2000-12-03 Kazu Hirata <kazu@hxi.com>
[deliverable/binutils-gdb.git] / gas / config / tc-m68hc11.c
index 94b193ffe7d080615cd8417689adec32779d5a54..81311084c4717cb694ca3f3392edc480c255a4a9 100644 (file)
@@ -26,8 +26,6 @@
 #include "opcode/m68hc11.h"
 #include "dwarf2dbg.h"
 
-struct dwarf2_line_info debug_line;
-
 const char comment_chars[] = ";!";
 const char line_comment_chars[] = "#*";
 const char line_separator_chars[] = "";
@@ -1075,6 +1073,8 @@ get_operand (oper, which, opmode)
 
       if (*p == ',')
        {
+          int possible_mode = M6811_OP_NONE;
+          char *old_input_line;
          p++;
 
          /* 68HC12 pre increment or decrement.  */
@@ -1082,23 +1082,37 @@ get_operand (oper, which, opmode)
            {
              if (*p == '-')
                {
-                 mode = M6812_PRE_DEC;
+                 possible_mode = M6812_PRE_DEC;
                  p++;
-                 if (current_architecture & cpu6811)
-                   as_bad (_("Pre-decrement mode is not valid for 68HC11"));
                }
              else if (*p == '+')
                {
-                 mode = M6812_PRE_INC;
+                 possible_mode = M6812_PRE_INC;
                  p++;
-                 if (current_architecture & cpu6811)
-                   as_bad (_("Pre-increment mode is not valid for 68HC11"));
                }
              p = skip_whites (p);
            }
+          old_input_line = input_line_pointer;
          input_line_pointer = p;
          reg = register_name ();
 
+          /* Backtrack if we have a valid constant expression and
+             it does not correspond to the offset of the 68HC12 indexed
+             addressing mode (as in N,x).  */
+          if (reg == REG_NONE && mode == M6811_OP_NONE
+              && possible_mode != M6811_OP_NONE)
+            {
+              oper->mode = M6811_OP_IND16 | M6811_OP_JUMP_REL;
+              input_line_pointer = skip_whites (old_input_line);
+              return 1;
+            }
+
+          if (possible_mode != M6811_OP_NONE)
+            mode = possible_mode;
+
+          if ((current_architecture & cpu6811)
+              && possible_mode != M6811_OP_NONE)
+            as_bad (_("Pre-increment mode is not valid for 68HC11"));
          /* Backtrack.  */
          if (which == 0 && opmode & M6812_OP_IDX_P2
              && reg != REG_X && reg != REG_Y
@@ -1373,15 +1387,8 @@ m68hc11_new_insn (size)
 
   f = frag_more (size);
 
-  /* Emit line number information in dwarf2 debug sections.  */
-  if (debug_type == DEBUG_DWARF2)
-    {
-      bfd_vma addr;
+  dwarf2_emit_insn (size);
 
-      dwarf2_where (&debug_line);
-      addr = frag_now->fr_address + frag_now_fix () - size;
-      dwarf2_gen_line_info (addr, &debug_line);
-    }
   return f;
 }
 
@@ -1709,7 +1716,8 @@ build_indexed_byte (op, format, move_insn)
 
          if (move_insn && !(val >= -16 && val <= 15))
            {
-             as_bad (_("Offset out of 5-bit range for movw/movb insn."));
+             as_bad (_("Offset out of 5-bit range for movw/movb insn: %ld."),
+                      val);
              return -1;
            }
 
@@ -2181,7 +2189,7 @@ find_opcode (opc, operands, nb_operands)
       if (*input_line_pointer == ',')
        input_line_pointer++;
     }
-  
+
   return 0;
 }
 
@@ -2767,7 +2775,7 @@ md_apply_fix (fixp, valuep)
       as_fatal (_("Line %d: unknown relocation type: 0x%x."),
                fixp->fx_line, fixp->fx_r_type);
     }
-  
+
   return 0;
 }
 
@@ -2776,38 +2784,3 @@ m68hc11_cleanup ()
 {
   return 1;
 }
-
-void
-m68hc11_end_of_source ()
-{
-  segT saved_seg;
-  subsegT saved_subseg;
-  segT debug_info;
-  char *p;
-  long total_size = 0;
-
-  if (debug_type != DEBUG_DWARF2)
-    return;
-
-  dwarf2_finish ();
-
-  saved_seg = now_seg;
-  saved_subseg = now_subseg;
-
-  debug_info = subseg_new (".debug_info", 0);
-  bfd_set_section_flags (stdoutput, debug_info, SEC_READONLY);
-  subseg_set (debug_info, 0);
-  p = frag_more (10);
-  total_size = 12;
-
-# define STUFF(val,size)       md_number_to_chars (p, val, size); p += size;
-  STUFF (total_size, 4); /* Length of compilation unit.  */
-  STUFF (2, 2); /* Dwarf version */
-  STUFF (0, 4);
-  STUFF (2, 1); /* Pointer size */
-  STUFF (1, 1); /* Compile unit */
-  STUFF (0, 4);
-
-  now_subseg = saved_subseg;
-  now_seg = saved_seg;
-}
This page took 0.024419 seconds and 4 git commands to generate.