mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +00:00
Use getPassManagerType() instead of dynamic_cast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33078 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4fe16d607d
commit
6b9420e943
@ -1686,17 +1686,14 @@ void PMStack::handleLastUserOverflow() {
|
||||
/// add self into that manager.
|
||||
void ModulePass::assignPassManager(PMStack &PMS) {
|
||||
|
||||
MPPassManager *MPP = NULL;
|
||||
|
||||
// Find Module Pass Manager
|
||||
while(!PMS.empty()) {
|
||||
|
||||
MPP = dynamic_cast<MPPassManager *>(PMS.top());
|
||||
if (MPP)
|
||||
break; // Found it
|
||||
else
|
||||
if (PMS.top()->getPassManagerType() > 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->addPassToManager(this);
|
||||
@ -1706,21 +1703,14 @@ void ModulePass::assignPassManager(PMStack &PMS) {
|
||||
/// in the PM Stack and add self into that manager.
|
||||
void FunctionPass::assignPassManager(PMStack &PMS) {
|
||||
|
||||
FPPassManager *FPP = NULL;
|
||||
|
||||
// Find Module Pass Manager (TODO : Or Call Graph Pass Manager)
|
||||
while(!PMS.empty()) {
|
||||
|
||||
FPP = dynamic_cast<FPPassManager *>(PMS.top());
|
||||
if (FPP)
|
||||
break; // Found Function Pass Manager
|
||||
else if (dynamic_cast<BBPassManager *>(PMS.top()))
|
||||
PMS.pop(); // Pop Basic Block Pass Manager
|
||||
// TODO : else if Pop Loop Pass Manager
|
||||
if (PMS.top()->getPassManagerType() > PMT_FunctionPassManager)
|
||||
PMS.pop();
|
||||
else
|
||||
break; // PMS.top() is either Module Pass Manager or Call Graph
|
||||
// Pass Manager
|
||||
break;
|
||||
}
|
||||
FPPassManager *FPP = dynamic_cast<FPPassManager *>(PMS.top());
|
||||
|
||||
// Create new Function Pass Manager
|
||||
if (!FPP) {
|
||||
|
Loading…
Reference in New Issue
Block a user