aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/LoopPass.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2007-03-06 16:59:03 +0000
committerDevang Patel <dpatel@apple.com>2007-03-06 16:59:03 +0000
commita5057d02c05efc0ead8787c76a012382ef675b03 (patch)
tree7d7fc0d152a28c17b7ba3c78b6e7b11ff8c348e6 /lib/Analysis/LoopPass.cpp
parent28b3c45109153bc50d3d9e97dccb25ffd043fa50 (diff)
LPPassManager : Add initialization and finalizatino hooks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34968 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/LoopPass.cpp')
-rw-r--r--lib/Analysis/LoopPass.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/Analysis/LoopPass.cpp b/lib/Analysis/LoopPass.cpp
index fe1672a403..8d613b09f4 100644
--- a/lib/Analysis/LoopPass.cpp
+++ b/lib/Analysis/LoopPass.cpp
@@ -57,6 +57,18 @@ bool LPPassManager::runOnFunction(Function &F) {
for (LoopInfo::iterator I = LI.begin(), E = LI.end(); I != E; ++I)
addLoopIntoQueue(*I, LQ);
+ // Initialization
+ for (std::deque<Loop *>::const_iterator I = LQ.begin(), E = LQ.end();
+ I != E; ++I) {
+ Loop *L = *I;
+ for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
+ Pass *P = getContainedPass(Index);
+ LoopPass *LP = dynamic_cast<LoopPass *>(P);
+ if (LP)
+ Changed |= LP->doInitialization(L, *this);
+ }
+ }
+
// Walk Loops
while (!LQ.empty()) {
@@ -101,6 +113,14 @@ bool LPPassManager::runOnFunction(Function &F) {
if (redoThisLoop)
LQ.push_back(L);
}
+
+ // Finalization
+ for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
+ Pass *P = getContainedPass(Index);
+ LoopPass *LP = dynamic_cast <LoopPass *>(P);
+ if (LP)
+ Changed |= LP->doFinalization();
+ }
return Changed;
}