diff options
author | Devang Patel <dpatel@apple.com> | 2006-12-07 23:24:58 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2006-12-07 23:24:58 +0000 |
commit | f72d29c540bf32b9c0e8914484cbbdeac70ee12a (patch) | |
tree | 7de49cdbe2e20a6fefa93a8b2ee0dda822fd6d09 | |
parent | c17bbb6da7e17c06c1f0ae7baa2f151db0e966d9 (diff) | |
download | external_llvm-f72d29c540bf32b9c0e8914484cbbdeac70ee12a.zip external_llvm-f72d29c540bf32b9c0e8914484cbbdeac70ee12a.tar.gz external_llvm-f72d29c540bf32b9c0e8914484cbbdeac70ee12a.tar.bz2 |
Maintain level(or depth) of pass manager in pass manager food chain.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32339 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/VMCore/PassManager.cpp | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index 99e7bc5..eb85465 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -209,7 +209,7 @@ class PMDataManager { public: - PMDataManager() : TPM(NULL) { + PMDataManager(int D) : TPM(NULL), Depth(D) { initializeAnalysisInfo(); } @@ -275,6 +275,8 @@ public: PMTopLevelManager *getTopLevelManager() { return TPM; } void setTopLevelManager(PMTopLevelManager *T) { TPM = T; } + unsigned getDepth() { return Depth; } + private: // Set of available Analysis. This information is used while scheduling // pass. If a pass requires an analysis which is not not available then @@ -288,6 +290,8 @@ private: // Top level manager. // TODO : Make it a reference. PMTopLevelManager *TPM; + + unsigned Depth; }; /// BasicBlockPassManager_New manages BasicBlockPass. It batches all the @@ -297,7 +301,7 @@ class BasicBlockPassManager_New : public PMDataManager, public FunctionPass { public: - BasicBlockPassManager_New() { } + BasicBlockPassManager_New(int D) : PMDataManager(D) { } /// Add a pass into a passmanager queue. bool addPass(Pass *p); @@ -326,8 +330,9 @@ class FunctionPassManagerImpl_New : public ModulePass, public PMDataManager, public PMTopLevelManager { public: - FunctionPassManagerImpl_New(ModuleProvider *P) { /* TODO */ } - FunctionPassManagerImpl_New() { + FunctionPassManagerImpl_New(ModuleProvider *P, int D) : + PMDataManager(D) { /* TODO */ } + FunctionPassManagerImpl_New(int D) : PMDataManager(D) { activeBBPassManager = NULL; } ~FunctionPassManagerImpl_New() { /* TODO */ }; @@ -382,7 +387,9 @@ private: class ModulePassManager_New : public PMDataManager { public: - ModulePassManager_New() { activeFunctionPassManager = NULL; } + ModulePassManager_New(int D) : PMDataManager(D) { + activeFunctionPassManager = NULL; + } /// Add a pass into a passmanager queue. bool addPass(Pass *p); @@ -412,6 +419,8 @@ class PassManagerImpl_New : public Pass, public: + PassManagerImpl_New(int D) : PMDataManager(D) {} + /// add - Add a pass to the queue of passes to run. This passes ownership of /// the Pass to the PassManager. When the PassManager is destroyed, the pass /// will be destroyed as well, so there is no need to delete the pass. This @@ -615,7 +624,7 @@ Pass * BasicBlockPassManager_New::getAnalysisPassFromManager(AnalysisID AID) { /// Create new Function pass manager FunctionPassManager_New::FunctionPassManager_New() { - FPM = new FunctionPassManagerImpl_New(); + FPM = new FunctionPassManagerImpl_New(0); } /// add - Add a pass to the queue of passes to run. This passes @@ -679,7 +688,8 @@ FunctionPassManagerImpl_New::addPass(Pass *P) { activeBBPassManager->initializeAnalysisInfo(); // Create and add new manager - activeBBPassManager = new BasicBlockPassManager_New(); + activeBBPassManager = + new BasicBlockPassManager_New(getDepth() + 1); addPassToManager(activeBBPassManager, false); // Add pass into new manager. This time it must succeed. @@ -818,7 +828,8 @@ ModulePassManager_New::addPass(Pass *P) { activeFunctionPassManager->initializeAnalysisInfo(); // Create and add new manager - activeFunctionPassManager = new FunctionPassManagerImpl_New(); + activeFunctionPassManager = + new FunctionPassManagerImpl_New(getDepth() + 1); addPassToManager(activeFunctionPassManager, false); // Add pass into new manager. This time it must succeed. @@ -905,7 +916,7 @@ Pass *PassManagerImpl_New::getAnalysisPassFromManager(AnalysisID AID) { bool PassManagerImpl_New::addPass(Pass *P) { if (!activeManager || !activeManager->addPass(P)) { - activeManager = new ModulePassManager_New(); + activeManager = new ModulePassManager_New(getDepth() + 1); PassManagers.push_back(activeManager); return activeManager->addPass(P); } @@ -930,7 +941,7 @@ bool PassManagerImpl_New::run(Module &M) { /// Create new pass manager PassManager_New::PassManager_New() { - PM = new PassManagerImpl_New(); + PM = new PassManagerImpl_New(0); } /// add - Add a pass to the queue of passes to run. This passes ownership of |