diff options
author | Devang Patel <dpatel@apple.com> | 2006-12-08 00:59:05 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2006-12-08 00:59:05 +0000 |
commit | 964e45e60769ccdb4ee0230a179f84f37f6c371a (patch) | |
tree | 5837bca6f0ae1eeb8b41baef3b88d0465af22c9a | |
parent | f9a60ae75d6fdc74160085323c14e92e7d3517d3 (diff) | |
download | external_llvm-964e45e60769ccdb4ee0230a179f84f37f6c371a.zip external_llvm-964e45e60769ccdb4ee0230a179f84f37f6c371a.tar.gz external_llvm-964e45e60769ccdb4ee0230a179f84f37f6c371a.tar.bz2 |
doInitialization and doFinalization for BasicBlockPassManager_New
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32345 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/VMCore/PassManager.cpp | 63 |
1 files changed, 60 insertions, 3 deletions
diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index 8cf4a15..1bc7872 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -199,7 +199,6 @@ void PMTopLevelManager::schedulePass(Pass *P, Pass *PM) { addTopLevelPass(P); } - //===----------------------------------------------------------------------===// // PMDataManager @@ -327,7 +326,11 @@ public: Info.setPreservesAll(); } -private: + bool doInitialization(Module &M); + bool doInitialization(Function &F); + bool doFinalization(Module &M); + bool doFinalization(Function &F); + }; /// FunctionPassManagerImpl_New manages FunctionPasses and BasicBlockPassManagers. @@ -533,7 +536,7 @@ void PMDataManager::removeDeadPasses(Pass *P) { std::map<AnalysisID, Pass*>::iterator Pos = AvailableAnalysis.find((*I)->getPassInfo()); - // It is possible that deadPass is already removed from the AvailableAnalysis + // It is possible that pass is already removed from the AvailableAnalysis if (Pos != AvailableAnalysis.end()) AvailableAnalysis.erase(Pos); } @@ -669,6 +672,60 @@ Pass * BasicBlockPassManager_New::getAnalysisPassFromManager(AnalysisID AID) { return getAnalysisPass(AID); } +// Implement doInitialization and doFinalization +inline bool BasicBlockPassManager_New::doInitialization(Module &M) { + bool Changed = false; + + for (std::vector<Pass *>::iterator itr = passVectorBegin(), + e = passVectorEnd(); itr != e; ++itr) { + Pass *P = *itr; + BasicBlockPass *BP = dynamic_cast<BasicBlockPass*>(P); + Changed |= BP->doInitialization(M); + } + + return Changed; +} + +inline bool BasicBlockPassManager_New::doFinalization(Module &M) { + bool Changed = false; + + for (std::vector<Pass *>::iterator itr = passVectorBegin(), + e = passVectorEnd(); itr != e; ++itr) { + Pass *P = *itr; + BasicBlockPass *BP = dynamic_cast<BasicBlockPass*>(P); + Changed |= BP->doFinalization(M); + } + + return Changed; +} + +inline bool BasicBlockPassManager_New::doInitialization(Function &F) { + bool Changed = false; + + for (std::vector<Pass *>::iterator itr = passVectorBegin(), + e = passVectorEnd(); itr != e; ++itr) { + Pass *P = *itr; + BasicBlockPass *BP = dynamic_cast<BasicBlockPass*>(P); + Changed |= BP->doInitialization(F); + } + + return Changed; +} + +inline bool BasicBlockPassManager_New::doFinalization(Function &F) { + bool Changed = false; + + for (std::vector<Pass *>::iterator itr = passVectorBegin(), + e = passVectorEnd(); itr != e; ++itr) { + Pass *P = *itr; + BasicBlockPass *BP = dynamic_cast<BasicBlockPass*>(P); + Changed |= BP->doFinalization(F); + } + + return Changed; +} + + //===----------------------------------------------------------------------===// // FunctionPassManager_New implementation |