2000-12-03 Kazu Hirata <kazu@hxi.com>
[deliverable/binutils-gdb.git] / gas / config / tc-i386.c
index 7aeea9a5ed45e5034a265968c5d4769bb43d19ef..5cf87bd0e2c4a85652cdf104d8b71e6bdf5f78ee 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "as.h"
 #include "subsegs.h"
+#include "dwarf2dbg.h"
 #include "opcode/i386.h"
 
 #ifndef REGISTER_WARNINGS
@@ -269,7 +270,7 @@ static unsigned int cpu_arch_flags = 0;
 #endif
 
 #define ENCODE_RELAX_STATE(type,size) \
-  ((relax_substateT)((type<<2) | (size)))
+  ((relax_substateT) ((type<<2) | (size)))
 #define SIZE_FROM_RELAX_STATE(s) \
     ( (((s) & 0x3) == BIG ? 4 : (((s) & 0x3) == BIG16 ? 2 : 1)) )
 
@@ -683,6 +684,8 @@ const pseudo_typeS md_pseudo_table[] =
   {"code32", set_16bit_code_flag, 0},
   {"intel_syntax", set_intel_syntax, 1},
   {"att_syntax", set_intel_syntax, 0},
+  {"file", dwarf2_directive_file, 0},
+  {"loc", dwarf2_directive_loc, 0},
   {0, 0, 0}
 };
 
@@ -1380,6 +1383,11 @@ md_assemble (line)
       {
        union i386_op temp_op;
        unsigned int temp_type;
+#ifdef BFD_ASSEMBLER
+       enum bfd_reloc_code_real temp_disp_reloc;
+#else
+       int temp_disp_reloc;
+#endif
        int xchg1 = 0;
        int xchg2 = 0;
 
@@ -1399,6 +1407,9 @@ md_assemble (line)
        temp_op = i.op[xchg2];
        i.op[xchg2] = i.op[xchg1];
        i.op[xchg1] = temp_op;
+       temp_disp_reloc = i.disp_reloc[xchg2];
+       i.disp_reloc[xchg2] = i.disp_reloc[xchg1];
+       i.disp_reloc[xchg1] = temp_disp_reloc;
 
        if (i.mem_operands == 2)
          {
@@ -2613,6 +2624,8 @@ md_assemble (line)
          }
       }
 
+    dwarf2_emit_insn (insn_size);
+
 #ifdef DEBUG386
     if (flag_debug)
       {
@@ -4186,7 +4199,6 @@ tc_coff_sizemachdep (frag)
 
    Initial production is 'expr'.
 
-
     addOp              + | -
 
     alpha              [a-zA-Z]
@@ -4252,7 +4264,6 @@ tc_coff_sizemachdep (frag)
                        | DR0 | DR1 | DR2 | DR3 | DR6 | DR7
                        | TR3 | TR4 | TR5 | TR6 | TR7
 
-
     We simplify the grammar in obvious places (e.g., register parsing is
     done by calling parse_register) and eliminate immediate left recursion
     to implement a recursive-descent parser.
@@ -4301,7 +4312,7 @@ struct intel_parser_s
   {
     char *op_string;           /* The string being parsed.  */
     int got_a_float;           /* Whether the operand is a float.  */
-    int op_modifier;           /* Operand modifier. */
+    int op_modifier;           /* Operand modifier.  */
     int is_mem;                        /* 1 if operand is memory reference.  */
     const reg_entry *reg;      /* Last register reference found.  */
     char *disp;                        /* Displacement string being built.  */
@@ -4348,7 +4359,6 @@ static int intel_e10              PARAMS ((void));
 static int intel_e10_1         PARAMS ((void));
 static int intel_e11           PARAMS ((void));
 
-
 static int
 i386_intel_operand (operand_string, got_a_float)
      char *operand_string;
@@ -4418,7 +4428,6 @@ i386_intel_operand (operand_string, got_a_float)
   return ret;
 }
 
-
 /* expr        SHORT e05
        | e05  */
 static int
@@ -4438,10 +4447,9 @@ intel_expr ()
     return intel_e05 ();
 }
 
-
 /* e05 e06 e05'
 
-   e05'        addOp e06 e05' 
+   e05'        addOp e06 e05'
        | Empty  */
 static int
 intel_e05 ()
@@ -4464,8 +4472,7 @@ intel_e05_1 ()
   /* e05'  Empty  */
   else
     return 1;
-} 
-
+}
 
 /* e06 e09 e06'
 
@@ -4488,13 +4495,12 @@ intel_e06_1 ()
 
       return (intel_e09 () && intel_e06_1 ());
     }
-  
+
   /* e06'  Empty  */
-  else 
+  else
     return 1;
 }
 
