aboutsummaryrefslogtreecommitdiff
path: root/opcodes/aarch64-dis.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2023-09-26 15:01:21 +0100
committerRichard Sandiford <richard.sandiford@arm.com>2023-09-26 15:01:21 +0100
commit4abb672ac1a2a14d32bfee02f2d05ae5e01af637 (patch)
tree0dfd2e84934d0cfe68521d95b0d4b24f9f112e03 /opcodes/aarch64-dis.c
parentfc21e0f029c51687c2b4ca686d0b773ad5efeff4 (diff)
downloadbinutils-4abb672ac1a2a14d32bfee02f2d05ae5e01af637.zip
binutils-4abb672ac1a2a14d32bfee02f2d05ae5e01af637.tar.gz
binutils-4abb672ac1a2a14d32bfee02f2d05ae5e01af637.tar.bz2
aarch64: Restructure feature flag handling
The AArch64 feature-flag code is currently limited to a maximum of 64 features. This patch reworks it so that the limit can be increased more easily. The basic idea is: (1) Turn the ARM_FEATURE_FOO macros into an enum, with the enum counting bit positions. (2) Make the feature-list macros take an array index argument (currently always 0). The macros then return the aarch64_feature_set contents for that array index. An N-element array would then be initialised as: { MACRO (0), ..., MACRO (N - 1) } (3) Provide convenience macros for initialising an aarch64_feature_set for: - a single feature - a list of individual features - an architecture version - an architecture version + a list of additional features (2) and (3) use the preprocessor to generate static initialisers. The main restriction was that uses of the same preprocessor macro cannot be nested. So if a macro wants to do something for N individual arguments, it needs to use a chain of N macros to do it. There then needs to be a way of deriving N, as a preprocessor token suitable for pasting. The easiest way of doing that was to precede each list of features by the number of features in the list. So an aarch64_feature_set initialiser for three features A, B and C would be written: AARCH64_FEATURES (3, A, B, C) This scheme makes it difficult to keep AARCH64_FEATURE_CRYPTO as a synonym for SHA2+AES, so the patch expands the former to the latter.
Diffstat (limited to 'opcodes/aarch64-dis.c')
-rw-r--r--opcodes/aarch64-dis.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/opcodes/aarch64-dis.c b/opcodes/aarch64-dis.c
index 03bcc37..3bf5f50 100644
--- a/opcodes/aarch64-dis.c
+++ b/opcodes/aarch64-dis.c
@@ -3008,7 +3008,7 @@ determine_disassembling_preference (struct aarch64_inst *inst,
continue;
}
- if (!AARCH64_CPU_HAS_FEATURE (arch_variant, *alias->avariant))
+ if (!AARCH64_CPU_HAS_ALL_FEATURES (arch_variant, *alias->avariant))
{
DEBUG_TRACE ("skip %s: we're missing features", alias->name);
continue;
@@ -3969,10 +3969,11 @@ select_aarch64_variant (unsigned mach)
switch (mach)
{
case bfd_mach_aarch64_8R:
- arch_variant = AARCH64_ARCH_V8R;
+ AARCH64_SET_FEATURE (arch_variant, AARCH64_ARCH_V8R);
break;
default:
- arch_variant = AARCH64_ANY & ~(AARCH64_FEATURE_V8R);
+ arch_variant = (aarch64_feature_set) AARCH64_ALL_FEATURES;
+ AARCH64_CLEAR_FEATURE (arch_variant, arch_variant, V8R);
}
}