public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: binutils@sourceware.org
Cc: Richard Earnshaw <Richard.Earnshaw@foss.arm.com>,
	Andrew Burgess <aburgess@redhat.com>
Subject: [PATCHv5 0/2] AArch64 libopcodes styling
Date: Thu, 21 Jul 2022 09:56:41 +0100	[thread overview]
Message-ID: <cover.1658393015.git.aburgess@redhat.com> (raw)
In-Reply-To: <e20c64bd-4c77-85af-6797-1f239c1c0c94@foss.arm.com>

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


  reply	other threads:[~2022-07-21  8:56 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-21 11:22 [PATCH " Andrew Burgess
2022-06-21 11:22 ` [PATCH 1/2] opcodes/aarch64: split off creation of comment text in disassembler Andrew Burgess
2022-06-22 11:02   ` Nick Clifton
2022-06-29 11:19     ` Andrew Burgess
2022-06-21 11:22 ` [PATCH 2/2] libopcodes/aarch64: add support for disassembler styling Andrew Burgess
2022-06-22 11:15   ` Nick Clifton
2022-06-29 11:01     ` Andrew Burgess
2022-06-29 11:12       ` Jan Beulich
2022-06-29 12:36   ` Richard Earnshaw
2022-07-04  9:52   ` Nick Clifton
2022-07-05 12:45 ` [PATCHv2 0/2] AArch64 libopcodes styling Andrew Burgess
2022-07-05 12:46   ` [PATCHv2 1/2] opcodes: add new sub-mnemonic disassembler style Andrew Burgess
2022-07-05 12:46   ` [PATCHv2 2/2] libopcodes/aarch64: add support for disassembler styling Andrew Burgess
2022-07-05 12:51     ` Andrew Burgess
2022-07-05 13:10       ` Richard Earnshaw
2022-07-07 10:23         ` [PATCHv3 0/2] AArch64 libopcodes styling Andrew Burgess
2022-07-07 10:23           ` [PATCHv3 1/2] opcodes: add new sub-mnemonic disassembler style Andrew Burgess
2022-07-07 10:23           ` [PATCHv3 2/2] libopcodes/aarch64: add support for disassembler styling Andrew Burgess
2022-07-07 10:44             ` Andrew Burgess
2022-07-08 10:25           ` [PATCHv4 0/2] AArch64 libopcodes styling Andrew Burgess
2022-07-08 10:25             ` [PATCHv4 1/2] opcodes: add new sub-mnemonic disassembler style Andrew Burgess
2022-07-26 13:54               ` Nick Clifton
2022-07-08 10:25             ` [PATCHv4 2/2] libopcodes/aarch64: add support for disassembler styling Andrew Burgess
2022-07-19 15:33               ` Richard Earnshaw
2022-07-21  8:56                 ` Andrew Burgess [this message]
2022-07-21  8:56                   ` [PATCHv5 1/2] opcodes: add new sub-mnemonic disassembler style Andrew Burgess
2022-07-25 13:34                     ` Andrew Burgess
2022-07-21  8:56                   ` [PATCHv5 2/2] libopcodes/aarch64: add support for disassembler styling Andrew Burgess
2022-07-26 13:55                     ` Nick Clifton
2022-07-29 13:12                       ` Andrew Burgess
2022-07-19 12:52             ` [PATCHv4 0/2] AArch64 libopcodes styling Andrew Burgess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1658393015.git.aburgess@redhat.com \
    --to=aburgess@redhat.com \
    --cc=Richard.Earnshaw@foss.arm.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).