Skip to content

Commit 66b162f

Browse files
committed
Swap alias with real operands
1 parent 2f839ec commit 66b162f

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

arch/RISCV/RISCVInstPrinter.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -416,21 +416,23 @@ void RISCV_LLVM_printInstruction(MCInst *MI, SStream *O,
416416
MI->flat_insn->detail->riscv.op_count = 0;
417417
// re-disassemble again with no printing in order to obtain the full details
418418
// including the whole operands array
419-
printInstruction(MI, MI->address, O);
419+
printInstruction(McInstr, MI->address, O);
420420
// re-open the stream to restore the usual state
421421
SStream_Open(O);
422422
}
423423
// the instruction is not an ISA alias, but it still can be an uncompressed "alias"
424424
} else {
425425
if (is_uncompressed) {
426-
unsigned int i = find_cs_id(MCInst_getOpcode(&Uncompressed),
427-
RISCV_insns, RISCV_insn_count);
426+
unsigned int i =
427+
find_cs_id(MCInst_getOpcode(&Uncompressed),
428+
RISCV_insns, RISCV_insn_count);
428429
if (i != -1) {
429-
Uncompressed.flat_insn->alias_id = RISCV_insns[i].mapid;
430+
Uncompressed.flat_insn->alias_id =
431+
RISCV_insns[i].mapid;
430432
MCInst_setIsAlias(&Uncompressed, true);
431433
}
432434
}
433-
printInstruction(McInstr, MI->address, O);
435+
printInstruction(MI, MI->address, O);
434436

435437
// do we still want the exact details even if the text is alias ?
436438
if (!usesAliasDetails && detail_is_set(MI)) {
@@ -442,7 +444,7 @@ void RISCV_LLVM_printInstruction(MCInst *MI, SStream *O,
442444
MI->flat_insn->detail->riscv.op_count = 0;
443445
// re-disassemble again with no printing in order to obtain the full details
444446
// including the whole operands array
445-
printInstruction(MI, MI->address, O);
447+
printInstruction(McInstr, MI->address, O);
446448
// re-open the stream to restore the usual state
447449
SStream_Open(O);
448450
}

0 commit comments

Comments
 (0)