Skip to content

Commit

Permalink
RISC-V: Make `is_addiw' parameter bool
Browse files Browse the repository at this point in the history
Because we widely use `bool' type, this commit makes this parameter `bool'
in the process of tidying.

opcodes/ChangeLog:

	* riscv-dis.c (maybe_print_address): Change `is_addiw' type from
	`int' to `bool'.  (print_insn_args): Use boolean values.
  • Loading branch information
a4lg committed Sep 1, 2022
1 parent 2a1b867 commit c88d112
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 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 is_addiw)
bool is_addiw)
{
if (pd->hi_addr[base_reg] != (bfd_vma)-1)
{
Expand Down Expand Up @@ -243,10 +243,10 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info
case 'o':
case 'j':
if (((l & MASK_C_ADDI) == MATCH_C_ADDI) && rd != 0)
maybe_print_address (pd, rd, EXTRACT_CITYPE_IMM (l), 0);
maybe_print_address (pd, rd, EXTRACT_CITYPE_IMM (l), false);
if (info->mach == bfd_mach_riscv64
&& ((l & MASK_C_ADDIW) == MATCH_C_ADDIW) && rd != 0)
maybe_print_address (pd, rd, EXTRACT_CITYPE_IMM (l), 1);
maybe_print_address (pd, rd, EXTRACT_CITYPE_IMM (l), true);
print (info->stream, dis_style_immediate, "%d",
(int)EXTRACT_CITYPE_IMM (l));
break;
Expand Down Expand Up @@ -406,7 +406,7 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info
case 'b':
case 's':
if ((l & MASK_JALR) == MATCH_JALR)
maybe_print_address (pd, rs1, EXTRACT_ITYPE_IMM (l), 0);
maybe_print_address (pd, rs1, EXTRACT_ITYPE_IMM (l), false);
print (info->stream, dis_style_register, "%s", riscv_gpr_names[rs1]);
break;

Expand Down Expand Up @@ -436,21 +436,21 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info
break;

case 'o':
maybe_print_address (pd, rs1, EXTRACT_ITYPE_IMM (l), 0);
maybe_print_address (pd, rs1, EXTRACT_ITYPE_IMM (l), false);
/* Fall through. */
case 'j':
if (((l & MASK_ADDI) == MATCH_ADDI && rs1 != 0)
|| (l & MASK_JALR) == MATCH_JALR)
maybe_print_address (pd, rs1, EXTRACT_ITYPE_IMM (l), 0);
maybe_print_address (pd, rs1, EXTRACT_ITYPE_IMM (l), false);
if (info->mach == bfd_mach_riscv64
&& ((l & MASK_ADDIW) == MATCH_ADDIW) && rs1 != 0)
maybe_print_address (pd, rs1, EXTRACT_ITYPE_IMM (l), 1);
maybe_print_address (pd, rs1, EXTRACT_ITYPE_IMM (l), true);
print (info->stream, dis_style_immediate, "%d",
(int)EXTRACT_ITYPE_IMM (l));
break;

case 'q':
maybe_print_address (pd, rs1, EXTRACT_STYPE_IMM (l), 0);
maybe_print_address (pd, rs1, EXTRACT_STYPE_IMM (l), false);
print (info->stream, dis_style_address_offset, "%d",
(int)EXTRACT_STYPE_IMM (l));
break;
Expand Down

0 comments on commit c88d112

Please sign in to comment.