[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp
Devang Patel
dpatel at apple.com
Tue Dec 12 15:34:48 PST 2006
Changes in directory llvm/lib/VMCore:
PassManager.cpp updated: 1.88 -> 1.89
---
Log message:
Add routines to dump pass manager queue.
---
Diffs of the changes: (+62 -0)
PassManager.cpp | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 62 insertions(+)
Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.88 llvm/lib/VMCore/PassManager.cpp:1.89
--- llvm/lib/VMCore/PassManager.cpp:1.88 Tue Dec 12 17:27:37 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 17:34:33 2006
@@ -149,6 +149,9 @@
IndirectPassManagers.push_back(Manager);
}
+ // Print passes managed by this top level manager.
+ void dumpPasses();
+
private:
/// Collection of pass managers
@@ -231,6 +234,21 @@
unsigned getDepth() { return Depth; }
+ // Print list of passes that are last used by P.
+ void dumpLastUses(Pass *P, unsigned Offset) {
+
+ std::vector<Pass *> LUses;
+
+ assert (TPM && "Top Level Manager is missing");
+ TPM->collectLastUses(LUses, P);
+
+ for (std::vector<Pass *>::iterator I = LUses.begin(),
+ E = LUses.end(); I != E; ++I) {
+ llvm::cerr << "--" << std::string(Offset*2, ' ');
+ (*I)->dumpPassStructure(0);
+ }
+ }
+
protected:
// Collection of pass whose last user asked this manager to claim
@@ -283,6 +301,16 @@
bool doFinalization(Module &M);
bool doFinalization(Function &F);
+ // Print passes managed by this manager
+ void dumpPassStructure(unsigned Offset) {
+ llvm::cerr << std::string(Offset*2, ' ') << "BasicBLockPass Manager\n";
+ for (std::vector<Pass *>::iterator I = passVectorBegin(),
+ E = passVectorEnd(); I != E; ++I) {
+ (*I)->dumpPassStructure(Offset + 1);
+ dumpLastUses(*I, Offset+1);
+ }
+ }
+
};
//===----------------------------------------------------------------------===//
@@ -349,6 +377,16 @@
Info.setPreservesAll();
}
+ // Print passes managed by this manager
+ void dumpPassStructure(unsigned Offset) {
+ llvm::cerr << std::string(Offset*2, ' ') << "FunctionPass Manager\n";
+ for (std::vector<Pass *>::iterator I = passVectorBegin(),
+ E = passVectorEnd(); I != E; ++I) {
+ (*I)->dumpPassStructure(Offset + 1);
+ dumpLastUses(*I, Offset+1);
+ }
+ }
+
private:
// Active Pass Managers
BasicBlockPassManager_New *activeBBPassManager;
@@ -380,6 +418,16 @@
Info.setPreservesAll();
}
+ // Print passes managed by this manager
+ void dumpPassStructure(unsigned Offset) {
+ llvm::cerr << std::string(Offset*2, ' ') << "ModulePass Manager\n";
+ for (std::vector<Pass *>::iterator I = passVectorBegin(),
+ E = passVectorEnd(); I != E; ++I) {
+ (*I)->dumpPassStructure(Offset + 1);
+ dumpLastUses(*I, Offset+1);
+ }
+ }
+
private:
// Active Pass Manager
FunctionPassManagerImpl_New *activeFunctionPassManager;
@@ -539,6 +587,20 @@
return P;
}
+// Print passes managed by this top level manager.
+void PMTopLevelManager::dumpPasses() {
+
+ // Print out the immutable passes
+ for (unsigned i = 0, e = ImmutablePasses.size(); i != e; ++i) {
+ ImmutablePasses[i]->dumpPassStructure(0);
+ }
+
+ for (std::vector<Pass *>::iterator I = PassManagers.begin(),
+ E = PassManagers.end(); I != E; ++I)
+ (*I)->dumpPassStructure(1);
+
+}
+
//===----------------------------------------------------------------------===//
// PMDataManager implementation
More information about the llvm-commits
mailing list