diff options
author | Victor Do Nascimento <victor.donascimento@arm.com> | 2023-06-26 13:10:09 +0100 |
---|---|---|
committer | Victor Do Nascimento <victor.donascimento@arm.com> | 2023-12-06 10:39:14 +0000 |
commit | 7d36ea705712539d2c2cda668feb2e675a74958e (patch) | |
tree | 16883406f10f06964dd745d26d7750618434af14 /gcc/rust/resolve | |
parent | 76d3114b04d44db419a824d272fc80cbcd2b68b8 (diff) | |
download | gcc-7d36ea705712539d2c2cda668feb2e675a74958e.zip gcc-7d36ea705712539d2c2cda668feb2e675a74958e.tar.gz gcc-7d36ea705712539d2c2cda668feb2e675a74958e.tar.bz2 |
aarch64: Implement system register validation tools
Given the implementation of a mechanism of encoding system registers
into GCC, this patch provides the mechanism of validating their use by
the compiler. In particular, this involves:
1. Ensuring a supplied string corresponds to a known system
register name. System registers can be accessed either via their
name (e.g. `SPSR_EL1') or their encoding (e.g. `S3_0_C4_C0_0').
Register names are validated using a hash map, mapping known
system register names to its corresponding `sysreg_t' struct,
which is populated from the `aarch64_system_regs.def' file.
Register name validation is done via `lookup_sysreg_map', while
the encoding naming convention is validated via a parser
implemented in this patch - `is_implem_def_reg'.
2. Once a given register name is deemed to be valid, it is checked
against a further 2 criteria:
a. Is the referenced register implemented in the target
architecture? This is achieved by comparing the ARCH field
in the relevant SYSREG entry from `aarch64_system_regs.def'
against `aarch64_feature_flags' flags set at compile-time.
b. Is the register being used correctly? Check the requested
operation against the FLAGS specified in SYSREG.
This prevents operations like writing to a read-only system
register.
gcc/ChangeLog:
* config/aarch64/aarch64-protos.h (aarch64_valid_sysreg_name_p): New.
(aarch64_retrieve_sysreg): Likewise.
* config/aarch64/aarch64.cc (is_implem_def_reg): Likewise.
(aarch64_valid_sysreg_name_p): Likewise.
(aarch64_retrieve_sysreg): Likewise.
(aarch64_register_sysreg): Likewise.
(aarch64_init_sysregs): Likewise.
(aarch64_lookup_sysreg_map): Likewise.
* config/aarch64/predicates.md (aarch64_sysreg_string): New.
Diffstat (limited to 'gcc/rust/resolve')
0 files changed, 0 insertions, 0 deletions