[NPM] Added opt option -print-pipeline-passes.
authorMarkus Lavin <markus.lavin@ericsson.com>
Thu, 2 Sep 2021 05:47:23 +0000 (07:47 +0200)
committerMarkus Lavin <markus.lavin@ericsson.com>
Thu, 2 Sep 2021 06:16:51 +0000 (08:16 +0200)
commitc71869ed4c24b3d4d13e2f83ee2c0104013ca129
treee45f0d3001f44e9e36d36741352542e3f18b395e
parent67794e784e1da5ef74d6310f847a2ec41a79d9ff
[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).
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