for (const auto &LiveIn : Entry.MBB->liveins())
Loop.MBB->addLiveIn(LiveIn);
Loop.addInstructions(Instructions);
- ET.decrementLoopCounterAndLoop(*Loop.MBB, State.getInstrInfo());
+ ET.decrementLoopCounterAndJump(*Loop.MBB, *Loop.MBB,
+ State.getInstrInfo());
// Set up the exit basic block.
Loop.MBB->addSuccessor(Exit.MBB, llvm::BranchProbability::getZero());
}
// Adds the code to decrement the loop counter and
- virtual void decrementLoopCounterAndLoop(MachineBasicBlock &MBB,
+ virtual void decrementLoopCounterAndJump(MachineBasicBlock &MBB,
+ MachineBasicBlock &TargetMBB,
const llvm::MCInstrInfo &MII) const {
llvm_unreachable("decrementLoopCounterAndBranch() requires "
"getLoopCounterRegister() > 0");
void fillMemoryOperands(InstructionTemplate &IT, unsigned Reg,
unsigned Offset) const override;
- void decrementLoopCounterAndLoop(MachineBasicBlock &MBB,
+ void decrementLoopCounterAndJump(MachineBasicBlock &MBB,
+ MachineBasicBlock &TargetMBB,
const llvm::MCInstrInfo &MII) const override;
std::vector<llvm::MCInst> setRegTo(const llvm::MCSubtargetInfo &STI,
SetOp(MemOpIdx + 4, MCOperand::createReg(0)); // Segment
}
-void ExegesisX86Target::decrementLoopCounterAndLoop(
- MachineBasicBlock &MBB, const llvm::MCInstrInfo &MII) const {
+void ExegesisX86Target::decrementLoopCounterAndJump(
+ MachineBasicBlock &MBB, MachineBasicBlock &TargetMBB,
+ const llvm::MCInstrInfo &MII) const {
BuildMI(&MBB, DebugLoc(), MII.get(X86::ADD64ri8))
.addDef(kLoopCounterReg)
.addUse(kLoopCounterReg)
.addImm(-1);
BuildMI(&MBB, DebugLoc(), MII.get(X86::JCC_1))
- .addMBB(&MBB)
+ .addMBB(&TargetMBB)
.addImm(X86::COND_NE);
}