[NPM] Added opt option -print-pipeline-passes.
authorMarkus Lavin <markus.lavin@ericsson.com>
Thu, 2 Sep 2021 06:23:33 +0000 (08:23 +0200)
committerMarkus Lavin <markus.lavin@ericsson.com>
Thu, 2 Sep 2021 06:23:33 +0000 (08:23 +0200)
commit304f2bd21de67583669b9787034e0e9c6caef775
treee45f0d3001f44e9e36d36741352542e3f18b395e
parent645af79e8e5f23382934b8d65f8af94438893f9f
[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
llvm/include/llvm/IR/PassManager.h
llvm/include/llvm/IR/PassManagerInternal.h
llvm/include/llvm/Transforms/Scalar/LoopPassManager.h
llvm/include/llvm/Transforms/Scalar/SimplifyCFG.h
llvm/lib/IR/PassManager.cpp
llvm/lib/Passes/PassBuilder.cpp
llvm/lib/Transforms/Scalar/LoopPassManager.cpp
llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
llvm/test/Other/new-pm-print-pipeline.ll [new file with mode: 0644]
llvm/tools/opt/NewPMDriver.cpp