Reviewed-by: Alistair Francis <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
---
disas/riscv.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/disas/riscv.c b/disas/riscv.c
index 47fae7316c..0be2f07612 100644
--- a/disas/riscv.c
+++ b/disas/riscv.c
@@ -5358,21 +5358,22 @@ static GString *format_inst(size_t tab, rv_decode *dec)
/* lift instruction to pseudo-instruction */
-static void decode_inst_lift_pseudo(rv_decode *dec)
+static const rv_opcode_data *decode_inst_lift_pseudo(rv_decode *dec,
+ const rv_opcode_data *op)
{
- const rv_opcode_data *opcode_data = dec->opcode_data;
- const rv_comp_data *comp_data = opcode_data[dec->op].pseudo;
- if (!comp_data) {
- return;
- }
- while (comp_data->constraints) {
- if (check_constraints(dec, comp_data->constraints)) {
- dec->op = comp_data->op;
- dec->codec = opcode_data[dec->op].codec;
- return;
+ const rv_comp_data *comp_data = op->pseudo;
+ if (comp_data) {
+ while (comp_data->constraints) {
+ if (check_constraints(dec, comp_data->constraints)) {
+ dec->op = comp_data->op;
+ op = &dec->opcode_data[dec->op];
+ dec->codec = op->codec;
+ break;
+ }
+ comp_data++;
}
- comp_data++;
}
+ return op;
}
/* decompress instruction */
@@ -5464,7 +5465,7 @@ static GString *disasm_inst(rv_isa isa, uint64_t pc,
rv_inst inst,
op = &dec.opcode_data[dec.op];
decode_inst_operands(&dec, isa, op);
op = decode_inst_decompress(&dec, isa, op);
- decode_inst_lift_pseudo(&dec);
+ op = decode_inst_lift_pseudo(&dec, op);
return format_inst(24, &dec);
}
--
2.43.0