public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Tsukasa OI via Binutils <binutils@sourceware.org>,
	Tsukasa OI <research_trasio@irq.a4lg.com>,
	Nelson Chu <nelson.chu@sifive.com>,
	Kito Cheng <kito.cheng@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>
Cc: binutils@sourceware.org
Subject: Re: [PATCH 1/4] RISC-V: Fix immediates to have `immediate' style
Date: Wed, 10 Aug 2022 12:16:46 +0100	[thread overview]
Message-ID: <871qto1h7l.fsf@redhat.com> (raw)
In-Reply-To: <811c2c02e7ad0afe48eb2b8a2db210c823cdd9a2.1659500861.git.research_trasio@irq.a4lg.com>

Tsukasa OI via Binutils <binutils@sourceware.org> writes:

> This commit fixes certain print calls on immediate operands to have
> `dis_style_immediate'.
>
> opcodes/ChangeLog:
>
> 	* riscv-dis.c (print_insn_args): Fix immediates to have
> 	`immediate' style.
> 	(riscv_disassemble_data): Likewise.

I'm not a binutils maintainer, so can't approve this patch. But...

... this looks good to me, with just one minor comment, see below.

> ---
>  opcodes/riscv-dis.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c
> index 164fd209dbd..fe091f294e7 100644
> --- a/opcodes/riscv-dis.c
> +++ b/opcodes/riscv-dis.c
> @@ -472,7 +472,7 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info
>  	  break;
>  
>  	case 'y':
> -	  print (info->stream, dis_style_text, "0x%x",
> +	  print (info->stream, dis_style_immediate, "0x%x",
>  		 (int)EXTRACT_OPERAND (BS, l));
>  	  break;
>  
> @@ -541,17 +541,17 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info
>  	    if (riscv_csr_hash[csr] != NULL)
>  	      print (info->stream, dis_style_text, "%s", riscv_csr_hash[csr]);

You haven't updated this line, but, I wonder if this should be
dis_style_register?

Otherwise, LGTM.

Thanks,
Andrew


>  	    else
> -	      print (info->stream, dis_style_text, "0x%x", csr);
> +	      print (info->stream, dis_style_immediate, "0x%x", csr);
>  	    break;
>  	  }
>  
>  	case 'Y':
> -	  print (info->stream, dis_style_text, "0x%x",
> +	  print (info->stream, dis_style_immediate, "0x%x",
>  		 (int) EXTRACT_OPERAND (RNUM, l));
>  	  break;
>  
>  	case 'Z':
> -	  print (info->stream, dis_style_text, "%d", rs1);
> +	  print (info->stream, dis_style_immediate, "%d", rs1);
>  	  break;
>  
>  	default:
> @@ -907,7 +907,7 @@ riscv_disassemble_data (bfd_vma memaddr ATTRIBUTE_UNUSED,
>        (*info->fprintf_styled_func)
>  	(info->stream, dis_style_assembler_directive, ".byte\t");
>        (*info->fprintf_styled_func)
> -	(info->stream, dis_style_assembler_directive, "0x%02llx",
> +	(info->stream, dis_style_immediate, "0x%02llx",
>  	 (unsigned long long) data);
>        break;
>      case 2:
> -- 
> 2.34.1


  reply	other threads:[~2022-08-10 11:16 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13 13:40 [PATCH] RISC-V: fix printf types on riscv-dis.c Tsukasa OI
2022-08-03  4:27 ` [PATCH 0/4] RISC-V: Fix disassembler types and styles Tsukasa OI
2022-08-03  4:27   ` [PATCH 1/4] RISC-V: Fix immediates to have `immediate' style Tsukasa OI
2022-08-10 11:16     ` Andrew Burgess [this message]
2022-08-10 13:48       ` Tsukasa OI
2022-08-03  4:27   ` [PATCH 2/4] RISC-V: Fix printf argument types corresponding %x Tsukasa OI
2022-08-03  4:27   ` [PATCH 3/4] RISC-V: Optimize riscv_disassemble_data printf Tsukasa OI
2022-08-03  4:27   ` [PATCH 4/4] RISC-V: Print comma and tabs as the `text' style Tsukasa OI
2022-08-10 11:20     ` Andrew Burgess
2022-08-10 13:54       ` Tsukasa OI
2022-09-26 12:26   ` [PATCH v2 0/6] RISC-V: Fix disassembler types and styles Tsukasa OI
2022-09-26 12:26     ` [PATCH v2 1/6] RISC-V: Fix immediates to have "immediate" style Tsukasa OI
2022-09-26 12:26     ` [PATCH v2 2/6] RISC-V: Fix printf argument types corresponding %x Tsukasa OI
2022-09-26 12:26     ` [PATCH v2 3/6] RISC-V: Optimize riscv_disassemble_data printf Tsukasa OI
2022-09-26 12:26     ` [PATCH v2 4/6] RISC-V: Print comma and tabs as the "text" style Tsukasa OI
2022-09-26 12:26     ` [PATCH v2 5/6] RISC-V: Fix T-Head immediate types on printing Tsukasa OI
2022-10-03  9:57       ` Andrew Burgess
2022-10-03 11:06       ` Christoph Müllner
2022-09-26 12:26     ` [PATCH v2 6/6] RISC-V: Print XTheadMemPair literal as "immediate" Tsukasa OI
2022-10-03 11:06       ` Christoph Müllner
2022-10-03  9:59     ` [PATCH v2 0/6] RISC-V: Fix disassembler types and styles Andrew Burgess
2022-10-03 17:40       ` Palmer Dabbelt
2022-10-04  1:34         ` Tsukasa OI
2022-10-04  1:41         ` Nelson Chu
2022-10-04  8:46         ` Andrew Burgess
2022-10-05 22:37           ` Palmer Dabbelt
2022-10-05 21:52         ` Jeff Law
2022-10-03 10:43     ` [PATCH v3 " Tsukasa OI
2022-10-03 10:43       ` [PATCH v3 1/6] RISC-V: Fix immediates to have "immediate" style Tsukasa OI
2022-10-03 10:44       ` [PATCH v3 2/6] RISC-V: Fix printf argument types corresponding %x Tsukasa OI
2022-10-03 10:44       ` [PATCH v3 3/6] RISC-V: Optimize riscv_disassemble_data printf Tsukasa OI
2022-10-03 10:44       ` [PATCH v3 4/6] RISC-V: Print comma and tabs as the "text" style Tsukasa OI
2022-10-03 10:44       ` [PATCH v3 5/6] RISC-V: Fix T-Head immediate types on printing Tsukasa OI
2022-10-03 10:44       ` [PATCH v3 6/6] RISC-V: Print XTheadMemPair literal as "immediate" Tsukasa OI

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=871qto1h7l.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=binutils@sourceware.org \
    --cc=kito.cheng@sifive.com \
    --cc=nelson.chu@sifive.com \
    --cc=palmer@dabbelt.com \
    --cc=research_trasio@irq.a4lg.com \
    /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).