forked from Imagelibrary/binutils-gdb
opcodes/riscv: add styling support to print_reg_list
I noticed that some unstyled output had crept into the risc-v
disassembler in this commit:
commit 9132c8152b
Date: Tue Feb 27 11:48:11 2024 +0800
RISC-V: Support Zcmp push/pop instructions.
this commit adds styling support. The risc-v disassembler is now once
again, fully styled.
This commit is contained in:
@@ -223,26 +223,49 @@ print_reg_list (disassemble_info *info, insn_t l)
|
||||
bool numeric = riscv_gpr_names == riscv_gpr_names_numeric;
|
||||
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]);
|
||||
info->fprintf_styled_func (info->stream, dis_style_register,
|
||||
"%s", riscv_gpr_names[X_RA]);
|
||||
|
||||
if (reg_list == 5)
|
||||
info->fprintf_func (info->stream, ",%s",
|
||||
riscv_gpr_names[X_S0]);
|
||||
{
|
||||
info->fprintf_styled_func (info->stream, dis_style_text, ",");
|
||||
info->fprintf_styled_func (info->stream, dis_style_register,
|
||||
"%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]);
|
||||
{
|
||||
info->fprintf_styled_func (info->stream, dis_style_text, ",");
|
||||
info->fprintf_styled_func (info->stream, dis_style_register,
|
||||
"%s", riscv_gpr_names[X_S0]);
|
||||
info->fprintf_styled_func (info->stream, dis_style_text, "-");
|
||||
info->fprintf_styled_func (info->stream, dis_style_register,
|
||||
"%s", riscv_gpr_names[X_S1]);
|
||||
}
|
||||
|
||||
if (reg_list == 15)
|
||||
info->fprintf_func (info->stream, ",%s-%s",
|
||||
riscv_gpr_names[r_start],
|
||||
riscv_gpr_names[X_S11]);
|
||||
{
|
||||
info->fprintf_styled_func (info->stream, dis_style_text, ",");
|
||||
info->fprintf_styled_func (info->stream, dis_style_register,
|
||||
"%s", riscv_gpr_names[r_start]);
|
||||
info->fprintf_styled_func (info->stream, dis_style_text, "-");
|
||||
info->fprintf_styled_func (info->stream, dis_style_register,
|
||||
"%s", riscv_gpr_names[X_S11]);
|
||||
}
|
||||
else if (reg_list == 7 && numeric)
|
||||
info->fprintf_func (info->stream, ",%s",
|
||||
riscv_gpr_names[X_S2]);
|
||||
{
|
||||
info->fprintf_styled_func (info->stream, dis_style_text, ",");
|
||||
info->fprintf_styled_func (info->stream, dis_style_register,
|
||||
"%s", riscv_gpr_names[X_S2]);
|
||||
}
|
||||
else if (reg_list > 6)
|
||||
info->fprintf_func (info->stream, ",%s-%s",
|
||||
riscv_gpr_names[r_start],
|
||||
riscv_gpr_names[reg_list + 11]);
|
||||
{
|
||||
info->fprintf_styled_func (info->stream, dis_style_text, ",");
|
||||
info->fprintf_styled_func (info->stream, dis_style_register,
|
||||
"%s", riscv_gpr_names[r_start]);
|
||||
info->fprintf_styled_func (info->stream, dis_style_text, "-");
|
||||
info->fprintf_styled_func (info->stream, dis_style_register,
|
||||
"%s", riscv_gpr_names[reg_list + 11]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Get Zcmp sp adjustment immediate. */
|
||||
|
||||
Reference in New Issue
Block a user