In response to https://lists.llvm.org/pipermail/llvm-dev/2021-July/151987.html and what was discussed in that thread.
Proposal for pipeline printing with the new pass manager with integrated printing of pass parameters for those passes that implement it (currently only SimplifyCFG).
Examples
$ opt -enable-new-pm=1 -adce -simplifycfg -o /dev/null /dev/null -print-pipeline-passes -passes='verify,function(adce),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,NO-PASSNAME-FOR(BitcodeWriterPass)'
$ opt -O3 /dev/null -S -o /dev/null -print-pipeline-passes -passes='verify,annotation2metadata,forceattrs,inferattrs,function(lower-expect,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts>,sroa,early-cse,coro-early,callsite-splitting),openmp-opt,ipsccp,called-value-propagation,globalopt,function(mem2reg),deadargelim,function(instcombine,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts>),inliner-wrapper,globalopt,globaldce,elim-avail-extern,rpo-function-attrs,require<globals-aa>,function(float2int,lower-constant-intrinsics,loop(loop-rotate),loop-distribute,inject-tli-mappings,loop-vectorize,loop-load-elim,instcombine,simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-to-lookup;no-keep-loops;hoist-common-insts;sink-common-insts>,slp-vectorizer,vector-combine,instcombine,loop-unroll,transform-warning,instcombine,require<opt-remark-emit>,loop-mssa(licm),alignment-from-assumptions,loop-sink,instsimplify,div-rem-pairs,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts>,coro-cleanup),cg-profile,globaldce,constmerge,rel-lookup-table-converter,function(annotation-remarks),verify,print'
IMHO the getPassNameForClassName function is pretty trivial. Maybe you should just pass around a reference to the ClassToPassName StringMap instead. That will show that we do not really depend on or use the PassInstrumentationCallbacks class. We are only interested in the StringMap (and in the future that could be implemented somewhere else and not in the PassInstrumentationCallbacks class). Or what do you think about that?