* lib/java.exp (java_init): Ignore $GCJ if it is empty.
[deliverable/binutils-gdb.git] / opcodes / i386-gen.c
index b0fe00d2d2428a6a69795dddc3843ed092817bb5..8c59a02c3c1eb3122f452cf0f359afc0a04cfa82 100644 (file)
@@ -40,14 +40,14 @@ typedef struct initializer
   const char *init;
 } initializer;
 
-static initializer cpu_flag_init [] =
+static initializer cpu_flag_init[] =
 {
   { "CPU_UNKNOWN_FLAGS",
     "unknown" },
   { "CPU_GENERIC32_FLAGS",
     "Cpu186|Cpu286|Cpu386" },
   { "CPU_GENERIC64_FLAGS", 
-    "Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuP4|CpuMMX|CpuSSE|CpuSSE2|CpuLM" },
+    "Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuClflush|CpuMMX|CpuSSE|CpuSSE2|CpuLM" },
   { "CPU_NONE_FLAGS",
    "0" },
   { "CPU_I186_FLAGS",
@@ -67,23 +67,29 @@ static initializer cpu_flag_init [] =
   { "CPU_P3_FLAGS",
     "Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuMMX|CpuSSE" },
   { "CPU_P4_FLAGS",
-    "Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuP4|CpuMMX|CpuSSE|CpuSSE2" },
+    "Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuClflush|CpuMMX|CpuSSE|CpuSSE2" },
   { "CPU_NOCONA_FLAGS",
-    "Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuP4|CpuMMX|CpuSSE|CpuSSE2|CpuSSE3|CpuLM" },
+    "Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuClflush|CpuMMX|CpuSSE|CpuSSE2|CpuSSE3|CpuLM" },
   { "CPU_CORE_FLAGS",
-    "Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuP4|CpuMMX|CpuSSE|CpuSSE2|CpuSSE3" },
+    "Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuClflush|CpuMMX|CpuSSE|CpuSSE2|CpuSSE3" },
   { "CPU_CORE2_FLAGS",
-    "Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuP4|CpuMMX|CpuSSE|CpuSSE2|CpuSSE3|CpuSSSE3|CpuLM" },
+    "Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuClflush|CpuMMX|CpuSSE|CpuSSE2|CpuSSE3|CpuSSSE3|CpuLM" },
+  { "CPU_COREI7_FLAGS",
+    "Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuClflush|CpuMMX|CpuSSE|CpuSSE2|CpuSSE3|CpuSSSE3|CpuSSE4_1|CpuSSE4_2|CpuRdtscp|CpuLM" },
   { "CPU_K6_FLAGS",
-    "Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|CpuK6|CpuMMX" },
+    "Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|CpuSYSCALL|CpuMMX" },
   { "CPU_K6_2_FLAGS",
-    "Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|CpuK6|CpuMMX|Cpu3dnow" },
+    "Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|CpuSYSCALL|CpuMMX|Cpu3dnow" },
   { "CPU_ATHLON_FLAGS",
-    "Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuK6|CpuMMX|Cpu3dnow|Cpu3dnowA" },
+    "Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuSYSCALL|CpuMMX|Cpu3dnow|Cpu3dnowA" },
   { "CPU_K8_FLAGS",
-    "Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuK6|CpuK8|CpuMMX|Cpu3dnow|Cpu3dnowA|CpuSSE|CpuSSE2|CpuRdtscp|CpuLM" },
+    "Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuSYSCALL|CpuRdtscp|CpuMMX|Cpu3dnow|Cpu3dnowA|CpuSSE|CpuSSE2|CpuLM" },
   { "CPU_AMDFAM10_FLAGS",
-    "Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuK6|CpuK8|CpuMMX|Cpu3dnow|Cpu3dnowA|CpuSSE|CpuSSE2|CpuSSE3|CpuSSE4a|CpuABM|CpuRdtscp|CpuLM" },
+    "Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuSYSCALL|CpuRdtscp|CpuMMX|Cpu3dnow|Cpu3dnowA|CpuSSE|CpuSSE2|CpuSSE3|CpuSSE4a|CpuABM|CpuLM" },
+  { "CPU_CLFLUSH_FLAGS",
+    "CpuClflush" },
+  { "CPU_SYSCALL_FLAGS",
+    "CpuSYSCALL" },
   { "CPU_MMX_FLAGS",
     "CpuMMX" },
   { "CPU_SSE_FLAGS",
@@ -128,13 +134,11 @@ static initializer cpu_flag_init [] =
     "CpuMMX|CpuSSE|CpuSSE2|CpuSSE3|CpuSSE4a" },
   { "CPU_ABM_FLAGS",
     "CpuABM" },
