Start using PMStack. Now each pass is responsibe for assinging

a pass manager for itself.

There is some opportunity to remove some dead code from PassManager.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33087 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel 2007-01-11 22:15:30 +00:00
parent 6cb4c1ad7f
commit 36bcb82c3f

View File

@ -24,6 +24,7 @@
using namespace llvm;
class llvm::PMDataManager;
class llvm::PMStack;
//===----------------------------------------------------------------------===//
// Overview:
@ -190,6 +191,9 @@ public:
void initializeAllAnalysisInfo();
// Active Pass Managers
PMStack activeStack;
protected:
/// Collection of pass managers
@ -434,9 +438,8 @@ private:
//
/// FunctionPassManagerImpl manages FPPassManagers
class FunctionPassManagerImpl : public Pass,
public PMDataManager,
public PMTopLevelManager {
public PMDataManager,
public PMTopLevelManager {
public:
FunctionPassManagerImpl(int Depth) : PMDataManager(Depth) {
@ -551,8 +554,8 @@ private:
//
/// PassManagerImpl manages MPPassManagers
class PassManagerImpl : public Pass,
public PMDataManager,
public PMTopLevelManager {
public PMDataManager,
public PMTopLevelManager {
public:
@ -1218,19 +1221,15 @@ bool FunctionPassManager::doFinalization() {
/// manage it.
bool FunctionPassManagerImpl::addPass(Pass *P) {
if (!activeManager || !activeManager->addPass(P)) {
activeManager = new FPPassManager(getDepth() + 1);
// Inherit top level manager
activeManager->setTopLevelManager(this->getTopLevelManager());
// This top level manager is going to manage activeManager.
// Set up analysis resolver to connect them.
AnalysisResolver *AR = new AnalysisResolver(*this);
activeManager->setResolver(AR);
addPassManager(activeManager);
return activeManager->addPass(P);
if (activeStack.empty()) {
FPPassManager *FPP = new FPPassManager(getDepth() + 1);
FPP->setTopLevelManager(this->getTopLevelManager());
addPassManager(FPP);
activeStack.push(FPP);
}
P->assignPassManager(activeStack);
return true;
}
@ -1525,21 +1524,16 @@ MPPassManager::runOnModule(Module &M) {
/// manage it.
bool PassManagerImpl::addPass(Pass *P) {
if (!activeManager || !activeManager->addPass(P)) {
activeManager = new MPPassManager(getDepth() + 1);
// Inherit top level manager
activeManager->setTopLevelManager(this->getTopLevelManager());
// This top level manager is going to manage activeManager.
// Set up analysis resolver to connect them.
AnalysisResolver *AR = new AnalysisResolver(*this);
activeManager->setResolver(AR);
addPassManager(activeManager);
return activeManager->addPass(P);
if (activeStack.empty()) {
MPPassManager *MPP = new MPPassManager(getDepth() + 1);
MPP->setTopLevelManager(this->getTopLevelManager());
addPassManager(MPP);
activeStack.push(MPP);
}
P->assignPassManager(activeStack);
return true;
}
@ -1618,6 +1612,7 @@ void TimingInfo::createTheTimeInfo() {
//===----------------------------------------------------------------------===//
// PMStack implementation
//
// Pop Pass Manager from the stack and clear its analysis info.
void PMStack::pop() {