1//===- AMDGPUPassRegistry.def - Registry of AMDGPU 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 part of the
10// AMDGPU backend.
11//
12//===----------------------------------------------------------------------===//
13
14// NOTE: NO INCLUDE GUARD DESIRED!
15
16#ifndef MODULE_PASS
17#define MODULE_PASS(NAME, CREATE_PASS)
18#endif
19MODULE_PASS("amdgpu-always-inline", AMDGPUAlwaysInlinePass())
20MODULE_PASS("amdgpu-export-kernel-runtime-handles", AMDGPUExportKernelRuntimeHandlesPass())
21MODULE_PASS("amdgpu-lower-buffer-fat-pointers",
22 AMDGPULowerBufferFatPointersPass(*this))
23MODULE_PASS("amdgpu-lower-intrinsics", AMDGPULowerIntrinsicsPass(*this))
24MODULE_PASS("amdgpu-lower-ctor-dtor", AMDGPUCtorDtorLoweringPass())
25MODULE_PASS("amdgpu-lower-module-lds", AMDGPULowerModuleLDSPass(*this))
26MODULE_PASS("amdgpu-perf-hint",
27 AMDGPUPerfHintAnalysisPass(
28 *static_cast<const GCNTargetMachine *>(this)))
29MODULE_PASS("amdgpu-preload-kernel-arguments", AMDGPUPreloadKernelArgumentsPass(*this))
30MODULE_PASS("amdgpu-printf-runtime-binding", AMDGPUPrintfRuntimeBindingPass())
31MODULE_PASS("amdgpu-remove-incompatible-functions", AMDGPURemoveIncompatibleFunctionsPass(*this))
32MODULE_PASS("amdgpu-lower-exec-sync", AMDGPULowerExecSyncPass())
33MODULE_PASS("amdgpu-sw-lower-lds", AMDGPUSwLowerLDSPass(*this))
34#undef MODULE_PASS
35
36#ifndef MODULE_PASS_WITH_PARAMS
37#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS)
38#endif
39MODULE_PASS_WITH_PARAMS(
40 "amdgpu-attributor", "AMDGPUAttributorPass",
41 [=](AMDGPUAttributorOptions Options) {
42 return AMDGPUAttributorPass(*this, Options);
43 },
44 parseAMDGPUAttributorPassOptions, "closed-world")
45#undef MODULE_PASS_WITH_PARAMS
46
47#ifndef FUNCTION_PASS
48#define FUNCTION_PASS(NAME, CREATE_PASS)
49#endif
50FUNCTION_PASS("amdgpu-annotate-uniform", AMDGPUAnnotateUniformValuesPass())
51FUNCTION_PASS("amdgpu-codegenprepare", AMDGPUCodeGenPreparePass(*this))
52FUNCTION_PASS("amdgpu-image-intrinsic-opt",
53 AMDGPUImageIntrinsicOptimizerPass(*this))
54FUNCTION_PASS("amdgpu-late-codegenprepare",
55 AMDGPULateCodeGenPreparePass(
56 *static_cast<const GCNTargetMachine *>(this)))
57FUNCTION_PASS("amdgpu-lower-kernel-arguments",
58 AMDGPULowerKernelArgumentsPass(*this))
59FUNCTION_PASS("amdgpu-lower-kernel-attributes",
60 AMDGPULowerKernelAttributesPass())
61FUNCTION_PASS("amdgpu-promote-alloca", AMDGPUPromoteAllocaPass(*this))
62FUNCTION_PASS("amdgpu-promote-alloca-to-vector",
63 AMDGPUPromoteAllocaToVectorPass(*this))
64FUNCTION_PASS("amdgpu-promote-kernel-arguments",
65 AMDGPUPromoteKernelArgumentsPass())
66FUNCTION_PASS("amdgpu-rewrite-undef-for-phi", AMDGPURewriteUndefForPHIPass())
67FUNCTION_PASS("amdgpu-simplifylib", AMDGPUSimplifyLibCallsPass())
68FUNCTION_PASS("amdgpu-unify-divergent-exit-nodes",
69 AMDGPUUnifyDivergentExitNodesPass())
70FUNCTION_PASS("amdgpu-usenative", AMDGPUUseNativeCallsPass())
71FUNCTION_PASS("si-annotate-control-flow", SIAnnotateControlFlowPass(*static_cast<const GCNTargetMachine *>(this)))
72FUNCTION_PASS("amdgpu-uniform-intrinsic-combine", AMDGPUUniformIntrinsicCombinePass())
73#undef FUNCTION_PASS
74
75#ifndef FUNCTION_ANALYSIS
76#define FUNCTION_ANALYSIS(NAME, CREATE_PASS)
77#endif
78
79#ifndef FUNCTION_ALIAS_ANALYSIS
80#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
81 FUNCTION_ANALYSIS(NAME, CREATE_PASS)
82#endif
83FUNCTION_ALIAS_ANALYSIS("amdgpu-aa", AMDGPUAA())
84#undef FUNCTION_ALIAS_ANALYSIS
85#undef FUNCTION_ANALYSIS
86
87#ifndef FUNCTION_PASS_WITH_PARAMS
88#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS)
89#endif
90FUNCTION_PASS_WITH_PARAMS(
91 "amdgpu-atomic-optimizer",
92 "AMDGPUAtomicOptimizerPass",
93 [=](ScanOptions Strategy) {
94 return AMDGPUAtomicOptimizerPass(*this, Strategy);
95 },
96 parseAMDGPUAtomicOptimizerStrategy, "strategy=dpp|iterative|none")
97#undef FUNCTION_PASS_WITH_PARAMS
98
99#ifndef MACHINE_FUNCTION_ANALYSIS
100#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS)
101#endif
102
103MACHINE_FUNCTION_ANALYSIS("amdgpu-resource-usage", AMDGPUResourceUsageAnalysis(*static_cast<const GCNTargetMachine *>(this)))
104#undef MACHINE_FUNCTION_ANALYSIS
105
106#ifndef MACHINE_FUNCTION_PASS
107#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS)
108#endif
109MACHINE_FUNCTION_PASS("amdgpu-insert-delay-alu", AMDGPUInsertDelayAluPass())
110MACHINE_FUNCTION_PASS("amdgpu-isel", AMDGPUISelDAGToDAGPass(*this))
111MACHINE_FUNCTION_PASS("amdgpu-lower-vgpr-encoding", AMDGPULowerVGPREncodingPass())
112MACHINE_FUNCTION_PASS("amdgpu-mark-last-scratch-load", AMDGPUMarkLastScratchLoadPass())
113MACHINE_FUNCTION_PASS("amdgpu-pre-ra-long-branch-reg", GCNPreRALongBranchRegPass())
114MACHINE_FUNCTION_PASS("amdgpu-reserve-wwm-regs", AMDGPUReserveWWMRegsPass())
115MACHINE_FUNCTION_PASS("amdgpu-rewrite-agpr-copy-mfma", AMDGPURewriteAGPRCopyMFMAPass())
116MACHINE_FUNCTION_PASS("amdgpu-rewrite-partial-reg-uses", GCNRewritePartialRegUsesPass())
117MACHINE_FUNCTION_PASS("amdgpu-set-wave-priority", AMDGPUSetWavePriorityPass())
118MACHINE_FUNCTION_PASS("amdgpu-pre-ra-optimizations", GCNPreRAOptimizationsPass())
119MACHINE_FUNCTION_PASS("amdgpu-preload-kern-arg-prolog", AMDGPUPreloadKernArgPrologPass())
120MACHINE_FUNCTION_PASS("amdgpu-prepare-agpr-alloc", AMDGPUPrepareAGPRAllocPass())
121MACHINE_FUNCTION_PASS("amdgpu-nsa-reassign", GCNNSAReassignPass())
122MACHINE_FUNCTION_PASS("amdgpu-wait-sgpr-hazards", AMDGPUWaitSGPRHazardsPass())
123MACHINE_FUNCTION_PASS("gcn-create-vopd", GCNCreateVOPDPass())
124MACHINE_FUNCTION_PASS("gcn-dpp-combine", GCNDPPCombinePass())
125MACHINE_FUNCTION_PASS("si-fix-sgpr-copies", SIFixSGPRCopiesPass())
126MACHINE_FUNCTION_PASS("si-fix-vgpr-copies", SIFixVGPRCopiesPass())
127MACHINE_FUNCTION_PASS("si-fold-operands", SIFoldOperandsPass());
128MACHINE_FUNCTION_PASS("si-form-memory-clauses", SIFormMemoryClausesPass())
129MACHINE_FUNCTION_PASS("si-i1-copies", SILowerI1CopiesPass())
130MACHINE_FUNCTION_PASS("si-insert-hard-clauses", SIInsertHardClausesPass())
131MACHINE_FUNCTION_PASS("si-insert-waitcnts", SIInsertWaitcntsPass())
132MACHINE_FUNCTION_PASS("si-late-branch-lowering", SILateBranchLoweringPass())
133MACHINE_FUNCTION_PASS("si-load-store-opt", SILoadStoreOptimizerPass())
134MACHINE_FUNCTION_PASS("si-lower-control-flow", SILowerControlFlowPass())
135MACHINE_FUNCTION_PASS("si-lower-sgpr-spills", SILowerSGPRSpillsPass())
136MACHINE_FUNCTION_PASS("si-lower-wwm-copies", SILowerWWMCopiesPass())
137MACHINE_FUNCTION_PASS("si-memory-legalizer", SIMemoryLegalizerPass())
138MACHINE_FUNCTION_PASS("si-mode-register", SIModeRegisterPass())
139MACHINE_FUNCTION_PASS("si-opt-vgpr-liverange", SIOptimizeVGPRLiveRangePass())
140MACHINE_FUNCTION_PASS("si-optimize-exec-masking", SIOptimizeExecMaskingPass())
141MACHINE_FUNCTION_PASS("si-optimize-exec-masking-pre-ra", SIOptimizeExecMaskingPreRAPass())
142MACHINE_FUNCTION_PASS("si-peephole-sdwa", SIPeepholeSDWAPass())
143MACHINE_FUNCTION_PASS("si-post-ra-bundler", SIPostRABundlerPass())
144MACHINE_FUNCTION_PASS("si-pre-allocate-wwm-regs", SIPreAllocateWWMRegsPass())
145MACHINE_FUNCTION_PASS("si-pre-emit-peephole", SIPreEmitPeepholePass())
146MACHINE_FUNCTION_PASS("si-shrink-instructions", SIShrinkInstructionsPass())
147MACHINE_FUNCTION_PASS("si-wqm", SIWholeQuadModePass())
148#undef MACHINE_FUNCTION_PASS
149
150#define DUMMY_MACHINE_FUNCTION_PASS(NAME, CREATE_PASS)
151// Global ISel passes
152DUMMY_MACHINE_FUNCTION_PASS("amdgpu-prelegalizer-combiner", AMDGPUPreLegalizerCombinerPass())
153DUMMY_MACHINE_FUNCTION_PASS("amdgpu-postlegalizer-combiner", AMDGPUPostLegalizerCombinerPass())
154DUMMY_MACHINE_FUNCTION_PASS("amdgpu-global-isel-divergence-lowering", AMDGPUGlobalISelDivergenceLoweringPass())
155DUMMY_MACHINE_FUNCTION_PASS("amdgpu-regbankselect", AMDGPURegBankSelectPass())
156DUMMY_MACHINE_FUNCTION_PASS("amdgpu-regbanklegalize", AMDGPURegBankLegalizePass())
157DUMMY_MACHINE_FUNCTION_PASS("amdgpu-regbank-combiner", AMDGPURegBankCombinerPass())
158
159#undef DUMMY_MACHINE_FUNCTION_PASS
160