-  { "CPU_SSE5_FLAGS",
-    "CpuMMX|CpuSSE|CpuSSE2|CpuSSE3|CpuSSE4a|CpuABM|CpuSSE5"},
   { "CPU_AVX_FLAGS",
     "CpuMMX|CpuSSE|CpuSSE2|CpuSSE3|CpuSSSE3|CpuSSE4_1|CpuSSE4_2|CpuAVX" },
 };
 
-static initializer operand_type_init [] =
+static initializer operand_type_init[] =
 {
   { "OPERAND_TYPE_NONE",
     "0" },
@@ -228,8 +232,6 @@ static initializer operand_type_init [] =
     "Imm32|Imm32S|Imm64|Disp32" },
   { "OPERAND_TYPE_IMM32_32S_64_DISP32_64",
     "Imm32|Imm32S|Imm64|Disp32|Disp64" },
-  { "OPERAND_TYPE_VEX_IMM4",
-    "VEX_Imm4" },
 };
 
 typedef struct bitfield
@@ -249,9 +251,8 @@ static bitfield cpu_flags[] =
   BITFIELD (Cpu486),
   BITFIELD (Cpu586),
   BITFIELD (Cpu686),
-  BITFIELD (CpuP4),
-  BITFIELD (CpuK6),
-  BITFIELD (CpuK8),
+  BITFIELD (CpuClflush),
+  BITFIELD (CpuSYSCALL),
   BITFIELD (CpuMMX),
   BITFIELD (CpuSSE),
   BITFIELD (CpuSSE2),
@@ -261,7 +262,6 @@ static bitfield cpu_flags[] =
   BITFIELD (CpuSSE4_2),
   BITFIELD (CpuAVX),
   BITFIELD (CpuSSE4a),
-  BITFIELD (CpuSSE5),
   BITFIELD (Cpu3dnow),
   BITFIELD (Cpu3dnowA),
   BITFIELD (CpuPadLock),
@@ -323,9 +323,6 @@ static bitfield opcode_modifiers[] =
   BITFIELD (NoRex64),
   BITFIELD (Rex64),
   BITFIELD (Ugh),
-  BITFIELD (Drex),
-  BITFIELD (Drexv),
-  BITFIELD (Drexc),
   BITFIELD (Vex),
   BITFIELD (Vex256),
   BITFIELD (VexNDS),
@@ -391,13 +388,11 @@ static bitfield operand_types[] =
   BITFIELD (Ymmword),
   BITFIELD (Unspecified),
   BITFIELD (Anysize),
-  BITFIELD (Vex_Imm4),
 #ifdef OTUnused
   BITFIELD (OTUnused),
 #endif
 };
 
-static int lineno;
 static const char *filename;
 
 static int
@@ -499,7 +494,7 @@ next_field (char *str, char sep, char **next, char *last)
 }
 
 static void
-set_bitfield (const char *f, bitfield *array, unsigned int size)
+set_bitfield (const char *f, bitfield *array, unsigned int size, int lineno)
 {
   unsigned int i;
 
@@ -515,7 +510,10 @@ set_bitfield (const char *f, bitfield *array, unsigned int size)
        return;
       }
 
-  fail (_("%s: %d: Unknown bitfield: %s\n"), filename, lineno, f);
+  if (lineno != -1)
+    fail (_("%s: %d: Unknown bitfield: %s\n"), filename, lineno, f);
+  else
+    fail (_("Unknown bitfield: %s\n"), f);
 }
 
 static void
