ppc: alias instruction for 'gBC 4, 2, target' to 'bne target'. issue reported by @kratolp

test2
Nguyen Anh Quynh 10 years ago
parent 1f196d12ea
commit f46ef2e0fe
  1. 10
      arch/PowerPC/PPCGenAsmWriter.inc
  2. 1
      arch/PowerPC/PPCInstPrinter.c

@ -7713,6 +7713,16 @@ static char *printAliasInstr(MCInst *MI, SStream *OS, void *info)
AsmString = "bt $\x02, $\xFF\x03\x01";
break;
}
if (MCInst_getNumOperands(MI) == 3 &&
MCOperand_isImm(MCInst_getOperand(MI, 0)) &&
MCOperand_getImm(MCInst_getOperand(MI, 0)) == 4 &&
MCOperand_isReg(MCInst_getOperand(MI, 1)) &&
PPC_map_register(MCOperand_getReg(MCInst_getOperand(MI, 1))) == PPC_REG_R2 &&
GETREGCLASS_CONTAIN(PPC_CRBITRCRegClassID, 1)) {
// (gBC 4, crbitrc:$bi, condbrtarget:$dst)
AsmString = "bne $\xFF\x03\x02";
break;
}
if (MCInst_getNumOperands(MI) == 3 &&
MCOperand_isImm(MCInst_getOperand(MI, 0)) &&
MCOperand_getImm(MCInst_getOperand(MI, 0)) == 4 &&

@ -454,6 +454,7 @@ static void printAbsBranchOperand(MCInst *MI, unsigned OpNo, SStream *O)
else
SStream_concat(O, "-%u", -imm);
}
if (MI->csh->detail) {
MI->flat_insn->detail->ppc.operands[MI->flat_insn->detail->ppc.op_count].type = PPC_OP_IMM;
MI->flat_insn->detail->ppc.operands[MI->flat_insn->detail->ppc.op_count].imm = imm;

Loading…
Cancel
Save