From: Devang Patel Date: Fri, 8 Dec 2006 22:47:25 +0000 (+0000) Subject: Do not keep yet another list of pass managers in PassManagerImpl_New. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a083e94f7971ddafb817b1bcd86992d9fc4d8f9e;p=oota-llvm.git Do not keep yet another list of pass managers in PassManagerImpl_New. Use one provided by toplevel manager. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32380 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index 1141c6a3291..5c9da43b867 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -137,6 +137,10 @@ public: return ImmutablePasses; } + void addPassManager(Pass *Manager) { + PassManagers.push_back(Manager); + } + private: /// Collection of pass managers @@ -479,9 +483,6 @@ private: /// Add a pass into a passmanager queue. bool addPass(Pass *p); - // Collection of pass managers - std::vector PassManagers; - // Active Pass Manager ModulePassManager_New *activeManager; }; @@ -1018,7 +1019,7 @@ bool PassManagerImpl_New::addPass(Pass *P) { if (!activeManager || !activeManager->addPass(P)) { activeManager = new ModulePassManager_New(getDepth() + 1); - PassManagers.push_back(activeManager); + addPassManager(activeManager); return activeManager->addPass(P); } return true; @@ -1029,10 +1030,10 @@ bool PassManagerImpl_New::addPass(Pass *P) { bool PassManagerImpl_New::run(Module &M) { bool Changed = false; - for (std::vector::iterator itr = PassManagers.begin(), - e = PassManagers.end(); itr != e; ++itr) { - ModulePassManager_New *pm = *itr; - Changed |= pm->runOnModule(M); + for (std::vector::iterator I = passManagersBegin(), + E = passManagersEnd(); I != E; ++I) { + ModulePassManager_New *MP = dynamic_cast(*I); + Changed |= MP->runOnModule(M); } return Changed; }