@@ -544,7 +542,8 @@ output_cpu_flags (FILE *table, bitfield *flags, unsigned int size,
 
 static void
 process_i386_cpu_flag (FILE *table, char *flag, int macro,
-                      const char *comma, const char *indent)
+                      const char *comma, const char *indent,
+                      int lineno)
 {
   char *str, *next, *last;
   bitfield flags [ARRAY_SIZE (cpu_flags)];
@@ -569,7 +568,7 @@ process_i386_cpu_flag (FILE *table, char *flag, int macro,
        {
          str = next_field (next, '|', &next, last);
          if (str)
-           set_bitfield (str, flags, ARRAY_SIZE (flags));
+           set_bitfield (str, flags, ARRAY_SIZE (flags), lineno);
        }
     }
 
@@ -595,7 +594,7 @@ output_opcode_modifier (FILE *table, bitfield *modifier, unsigned int size)
 }
 
 static void
-process_i386_opcode_modifier (FILE *table, char *mod)
+process_i386_opcode_modifier (FILE *table, char *mod, int lineno)
 {
   char *str, *next, *last;
   bitfield modifiers [ARRAY_SIZE (opcode_modifiers)];
@@ -610,7 +609,7 @@ process_i386_opcode_modifier (FILE *table, char *mod)
        {
          str = next_field (next, '|', &next, last);
          if (str)
-           set_bitfield (str, modifiers, ARRAY_SIZE (modifiers));
+           set_bitfield (str, modifiers, ARRAY_SIZE (modifiers), lineno);
        }
     }
   output_opcode_modifier (table, modifiers, ARRAY_SIZE (modifiers));
@@ -642,7 +641,7 @@ output_operand_type (FILE *table, bitfield *types, unsigned int size,
 
 static void
 process_i386_operand_type (FILE *table, char *op, int macro,
-                          const char *indent)
+                          const char *indent, int lineno)
 {
   char *str, *next, *last;
   bitfield types [ARRAY_SIZE (operand_types)];
@@ -657,7 +656,7 @@ process_i386_operand_type (FILE *table, char *op, int macro,
        {
          str = next_field (next, '|', &next, last);
          if (str)
-           set_bitfield (str, types, ARRAY_SIZE (types));
+           set_bitfield (str, types, ARRAY_SIZE (types), lineno);
        }
     }
   output_operand_type (table, types, ARRAY_SIZE (types), macro,
@@ -666,7 +665,7 @@ process_i386_operand_type (FILE *table, char *op, int macro,
 
 static void
 output_i386_opcode (FILE *table, const char *name, char *str,
-                   char *last)
+                   char *last, int lineno)
 {
   unsigned int i;
   char *operands, *base_opcode, *extension_opcode, *opcode_length;
@@ -737,9 +736,9 @@ output_i386_opcode (FILE *table, const char *name, char *str,
           name, operands, base_opcode, extension_opcode,
           opcode_length);
 
-  process_i386_cpu_flag (table, cpu_flags, 0, ",", "    ");
+  process_i386_cpu_flag (table, cpu_flags, 0, ",", "    ", lineno);
 
-  process_i386_opcode_modifier (table, opcode_modifier);
+  process_i386_opcode_modifier (table, opcode_modifier, lineno);
 
   fprintf (table, "    { ");
 
@@ -748,7 +747,7 @@ output_i386_opcode (FILE *table, const char *name, char *str,
       if (operand_types[i] == NULL || *operand_types[i] == '0')
        {
          if (i == 0)
-           process_i386_operand_type (table, "0", 0, "\t  ");
+           process_i386_operand_type (table, "0", 0, "\t  ", lineno);
          break;
        }
 
@@ -756,7 +755,7 @@ output_i386_opcode (FILE *table, const char *name, char *str,
        fprintf (table, ",\n      ");
 
       process_i386_operand_type (table, operand_types[i], 0,
-                                "\t  ");
+                                "\t  ", lineno);
     }
   fprintf (table, " } },\n");
 }
@@ -766,6 +765,7 @@ struct opcode_hash_entry
   struct opcode_hash_entry *next;
   char *name;
   char *opcode;
+  int lineno;
 };
 
 /* Calculate the hash value of an opcode hash entry P.  */
@@ -798,6 +798,7 @@ process_i386_opcodes (FILE *table)
   htab_t opcode_hash_table;
   struct opcode_hash_entry **opcode_array;
   unsigned int opcode_array_size = 1024;
+  int lineno = 0;
 
   filename = "i386-opc.tbl";
   fp = fopen (filename, "r");
@@ -874,6 +875,7 @@ process_i386_opcodes (FILE *table)
          opcode_array[i]->next = NULL;
          opcode_array[i]->name = xstrdup (name);
          opcode_array[i]->opcode = xstrdup (str);
+         opcode_array[i]->lineno = lineno;
          *hash_slot = opcode_array[i];
          i++;
        }
