Make MCPlusBuilder::isUnsupportedBranch() take MCInst, not opcode.
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D152765
}
/// Check whether we support inverting this branch
- virtual bool isUnsupportedBranch(unsigned Opcode) const { return false; }
+ virtual bool isUnsupportedBranch(const MCInst &Inst) const { return false; }
/// Return true of the instruction is of pseudo kind.
bool isPseudo(const MCInst &Inst) const {
const bool IsCondBranch = MIB->isConditionalBranch(Instruction);
MCSymbol *TargetSymbol = nullptr;
- if (BC.MIB->isUnsupportedBranch(Instruction.getOpcode())) {
+ if (BC.MIB->isUnsupportedBranch(Instruction)) {
setIgnored();
if (BinaryFunction *TargetFunc =
BC.getBinaryFunctionContainingAddress(TargetAddress))
const BinaryBasicBlock *TSuccessor = BB->getConditionalSuccessor(true);
const BinaryBasicBlock *FSuccessor = BB->getConditionalSuccessor(false);
// Check whether we support reversing this branch direction
- const bool IsSupported =
- !MIB->isUnsupportedBranch(CondBranch->getOpcode());
+ const bool IsSupported = !MIB->isUnsupportedBranch(*CondBranch);
if (NextBB && NextBB == TSuccessor && IsSupported) {
std::swap(TSuccessor, FSuccessor);
{
else if (BC.MIB->isUnconditionalBranch(Inst))
HasUnconditionalBranch = true;
else if ((!BC.MIB->isCall(Inst) && !BC.MIB->isConditionalBranch(Inst)) ||
- BC.MIB->isUnsupportedBranch(Inst.getOpcode()))
+ BC.MIB->isUnsupportedBranch(Inst))
continue;
const uint32_t FromOffset = *BC.MIB->getOffset(Inst);
return false;
}
- bool isUnsupportedBranch(unsigned Opcode) const override {
- switch (Opcode) {
+ bool isUnsupportedBranch(const MCInst &Inst) const override {
+ switch (Inst.getOpcode()) {
default:
return false;
case X86::LOOP:
}
// Handle conditional branches and ignore indirect branches
- if (!isUnsupportedBranch(I->getOpcode()) &&
- getCondCode(*I) == X86::COND_INVALID) {
+ if (!isUnsupportedBranch(*I) && getCondCode(*I) == X86::COND_INVALID) {
// Indirect branch
return false;
}