[PATCH v4 1/2] RISC-V: Support Zcmp push/pop instructions.
Kito Cheng
kito.cheng@sifive.com
Fri Jan 26 08:33:00 GMT 2024
> +/* If set, disassemble numeric register names instead of ABI names. */
> +static int numeric = false;
>
> /* Set default RISC-V disassembler options. */
>
> @@ -84,6 +86,7 @@ set_default_riscv_dis_options (void)
> riscv_gpr_names = riscv_gpr_names_abi;
> riscv_fpr_names = riscv_fpr_names_abi;
> no_aliases = false;
> + numeric = false;
> }
>
> /* Parse RISC-V disassembler option (without arguments). */
> @@ -97,6 +100,7 @@ parse_riscv_dis_option_without_args (const char *option)
> {
> riscv_gpr_names = riscv_gpr_names_numeric;
> riscv_fpr_names = riscv_fpr_names_numeric;
> + numeric = true;
> }
> else
> return false;
> @@ -215,6 +219,50 @@ maybe_print_address (struct riscv_private_data *pd, int base_reg, int offset,
> pd->print_addr = (bfd_vma)(uint32_t)pd->print_addr;
> }
>
> +/* Get Zcmp reg_list field. */
> +
> +static void
> +print_reg_list (disassemble_info *info, insn_t l)
> +{
bool numeric = riscv_gpr_names == riscv_gpr_names_numeric;
then you can drop numeric from global variables.
> + unsigned reg_list = (int)EXTRACT_OPERAND (REG_LIST, l);
> + unsigned r_start = numeric ? X_S2 : X_S0;
> + info->fprintf_func (info->stream, "%s", riscv_gpr_names[X_RA]);
> +
> + if (reg_list == 5)
> + info->fprintf_func (info->stream, ",%s", riscv_gpr_names[X_S0]);
> + else if (reg_list == 6 || (numeric && reg_list > 6))
> + info->fprintf_func (info->stream, ",%s-%s",
> + riscv_gpr_names[X_S0],
> + riscv_gpr_names[X_S1]);
> +
More information about the Binutils
mailing list