[PATCHv5 0/2] AArch64 libopcodes styling
Andrew Burgess
aburgess@redhat.com
Thu Jul 21 08:56:41 GMT 2022
More information about the Binutils mailing list
Thu Jul 21 08:56:41 GMT 2022
- Previous message (by thread): [PATCHv4 2/2] libopcodes/aarch64: add support for disassembler styling
- Next message (by thread): [PATCHv5 1/2] opcodes: add new sub-mnemonic disassembler style
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Richard,
Here's an updated series. I've fixed the typo you spotted, and I now
pass "%s" in where I'm formatting a single string, which avoids
potential formatting issues if there's ever a '%' in the string to
print.
What I've not done in this commit is try to optimise how we handle the
obstack.
In your comment you talk about the obstack being initialised for each
call to aarch64_print_operand - this isn't exactly correct, we
initialise the obstack once in print_operands (there's a version of
this in the assembler and disassembler), and then make multiple calls
to aarch64_print_operand using the same obstack. This means we
initialise the obstack once per instruction right now.
However, we could do better, we could make use of
disassemble_init_for_target, and then store the obstack in the
disassemble_info::private_data field. In this way we really could
initialise the obstack once, and then disassemble multiple
instructions (resetting the obstack after each instruction has
completed). In the assembler we could potentially just make the
obstack global (as the assembler already has lots of global state),
or, as the assembler only prints instructions on an error path, we
maybe don't care about allocating the obstack multiple times...
That said, I haven't done either of these things in this patch. If
you think this is worth doing then I'm happy to write this patch, but
I'll keep it as a separate patch as it feels like a new piece of work.
Let me know what you think,
Thanks,
Andrew
---
Changes since v4:
- Fixed a typo in patch #2,
- Pass "%s" format in more cases.
Changed since v3:
- Patch #1 is unchanged,
- Removed debug code that was accidentally left in patch #2,
- Patch #2 now sets the disassemble_info::created_styled_output flag
correctly in disassembler.c.
Changes since v2:
- Patch #1 is unchanged,
- Patch #2, now with more OBSTACK! This patch is pretty much a
complete rewrite from the gound up based on Richard's feedback.
The new iteration makes use of obstacks (in aarch64-dis.c and
tc-aarch64.c) to format each chunk of disassembler output. These
chunks are then combined in aarch64-opc.c as required.
Changes since v1:
- Original patch #1 has been merged,
- New patch #1 adds a dis_style_sub_mnemonic style and updates
objdump to handle this style,
- Patch #2 has been updated to make use of the new style.
---
Andrew Burgess (2):
opcodes: add new sub-mnemonic disassembler style
libopcodes/aarch64: add support for disassembler styling
binutils/objdump.c | 2 +
gas/config/tc-aarch64.c | 45 +++-
include/dis-asm.h | 7 +
include/opcode/aarch64.h | 28 ++-
opcodes/aarch64-dis.c | 247 +++++++++++++++++++---
opcodes/aarch64-opc.c | 445 ++++++++++++++++++++++++++-------------
opcodes/disassemble.c | 1 +
7 files changed, 596 insertions(+), 179 deletions(-)
--
2.25.4
- Previous message (by thread): [PATCHv4 2/2] libopcodes/aarch64: add support for disassembler styling
- Next message (by thread): [PATCHv5 1/2] opcodes: add new sub-mnemonic disassembler style
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list