[PATCH 1/4] RISC-V: Fix immediates to have `immediate' style
Tsukasa OI
research_trasio@irq.a4lg.com
Wed Aug 10 13:48:45 GMT 2022
On 2022/08/10 20:16, Andrew Burgess wrote:
> 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?
That might be an option but I wasn't confident enough.
Maybe RISC-V related developers can talk about it.
For now, I prefer to keep this line.
>
> 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
>
More information about the Binutils
mailing list