[all-commits] [llvm/llvm-project] 2f0de5: [NewPM] Support --print-before/after in NPM
aeubanks via All-commits
all-commits at lists.llvm.org
Thu Dec 3 17:08:34 PST 2020
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2f0de582949d1c9b5beff591b3735b6c02c45033
https://github.com/llvm/llvm-project/commit/2f0de582949d1c9b5beff591b3735b6c02c45033
Author: Arthur Eubanks <aeubanks at google.com>
Date: 2020-12-03 (Thu, 03 Dec 2020)
Changed paths:
M llvm/include/llvm/IR/IRPrintingPasses.h
M llvm/include/llvm/IR/PassInstrumentation.h
A llvm/include/llvm/IR/PrintPasses.h
M llvm/include/llvm/Passes/StandardInstrumentations.h
M llvm/lib/Analysis/CallGraphSCCPass.cpp
M llvm/lib/Analysis/LoopInfo.cpp
M llvm/lib/Analysis/LoopPass.cpp
M llvm/lib/CodeGen/MachineFunctionPrinterPass.cpp
M llvm/lib/IR/CMakeLists.txt
M llvm/lib/IR/IRPrintingPasses.cpp
M llvm/lib/IR/LegacyPassManager.cpp
M llvm/lib/IR/PassInstrumentation.cpp
A llvm/lib/IR/PrintPasses.cpp
M llvm/lib/Passes/PassBuilder.cpp
M llvm/lib/Passes/StandardInstrumentations.cpp
R llvm/test/CodeGen/Generic/print-after.ll
M llvm/test/Other/loop-pass-printer.ll
A llvm/test/Other/print-before-after.ll
M llvm/utils/gn/secondary/llvm/lib/IR/BUILD.gn
Log Message:
-----------
[NewPM] Support --print-before/after in NPM
This changes --print-before/after to be a list of strings rather than
legacy passes. (this also has the effect of not showing the entire list
of passes in --help-hidden after --print-before/after, which IMO is
great for making it less verbose).
Currently PrintIRInstrumentation passes the class name rather than pass
name to llvm::shouldPrintBeforePass(), meaning
llvm::shouldPrintBeforePass() never functions as intended in the NPM.
There is no easy way of converting class names to pass names outside of
within an instance of PassBuilder.
This adds a map of pass class names to their short names in
PassRegistry.def within PassInstrumentationCallbacks. It is populated
inside the constructor of PassBuilder, which takes a
PassInstrumentationCallbacks.
Add a pointer to PassInstrumentationCallbacks inside
PrintIRInstrumentation and use the newly created map.
This is a bit hacky, but I can't think of a better way since the short
id to class name only exists within PassRegistry.def. This also doesn't
handle passes not in PassRegistry.def but rather added via
PassBuilder::registerPipelineParsingCallback().
llvm/test/CodeGen/Generic/print-after.ll doesn't seem very useful now
with this change.
Reviewed By: ychen, jamieschmeiser
Differential Revision: https://reviews.llvm.org/D87216
More information about the All-commits
mailing list