[llvm-commits] [llvm] r111199 - in /llvm/trunk: include/llvm/Pass.h include/llvm/PassManagers.h lib/Analysis/IPA/CallGraphSCCPass.cpp lib/Analysis/LoopPass.cpp lib/VMCore/Pass.cpp lib/VMCore/PassManager.cpp
Dan Gohman
gohman at apple.com
Mon Aug 16 15:45:12 PDT 2010
Author: djg
Date: Mon Aug 16 17:45:12 2010
New Revision: 111199
URL: http://llvm.org/viewvc/llvm-project?rev=111199&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/Pass.h
llvm/trunk/include/llvm/PassManagers.h
llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp
llvm/trunk/lib/Analysis/LoopPass.cpp
llvm/trunk/lib/VMCore/Pass.cpp
llvm/trunk/lib/VMCore/PassManager.cpp
Modified: llvm/trunk/include/llvm/Pass.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Pass.h?rev=111199&r1=111198&r2=111199&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Pass.h (original)
+++ llvm/trunk/include/llvm/Pass.h Mon Aug 16 17:45:12 2010
@@ -163,7 +163,7 @@
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.
Modified: llvm/trunk/include/llvm/PassManagers.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassManagers.h?rev=111199&r1=111198&r2=111199&view=diff
==============================================================================
--- llvm/trunk/include/llvm/PassManagers.h (original)
+++ llvm/trunk/include/llvm/PassManagers.h Mon Aug 16 17:45:12 2010
@@ -362,6 +362,9 @@
InheritedAnalysis[Index++] = (*I)->getAvailableAnalysis();
}
+ /// dumpPassStructure - Implement the -debug-passes=PassStructure option.
+ virtual void dumpPassStructure(unsigned Offset) = 0;
+
protected:
// Top level manager.
Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=111199&r1=111198&r2=111199&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original)
+++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Mon Aug 16 17:45:12 2010
@@ -73,7 +73,7 @@
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);
}
}
Modified: llvm/trunk/lib/Analysis/LoopPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopPass.cpp?rev=111199&r1=111198&r2=111199&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopPass.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopPass.cpp Mon Aug 16 17:45:12 2010
@@ -332,7 +332,7 @@
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);
}
}
Modified: llvm/trunk/lib/VMCore/Pass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Pass.cpp?rev=111199&r1=111198&r2=111199&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Pass.cpp (original)
+++ llvm/trunk/lib/VMCore/Pass.cpp Mon Aug 16 17:45:12 2010
@@ -48,8 +48,8 @@
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";
}
Modified: llvm/trunk/lib/VMCore/PassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=111199&r1=111198&r2=111199&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/PassManager.cpp (original)
+++ llvm/trunk/lib/VMCore/PassManager.cpp Mon Aug 16 17:45:12 2010
@@ -192,7 +192,7 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
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 @@
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);
}
}
More information about the llvm-commits
mailing list