[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp
Devang Patel
dpatel at apple.com
Thu Jan 11 11:59:22 PST 2007
Changes in directory llvm/lib/VMCore:
PassManager.cpp updated: 1.115 -> 1.116
---
Log message:
Use getPassManagerType() instead of dynamic_cast.
---
Diffs of the changes: (+8 -18)
PassManager.cpp | 26 ++++++++------------------
1 files changed, 8 insertions(+), 18 deletions(-)
Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.115 llvm/lib/VMCore/PassManager.cpp:1.116
--- llvm/lib/VMCore/PassManager.cpp:1.115 Wed Jan 10 19:10:25 2007
+++ llvm/lib/VMCore/PassManager.cpp Thu Jan 11 13:59:06 2007
@@ -1686,17 +1686,14 @@
/// 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 @@
/// 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) {
More information about the llvm-commits
mailing list