1//===- MachinePassRegistry.def - Registry of passes -------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file is used as the registry of passes that are for target-independent
10// code generator.
11//
12//===----------------------------------------------------------------------===//
13
14// NOTE: NO INCLUDE GUARD DESIRED!
15
16#ifndef MACHINE_MODULE_PASS
17#define MACHINE_MODULE_PASS(NAME, CREATE_PASS)
18#endif
19#undef MACHINE_MODULE_PASS
20
21#ifndef MACHINE_FUNCTION_ANALYSIS
22#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS)
23#endif
24// LiveVariables currently requires pure SSA form.
25// FIXME: Once TwoAddressInstruction pass no longer uses kill flags,
26// LiveVariables can be removed completely, and LiveIntervals can be directly
27// computed. (We still either need to regenerate kill flags after regalloc, or
28// preferably fix the scavenger to not depend on them).
29MACHINE_FUNCTION_ANALYSIS("edge-bundles", EdgeBundlesAnalysis())
30MACHINE_FUNCTION_ANALYSIS("gisel-cse-analysis", GISelCSEAnalysis(TM))
31MACHINE_FUNCTION_ANALYSIS("gisel-value-tracking", GISelValueTrackingAnalysis())
32MACHINE_FUNCTION_ANALYSIS("livedebugvars", LiveDebugVariablesAnalysis())
33MACHINE_FUNCTION_ANALYSIS("live-intervals", LiveIntervalsAnalysis())
34MACHINE_FUNCTION_ANALYSIS("live-reg-matrix", LiveRegMatrixAnalysis())
35MACHINE_FUNCTION_ANALYSIS("live-stacks", LiveStacksAnalysis())
36MACHINE_FUNCTION_ANALYSIS("live-vars", LiveVariablesAnalysis())
37MACHINE_FUNCTION_ANALYSIS("machine-block-freq", MachineBlockFrequencyAnalysis())
38MACHINE_FUNCTION_ANALYSIS("machine-block-hash", MachineBlockHashInfoAnalysis())
39MACHINE_FUNCTION_ANALYSIS("machine-branch-prob",
40 MachineBranchProbabilityAnalysis())
41MACHINE_FUNCTION_ANALYSIS("machine-cycles", MachineCycleAnalysis())
42MACHINE_FUNCTION_ANALYSIS("machine-dom-frontier", MachineDominanceFrontierAnalysis())
43MACHINE_FUNCTION_ANALYSIS("machine-dom-tree", MachineDominatorTreeAnalysis())
44MACHINE_FUNCTION_ANALYSIS("machine-loops", MachineLoopAnalysis())
45MACHINE_FUNCTION_ANALYSIS("machine-opt-remark-emitter",
46 MachineOptimizationRemarkEmitterAnalysis())
47MACHINE_FUNCTION_ANALYSIS("machine-post-dom-tree",
48 MachinePostDominatorTreeAnalysis())
49MACHINE_FUNCTION_ANALYSIS("machine-register-class-info",
50 MachineRegisterClassAnalysis())
51MACHINE_FUNCTION_ANALYSIS("machine-regions", MachineRegionInfoAnalysis())
52MACHINE_FUNCTION_ANALYSIS("machine-trace-metrics", MachineTraceMetricsAnalysis())
53MACHINE_FUNCTION_ANALYSIS("machine-uniformity", MachineUniformityAnalysis())
54MACHINE_FUNCTION_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
55MACHINE_FUNCTION_ANALYSIS("reaching-def", ReachingDefAnalysis())
56MACHINE_FUNCTION_ANALYSIS("regalloc-evict", RegAllocEvictionAdvisorAnalysis())
57MACHINE_FUNCTION_ANALYSIS("regalloc-priority", RegAllocPriorityAdvisorAnalysis())
58MACHINE_FUNCTION_ANALYSIS("slot-indexes", SlotIndexesAnalysis())
59MACHINE_FUNCTION_ANALYSIS("spill-code-placement", SpillPlacementAnalysis())
60MACHINE_FUNCTION_ANALYSIS("virtregmap", VirtRegMapAnalysis())
61// MACHINE_FUNCTION_ANALYSIS("gc-analysis",
62// GCMachineCodeAnalysisPass())
63#undef MACHINE_FUNCTION_ANALYSIS
64
65#ifndef MACHINE_FUNCTION_PASS
66#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS)
67#endif
68MACHINE_FUNCTION_PASS("block-placement-stats", MachineBlockPlacementStatsPass())
69MACHINE_FUNCTION_PASS("branch-relaxation", BranchRelaxationPass())
70MACHINE_FUNCTION_PASS("break-false-deps", BreakFalseDepsPass())
71MACHINE_FUNCTION_PASS("cfi-fixup", CFIFixupPass())
72MACHINE_FUNCTION_PASS("cfi-instr-inserter", CFIInstrInserterPass())
73MACHINE_FUNCTION_PASS("dead-mi-elimination", DeadMachineInstructionElimPass())
74MACHINE_FUNCTION_PASS("detect-dead-lanes", DetectDeadLanesPass())
75MACHINE_FUNCTION_PASS("dot-machine-cfg", MachineCFGPrinterPass())
76MACHINE_FUNCTION_PASS("early-ifcvt", EarlyIfConverterPass())
77MACHINE_FUNCTION_PASS("early-machinelicm", EarlyMachineLICMPass())
78MACHINE_FUNCTION_PASS("early-tailduplication", EarlyTailDuplicatePass())
79MACHINE_FUNCTION_PASS("eh-cont-guard-targets", EHContGuardTargetsPass())
80MACHINE_FUNCTION_PASS("fentry-insert", FEntryInserterPass())
81MACHINE_FUNCTION_PASS("finalize-isel", FinalizeISelPass())
82MACHINE_FUNCTION_PASS("finalizebundle-test", FinalizeBundleTestPass())
83MACHINE_FUNCTION_PASS("fixup-statepoint-caller-saved", FixupStatepointCallerSavedPass())
84MACHINE_FUNCTION_PASS("funclet-layout", FuncletLayoutPass())
85MACHINE_FUNCTION_PASS("init-undef", InitUndefPass())
86MACHINE_FUNCTION_PASS("implicit-null-checks", ImplicitNullChecksPass())
87MACHINE_FUNCTION_PASS("instruction-select", InstructionSelectPass())
88MACHINE_FUNCTION_PASS("ir-translator", IRTranslatorPass(TM->getOptLevel()))
89MACHINE_FUNCTION_PASS("kcfi", MachineKCFIPass())
90MACHINE_FUNCTION_PASS("gc-empty-basic-blocks", GCEmptyBasicBlocksPass())
91MACHINE_FUNCTION_PASS("legalizer", LegalizerPass())
92MACHINE_FUNCTION_PASS("load-store-opt", LoadStoreOptPass())
93MACHINE_FUNCTION_PASS("localizer", LocalizerPass())
94MACHINE_FUNCTION_PASS("localstackalloc", LocalStackSlotAllocationPass())
95MACHINE_FUNCTION_PASS("machine-combiner", MachineCombinerPass())
96MACHINE_FUNCTION_PASS("machine-cp", MachineCopyPropagationPass())
97MACHINE_FUNCTION_PASS("machine-cse", MachineCSEPass())
98MACHINE_FUNCTION_PASS("machine-latecleanup", MachineLateInstrsCleanupPass())
99MACHINE_FUNCTION_PASS("machine-sanmd", MachineSanitizerBinaryMetadataPass())
100MACHINE_FUNCTION_PASS("machine-scheduler", MachineSchedulerPass(TM))
101MACHINE_FUNCTION_PASS("machinelicm", MachineLICMPass())
102MACHINE_FUNCTION_PASS("no-op-machine-function", NoOpMachineFunctionPass())
103MACHINE_FUNCTION_PASS("opt-phis", OptimizePHIsPass())
104MACHINE_FUNCTION_PASS("patchable-function", PatchableFunctionPass())
105MACHINE_FUNCTION_PASS("peephole-opt", PeepholeOptimizerPass())
106MACHINE_FUNCTION_PASS("phi-node-elimination", PHIEliminationPass())
107MACHINE_FUNCTION_PASS("post-RA-hazard-rec", PostRAHazardRecognizerPass())
108MACHINE_FUNCTION_PASS("post-RA-sched", PostRASchedulerPass(TM))
109MACHINE_FUNCTION_PASS("postra-machine-sink", PostRAMachineSinkingPass())
110MACHINE_FUNCTION_PASS("postmisched", PostMachineSchedulerPass(TM))
111MACHINE_FUNCTION_PASS("post-ra-pseudos", ExpandPostRAPseudosPass())
112MACHINE_FUNCTION_PASS("print", PrintMIRPass())
113MACHINE_FUNCTION_PASS("print<gisel-value-tracking>", GISelValueTrackingPrinterPass(errs()))
114MACHINE_FUNCTION_PASS("print<livedebugvars>", LiveDebugVariablesPrinterPass(errs()))
115MACHINE_FUNCTION_PASS("print<live-intervals>", LiveIntervalsPrinterPass(errs()))
116MACHINE_FUNCTION_PASS("print<live-stacks>", LiveStacksPrinterPass(errs()))
117MACHINE_FUNCTION_PASS("print<live-vars>", LiveVariablesPrinterPass(errs()))
118MACHINE_FUNCTION_PASS("print<machine-block-freq>",
119 MachineBlockFrequencyPrinterPass(errs()))
120MACHINE_FUNCTION_PASS("print<machine-block-hash>",
121 MachineBlockHashInfoPrinterPass(errs()))
122MACHINE_FUNCTION_PASS("print<machine-branch-prob>",
123 MachineBranchProbabilityPrinterPass(errs()))
124MACHINE_FUNCTION_PASS("print<machine-cycles>", MachineCycleInfoPrinterPass(errs()))
125MACHINE_FUNCTION_PASS("print<machine-dom-tree>",
126 MachineDominatorTreePrinterPass(errs()))
127MACHINE_FUNCTION_PASS("print<machine-loops>", MachineLoopPrinterPass(errs()))
128MACHINE_FUNCTION_PASS("print<machine-post-dom-tree>",
129 MachinePostDominatorTreePrinterPass(errs()))
130MACHINE_FUNCTION_PASS("print<machine-regions>",
131 MachineRegionInfoPrinterPass(errs()))
132MACHINE_FUNCTION_PASS("print<machine-uniformity>",
133 MachineUniformityPrinterPass(errs()))
134MACHINE_FUNCTION_PASS("print<reaching-def>", ReachingDefPrinterPass(errs()))
135MACHINE_FUNCTION_PASS("print<slot-indexes>", SlotIndexesPrinterPass(errs()))
136MACHINE_FUNCTION_PASS("print<virtregmap>", VirtRegMapPrinterPass(errs()))
137MACHINE_FUNCTION_PASS("process-imp-defs", ProcessImplicitDefsPass())
138MACHINE_FUNCTION_PASS("prolog-epilog", PrologEpilogInserterPass())
139MACHINE_FUNCTION_PASS("reg-bank-select", RegBankSelectPass())
140MACHINE_FUNCTION_PASS("reg-usage-collector", RegUsageInfoCollectorPass())
141MACHINE_FUNCTION_PASS("reg-usage-propagation", RegUsageInfoPropagationPass())
142MACHINE_FUNCTION_PASS("register-coalescer", RegisterCoalescerPass())
143MACHINE_FUNCTION_PASS("rename-independent-subregs", RenameIndependentSubregsPass())
144MACHINE_FUNCTION_PASS("remove-loads-into-fake-uses", RemoveLoadsIntoFakeUsesPass())
145MACHINE_FUNCTION_PASS("remove-redundant-debug-values", RemoveRedundantDebugValuesPass())
146MACHINE_FUNCTION_PASS("require-all-machine-function-properties",
147 RequireAllMachineFunctionPropertiesPass())
148MACHINE_FUNCTION_PASS("shrink-wrap", ShrinkWrapPass())
149MACHINE_FUNCTION_PASS("stack-coloring", StackColoringPass())
150MACHINE_FUNCTION_PASS("stack-frame-layout", StackFrameLayoutAnalysisPass())
151MACHINE_FUNCTION_PASS("stack-slot-coloring", StackSlotColoringPass())
152MACHINE_FUNCTION_PASS("static-data-splitter", StaticDataSplitterPass())
153MACHINE_FUNCTION_PASS("tailduplication", TailDuplicatePass())
154MACHINE_FUNCTION_PASS("trigger-verifier-error", TriggerVerifierErrorPass())
155MACHINE_FUNCTION_PASS("two-address-instruction", TwoAddressInstructionPass())
156MACHINE_FUNCTION_PASS("unpack-mi-bundles", UnpackMachineBundlesPass())
157MACHINE_FUNCTION_PASS("unreachable-mbb-elimination",
158 UnreachableMachineBlockElimPass())
159MACHINE_FUNCTION_PASS("verify", MachineVerifierPass())
160MACHINE_FUNCTION_PASS("verify<machine-trace-metrics>", MachineTraceMetricsVerifierPass())
161MACHINE_FUNCTION_PASS("xray-instrumentation", XRayInstrumentationPass())
162#undef MACHINE_FUNCTION_PASS
163
164#ifndef MACHINE_FUNCTION_PASS_WITH_PARAMS
165#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
166 PARAMS)
167#endif
168
169MACHINE_FUNCTION_PASS_WITH_PARAMS(
170 "block-placement", "MachineBlockPlacementPass",
171 [](bool AllowTailMerge) {
172 // Default is true.
173 return MachineBlockPlacementPass(AllowTailMerge);
174 },
175 parseMachineBlockPlacementPassOptions, "no-tail-merge;tail-merge")
176
177MACHINE_FUNCTION_PASS_WITH_PARAMS(
178 "branch-folder", "BranchFolderPass",
179 [](bool EnableTailMerge) { return BranchFolderPass(EnableTailMerge); },
180 [](StringRef Params) {
181 return parseSinglePassOption(Params, "enable-tail-merge",
182 "BranchFolderPass");
183 },
184 "enable-tail-merge")
185
186MACHINE_FUNCTION_PASS_WITH_PARAMS(
187 "live-debug-values", "LiveDebugValuesPass",
188 [](bool ShouldEmitDebugEntryValues) {
189 return LiveDebugValuesPass(ShouldEmitDebugEntryValues);
190 },
191 [](StringRef Params) {
192 return parseSinglePassOption(Params, "emit-debug-entry-values",
193 "LiveDebugValuesPass");
194 },
195 "emit-debug-entry-values")
196
197MACHINE_FUNCTION_PASS_WITH_PARAMS(
198 "machine-sink", "MachineSinkingPass",
199 [](bool EnableSinkAndFold) {
200 return MachineSinkingPass(EnableSinkAndFold);
201 },
202 parseMachineSinkingPassOptions, "enable-sink-fold")
203
204MACHINE_FUNCTION_PASS_WITH_PARAMS(
205 "regallocfast", "RegAllocFastPass",
206 [](RegAllocFastPass::Options Opts) { return RegAllocFastPass(Opts); },
207 [PB = this](StringRef Params) {
208 return parseRegAllocFastPassOptions(*PB, Params);
209 },
210 "filter=reg-filter;no-clear-vregs")
211
212// 'all' is the default filter.
213MACHINE_FUNCTION_PASS_WITH_PARAMS(
214 "greedy", "RAGreedyPass",
215 [](RAGreedyPass::Options Opts) { return RAGreedyPass(Opts); },
216 [PB = this](StringRef Params) {
217 return parseRegAllocGreedyFilterFunc(*PB, Params);
218 }, "reg-filter"
219)
220
221MACHINE_FUNCTION_PASS_WITH_PARAMS(
222 "virt-reg-rewriter", "VirtRegRewriterPass",
223 [](bool ClearVirtRegs) { return VirtRegRewriterPass(ClearVirtRegs); },
224 parseVirtRegRewriterPassOptions, "no-clear-vregs;clear-vregs")
225
226#undef MACHINE_FUNCTION_PASS_WITH_PARAMS
227
228// After a pass is converted to new pass manager, its entry should be moved from
229// dummy table to the normal one. For example, for a machine function pass,
230// DUMMY_MACHINE_FUNCTION_PASS to MACHINE_FUNCTION_PASS.
231
232#ifndef DUMMY_FUNCTION_PASS
233#define DUMMY_FUNCTION_PASS(NAME, PASS_NAME)
234#endif
235#undef DUMMY_FUNCTION_PASS
236
237#ifndef DUMMY_MACHINE_MODULE_PASS
238#define DUMMY_MACHINE_MODULE_PASS(NAME, PASS_NAME)
239#endif
240DUMMY_MACHINE_MODULE_PASS("machine-outliner", MachineOutlinerPass)
241DUMMY_MACHINE_MODULE_PASS("pseudo-probe-inserter", PseudoProbeInserterPass)
242#undef DUMMY_MACHINE_MODULE_PASS
243
244#ifndef DUMMY_MACHINE_FUNCTION_PASS
245#define DUMMY_MACHINE_FUNCTION_PASS(NAME, PASS_NAME)
246#endif
247DUMMY_MACHINE_FUNCTION_PASS("bbsections-prepare", BasicBlockSectionsPass)
248DUMMY_MACHINE_FUNCTION_PASS("bbsections-profile-reader", BasicBlockSectionsProfileReaderPass)
249DUMMY_MACHINE_FUNCTION_PASS("cfguard-longjmp", CFGuardLongjmpPass)
250DUMMY_MACHINE_FUNCTION_PASS("fs-profile-loader", MIRProfileLoaderNewPass)
251DUMMY_MACHINE_FUNCTION_PASS("lrshrink", LiveRangeShrinkPass)
252DUMMY_MACHINE_FUNCTION_PASS("machine-function-splitter", MachineFunctionSplitterPass)
253DUMMY_MACHINE_FUNCTION_PASS("machineinstr-printer", MachineFunctionPrinterPass)
254DUMMY_MACHINE_FUNCTION_PASS("mirfs-discriminators", MIRAddFSDiscriminatorsPass)
255DUMMY_MACHINE_FUNCTION_PASS("prolog-epilog-code", PrologEpilogCodeInserterPass)
256DUMMY_MACHINE_FUNCTION_PASS("ra-basic", RABasicPass)
257DUMMY_MACHINE_FUNCTION_PASS("ra-pbqp", RAPBQPPass)
258DUMMY_MACHINE_FUNCTION_PASS("regalloc", RegAllocPass)
259DUMMY_MACHINE_FUNCTION_PASS("regallocscoringpass", RegAllocScoringPass)
260DUMMY_MACHINE_FUNCTION_PASS("reset-machine-function", ResetMachineFunctionPass)
261DUMMY_MACHINE_FUNCTION_PASS("stackmap-liveness", StackMapLivenessPass)
262#undef DUMMY_MACHINE_FUNCTION_PASS
263