AMDGPU.h revision 57e6b2d1f3de0bf459e96f7038e692d624f7e580
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 AMDGPU_H
12#define AMDGPU_H
13
14#include "llvm/Support/TargetRegistry.h"
15#include "llvm/Target/TargetMachine.h"
16
17namespace llvm {
18
19class AMDGPUInstrPrinter;
20class AMDGPUTargetMachine;
21class FunctionPass;
22class MCAsmInfo;
23class raw_ostream;
24class Target;
25class TargetMachine;
26
27// R600 Passes
28FunctionPass *createR600VectorRegMerger(TargetMachine &tm);
29FunctionPass *createR600TextureIntrinsicsReplacer();
30FunctionPass *createR600ExpandSpecialInstrsPass(TargetMachine &tm);
31FunctionPass *createR600EmitClauseMarkers(TargetMachine &tm);
32FunctionPass *createR600Packetizer(TargetMachine &tm);
33FunctionPass *createR600ControlFlowFinalizer(TargetMachine &tm);
34FunctionPass *createAMDGPUCFGStructurizerPass(TargetMachine &tm);
35
36// SI Passes
37FunctionPass *createSIAnnotateControlFlowPass();
38FunctionPass *createSILowerControlFlowPass(TargetMachine &tm);
39FunctionPass *createSICodeEmitterPass(formatted_raw_ostream &OS);
40FunctionPass *createSIInsertWaits(TargetMachine &tm);
41
42// Passes common to R600 and SI
43Pass *createAMDGPUStructurizeCFGPass();
44FunctionPass *createAMDGPUConvertToISAPass(TargetMachine &tm);
45FunctionPass *createAMDGPUIndirectAddressingPass(TargetMachine &tm);
46FunctionPass *createAMDGPUISelDag(TargetMachine &tm);
47
48/// \brief Creates an AMDGPU-specific Target Transformation Info pass.
49ImmutablePass *
50createAMDGPUTargetTransformInfoPass(const AMDGPUTargetMachine *TM);
51
52extern Target TheAMDGPUTarget;
53
54} // End namespace llvm
55
56namespace ShaderType {
57  enum Type {
58    PIXEL = 0,
59    VERTEX = 1,
60    GEOMETRY = 2,
61    COMPUTE = 3
62  };
63}
64
65/// OpenCL uses address spaces to differentiate between
66/// various memory regions on the hardware. On the CPU
67/// all of the address spaces point to the same memory,
68/// however on the GPU, each address space points to
69/// a seperate piece of memory that is unique from other
70/// memory locations.
71namespace AMDGPUAS {
72enum AddressSpaces {
73  PRIVATE_ADDRESS  = 0, ///< Address space for private memory.
74  GLOBAL_ADDRESS   = 1, ///< Address space for global memory (RAT0, VTX0).
75  CONSTANT_ADDRESS = 2, ///< Address space for constant memory
76  LOCAL_ADDRESS    = 3, ///< Address space for local memory.
77  REGION_ADDRESS   = 4, ///< Address space for region memory.
78  ADDRESS_NONE     = 5, ///< Address space for unknown memory.
79  PARAM_D_ADDRESS  = 6, ///< Address space for direct addressible parameter memory (CONST0)
80  PARAM_I_ADDRESS  = 7, ///< Address space for indirect addressible parameter memory (VTX1)
81
82  // Do not re-order the CONSTANT_BUFFER_* enums.  Several places depend on this
83  // order to be able to dynamically index a constant buffer, for example:
84  //
85  // ConstantBufferAS = CONSTANT_BUFFER_0 + CBIdx
86
87  CONSTANT_BUFFER_0 = 8,
88  CONSTANT_BUFFER_1 = 9,
89  CONSTANT_BUFFER_2 = 10,
90  CONSTANT_BUFFER_3 = 11,
91  CONSTANT_BUFFER_4 = 12,
92  CONSTANT_BUFFER_5 = 13,
93  CONSTANT_BUFFER_6 = 14,
94  CONSTANT_BUFFER_7 = 15,
95  CONSTANT_BUFFER_8 = 16,
96  CONSTANT_BUFFER_9 = 17,
97  CONSTANT_BUFFER_10 = 18,
98  CONSTANT_BUFFER_11 = 19,
99  CONSTANT_BUFFER_12 = 20,
100  CONSTANT_BUFFER_13 = 21,
101  CONSTANT_BUFFER_14 = 22,
102  CONSTANT_BUFFER_15 = 23,
103  LAST_ADDRESS     = 24
104};
105
106} // namespace AMDGPUAS
107
108#endif // AMDGPU_H
109