aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Eubanks <aeubanks@google.com>2021-02-04 19:34:09 -0800
committerArthur Eubanks <aeubanks@google.com>2021-02-10 11:22:12 -0800
commit5d960cba34682d0d4e0cd56837131888eb647c62 (patch)
treef378cebbd782be2d6f0c1597cb9fa1407e7320f4 /llvm/test/Other
parent[RISCV] Remove superfluous semicolon. NFC (diff)
downloadllvm-project-5d960cba34682d0d4e0cd56837131888eb647c62.tar.gz
llvm-project-5d960cba34682d0d4e0cd56837131888eb647c62.tar.bz2
llvm-project-5d960cba34682d0d4e0cd56837131888eb647c62.zip
[opt][NewPM] Add a --print-passes flag to print all available passes
It seems nicer to list passes given a flag rather than displaying all passes in opt --help. This is awkwardly structured because a PassBuilder is required, but reusing the PassBuilder in runPassPipeline() doesn't work because we read the input IR before getting to runPassPipeline(). So printing the list of passes needs to happen before reading the input IR. If we remove the legacy PM code in main() and move everything from NewPMDriver.cpp into opt.cpp, we can create the PassBuilder before reading IR and check if we should print the list of passes and exit. But until then this hack seems fine. Compared to the legacy PM, the new PM passes are lacking descriptions. We'll need to figure out a way to add descriptions if we think this is important. Also, this only works for passes specified in PassRegistry.def. If we want to print other custom registered passes, we'll need a different mechanism. Reviewed By: asbirlea Differential Revision: https://reviews.llvm.org/D96101
Diffstat (limited to 'llvm/test/Other')
-rw-r--r--llvm/test/Other/print-passes.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/Other/print-passes.ll b/llvm/test/Other/print-passes.ll
new file mode 100644
index 000000000000..a77922bff6f4
--- /dev/null
+++ b/llvm/test/Other/print-passes.ll
@@ -0,0 +1,22 @@
+; RUN: opt --print-passes | FileCheck %s
+
+; CHECK: Module passes:
+; CHECK: no-op-module
+; CHECK: Module analyses:
+; CHECK: no-op-module
+; CHECK: Module alias analyses:
+; CHECK: globals-aa
+; CHECK: CGSCC passes:
+; CHECK: no-op-cgscc
+; CHECK: CGSCC analyses:
+; CHECK: no-op-cgscc
+; CHECK: Function passes:
+; CHECK: no-op-function
+; CHECK: Function analyses:
+; CHECK: no-op-function
+; CHECK: Function alias analyses:
+; CHECK: basic-aa
+; CHECK: Loop passes:
+; CHECK: no-op-loop
+; CHECK: Loop analyses:
+; CHECK: no-op-loop