LLVM API Documentation
00001 //===-- R600Defines.h - R600 Helper Macros ----------------------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 /// \file 00009 //===----------------------------------------------------------------------===// 00010 00011 #ifndef LLVM_LIB_TARGET_R600_R600DEFINES_H 00012 #define LLVM_LIB_TARGET_R600_R600DEFINES_H 00013 00014 #include "llvm/MC/MCRegisterInfo.h" 00015 00016 // Operand Flags 00017 #define MO_FLAG_CLAMP (1 << 0) 00018 #define MO_FLAG_NEG (1 << 1) 00019 #define MO_FLAG_ABS (1 << 2) 00020 #define MO_FLAG_MASK (1 << 3) 00021 #define MO_FLAG_PUSH (1 << 4) 00022 #define MO_FLAG_NOT_LAST (1 << 5) 00023 #define MO_FLAG_LAST (1 << 6) 00024 #define NUM_MO_FLAGS 7 00025 00026 /// \brief Helper for getting the operand index for the instruction flags 00027 /// operand. 00028 #define GET_FLAG_OPERAND_IDX(Flags) (((Flags) >> 7) & 0x3) 00029 00030 namespace R600_InstFlag { 00031 enum TIF { 00032 TRANS_ONLY = (1 << 0), 00033 TEX = (1 << 1), 00034 REDUCTION = (1 << 2), 00035 FC = (1 << 3), 00036 TRIG = (1 << 4), 00037 OP3 = (1 << 5), 00038 VECTOR = (1 << 6), 00039 //FlagOperand bits 7, 8 00040 NATIVE_OPERANDS = (1 << 9), 00041 OP1 = (1 << 10), 00042 OP2 = (1 << 11), 00043 VTX_INST = (1 << 12), 00044 TEX_INST = (1 << 13), 00045 ALU_INST = (1 << 14), 00046 LDS_1A = (1 << 15), 00047 LDS_1A1D = (1 << 16), 00048 IS_EXPORT = (1 << 17), 00049 LDS_1A2D = (1 << 18) 00050 }; 00051 } 00052 00053 #define HAS_NATIVE_OPERANDS(Flags) ((Flags) & R600_InstFlag::NATIVE_OPERANDS) 00054 00055 /// \brief Defines for extracting register information from register encoding 00056 #define HW_REG_MASK 0x1ff 00057 #define HW_CHAN_SHIFT 9 00058 00059 #define GET_REG_CHAN(reg) ((reg) >> HW_CHAN_SHIFT) 00060 #define GET_REG_INDEX(reg) ((reg) & HW_REG_MASK) 00061 00062 #define IS_VTX(desc) ((desc).TSFlags & R600_InstFlag::VTX_INST) 00063 #define IS_TEX(desc) ((desc).TSFlags & R600_InstFlag::TEX_INST) 00064 00065 namespace OpName { 00066 00067 enum VecOps { 00068 UPDATE_EXEC_MASK_X, 00069 UPDATE_PREDICATE_X, 00070 WRITE_X, 00071 OMOD_X, 00072 DST_REL_X, 00073 CLAMP_X, 00074 SRC0_X, 00075 SRC0_NEG_X, 00076 SRC0_REL_X, 00077 SRC0_ABS_X, 00078 SRC0_SEL_X, 00079 SRC1_X, 00080 SRC1_NEG_X, 00081 SRC1_REL_X, 00082 SRC1_ABS_X, 00083 SRC1_SEL_X, 00084 PRED_SEL_X, 00085 UPDATE_EXEC_MASK_Y, 00086 UPDATE_PREDICATE_Y, 00087 WRITE_Y, 00088 OMOD_Y, 00089 DST_REL_Y, 00090 CLAMP_Y, 00091 SRC0_Y, 00092 SRC0_NEG_Y, 00093 SRC0_REL_Y, 00094 SRC0_ABS_Y, 00095 SRC0_SEL_Y, 00096 SRC1_Y, 00097 SRC1_NEG_Y, 00098 SRC1_REL_Y, 00099 SRC1_ABS_Y, 00100 SRC1_SEL_Y, 00101 PRED_SEL_Y, 00102 UPDATE_EXEC_MASK_Z, 00103 UPDATE_PREDICATE_Z, 00104 WRITE_Z, 00105 OMOD_Z, 00106 DST_REL_Z, 00107 CLAMP_Z, 00108 SRC0_Z, 00109 SRC0_NEG_Z, 00110 SRC0_REL_Z, 00111 SRC0_ABS_Z, 00112 SRC0_SEL_Z, 00113 SRC1_Z, 00114 SRC1_NEG_Z, 00115 SRC1_REL_Z, 00116 SRC1_ABS_Z, 00117 SRC1_SEL_Z, 00118 PRED_SEL_Z, 00119 UPDATE_EXEC_MASK_W, 00120 UPDATE_PREDICATE_W, 00121 WRITE_W, 00122 OMOD_W, 00123 DST_REL_W, 00124 CLAMP_W, 00125 SRC0_W, 00126 SRC0_NEG_W, 00127 SRC0_REL_W, 00128 SRC0_ABS_W, 00129 SRC0_SEL_W, 00130 SRC1_W, 00131 SRC1_NEG_W, 00132 SRC1_REL_W, 00133 SRC1_ABS_W, 00134 SRC1_SEL_W, 00135 PRED_SEL_W, 00136 IMM_0, 00137 IMM_1, 00138 VEC_COUNT 00139 }; 00140 00141 } 00142 00143 //===----------------------------------------------------------------------===// 00144 // Config register definitions 00145 //===----------------------------------------------------------------------===// 00146 00147 #define R_02880C_DB_SHADER_CONTROL 0x02880C 00148 #define S_02880C_KILL_ENABLE(x) (((x) & 0x1) << 6) 00149 00150 // These fields are the same for all shader types and families. 00151 #define S_NUM_GPRS(x) (((x) & 0xFF) << 0) 00152 #define S_STACK_SIZE(x) (((x) & 0xFF) << 8) 00153 //===----------------------------------------------------------------------===// 00154 // R600, R700 Registers 00155 //===----------------------------------------------------------------------===// 00156 00157 #define R_028850_SQ_PGM_RESOURCES_PS 0x028850 00158 #define R_028868_SQ_PGM_RESOURCES_VS 0x028868 00159 00160 //===----------------------------------------------------------------------===// 00161 // Evergreen, Northern Islands Registers 00162 //===----------------------------------------------------------------------===// 00163 00164 #define R_028844_SQ_PGM_RESOURCES_PS 0x028844 00165 #define R_028860_SQ_PGM_RESOURCES_VS 0x028860 00166 #define R_028878_SQ_PGM_RESOURCES_GS 0x028878 00167 #define R_0288D4_SQ_PGM_RESOURCES_LS 0x0288d4 00168 00169 #define R_0288E8_SQ_LDS_ALLOC 0x0288E8 00170 00171 #endif