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("pipeliner", MachinePipelinerPass())
108MACHINE_FUNCTION_PASS("post-RA-hazard-rec", PostRAHazardRecognizerPass())
109MACHINE_FUNCTION_PASS("post-RA-sched", PostRASchedulerPass(TM))
110MACHINE_FUNCTION_PASS("postra-machine-sink", PostRAMachineSinkingPass())
111MACHINE_FUNCTION_PASS("postmisched", PostMachineSchedulerPass(TM))
112MACHINE_FUNCTION_PASS("post-ra-pseudos", ExpandPostRAPseudosPass())
113MACHINE_FUNCTION_PASS("print", PrintMIRPass())
114MACHINE_FUNCTION_PASS("print<gisel-value-tracking>", GISelValueTrackingPrinterPass(errs()))
115MACHINE_FUNCTION_PASS("print<livedebugvars>", LiveDebugVariablesPrinterPass(errs()))
116MACHINE_FUNCTION_PASS("print<live-intervals>", LiveIntervalsPrinterPass(errs()))
117MACHINE_FUNCTION_PASS("print<live-stacks>", LiveStacksPrinterPass(errs()))
118MACHINE_FUNCTION_PASS("print<live-vars>", LiveVariablesPrinterPass(errs()))
119MACHINE_FUNCTION_PASS("print<machine-block-freq>",
120 MachineBlockFrequencyPrinterPass(errs()))
121MACHINE_FUNCTION_PASS("print<machine-block-hash>",
122 MachineBlockHashInfoPrinterPass(errs()))
123MACHINE_FUNCTION_PASS("print<machine-branch-prob>",
124 MachineBranchProbabilityPrinterPass(errs()))
125MACHINE_FUNCTION_PASS("print<machine-cycles>", MachineCycleInfoPrinterPass(errs()))
126MACHINE_FUNCTION_PASS("print<machine-dom-tree>",
127 MachineDominatorTreePrinterPass(errs()))
128MACHINE_FUNCTION_PASS("print<machine-loops>", MachineLoopPrinterPass(errs()))
129MACHINE_FUNCTION_PASS("print<machine-post-dom-tree>",
130 MachinePostDominatorTreePrinterPass(errs()))
131MACHINE_FUNCTION_PASS("print<machine-regions>",
132 MachineRegionInfoPrinterPass(errs()))
133MACHINE_FUNCTION_PASS("print<machine-uniformity>",
134 MachineUniformityPrinterPass(errs()))
135MACHINE_FUNCTION_PASS("print<reaching-def>", ReachingDefPrinterPass(errs()))
136MACHINE_FUNCTION_PASS("print<slot-indexes>", SlotIndexesPrinterPass(errs()))
137MACHINE_FUNCTION_PASS("print<virtregmap>", VirtRegMapPrinterPass(errs()))
138MACHINE_FUNCTION_PASS("process-imp-defs", ProcessImplicitDefsPass())
139MACHINE_FUNCTION_PASS("prolog-epilog", PrologEpilogInserterPass())
140MACHINE_FUNCTION_PASS("reg-bank-select", RegBankSelectPass())
141MACHINE_FUNCTION_PASS("reg-usage-collector", RegUsageInfoCollectorPass())
142MACHINE_FUNCTION_PASS("reg-usage-propagation", RegUsageInfoPropagationPass())
143MACHINE_FUNCTION_PASS("register-coalescer", RegisterCoalescerPass())
144MACHINE_FUNCTION_PASS("rename-independent-subregs", RenameIndependentSubregsPass())
145MACHINE_FUNCTION_PASS("remove-loads-into-fake-uses", RemoveLoadsIntoFakeUsesPass())
146MACHINE_FUNCTION_PASS("remove-redundant-debug-values", RemoveRedundantDebugValuesPass())
147MACHINE_FUNCTION_PASS("reset-machine-function", ResetMachineFunctionPass())
148MACHINE_FUNCTION_PASS("require-all-machine-function-properties",
149 RequireAllMachineFunctionPropertiesPass())
150MACHINE_FUNCTION_PASS("shrink-wrap", ShrinkWrapPass())
151MACHINE_FUNCTION_PASS("stack-coloring", StackColoringPass())
152MACHINE_FUNCTION_PASS("stack-frame-layout", StackFrameLayoutAnalysisPass())
153MACHINE_FUNCTION_PASS("stack-slot-coloring", StackSlotColoringPass())
154MACHINE_FUNCTION_PASS("static-data-splitter", StaticDataSplitterPass())
155MACHINE_FUNCTION_PASS("tailduplication", TailDuplicatePass())
156MACHINE_FUNCTION_PASS("trigger-crash-machine-function",
157 TriggerCrashMachineFunctionPass())
158MACHINE_FUNCTION_PASS("trigger-verifier-error", TriggerVerifierErrorPass())
159MACHINE_FUNCTION_PASS("two-address-instruction", TwoAddressInstructionPass())
160MACHINE_FUNCTION_PASS("unpack-mi-bundles", UnpackMachineBundlesPass())
161MACHINE_FUNCTION_PASS("unreachable-mbb-elimination",
162 UnreachableMachineBlockElimPass())
163MACHINE_FUNCTION_PASS("verify", MachineVerifierPass())
164MACHINE_FUNCTION_PASS("verify<machine-trace-metrics>", MachineTraceMetricsVerifierPass())
165MACHINE_FUNCTION_PASS("xray-instrumentation", XRayInstrumentationPass())
166#undef MACHINE_FUNCTION_PASS
167
168#ifndef MACHINE_FUNCTION_PASS_WITH_PARAMS
169#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
170 PARAMS)
171#endif
172
173MACHINE_FUNCTION_PASS_WITH_PARAMS(
174 "block-placement", "MachineBlockPlacementPass",
175 [](bool AllowTailMerge) {
176 // Default is true.
177 return MachineBlockPlacementPass(AllowTailMerge);
178 },
179 parseMachineBlockPlacementPassOptions, "no-tail-merge;tail-merge")
180
181MACHINE_FUNCTION_PASS_WITH_PARAMS(
182 "branch-folder", "BranchFolderPass",
183 [](bool EnableTailMerge) { return BranchFolderPass(EnableTailMerge); },
184 [](StringRef Params) {
185 return parseSinglePassOption(Params, "enable-tail-merge",
186 "BranchFolderPass");
187 },
188 "enable-tail-merge")
189
190MACHINE_FUNCTION_PASS_WITH_PARAMS(
191 "live-debug-values", "LiveDebugValuesPass",
192 [](bool ShouldEmitDebugEntryValues) {
193 return LiveDebugValuesPass(ShouldEmitDebugEntryValues);
194 },
195 [](StringRef Params) {
196 return parseSinglePassOption(Params, "emit-debug-entry-values",
197 "LiveDebugValuesPass");
198 },
199 "emit-debug-entry-values")
200
201MACHINE_FUNCTION_PASS_WITH_PARAMS(
202 "machine-sink", "MachineSinkingPass",
203 [](bool EnableSinkAndFold) {
204 return MachineSinkingPass(EnableSinkAndFold);
205 },
206 parseMachineSinkingPassOptions, "enable-sink-fold")
207
208MACHINE_FUNCTION_PASS_WITH_PARAMS(
209 "regallocfast", "RegAllocFastPass",
210 [](RegAllocFastPass::Options Opts) { return RegAllocFastPass(Opts); },
211 [PB = this](StringRef Params) {
212 return parseRegAllocFastPassOptions(*PB, Params);
213 },
214 "filter=reg-filter;no-clear-vregs")
215
216// 'all' is the default filter.
217MACHINE_FUNCTION_PASS_WITH_PARAMS(
218 "greedy", "RAGreedyPass",
219 [](RAGreedyPass::Options Opts) { return RAGreedyPass(Opts); },
220 [PB = this](StringRef Params) {
221 return parseRegAllocGreedyFilterFunc(*PB, Params);
222 }, "reg-filter"
223)
224
225MACHINE_FUNCTION_PASS_WITH_PARAMS(
226 "virt-reg-rewriter", "VirtRegRewriterPass",
227 [](bool ClearVirtRegs) { return VirtRegRewriterPass(ClearVirtRegs); },
228 parseVirtRegRewriterPassOptions, "no-clear-vregs;clear-vregs")
229
230#undef MACHINE_FUNCTION_PASS_WITH_PARAMS
231
232// After a pass is converted to new pass manager, its entry should be moved from
233// dummy table to the normal one. For example, for a machine function pass,
234// DUMMY_MACHINE_FUNCTION_PASS to MACHINE_FUNCTION_PASS.
235
236#ifndef DUMMY_FUNCTION_PASS
237#define DUMMY_FUNCTION_PASS(NAME, PASS_NAME)
238#endif
239#undef DUMMY_FUNCTION_PASS
240
241#ifndef DUMMY_MACHINE_MODULE_PASS
242#define DUMMY_MACHINE_MODULE_PASS(NAME, PASS_NAME)
243#endif
244DUMMY_MACHINE_MODULE_PASS("machine-outliner", MachineOutlinerPass)
245DUMMY_MACHINE_MODULE_PASS("pseudo-probe-inserter", PseudoProbeInserterPass)
246#undef DUMMY_MACHINE_MODULE_PASS
247
248#ifndef DUMMY_MACHINE_FUNCTION_PASS
249#define DUMMY_MACHINE_FUNCTION_PASS(NAME, PASS_NAME)
250#endif
251DUMMY_MACHINE_FUNCTION_PASS("bbsections-prepare", BasicBlockSectionsPass)
252DUMMY_MACHINE_FUNCTION_PASS("bbsections-profile-reader", BasicBlockSectionsProfileReaderPass)
253DUMMY_MACHINE_FUNCTION_PASS("cfguard-longjmp", CFGuardLongjmpPass)
254DUMMY_MACHINE_FUNCTION_PASS("fs-profile-loader", MIRProfileLoaderNewPass)
255DUMMY_MACHINE_FUNCTION_PASS("lrshrink", LiveRangeShrinkPass)
256DUMMY_MACHINE_FUNCTION_PASS("machine-function-splitter", MachineFunctionSplitterPass)
257DUMMY_MACHINE_FUNCTION_PASS("machineinstr-printer", MachineFunctionPrinterPass)
258DUMMY_MACHINE_FUNCTION_PASS("mirfs-discriminators", MIRAddFSDiscriminatorsPass)
259DUMMY_MACHINE_FUNCTION_PASS("prolog-epilog-code", PrologEpilogCodeInserterPass)
260DUMMY_MACHINE_FUNCTION_PASS("ra-basic", RABasicPass)
261DUMMY_MACHINE_FUNCTION_PASS("ra-pbqp", RAPBQPPass)
262DUMMY_MACHINE_FUNCTION_PASS("regalloc", RegAllocPass)
263DUMMY_MACHINE_FUNCTION_PASS("regallocscoringpass", RegAllocScoringPass)
264DUMMY_MACHINE_FUNCTION_PASS("stackmap-liveness", StackMapLivenessPass)
265#undef DUMMY_MACHINE_FUNCTION_PASS
266