disas/microblaze: Merge op->name output into each fprintf

In the common case, issue one single fprintf.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20240412073346.458116-17-richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2024-04-12 00:33:35 -07:00
parent c3c6fed646
commit de66f9f7ab

View File

@ -830,54 +830,52 @@ print_insn_microblaze(bfd_vma memaddr, struct disassemble_info *info)
return 4; return 4;
} }
fprintf_func (stream, "%s", op->name);
switch (op->inst_type) { switch (op->inst_type) {
case INST_TYPE_RD_R1_R2: case INST_TYPE_RD_R1_R2:
fprintf_func(stream, "\t%s, %s, %s", fprintf_func(stream, "%s\t%s, %s, %s",
get_field_rd(inst), get_field_r1(inst), op->name, get_field_rd(inst), get_field_r1(inst),
get_field_r2(inst)); get_field_r2(inst));
break; break;
case INST_TYPE_RD_R1_IMM: case INST_TYPE_RD_R1_IMM:
fprintf_func(stream, "\t%s, %s, %s", fprintf_func(stream, "%s\t%s, %s, %s",
get_field_rd(inst), get_field_r1(inst), op->name, get_field_rd(inst), get_field_r1(inst),
get_field_imm(inst)); get_field_imm(inst));
if (get_int_field_r1(inst) == 0) { if (get_int_field_r1(inst) == 0) {
print_immval_addr(info, immfound, immval, inst, 0); print_immval_addr(info, immfound, immval, inst, 0);
} }
break; break;
case INST_TYPE_RD_R1_IMM5: case INST_TYPE_RD_R1_IMM5:
fprintf_func(stream, "\t%s, %s, %s", fprintf_func(stream, "%s\t%s, %s, %s",
get_field_rd(inst), get_field_r1(inst), op->name, get_field_rd(inst), get_field_r1(inst),
get_field_imm5(inst)); get_field_imm5(inst));
break; break;
case INST_TYPE_RD_RFSL: case INST_TYPE_RD_RFSL:
fprintf_func(stream, "\t%s, %s", fprintf_func(stream, "%s\t%s, %s",
get_field_rd(inst), get_field_rfsl(inst)); op->name, get_field_rd(inst), get_field_rfsl(inst));
break; break;
case INST_TYPE_R1_RFSL: case INST_TYPE_R1_RFSL:
fprintf_func(stream, "\t%s, %s", fprintf_func(stream, "%s\t%s, %s",
get_field_r1(inst), get_field_rfsl(inst)); op->name, get_field_r1(inst), get_field_rfsl(inst));
break; break;
case INST_TYPE_RD_SPECIAL: case INST_TYPE_RD_SPECIAL:
fprintf_func(stream, "\t%s, %s", fprintf_func(stream, "%s\t%s, %s",
get_field_rd(inst), get_field_special(inst, op)); op->name, get_field_rd(inst), get_field_special(inst, op));
break; break;
case INST_TYPE_SPECIAL_R1: case INST_TYPE_SPECIAL_R1:
fprintf_func(stream, "\t%s, %s", fprintf_func(stream, "%s\t%s, %s",
get_field_special(inst, op), get_field_r1(inst)); op->name, get_field_special(inst, op), get_field_r1(inst));
break; break;
case INST_TYPE_RD_R1: case INST_TYPE_RD_R1:
fprintf_func(stream, "\t%s, %s", fprintf_func(stream, "%s\t%s, %s",
get_field_rd(inst), get_field_r1(inst)); op->name, get_field_rd(inst), get_field_r1(inst));
break; break;
case INST_TYPE_R1_R2: case INST_TYPE_R1_R2:
fprintf_func(stream, "\t%s, %s", fprintf_func(stream, "%s\t%s, %s",
get_field_r1(inst), get_field_r2(inst)); op->name, get_field_r1(inst), get_field_r2(inst));
break; break;
case INST_TYPE_R1_IMM: case INST_TYPE_R1_IMM:
fprintf_func(stream, "\t%s, %s", fprintf_func(stream, "%s\t%s, %s",
get_field_r1(inst), get_field_imm(inst)); op->name, get_field_r1(inst), get_field_imm(inst));
/* /*
* The non-pc relative instructions are returns, * The non-pc relative instructions are returns,
* which shouldn't have a label printed. * which shouldn't have a label printed.
@ -887,14 +885,15 @@ print_insn_microblaze(bfd_vma memaddr, struct disassemble_info *info)
} }
break; break;
case INST_TYPE_RD_IMM: case INST_TYPE_RD_IMM:
fprintf_func(stream, "\t%s, %s", fprintf_func(stream, "%s\t%s, %s",
get_field_rd(inst), get_field_imm(inst)); op->name, get_field_rd(inst), get_field_imm(inst));
print_immval_addr(info, immfound, immval, inst, print_immval_addr(info, immfound, immval, inst,
op->inst_offset_type == INST_PC_OFFSET op->inst_offset_type == INST_PC_OFFSET
? memaddr : 0); ? memaddr : 0);
break; break;
case INST_TYPE_IMM: case INST_TYPE_IMM:
fprintf_func(stream, "\t%s", get_field_imm(inst)); fprintf_func(stream, "%s\t%s",
op->name, get_field_imm(inst));
if (op->instr != imm) { if (op->instr != imm) {
print_immval_addr(info, immfound, immval, inst, print_immval_addr(info, immfound, immval, inst,
op->inst_offset_type == INST_PC_OFFSET op->inst_offset_type == INST_PC_OFFSET
@ -902,37 +901,38 @@ print_insn_microblaze(bfd_vma memaddr, struct disassemble_info *info)
} }
break; break;
case INST_TYPE_RD_R2: case INST_TYPE_RD_R2:
fprintf_func(stream, "\t%s, %s", fprintf_func(stream, "%s\t%s, %s",
get_field_rd(inst), get_field_r2(inst)); op->name, get_field_rd(inst), get_field_r2(inst));
break; break;
case INST_TYPE_R2: case INST_TYPE_R2:
fprintf_func(stream, "\t%s", fprintf_func(stream, "%s\t%s",
get_field_r2(inst)); op->name, get_field_r2(inst));
break; break;
case INST_TYPE_R1: case INST_TYPE_R1:
fprintf_func(stream, "\t%s", fprintf_func(stream, "%s\t%s",
get_field_r1(inst)); op->name, get_field_r1(inst));
break; break;
case INST_TYPE_RD_R1_SPECIAL: case INST_TYPE_RD_R1_SPECIAL:
fprintf_func(stream, "\t%s, %s", fprintf_func(stream, "%s\t%s, %s",
get_field_rd(inst), get_field_r2(inst)); op->name, get_field_rd(inst), get_field_r2(inst));
break; break;
case INST_TYPE_RD_IMM15: case INST_TYPE_RD_IMM15:
fprintf_func(stream, "\t%s, %s", fprintf_func(stream, "%s\t%s, %s",
get_field_rd(inst), get_field_imm15(inst)); op->name, get_field_rd(inst), get_field_imm15(inst));
break; break;
/* For tuqula instruction */ /* For tuqula instruction */
case INST_TYPE_RD: case INST_TYPE_RD:
fprintf_func(stream, "\t%s", fprintf_func(stream, "%s\t%s",
get_field_rd(inst)); op->name, get_field_rd(inst));
break; break;
case INST_TYPE_RFSL: case INST_TYPE_RFSL:
fprintf_func(stream, "\t%s", fprintf_func(stream, "%s\t%s",
get_field_rfsl(inst)); op->name, get_field_rfsl(inst));
break; break;
default: default:
/* if the disassembler lags the instruction set */ /* if the disassembler lags the instruction set */
fprintf_func(stream, "\tundecoded operands, inst is 0x%04lx", inst); fprintf_func(stream, "%s\tundecoded operands, inst is 0x%04lx",
op->name, inst);
break; break;
} }
return 4; return 4;