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
24MACHINE_FUNCTION_ANALYSIS("edge-bundles", EdgeBundlesAnalysis())
25MACHINE_FUNCTION_ANALYSIS("gisel-cse-analysis", GISelCSEAnalysis(TM))
26MACHINE_FUNCTION_ANALYSIS("gisel-value-tracking", GISelValueTrackingAnalysis())
27MACHINE_FUNCTION_ANALYSIS("livedebugvars", LiveDebugVariablesAnalysis())
28MACHINE_FUNCTION_ANALYSIS("live-intervals", LiveIntervalsAnalysis())
29MACHINE_FUNCTION_ANALYSIS("live-reg-matrix", LiveRegMatrixAnalysis())
30MACHINE_FUNCTION_ANALYSIS("live-stacks", LiveStacksAnalysis())
31MACHINE_FUNCTION_ANALYSIS("machine-block-freq", MachineBlockFrequencyAnalysis())
32MACHINE_FUNCTION_ANALYSIS("machine-block-hash", MachineBlockHashInfoAnalysis())
33MACHINE_FUNCTION_ANALYSIS("machine-branch-prob",
34 MachineBranchProbabilityAnalysis())
35MACHINE_FUNCTION_ANALYSIS("machine-cycles", MachineCycleAnalysis())
36MACHINE_FUNCTION_ANALYSIS("machine-dom-frontier", MachineDominanceFrontierAnalysis())
37MACHINE_FUNCTION_ANALYSIS("machine-dom-tree", MachineDominatorTreeAnalysis())
38MACHINE_FUNCTION_ANALYSIS("machine-loops", MachineLoopAnalysis())
39MACHINE_FUNCTION_ANALYSIS("machine-opt-remark-emitter",
40 MachineOptimizationRemarkEmitterAnalysis())
41MACHINE_FUNCTION_ANALYSIS("machine-post-dom-tree",
42 MachinePostDominatorTreeAnalysis())
43MACHINE_FUNCTION_ANALYSIS("machine-register-class-info",
44 MachineRegisterClassAnalysis())
45MACHINE_FUNCTION_ANALYSIS("machine-regions", MachineRegionInfoAnalysis())
46MACHINE_FUNCTION_ANALYSIS("machine-trace-metrics", MachineTraceMetricsAnalysis())
47MACHINE_FUNCTION_ANALYSIS("machine-uniformity", MachineUniformityAnalysis())
48MACHINE_FUNCTION_ANALYSIS("mir2vec-vocab", MIR2VecVocabAnalysis())
49MACHINE_FUNCTION_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
50MACHINE_FUNCTION_ANALYSIS("reaching-def", ReachingDefAnalysis())
51MACHINE_FUNCTION_ANALYSIS("regalloc-evict", RegAllocEvictionAdvisorAnalysis())
52MACHINE_FUNCTION_ANALYSIS("regalloc-priority", RegAllocPriorityAdvisorAnalysis())
53MACHINE_FUNCTION_ANALYSIS("slot-indexes", SlotIndexesAnalysis())
54MACHINE_FUNCTION_ANALYSIS("spill-code-placement", SpillPlacementAnalysis())
55MACHINE_FUNCTION_ANALYSIS("virtregmap", VirtRegMapAnalysis())
56// MACHINE_FUNCTION_ANALYSIS("gc-analysis",
57// GCMachineCodeAnalysisPass())
58#undef MACHINE_FUNCTION_ANALYSIS
59
60#ifndef MACHINE_FUNCTION_PASS
61#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS)
62#endif
63MACHINE_FUNCTION_PASS("block-placement-stats", MachineBlockPlacementStatsPass())
64MACHINE_FUNCTION_PASS("branch-relaxation", BranchRelaxationPass())
65MACHINE_FUNCTION_PASS("break-false-deps", BreakFalseDepsPass())
66MACHINE_FUNCTION_PASS("cfguard-longjmp", CFGuardLongjmpPass())
67MACHINE_FUNCTION_PASS("cfi-fixup", CFIFixupPass())
68MACHINE_FUNCTION_PASS("cfi-instr-inserter", CFIInstrInserterPass())
69MACHINE_FUNCTION_PASS("dead-mi-elimination", DeadMachineInstructionElimPass())
70MACHINE_FUNCTION_PASS("detect-dead-lanes", DetectDeadLanesPass())
71MACHINE_FUNCTION_PASS("dot-machine-cfg", MachineCFGPrinterPass())
72MACHINE_FUNCTION_PASS("early-ifcvt", EarlyIfConverterPass())
73MACHINE_FUNCTION_PASS("early-machinelicm", EarlyMachineLICMPass())
74MACHINE_FUNCTION_PASS("early-tailduplication", EarlyTailDuplicatePass())
75MACHINE_FUNCTION_PASS("eh-cont-guard-targets", EHContGuardTargetsPass())
76MACHINE_FUNCTION_PASS("execution-domain-fix", ExecutionDomainFixPass())
77MACHINE_FUNCTION_PASS("fentry-insert", FEntryInserterPass())
78MACHINE_FUNCTION_PASS("finalize-isel", FinalizeISelPass())
79MACHINE_FUNCTION_PASS("finalizebundle-test", FinalizeBundleTestPass())
80MACHINE_FUNCTION_PASS("fixup-statepoint-caller-saved", FixupStatepointCallerSavedPass())
81MACHINE_FUNCTION_PASS("funclet-layout", FuncletLayoutPass())
82MACHINE_FUNCTION_PASS("if-converter", IfConverterPass())
83MACHINE_FUNCTION_PASS("init-undef", InitUndefPass())
84MACHINE_FUNCTION_PASS("implicit-null-checks", ImplicitNullChecksPass())
85MACHINE_FUNCTION_PASS("instruction-select", InstructionSelectPass())
86MACHINE_FUNCTION_PASS("ir-translator", IRTranslatorPass(TM->getOptLevel()))
87MACHINE_FUNCTION_PASS("kcfi", MachineKCFIPass())
88MACHINE_FUNCTION_PASS("gc-empty-basic-blocks", GCEmptyBasicBlocksPass())
89MACHINE_FUNCTION_PASS("legalizer", LegalizerPass())
90MACHINE_FUNCTION_PASS("live-debug-values", LiveDebugValuesPass())
91MACHINE_FUNCTION_PASS("load-store-opt", LoadStoreOptPass())
92MACHINE_FUNCTION_PASS("localizer", LocalizerPass())
93MACHINE_FUNCTION_PASS("localstackalloc", LocalStackSlotAllocationPass())
94MACHINE_FUNCTION_PASS("machine-combiner", MachineCombinerPass())
95MACHINE_FUNCTION_PASS("machine-cp", MachineCopyPropagationPass())
96MACHINE_FUNCTION_PASS("machine-cse", MachineCSEPass())
97MACHINE_FUNCTION_PASS("machine-latecleanup", MachineLateInstrsCleanupPass())
98MACHINE_FUNCTION_PASS("machine-sanmd", MachineSanitizerBinaryMetadataPass())
99MACHINE_FUNCTION_PASS("machine-scheduler", MachineSchedulerPass(TM))
100MACHINE_FUNCTION_PASS("ssa-machine-scheduler", SSAMachineSchedulerPass(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<gisel-value-tracking-fpclass>",
114 GISelValueTrackingFPClassPrinterPass(errs()))
115MACHINE_FUNCTION_PASS("print<gisel-value-tracking>",
116 GISelValueTrackingPrinterPass(errs()))
117MACHINE_FUNCTION_PASS("print<livedebugvars>", LiveDebugVariablesPrinterPass(errs()))
118MACHINE_FUNCTION_PASS("print<live-intervals>", LiveIntervalsPrinterPass(errs()))
119MACHINE_FUNCTION_PASS("print<live-stacks>", LiveStacksPrinterPass(errs()))
120MACHINE_FUNCTION_PASS("print<machine-block-freq>",
121 MachineBlockFrequencyPrinterPass(errs()))
122MACHINE_FUNCTION_PASS("print<machine-block-hash>",
123 MachineBlockHashInfoPrinterPass(errs()))
124MACHINE_FUNCTION_PASS("print<machine-branch-prob>",
125 MachineBranchProbabilityPrinterPass(errs()))
126MACHINE_FUNCTION_PASS("print<machine-cycles>", MachineCycleInfoPrinterPass(errs()))
127MACHINE_FUNCTION_PASS("print<machine-dom-tree>",
128 MachineDominatorTreePrinterPass(errs()))
129MACHINE_FUNCTION_PASS("print<machine-loops>", MachineLoopPrinterPass(errs()))
130MACHINE_FUNCTION_PASS("print<machine-post-dom-tree>",
131 MachinePostDominatorTreePrinterPass(errs()))
132MACHINE_FUNCTION_PASS("print<machine-regions>",
133 MachineRegionInfoPrinterPass(errs()))
134MACHINE_FUNCTION_PASS("print<machine-uniformity>",
135 MachineUniformityPrinterPass(errs()))
136MACHINE_FUNCTION_PASS("print<mir2vec>", MIR2VecPrinterPass(errs()))
137MACHINE_FUNCTION_PASS("print<reaching-def>", ReachingDefPrinterPass(errs()))
138MACHINE_FUNCTION_PASS("print<slot-indexes>", SlotIndexesPrinterPass(errs()))
139MACHINE_FUNCTION_PASS("print<virtregmap>", VirtRegMapPrinterPass(errs()))
140MACHINE_FUNCTION_PASS("process-implicit-defs", ProcessImplicitDefsPass())
141MACHINE_FUNCTION_PASS("prolog-epilog", PrologEpilogInserterPass())
142MACHINE_FUNCTION_PASS("pseudo-probe-inserter", PseudoProbeInserterPass())
143MACHINE_FUNCTION_PASS("reg-bank-select", RegBankSelectPass())
144MACHINE_FUNCTION_PASS("reg-usage-collector", RegUsageInfoCollectorPass())
145MACHINE_FUNCTION_PASS("reg-usage-propagation", RegUsageInfoPropagationPass())
146MACHINE_FUNCTION_PASS("register-coalescer", RegisterCoalescerPass())
147MACHINE_FUNCTION_PASS("rename-independent-subregs", RenameIndependentSubregsPass())
148MACHINE_FUNCTION_PASS("remove-loads-into-fake-uses", RemoveLoadsIntoFakeUsesPass())
149MACHINE_FUNCTION_PASS("remove-redundant-debug-values", RemoveRedundantDebugValuesPass())
150MACHINE_FUNCTION_PASS("reset-machine-function", ResetMachineFunctionPass())
151MACHINE_FUNCTION_PASS("require-all-machine-function-properties",
152 RequireAllMachineFunctionPropertiesPass())
153MACHINE_FUNCTION_PASS("shrink-wrap", ShrinkWrapPass())
154MACHINE_FUNCTION_PASS("stack-coloring", StackColoringPass())
155MACHINE_FUNCTION_PASS("stack-frame-layout", StackFrameLayoutAnalysisPass())
156MACHINE_FUNCTION_PASS("stack-slot-coloring", StackSlotColoringPass())
157MACHINE_FUNCTION_PASS("static-data-splitter", StaticDataSplitterPass())
158MACHINE_FUNCTION_PASS("tailduplication", TailDuplicatePass())
159MACHINE_FUNCTION_PASS("trigger-crash-machine-function",
160 TriggerCrashMachineFunctionPass())
161MACHINE_FUNCTION_PASS("trigger-verifier-error", TriggerVerifierErrorPass())
162MACHINE_FUNCTION_PASS("two-address-instruction", TwoAddressInstructionPass())
163MACHINE_FUNCTION_PASS("unpack-mi-bundles", UnpackMachineBundlesPass())
164MACHINE_FUNCTION_PASS("unreachable-mbb-elimination",
165 UnreachableMachineBlockElimPass())
166MACHINE_FUNCTION_PASS("verify", MachineVerifierPass())
167MACHINE_FUNCTION_PASS("verify<machine-cycles>", MachineCycleInfoVerifierPass())
168MACHINE_FUNCTION_PASS("verify<machine-dom-tree>",
169 MachineDominatorTreeVerifierPass())
170MACHINE_FUNCTION_PASS("verify<machine-trace-metrics>", MachineTraceMetricsVerifierPass())
171MACHINE_FUNCTION_PASS("xray-instrumentation", XRayInstrumentationPass())
172#undef MACHINE_FUNCTION_PASS
173
174#ifndef MACHINE_FUNCTION_PASS_WITH_PARAMS
175#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
176 PARAMS)
177#endif
178
179MACHINE_FUNCTION_PASS_WITH_PARAMS(
180 "block-placement", "MachineBlockPlacementPass",
181 [](bool AllowTailMerge) {
182 // Default is true.
183 return MachineBlockPlacementPass(AllowTailMerge);
184 },
185 parseMachineBlockPlacementPassOptions, "no-tail-merge;tail-merge")
186
187MACHINE_FUNCTION_PASS_WITH_PARAMS(
188 "branch-folder", "BranchFolderPass",
189 [](bool EnableTailMerge) { return BranchFolderPass(EnableTailMerge); },
190 [](StringRef Params) {
191 return parseSinglePassOption(Params, "enable-tail-merge",
192 "BranchFolderPass");
193 },
194 "enable-tail-merge")
195
196MACHINE_FUNCTION_PASS_WITH_PARAMS(
197 "machine-sink", "MachineSinkingPass",
198 [](bool EnableSinkAndFold) {
199 return MachineSinkingPass(EnableSinkAndFold);
200 },
201 parseMachineSinkingPassOptions, "enable-sink-fold")
202
203MACHINE_FUNCTION_PASS_WITH_PARAMS(
204 "regallocfast", "RegAllocFastPass",
205 [](RegAllocFastPass::Options Opts) { return RegAllocFastPass(Opts); },
206 [PB = this](StringRef Params) {
207 return parseRegAllocFastPassOptions(*PB, Params);
208 },
209 "filter=reg-filter;no-clear-vregs")
210
211// 'all' is the default filter.
212MACHINE_FUNCTION_PASS_WITH_PARAMS(
213 "greedy", "RAGreedyPass",
214 [](RAGreedyPass::Options Opts) { return RAGreedyPass(Opts); },
215 [PB = this](StringRef Params) {
216 return parseRegAllocGreedyFilterFunc(*PB, Params);
217 }, "reg-filter"
218)
219
220MACHINE_FUNCTION_PASS_WITH_PARAMS(
221 "virt-reg-rewriter", "VirtRegRewriterPass",
222 [](bool ClearVirtRegs) { return VirtRegRewriterPass(ClearVirtRegs); },
223 parseVirtRegRewriterPassOptions, "no-clear-vregs;clear-vregs")
224
225#undef MACHINE_FUNCTION_PASS_WITH_PARAMS
226
227// After a pass is converted to new pass manager, its entry should be moved from
228// dummy table to the normal one. For example, for a machine function pass,
229// DUMMY_MACHINE_FUNCTION_PASS to MACHINE_FUNCTION_PASS.
230
231#ifndef DUMMY_FUNCTION_PASS
232#define DUMMY_FUNCTION_PASS(NAME, PASS_NAME)
233#endif
234#undef DUMMY_FUNCTION_PASS
235
236#ifndef DUMMY_MACHINE_MODULE_PASS
237#define DUMMY_MACHINE_MODULE_PASS(NAME, PASS_NAME)
238#endif
239DUMMY_MACHINE_MODULE_PASS("machine-outliner", MachineOutlinerPass)
240#undef DUMMY_MACHINE_MODULE_PASS
241
242#ifndef DUMMY_MACHINE_FUNCTION_PASS
243#define DUMMY_MACHINE_FUNCTION_PASS(NAME, PASS_NAME)
244#endif
245DUMMY_MACHINE_FUNCTION_PASS("bbsections-prepare", BasicBlockSectionsPass)
246DUMMY_MACHINE_FUNCTION_PASS("bbsections-profile-reader", BasicBlockSectionsProfileReaderPass)
247DUMMY_MACHINE_FUNCTION_PASS("fs-profile-loader", MIRProfileLoaderNewPass)
248DUMMY_MACHINE_FUNCTION_PASS("lrshrink", LiveRangeShrinkPass)
249DUMMY_MACHINE_FUNCTION_PASS("machineinstr-printer", MachineFunctionPrinterPass)
250DUMMY_MACHINE_FUNCTION_PASS("mirfs-discriminators", MIRAddFSDiscriminatorsPass)
251DUMMY_MACHINE_FUNCTION_PASS("prolog-epilog-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("stackmap-liveness", StackMapLivenessPass)
257#undef DUMMY_MACHINE_FUNCTION_PASS
258