aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2024-05-31 10:22:50 +0200
committerJan Beulich <jbeulich@suse.com>2024-05-31 10:22:50 +0200
commit939c703789ede7ddd2c9bc21198f430227ccbdf5 (patch)
treeaf0712238d55be5b3c0e36275d56f695a5edfc7b
parent9736d941f271a6c3c14dcbeb5ad03a5fc4106b45 (diff)
downloadbinutils-939c703789ede7ddd2c9bc21198f430227ccbdf5.zip
binutils-939c703789ede7ddd2c9bc21198f430227ccbdf5.tar.gz
binutils-939c703789ede7ddd2c9bc21198f430227ccbdf5.tar.bz2
x86: reduce check_{byte,word,long,qword}_reg() overhead
These run after template matching. Therefore it is quite pointless for them to check all operands, when operand sizes matching across operands is already known. Exit the loops early in such cases. In check_byte_reg() also drop a long-stale part of a comment.
-rw-r--r--gas/config/tc-i386.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 9e13f2f..95f5810 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -9850,11 +9850,13 @@ check_byte_reg (void)
if (i.types[op].bitfield.class != Reg)
continue;
- /* If this is an eight bit register, it's OK. If it's the 16 or
- 32 bit version of an eight bit register, we will just use the
- low portion, and that's OK too. */
+ /* If this is an eight bit register, it's OK. */
if (i.types[op].bitfield.byte)
- continue;
+ {
+ if (i.tm.opcode_modifier.checkoperandsize)
+ break;
+ continue;
+ }
/* I/O port address operands are OK too. */
if (i.tm.operand_types[op].bitfield.instance == RegD
@@ -9908,6 +9910,9 @@ check_long_reg (void)
i.suffix);
return 0;
}
+ else if (i.tm.opcode_modifier.checkoperandsize)
+ break;
+
return 1;
}
@@ -9943,6 +9948,9 @@ check_qword_reg (void)
register_prefix, i.op[op].regs->reg_name, i.suffix);
return 0;
}
+ else if (i.tm.opcode_modifier.checkoperandsize)
+ break;
+
return 1;
}
@@ -9978,6 +9986,9 @@ check_word_reg (void)
i.suffix);
return 0;
}
+ else if (i.tm.opcode_modifier.checkoperandsize)
+ break;
+
return 1;
}