[llvm-branch-commits] [llvm-branch] r85269 - in /llvm/branches/Apple/Leela: include/llvm/CodeGen/MachineLoopInfo.h lib/CodeGen/MachineLoopInfo.cpp
Bill Wendling
isanbard at gmail.com
Tue Oct 27 11:41:43 PDT 2009
Author: void
Date: Tue Oct 27 13:41:43 2009
New Revision: 85269
URL: http://llvm.org/viewvc/llvm-project?rev=85269&view=rev
Log:
$ svn merge -c 84596 https://llvm.org/svn/llvm-project/llvm/trunk
--- Merging r84596 into '.':
U include/llvm/CodeGen/MachineLoopInfo.h
U lib/CodeGen/MachineLoopInfo.cpp
Modified:
llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineLoopInfo.h
llvm/branches/Apple/Leela/lib/CodeGen/MachineLoopInfo.cpp
Modified: llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineLoopInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineLoopInfo.h?rev=85269&r1=85268&r2=85269&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineLoopInfo.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineLoopInfo.h Tue Oct 27 13:41:43 2009
@@ -38,6 +38,17 @@
class MachineLoop : public LoopBase<MachineBasicBlock, MachineLoop> {
public:
MachineLoop();
+
+ /// getTopBlock - Return the "top" block in the loop, which is the first
+ /// block in the linear layout, ignoring any parts of the loop not
+ /// contiguous with the part the contains the header.
+ MachineBasicBlock *getTopBlock();
+
+ /// getBottomBlock - Return the "bottom" block in the loop, which is the last
+ /// block in the linear layout, ignoring any parts of the loop not
+ /// contiguous with the part the contains the header.
+ MachineBasicBlock *getBottomBlock();
+
private:
friend class LoopInfoBase<MachineBasicBlock, MachineLoop>;
explicit MachineLoop(MachineBasicBlock *MBB)
Modified: llvm/branches/Apple/Leela/lib/CodeGen/MachineLoopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/CodeGen/MachineLoopInfo.cpp?rev=85269&r1=85268&r2=85269&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/CodeGen/MachineLoopInfo.cpp (original)
+++ llvm/branches/Apple/Leela/lib/CodeGen/MachineLoopInfo.cpp Tue Oct 27 13:41:43 2009
@@ -43,3 +43,31 @@
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;
+}
More information about the llvm-branch-commits
mailing list