Skip to content

Commit

Permalink
RISC-V: Clarify that `wide' is only used for ADDIW
Browse files Browse the repository at this point in the history
The `wide' parameter on the `maybe_print_address' function is only used
for the ADDIW/C.ADDIW instructions and there's no reasonable usecases except
those two.

This commit renames the parameter from `wide' to `is_addiw' to clarify that
this parameter is only used for ADDIW instructions.

opcodes/ChangeLog:

	* riscv-dis.c (maybe_print_address): Clarify and rename the last
	parameter so that this is only used for ADDIW instructions.
  • Loading branch information
a4lg committed Sep 1, 2022
1 parent 154e28c commit 2a1b867
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions opcodes/riscv-dis.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ arg_print (struct disassemble_info *info, unsigned long val,

static void
maybe_print_address (struct riscv_private_data *pd, int base_reg, int offset,
int wide)
int is_addiw)
{
if (pd->hi_addr[base_reg] != (bfd_vma)-1)
{
Expand All @@ -187,8 +187,8 @@ maybe_print_address (struct riscv_private_data *pd, int base_reg, int offset,
return; /* Don't print the address. */
pd->to_print_addr = true;

/* Sign-extend a 32-bit value to a 64-bit value. */
if (wide)
/* On ADDIW, sign-extend a 32-bit value to a 64-bit value. */
if (is_addiw)
pd->print_addr = (bfd_vma)(int32_t) pd->print_addr;

/* Fit into a 32-bit value on RV32. */
Expand Down

0 comments on commit 2a1b867

Please sign in to comment.