diff options
author | Devang Patel <dpatel@apple.com> | 2007-03-06 16:59:03 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2007-03-06 16:59:03 +0000 |
commit | 84ffc223f169cc584852b263ed906d6864a6f85c (patch) | |
tree | 50c1571b408598c97206f581ef053d14d2959cce /llvm/lib/Analysis | |
parent | 8b8cac289bd4356f2f364e2a41f183e3c1727cf6 (diff) | |
download | bcm5719-llvm-84ffc223f169cc584852b263ed906d6864a6f85c.tar.gz bcm5719-llvm-84ffc223f169cc584852b263ed906d6864a6f85c.zip |
LPPassManager : Add initialization and finalizatino hooks.
llvm-svn: 34968
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/LoopPass.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/LoopPass.cpp b/llvm/lib/Analysis/LoopPass.cpp index fe1672a4037..8d613b09f42 100644 --- a/llvm/lib/Analysis/LoopPass.cpp +++ b/llvm/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; } |