diff options
Diffstat (limited to 'llvm/lib/IR/LegacyPassManager.cpp')
| -rw-r--r-- | llvm/lib/IR/LegacyPassManager.cpp | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/llvm/lib/IR/LegacyPassManager.cpp b/llvm/lib/IR/LegacyPassManager.cpp index 4547c3a01239..32840fdeddf7 100644 --- a/llvm/lib/IR/LegacyPassManager.cpp +++ b/llvm/lib/IR/LegacyPassManager.cpp @@ -52,15 +52,14 @@ enum PassDebugLevel { }; } // namespace -static cl::opt<enum PassDebugLevel> -PassDebugging("debug-pass", cl::Hidden, - cl::desc("Print PassManager debugging information"), - cl::values( - clEnumVal(Disabled , "disable debug output"), - clEnumVal(Arguments , "print pass arguments to pass to 'opt'"), - clEnumVal(Structure , "print pass structure before run()"), - clEnumVal(Executions, "print pass name before it is executed"), - clEnumVal(Details , "print pass details when it is executed"))); +static cl::opt<enum PassDebugLevel> PassDebugging( + "debug-pass", cl::Hidden, + cl::desc("Print legacy PassManager debugging information"), + cl::values(clEnumVal(Disabled, "disable debug output"), + clEnumVal(Arguments, "print pass arguments to pass to 'opt'"), + clEnumVal(Structure, "print pass structure before run()"), + clEnumVal(Executions, "print pass name before it is executed"), + clEnumVal(Details, "print pass details when it is executed"))); /// isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions /// or higher is specified. @@ -243,6 +242,8 @@ void PassManagerPrettyStackEntry::print(raw_ostream &OS) const { namespace llvm { namespace legacy { +bool debugPassSpecified() { return PassDebugging != Disabled; } + //===----------------------------------------------------------------------===// // FunctionPassManagerImpl // @@ -746,8 +747,10 @@ void PMTopLevelManager::schedulePass(Pass *P) { } if (PI && !PI->isAnalysis() && shouldPrintBeforePass(PI->getPassArgument())) { - Pass *PP = P->createPrinterPass( - dbgs(), ("*** IR Dump Before " + P->getPassName() + " ***").str()); + Pass *PP = + P->createPrinterPass(dbgs(), ("*** IR Dump Before " + P->getPassName() + + " (" + PI->getPassArgument() + ") ***") + .str()); PP->assignPassManager(activeStack, getTopLevelPassManagerType()); } @@ -755,8 +758,10 @@ void PMTopLevelManager::schedulePass(Pass *P) { P->assignPassManager(activeStack, getTopLevelPassManagerType()); if (PI && !PI->isAnalysis() && shouldPrintAfterPass(PI->getPassArgument())) { - Pass *PP = P->createPrinterPass( - dbgs(), ("*** IR Dump After " + P->getPassName() + " ***").str()); + Pass *PP = + P->createPrinterPass(dbgs(), ("*** IR Dump After " + P->getPassName() + + " (" + PI->getPassArgument() + ") ***") + .str()); PP->assignPassManager(activeStack, getTopLevelPassManagerType()); } } @@ -945,14 +950,13 @@ void PMDataManager::removeNotPreservedAnalysis(Pass *P) { // Check inherited analysis also. If P is not preserving analysis // provided by parent manager then remove it here. - for (unsigned Index = 0; Index < PMT_Last; ++Index) { - - if (!InheritedAnalysis[Index]) + for (DenseMap<AnalysisID, Pass *> *IA : InheritedAnalysis) { + if (!IA) continue; - for (DenseMap<AnalysisID, Pass*>::iterator - I = InheritedAnalysis[Index]->begin(), - E = InheritedAnalysis[Index]->end(); I != E; ) { + for (DenseMap<AnalysisID, Pass *>::iterator I = IA->begin(), + E = IA->end(); + I != E;) { DenseMap<AnalysisID, Pass *>::iterator Info = I++; if (Info->second->getAsImmutablePass() == nullptr && !is_contained(PreservedSet, Info->first)) { @@ -962,7 +966,7 @@ void PMDataManager::removeNotPreservedAnalysis(Pass *P) { dbgs() << " -- '" << P->getPassName() << "' is not preserving '"; dbgs() << S->getPassName() << "'\n"; } - InheritedAnalysis[Index]->erase(Info); + IA->erase(Info); } } } |
