LLVM  8.0.1
AMDGPU.h
Go to the documentation of this file.
1 //===-- AMDGPU.h - MachineFunction passes hw codegen --------------*- C++ -*-=//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 /// \file
9 //===----------------------------------------------------------------------===//
10 
11 #ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPU_H
12 #define LLVM_LIB_TARGET_AMDGPU_AMDGPU_H
13 
15 
16 namespace llvm {
17 
18 class AMDGPUTargetMachine;
19 class FunctionPass;
20 class GCNTargetMachine;
21 class ModulePass;
22 class Pass;
23 class Target;
24 class TargetMachine;
25 class TargetOptions;
26 class PassRegistry;
27 class Module;
28 
29 // R600 Passes
30 FunctionPass *createR600VectorRegMerger();
31 FunctionPass *createR600ExpandSpecialInstrsPass();
32 FunctionPass *createR600EmitClauseMarkers();
33 FunctionPass *createR600ClauseMergePass();
34 FunctionPass *createR600Packetizer();
35 FunctionPass *createR600ControlFlowFinalizer();
36 FunctionPass *createAMDGPUCFGStructurizerPass();
37 FunctionPass *createR600ISelDag(TargetMachine *TM, CodeGenOpt::Level OptLevel);
38 
39 // SI Passes
40 FunctionPass *createGCNDPPCombinePass();
41 FunctionPass *createSIAnnotateControlFlowPass();
42 FunctionPass *createSIFoldOperandsPass();
43 FunctionPass *createSIPeepholeSDWAPass();
44 FunctionPass *createSILowerI1CopiesPass();
45 FunctionPass *createSIFixupVectorISelPass();
46 FunctionPass *createSIAddIMGInitPass();
47 FunctionPass *createSIShrinkInstructionsPass();
48 FunctionPass *createSILoadStoreOptimizerPass();
49 FunctionPass *createSIWholeQuadModePass();
52 FunctionPass *createSIFixSGPRCopiesPass();
53 FunctionPass *createSIMemoryLegalizerPass();
54 FunctionPass *createSIDebuggerInsertNopsPass();
55 FunctionPass *createSIInsertWaitcntsPass();
56 FunctionPass *createSIFixWWMLivenessPass();
57 FunctionPass *createSIFormMemoryClausesPass();
58 FunctionPass *createAMDGPUSimplifyLibCallsPass(const TargetOptions &);
59 FunctionPass *createAMDGPUUseNativeCallsPass();
60 FunctionPass *createAMDGPUCodeGenPreparePass();
63 FunctionPass *createSIModeRegisterPass();
64 
65 void initializeAMDGPUDAGToDAGISelPass(PassRegistry&);
66 
69 
70 void initializeAMDGPUAlwaysInlinePass(PassRegistry&);
71 
75 
76 FunctionPass *createAMDGPUAtomicOptimizerPass();
77 void initializeAMDGPUAtomicOptimizerPass(PassRegistry &);
78 extern char &AMDGPUAtomicOptimizerID;
79 
81 void initializeAMDGPULowerIntrinsicsPass(PassRegistry &);
82 extern char &AMDGPULowerIntrinsicsID;
83 
85 void initializeAMDGPUFixFunctionBitcastsPass(PassRegistry &);
86 extern char &AMDGPUFixFunctionBitcastsID;
87 
89 void initializeAMDGPULowerKernelArgumentsPass(PassRegistry &);
90 extern char &AMDGPULowerKernelArgumentsID;
91 
95 
96 void initializeAMDGPURewriteOutArgumentsPass(PassRegistry &);
97 extern char &AMDGPURewriteOutArgumentsID;
98 
99 void initializeGCNDPPCombinePass(PassRegistry &);
100 extern char &GCNDPPCombineID;
101 
102 void initializeR600ClauseMergePassPass(PassRegistry &);
103 extern char &R600ClauseMergePassID;
104 
105 void initializeR600ControlFlowFinalizerPass(PassRegistry &);
106 extern char &R600ControlFlowFinalizerID;
107 
108 void initializeR600ExpandSpecialInstrsPassPass(PassRegistry &);
109 extern char &R600ExpandSpecialInstrsPassID;
110 
111 void initializeR600VectorRegMergerPass(PassRegistry &);
112 extern char &R600VectorRegMergerID;
113 
114 void initializeR600PacketizerPass(PassRegistry &);
115 extern char &R600PacketizerID;
116 
117 void initializeSIFoldOperandsPass(PassRegistry &);
118 extern char &SIFoldOperandsID;
119 
120 void initializeSIPeepholeSDWAPass(PassRegistry &);
121 extern char &SIPeepholeSDWAID;
122 
123 void initializeSIShrinkInstructionsPass(PassRegistry&);
124 extern char &SIShrinkInstructionsID;
125 
126 void initializeSIFixSGPRCopiesPass(PassRegistry &);
127 extern char &SIFixSGPRCopiesID;
128 
129 void initializeSIFixVGPRCopiesPass(PassRegistry &);
130 extern char &SIFixVGPRCopiesID;
131 
132 void initializeSIFixupVectorISelPass(PassRegistry &);
133 extern char &SIFixupVectorISelID;
134 
135 void initializeSILowerI1CopiesPass(PassRegistry &);
136 extern char &SILowerI1CopiesID;
137 
138 void initializeSILoadStoreOptimizerPass(PassRegistry &);
139 extern char &SILoadStoreOptimizerID;
140 
141 void initializeSIWholeQuadModePass(PassRegistry &);
142 extern char &SIWholeQuadModeID;
143 
144 void initializeSILowerControlFlowPass(PassRegistry &);
145 extern char &SILowerControlFlowID;
146 
147 void initializeSIInsertSkipsPass(PassRegistry &);
148 extern char &SIInsertSkipsPassID;
149 
150 void initializeSIOptimizeExecMaskingPass(PassRegistry &);
151 extern char &SIOptimizeExecMaskingID;
152 
153 void initializeSIFixWWMLivenessPass(PassRegistry &);
154 extern char &SIFixWWMLivenessID;
155 
156 void initializeAMDGPUSimplifyLibCallsPass(PassRegistry &);
157 extern char &AMDGPUSimplifyLibCallsID;
158 
159 void initializeAMDGPUUseNativeCallsPass(PassRegistry &);
160 extern char &AMDGPUUseNativeCallsID;
161 
162 void initializeSIAddIMGInitPass(PassRegistry &);
163 extern char &SIAddIMGInitID;
164 
165 void initializeAMDGPUPerfHintAnalysisPass(PassRegistry &);
166 extern char &AMDGPUPerfHintAnalysisID;
167 
168 // Passes common to R600 and SI
169 FunctionPass *createAMDGPUPromoteAlloca();
170 void initializeAMDGPUPromoteAllocaPass(PassRegistry&);
171 extern char &AMDGPUPromoteAllocaID;
172 
174 FunctionPass *createAMDGPUISelDag(
175  TargetMachine *TM = nullptr,
177 ModulePass *createAMDGPUAlwaysInlinePass(bool GlobalOpt = true);
179 FunctionPass *createAMDGPUAnnotateUniformValues();
180 
181 ModulePass* createAMDGPUUnifyMetadataPass();
182 void initializeAMDGPUUnifyMetadataPass(PassRegistry&);
183 extern char &AMDGPUUnifyMetadataID;
184 
185 void initializeSIOptimizeExecMaskingPreRAPass(PassRegistry&);
186 extern char &SIOptimizeExecMaskingPreRAID;
187 
190 
191 void initializeAMDGPUCodeGenPreparePass(PassRegistry&);
192 extern char &AMDGPUCodeGenPrepareID;
193 
194 void initializeSIAnnotateControlFlowPass(PassRegistry&);
195 extern char &SIAnnotateControlFlowPassID;
196 
197 void initializeSIMemoryLegalizerPass(PassRegistry&);
198 extern char &SIMemoryLegalizerID;
199 
200 void initializeSIDebuggerInsertNopsPass(PassRegistry&);
201 extern char &SIDebuggerInsertNopsID;
202 
203 void initializeSIModeRegisterPass(PassRegistry&);
204 extern char &SIModeRegisterID;
205 
206 void initializeSIInsertWaitcntsPass(PassRegistry&);
207 extern char &SIInsertWaitcntsID;
208 
209 void initializeSIFormMemoryClausesPass(PassRegistry&);
210 extern char &SIFormMemoryClausesID;
211 
214 
215 ImmutablePass *createAMDGPUAAWrapperPass();
216 void initializeAMDGPUAAWrapperPassPass(PassRegistry&);
217 ImmutablePass *createAMDGPUExternalAAWrapperPass();
218 void initializeAMDGPUExternalAAWrapperPass(PassRegistry&);
219 
220 void initializeAMDGPUArgumentUsageInfoPass(PassRegistry &);
221 
223 void initializeAMDGPUInlinerPass(PassRegistry&);
224 
228 
229 Target &getTheAMDGPUTarget();
230 Target &getTheGCNTarget();
231 
232 namespace AMDGPU {
239 };
240 }
241 
242 } // End namespace llvm
243 
244 /// OpenCL uses address spaces to differentiate between
245 /// various memory regions on the hardware. On the CPU
246 /// all of the address spaces point to the same memory,
247 /// however on the GPU, each address space points to
248 /// a separate piece of memory that is unique from other
249 /// memory locations.
250 namespace AMDGPUAS {
251  enum : unsigned {
252  // The maximum value for flat, generic, local, private, constant and region.
254 
255  FLAT_ADDRESS = 0, ///< Address space for flat memory.
256  GLOBAL_ADDRESS = 1, ///< Address space for global memory (RAT0, VTX0).
257  REGION_ADDRESS = 2, ///< Address space for region memory. (GDS)
258 
259  CONSTANT_ADDRESS = 4, ///< Address space for constant memory (VTX2)
260  LOCAL_ADDRESS = 3, ///< Address space for local memory.
261  PRIVATE_ADDRESS = 5, ///< Address space for private memory.
262 
263  CONSTANT_ADDRESS_32BIT = 6, ///< Address space for 32-bit constant memory
264 
265  /// Address space for direct addressible parameter memory (CONST0)
267  /// Address space for indirect addressible parameter memory (VTX1)
269 
270  // Do not re-order the CONSTANT_BUFFER_* enums. Several places depend on
271  // this order to be able to dynamically index a constant buffer, for
272  // example:
273  //
274  // ConstantBufferAS = CONSTANT_BUFFER_0 + CBIdx
275 
292 
293  // Some places use this if the address space can't be determined.
295  };
296 }
297 
298 #endif
char & SIFormMemoryClausesID
Pass * createAMDGPUStructurizeCFGPass()
Target & getTheGCNTarget()
The target for GCN GPUs.
void initializeAMDGPUDAGToDAGISelPass(PassRegistry &)
char & SIWholeQuadModeID
FunctionPass * createSIAnnotateControlFlowPass()
Create the annotation pass.
ModulePass * createAMDGPUAlwaysInlinePass(bool GlobalOpt=true)
Address space for direct addressible parameter memory (CONST0)
Definition: AMDGPU.h:266
FunctionPass * createSIPeepholeSDWAPass()
This class represents lattice values for constants.
Definition: AllocatorList.h:24
FunctionPass * createSIFormMemoryClausesPass()
char & SIShrinkInstructionsID
void initializeSIFixVGPRCopiesPass(PassRegistry &)
FunctionPass * createR600ISelDag(TargetMachine *TM, CodeGenOpt::Level OptLevel)
This pass converts a legalized DAG into a R600-specific.
void initializeSIInsertWaitcntsPass(PassRegistry &)
char & AMDGPULowerKernelAttributesID
void initializeSIFormMemoryClausesPass(PassRegistry &)
ModulePass * createR600OpenCLImageTypeLoweringPass()
void initializeAMDGPUAnnotateKernelFeaturesPass(PassRegistry &)
void initializeAMDGPUAtomicOptimizerPass(PassRegistry &)
char & SILoadStoreOptimizerID
Target & getTheAMDGPUTarget()
The target which supports all AMD GPUs.
char & SIPeepholeSDWAID
void initializeSIModeRegisterPass(PassRegistry &)
void initializeAMDGPUSimplifyLibCallsPass(PassRegistry &)
char & AMDGPULowerKernelArgumentsID
Address space for 32-bit constant memory.
Definition: AMDGPU.h:263
void initializeAMDGPULowerKernelAttributesPass(PassRegistry &)
void initializeR600ControlFlowFinalizerPass(PassRegistry &)
void initializeAMDGPUAnnotateUniformValuesPass(PassRegistry &)
Address space for private memory.
Definition: AMDGPU.h:261
char & AMDGPUOpenCLEnqueuedBlockLoweringID
FunctionPass * createAMDGPUPromoteAlloca()
ModulePass * createAMDGPULowerKernelAttributesPass()
FunctionPass * createAMDGPUCodeGenPreparePass()
char & SIFixupVectorISelID
FunctionPass * createAMDGPUCFGStructurizerPass()
void initializeAMDGPUAAWrapperPassPass(PassRegistry &)
void initializeAMDGPUPromoteAllocaPass(PassRegistry &)
void initializeAMDGPULowerKernelArgumentsPass(PassRegistry &)
FunctionPass * createSIAddIMGInitPass()
FunctionPass * createSIMemoryLegalizerPass()
FunctionPass * createAMDGPUMachineCFGStructurizerPass()
FunctionPass * createSIInsertWaitcntsPass()
char & AMDGPUAtomicOptimizerID
char & AMDGPURewriteOutArgumentsID
Address space for constant memory (VTX2)
Definition: AMDGPU.h:259
Pass * createAMDGPUFunctionInliningPass()
char & AMDGPUUnifyMetadataID
Pass * createAMDGPUAnnotateKernelFeaturesPass()
void initializeAMDGPUCodeGenPreparePass(PassRegistry &)
ModulePass * createAMDGPUOpenCLEnqueuedBlockLoweringPass()
void initializeAMDGPUInlinerPass(PassRegistry &)
char & SIOptimizeExecMaskingPreRAID
char & R600ControlFlowFinalizerID
FunctionPass * createR600ExpandSpecialInstrsPass()
FunctionPass * createSIFixupVectorISelPass()
char & R600PacketizerID
FunctionPass * createSILowerI1CopiesPass()
void initializeSIOptimizeExecMaskingPass(PassRegistry &)
void initializeSIOptimizeExecMaskingPreRAPass(PassRegistry &)
void initializeR600ExpandSpecialInstrsPassPass(PassRegistry &)
void initializeSIFixSGPRCopiesPass(PassRegistry &)
void initializeAMDGPULowerIntrinsicsPass(PassRegistry &)
FunctionPass * createR600VectorRegMerger()
void initializeSIFixupVectorISelPass(PassRegistry &)
char & R600ExpandSpecialInstrsPassID
FunctionPass * createAMDGPURewriteOutArgumentsPass()
void initializeAMDGPUExternalAAWrapperPass(PassRegistry &)
FunctionPass * createAMDGPUISelDag(TargetMachine *TM=nullptr, CodeGenOpt::Level OptLevel=CodeGenOpt::Default)
This pass converts a legalized DAG into a AMDGPU-specific.
char & GCNDPPCombineID
FunctionPass * createSIOptimizeExecMaskingPreRAPass()
FunctionPass * createAMDGPULowerKernelArgumentsPass()
char & AMDGPUAnnotateUniformValuesPassID
FunctionPass * createSIDebuggerInsertNopsPass()
FunctionPass * createSIWholeQuadModePass()
FunctionPass * createSIFixControlFlowLiveIntervalsPass()
Address space for flat memory.
Definition: AMDGPU.h:255
char & AMDGPUUseNativeCallsID
FunctionPass * createGCNDPPCombinePass()
char & SIInsertSkipsPassID
void initializeSIPeepholeSDWAPass(PassRegistry &)
char & AMDGPUAnnotateKernelFeaturesID
char & AMDGPUPerfHintAnalysisID
Address space for indirect addressible parameter memory (VTX1)
Definition: AMDGPU.h:268
FunctionPass * createR600ControlFlowFinalizer()
Address space for local memory.
Definition: AMDGPU.h:260
void initializeSILowerControlFlowPass(PassRegistry &)
void initializeAMDGPUPerfHintAnalysisPass(PassRegistry &)
ModulePass * createAMDGPULowerIntrinsicsPass()
FunctionPass * createSIModeRegisterPass()
FunctionPass * createR600ClauseMergePass()
char & SILowerI1CopiesID
void initializeSIShrinkInstructionsPass(PassRegistry &)
Address space for global memory (RAT0, VTX0).
Definition: AMDGPU.h:256
void initializeAMDGPUUseNativeCallsPass(PassRegistry &)
void initializeSIAddIMGInitPass(PassRegistry &)
void initializeSIInsertSkipsPass(PassRegistry &)
void initializeR600PacketizerPass(PassRegistry &)
FunctionPass * createAMDGPUAnnotateUniformValues()
char & SIFixWWMLivenessID
char & SIOptimizeExecMaskingID
FunctionPass * createSIFixWWMLivenessPass()
char & SIInsertWaitcntsID
print lazy value Lazy Value Info Printer Pass
void initializeAMDGPUMachineCFGStructurizerPass(PassRegistry &)
void initializeAMDGPUFixFunctionBitcastsPass(PassRegistry &)
char & AMDGPUUnifyDivergentExitNodesID
void initializeSIFixWWMLivenessPass(PassRegistry &)
void initializeSIMemoryLegalizerPass(PassRegistry &)
void initializeSIWholeQuadModePass(PassRegistry &)
FunctionPass * createAMDGPUAtomicOptimizerPass()
void initializeR600VectorRegMergerPass(PassRegistry &)
char & SIMemoryLegalizerID
char & SIFixVGPRCopiesID
void initializeAMDGPURewriteOutArgumentsPass(PassRegistry &)
OpenCL uses address spaces to differentiate between various memory regions on the hardware...
Definition: AMDGPU.h:250
void initializeGCNDPPCombinePass(PassRegistry &)
ImmutablePass * createAMDGPUAAWrapperPass()
FunctionPass * createR600EmitClauseMarkers()
void initializeR600ClauseMergePassPass(PassRegistry &)
ModulePass * createAMDGPUFixFunctionBitcastsPass()
char & SIAnnotateControlFlowPassID
void initializeAMDGPUUnifyMetadataPass(PassRegistry &)
void initializeAMDGPUArgumentUsageInfoPass(PassRegistry &)
FunctionPass * createSIFixSGPRCopiesPass()
FunctionPass * createR600Packetizer()
void initializeSILoadStoreOptimizerPass(PassRegistry &)
char & SILowerControlFlowID
ModulePass * createAMDGPUUnifyMetadataPass()
void initializeSIAnnotateControlFlowPass(PassRegistry &)
char & SIModeRegisterID
char & AMDGPUSimplifyLibCallsID
void initializeSIFoldOperandsPass(PassRegistry &)
char & SIFoldOperandsID
FunctionPass * createSIShrinkInstructionsPass()
void initializeSIDebuggerInsertNopsPass(PassRegistry &)
FunctionPass * createSIFoldOperandsPass()
char & SIFixSGPRCopiesID
FunctionPass * createAMDGPUSimplifyLibCallsPass(const TargetOptions &)
char & AMDGPUMachineCFGStructurizerID
ImmutablePass * createAMDGPUExternalAAWrapperPass()
char & AMDGPULowerIntrinsicsID
FunctionPass * createSILoadStoreOptimizerPass()
FunctionPass * createAMDGPUUseNativeCallsPass()
Address space for region memory. (GDS)
Definition: AMDGPU.h:257
char & AMDGPUPromoteAllocaID
void initializeSILowerI1CopiesPass(PassRegistry &)
char & SIDebuggerInsertNopsID
void initializeAMDGPUUnifyDivergentExitNodesPass(PassRegistry &)
char & AMDGPUCodeGenPrepareID
char & AMDGPUFixFunctionBitcastsID
char & SIAddIMGInitID
void initializeAMDGPUAlwaysInlinePass(PassRegistry &)
void initializeAMDGPUOpenCLEnqueuedBlockLoweringPass(PassRegistry &)
char & R600ClauseMergePassID