-
 /* e09 OFFSET e10 e09'
        | e10 e09'
 
@@ -4592,7 +4598,7 @@ intel_e10_1 ()
     {
       intel_match_token ('[');
       intel_parser.is_mem = 1;
-      
+
       /* Add a '+' to the displacement string if necessary.  */
       if (*intel_parser.disp != '\0')
        strcat (intel_parser.disp, "+");
@@ -4605,7 +4611,6 @@ intel_e10_1 ()
     return 1;
 }
 
-
 /* e11 ( expr )
        | [ expr ]
        | BYTE
@@ -4613,7 +4618,7 @@ intel_e10_1 ()
        | DWORD
        | QWORD
        | XWORD
-       | $ 
+       | $
        | .
        | register
        | id
@@ -4641,7 +4646,7 @@ intel_e11 ()
     {
       intel_match_token ('[');
       intel_parser.is_mem = 1;
-      
+
       /* Operands for jump/call inside brackets denote absolute addresses.  */
       if (current_templates->start->opcode_modifier & Jump
          || current_templates->start->opcode_modifier & JumpDword
@@ -4656,7 +4661,7 @@ intel_e11 ()
       return (intel_expr () && intel_match_token (']'));
     }
 
-  /* e11  BYTE 
+  /* e11  BYTE
          | WORD
          | DWORD
          | QWORD
@@ -4733,7 +4738,7 @@ intel_e11 ()
              return 0;
            }
 
-         /* What follows must be a valid scale. */
+         /* What follows must be a valid scale.  */
          if (intel_match_token ('*')
              && strchr ("01248", *cur_token.str))
            {
@@ -4776,7 +4781,7 @@ intel_e11 ()
         parsed as an immediate expression after we're done.  */
       else if (intel_parser.op_modifier == OFFSET_FLAT)
        strcat (intel_parser.disp, reg->reg_name);
-       
+
       /* It's neither base nor index nor offset.  */
       else
        {
@@ -4799,7 +4804,7 @@ intel_e11 ()
 
       return 1;
     }
-    
+
   /* e11  id  */
   else if (cur_token.code == T_ID)
     {
@@ -4838,7 +4843,7 @@ intel_e11 ()
 
       save_str = (char *)malloc (strlen (cur_token.str) + 1);
       if (save_str == NULL)
-       abort();
+       abort ();
       strcpy (save_str, cur_token.str);
 
       /* Get the next token to check for register scaling.  */
@@ -4855,7 +4860,7 @@ intel_e11 ()
                  return 0;
                }
 
-             /* The constant is followed by `* reg', so it must be 
+             /* The constant is followed by `* reg', so it must be
                 a valid scale.  */
              if (strchr ("01248", *save_str))
                {
@@ -4900,12 +4905,10 @@ intel_e11 ()
       return 1;
     }
 
-
   as_bad (_("Unrecognized token '%s'"), cur_token.str);
   return 0;
 }
 
-
 /* Match the given token against cur_token. If they match, read the next
    token from the operand string.  */
 static int
@@ -4924,7 +4927,6 @@ intel_match_token (code)
     }
 }
 
-
 /* Read a new token from intel_parser.op_string and store it in cur_token.  */
 static void
 intel_get_token ()
@@ -4937,7 +4939,7 @@ intel_get_token ()
   new_token.reg = NULL;
   new_token.str = NULL;
 
-  /* Free the memory allocated to the previous token and move 
+  /* Free the memory allocated to the previous token and move
      cur_token to prev_token.  */
   if (prev_token.str)
     free (prev_token.str);
@@ -4959,7 +4961,7 @@ intel_get_token ()
      string.  */
   new_token.str = (char *)malloc (strlen (intel_parser.op_string) + 1);
   if (new_token.str == NULL)
-    abort();
+    abort ();
   new_token.str[0] = '\0';
 
   if (strchr ("0123456789", *intel_parser.op_string))
@@ -4976,7 +4978,7 @@ intel_get_token ()
 
       /* Recognize special symbol names [0-9][bf].  */
       if (strlen (intel_parser.op_string) == 2
-         && (intel_parser.op_string[1] == 'b' 
+         && (intel_parser.op_string[1] == 'b'
              || intel_parser.op_string[1] == 'f'))
        new_token.code = T_ID;
     }
@@ -5070,7 +5072,6 @@ intel_get_token ()
   cur_token = new_token;
 }
 
-
 /* Put cur_token back into the token stream and make cur_token point to
    prev_token.  */
 static void
@@ -5079,7 +5080,7 @@ intel_putback_token ()
   intel_parser.op_string -= strlen (cur_token.str);
   free (cur_token.str);
   cur_token = prev_token;
-  
+
   /* Forget prev_token.  */
   prev_token.code = T_NIL;
   prev_token.reg = NULL;
This page took 0.027922 seconds and 4 git commands to generate.