public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] aarch64: standardize system register representation
@ 2023-10-03 10:51 Victor Do Nascimento
  2023-10-03 10:51 ` [PATCH v2 1/2] aarch64: system register aliasing detection Victor Do Nascimento
  2023-10-03 10:51 ` [PATCH v2 2/2] aarch64: Refactor system register data Victor Do Nascimento
  0 siblings, 2 replies; 7+ messages in thread
From: Victor Do Nascimento @ 2023-10-03 10:51 UTC (permalink / raw)
  To: binutils; +Cc: richard.earnshaw, nickc, Victor Do Nascimento

Previously-approved patch rebased to accommodate changes made by the
"aarch64: Restructure feature flag handling" patch:

https://sourceware.org/pipermail/binutils/2023-September/129634.html

---

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-sys-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 can be used by both Binutils and GCC to specify
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 labeling 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.
OK to install?

Victor

Victor Do Nascimento (2):
  aarch64: system register aliasing detection
  AArch64: Refactor system register data

 include/opcode/aarch64.h     |    1 +
 opcodes/aarch64-opc.c        | 1095 +---------------------------------
 opcodes/aarch64-opc.h        |    3 +
 opcodes/aarch64-sys-regs.def | 1060 ++++++++++++++++++++++++++++++++
 4 files changed, 1091 insertions(+), 1068 deletions(-)
 create mode 100644 opcodes/aarch64-sys-regs.def

-- 
2.41.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-10-04 10:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-03 10:51 [PATCH v2 0/2] aarch64: standardize system register representation Victor Do Nascimento
2023-10-03 10:51 ` [PATCH v2 1/2] aarch64: system register aliasing detection Victor Do Nascimento
2023-10-03 13:40   ` Richard Earnshaw (lists)
2023-10-03 10:51 ` [PATCH v2 2/2] aarch64: Refactor system register data Victor Do Nascimento
2023-10-03 13:46   ` Richard Earnshaw (lists)
2023-10-04 10:15     ` Victor Do Nascimento
2023-10-04 10:22       ` Victor 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).