aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2022-10-31 17:56:06 +0100
committerJan Beulich <jbeulich@suse.com>2022-10-31 17:56:06 +0100
commit8f0212acb19da47fa9d9feeaae42e71c8817cafc (patch)
treee87ebfd50f0099aaa587de359f3effba3f50f96d
parent5bab16fdf1775c8abd16376458c5843fbe1d4314 (diff)
downloadgdb-8f0212acb19da47fa9d9feeaae42e71c8817cafc.zip
gdb-8f0212acb19da47fa9d9feeaae42e71c8817cafc.tar.gz
gdb-8f0212acb19da47fa9d9feeaae42e71c8817cafc.tar.bz2
x86: minor improvements to optimize_imm() (part III)
Earlier tidying still missed an opportunity: There's no need for the "anyimm" static variable. Instead of using it in the loop to mask "allowed" (which is necessary to satisfy operand_type_or()'s assertions) simply use "mask", requiring it to be calculated first. That way the post-loop masking by "mask" ahead of the operand_type_all_zero() can be dropped.
-rw-r--r--gas/config/tc-i386.c17
-rw-r--r--opcodes/i386-gen.c2
-rw-r--r--opcodes/i386-init.h4
3 files changed, 8 insertions, 15 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index cccd837..bea2de9 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -1907,7 +1907,6 @@ operand_type_xor (i386_operand_type x, i386_operand_type y)
static const i386_operand_type disp16_32 = OPERAND_TYPE_DISP16_32;
static const i386_operand_type anydisp = OPERAND_TYPE_ANYDISP;
-static const i386_operand_type anyimm = OPERAND_TYPE_ANYIMM;
static const i386_operand_type regxmm = OPERAND_TYPE_REGXMM;
static const i386_operand_type imm8 = OPERAND_TYPE_IMM8;
static const i386_operand_type imm8s = OPERAND_TYPE_IMM8S;
@@ -5817,13 +5816,6 @@ optimize_imm (void)
const insn_template *t = current_templates->start;
operand_type_set (&mask, 0);
- allowed = t->operand_types[op];
-
- while (++t < current_templates->end)
- {
- allowed = operand_type_and (allowed, anyimm);
- allowed = operand_type_or (allowed, t->operand_types[op]);
- }
switch (guess_suffix)
{
case QWORD_MNEM_SUFFIX:
@@ -5842,7 +5834,14 @@ optimize_imm (void)
default:
break;
}
- allowed = operand_type_and (mask, allowed);
+
+ allowed = operand_type_and (t->operand_types[op], mask);
+ while (++t < current_templates->end)
+ {
+ allowed = operand_type_or (allowed, t->operand_types[op]);
+ allowed = operand_type_and (allowed, mask);
+ }
+
if (!operand_type_all_zero (&allowed))
i.types[op] = operand_type_and (i.types[op], mask);
}
diff --git a/opcodes/i386-gen.c b/opcodes/i386-gen.c
index 33c4f9f..3024e61 100644
--- a/opcodes/i386-gen.c
+++ b/opcodes/i386-gen.c
@@ -539,8 +539,6 @@ static initializer operand_type_init[] =
"Imm32|Imm32S|Imm64|Disp32" },
{ "OPERAND_TYPE_IMM32_32S_64_DISP32_64",
"Imm32|Imm32S|Imm64|Disp32|Disp64" },
- { "OPERAND_TYPE_ANYIMM",
- "Imm1|Imm8|Imm8S|Imm16|Imm32|Imm32S|Imm64" },
};
typedef struct bitfield
diff --git a/opcodes/i386-init.h b/opcodes/i386-init.h
index e662ba6..133827a 100644
--- a/opcodes/i386-init.h
+++ b/opcodes/i386-init.h
@@ -1993,7 +1993,3 @@
#define OPERAND_TYPE_IMM32_32S_64_DISP32_64 \
{ { 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0 } }
-
-#define OPERAND_TYPE_ANYIMM \
- { { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0 } }