Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 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 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 11 | #ifndef LLVM_LIB_TARGET_R600_AMDGPU_H |
| 12 | #define LLVM_LIB_TARGET_R600_AMDGPU_H |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 13 | |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 14 | #include "llvm/Support/TargetRegistry.h" |
| 15 | #include "llvm/Target/TargetMachine.h" |
| 16 | |
| 17 | namespace llvm { |
| 18 | |
Tom Stellard | a6c6e1b | 2013-06-07 20:37:48 +0000 | [diff] [blame] | 19 | class AMDGPUInstrPrinter; |
Tom Stellard | 880a80a | 2014-06-17 16:53:14 +0000 | [diff] [blame] | 20 | class AMDGPUSubtarget; |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 21 | class AMDGPUTargetMachine; |
Tom Stellard | a6c6e1b | 2013-06-07 20:37:48 +0000 | [diff] [blame] | 22 | class FunctionPass; |
| 23 | class MCAsmInfo; |
| 24 | class raw_ostream; |
| 25 | class Target; |
| 26 | class TargetMachine; |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 27 | |
| 28 | // R600 Passes |
Vincent Lejeune | dec1875 | 2013-06-05 21:38:04 +0000 | [diff] [blame] | 29 | FunctionPass *createR600VectorRegMerger(TargetMachine &tm); |
Tom Stellard | a6c6e1b | 2013-06-07 20:37:48 +0000 | [diff] [blame] | 30 | FunctionPass *createR600TextureIntrinsicsReplacer(); |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 31 | FunctionPass *createR600ExpandSpecialInstrsPass(TargetMachine &tm); |
Tom Stellard | 1de5582 | 2013-12-11 17:51:41 +0000 | [diff] [blame] | 32 | FunctionPass *createR600EmitClauseMarkers(); |
Vincent Lejeune | a4da6fb | 2013-10-01 19:32:58 +0000 | [diff] [blame] | 33 | FunctionPass *createR600ClauseMergePass(TargetMachine &tm); |
Vincent Lejeune | 147700b | 2013-04-30 00:14:27 +0000 | [diff] [blame] | 34 | FunctionPass *createR600Packetizer(TargetMachine &tm); |
Vincent Lejeune | bfaa63a6 | 2013-04-01 21:48:05 +0000 | [diff] [blame] | 35 | FunctionPass *createR600ControlFlowFinalizer(TargetMachine &tm); |
Tom Stellard | f2ba972 | 2013-12-11 17:51:47 +0000 | [diff] [blame] | 36 | FunctionPass *createAMDGPUCFGStructurizerPass(); |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 37 | |
| 38 | // SI Passes |
Tom Stellard | 9fa1791 | 2013-08-14 23:24:45 +0000 | [diff] [blame] | 39 | FunctionPass *createSITypeRewriter(); |
Tom Stellard | f879435 | 2012-12-19 22:10:31 +0000 | [diff] [blame] | 40 | FunctionPass *createSIAnnotateControlFlowPass(); |
Tom Stellard | 6596ba7 | 2014-11-21 22:06:37 +0000 | [diff] [blame^] | 41 | FunctionPass *createSIFoldOperandsPass(); |
Tom Stellard | 1bd8072 | 2014-04-30 15:31:33 +0000 | [diff] [blame] | 42 | FunctionPass *createSILowerI1CopiesPass(); |
Tom Stellard | 1aaad69 | 2014-07-21 16:55:33 +0000 | [diff] [blame] | 43 | FunctionPass *createSIShrinkInstructionsPass(); |
Matt Arsenault | 4103328 | 2014-10-10 22:01:59 +0000 | [diff] [blame] | 44 | FunctionPass *createSILoadStoreOptimizerPass(TargetMachine &tm); |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 45 | FunctionPass *createSILowerControlFlowPass(TargetMachine &tm); |
Tom Stellard | 2f7cdda | 2013-08-06 23:08:28 +0000 | [diff] [blame] | 46 | FunctionPass *createSIFixSGPRCopiesPass(TargetMachine &tm); |
Tom Stellard | b2de94e | 2014-07-02 20:53:48 +0000 | [diff] [blame] | 47 | FunctionPass *createSIFixSGPRLiveRangesPass(); |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 48 | FunctionPass *createSICodeEmitterPass(formatted_raw_ostream &OS); |
Tom Stellard | c4cabef | 2013-01-18 21:15:53 +0000 | [diff] [blame] | 49 | FunctionPass *createSIInsertWaits(TargetMachine &tm); |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 50 | |
Tom Stellard | 6596ba7 | 2014-11-21 22:06:37 +0000 | [diff] [blame^] | 51 | void initializeSIFoldOperandsPass(PassRegistry &); |
| 52 | extern char &SIFoldOperandsID; |
| 53 | |
Tom Stellard | 1bd8072 | 2014-04-30 15:31:33 +0000 | [diff] [blame] | 54 | void initializeSILowerI1CopiesPass(PassRegistry &); |
| 55 | extern char &SILowerI1CopiesID; |
| 56 | |
Matt Arsenault | 4103328 | 2014-10-10 22:01:59 +0000 | [diff] [blame] | 57 | void initializeSILoadStoreOptimizerPass(PassRegistry &); |
| 58 | extern char &SILoadStoreOptimizerID; |
| 59 | |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 60 | // Passes common to R600 and SI |
Tom Stellard | 880a80a | 2014-06-17 16:53:14 +0000 | [diff] [blame] | 61 | FunctionPass *createAMDGPUPromoteAlloca(const AMDGPUSubtarget &ST); |
Tom Stellard | f879435 | 2012-12-19 22:10:31 +0000 | [diff] [blame] | 62 | Pass *createAMDGPUStructurizeCFGPass(); |
Tom Stellard | a6c6e1b | 2013-06-07 20:37:48 +0000 | [diff] [blame] | 63 | FunctionPass *createAMDGPUISelDag(TargetMachine &tm); |
Tom Stellard | 5cbb53c | 2014-11-03 19:49:05 +0000 | [diff] [blame] | 64 | ModulePass *createAMDGPUAlwaysInlinePass(); |
Tom Stellard | a6c6e1b | 2013-06-07 20:37:48 +0000 | [diff] [blame] | 65 | |
Tom Stellard | 8b1e021 | 2013-07-27 00:01:07 +0000 | [diff] [blame] | 66 | /// \brief Creates an AMDGPU-specific Target Transformation Info pass. |
| 67 | ImmutablePass * |
| 68 | createAMDGPUTargetTransformInfoPass(const AMDGPUTargetMachine *TM); |
| 69 | |
Tom Stellard | b2de94e | 2014-07-02 20:53:48 +0000 | [diff] [blame] | 70 | void initializeSIFixSGPRLiveRangesPass(PassRegistry&); |
| 71 | extern char &SIFixSGPRLiveRangesID; |
| 72 | |
| 73 | |
Tom Stellard | a6c6e1b | 2013-06-07 20:37:48 +0000 | [diff] [blame] | 74 | extern Target TheAMDGPUTarget; |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 75 | |
Tom Stellard | 067c815 | 2014-07-21 14:01:14 +0000 | [diff] [blame] | 76 | namespace AMDGPU { |
| 77 | enum TargetIndex { |
| 78 | TI_CONSTDATA_START |
| 79 | }; |
| 80 | } |
| 81 | |
| 82 | #define END_OF_TEXT_LABEL_NAME "EndOfTextLabel" |
| 83 | |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 84 | } // End namespace llvm |
| 85 | |
| 86 | namespace ShaderType { |
| 87 | enum Type { |
| 88 | PIXEL = 0, |
| 89 | VERTEX = 1, |
| 90 | GEOMETRY = 2, |
| 91 | COMPUTE = 3 |
| 92 | }; |
| 93 | } |
| 94 | |
Tom Stellard | a6c6e1b | 2013-06-07 20:37:48 +0000 | [diff] [blame] | 95 | /// OpenCL uses address spaces to differentiate between |
| 96 | /// various memory regions on the hardware. On the CPU |
| 97 | /// all of the address spaces point to the same memory, |
| 98 | /// however on the GPU, each address space points to |
Alp Toker | cb40291 | 2014-01-24 17:20:08 +0000 | [diff] [blame] | 99 | /// a separate piece of memory that is unique from other |
Tom Stellard | a6c6e1b | 2013-06-07 20:37:48 +0000 | [diff] [blame] | 100 | /// memory locations. |
| 101 | namespace AMDGPUAS { |
| 102 | enum AddressSpaces { |
| 103 | PRIVATE_ADDRESS = 0, ///< Address space for private memory. |
| 104 | GLOBAL_ADDRESS = 1, ///< Address space for global memory (RAT0, VTX0). |
| 105 | CONSTANT_ADDRESS = 2, ///< Address space for constant memory |
| 106 | LOCAL_ADDRESS = 3, ///< Address space for local memory. |
Matt Arsenault | 46b51b7 | 2014-05-22 18:27:07 +0000 | [diff] [blame] | 107 | FLAT_ADDRESS = 4, ///< Address space for flat memory. |
| 108 | REGION_ADDRESS = 5, ///< Address space for region memory. |
Tom Stellard | a6c6e1b | 2013-06-07 20:37:48 +0000 | [diff] [blame] | 109 | PARAM_D_ADDRESS = 6, ///< Address space for direct addressible parameter memory (CONST0) |
| 110 | PARAM_I_ADDRESS = 7, ///< Address space for indirect addressible parameter memory (VTX1) |
Tom Stellard | 1e80309 | 2013-07-23 01:48:18 +0000 | [diff] [blame] | 111 | |
| 112 | // Do not re-order the CONSTANT_BUFFER_* enums. Several places depend on this |
| 113 | // order to be able to dynamically index a constant buffer, for example: |
| 114 | // |
| 115 | // ConstantBufferAS = CONSTANT_BUFFER_0 + CBIdx |
| 116 | |
Tom Stellard | a6c6e1b | 2013-06-07 20:37:48 +0000 | [diff] [blame] | 117 | CONSTANT_BUFFER_0 = 8, |
| 118 | CONSTANT_BUFFER_1 = 9, |
| 119 | CONSTANT_BUFFER_2 = 10, |
| 120 | CONSTANT_BUFFER_3 = 11, |
| 121 | CONSTANT_BUFFER_4 = 12, |
| 122 | CONSTANT_BUFFER_5 = 13, |
| 123 | CONSTANT_BUFFER_6 = 14, |
| 124 | CONSTANT_BUFFER_7 = 15, |
| 125 | CONSTANT_BUFFER_8 = 16, |
| 126 | CONSTANT_BUFFER_9 = 17, |
| 127 | CONSTANT_BUFFER_10 = 18, |
| 128 | CONSTANT_BUFFER_11 = 19, |
| 129 | CONSTANT_BUFFER_12 = 20, |
| 130 | CONSTANT_BUFFER_13 = 21, |
| 131 | CONSTANT_BUFFER_14 = 22, |
| 132 | CONSTANT_BUFFER_15 = 23, |
Matt Arsenault | 46b51b7 | 2014-05-22 18:27:07 +0000 | [diff] [blame] | 133 | ADDRESS_NONE = 24, ///< Address space for unknown memory. |
| 134 | LAST_ADDRESS = ADDRESS_NONE |
Tom Stellard | a6c6e1b | 2013-06-07 20:37:48 +0000 | [diff] [blame] | 135 | }; |
| 136 | |
| 137 | } // namespace AMDGPUAS |
| 138 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 139 | #endif |