mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
Add getTopBlock and getBottomBlock member functions to MachineLoopInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84596 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -43,3 +43,31 @@ void MachineLoopInfo::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequired<MachineDominatorTree>();
|
||||
MachineFunctionPass::getAnalysisUsage(AU);
|
||||
}
|
||||
|
||||
MachineBasicBlock *MachineLoop::getTopBlock() {
|
||||
MachineBasicBlock *TopMBB = getHeader();
|
||||
MachineFunction::iterator Begin = TopMBB->getParent()->begin();
|
||||
if (TopMBB != Begin) {
|
||||
MachineBasicBlock *PriorMBB = prior(MachineFunction::iterator(TopMBB));
|
||||
while (contains(PriorMBB)) {
|
||||
TopMBB = PriorMBB;
|
||||
if (TopMBB == Begin) break;
|
||||
PriorMBB = prior(MachineFunction::iterator(TopMBB));
|
||||
}
|
||||
}
|
||||
return TopMBB;
|
||||
}
|
||||
|
||||
MachineBasicBlock *MachineLoop::getBottomBlock() {
|
||||
MachineBasicBlock *BotMBB = getHeader();
|
||||
MachineFunction::iterator End = BotMBB->getParent()->end();
|
||||
if (BotMBB != prior(End)) {
|
||||
MachineBasicBlock *NextMBB = next(MachineFunction::iterator(BotMBB));
|
||||
while (contains(NextMBB)) {
|
||||
BotMBB = NextMBB;
|
||||
if (BotMBB == next(MachineFunction::iterator(BotMBB))) break;
|
||||
NextMBB = next(MachineFunction::iterator(BotMBB));
|
||||
}
|
||||
}
|
||||
return BotMBB;
|
||||
}
|
||||
|
Reference in New Issue
Block a user