aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2022-12-12 08:49:00 +0100
committerJan Beulich <jbeulich@suse.com>2022-12-12 08:49:00 +0100
commitdaf15e3e96bf99ec5d3d8a610c3cf44bcc5b1cf1 (patch)
tree08118ddc3d9eef95a693865c2203e153a34d87fa
parent313095ba2d898d46b768ddc804707b17212567ee (diff)
downloadfsf-binutils-gdb-daf15e3e96bf99ec5d3d8a610c3cf44bcc5b1cf1.zip
fsf-binutils-gdb-daf15e3e96bf99ec5d3d8a610c3cf44bcc5b1cf1.tar.gz
fsf-binutils-gdb-daf15e3e96bf99ec5d3d8a610c3cf44bcc5b1cf1.tar.bz2
x86: drop sentinel from i386_optab[]
Now that the table is local to gas, ARRAY_SIZE() can be used to determine the end of the table. Re-arrange the processing loop in md_begin() accordingly, at the same time folding the two calls to notes_alloc() into just one.
-rw-r--r--gas/config/tc-i386.c33
-rw-r--r--opcodes/i386-gen.c10
-rw-r--r--opcodes/i386-tbl.h13
3 files changed, 11 insertions, 45 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index e68ff2f..fce8631 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -2973,31 +2973,20 @@ md_begin (void)
op_hash = str_htab_create ();
{
- const insn_template *optab;
- templates *core_optab;
+ const insn_template *optab = i386_optab;
+ const insn_template *end = optab + ARRAY_SIZE (i386_optab);
- /* Setup for loop. */
- optab = i386_optab;
- core_optab = notes_alloc (sizeof (*core_optab));
- core_optab->start = optab;
-
- while (1)
+ while (optab < end)
{
- ++optab;
- if (optab->name == NULL
- || strcmp (optab->name, (optab - 1)->name) != 0)
- {
- /* different name --> ship out current template list;
- add to hash table; & begin anew. */
- core_optab->end = optab;
- if (str_hash_insert (op_hash, (optab - 1)->name, core_optab, 0))
- as_fatal (_("duplicate %s"), (optab - 1)->name);
+ templates *core_optab = notes_alloc (sizeof (*core_optab));
- if (optab->name == NULL)
- break;
- core_optab = notes_alloc (sizeof (*core_optab));
- core_optab->start = optab;
- }
+ core_optab->start = optab;
+ while (++optab < end)
+ if (strcmp (optab->name, optab[-1].name) != 0)
+ break;
+ core_optab->end = optab;
+ if (str_hash_insert (op_hash, optab[-1].name, core_optab, 0))
+ as_fatal (_("duplicate %s"), optab[-1].name);
}
}
diff --git a/opcodes/i386-gen.c b/opcodes/i386-gen.c
index 5551008..f143842 100644
--- a/opcodes/i386-gen.c
+++ b/opcodes/i386-gen.c
@@ -1818,16 +1818,6 @@ process_i386_opcodes (FILE *table)
fclose (fp);
- fprintf (table, " { NULL, 0, 0, 0,\n");
-
- process_i386_opcode_modifier (table, "0", 0, 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");
-
fprintf (table, "};\n");
}
diff --git a/opcodes/i386-tbl.h b/opcodes/i386-tbl.h
index ff84e22..27be4c5 100644
--- a/opcodes/i386-tbl.h
+++ b/opcodes/i386-tbl.h
@@ -59836,19 +59836,6 @@ static const insn_template i386_optab[] =
0, 0, 0, 0, 0, 0 } },
{ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0,
0, 0, 0, 0, 1, 0 } } } },
- { NULL, 0, 0, 0,
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0 },
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
- { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0 } } } }
};
/* i386 register table. */