mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
Reapply r55191 and r55192.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55205 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -145,6 +145,8 @@ BasicBlock::iterator
|
||||
FastISel::SelectInstructions(BasicBlock::iterator Begin,
|
||||
BasicBlock::iterator End,
|
||||
DenseMap<const Value*, unsigned> &ValueMap,
|
||||
std::map<const BasicBlock*,
|
||||
MachineBasicBlock *> &MBBMap,
|
||||
MachineBasicBlock *mbb) {
|
||||
MBB = mbb;
|
||||
BasicBlock::iterator I = Begin;
|
||||
@ -195,19 +197,24 @@ FastISel::SelectInstructions(BasicBlock::iterator Begin,
|
||||
case Instruction::Br: {
|
||||
BranchInst *BI = cast<BranchInst>(I);
|
||||
|
||||
// For now, check for and handle just the most trivial case: an
|
||||
// unconditional fall-through branch.
|
||||
if (BI->isUnconditional()) {
|
||||
MachineFunction::iterator NextMBB =
|
||||
MachineFunction::iterator NextMBB =
|
||||
next(MachineFunction::iterator(MBB));
|
||||
if (NextMBB != MF.end() &&
|
||||
NextMBB->getBasicBlock() == BI->getSuccessor(0)) {
|
||||
MBB->addSuccessor(NextMBB);
|
||||
break;
|
||||
BasicBlock *LLVMSucc = BI->getSuccessor(0);
|
||||
MachineBasicBlock *MSucc = MBBMap[LLVMSucc];
|
||||
|
||||
if (NextMBB != MF.end() && MSucc == NextMBB) {
|
||||
// The unconditional fall-through case, which needs no instructions.
|
||||
} else {
|
||||
// The unconditional branch case.
|
||||
TII.InsertBranch(*MBB, MSucc, NULL, SmallVector<MachineOperand, 0>());
|
||||
}
|
||||
MBB->addSuccessor(MSucc);
|
||||
break;
|
||||
}
|
||||
|
||||
// Something more complicated. Halt "fast" selection and bail.
|
||||
// Conditional branches are not handed yet.
|
||||
// Halt "fast" selection and bail.
|
||||
return I;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user