Update ModulePass::assignPassManager() to take into account Preferred

Pass Manager Type.

llvm-svn: 33308
This commit is contained in:
Devang Patel 2007-01-17 21:19:23 +00:00
parent b40f9ee72e
commit cda3b4d76f

View File

@ -1207,15 +1207,16 @@ void ModulePass::assignPassManager(PMStack &PMS,
// Find Module Pass Manager
while(!PMS.empty()) {
if (PMS.top()->getPassManagerType() > PMT_ModulePassManager)
PassManagerType TopPMType = PMS.top()->getPassManagerType();
if (TopPMType == PreferredType)
break; // We found desired pass manager
else if (TopPMType > PMT_ModulePassManager)
PMS.pop(); // Pop children pass managers
else
break;
}
MPPassManager *MPP = dynamic_cast<MPPassManager *>(PMS.top());
assert(MPP && "Unable to find Module Pass Manager");
MPP->add(this);
PMS.top()->add(this);
}
/// Find appropriate Function Pass Manager or Call Graph Pass Manager