@@ -888,6 +890,7 @@ process_i386_opcodes (FILE *table)
          (*entry)->next = NULL;
          (*entry)->name = (*hash_slot)->name;
          (*entry)->opcode = xstrdup (str);
+         (*entry)->lineno = lineno;
        }
     }
 
@@ -898,8 +901,9 @@ process_i386_opcodes (FILE *table)
        {
          name = next->name;
          str = next->opcode;
+         lineno = next->lineno;
          last = str + strlen (str);
-         output_i386_opcode (table, name, str, last);
+         output_i386_opcode (table, name, str, last, lineno);
        }
     }
 
@@ -907,12 +911,12 @@ process_i386_opcodes (FILE *table)
 
   fprintf (table, "  { NULL, 0, 0, 0, 0,\n");
 
-  process_i386_cpu_flag (table, "0", 0, ",", "    ");
+  process_i386_cpu_flag (table, "0", 0, ",", "    ", -1);
 
-  process_i386_opcode_modifier (table, "0");
+  process_i386_opcode_modifier (table, "0", -1);
  
   fprintf (table, "    { ");
-  process_i386_operand_type (table, "0", 0, "\t  ");
+  process_i386_operand_type (table, "0", 0, "\t  ", -1);
   fprintf (table, " } }\n");
 
   fprintf (table, "};\n");
@@ -926,6 +930,7 @@ process_i386_registers (FILE *table)
   char *str, *p, *last;
   char *reg_name, *reg_type, *reg_flags, *reg_num;
   char *dw2_32_num, *dw2_64_num;
+  int lineno = 0;
 
   filename = "i386-reg.tbl";
   fp = fopen (filename, "r");
@@ -980,7 +985,7 @@ process_i386_registers (FILE *table)
 
       fprintf (table, "  { \"%s\",\n    ", reg_name);
 
-      process_i386_operand_type (table, reg_type, 0, "\t");
+      process_i386_operand_type (table, reg_type, 0, "\t", lineno);
 
       /* Find 32-bit Dwarf2 register number.  */
       dw2_32_num = next_field (str, ',', &str, last);
@@ -1016,7 +1021,7 @@ process_i386_initializers (void)
     {
       fprintf (fp, "\n#define %s \\\n", cpu_flag_init[i].name);
       init = xstrdup (cpu_flag_init[i].init);
-      process_i386_cpu_flag (fp, init, 1, "", "  ");
+      process_i386_cpu_flag (fp, init, 1, "", "  ", -1);
       free (init);
     }
 
@@ -1024,7 +1029,7 @@ process_i386_initializers (void)
     {
       fprintf (fp, "\n\n#define %s \\\n  ", operand_type_init[i].name);
       init = xstrdup (operand_type_init[i].init);
-      process_i386_operand_type (fp, init, 1, "      ");
+      process_i386_operand_type (fp, init, 1, "      ", -1);
       free (init);
     }
   fprintf (fp, "\n");
This page took 0.029552 seconds and 4 git commands to generate.