aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
diff options
context:
space:
mode:
authorMarkus Lavin <markus.lavin@ericsson.com>2021-09-02 08:23:33 +0200
committerMarkus Lavin <markus.lavin@ericsson.com>2021-09-02 08:23:33 +0200
commit304f2bd21de67583669b9787034e0e9c6caef775 (patch)
treee45f0d3001f44e9e36d36741352542e3f18b395e /llvm/lib/Transforms/Scalar/LoopPassManager.cpp
parent645af79e8e5f23382934b8d65f8af94438893f9f (diff)
downloadllvm-304f2bd21de67583669b9787034e0e9c6caef775.zip
llvm-304f2bd21de67583669b9787034e0e9c6caef775.tar.gz
llvm-304f2bd21de67583669b9787034e0e9c6caef775.tar.bz2
[NPM] Added opt option -print-pipeline-passes.
Added opt option -print-pipeline-passes to print a -passes compatible string describing the built pass pipeline. As an example: $ opt -enable-new-pm=1 -adce -licm -simplifycfg -o /dev/null /dev/null -print-pipeline-passes verify,function(adce),function(loop-mssa(licm)),function(simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts>),verify,BitcodeWriterPass At the moment this is best-effort only and there are some known limitations: - Not all passes accepting parameters will print their parameters (currently only implemented for simplifycfg). - Some ClassName to pass-name mappings are not unique. - Some ClassName to pass-name mappings are missing (e.g. BitcodeWriterPass). Differential Revision: https://reviews.llvm.org/D108298
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopPassManager.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopPassManager.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopPassManager.cpp b/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
index 9f61aa0..1794d053 100644
--- a/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
@@ -44,6 +44,18 @@ PassManager<Loop, LoopAnalysisManager, LoopStandardAnalysisResults &,
return PA;
}
+void PassManager<Loop, LoopAnalysisManager, LoopStandardAnalysisResults &,
+ LPMUpdater &>::printPipeline(raw_ostream &OS,
+ function_ref<StringRef(StringRef)>
+ MapClassName2PassName) {
+ for (unsigned Idx = 0, Size = LoopPasses.size(); Idx != Size; ++Idx) {
+ auto *P = LoopPasses[Idx].get();
+ P->printPipeline(OS, MapClassName2PassName);
+ if (Idx + 1 < Size)
+ OS << ",";
+ }
+}
+
// Run both loop passes and loop-nest passes on top-level loop \p L.
PreservedAnalyses
LoopPassManager::runWithLoopNestPasses(Loop &L, LoopAnalysisManager &AM,
@@ -172,6 +184,12 @@ LoopPassManager::runWithoutLoopNestPasses(Loop &L, LoopAnalysisManager &AM,
}
} // namespace llvm
+void FunctionToLoopPassAdaptor::printPipeline(
+ raw_ostream &OS, function_ref<StringRef(StringRef)> MapClassName2PassName) {
+ OS << (UseMemorySSA ? "loop-mssa(" : "loop(");
+ Pass->printPipeline(OS, MapClassName2PassName);
+ OS << ")";
+}
PreservedAnalyses FunctionToLoopPassAdaptor::run(Function &F,
FunctionAnalysisManager &AM) {
// Before we even compute any loop analyses, first run a miniature function