public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/3] aarch64: standardize system register representation
@ 2023-09-08 12:10 Victor L. Do Nascimento
  0 siblings, 0 replies; only message in thread
From: Victor L. Do Nascimento @ 2023-09-08 12:10 UTC (permalink / raw)
  To: binutils; +Cc: Richard.Earnshaw, richard.sandiford

This patch series standardizes the representation of system registers,
moving them out of their original place in `aarch64-opc.c' and into a
dedicated .def file, `aarch64-system-regs.def'.

The purpose of this work is to disentangle system-register
representation from anything that is Binutils-specific.  This way,
with a more generic representation format, the information can be
shared between different parts of the toolchain which rely the same
information, reducing maintenance burden.  More specifically, the .def
file herein defined has a format that can be used by both Binutils
and GCC to specify architecture-defined system registers.

With the relevant macros defined in `aarch64-opc.c', the key step that
needs to be done to load the system register information into Binutils
is to have the `#include "aarch64-system-regs.def"' preprocessor
invocation within the definition of the const `aarch64_sys_reg
aarch64_sys_regs []' array.

We note that the previous implementation was sensitive to the order
the registers were stored in the `aarch64_sys_regs []' array,
particularly in the case of register name aliases.  This led to poor
maintainability and caused the disassembler to favor the alias name
if the correct, arbitrary ordering between registers wasn't kept in
the array.

A mechanism for labelling and, based on these labels, identifying
these aliases is also added.  This eliminates bugs that come about as
a consequence of reordering elements of the system register list and
gave us freedom to reorder elements in the array as most appropriate.

Based on this freedom, system register entries in this new file are
ordered alphabetically by name.  This choice is made to enable the use
of fast search algorithms such as binary search when validating
register names.

Regtested on aarch64-none-elf and aarch64-none-linux-gnu

Victor Do Nascimento (3):
  AArch64: Refactor system register data
  aarch64: macroize archictectural feature union in SYSREG
  aarch64: system register aliasing detection

 include/opcode/aarch64.h        |    2 +
 opcodes/aarch64-opc.c           | 1104 +------------------------------
 opcodes/aarch64-opc.h           |    3 +
 opcodes/aarch64-system-regs.def | 1059 +++++++++++++++++++++++++++++
 4 files changed, 1097 insertions(+), 1071 deletions(-)
 create mode 100644 opcodes/aarch64-system-regs.def

-- 
2.41.0

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-08 12:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-08 12:10 [PATCH 0/3] aarch64: standardize system register representation Victor L. Do Nascimento

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).