diff options
author | Chris Lattner <sabre@nondot.org> | 2008-08-08 15:14:09 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-08-08 15:14:09 +0000 |
commit | 0dabb7e8f3e371cf0d6a9747b5bd4b555cc32c95 (patch) | |
tree | 83f0406dcedbbc9d98891ae1b3927a7386466831 /lib/VMCore/PassManager.cpp | |
parent | e1a4eda990a765952434d39d7c14299d1d4614a5 (diff) | |
download | external_llvm-0dabb7e8f3e371cf0d6a9747b5bd4b555cc32c95.zip external_llvm-0dabb7e8f3e371cf0d6a9747b5bd4b555cc32c95.tar.gz external_llvm-0dabb7e8f3e371cf0d6a9747b5bd4b555cc32c95.tar.bz2 |
Don't call getAnalysisUsage unless -debug-pass is enabled. This speeds
up the passmgr by avoiding useless work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54528 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/PassManager.cpp')
-rw-r--r-- | lib/VMCore/PassManager.cpp | 59 |
1 files changed, 36 insertions, 23 deletions
diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index e48ea81..fc3621a 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -954,17 +954,38 @@ void PMDataManager::dumpPassInfo(Pass *P, enum PassDebuggingString S1, } } -void PMDataManager::dumpAnalysisSetInfo(const char *Msg, Pass *P, +void PMDataManager::dumpRequiredSet(const Pass *P) + const { + if (PassDebugging < Details) + return; + + AnalysisUsage analysisUsage; + P->getAnalysisUsage(analysisUsage); + dumpAnalysisUsage("Required", P, analysisUsage.getRequiredSet()); +} + +void PMDataManager::dumpPreservedSet(const Pass *P) + const { + if (PassDebugging < Details) + return; + + AnalysisUsage analysisUsage; + P->getAnalysisUsage(analysisUsage); + dumpAnalysisUsage("Preserved", P, analysisUsage.getPreservedSet()); +} + +void PMDataManager::dumpAnalysisUsage(const char *Msg, const Pass *P, const AnalysisUsage::VectorType &Set) const { - if (PassDebugging >= Details && !Set.empty()) { - cerr << (void*)P << std::string(getDepth()*2+3, ' ') << Msg << " Analyses:"; - for (unsigned i = 0; i != Set.size(); ++i) { - if (i) cerr << ","; - cerr << " " << Set[i]->getPassName(); - } - cerr << "\n"; - } + assert(PassDebugging >= Details); + if (Set.empty()) + return; + cerr << (void*)P << std::string(getDepth()*2+3, ' ') << Msg << " Analyses:"; + for (unsigned i = 0; i != Set.size(); ++i) { + if (i) cerr << ","; + cerr << " " << Set[i]->getPassName(); + } + cerr << "\n"; } /// Add RequiredPass into list of lower level passes required by pass P. @@ -1031,11 +1052,9 @@ BBPassManager::runOnFunction(Function &F) { for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { BasicBlockPass *BP = getContainedPass(Index); - AnalysisUsage AnUsage; - BP->getAnalysisUsage(AnUsage); dumpPassInfo(BP, EXECUTION_MSG, ON_BASICBLOCK_MSG, I->getNameStart()); - dumpAnalysisSetInfo("Required", BP, AnUsage.getRequiredSet()); + dumpRequiredSet(BP); initializeAnalysisImpl(BP); @@ -1046,7 +1065,7 @@ BBPassManager::runOnFunction(Function &F) { if (Changed) dumpPassInfo(BP, MODIFICATION_MSG, ON_BASICBLOCK_MSG, I->getNameStart()); - dumpAnalysisSetInfo("Preserved", BP, AnUsage.getPreservedSet()); + dumpPreservedSet(BP); verifyPreservedAnalysis(BP); removeNotPreservedAnalysis(BP); @@ -1232,11 +1251,8 @@ bool FPPassManager::runOnFunction(Function &F) { for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { FunctionPass *FP = getContainedPass(Index); - AnalysisUsage AnUsage; - FP->getAnalysisUsage(AnUsage); - dumpPassInfo(FP, EXECUTION_MSG, ON_FUNCTION_MSG, F.getNameStart()); - dumpAnalysisSetInfo("Required", FP, AnUsage.getRequiredSet()); + dumpRequiredSet(FP); initializeAnalysisImpl(FP); @@ -1246,7 +1262,7 @@ bool FPPassManager::runOnFunction(Function &F) { if (Changed) dumpPassInfo(FP, MODIFICATION_MSG, ON_FUNCTION_MSG, F.getNameStart()); - dumpAnalysisSetInfo("Preserved", FP, AnUsage.getPreservedSet()); + dumpPreservedSet(FP); verifyPreservedAnalysis(FP); removeNotPreservedAnalysis(FP); @@ -1304,12 +1320,9 @@ MPPassManager::runOnModule(Module &M) { for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { ModulePass *MP = getContainedPass(Index); - AnalysisUsage AnUsage; - MP->getAnalysisUsage(AnUsage); - dumpPassInfo(MP, EXECUTION_MSG, ON_MODULE_MSG, M.getModuleIdentifier().c_str()); - dumpAnalysisSetInfo("Required", MP, AnUsage.getRequiredSet()); + dumpRequiredSet(MP); initializeAnalysisImpl(MP); @@ -1320,7 +1333,7 @@ MPPassManager::runOnModule(Module &M) { if (Changed) dumpPassInfo(MP, MODIFICATION_MSG, ON_MODULE_MSG, M.getModuleIdentifier().c_str()); - dumpAnalysisSetInfo("Preserved", MP, AnUsage.getPreservedSet()); + dumpPreservedSet(MP); verifyPreservedAnalysis(MP); removeNotPreservedAnalysis(MP); |