summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-08-16 22:45:12 +0000
committerDan Gohman <gohman@apple.com>2010-08-16 22:45:12 +0000
commit65bffec2c2dc87a5974930ec17931721bc485f9a (patch)
tree4d64f4bd493e167f799d0c6a12e5d3ff110ebf7c
parent4861ed60ac68a543d1b88e631e9fe2c55583b24b (diff)
downloadllvm-65bffec2c2dc87a5974930ec17931721bc485f9a.tar.gz
llvm-65bffec2c2dc87a5974930ec17931721bc485f9a.tar.bz2
llvm-65bffec2c2dc87a5974930ec17931721bc485f9a.tar.xz
Make dumpPassStructure be a PMDataManager abstraction, rather than
a Pass abstraction, since that's the level it's actually used at. Rename Pass' dumpPassStructure to dumpPass. This eliminates an awkward use of getAsPass() to convert a PMDataManager* into a Pass* just to permit a dumpPassStructure call. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111199 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Pass.h2
-rw-r--r--include/llvm/PassManagers.h3
-rw-r--r--lib/Analysis/IPA/CallGraphSCCPass.cpp2
-rw-r--r--lib/Analysis/LoopPass.cpp2
-rw-r--r--lib/VMCore/Pass.cpp4
-rw-r--r--lib/VMCore/PassManager.cpp28
6 files changed, 26 insertions, 15 deletions
diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h
index f4c6eed2cf..9f4e963343 100644
--- a/include/llvm/Pass.h
+++ b/include/llvm/Pass.h
@@ -163,7 +163,7 @@ public:
virtual void verifyAnalysis() const;
// dumpPassStructure - Implement the -debug-passes=PassStructure option
- virtual void dumpPassStructure(unsigned Offset = 0);
+ void dumpPass(unsigned Offset = 0);
// lookupPassInfo - Return the pass info object for the specified pass class,
// or null if it is not known.
diff --git a/include/llvm/PassManagers.h b/include/llvm/PassManagers.h
index 17f4a0592f..e324184207 100644
--- a/include/llvm/PassManagers.h
+++ b/include/llvm/PassManagers.h
@@ -362,6 +362,9 @@ public:
InheritedAnalysis[Index++] = (*I)->getAvailableAnalysis();
}
+ /// dumpPassStructure - Implement the -debug-passes=PassStructure option.
+ virtual void dumpPassStructure(unsigned Offset) = 0;
+
protected:
// Top level manager.
diff --git a/lib/Analysis/IPA/CallGraphSCCPass.cpp b/lib/Analysis/IPA/CallGraphSCCPass.cpp
index b7a27cb288..1063190f4e 100644
--- a/lib/Analysis/IPA/CallGraphSCCPass.cpp
+++ b/lib/Analysis/IPA/CallGraphSCCPass.cpp
@@ -73,7 +73,7 @@ public:
errs().indent(Offset*2) << "Call Graph SCC Pass Manager\n";
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
Pass *P = getContainedPass(Index);
- P->dumpPassStructure(Offset + 1);
+ P->dumpPass(Offset + 1);
dumpLastUses(P, Offset+1);
}
}
diff --git a/lib/Analysis/LoopPass.cpp b/lib/Analysis/LoopPass.cpp
index 15d4db8f5f..718b615aa5 100644
--- a/lib/Analysis/LoopPass.cpp
+++ b/lib/Analysis/LoopPass.cpp
@@ -332,7 +332,7 @@ void LPPassManager::dumpPassStructure(unsigned Offset) {
errs().indent(Offset*2) << "Loop Pass Manager\n";
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
Pass *P = getContainedPass(Index);
- P->dumpPassStructure(Offset + 1);
+ P->dumpPass(Offset + 1);
dumpLastUses(P, Offset+1);
}
}
diff --git a/lib/VMCore/Pass.cpp b/lib/VMCore/Pass.cpp
index a7d7f61dd7..9995d1d492 100644
--- a/lib/VMCore/Pass.cpp
+++ b/lib/VMCore/Pass.cpp
@@ -48,8 +48,8 @@ bool Pass::mustPreserveAnalysisID(char &AID) const {
return Resolver->getAnalysisIfAvailable(&AID, true) != 0;
}
-// dumpPassStructure - Implement the -debug-passes=Structure option
-void Pass::dumpPassStructure(unsigned Offset) {
+// dumpPass - Implement the -debug-passes=Structure option
+void Pass::dumpPass(unsigned Offset) {
dbgs().indent(Offset*2) << getPassName() << "\n";
}
diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp
index ba06e92d9d..664ef1f08e 100644
--- a/lib/VMCore/PassManager.cpp
+++ b/lib/VMCore/PassManager.cpp
@@ -192,7 +192,7 @@ public:
llvm::dbgs() << std::string(Offset*2, ' ') << "BasicBlockPass Manager\n";
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
BasicBlockPass *BP = getContainedPass(Index);
- BP->dumpPassStructure(Offset + 1);
+ BP->dumpPass(Offset + 1);
dumpLastUses(BP, Offset+1);
}
}
@@ -286,6 +286,11 @@ public:
FPPassManager *FP = static_cast<FPPassManager *>(PassManagers[N]);
return FP;
}
+
+ /// dumpPassStructure - Implement the -debug-passes=PassStructure option.
+ void dumpPassStructure(unsigned) {
+ llvm_unreachable("dumpPassStructure called on FunctionPassManagerImpl");
+ }
};
char FunctionPassManagerImpl::ID = 0;
@@ -348,7 +353,7 @@ public:
llvm::dbgs() << std::string(Offset*2, ' ') << "ModulePass Manager\n";
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
ModulePass *MP = getContainedPass(Index);
- MP->dumpPassStructure(Offset + 1);
+ MP->dumpPass(Offset + 1);
std::map<Pass *, FunctionPassManagerImpl *>::const_iterator I =
OnTheFlyManagers.find(MP);
if (I != OnTheFlyManagers.end())
@@ -432,6 +437,11 @@ public:
MPPassManager *MP = static_cast<MPPassManager *>(PassManagers[N]);
return MP;
}
+
+ /// dumpPassStructure - Implement the -debug-passes=PassStructure option.
+ void dumpPassStructure(unsigned) {
+ llvm_unreachable("dumpPassStructure called on PassManagerImpl");
+ }
};
char PassManagerImpl::ID = 0;
@@ -657,16 +667,14 @@ void PMTopLevelManager::dumpPasses() const {
// Print out the immutable passes
for (unsigned i = 0, e = ImmutablePasses.size(); i != e; ++i) {
- ImmutablePasses[i]->dumpPassStructure(0);
+ ImmutablePasses[i]->dumpPass();
}
- // Every class that derives from PMDataManager also derives from Pass
- // (sometimes indirectly), but there's no inheritance relationship
- // between PMDataManager and Pass, so we have to getAsPass to get
- // from a PMDataManager* to a Pass*.
+ // Print out the normal passes. We add an extra layer of indentation here
+ // to help distinguish them visually from the immutable passes.
for (SmallVector<PMDataManager *, 8>::const_iterator I = PassManagers.begin(),
E = PassManagers.end(); I != E; ++I)
- (*I)->getAsPass()->dumpPassStructure(1);
+ (*I)->dumpPassStructure(1);
}
void PMTopLevelManager::dumpArguments() const {
@@ -1041,7 +1049,7 @@ void PMDataManager::dumpLastUses(Pass *P, unsigned Offset) const{
for (SmallVector<Pass *, 12>::iterator I = LUses.begin(),
E = LUses.end(); I != E; ++I) {
llvm::dbgs() << "--" << std::string(Offset*2, ' ');
- (*I)->dumpPassStructure(0);
+ (*I)->dumpPass(0);
}
}
@@ -1409,7 +1417,7 @@ void FPPassManager::dumpPassStructure(unsigned Offset) {
llvm::dbgs() << std::string(Offset*2, ' ') << "FunctionPass Manager\n";
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
FunctionPass *FP = getContainedPass(Index);
- FP->dumpPassStructure(Offset + 1);
+ FP->dumpPass(Offset + 1);
dumpLastUses(FP, Offset+1);
}
}