OSDN Git Service

gas/
authorhjl <hjl>
Thu, 15 Mar 2007 17:30:29 +0000 (17:30 +0000)
committerhjl <hjl>
Thu, 15 Mar 2007 17:30:29 +0000 (17:30 +0000)
2007-03-15  H.J. Lu  <hongjiu.lu@intel.com>

* config/tc-i386.c (md_begin): Use i386_regtab_size to scan
i386_regtab.
(parse_register): Use i386_regtab_size instead of ARRAY_SIZE
on i386_regtab.

opcodes/

2007-03-15  H.J. Lu  <hongjiu.lu@intel.com>

* i386-opc.c: Include "libiberty.h".
(i386_regtab): Remove the last entry.
(i386_regtab_size): New.
(i386_float_regtab_size): Likewise.

* i386-opc.h (i386_regtab_size): New.
(i386_float_regtab_size): Likewise.

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

index da20b24..24ac6e7 100644 (file)
@@ -1,3 +1,10 @@
+2007-03-15  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * config/tc-i386.c (md_begin): Use i386_regtab_size to scan 
+       i386_regtab.
+       (parse_register): Use i386_regtab_size instead of ARRAY_SIZE
+       on i386_regtab.
+
 2007-03-15  Alexandre Oliva  <aoliva@redhat.com>
 
        PR gas/4184
index 26684c8..0f3077c 100644 (file)
@@ -1238,8 +1238,9 @@ md_begin ()
   reg_hash = hash_new ();
   {
     const reg_entry *regtab;
+    unsigned int regtab_size = i386_regtab_size;
 
-    for (regtab = i386_regtab; regtab->reg_name != NULL; regtab++)
+    for (regtab = i386_regtab; regtab_size--; regtab++)
       {
        hash_err = hash_insert (reg_hash, regtab->reg_name, (PTR) regtab);
        if (hash_err)
@@ -5791,7 +5792,7 @@ parse_register (char *reg_string, char **end_op)
 
          know (e->X_op == O_register);
          know (e->X_add_number >= 0
-               && (valueT) e->X_add_number < ARRAY_SIZE (i386_regtab));
+               && (valueT) e->X_add_number < i386_regtab_size);
          r = i386_regtab + e->X_add_number;
          *end_op = input_line_pointer;
        }
index a478d04..3d0b34f 100644 (file)
@@ -1,5 +1,15 @@
 2007-03-15  H.J. Lu  <hongjiu.lu@intel.com>
 
+       * i386-opc.c: Include "libiberty.h".
+       (i386_regtab): Remove the last entry.
+       (i386_regtab_size): New.
+       (i386_float_regtab_size): Likewise.
+
+       * i386-opc.h (i386_regtab_size): New.
+       (i386_float_regtab_size): Likewise.
+
+2007-03-15  H.J. Lu  <hongjiu.lu@intel.com>
+
        * Makefile.am (CFILES): Add i386-opc.c.
        (ALL_MACHINES): Add i386-opc.lo.
        Run "make dep-am".
index 05de431..9c96113 100644 (file)
@@ -19,6 +19,7 @@
    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 #include "sysdep.h"
+#include "libiberty.h"
 #include "i386-opc.h"
 
 const template i386_optab[] =
@@ -1631,11 +1632,10 @@ const reg_entry i386_regtab[] =
   /* No type will make this register rejected for all purposes except
      for addressing.  This saves creating one extra type for RIP.  */
   {"rip", BaseIndex, 0, 0},
-
-  /* sentinel */
-  {NULL, 0, 0, 0}
 };
 
+const unsigned int i386_regtab_size = ARRAY_SIZE (i386_regtab);
+
 const reg_entry i386_float_regtab[] =
 {
   {"st(0)", FloatReg|FloatAcc, 0, 0},
@@ -1648,6 +1648,8 @@ const reg_entry i386_float_regtab[] =
   {"st(7)", FloatReg, 0, 7}
 };
 
+const unsigned int i386_float_regtab_size = ARRAY_SIZE (i386_float_regtab);
+
 /* Segment stuff.  */
 const seg_entry cs = { "cs", 0x2e };
 const seg_entry ds = { "ds", 0x3e };
index f944b9d..83211dd 100644 (file)
@@ -214,7 +214,9 @@ reg_entry;
 #define REGNAM_EAX 41
 
 extern const reg_entry i386_regtab[];
+extern const unsigned int i386_regtab_size;
 extern const reg_entry i386_float_regtab[];
+extern const unsigned int i386_float_regtab_size;
 
 typedef struct
 {