[binutils-gdb] x86: embed register names in reg_entry

Jan Beulich jbeulich@sourceware.org
Fri Jan 20 09:19:22 GMT 2023


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=edf772580db29fdddc54deef72d3ddda00c21286

commit edf772580db29fdddc54deef72d3ddda00c21286
Author: Jan Beulich <jbeulich@suse.com>
Date:   Fri Jan 20 10:17:53 2023 +0100

    x86: embed register names in reg_entry
    
    Register names are (including their nul terminators) on average almost 4
    bytes long. Otoh no register name is longer than 7 bytes. Hence even for
    32-bit builds using a pointer is only slightly more space efficient than
    embedding the strings. A level of indirection can be also avoided by
    embedding the names as an array of 8 characters directly in the struct,
    and the number of base relocations in PIE builds of gas goes down as
    well.

Diff:
---
 opcodes/i386-opc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/opcodes/i386-opc.h b/opcodes/i386-opc.h
index ebedb3e6f5f..6739d494cc5 100644
--- a/opcodes/i386-opc.h
+++ b/opcodes/i386-opc.h
@@ -987,7 +987,7 @@ insn_template;
 /* these are for register name --> number & type hash lookup */
 typedef struct
 {
-  const char *reg_name;
+  char reg_name[8];
   i386_operand_type reg_type;
   unsigned char reg_flags;
 #define RegRex	    0x1  /* Extended register.  */


More information about the Binutils-cvs mailing list