87 std::unique_ptr<MCStreamer> &&Streamer) {
99 std::unique_ptr<MCStreamer> Streamer)
105 return "AMDGPU Assembly Printer";
128 HSAMetadataStream.
begin(M);
154 std::string ISAVersionString;
161 HSAMetadataStream.
end();
170 for (
auto i : PALMetadataMap) {
171 PALMetadataVector.push_back(i.first);
172 PALMetadataVector.push_back(i.second);
206 getAmdKernelCode(KernelCode, CurrentProgramInfo, *
MF);
225 auto &
Context = Streamer.getContext();
226 auto &ObjectFileInfo = *
Context.getObjectFileInfo();
227 auto &ReadOnlySection = *ObjectFileInfo.getReadOnlySection();
229 Streamer.PushSection();
230 Streamer.SwitchSection(&ReadOnlySection);
234 Streamer.EmitValueToAlignment(64, 0, 1, 0);
235 if (ReadOnlySection.getAlignment() < 64)
236 ReadOnlySection.setAlignment(64);
241 *
getSTI(), KernelName, getAmdhsaKernelDescriptor(*
MF, CurrentProgramInfo),
250 Streamer.PopSection();
302 CallGraphResourceInfo.clear();
311 void AMDGPUAsmPrinter::readPALMetadata(
Module &M) {
313 if (!NamedMD || !NamedMD->getNumOperands())
318 for (
unsigned I = 0,
E = Tuple->getNumOperands() & -2;
I !=
E;
I += 2) {
319 auto Key = mdconst::dyn_extract<ConstantInt>(Tuple->getOperand(
I));
320 auto Val = mdconst::dyn_extract<ConstantInt>(Tuple->getOperand(
I + 1));
323 PALMetadataMap[
Key->getZExtValue()] = Val->getZExtValue();
328 void AMDGPUAsmPrinter::emitCommonFunctionComments(
331 uint64_t ScratchSize,
342 uint16_t AMDGPUAsmPrinter::getAmdhsaKernelCodeProperties(
345 uint16_t KernelCodeProperties = 0;
348 KernelCodeProperties |=
349 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_PRIVATE_SEGMENT_BUFFER;
352 KernelCodeProperties |=
353 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_DISPATCH_PTR;
356 KernelCodeProperties |=
357 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_QUEUE_PTR;
360 KernelCodeProperties |=
361 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_KERNARG_SEGMENT_PTR;
364 KernelCodeProperties |=
365 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_DISPATCH_ID;
368 KernelCodeProperties |=
369 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_FLAT_SCRATCH_INIT;
372 return KernelCodeProperties;
379 memset(&KernelDescriptor, 0x0,
sizeof(KernelDescriptor));
391 return KernelDescriptor;
415 getSIProgramInfo(CurrentProgramInfo, MF);
417 auto I = CallGraphResourceInfo.insert(
418 std::make_pair(&MF.
getFunction(), SIFunctionResourceInfo()));
419 SIFunctionResourceInfo &Info =
I.first->second;
420 assert(
I.second &&
"should only be called once per function");
421 Info = analyzeResourceUsage(MF);
425 EmitPALMetadata(MF, CurrentProgramInfo);
427 EmitProgramInfoSI(MF, CurrentProgramInfo);
442 OutStreamer->emitRawComment(
" Function info:",
false);
443 SIFunctionResourceInfo &Info = CallGraphResourceInfo[&MF.
getFunction()];
444 emitCommonFunctionComments(
447 Info.PrivateSegmentSize,
448 getFunctionCodeSize(MF), MFI);
452 OutStreamer->emitRawComment(
" Kernel info:",
false);
453 emitCommonFunctionComments(CurrentProgramInfo.
NumVGPR,
456 getFunctionCodeSize(MF), MFI);
464 " bytes/workgroup (compile time only)",
false);
472 " NumSGPRsForWavesPerEU: " +
475 " NumVGPRsForWavesPerEU: " +
483 " DebuggerWavefrontPrivateSegmentOffsetSGPR: s" +
486 " DebuggerPrivateSegmentBufferSGPR: s" +
491 " COMPUTE_PGM_RSRC2:USER_SGPR: " +
494 " COMPUTE_PGM_RSRC2:TRAP_HANDLER: " +
497 " COMPUTE_PGM_RSRC2:TGID_X_EN: " +
500 " COMPUTE_PGM_RSRC2:TGID_Y_EN: " +
503 " COMPUTE_PGM_RSRC2:TGID_Z_EN: " +
506 " COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: " +
517 std::string Comment =
"\n";
520 Comment +=
" ; " +
HexLines[i] +
"\n";
531 uint64_t AMDGPUAsmPrinter::getFunctionCodeSize(
const MachineFunction &MF)
const {
535 uint64_t CodeSize = 0;
542 if (
MI.isDebugInstr())
556 if (!UseOp.isImplicit() || !TII.
isFLAT(*UseOp.getParent()))
566 UsesVCC, UsesFlatScratch);
569 AMDGPUAsmPrinter::SIFunctionResourceInfo AMDGPUAsmPrinter::analyzeResourceUsage(
571 SIFunctionResourceInfo Info;
580 Info.UsesFlatScratch = MRI.
isPhysRegUsed(AMDGPU::FLAT_SCR_LO) ||
593 Info.UsesFlatScratch =
false;
596 Info.HasDynamicallySizedStack = FrameInfo.hasVarSizedObjects();
597 Info.PrivateSegmentSize = FrameInfo.getStackSize();
599 Info.PrivateSegmentSize += FrameInfo.getMaxAlignment();
608 if (!FrameInfo.hasCalls() && !FrameInfo.hasTailCall()) {
609 MCPhysReg HighestVGPRReg = AMDGPU::NoRegister;
612 HighestVGPRReg =
Reg;
617 MCPhysReg HighestSGPRReg = AMDGPU::NoRegister;
620 HighestSGPRReg =
Reg;
627 Info.NumVGPR = HighestVGPRReg == AMDGPU::NoRegister ? 0 :
629 Info.NumExplicitSGPR = HighestSGPRReg == AMDGPU::NoRegister ? 0 :
635 int32_t MaxVGPR = -1;
636 int32_t MaxSGPR = -1;
637 uint64_t CalleeFrameSize = 0;
649 unsigned Reg = MO.getReg();
652 case AMDGPU::EXEC_LO:
653 case AMDGPU::EXEC_HI:
656 case AMDGPU::SRC_SHARED_BASE:
657 case AMDGPU::SRC_SHARED_LIMIT:
658 case AMDGPU::SRC_PRIVATE_BASE:
659 case AMDGPU::SRC_PRIVATE_LIMIT:
662 case AMDGPU::NoRegister:
672 case AMDGPU::FLAT_SCR:
673 case AMDGPU::FLAT_SCR_LO:
674 case AMDGPU::FLAT_SCR_HI:
677 case AMDGPU::XNACK_MASK:
678 case AMDGPU::XNACK_MASK_LO:
679 case AMDGPU::XNACK_MASK_HI:
694 if (AMDGPU::SReg_32RegClass.
contains(Reg)) {
696 "trap handler registers should not be used");
699 }
else if (AMDGPU::VGPR_32RegClass.
contains(Reg)) {
702 }
else if (AMDGPU::SReg_64RegClass.
contains(Reg)) {
704 "trap handler registers should not be used");
707 }
else if (AMDGPU::VReg_64RegClass.
contains(Reg)) {
710 }
else if (AMDGPU::VReg_96RegClass.
contains(Reg)) {
713 }
else if (AMDGPU::SReg_128RegClass.
contains(Reg)) {
715 "trap handler registers should not be used");
718 }
else if (AMDGPU::VReg_128RegClass.
contains(Reg)) {
721 }
else if (AMDGPU::SReg_256RegClass.
contains(Reg)) {
723 "trap handler registers should not be used");
726 }
else if (AMDGPU::VReg_256RegClass.
contains(Reg)) {
729 }
else if (AMDGPU::SReg_512RegClass.
contains(Reg)) {
731 "trap handler registers should not be used");
734 }
else if (AMDGPU::VReg_512RegClass.
contains(Reg)) {
741 int MaxUsed = HWReg + Width - 1;
743 MaxSGPR = MaxUsed > MaxSGPR ? MaxUsed : MaxSGPR;
745 MaxVGPR = MaxUsed > MaxVGPR ? MaxUsed : MaxVGPR;
763 ST.hasFlatAddressSpace());
764 MaxSGPR =
std::max(MaxSGPR, MaxSGPRGuess);
767 CalleeFrameSize =
std::max(CalleeFrameSize, UINT64_C(16384));
769 Info.UsesFlatScratch = ST.hasFlatAddressSpace();
770 Info.HasDynamicallySizedStack =
true;
774 auto I = CallGraphResourceInfo.find(Callee);
775 assert(
I != CallGraphResourceInfo.end() &&
776 "callee should have been handled before caller");
778 MaxSGPR =
std::max(
I->second.NumExplicitSGPR - 1, MaxSGPR);
779 MaxVGPR =
std::max(
I->second.NumVGPR - 1, MaxVGPR);
781 =
std::max(
I->second.PrivateSegmentSize, CalleeFrameSize);
782 Info.UsesVCC |=
I->second.UsesVCC;
783 Info.UsesFlatScratch |=
I->second.UsesFlatScratch;
784 Info.HasDynamicallySizedStack |=
I->second.HasDynamicallySizedStack;
785 Info.HasRecursion |=
I->second.HasRecursion;
789 Info.HasRecursion =
true;
794 Info.NumExplicitSGPR = MaxSGPR + 1;
795 Info.NumVGPR = MaxVGPR + 1;
796 Info.PrivateSegmentSize += CalleeFrameSize;
801 void AMDGPUAsmPrinter::getSIProgramInfo(
SIProgramInfo &ProgInfo,
803 SIFunctionResourceInfo Info = analyzeResourceUsage(MF);
805 ProgInfo.
NumVGPR = Info.NumVGPR;
806 ProgInfo.
NumSGPR = Info.NumExplicitSGPR;
808 ProgInfo.
VCCUsed = Info.UsesVCC;
809 ProgInfo.
FlatUsed = Info.UsesFlatScratch;
810 ProgInfo.
DynamicCallStack = Info.HasDynamicallySizedStack || Info.HasRecursion;
833 if (ProgInfo.
NumSGPR > MaxAddressableNumSGPRs) {
837 "addressable scalar registers",
840 MaxAddressableNumSGPRs);
842 ProgInfo.
NumSGPR = MaxAddressableNumSGPRs - 1;
847 ProgInfo.
NumSGPR += ExtraSGPRs;
851 unsigned WaveDispatchNumSGPR = 0, WaveDispatchNumVGPR = 0;
854 if (
Arg.hasAttribute(Attribute::InReg))
855 WaveDispatchNumSGPR += NumRegs;
857 WaveDispatchNumVGPR += NumRegs;
872 if (ProgInfo.
NumSGPR > MaxAddressableNumSGPRs) {
880 MaxAddressableNumSGPRs);
882 ProgInfo.
NumSGPR = MaxAddressableNumSGPRs;
932 unsigned LDSAlignShift;
941 unsigned LDSSpillSize =
942 MFI->getLDSWaveSpillSize() * MFI->getMaxFlatWorkGroupSize();
944 ProgInfo.
LDSSize = MFI->getLDSSize() + LDSSpillSize;
946 alignTo(ProgInfo.
LDSSize, 1ULL << LDSAlignShift) >> LDSAlignShift;
949 unsigned ScratchAlignShift = 10;
955 1ULL << ScratchAlignShift) >>
969 unsigned TIDIGCompCnt = 0;
970 if (MFI->hasWorkItemIDZ())
972 else if (MFI->hasWorkItemIDY())
1037 OutStreamer->EmitIntValue(MFI->getPSInputEnable(), 4);
1039 OutStreamer->EmitIntValue(MFI->getPSInputAddr(), 4);
1043 OutStreamer->EmitIntValue(MFI->getNumSpilledSGPRs(), 4);
1045 OutStreamer->EmitIntValue(MFI->getNumSpilledVGPRs(), 4);
1063 unsigned Rsrc2Reg = Rsrc1Reg + 1;
1088 unsigned NumUsedVgprsKey = ScratchSizeKey +
1090 unsigned NumUsedSgprsKey = ScratchSizeKey +
1098 PALMetadataMap[ScratchSizeKey] |=
1106 PALMetadataMap[ScratchSizeKey] |=
1110 PALMetadataMap[Rsrc2Reg] |=
1155 if (MFI->hasPrivateSegmentBuffer()) {
1160 if (MFI->hasDispatchPtr())
1163 if (MFI->hasQueuePtr())
1166 if (MFI->hasKernargSegmentPtr())
1169 if (MFI->hasDispatchID())
1172 if (MFI->hasFlatScratchInit())
1175 if (MFI->hasDispatchPtr())
1178 if (STM.debuggerSupported())
1181 if (STM.isXNACKEnabled())
1184 unsigned MaxKernArgAlign;
1196 if (STM.debuggerEmitPrologue()) {
1205 unsigned AsmVariant,
1211 if (ExtraCode && ExtraCode[0]) {
1212 if (ExtraCode[1] != 0)
1215 switch (ExtraCode[0]) {
bool enableIEEEBit(const MachineFunction &MF) const
virtual void EmitGlobalVariable(const GlobalVariable *GV)
Emit the specified global variable to the .s file.
bool hasDispatchPtr() const
uint16_t DebuggerPrivateSegmentBufferSGPR
constexpr bool isUInt< 32 >(uint64_t x)
unsigned getNumExtraSGPRs(const FeatureBitset &Features, bool VCCUsed, bool FlatScrUsed, bool XNACKUsed)
const TargetLoweringObjectFile & getObjFileLowering() const
Return information about object file lowering.
void EmitGlobalVariable(const GlobalVariable *GV) override
Emit the specified global variable to the .s file.
Interface definition for SIRegisterInfo.
Target & getTheGCNTarget()
The target for GCN GPUs.
bool hasPrivateSegmentBuffer() const
Calling convention used for AMDPAL shader stage before geometry shader if geometry is in use...
#define S_00B848_VGPRS(x)
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
AMDGPU specific subclass of TargetSubtarget.
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
#define FP_DENORM_MODE_SP(x)
Compute iterated dominance frontiers using a linear time algorithm.
#define R_00B228_SPI_SHADER_PGM_RSRC1_GS
#define G_00B84C_USER_SGPR(x)
A Module instance is used to store all the information related to an LLVM module. ...
bool doFinalization(Module &M) override
Shut down the asmprinter.
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
OSType getOS() const
getOS - Get the parsed operating system type of this triple.
void EmitFunctionBodyEnd() override
Targets can override this to emit stuff after the last basic block in the function.
Target & getTheAMDGPUTarget()
The target which supports all AMD GPUs.
#define G_00B84C_TGID_Z_EN(x)
unsigned getReg() const
getReg - Returns the register number.
AMDGPUAS getAMDGPUAS(const Module &M)
#define R_00B028_SPI_SHADER_PGM_RSRC1_PS
iterator_range< reg_iterator > reg_operands(unsigned Reg) const
virtual void EmitAmdhsaKernelDescriptor(const MCSubtargetInfo &STI, StringRef KernelName, const amdhsa::kernel_descriptor_t &KernelDescriptor, uint64_t NextVGPR, uint64_t NextSGPR, bool ReserveVCC, bool ReserveFlatScr, bool ReserveXNACK)=0
#define S_00B84C_SCRATCH_EN(x)
const SIInstrInfo * getInstrInfo() const override
#define S_00B84C_TG_SIZE_EN(x)
#define S_00B848_DX10_CLAMP(x)
unsigned getPSInputAddr() const
bool isAmdCodeObjectV2(const Function &F) const
uint32_t NumSGPRsForWavesPerEU
unsigned const TargetRegisterInfo * TRI
MachineFunction * MF
The current machine function.
uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Alig...
#define G_00B84C_TGID_Y_EN(x)
const MCSubtargetInfo * getSTI() const
Interface definition for R600RegisterInfo.
unsigned getMinNumSGPRs(unsigned WavesPerEU) const
#define R_0286CC_SPI_PS_INPUT_ENA
bool hasDispatchID() const
#define S_00B028_SGPRS(x)
AsmPrinter * createR600AsmPrinterPass(TargetMachine &TM, std::unique_ptr< MCStreamer > &&Streamer)
Track resource usage for kernels / entry functions.
virtual void EmitAMDGPUSymbolType(StringRef SymbolName, unsigned Type)=0
const SIRegisterInfo & getRegisterInfo() const
return AArch64::GPR64RegClass contains(Reg)
bool hasFP64Denormals() const
bool hasFlatScratchInit() const
Calling convention used for Mesa/AMDPAL pixel shaders.
static amd_element_byte_size_t getElementByteSizeValue(unsigned Size)
#define FP_DENORM_FLUSH_NONE
uint32_t code_properties
Code properties.
virtual bool EmitHSAMetadata(StringRef HSAMetadataString)
constexpr char SymbolName[]
Key for Kernel::Metadata::mSymbolName.
static bool isFLAT(const MachineInstr &MI)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
unsigned getInstSizeInBytes(const MachineInstr &MI) const override
const HexagonInstrInfo * TII
int getLocalMemorySize() const
AMD Kernel Code Object (amd_kernel_code_t).
bool isEntryFunction() const
bool enableDX10Clamp() const
static void printRegOperand(unsigned RegNo, raw_ostream &O, const MCRegisterInfo &MRI)
#define G_00B84C_TRAP_HANDLER(x)
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
AMDGPUAsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer)
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
bool isTrapHandlerEnabled() const
uint32_t compute_pgm_rsrc2
uint16_t DebuggerWavefrontPrivateSegmentOffsetSGPR
virtual bool EmitPALMetadata(const AMDGPU::PALMD::Metadata &PALMetadata)=0
#define FP_ROUND_MODE_SP(x)
Diagnostic information for stack size etc.
#define S_00B84C_TGID_Y_EN(x)
uint32_t private_segment_fixed_size
bool hasCodeObjectV3(const MCSubtargetInfo *STI)
Context object for machine code objects.
auto reverse(ContainerTy &&C, typename std::enable_if< has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(C.rbegin(), C.rend()))
#define S_00B848_FLOAT_MODE(x)
#define R_00B848_COMPUTE_PGM_RSRC1
uint32_t group_segment_fixed_size
SPIR_KERNEL - Calling convention for SPIR kernel functions.
uint8_t kernarg_segment_alignment
The maximum byte alignment of variables used by the kernel in the specified memory segment...
void EmitFunctionBody()
This method emits the body and trailer for a function.
Type * getType() const
All values are typed, get the type of this value.
unsigned getAddressableNumSGPRs() const
LLVM_READONLY MachineOperand * getNamedOperand(MachineInstr &MI, unsigned OperandName) const
Returns the operand named Op.
bool isGroupSegment(const GlobalValue *GV)
NamedMDNode * getNamedMetadata(const Twine &Name) const
Return the first NamedMDNode in the module with the specified name.
#define S_00B84C_TRAP_HANDLER(x)
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
uint16_t kernel_code_properties
bool isVerbose() const
Return true if assembly output should contain comments.
amdgpu Simplify well known AMD library false Value * Callee
uint64_t compute_pgm_resource_registers
Shader program settings for CS.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
bool debuggerEmitPrologue() const
uint32_t NumVGPRsForWavesPerEU
bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const override
Return true if the basic block has exactly one predecessor and the control transfer mechanism between...
bool hasFP32Denormals() const
#define S_00B848_IEEE_MODE(x)
unsigned getNumSGPRBlocks(const FeatureBitset &Features, unsigned NumSGPRs)
bool isCompute(CallingConv::ID cc)
#define S_00B028_VGPRS(x)
static uint32_t getFPMode(const MachineFunction &F)
uint16_t wavefront_sgpr_count
Number of scalar registers used by a wavefront.
* if(!EatIfPresent(lltok::kw_thread_local)) return false
ParseOptionalThreadLocal := /*empty.
unsigned const MachineRegisterInfo * MRI
std::size_t countTrailingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the least significant bit to the most stopping at the first 1...
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
This is an important class for using LLVM in a threaded context.
unsigned getTotalNumSGPRs(const FeatureBitset &Features)
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define G_00B84C_TGID_X_EN(x)
#define S_00B84C_TIDIG_COMP_CNT(x)
#define FP_ROUND_MODE_DP(x)
const GlobalValue * getGlobal() const
virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode, raw_ostream &OS)
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant...
virtual bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const
Return true if the basic block has exactly one predecessor and the control transfer mechanism between...
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode, raw_ostream &O) override
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant...
Calling convention used for AMDPAL vertex shader if tessellation is in use.
TargetMachine & TM
Target machine description.
This class is intended to be used as a driving class for all asm writers.
void getNameWithPrefix(SmallVectorImpl< char > &Name, const GlobalValue *GV) const
void EmitEndOfAsmFile(Module &M) override
This virtual method can be overridden by targets that want to emit something at the end of their file...
#define S_00B84C_EXCP_EN_MSB(x)
Instruction set architecture version.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
Generation getGeneration() const
MCContext & getContext() const
const Triple & getTargetTriple() const
#define R_00B02C_SPI_SHADER_PGM_RSRC2_PS
#define FP_DENORM_FLUSH_IN_FLUSH_OUT
#define S_00B84C_TGID_Z_EN(x)
The AMDGPU TargetMachine interface definition for hw codgen targets.
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
#define R_00B328_SPI_SHADER_PGM_RSRC1_ES
#define S_00B84C_LDS_SIZE(x)
void EmitBasicBlockStart(const MachineBasicBlock &MBB) const override
Targets can override this to emit stuff at the start of a basic block.
virtual void EmitDirectiveHSACodeObjectISA(uint32_t Major, uint32_t Minor, uint32_t Stepping, StringRef VendorName, StringRef ArchName)=0
void initDefaultAMDKernelCodeT(amd_kernel_code_t &Header, const FeatureBitset &Features)
std::string & str()
Flushes the stream contents to the target string and returns the string's reference.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
amd_element_byte_size_t
The values used to define the number of bytes to use for the swizzle element size.
#define FP_ROUND_ROUND_TO_NEAREST
bool doesNotRecurse() const
Determine if the function is known not to recurse, directly or indirectly.
#define S_00B84C_EXCP_EN(x)
void LLVMInitializeAMDGPUAsmPrinter()
unsigned getWavefrontSize() const
#define R_00B428_SPI_SHADER_PGM_RSRC1_HS
AMDGPUTargetStreamer * getTargetStreamer() const
unsigned getFunctionNumber() const
Return a unique ID for the current function.
#define G_00B84C_TIDIG_COMP_CNT(x)
MCStreamer & getStreamer()
std::vector< std::string > HexLines
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
bool hasKernargSegmentPtr() const
#define R_00B128_SPI_SHADER_PGM_RSRC1_VS
uint64_t kernarg_segment_byte_size
The size in bytes of the kernarg segment that holds the values of the arguments to the kernel...
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
R600 Assembly printer class.
MachineOperand class - Representation of each machine instruction operand.
bool isStackRealigned() const
uint16_t debug_wavefront_private_segment_offset_sgpr
If is_debug_supported is 0 then must be 0.
const MCSubtargetInfo * getMCSubtargetInfo() const
virtual void EmitAMDKernelCodeT(const amd_kernel_code_t &Header)=0
uint16_t workitem_vgpr_count
Number of vector registers used by each work-item.
bool hasSGPRInitBug() const
#define S_00B848_DEBUG_MODE(x)
#define FP_DENORM_MODE_DP(x)
#define S_0286E8_WAVESIZE(x)
const Function & getFunction() const
Return the LLVM function that this machine code represents.
#define S_00B84C_TGID_X_EN(x)
bool runOnMachineFunction(MachineFunction &MF) override
Emit the specified function out to the OutStreamer.
bool isVGPRSpillingEnabled(const Function &F) const
bool isPhysRegUsed(unsigned PhysReg) const
Return true if the specified register is modified or read in this function.
uint32_t workgroup_group_segment_byte_size
The amount of group segment memory required by a work-group in bytes.
unsigned getNumVGPRBlocks(const FeatureBitset &Features, unsigned NumVGPRs)
#define AMD_HSA_BITS_SET(dst, mask, val)
Calling convention used for Mesa/AMDPAL compute shaders.
std::vector< std::string > DisasmLines
virtual void EmitDirectiveHSACodeObjectVersion(uint32_t Major, uint32_t Minor)=0
Calling convention for AMDGPU code object kernels.
bool isMemoryBound() const
void EmitFunctionEntryLabel() override
EmitFunctionEntryLabel - Emit the label that is the entrypoint for the function.
static AsmPrinter * createAMDGPUAsmPrinterPass(TargetMachine &tm, std::unique_ptr< MCStreamer > &&Streamer)
amdgpu Simplify well known AMD library false Value Value * Arg
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
unsigned getPSInputEnable() const
uint32_t compute_pgm_rsrc1
virtual bool EmitISAVersion(StringRef IsaVersionString)=0
Provides AMDGPU specific target descriptions.
Representation of each machine instruction.
void EmitFunctionBodyStart() override
Targets can override this to emit stuff before the first basic block in the function.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
bool doFinalization(Module &M) override
Shut down the asmprinter.
Calling convention used for Mesa/AMDPAL geometry shaders.
This class keeps track of the SPI_SP_INPUT_ADDR config register, which tells the hardware which inter...
Interface definition for SIInstrInfo.
void SetupMachineFunction(MachineFunction &MF)
This should be called when a new MachineFunction is being processed from runOnMachineFunction.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
#define S_00B848_SGPRS(x)
virtual void EmitBasicBlockStart(const MachineBasicBlock &MBB) const
Targets can override this to emit stuff at the start of a basic block.
bool hasXNACK(const MCSubtargetInfo &STI)
uint32_t workitem_private_segment_byte_size
The amount of memory required for the combined private, spill and arg segments for a work-item in byt...
#define S_00B84C_USER_SGPR(x)
AMDGPU Assembly printer class.
#define R_00B860_COMPUTE_TMPRING_SIZE
Generic base class for all target subtargets.
This represents a section on linux, lots of unix variants and some bare metal systems.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
void diagnose(const DiagnosticInfo &DI)
Report a message to the currently installed diagnostic handler.
static bool hasAnyNonFlatUseOfReg(const MachineRegisterInfo &MRI, const SIInstrInfo &TII, unsigned Reg)
virtual void EmitFunctionEntryLabel()
EmitFunctionEntryLabel - Emit the label that is the entrypoint for the function.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
unsigned getMinNumVGPRs(unsigned WavesPerEU) const
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
static unsigned getRsrcReg(CallingConv::ID CallConv)
unsigned getMaxNumUserSGPRs() const
#define S_00B860_WAVESIZE(x)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool needsWaveLimiter() const
#define R_00B84C_COMPUTE_PGM_RSRC2
#define S_00B848_PRIORITY(x)
A raw_ostream that writes to an std::string.
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
void EmitStartOfAsmFile(Module &M) override
This virtual method can be overridden by targets that want to emit something at the start of their fi...
Calling convention used for Mesa vertex shaders, or AMDPAL last shader stage before rasterization (ve...
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
#define R_0286E8_SPI_TMPRING_SIZE
void setAlignment(unsigned A)
setAlignment - Set the alignment (log2, not bytes) of the function.
unsigned getHWRegIndex(unsigned Reg) const
#define S_00B02C_EXTRA_LDS_SIZE(x)
This class implements an extremely fast bulk output stream that can only output to a stream...
Primary interface to the complete machine description for the target machine.
static void RegisterAsmPrinter(Target &T, Target::AsmPrinterCtorTy Fn)
RegisterAsmPrinter - Register an AsmPrinter implementation for the given target.
#define R_00B528_SPI_SHADER_PGM_RSRC1_LS
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
StringRef - Represent a constant reference to a string, i.e.
#define R_0286D0_SPI_PS_INPUT_ADDR
uint16_t debug_private_segment_buffer_sgpr
If is_debug_supported is 0 then must be 0.
const MachineOperand & getOperand(unsigned i) const
Calling convention used for Mesa/AMDPAL hull shaders (= tessellation control shaders).
IsaVersion getIsaVersion(const FeatureBitset &Features)
std::vector< uint32_t > Metadata
PAL metadata represented as a vector.
void streamIsaVersion(const MCSubtargetInfo *STI, raw_ostream &Stream)
Streams isa version string for given subtarget STI into Stream.
iterator_range< arg_iterator > args()