[llvm-commits] CVS: llvm/lib/Analysis/LoopPass.cpp
Devang Patel
dpatel at apple.com
Thu Feb 22 16:37:19 PST 2007
Changes in directory llvm/lib/Analysis:
LoopPass.cpp updated: 1.5 -> 1.6
---
Log message:
Teach LoopPass to assign itself one Loop Pass Manager.
---
Diffs of the changes: (+41 -0)
LoopPass.cpp | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+)
Index: llvm/lib/Analysis/LoopPass.cpp
diff -u llvm/lib/Analysis/LoopPass.cpp:1.5 llvm/lib/Analysis/LoopPass.cpp:1.6
--- llvm/lib/Analysis/LoopPass.cpp:1.5 Thu Feb 22 18:16:44 2007
+++ llvm/lib/Analysis/LoopPass.cpp Thu Feb 22 18:36:57 2007
@@ -143,3 +143,44 @@
}
+//===----------------------------------------------------------------------===//
+// LoopPass
+
+/// Assign pass manager to manage this pass.
+void LoopPass::assignPassManager(PMStack &PMS,
+ PassManagerType PreferredType) {
+ // Find LPPassManager
+ while (!PMS.empty()) {
+ if (PMS.top()->getPassManagerType() > PMT_LoopPassManager)
+ PMS.pop();
+ else;
+ break;
+ }
+
+ LPPassManager *LPPM = dynamic_cast<LPPassManager *>(PMS.top());
+
+ // Create new Loop Pass Manager if it does not exist.
+ if (!LPPM) {
+
+ assert (!PMS.empty() && "Unable to create Loop Pass Manager");
+ PMDataManager *PMD = PMS.top();
+
+ // [1] Create new Call Graph Pass Manager
+ LPPM = new LPPassManager(PMD->getDepth() + 1);
+
+ // [2] Set up new manager's top level manager
+ PMTopLevelManager *TPM = PMD->getTopLevelManager();
+ TPM->addIndirectPassManager(LPPM);
+
+ // [3] Assign manager to manage this new manager. This may create
+ // and push new managers into PMS
+ Pass *P = dynamic_cast<Pass *>(LPPM);
+ P->assignPassManager(PMS);
+
+ // [4] Push new manager into PMS
+ PMS.push(LPPM);
+ }
+
+ LPPM->add(this);
+}
+
More information about the llvm-commits
mailing list