forked from OSchip/llvm-project
[LegacyPassManager] Simplify FunctionPass::assignPassManager
And make it clear the parameter PreferredType is unused for FunctionPass.
This commit is contained in:
parent
1abd4c94d7
commit
4adddbd8ad
|
@ -1786,36 +1786,32 @@ void ModulePass::assignPassManager(PMStack &PMS,
|
|||
/// Find appropriate Function Pass Manager or Call Graph Pass Manager
|
||||
/// in the PM Stack and add self into that manager.
|
||||
void FunctionPass::assignPassManager(PMStack &PMS,
|
||||
PassManagerType PreferredType) {
|
||||
PassManagerType /*PreferredType*/) {
|
||||
// Find Function Pass Manager
|
||||
while (PMS.top()->getPassManagerType() > PMT_FunctionPassManager)
|
||||
PMDataManager *PM;
|
||||
while (PM = PMS.top(), PM->getPassManagerType() > PMT_FunctionPassManager)
|
||||
PMS.pop();
|
||||
|
||||
// Create new Function Pass Manager if needed.
|
||||
FPPassManager *FPP;
|
||||
if (PMS.top()->getPassManagerType() == PMT_FunctionPassManager) {
|
||||
FPP = (FPPassManager *)PMS.top();
|
||||
} else {
|
||||
PMDataManager *PMD = PMS.top();
|
||||
|
||||
if (PM->getPassManagerType() != PMT_FunctionPassManager) {
|
||||
// [1] Create new Function Pass Manager
|
||||
FPP = new FPPassManager();
|
||||
auto *FPP = new FPPassManager;
|
||||
FPP->populateInheritedAnalysis(PMS);
|
||||
|
||||
// [2] Set up new manager's top level manager
|
||||
PMTopLevelManager *TPM = PMD->getTopLevelManager();
|
||||
TPM->addIndirectPassManager(FPP);
|
||||
PM->getTopLevelManager()->addIndirectPassManager(FPP);
|
||||
|
||||
// [3] Assign manager to manage this new manager. This may create
|
||||
// and push new managers into PMS
|
||||
FPP->assignPassManager(PMS, PMD->getPassManagerType());
|
||||
FPP->assignPassManager(PMS, PM->getPassManagerType());
|
||||
|
||||
// [4] Push new manager into PMS
|
||||
PMS.push(FPP);
|
||||
PM = FPP;
|
||||
}
|
||||
|
||||
// Assign FPP as the manager of this pass.
|
||||
FPP->add(this);
|
||||
PM->add(this);
|
||||
}
|
||||
|
||||
PassManagerBase::~PassManagerBase() {}
|
||||
|
|
Loading…
Reference in New Issue