]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
x86: shrink some struct insn_template fields
authorJan Beulich <jbeulich@suse.com>
Mon, 29 Mar 2021 10:03:31 +0000 (12:03 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 29 Mar 2021 10:03:31 +0000 (12:03 +0200)
Now that all base opcodes are only at most 2 bytes in size, shrink its
template field to just as much. By also shrinking extension_opcode and
operands to just what they really need, we can free up an entire 32-bit
slot (plus 4 left bits past the bitfields themselves).

At present this alters sizeof(struct insn_template) only for 32-bit
builds. In 64-bit builds it instead leaves a padding hole that will
allow to buffer future growth of other fields (opcode_modifier,
cpu_flags, operand_types[]).

opcodes/ChangeLog
opcodes/i386-opc.h

index 82a1c5cdb927579fe72e5c79475d03b3ef77b155..ff0ecf3bddc8f42d0eb164669b1ffb8e54e639c5 100644 (file)
@@ -1,3 +1,9 @@
+2021-03-29  Jan Beulich  <jbeulich@suse.com>
+
+       * i386-opc.h (struct insn_template): Shrink base_opcode to 16
+       bits. Shrink extension_opcode to 9 bits. Make it signed. Change
+       value of None. Shrink operands to 3 bits.
+
 2021-03-29  Jan Beulich  <jbeulich@suse.com>
 
        * i386-gen.c (process_i386_opcode_modifier): New parameter
index 9ed0793bdbaca0f6a12ad78950bcfa596ed02fbf..115895c65ed0cb5ba8b59569109611ffb69e0c87 100644 (file)
@@ -917,7 +917,7 @@ typedef struct insn_template
 
   /* base_opcode is the fundamental opcode byte without optional
      prefix(es).  */
-  unsigned int base_opcode;
+  unsigned int base_opcode:16;
 #define Opcode_D       0x2 /* Direction bit:
                               set if Reg --> Regmem;
                               unset if Regmem --> Reg. */
@@ -934,8 +934,8 @@ typedef struct insn_template
      AMD 3DNow! instructions.
      If this template has no extension opcode (the usual case) use None
      Instructions */
-  unsigned short extension_opcode;
-#define None 0xffff            /* If no extension_opcode is possible.  */
+  signed int extension_opcode:9;
+#define None (-1)              /* If no extension_opcode is possible.  */
 
 /* Pseudo prefixes.  */
 #define Prefix_Disp8           0       /* {disp8} */
@@ -950,7 +950,7 @@ typedef struct insn_template
 #define Prefix_NoOptimize      9       /* {nooptimize} */
 
   /* how many operands */
-  unsigned char operands;
+  unsigned int operands:3;
 
   /* 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