[PATCH v8 6/7] RISC-V: Clarify that `wide' is only used for ADDIW

Tsukasa OI research_trasio@irq.a4lg.com
Sat Aug 27 00:11:03 GMT 2022


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.
---
 opcodes/riscv-dis.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c
index 160cc40f865..7322db10d24 100644
--- a/opcodes/riscv-dis.c
+++ b/opcodes/riscv-dis.c
@@ -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)
     {
@@ -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.  */
-- 
2.34.1



More information about the Binutils mailing list