forked from OSchip/llvm-project
Undo last check-in.
Remove setupPassManager() and its use. llvm-svn: 33270
This commit is contained in:
parent
31fcc2cde9
commit
3312f75071
|
@ -108,8 +108,6 @@ public:
|
||||||
void dump() const; // dump - call print(std::cerr, 0);
|
void dump() const; // dump - call print(std::cerr, 0);
|
||||||
|
|
||||||
virtual void assignPassManager(PMStack &PMS) {}
|
virtual void assignPassManager(PMStack &PMS) {}
|
||||||
virtual void setupPassManager(PMStack &PMS) {}
|
|
||||||
|
|
||||||
// Access AnalysisResolver
|
// Access AnalysisResolver
|
||||||
inline void setResolver(AnalysisResolver *AR) { Resolver = AR; }
|
inline void setResolver(AnalysisResolver *AR) { Resolver = AR; }
|
||||||
inline AnalysisResolver *getResolver() { return Resolver; }
|
inline AnalysisResolver *getResolver() { return Resolver; }
|
||||||
|
@ -203,7 +201,6 @@ public:
|
||||||
virtual bool runPass(BasicBlock&) { return false; }
|
virtual bool runPass(BasicBlock&) { return false; }
|
||||||
|
|
||||||
virtual void assignPassManager(PMStack &PMS);
|
virtual void assignPassManager(PMStack &PMS);
|
||||||
|
|
||||||
// Force out-of-line virtual method.
|
// Force out-of-line virtual method.
|
||||||
virtual ~ModulePass();
|
virtual ~ModulePass();
|
||||||
};
|
};
|
||||||
|
@ -270,7 +267,6 @@ public:
|
||||||
bool run(Function &F);
|
bool run(Function &F);
|
||||||
|
|
||||||
virtual void assignPassManager(PMStack &PMS);
|
virtual void assignPassManager(PMStack &PMS);
|
||||||
virtual void setupPassManager(PMStack &PMS);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -325,7 +321,6 @@ public:
|
||||||
virtual bool runPass(BasicBlock &BB);
|
virtual bool runPass(BasicBlock &BB);
|
||||||
|
|
||||||
virtual void assignPassManager(PMStack &PMS);
|
virtual void assignPassManager(PMStack &PMS);
|
||||||
virtual void setupPassManager(PMStack &PMS);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Different types of internal pass managers. External pass managers
|
/// Different types of internal pass managers. External pass managers
|
||||||
|
@ -342,10 +337,8 @@ enum PassManagerType {
|
||||||
|
|
||||||
/// PMStack
|
/// PMStack
|
||||||
/// Top level pass manager (see PasManager.cpp) maintains active Pass Managers
|
/// Top level pass manager (see PasManager.cpp) maintains active Pass Managers
|
||||||
/// using PMStack. Each Pass implements setupPassManager() and
|
/// using PMStack. Each Pass implements assignPassManager() to connect itself
|
||||||
/// assignPassManager() to connect itself with appropriate manager.
|
/// with appropriate manager. assignPassManager() walks PMStack to find
|
||||||
/// setupPassManager() creates new pass manager if required before adding
|
|
||||||
/// required analysis passes. assignPassManager() walks PMStack to find
|
|
||||||
/// suitable manager.
|
/// suitable manager.
|
||||||
///
|
///
|
||||||
/// PMStack is just a wrapper around standard deque that overrides pop() and
|
/// PMStack is just a wrapper around standard deque that overrides pop() and
|
||||||
|
|
|
@ -366,7 +366,8 @@ void PMTopLevelManager::collectLastUses(std::vector<Pass *> &LastUses,
|
||||||
/// the manager. Remove dead passes. This is a recursive function.
|
/// the manager. Remove dead passes. This is a recursive function.
|
||||||
void PMTopLevelManager::schedulePass(Pass *P) {
|
void PMTopLevelManager::schedulePass(Pass *P) {
|
||||||
|
|
||||||
P->setupPassManager(activeStack);
|
// TODO : Allocate function manager for this pass, other wise required set
|
||||||
|
// may be inserted into previous function manager
|
||||||
|
|
||||||
AnalysisUsage AnUsage;
|
AnalysisUsage AnUsage;
|
||||||
P->getAnalysisUsage(AnUsage);
|
P->getAnalysisUsage(AnUsage);
|
||||||
|
@ -1217,55 +1218,47 @@ void ModulePass::assignPassManager(PMStack &PMS) {
|
||||||
MPP->add(this);
|
MPP->add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Setup Pass Manager in advance before checking availability of
|
/// Find appropriate Function Pass Manager or Call Graph Pass Manager
|
||||||
/// required analysis passes.
|
/// in the PM Stack and add self into that manager.
|
||||||
void FunctionPass::setupPassManager(PMStack &PMS) {
|
void FunctionPass::assignPassManager(PMStack &PMS) {
|
||||||
|
|
||||||
// Find Module Pass Manager (TODO : Or Call Graph Pass Manager)
|
// Find Module Pass Manager (TODO : Or Call Graph Pass Manager)
|
||||||
while(!PMS.empty()) {
|
while(!PMS.empty()) {
|
||||||
if (PMS.top()->getPassManagerType() > PMT_FunctionPassManager)
|
if (PMS.top()->getPassManagerType() > PMT_FunctionPassManager)
|
||||||
PMS.pop();
|
PMS.pop();
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
FPPassManager *FPP = dynamic_cast<FPPassManager *>(PMS.top());
|
||||||
|
|
||||||
|
// Create new Function Pass Manager
|
||||||
|
if (!FPP) {
|
||||||
|
assert(!PMS.empty() && "Unable to create Function Pass Manager");
|
||||||
|
PMDataManager *PMD = PMS.top();
|
||||||
|
|
||||||
|
// [1] Create new Function Pass Manager
|
||||||
|
FPP = new FPPassManager(PMD->getDepth() + 1);
|
||||||
|
|
||||||
|
// [2] Set up new manager's top level manager
|
||||||
|
PMTopLevelManager *TPM = PMD->getTopLevelManager();
|
||||||
|
TPM->addIndirectPassManager(FPP);
|
||||||
|
|
||||||
|
// [3] Assign manager to manage this new manager. This may create
|
||||||
|
// and push new managers into PMS
|
||||||
|
Pass *P = dynamic_cast<Pass *>(FPP);
|
||||||
|
P->assignPassManager(PMS);
|
||||||
|
|
||||||
|
// [4] Push new manager into PMS
|
||||||
|
PMS.push(FPP);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(!PMS.empty() && "Unable to create Function Pass Manager");
|
// Assign FPP as the manager of this pass.
|
||||||
|
FPP->add(this);
|
||||||
if (PMS.top()->getPassManagerType() == PMT_FunctionPassManager
|
|
||||||
|| PMS.top()->getPassManagerType() == PMT_CallGraphPassManager)
|
|
||||||
return;
|
|
||||||
|
|
||||||
PMDataManager *PMD = PMS.top();
|
|
||||||
|
|
||||||
// [1] Create new Function Pass Manager
|
|
||||||
FPPassManager *FPP = new FPPassManager(PMD->getDepth() + 1);
|
|
||||||
|
|
||||||
// [2] Set up new manager's top level manager
|
|
||||||
PMTopLevelManager *TPM = PMD->getTopLevelManager();
|
|
||||||
TPM->addIndirectPassManager(FPP);
|
|
||||||
|
|
||||||
// [3] Assign manager to manage this new manager. This may create
|
|
||||||
// and push new managers into PMS
|
|
||||||
Pass *P = dynamic_cast<Pass *>(FPP);
|
|
||||||
P->assignPassManager(PMS);
|
|
||||||
|
|
||||||
// [4] Push new manager into PMS
|
|
||||||
PMS.push(FPP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Find appropriate Function Pass Manager or Call Graph Pass Manager
|
/// Find appropriate Basic Pass Manager or Call Graph Pass Manager
|
||||||
/// in the PM Stack and add self into that manager.
|
/// in the PM Stack and add self into that manager.
|
||||||
void FunctionPass::assignPassManager(PMStack &PMS) {
|
void BasicBlockPass::assignPassManager(PMStack &PMS) {
|
||||||
|
|
||||||
PMDataManager *PMD = dynamic_cast<PMDataManager *>(PMS.top());
|
|
||||||
assert(PMD && "Unable to assign Pass Manager");
|
|
||||||
|
|
||||||
PMD->add(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Setup Pass Manager in advance before checking availability of
|
|
||||||
/// required analysis passes.
|
|
||||||
void BasicBlockPass::setupPassManager(PMStack &PMS) {
|
|
||||||
|
|
||||||
BBPassManager *BBP = NULL;
|
BBPassManager *BBP = NULL;
|
||||||
|
|
||||||
|
@ -1275,37 +1268,32 @@ void BasicBlockPass::setupPassManager(PMStack &PMS) {
|
||||||
BBP = dynamic_cast<BBPassManager *>(PMS.top());
|
BBP = dynamic_cast<BBPassManager *>(PMS.top());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BBP)
|
// If leaf manager is not Basic Block Pass manager then create new
|
||||||
return;
|
// basic Block Pass manager.
|
||||||
|
|
||||||
|
if (!BBP) {
|
||||||
|
assert(!PMS.empty() && "Unable to create BasicBlock Pass Manager");
|
||||||
|
PMDataManager *PMD = PMS.top();
|
||||||
|
|
||||||
|
// [1] Create new Basic Block Manager
|
||||||
|
BBP = new BBPassManager(PMD->getDepth() + 1);
|
||||||
|
|
||||||
|
// [2] Set up new manager's top level manager
|
||||||
|
// Basic Block Pass Manager does not live by itself
|
||||||
|
PMTopLevelManager *TPM = PMD->getTopLevelManager();
|
||||||
|
TPM->addIndirectPassManager(BBP);
|
||||||
|
|
||||||
assert(!PMS.empty() && "Unable to create BasicBlock Pass Manager");
|
|
||||||
PMDataManager *PMD = PMS.top();
|
|
||||||
|
|
||||||
// [1] Create new Basic Block Manager
|
|
||||||
BBP = new BBPassManager(PMD->getDepth() + 1);
|
|
||||||
|
|
||||||
// [2] Set up new manager's top level manager
|
|
||||||
// Basic Block Pass Manager does not live by itself
|
|
||||||
PMTopLevelManager *TPM = PMD->getTopLevelManager();
|
|
||||||
TPM->addIndirectPassManager(BBP);
|
|
||||||
|
|
||||||
// [3] Assign manager to manage this new manager. This may create
|
// [3] Assign manager to manage this new manager. This may create
|
||||||
// and push new managers into PMS
|
// and push new managers into PMS
|
||||||
Pass *P = dynamic_cast<Pass *>(BBP);
|
Pass *P = dynamic_cast<Pass *>(BBP);
|
||||||
P->assignPassManager(PMS);
|
P->assignPassManager(PMS);
|
||||||
|
|
||||||
// [4] Push new manager into PMS
|
|
||||||
PMS.push(BBP);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Find appropriate Basic Pass Manager or Call Graph Pass Manager
|
// [4] Push new manager into PMS
|
||||||
/// in the PM Stack and add self into that manager.
|
PMS.push(BBP);
|
||||||
void BasicBlockPass::assignPassManager(PMStack &PMS) {
|
}
|
||||||
|
|
||||||
PMDataManager *PMD = dynamic_cast<PMDataManager *>(PMS.top());
|
// Assign BBP as the manager of this pass.
|
||||||
assert(PMD && "Unable to assign Pass Manager");
|
BBP->add(this);
|
||||||
|
|
||||||
PMD->add(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue