From bb27588b3f154f85934c696e52eed4c20522bf5b Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 19 Aug 2010 01:29:07 +0000 Subject: [PATCH] Revert r111199; it breaks -debug-pass=Structure output. llvm-svn: 111500 --- include/llvm/Pass.h | 2 +- include/llvm/PassManagers.h | 3 --- lib/Analysis/IPA/CallGraphSCCPass.cpp | 2 +- lib/Analysis/LoopPass.cpp | 2 +- lib/VMCore/Pass.cpp | 4 ++-- lib/VMCore/PassManager.cpp | 28 ++++++++++----------------- 6 files changed, 15 insertions(+), 26 deletions(-) diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h index 9f4e963343c..f4c6eed2cf9 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 - void dumpPass(unsigned Offset = 0); + virtual void dumpPassStructure(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 e3241842077..17f4a0592fb 100644 --- a/include/llvm/PassManagers.h +++ b/include/llvm/PassManagers.h @@ -362,9 +362,6 @@ 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 1063190f4e5..b7a27cb288d 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->dumpPass(Offset + 1); + P->dumpPassStructure(Offset + 1); dumpLastUses(P, Offset+1); } } diff --git a/lib/Analysis/LoopPass.cpp b/lib/Analysis/LoopPass.cpp index 718b615aa5c..15d4db8f5f9 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->dumpPass(Offset + 1); + P->dumpPassStructure(Offset + 1); dumpLastUses(P, Offset+1); } } diff --git a/lib/VMCore/Pass.cpp b/lib/VMCore/Pass.cpp index 9995d1d4922..a7d7f61dd76 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; } -// dumpPass - Implement the -debug-passes=Structure option -void Pass::dumpPass(unsigned Offset) { +// dumpPassStructure - Implement the -debug-passes=Structure option +void Pass::dumpPassStructure(unsigned Offset) { dbgs().indent(Offset*2) << getPassName() << "\n"; } diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index 14c91740ae7..ab4d4e55c75 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->dumpPass(Offset + 1); + BP->dumpPassStructure(Offset + 1); dumpLastUses(BP, Offset+1); } } @@ -286,11 +286,6 @@ public: FPPassManager *FP = static_cast(PassManagers[N]); return FP; } - - /// dumpPassStructure - Implement the -debug-passes=PassStructure option. - void dumpPassStructure(unsigned) { - llvm_unreachable("dumpPassStructure called on FunctionPassManagerImpl"); - } }; char FunctionPassManagerImpl::ID = 0; @@ -353,7 +348,7 @@ public: llvm::dbgs() << std::string(Offset*2, ' ') << "ModulePass Manager\n"; for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { ModulePass *MP = getContainedPass(Index); - MP->dumpPass(Offset + 1); + MP->dumpPassStructure(Offset + 1); std::map::const_iterator I = OnTheFlyManagers.find(MP); if (I != OnTheFlyManagers.end()) @@ -437,11 +432,6 @@ public: MPPassManager *MP = static_cast(PassManagers[N]); return MP; } - - /// dumpPassStructure - Implement the -debug-passes=PassStructure option. - void dumpPassStructure(unsigned) { - llvm_unreachable("dumpPassStructure called on PassManagerImpl"); - } }; char PassManagerImpl::ID = 0; @@ -667,14 +657,16 @@ void PMTopLevelManager::dumpPasses() const { // Print out the immutable passes for (unsigned i = 0, e = ImmutablePasses.size(); i != e; ++i) { - ImmutablePasses[i]->dumpPass(); + ImmutablePasses[i]->dumpPassStructure(0); } - // Print out the normal passes. We add an extra layer of indentation here - // to help distinguish them visually from the immutable passes. + // 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*. for (SmallVector::const_iterator I = PassManagers.begin(), E = PassManagers.end(); I != E; ++I) - (*I)->dumpPassStructure(1); + (*I)->getAsPass()->dumpPassStructure(1); } void PMTopLevelManager::dumpArguments() const { @@ -1049,7 +1041,7 @@ void PMDataManager::dumpLastUses(Pass *P, unsigned Offset) const{ for (SmallVector::iterator I = LUses.begin(), E = LUses.end(); I != E; ++I) { llvm::dbgs() << "--" << std::string(Offset*2, ' '); - (*I)->dumpPass(0); + (*I)->dumpPassStructure(0); } } @@ -1417,7 +1409,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->dumpPass(Offset + 1); + FP->dumpPassStructure(Offset + 1); dumpLastUses(FP, Offset+1); } }