[5/8] x86: re-order two fields of struct insn_template

Message ID 239c5270-69b7-7962-a330-21b1f2d963ac@suse.com
State New
Headers show
Series
  • x86: work towards further opcode table compaction
Related show

Commit Message

H.J. Lu via Binutils March 22, 2021, 4:44 p.m.
To facilitate a subsequent table parser change, re-order CPU flags and
opcode modifier fields. No functional change intended.

gas/
2021-03-XX  Jan Beulich  <jbeulich@suse.com>

	* config/tc-i386.c (output_i386_opcode): Invoke
	process_i386_cpu_flag() slightly later.
	(process_i386_opcodes): Likewise.

opcodes/
2021-03-XX  Jan Beulich  <jbeulich@suse.com>

	* i386-opc.h (struct insn_template): Move cpu_flags field past
	opcode_modifier one.
	* i386-tbl.h: Re-generate.

Comments

H.J. Lu via Binutils March 22, 2021, 6:03 p.m. | #1
On Mon, Mar 22, 2021 at 05:44:55PM +0100, Jan Beulich wrote:
> To facilitate a subsequent table parser change, re-order CPU flags and

> opcode modifier fields. No functional change intended.

> 

> gas/

> 2021-03-XX  Jan Beulich  <jbeulich@suse.com>

> 

> 	* config/tc-i386.c (output_i386_opcode): Invoke

> 	process_i386_cpu_flag() slightly later.

> 	(process_i386_opcodes): Likewise.

> 

> opcodes/

> 2021-03-XX  Jan Beulich  <jbeulich@suse.com>

> 

> 	* i386-opc.h (struct insn_template): Move cpu_flags field past

> 	opcode_modifier one.

> 	* i386-tbl.h: Re-generate.

> 


OK.  Thanks.

H.J.

Patch

--- a/opcodes/i386-gen.c
+++ b/opcodes/i386-gen.c
@@ -1410,8 +1410,6 @@  output_i386_opcode (FILE *table, const c
   fprintf (table, "  { \"%s\", %s, %s, %s, %u,\n",
 	   name, base_opcode, extension_opcode, opcode_length, i);
 
-  process_i386_cpu_flag (table, cpu_flags, 0, ",", "    ", lineno);
-
   if (process_i386_opcode_modifier (table, opcode_modifier,
 				    operand_types, lineno))
     {
@@ -1449,6 +1447,8 @@  output_i386_opcode (FILE *table, const c
 	}
     }
 
+  process_i386_cpu_flag (table, cpu_flags, 0, ",", "    ", lineno);
+
   fprintf (table, "    { ");
 
   for (i = 0; i < ARRAY_SIZE (operand_types); i++)
@@ -1836,10 +1836,10 @@  process_i386_opcodes (FILE *table)
 
   fprintf (table, "  { NULL, 0, 0, 0, 0,\n");
 
-  process_i386_cpu_flag (table, "0", 0, ",", "    ", -1);
-
   process_i386_opcode_modifier (table, "0", NULL, -1);
 
+  process_i386_cpu_flag (table, "0", 0, ",", "    ", -1);
+
   fprintf (table, "    { ");
   process_i386_operand_type (table, "0", stage_opcodes, "\t  ", -1);
   fprintf (table, " } }\n");
--- a/opcodes/i386-opc.h
+++ b/opcodes/i386-opc.h
@@ -951,14 +951,14 @@  typedef struct insn_template
   /* how many operands */
   unsigned char operands;
 
-  /* cpu feature flags */
-  i386_cpu_flags cpu_flags;
-
   /* the bits in opcode_modifier are used to generate the final opcode from
      the base_opcode.  These bits also are used to detect alternate forms of
      the same instruction */
   i386_opcode_modifier opcode_modifier;
 
+  /* cpu feature flags */
+  i386_cpu_flags cpu_flags;
+
   /* operand_types[i] describes the type of operand i.  This is made
      by OR'ing together all of the possible type masks.  (e.g.
      'operand_types[i] = Reg|Imm' specifies that operand i can be