@samitouri / QOSamiQemu / commits / f8bc5f5635

disas/riscv: Pass rv_opcode_data pointer to/from decode_inst_lift_pseudo

Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-ID: <20260812223142.349142-7-richard.henderson@linaro.org> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

Richard Henderson committed Aug 12, 2026 at 15:30 UTC f8bc5f5635f67dc21919454bdca4a9f917e5337d
1 file changed +14 -13
disas/riscv.c
+14 -13
@@ -5358,21 +5358,22 @@ static GString *format_inst(size_t tab, rv_decode *dec)
5358
5359 /* lift instruction to pseudo-instruction */
5360
5361 -static void decode_inst_lift_pseudo(rv_decode *dec)
5361 +static const rv_opcode_data *decode_inst_lift_pseudo(rv_decode *dec,
5362 + const rv_opcode_data *op)
5363 {
5363 - const rv_opcode_data *opcode_data = dec->opcode_data;
5364 - const rv_comp_data *comp_data = opcode_data[dec->op].pseudo;
5365 - if (!comp_data) {
5366 - return;
5367 - }
5368 - while (comp_data->constraints) {
5369 - if (check_constraints(dec, comp_data->constraints)) {
5370 - dec->op = comp_data->op;
5371 - dec->codec = opcode_data[dec->op].codec;
5372 - return;
5364 + const rv_comp_data *comp_data = op->pseudo;
5365 + if (comp_data) {
5366 + while (comp_data->constraints) {
5367 + if (check_constraints(dec, comp_data->constraints)) {
5368 + dec->op = comp_data->op;
5369 + op = &dec->opcode_data[dec->op];
5370 + dec->codec = op->codec;
5371 + break;
5372 + }
5373 + comp_data++;
5374 }
5374 - comp_data++;
5375 }
5376 + return op;
5377 }
5378
5379 /* decompress instruction */
@@ -5464,7 +5465,7 @@ static GString *disasm_inst(rv_isa isa, uint64_t pc, rv_inst inst,
5465 op = &dec.opcode_data[dec.op];
5466 decode_inst_operands(&dec, isa, op);
5467 op = decode_inst_decompress(&dec, isa, op);
5467 - decode_inst_lift_pseudo(&dec);
5468 + op = decode_inst_lift_pseudo(&dec, op);
5469 return format_inst(24, &dec);
5470 }
5471