[PATCHv2 2/2] libopcodes/ppc: add support for disassembler styling

Alan Modra amodra@gmail.com
Thu Jul 21 09:31:04 GMT 2022


On Mon, Jul 18, 2022 at 05:31:34PM +0100, Andrew Burgess via Binutils wrote:
> This commit adds disassembler styling to the libopcodes ppc
> disassembler.  This conversion was pretty straight forward, I just
> converted the fprintf_func calls to fprintf_styled_func calls and
> added an appropriate style.
> 
> For testing the new styling I just assembled then disassembled the
> source files in gas/testsuite/gas/ppc and manually checked that the
> styling looked reasonable.
> 
> I think the only slightly weird case was how things like '4*cr1+eq'
> are styled.  As best I can tell, this construct, used for example in
> this instruction:
> 
>   crand   4*cr1+lt,4*cr1+gt,4*cr1+eq
> 
> is used to access a field of a control register.  I initially tried
> styling this whole construct as a register[1], but during review it
> was suggested that instead different parts of the text should have
> different styles.  In this commit I propose styling '4*cr1+lt' like
> this:
> 
>   4    - immediate,
>   *    - text,
>   cr1  - register
>   +    - text
>   lt   - sub-mnemonic

As I said before, I believe "4" should be text.  It is not an
immediate that the user can alter, and is left out entirely when
disassembling if the cr field is cr0.  OK with that change.

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list