aboutsummaryrefslogtreecommitdiff
path: root/include/opcode
diff options
context:
space:
mode:
authorAlice Carlotti <alice.carlotti@arm.com>2025-07-11 07:55:45 +0100
committerAlice Carlotti <alice.carlotti@arm.com>2025-07-12 10:04:26 +0100
commit891fa528c2b3c8aac3e959ec6496ebffe5e5db15 (patch)
tree875af412c3b70609268c4dc937cd1bcdbbf8ad6a /include/opcode
parent6a2b11857f8151379a6c0d126c3a7d38e2fbe776 (diff)
downloadfsf-binutils-gdb-891fa528c2b3c8aac3e959ec6496ebffe5e5db15.zip
fsf-binutils-gdb-891fa528c2b3c8aac3e959ec6496ebffe5e5db15.tar.gz
fsf-binutils-gdb-891fa528c2b3c8aac3e959ec6496ebffe5e5db15.tar.bz2
aarch64: Refactor exclusion of reg names in immediates
When parsing immediate values, register names should not be misinterpreted as symbols. However, for backwards compatibility we need to permit some newer register names within older instructions. The current mechanism for doing so depends on the list of explicit architecture requirements for the instructions, which is fragile and easy to forget, and grows increasingly messy as more architecture features are added. This patch add explicit flags to each opcode to indicate which set of register names is disallowed in each instance. These flags are mandatory for all opcodes with immediate operands, which ensures that the choice of disallowed names will always be deliberate and explicit. This patch should have no functional change.
Diffstat (limited to 'include/opcode')
-rw-r--r--include/opcode/aarch64.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/include/opcode/aarch64.h b/include/opcode/aarch64.h
index 826bd7d..c715e7b 100644
--- a/include/opcode/aarch64.h
+++ b/include/opcode/aarch64.h
@@ -1541,7 +1541,24 @@ extern const aarch64_opcode aarch64_opcode_table[];
/* For LSFE instructions with size[30:31] field. */
#define F_LSFE_SZ (1ULL << 41)
-/* Next bit is 42. */
+
+/* When parsing immediate values, register names should not be misinterpreted
+ as symbols. However, for backwards compatibility we need to permit some
+ newer register names within older instructions. These flags specify which
+ register names are invalid immediate value, and are required for all
+ instructions with immediate operands (and are otherwise ignored). */
+#define F_INVALID_IMM_SYMS (3ULL << 42)
+
+/* Any GP or SIMD register except WSP/SP. */
+#define F_INVALID_IMM_SYMS_1 (1ULL << 42)
+
+/* As above, plus WSP/SP, and Z and P registers. */
+#define F_INVALID_IMM_SYMS_2 (2ULL << 42)
+
+/* As above, plus PN registers. */
+#define F_INVALID_IMM_SYMS_3 (3ULL << 42)
+
+/* Next bit is 44. */
/* Instruction constraints. */
/* This instruction has a predication constraint on the instruction at PC+4. */