23 #include "llvm/IR/IntrinsicsAMDGPU.h" 24 #include "llvm/IR/IntrinsicsR600.h" 45 #define GET_INSTRINFO_NAMED_OPS 46 #define GET_INSTRMAP_INFO 47 #include "AMDGPUGenInstrInfo.inc" 48 #undef GET_INSTRMAP_INFO 49 #undef GET_INSTRINFO_NAMED_OPS 54 unsigned getBitMask(
unsigned Shift,
unsigned Width) {
55 return ((1 << Width) - 1) << Shift;
61 unsigned packBits(
unsigned Src,
unsigned Dst,
unsigned Shift,
unsigned Width) {
62 Dst &= ~(1 << Shift) & ~getBitMask(Shift, Width);
63 Dst |= (Src << Shift) & getBitMask(Shift, Width);
70 unsigned unpackBits(
unsigned Src,
unsigned Shift,
unsigned Width) {
71 return (Src & getBitMask(Shift, Width)) >> Shift;
75 unsigned getVmcntBitShiftLo() {
return 0; }
78 unsigned getVmcntBitWidthLo() {
return 4; }
81 unsigned getExpcntBitShift() {
return 4; }
84 unsigned getExpcntBitWidth() {
return 3; }
87 unsigned getLgkmcntBitShift() {
return 8; }
91 return (VersionMajor >= 10) ? 6 : 4;
95 unsigned getVmcntBitShiftHi() {
return 14; }
98 unsigned getVmcntBitWidthHi() {
return 2; }
106 #define GET_MIMGBaseOpcodesTable_IMPL 107 #define GET_MIMGDimInfoTable_IMPL 108 #define GET_MIMGInfoTable_IMPL 109 #define GET_MIMGLZMappingTable_IMPL 110 #define GET_MIMGMIPMappingTable_IMPL 111 #include "AMDGPUGenSearchableTables.inc" 114 unsigned VDataDwords,
unsigned VAddrDwords) {
115 const MIMGInfo *
Info = getMIMGOpcodeHelper(BaseOpcode, MIMGEncoding,
116 VDataDwords, VAddrDwords);
117 return Info ? Info->
Opcode : -1;
130 return NewInfo ? NewInfo->
Opcode : -1;
151 #define GET_MTBUFInfoTable_DECL 152 #define GET_MTBUFInfoTable_IMPL 153 #define GET_MUBUFInfoTable_DECL 154 #define GET_MUBUFInfoTable_IMPL 155 #include "AMDGPUGenSearchableTables.inc" 163 const MTBUFInfo *
Info = getMTBUFInfoFromBaseOpcodeAndElements(BaseOpc, Elements);
164 return Info ? Info->
Opcode : -1;
193 const MUBUFInfo *
Info = getMUBUFInfoFromBaseOpcodeAndElements(BaseOpc, Elements);
194 return Info ? Info->
Opcode : -1;
221 return getMCOpcodeGen(Opcode, static_cast<Subtarget>(Gen));
230 Stream << TargetTriple.getArchName() <<
'-' 231 << TargetTriple.getVendorName() <<
'-' 232 << TargetTriple.getOSName() <<
'-' 233 << TargetTriple.getEnvironmentName() <<
'-' 242 Stream <<
"+sram-ecc";
275 unsigned FlatWorkGroupSize) {
276 assert(FlatWorkGroupSize != 0);
283 return std::min(N, 16u);
291 unsigned FlatWorkGroupSize) {
307 unsigned FlatWorkGroupSize) {
322 unsigned FlatWorkGroupSize) {
329 if (Version.
Major >= 10)
331 if (Version.
Major >= 8)
342 if (Version.
Major >= 8)
352 if (Version.
Major >= 10)
354 if (Version.
Major >= 8)
363 if (Version.
Major >= 10)
382 if (Version.
Major >= 10)
383 return Addressable ? AddressableNumSGPRs : 108;
384 if (Version.
Major >= 8 && !Addressable)
385 AddressableNumSGPRs = 112;
390 return std::min(MaxNumSGPRs, AddressableNumSGPRs);
394 bool FlatScrUsed,
bool XNACKUsed) {
395 unsigned ExtraSGPRs = 0;
400 if (Version.
Major >= 10)
403 if (Version.
Major < 8) {
431 bool IsWave32 = EnableWavefrontSize32 ?
432 *EnableWavefrontSize32 :
434 return IsWave32 ? 8 : 4;
457 unsigned MinNumVGPRs =
469 return std::min(MaxNumVGPRs, AddressableNumVGPRs);
486 memset(&Header, 0,
sizeof(Header));
507 if (Version.
Major >= 10) {
523 memset(&KD, 0,
sizeof(KD));
526 amdhsa::COMPUTE_PGM_RSRC1_FLOAT_DENORM_MODE_16_64,
529 amdhsa::COMPUTE_PGM_RSRC1_ENABLE_DX10_CLAMP, 1);
531 amdhsa::COMPUTE_PGM_RSRC1_ENABLE_IEEE_MODE, 1);
533 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_SGPR_WORKGROUP_ID_X, 1);
534 if (Version.
Major >= 10) {
536 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_WAVEFRONT_SIZE32,
539 amdhsa::COMPUTE_PGM_RSRC1_WGP_MODE,
542 amdhsa::COMPUTE_PGM_RSRC1_MEM_ORDERED, 1);
567 int Result = Default;
573 Ctx.
emitError(
"can't parse integer attribute " + Name);
582 std::pair<int, int> Default,
583 bool OnlyFirstRequired) {
589 std::pair<int, int> Ints = Default;
591 if (Strs.first.trim().getAsInteger(0, Ints.first)) {
592 Ctx.
emitError(
"can't parse first integer attribute " + Name);
595 if (Strs.second.trim().getAsInteger(0, Ints.second)) {
596 if (!OnlyFirstRequired || !Strs.second.trim().empty()) {
597 Ctx.
emitError(
"can't parse second integer attribute " + Name);
606 unsigned VmcntLo = (1 << getVmcntBitWidthLo()) - 1;
607 if (Version.
Major < 9)
610 unsigned VmcntHi = ((1 << getVmcntBitWidthHi()) - 1) << getVmcntBitWidthLo();
611 return VmcntLo | VmcntHi;
615 return (1 << getExpcntBitWidth()) - 1;
619 return (1 << getLgkmcntBitWidth(Version.
Major)) - 1;
623 unsigned VmcntLo = getBitMask(getVmcntBitShiftLo(), getVmcntBitWidthLo());
624 unsigned Expcnt = getBitMask(getExpcntBitShift(), getExpcntBitWidth());
625 unsigned Lgkmcnt = getBitMask(getLgkmcntBitShift(),
626 getLgkmcntBitWidth(Version.
Major));
627 unsigned Waitcnt = VmcntLo | Expcnt | Lgkmcnt;
628 if (Version.
Major < 9)
631 unsigned VmcntHi = getBitMask(getVmcntBitShiftHi(), getVmcntBitWidthHi());
632 return Waitcnt | VmcntHi;
637 unpackBits(Waitcnt, getVmcntBitShiftLo(), getVmcntBitWidthLo());
638 if (Version.
Major < 9)
642 unpackBits(Waitcnt, getVmcntBitShiftHi(), getVmcntBitWidthHi());
643 VmcntHi <<= getVmcntBitWidthLo();
644 return VmcntLo | VmcntHi;
648 return unpackBits(Waitcnt, getExpcntBitShift(), getExpcntBitWidth());
652 return unpackBits(Waitcnt, getLgkmcntBitShift(),
653 getLgkmcntBitWidth(Version.
Major));
657 unsigned &Vmcnt,
unsigned &Expcnt,
unsigned &Lgkmcnt) {
674 packBits(Vmcnt, Waitcnt, getVmcntBitShiftLo(), getVmcntBitWidthLo());
675 if (Version.
Major < 9)
678 Vmcnt >>= getVmcntBitWidthLo();
679 return packBits(Vmcnt, Waitcnt, getVmcntBitShiftHi(), getVmcntBitWidthHi());
684 return packBits(Expcnt, Waitcnt, getExpcntBitShift(), getExpcntBitWidth());
689 return packBits(Lgkmcnt, Waitcnt, getLgkmcntBitShift(),
690 getLgkmcntBitWidth(Version.
Major));
694 unsigned Vmcnt,
unsigned Expcnt,
unsigned Lgkmcnt) {
735 return 0 <= Id && isUInt<ID_WIDTH_>(
Id);
739 return 0 <= Offset && isUInt<OFFSET_WIDTH_>(
Offset);
743 return 0 <= (Width - 1) && isUInt<WIDTH_M1_WIDTH_>(Width - 1);
789 return 0 <= MsgId && isUInt<ID_WIDTH_>(MsgId);
801 for (
int i = F; i < L; ++i) {
812 return 0 <= OpId && isUInt<OP_WIDTH_>(OpId);
835 return 0 <= StreamId && isUInt<STREAM_ID_WIDTH_>(
StreamId);
963 const unsigned FirstSubReg = TRI->
getSubReg(Reg, 1);
964 return SGPRClass.
contains(FirstSubReg != 0 ? FirstSubReg : Reg) ||
970 if (*R == Reg1)
return true;
975 #define MAP_REG2REG \ 976 using namespace AMDGPU; \ 978 default: return Reg; \ 979 CASE_CI_VI(FLAT_SCR) \ 980 CASE_CI_VI(FLAT_SCR_LO) \ 981 CASE_CI_VI(FLAT_SCR_HI) \ 982 CASE_VI_GFX9_GFX10(TTMP0) \ 983 CASE_VI_GFX9_GFX10(TTMP1) \ 984 CASE_VI_GFX9_GFX10(TTMP2) \ 985 CASE_VI_GFX9_GFX10(TTMP3) \ 986 CASE_VI_GFX9_GFX10(TTMP4) \ 987 CASE_VI_GFX9_GFX10(TTMP5) \ 988 CASE_VI_GFX9_GFX10(TTMP6) \ 989 CASE_VI_GFX9_GFX10(TTMP7) \ 990 CASE_VI_GFX9_GFX10(TTMP8) \ 991 CASE_VI_GFX9_GFX10(TTMP9) \ 992 CASE_VI_GFX9_GFX10(TTMP10) \ 993 CASE_VI_GFX9_GFX10(TTMP11) \ 994 CASE_VI_GFX9_GFX10(TTMP12) \ 995 CASE_VI_GFX9_GFX10(TTMP13) \ 996 CASE_VI_GFX9_GFX10(TTMP14) \ 997 CASE_VI_GFX9_GFX10(TTMP15) \ 998 CASE_VI_GFX9_GFX10(TTMP0_TTMP1) \ 999 CASE_VI_GFX9_GFX10(TTMP2_TTMP3) \ 1000 CASE_VI_GFX9_GFX10(TTMP4_TTMP5) \ 1001 CASE_VI_GFX9_GFX10(TTMP6_TTMP7) \ 1002 CASE_VI_GFX9_GFX10(TTMP8_TTMP9) \ 1003 CASE_VI_GFX9_GFX10(TTMP10_TTMP11) \ 1004 CASE_VI_GFX9_GFX10(TTMP12_TTMP13) \ 1005 CASE_VI_GFX9_GFX10(TTMP14_TTMP15) \ 1006 CASE_VI_GFX9_GFX10(TTMP0_TTMP1_TTMP2_TTMP3) \ 1007 CASE_VI_GFX9_GFX10(TTMP4_TTMP5_TTMP6_TTMP7) \ 1008 CASE_VI_GFX9_GFX10(TTMP8_TTMP9_TTMP10_TTMP11) \ 1009 CASE_VI_GFX9_GFX10(TTMP12_TTMP13_TTMP14_TTMP15) \ 1010 CASE_VI_GFX9_GFX10(TTMP0_TTMP1_TTMP2_TTMP3_TTMP4_TTMP5_TTMP6_TTMP7) \ 1011 CASE_VI_GFX9_GFX10(TTMP4_TTMP5_TTMP6_TTMP7_TTMP8_TTMP9_TTMP10_TTMP11) \ 1012 CASE_VI_GFX9_GFX10(TTMP8_TTMP9_TTMP10_TTMP11_TTMP12_TTMP13_TTMP14_TTMP15) \ 1013 CASE_VI_GFX9_GFX10(TTMP0_TTMP1_TTMP2_TTMP3_TTMP4_TTMP5_TTMP6_TTMP7_TTMP8_TTMP9_TTMP10_TTMP11_TTMP12_TTMP13_TTMP14_TTMP15) \ 1016 #define CASE_CI_VI(node) \ 1017 assert(!isSI(STI)); \ 1018 case node: return isCI(STI) ? node##_ci : node##_vi; 1020 #define CASE_VI_GFX9_GFX10(node) \ 1021 case node: return (isGFX9(STI) || isGFX10(STI)) ? node##_gfx9_gfx10 : node##_vi; 1030 #undef CASE_VI_GFX9_GFX10 1032 #define CASE_CI_VI(node) case node##_ci: case node##_vi: return node; 1033 #define CASE_VI_GFX9_GFX10(node) case node##_vi: case node##_gfx9_gfx10: return node; 1040 #undef CASE_VI_GFX9_GFX10 1085 case AMDGPU::SGPR_32RegClassID:
1086 case AMDGPU::VGPR_32RegClassID:
1087 case AMDGPU::VRegOrLds_32RegClassID:
1088 case AMDGPU::AGPR_32RegClassID:
1089 case AMDGPU::VS_32RegClassID:
1090 case AMDGPU::AV_32RegClassID:
1091 case AMDGPU::SReg_32RegClassID:
1092 case AMDGPU::SReg_32_XM0RegClassID:
1093 case AMDGPU::SRegOrLds_32RegClassID:
1095 case AMDGPU::SGPR_64RegClassID:
1096 case AMDGPU::VS_64RegClassID:
1097 case AMDGPU::AV_64RegClassID:
1098 case AMDGPU::SReg_64RegClassID:
1099 case AMDGPU::VReg_64RegClassID:
1100 case AMDGPU::AReg_64RegClassID:
1101 case AMDGPU::SReg_64_XEXECRegClassID:
1103 case AMDGPU::SGPR_96RegClassID:
1104 case AMDGPU::SReg_96RegClassID:
1105 case AMDGPU::VReg_96RegClassID:
1107 case AMDGPU::SGPR_128RegClassID:
1108 case AMDGPU::SReg_128RegClassID:
1109 case AMDGPU::VReg_128RegClassID:
1110 case AMDGPU::AReg_128RegClassID:
1112 case AMDGPU::SGPR_160RegClassID:
1113 case AMDGPU::SReg_160RegClassID:
1114 case AMDGPU::VReg_160RegClassID:
1116 case AMDGPU::SReg_256RegClassID:
1117 case AMDGPU::VReg_256RegClassID:
1119 case AMDGPU::SReg_512RegClassID:
1120 case AMDGPU::VReg_512RegClassID:
1121 case AMDGPU::AReg_512RegClassID:
1123 case AMDGPU::SReg_1024RegClassID:
1124 case AMDGPU::VReg_1024RegClassID:
1125 case AMDGPU::AReg_1024RegClassID:
1144 if (Literal >= -16 && Literal <= 64)
1147 uint64_t Val =
static_cast<uint64_t
>(Literal);
1157 (Val == 0x3fc45f306dc9c882 && HasInv2Pi);
1161 if (Literal >= -16 && Literal <= 64)
1183 (Val == 0x3e22f983 && HasInv2Pi);
1190 if (Literal >= -16 && Literal <= 64)
1194 return Val == 0x3C00 ||
1209 int16_t Trunc =
static_cast<int16_t
>(Literal);
1212 if (!(Literal & 0xffff))
1215 int16_t Lo16 =
static_cast<int16_t
>(Literal);
1216 int16_t Hi16 =
static_cast<int16_t
>(Literal >> 16);
1253 return ByteOffset >> 2;
1259 isUInt<20>(EncodedOffset) :
isUInt<8>(EncodedOffset);
1275 if (Imm <= MaxImm + 64) {
1277 Overflow = Imm - MaxImm;
1292 Overflow = High -
Align;
1313 if (!IEEEAttr.empty())
1314 IEEE = IEEEAttr ==
"true";
1318 if (!DX10ClampAttr.
empty())
1319 DX10Clamp = DX10ClampAttr ==
"true";
1327 struct SourceOfDivergence {
1330 const SourceOfDivergence *lookupSourceOfDivergence(
unsigned Intr);
1332 #define GET_SourcesOfDivergence_IMPL 1333 #define GET_Gfx9BufferFormat_IMPL 1334 #define GET_Gfx10PlusBufferFormat_IMPL 1335 #include "AMDGPUGenSearchableTables.inc" 1340 return lookupSourceOfDivergence(IntrID);
1344 uint8_t NumComponents,
1348 ? getGfx10PlusBufferFormatInfo(BitsPerComp, NumComponents,
1350 : getGfx9BufferFormatInfo(BitsPerComp, NumComponents, NumFormat);
1355 return isGFX10(STI) ? getGfx10PlusBufferFormatInfo(Format)
1356 : getGfx9BufferFormatInfo(Format);
bool isValidMsgId(int64_t MsgId, const MCSubtargetInfo &STI, bool Strict)
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
unsigned mc2PseudoReg(unsigned Reg)
Convert hardware register Reg to a pseudo register.
Calling convention used for Mesa/AMDPAL hull shaders (= tessellation control shaders).
bool hasPackedD16(const MCSubtargetInfo &STI)
int64_t getHwregId(const StringRef Name)
uint64_t encodeHwreg(uint64_t Id, uint64_t Offset, uint64_t Width)
This class represents an incoming formal argument to a Function.
bool getMUBUFHasSrsrc(unsigned Opc)
LLVM_READONLY const MIMGInfo * getMIMGInfo(unsigned Opc)
static unsigned getLastSymbolicHwreg(const MCSubtargetInfo &STI)
This class represents lattice values for constants.
bool isValidHwregWidth(int64_t Width)
unsigned getMaxWorkGroupsPerCU(const MCSubtargetInfo *STI, unsigned FlatWorkGroupSize)
unsigned getExpcntBitMask(const IsaVersion &Version)
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
OSType getOS() const
getOS - Get the parsed operating system type of this triple.
Represents the counter values to wait for in an s_waitcnt instruction.
unsigned getVGPRAllocGranule(const MCSubtargetInfo *STI, Optional< bool > EnableWavefrontSize32)
Describe properties that are true of each instruction in the target description file.
Address space for global memory (RAT0, VTX0).
uint64_t encodeMsg(uint64_t MsgId, uint64_t OpId, uint64_t StreamId)
unsigned getRegBitWidth(unsigned RCID)
Get the size in bits of a register from the register class RC.
unsigned getMaxWavesPerCU(const MCSubtargetInfo *STI, unsigned FlatWorkGroupSize)
Instruction set architecture version.
unsigned decodeVmcnt(const IsaVersion &Version, unsigned Waitcnt)
#define S_00B848_WGP_MODE(x)
constexpr bool isInt< 16 >(int64_t x)
unsigned const TargetRegisterInfo * TRI
bool isInlinableLiteralV216(int32_t Literal, bool HasInv2Pi)
unsigned encodeVmcnt(const IsaVersion &Version, unsigned Waitcnt, unsigned Vmcnt)
Calling convention used for AMDPAL vertex shader if tessellation is in use.
bool isValidMsgOp(int64_t MsgId, int64_t OpId, bool Strict)
unsigned decodeExpcnt(const IsaVersion &Version, unsigned Waitcnt)
Calling convention used for Mesa/AMDPAL geometry shaders.
unsigned getSGPREncodingGranule(const MCSubtargetInfo *STI)
std::pair< int, int > getIntegerPairAttribute(const Function &F, StringRef Name, std::pair< int, int > Default, bool OnlyFirstRequired)
const Triple & getTargetTriple() const
bool isGlobalSegment(const GlobalValue *GV)
bool isInlinableLiteral16(int16_t Literal, bool HasInv2Pi)
unsigned getID() const
getID() - Return the register class ID number.
#define S_00B848_MEM_ORDERED(x)
uint32_t amd_kernel_code_version_major
uint64_t alignDown(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the largest uint64_t less than or equal to Value and is Skew mod Align.
uint32_t code_properties
Code properties.
unsigned getWavesPerWorkGroup(const MCSubtargetInfo *STI, unsigned FlatWorkGroupSize)
SPIR_KERNEL - Calling convention for SPIR kernel functions.
bool isRegIntersect(unsigned Reg0, unsigned Reg1, const MCRegisterInfo *TRI)
Is there any intersection between registers.
bool isStringAttribute() const
Return true if the attribute is a string (target-dependent) attribute.
const FeatureBitset & getFeatureBits() const
int64_t getMsgId(const StringRef Name)
AMD Kernel Code Object (amd_kernel_code_t).
unsigned getLocalMemorySize(const MCSubtargetInfo *STI)
unsigned getRegOperandSize(const MCRegisterInfo *MRI, const MCInstrDesc &Desc, unsigned OpNo)
Get size of register operand.
uint16_t amd_machine_version_major
This file contains the simple types necessary to represent the attributes associated with functions a...
int getMUBUFElements(unsigned Opc)
int getMTBUFOpcode(unsigned BaseOpc, unsigned Elements)
Address space for 32-bit constant memory.
StringRef getMsgOpName(int64_t MsgId, int64_t OpId)
bool hasFP64FP16Denormals(const Function &F) const
int getMaskedMIMGOp(unsigned Opc, unsigned NewChannels)
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
unsigned getMaxNumSGPRs(const MCSubtargetInfo *STI, unsigned WavesPerEU, bool Addressable)
bool hasCodeObjectV3(const MCSubtargetInfo *STI)
unsigned getTotalNumVGPRs(const MCSubtargetInfo *STI)
int getMCOpcode(uint16_t Opcode, unsigned Gen)
void emitError(unsigned LocCookie, const Twine &ErrorStr)
emitError - Emit an error message to the currently installed error handler with optional location inf...
uint8_t OperandType
Information about the type of the operand.
unsigned getMinWavesPerEU(const MCSubtargetInfo *STI)
uint8_t kernarg_segment_alignment
The maximum byte alignment of variables used by the kernel in the specified memory segment...
constexpr bool test(unsigned I) const
unsigned getMinFlatWorkGroupSize(const MCSubtargetInfo *STI)
bool splitMUBUFOffset(uint32_t Imm, uint32_t &SOffset, uint32_t &ImmOffset, const GCNSubtarget *Subtarget, uint32_t Align)
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
uint8_t group_segment_alignment
bool isGroupSegment(const GlobalValue *GV)
bool contains(MCRegister Reg) const
contains - Return true if the specified register is included in this register class.
unsigned encodeWaitcnt(const IsaVersion &Version, unsigned Vmcnt, unsigned Expcnt, unsigned Lgkmcnt)
Encodes Vmcnt, Expcnt and Lgkmcnt into Waitcnt for given isa Version.
unsigned getMaxNumVGPRs(const MCSubtargetInfo *STI, unsigned WavesPerEU)
bool isReadOnlySegment(const GlobalValue *GV)
unsigned encodeExpcnt(const IsaVersion &Version, unsigned Waitcnt, unsigned Expcnt)
LLVM_READONLY const MIMGBaseOpcodeInfo * getMIMGBaseOpcodeInfo(unsigned BaseOpcode)
AttributeList getAttributes() const
Return the attribute list for this Function.
uint16_t amd_machine_version_minor
unsigned decodeLgkmcnt(const IsaVersion &Version, unsigned Waitcnt)
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
uint32_t amd_kernel_code_version_minor
MCRegisterClass - Base class of TargetRegisterClass.
uint64_t compute_pgm_resource_registers
Shader program settings for CS.
Analysis containing CSE Info
unsigned short NumOperands
uint32_t FloatToBits(float Float)
This function takes a float and returns the bit equivalent 32-bit integer.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Calling convention used for Mesa/AMDPAL compute shaders.
bool isSISrcFPOperand(const MCInstrDesc &Desc, unsigned OpNo)
Is this floating-point operand?
static bool hasSMEMByteOffset(const MCSubtargetInfo &ST)
void decodeHwreg(unsigned Val, unsigned &Id, unsigned &Offset, unsigned &Width)
bool hasSRAMECC(const MCSubtargetInfo &STI)
bool getMTBUFHasVAddr(unsigned Opc)
int64_t getSMRDEncodedOffset(const MCSubtargetInfo &ST, int64_t ByteOffset)
bool isCompute(CallingConv::ID cc)
bool isInlinableLiteral64(int64_t Literal, bool HasInv2Pi)
Is this literal inlinable.
bool isSI(const MCSubtargetInfo &STI)
unsigned getMinNumSGPRs(const MCSubtargetInfo *STI, unsigned WavesPerEU)
constexpr bool isUInt< 8 >(uint64_t x)
unsigned const MachineRegisterInfo * MRI
bool getMUBUFHasSoffset(unsigned Opc)
unsigned getEUsPerCU(const MCSubtargetInfo *STI)
bool isGFX10(const MCSubtargetInfo &STI)
StringRef getHwreg(unsigned Id, const MCSubtargetInfo &STI)
This is an important class for using LLVM in a threaded context.
bool hasMIMG_R128(const MCSubtargetInfo &STI)
const char *const IdSymbolic[]
This file contains the declarations for the subclasses of Constant, which represent the different fla...
bool isEntryFunctionCC(CallingConv::ID CC)
int getMUBUFBaseOpcode(unsigned Opc)
uint8_t private_segment_alignment
bool isIntrinsicSourceOfDivergence(unsigned IntrID)
bool isValidHwreg(int64_t Id)
MCRegAliasIterator enumerates all registers aliasing Reg.
int getMUBUFOpcode(unsigned BaseOpc, unsigned Elements)
int getMTBUFElements(unsigned Opc)
unsigned getAddressSpace() const
Generation getGeneration() const
bool isValidHwregOffset(int64_t Offset)
MCRegister getSubReg(MCRegister Reg, unsigned Idx) const
Returns the physical register number of sub-register "Index" for physical register RegNo...
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
bool isLegalSMRDImmOffset(const MCSubtargetInfo &ST, int64_t ByteOffset)
bool isSISrcInlinableOperand(const MCInstrDesc &Desc, unsigned OpNo)
Does this opearnd support only inlinable literals?
#define AMDHSA_BITS_SET(DST, MSK, VAL)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char NumSGPRs[]
Key for Kernel::CodeProps::Metadata::mNumSGPRs.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Triple - Helper class for working with autoconf configuration names.
int getMIMGOpcode(unsigned BaseOpcode, unsigned MIMGEncoding, unsigned VDataDwords, unsigned VAddrDwords)
std::enable_if< std::numeric_limits< T >::is_signed, bool >::type getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
IsaVersion getIsaVersion(StringRef GPU)
unsigned getVGPREncodingGranule(const MCSubtargetInfo *STI, Optional< bool > EnableWavefrontSize32)
bool hasFP32Denormals(const Function &F) const
bool hasParamAttribute(unsigned ArgNo, Attribute::AttrKind Kind) const
Equivalent to hasAttribute(ArgNo + FirstArgIndex, Kind).
unsigned getWavefrontSize(const MCSubtargetInfo *STI)
Align max(MaybeAlign Lhs, Align Rhs)
unsigned getTotalNumSGPRs(const MCSubtargetInfo *STI)
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
Address space for local memory.
unsigned getAddressableNumSGPRs(const MCSubtargetInfo *STI)
Calling convention used for Mesa/AMDPAL pixel shaders.
Module.h This file contains the declarations for the Module class.
bool getMTBUFHasSoffset(unsigned Opc)
LLVM_NODISCARD std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
bool getMTBUFHasSrsrc(unsigned Opc)
bool isValidMsgStream(int64_t MsgId, int64_t OpId, int64_t StreamId, bool Strict)
uint16_t amd_machine_version_stepping
uint8_t wavefront_size
Wavefront size expressed as a power of two.
bool isArgPassedInSGPR(const Argument *A)
int64_t getMsgOpId(int64_t MsgId, const StringRef Name)
uint64_t DoubleToBits(double Double)
This function takes a double and returns the bit equivalent 64-bit integer.
unsigned getNumExtraSGPRs(const MCSubtargetInfo *STI, bool VCCUsed, bool FlatScrUsed)
bool msgSupportsStream(int64_t MsgId, int64_t OpId)
const GcnBufferFormatInfo * getGcnBufferFormatInfo(uint8_t BitsPerComp, uint8_t NumComponents, uint8_t NumFormat, const MCSubtargetInfo &STI)
bool isShader(CallingConv::ID cc)
const char *const OpSysSymbolic[]
unsigned getArgNo() const
Return the index of this formal argument in its containing function.
unsigned getMaxFlatWorkGroupSize(const MCSubtargetInfo *STI)
bool msgRequiresOp(int64_t MsgId)
constexpr char NumVGPRs[]
Key for Kernel::CodeProps::Metadata::mNumVGPRs.
unsigned getNumVGPRBlocks(const MCSubtargetInfo *STI, unsigned NumVGPRs, Optional< bool > EnableWavefrontSize32)
bool isGCN3Encoding(const MCSubtargetInfo &STI)
bool isCI(const MCSubtargetInfo &STI)
int getMTBUFBaseOpcode(unsigned Opc)
unsigned getAddressableNumVGPRs(const MCSubtargetInfo *STI)
unsigned getInitialPSInputAddr(const Function &F)
bool isGFX9(const MCSubtargetInfo &STI)
const char *const OpGsSymbolic[]
Provides AMDGPU specific target descriptions.
amdhsa::kernel_descriptor_t getDefaultAmdhsaKernelDescriptor(const MCSubtargetInfo *STI)
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
const Function * getParent() const
bool isVI(const MCSubtargetInfo &STI)
StringRef getValueAsString() const
Return the attribute's value as a string.
unsigned getNumSGPRBlocks(const MCSubtargetInfo *STI, unsigned NumSGPRs)
int16_t RegClass
This specifies the register class enumeration of the operand if the operand is a register.
bool hasXNACK(const MCSubtargetInfo &STI)
Calling convention used for Mesa vertex shaders, or AMDPAL last shader stage before rasterization (ve...
int getIntegerAttribute(const Function &F, StringRef Name, int Default)
Generic base class for all target subtargets.
unsigned getWaitcntBitMask(const IsaVersion &Version)
bool shouldEmitConstantsToTextSection(const Triple &TT)
constexpr bool isUInt< 16 >(uint64_t x)
int64_t kernel_code_entry_byte_offset
Byte offset (possibly negative) from start of amd_kernel_code_t object to kernel's entry point instru...
bool isSISrcOperand(const MCInstrDesc &Desc, unsigned OpNo)
Can this operand also contain immediate values?
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void decodeMsg(unsigned Val, uint16_t &MsgId, uint16_t &OpId, uint16_t &StreamId)
bool isInlinableLiteral32(int32_t Literal, bool HasInv2Pi)
const MCOperandInfo * OpInfo
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
unsigned getMCReg(unsigned Reg, const MCSubtargetInfo &STI)
If Reg is a pseudo reg, return the correct hardware register given STI otherwise return Reg...
This class implements an extremely fast bulk output stream that can only output to a stream...
uint16_t amd_machine_kind
unsigned getMinNumVGPRs(const MCSubtargetInfo *STI, unsigned WavesPerEU)
StringRef - Represent a constant reference to a string, i.e.
unsigned getLgkmcntBitMask(const IsaVersion &Version)
bool getMUBUFHasVAddr(unsigned Opc)
const MIMGBaseOpcodeInfo * getMIMGBaseOpcode(unsigned Opc)
bool isSGPR(unsigned Reg, const MCRegisterInfo *TRI)
Is Reg - scalar register.
unsigned getMaxWavesPerEU(const MCSubtargetInfo *STI, unsigned FlatWorkGroupSize)
void initDefaultAMDKernelCodeT(amd_kernel_code_t &Header, const MCSubtargetInfo *STI)
Calling convention for AMDGPU code object kernels.
StringRef getMsgName(int64_t MsgId)
unsigned getSGPRAllocGranule(const MCSubtargetInfo *STI)
unsigned encodeLgkmcnt(const IsaVersion &Version, unsigned Waitcnt, unsigned Lgkmcnt)
Address space for constant memory (VTX2).
constexpr uint32_t VersionMajor
HSA metadata major version.
void streamIsaVersion(const MCSubtargetInfo *STI, raw_ostream &Stream)
Streams isa version string for given subtarget STI into Stream.
const MCRegisterClass & getRegClass(unsigned i) const
Returns the register class associated with the enumeration value.
Calling convention used for AMDPAL shader stage before geometry shader if geometry is in use...
unsigned getVmcntBitMask(const IsaVersion &Version)
void decodeWaitcnt(const IsaVersion &Version, unsigned Waitcnt, unsigned &Vmcnt, unsigned &Expcnt, unsigned &Lgkmcnt)
Decodes Vmcnt, Expcnt and Lgkmcnt from given Waitcnt for given isa Version, and writes decoded values...