[llvm-commits] CVS: llvm/lib/Analysis/LoopPass.cpp
Devang Patel
dpatel at apple.com
Tue Mar 6 11:00:24 PST 2007
Changes in directory llvm/lib/Analysis:
LoopPass.cpp updated: 1.13 -> 1.14
---
Log message:
Add LPPassManager::insertLoop().
---
Diffs of the changes: (+32 -0)
LoopPass.cpp | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+)
Index: llvm/lib/Analysis/LoopPass.cpp
diff -u llvm/lib/Analysis/LoopPass.cpp:1.13 llvm/lib/Analysis/LoopPass.cpp:1.14
--- llvm/lib/Analysis/LoopPass.cpp:1.13 Tue Mar 6 12:38:33 2007
+++ llvm/lib/Analysis/LoopPass.cpp Tue Mar 6 13:00:02 2007
@@ -97,10 +97,42 @@
}
}
+// Inset loop into loop nest (LoopInfo) and loop queue (LQ).
+void LPPassManager::insertLoop(Loop *L, Loop *ParentLoop) {
+
+ assert (CurrentLoop != L && "Cannot insert CurrentLoop");
+
+ // Insert into loop nest
+ if (ParentLoop)
+ ParentLoop->addChildLoop(L);
+ else
+ LI->addTopLevelLoop(L);
+
+ // Insert L into loop queue
+ if (L == CurrentLoop)
+ redoLoop(L);
+ else if (!ParentLoop)
+ // This is top level loop.
+ LQ.push_front(L);
+ else {
+ // Insert L after ParentLoop
+ for (std::deque<Loop *>::iterator I = LQ.begin(),
+ E = LQ.end(); I != E; ++I) {
+ if (*I == ParentLoop) {
+ // deque does not support insert after.
+ ++I;
+ LQ.insert(I, 1, L);
+ break;
+ }
+ }
+ }
+}
+
// Reoptimize this loop. LPPassManager will re-insert this loop into the
// queue. This allows LoopPass to change loop nest for the loop. This
// utility may send LPPassManager into infinite loops so use caution.
void LPPassManager::redoLoop(Loop *L) {
+ assert (CurrentLoop != L && "Can redo only CurrentLoop");
redoThisLoop = true;
}
More information about the llvm-commits
mailing list