]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
x86: drop REGNAM_{AL,AX,EAX}
authorJan Beulich <jbeulich@suse.com>
Tue, 30 Mar 2021 12:08:48 +0000 (14:08 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 30 Mar 2021 12:08:48 +0000 (14:08 +0200)
The former two are unused anyway. And having such constants isn't very
helpful either, when they live in a place where updating the register
table wouldn't even allow noticing the need to adjust these constants.

gas/ChangeLog
gas/config/tc-i386-intel.c
gas/config/tc-i386.c
opcodes/ChangeLog
opcodes/i386-opc.h

index 468be74256c76da7dc76a290b30a88bafed2fb7b..210a93858d462c1f428799d6d965e38795864c99 100644 (file)
@@ -1,3 +1,11 @@
+2021-03-30  Jan Beulich  <jbeulich@suse.com>
+
+       * config/tc-i386.c (reg_eax): New.
+       (md_begin): Initialize reg_eax.
+       * config/tc-i386-intel.c (i386_intel_simplify_register): Use
+       reg_eax.
+       (i386_intel_simplify): Likewise.
+
 2021-03-30  Jan Beulich  <jbeulich@suse.com>
 
        * config/tc-i386.c (reg_st0): New.
index 4c9f0b705203c52de632545b16d601b708e69012..e61e7572fc93d3b4914219a3636a093fb4a584c7 100644 (file)
@@ -335,7 +335,7 @@ i386_intel_simplify_register (expressionS *e)
   else
     {
       /* esp is invalid as index */
-      intel_state.index = i386_regtab + REGNAM_EAX + ESP_REG_NUM;
+      intel_state.index = reg_eax + ESP_REG_NUM;
     }
   return 2;
 }
@@ -500,7 +500,7 @@ static int i386_intel_simplify (expressionS *e)
                break;
              default:
                /* esp is invalid as index */
-               intel_state.index = i386_regtab + REGNAM_EAX + ESP_REG_NUM;
+               intel_state.index = reg_eax + ESP_REG_NUM;
                break;
              }
 
index 3a7d50484ff49b8bda3c69eb2407af8971f431e1..7fa31dab553201bf81207a74ffd8f5c3d0bf7bfe 100644 (file)
@@ -214,6 +214,7 @@ static const char *default_arch = DEFAULT_ARCH;
 static const reg_entry bad_reg = { "<bad>", OPERAND_TYPE_NONE, 0, 0,
                                   { Dw2Inval, Dw2Inval } };
 
+static const reg_entry *reg_eax;
 static const reg_entry *reg_st0;
 static const reg_entry *reg_k0;
 
@@ -3091,7 +3092,12 @@ md_begin (void)
        switch (regtab->reg_type.bitfield.class)
          {
          case Reg:
-           if (regtab->reg_type.bitfield.tbyte)
+           if (regtab->reg_type.bitfield.dword)
+             {
+               if (regtab->reg_type.bitfield.instance == Accum)
+                 reg_eax = regtab;
+             }
+           else if (regtab->reg_type.bitfield.tbyte)
              {
                /* There's no point inserting st(<N>) in the hash table, as
                   parentheses aren't included in register_chars[] anyway.  */
index 5acb021fa48f8026ce7ba46a590ac418d3c5daad..fb5b8c75ecf3707626c4c77c4b386d1919fd6357 100644 (file)
@@ -1,3 +1,7 @@
+2021-03-30  Jan Beulich  <jbeulich@suse.com>
+
+       * i386-opc.h (REGNAM_AL, REGNAM_AX, REGNAM_EAX): Delete.
+
 2021-03-30  Jan Beulich  <jbeulich@suse.com>
 
        * i386-opc.h (REGNAM_AL, REGNAM_AX, REGNAM_EAX): Adjust values.
index a2a657eeda0e34498efd264496f65e501fb4661e..9c451defc934215a49ff4c29a19dfeb4d6994f53 100644 (file)
@@ -990,11 +990,6 @@ typedef struct
 }
 reg_entry;
 
-/* Entries in i386_regtab.  */
-#define REGNAM_AL 0
-#define REGNAM_AX 24
-#define REGNAM_EAX 40
-
 extern const reg_entry i386_regtab[];
 extern const unsigned int i386_regtab_size;