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-regions", MachineRegionInfoAnalysis())
50MACHINE_FUNCTION_ANALYSIS("machine-trace-metrics", MachineTraceMetricsAnalysis())
51MACHINE_FUNCTION_ANALYSIS("machine-uniformity", MachineUniformityAnalysis())
52MACHINE_FUNCTION_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
53MACHINE_FUNCTION_ANALYSIS("reaching-def", ReachingDefAnalysis())
54MACHINE_FUNCTION_ANALYSIS("regalloc-evict", RegAllocEvictionAdvisorAnalysis())
55MACHINE_FUNCTION_ANALYSIS("regalloc-priority", RegAllocPriorityAdvisorAnalysis())
56MACHINE_FUNCTION_ANALYSIS("slot-indexes", SlotIndexesAnalysis())
57MACHINE_FUNCTION_ANALYSIS("spill-code-placement", SpillPlacementAnalysis())
58MACHINE_FUNCTION_ANALYSIS("virtregmap", VirtRegMapAnalysis())
59// MACHINE_FUNCTION_ANALYSIS("gc-analysis",
60// GCMachineCodeAnalysisPass())
61#undef MACHINE_FUNCTION_ANALYSIS
62
63#ifndef MACHINE_FUNCTION_PASS
64#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS)
65#endif
66MACHINE_FUNCTION_PASS("block-placement-stats", MachineBlockPlacementStatsPass())
67MACHINE_FUNCTION_PASS("branch-relaxation", BranchRelaxationPass())
68MACHINE_FUNCTION_PASS("break-false-deps", BreakFalseDepsPass())
69MACHINE_FUNCTION_PASS("cfi-fixup", CFIFixupPass())
70MACHINE_FUNCTION_PASS("dead-mi-elimination", DeadMachineInstructionElimPass())
71MACHINE_FUNCTION_PASS("detect-dead-lanes", DetectDeadLanesPass())
72MACHINE_FUNCTION_PASS("dot-machine-cfg", MachineCFGPrinterPass())
73MACHINE_FUNCTION_PASS("early-ifcvt", EarlyIfConverterPass())
74MACHINE_FUNCTION_PASS("early-machinelicm", EarlyMachineLICMPass())
75MACHINE_FUNCTION_PASS("early-tailduplication", EarlyTailDuplicatePass())
76MACHINE_FUNCTION_PASS("fentry-insert", FEntryInserterPass())
77MACHINE_FUNCTION_PASS("finalize-isel", FinalizeISelPass())
78MACHINE_FUNCTION_PASS("finalizebundle-test", FinalizeBundleTestPass())
79MACHINE_FUNCTION_PASS("fixup-statepoint-caller-saved", FixupStatepointCallerSavedPass())
80MACHINE_FUNCTION_PASS("init-undef", InitUndefPass())
81MACHINE_FUNCTION_PASS("kcfi", MachineKCFIPass())
82MACHINE_FUNCTION_PASS("gc-empty-basic-blocks", GCEmptyBasicBlocksPass())
83MACHINE_FUNCTION_PASS("localstackalloc", LocalStackSlotAllocationPass())
84MACHINE_FUNCTION_PASS("machine-cp", MachineCopyPropagationPass())
85MACHINE_FUNCTION_PASS("machine-cse", MachineCSEPass())
86MACHINE_FUNCTION_PASS("machine-latecleanup", MachineLateInstrsCleanupPass())
87MACHINE_FUNCTION_PASS("machine-sanmd", MachineSanitizerBinaryMetadataPass())
88MACHINE_FUNCTION_PASS("machine-scheduler", MachineSchedulerPass(TM))
89MACHINE_FUNCTION_PASS("machinelicm", MachineLICMPass())
90MACHINE_FUNCTION_PASS("no-op-machine-function", NoOpMachineFunctionPass())
91MACHINE_FUNCTION_PASS("opt-phis", OptimizePHIsPass())
92MACHINE_FUNCTION_PASS("patchable-function", PatchableFunctionPass())
93MACHINE_FUNCTION_PASS("peephole-opt", PeepholeOptimizerPass())
94MACHINE_FUNCTION_PASS("phi-node-elimination", PHIEliminationPass())
95MACHINE_FUNCTION_PASS("post-RA-hazard-rec", PostRAHazardRecognizerPass())
96MACHINE_FUNCTION_PASS("post-RA-sched", PostRASchedulerPass(TM))
97MACHINE_FUNCTION_PASS("postra-machine-sink", PostRAMachineSinkingPass())
98MACHINE_FUNCTION_PASS("postmisched", PostMachineSchedulerPass(TM))
99MACHINE_FUNCTION_PASS("post-ra-pseudos", ExpandPostRAPseudosPass())
100MACHINE_FUNCTION_PASS("print", PrintMIRPass())
101MACHINE_FUNCTION_PASS("print<gisel-value-tracking>", GISelValueTrackingPrinterPass(errs()))
102MACHINE_FUNCTION_PASS("print<livedebugvars>", LiveDebugVariablesPrinterPass(errs()))
103MACHINE_FUNCTION_PASS("print<live-intervals>", LiveIntervalsPrinterPass(errs()))
104MACHINE_FUNCTION_PASS("print<live-stacks>", LiveStacksPrinterPass(errs()))
105MACHINE_FUNCTION_PASS("print<live-vars>", LiveVariablesPrinterPass(errs()))
106MACHINE_FUNCTION_PASS("print<machine-block-freq>",
107 MachineBlockFrequencyPrinterPass(errs()))
108MACHINE_FUNCTION_PASS("print<machine-block-hash>",
109 MachineBlockHashInfoPrinterPass(errs()))
110MACHINE_FUNCTION_PASS("print<machine-branch-prob>",
111 MachineBranchProbabilityPrinterPass(errs()))
112MACHINE_FUNCTION_PASS("print<machine-cycles>", MachineCycleInfoPrinterPass(errs()))
113MACHINE_FUNCTION_PASS("print<machine-dom-tree>",
114 MachineDominatorTreePrinterPass(errs()))
115MACHINE_FUNCTION_PASS("print<machine-loops>", MachineLoopPrinterPass(errs()))
116MACHINE_FUNCTION_PASS("print<machine-post-dom-tree>",
117 MachinePostDominatorTreePrinterPass(errs()))
118MACHINE_FUNCTION_PASS("print<machine-regions>",
119 MachineRegionInfoPrinterPass(errs()))
120MACHINE_FUNCTION_PASS("print<machine-uniformity>",
121 MachineUniformityPrinterPass(errs()))
122MACHINE_FUNCTION_PASS("print<reaching-def>", ReachingDefPrinterPass(errs()))
123MACHINE_FUNCTION_PASS("print<slot-indexes>", SlotIndexesPrinterPass(errs()))
124MACHINE_FUNCTION_PASS("print<virtregmap>", VirtRegMapPrinterPass(errs()))
125MACHINE_FUNCTION_PASS("process-imp-defs", ProcessImplicitDefsPass())
126MACHINE_FUNCTION_PASS("prolog-epilog", PrologEpilogInserterPass())
127MACHINE_FUNCTION_PASS("reg-usage-collector", RegUsageInfoCollectorPass())
128MACHINE_FUNCTION_PASS("reg-usage-propagation", RegUsageInfoPropagationPass())
129MACHINE_FUNCTION_PASS("register-coalescer", RegisterCoalescerPass())
130MACHINE_FUNCTION_PASS("rename-independent-subregs", RenameIndependentSubregsPass())
131MACHINE_FUNCTION_PASS("remove-loads-into-fake-uses", RemoveLoadsIntoFakeUsesPass())
132MACHINE_FUNCTION_PASS("remove-redundant-debug-values", RemoveRedundantDebugValuesPass())
133MACHINE_FUNCTION_PASS("require-all-machine-function-properties",
134 RequireAllMachineFunctionPropertiesPass())
135MACHINE_FUNCTION_PASS("shrink-wrap", ShrinkWrapPass())
136MACHINE_FUNCTION_PASS("stack-coloring", StackColoringPass())
137MACHINE_FUNCTION_PASS("stack-frame-layout", StackFrameLayoutAnalysisPass())
138MACHINE_FUNCTION_PASS("stack-slot-coloring", StackSlotColoringPass())
139MACHINE_FUNCTION_PASS("tailduplication", TailDuplicatePass())
140MACHINE_FUNCTION_PASS("trigger-verifier-error", TriggerVerifierErrorPass())
141MACHINE_FUNCTION_PASS("two-address-instruction", TwoAddressInstructionPass())
142MACHINE_FUNCTION_PASS("unpack-mi-bundles", UnpackMachineBundlesPass())
143MACHINE_FUNCTION_PASS("unreachable-mbb-elimination",
144 UnreachableMachineBlockElimPass())
145MACHINE_FUNCTION_PASS("verify", MachineVerifierPass())
146MACHINE_FUNCTION_PASS("verify<machine-trace-metrics>", MachineTraceMetricsVerifierPass())
147MACHINE_FUNCTION_PASS("xray-instrumentation", XRayInstrumentationPass())
148#undef MACHINE_FUNCTION_PASS
149
150#ifndef MACHINE_FUNCTION_PASS_WITH_PARAMS
151#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
152 PARAMS)
153#endif
154
155MACHINE_FUNCTION_PASS_WITH_PARAMS(
156 "block-placement", "MachineBlockPlacementPass",
157 [](bool AllowTailMerge) {
158 // Default is true.
159 return MachineBlockPlacementPass(AllowTailMerge);
160 },
161 parseMachineBlockPlacementPassOptions, "no-tail-merge;tail-merge")
162
163MACHINE_FUNCTION_PASS_WITH_PARAMS(
164 "branch-folder", "BranchFolderPass",
165 [](bool EnableTailMerge) { return BranchFolderPass(EnableTailMerge); },
166 [](StringRef Params) {
167 return parseSinglePassOption(Params, "enable-tail-merge",
168 "BranchFolderPass");
169 },
170 "enable-tail-merge")
171
172MACHINE_FUNCTION_PASS_WITH_PARAMS(
173 "live-debug-values", "LiveDebugValuesPass",
174 [](bool ShouldEmitDebugEntryValues) {
175 return LiveDebugValuesPass(ShouldEmitDebugEntryValues);
176 },
177 [](StringRef Params) {
178 return parseSinglePassOption(Params, "emit-debug-entry-values",
179 "LiveDebugValuesPass");
180 },
181 "emit-debug-entry-values")
182
183MACHINE_FUNCTION_PASS_WITH_PARAMS(
184 "machine-sink", "MachineSinkingPass",
185 [](bool EnableSinkAndFold) {
186 return MachineSinkingPass(EnableSinkAndFold);
187 },
188 parseMachineSinkingPassOptions, "enable-sink-fold")
189
190MACHINE_FUNCTION_PASS_WITH_PARAMS(
191 "regallocfast", "RegAllocFastPass",
192 [](RegAllocFastPass::Options Opts) { return RegAllocFastPass(Opts); },
193 [PB = this](StringRef Params) {
194 return parseRegAllocFastPassOptions(*PB, Params);
195 },
196 "filter=reg-filter;no-clear-vregs")
197
198// 'all' is the default filter.
199MACHINE_FUNCTION_PASS_WITH_PARAMS(
200 "greedy", "RAGreedyPass",
201 [](RAGreedyPass::Options Opts) { return RAGreedyPass(Opts); },
202 [PB = this](StringRef Params) {
203 return parseRegAllocGreedyFilterFunc(*PB, Params);
204 }, "reg-filter"
205)
206
207MACHINE_FUNCTION_PASS_WITH_PARAMS(
208 "virt-reg-rewriter", "VirtRegRewriterPass",
209 [](bool ClearVirtRegs) { return VirtRegRewriterPass(ClearVirtRegs); },
210 parseVirtRegRewriterPassOptions, "no-clear-vregs;clear-vregs")
211
212#undef MACHINE_FUNCTION_PASS_WITH_PARAMS
213
214// After a pass is converted to new pass manager, its entry should be moved from
215// dummy table to the normal one. For example, for a machine function pass,
216// DUMMY_MACHINE_FUNCTION_PASS to MACHINE_FUNCTION_PASS.
217
218#ifndef DUMMY_FUNCTION_PASS
219#define DUMMY_FUNCTION_PASS(NAME, PASS_NAME)
220#endif
221#undef DUMMY_FUNCTION_PASS
222
223#ifndef DUMMY_MACHINE_MODULE_PASS
224#define DUMMY_MACHINE_MODULE_PASS(NAME, PASS_NAME)
225#endif
226DUMMY_MACHINE_MODULE_PASS("machine-outliner", MachineOutlinerPass)
227DUMMY_MACHINE_MODULE_PASS("static-data-annotator", StaticDataAnnotator)
228DUMMY_MACHINE_MODULE_PASS("pseudo-probe-inserter", PseudoProbeInserterPass)
229#undef DUMMY_MACHINE_MODULE_PASS
230
231#ifndef DUMMY_MACHINE_FUNCTION_PASS
232#define DUMMY_MACHINE_FUNCTION_PASS(NAME, PASS_NAME)
233#endif
234DUMMY_MACHINE_FUNCTION_PASS("bbsections-prepare", BasicBlockSectionsPass)
235DUMMY_MACHINE_FUNCTION_PASS("bbsections-profile-reader", BasicBlockSectionsProfileReaderPass)
236DUMMY_MACHINE_FUNCTION_PASS("cfguard-longjmp", CFGuardLongjmpPass)
237DUMMY_MACHINE_FUNCTION_PASS("cfi-instr-inserter", CFIInstrInserterPass)
238DUMMY_MACHINE_FUNCTION_PASS("eh-cont-guard-targets", EHContGuardTargetsPass)
239DUMMY_MACHINE_FUNCTION_PASS("fs-profile-loader", MIRProfileLoaderNewPass)
240DUMMY_MACHINE_FUNCTION_PASS("funclet-layout", FuncletLayoutPass)
241DUMMY_MACHINE_FUNCTION_PASS("implicit-null-checks", ImplicitNullChecksPass)
242DUMMY_MACHINE_FUNCTION_PASS("instruction-select", InstructionSelectPass)
243DUMMY_MACHINE_FUNCTION_PASS("irtranslator", IRTranslatorPass)
244DUMMY_MACHINE_FUNCTION_PASS("legalizer", LegalizerPass)
245DUMMY_MACHINE_FUNCTION_PASS("lrshrink", LiveRangeShrinkPass)
246DUMMY_MACHINE_FUNCTION_PASS("machine-combiner", MachineCombinerPass)
247DUMMY_MACHINE_FUNCTION_PASS("static-data-splitter", StaticDataSplitter)
248DUMMY_MACHINE_FUNCTION_PASS("machine-function-splitter", MachineFunctionSplitterPass)
249DUMMY_MACHINE_FUNCTION_PASS("machineinstr-printer", MachineFunctionPrinterPass)
250DUMMY_MACHINE_FUNCTION_PASS("mirfs-discriminators", MIRAddFSDiscriminatorsPass)
251DUMMY_MACHINE_FUNCTION_PASS("prologepilog-code", PrologEpilogCodeInserterPass)
252DUMMY_MACHINE_FUNCTION_PASS("ra-basic", RABasicPass)
253DUMMY_MACHINE_FUNCTION_PASS("ra-pbqp", RAPBQPPass)
254DUMMY_MACHINE_FUNCTION_PASS("regalloc", RegAllocPass)
255DUMMY_MACHINE_FUNCTION_PASS("regallocscoringpass", RegAllocScoringPass)
256DUMMY_MACHINE_FUNCTION_PASS("regbankselect", RegBankSelectPass)
257DUMMY_MACHINE_FUNCTION_PASS("reset-machine-function", ResetMachineFunctionPass)
258DUMMY_MACHINE_FUNCTION_PASS("stackmap-liveness", StackMapLivenessPass)
259#undef DUMMY_MACHINE_FUNCTION_PASS
260