[llvm-commits] CVS: llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp
Devang Patel
dpatel at apple.com
Tue Jan 23 13:52:53 PST 2007
Changes in directory llvm/lib/Analysis/IPA:
CallGraphSCCPass.cpp updated: 1.11 -> 1.12
---
Log message:
Add CallGraphSCCPass::assignPassManager().
This enables CalLGraphPassManager.
---
Diffs of the changes: (+38 -0)
CallGraphSCCPass.cpp | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+)
Index: llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp
diff -u llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp:1.11 llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp:1.12
--- llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp:1.11 Wed Jan 17 15:45:01 2007
+++ llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp Tue Jan 23 15:52:35 2007
@@ -144,6 +144,44 @@
return Changed;
}
+/// Assign pass manager to manager this pass
+void CallGraphSCCPass::assignPassManager(PMStack &PMS,
+ PassManagerType PreferredType) {
+ // Find CGPassManager
+ while (!PMS.empty()) {
+ if (PMS.top()->getPassManagerType() > PMT_CallGraphPassManager)
+ PMS.pop();
+ else;
+ break;
+ }
+
+ CGPassManager *CGP = dynamic_cast<CGPassManager *>(PMS.top());
+
+ // Create new Call Graph SCC Pass Manager if it does not exist.
+ if (!CGP) {
+
+ assert (!PMS.empty() && "Unable to create Call Graph Pass Manager");
+ PMDataManager *PMD = PMS.top();
+
+ // [1] Create new Call Graph Pass Manager
+ CGP = new CGPassManager(PMD->getDepth() + 1);
+
+ // [2] Set up new manager's top level manager
+ PMTopLevelManager *TPM = PMD->getTopLevelManager();
+ TPM->addIndirectPassManager(CGP);
+
+ // [3] Assign manager to manage this new manager. This may create
+ // and push new managers into PMS
+ Pass *P = dynamic_cast<Pass *>(CGP);
+ P->assignPassManager(PMS);
+
+ // [4] Push new manager into PMS
+ PMS.push(CGP);
+ }
+
+ CGP->add(this);
+}
+
/// getAnalysisUsage - For this class, we declare that we require and preserve
/// the call graph. If the derived class implements this method, it should
/// always explicitly call the implementation here.
More information about the llvm-commits
mailing list