14 #ifndef LLVM_LIB_TARGET_AMDGPU_SIMACHINEFUNCTIONINFO_H
15 #define LLVM_LIB_TARGET_AMDGPU_SIMACHINEFUNCTIONINFO_H
88 unsigned ScratchRSrcReg;
89 unsigned ScratchWaveOffsetReg;
94 unsigned FrameOffsetReg;
97 unsigned StackPtrOffsetReg;
100 unsigned ImplicitBufferPtrUserSGPR;
104 unsigned PrivateSegmentBufferUserSGPR;
105 unsigned DispatchPtrUserSGPR;
106 unsigned QueuePtrUserSGPR;
107 unsigned KernargSegmentPtrUserSGPR;
108 unsigned DispatchIDUserSGPR;
109 unsigned FlatScratchInitUserSGPR;
110 unsigned PrivateSegmentSizeUserSGPR;
111 unsigned GridWorkGroupCountXUserSGPR;
112 unsigned GridWorkGroupCountYUserSGPR;
113 unsigned GridWorkGroupCountZUserSGPR;
116 unsigned WorkGroupIDXSystemSGPR;
117 unsigned WorkGroupIDYSystemSGPR;
118 unsigned WorkGroupIDZSystemSGPR;
119 unsigned WorkGroupInfoSystemSGPR;
120 unsigned PrivateSegmentWaveByteOffsetSystemSGPR;
123 unsigned WorkItemIDXVGPR;
124 unsigned WorkItemIDYVGPR;
125 unsigned WorkItemIDZVGPR;
128 unsigned PSInputAddr;
129 unsigned PSInputEnable;
135 std::pair<unsigned, unsigned> FlatWorkGroupSizes;
139 std::pair<unsigned, unsigned> WavesPerEU;
142 std::array<int, 3> DebuggerWorkGroupIDStackObjectIndices;
151 unsigned ScratchOffsetReg;
200 unsigned VGPR = AMDGPU::NoRegister;
212 typedef std::pair<unsigned, unsigned> SpillRegMask;
217 unsigned NumVGPRSpillLanes = 0;
225 auto I = SGPRToVGPRSpills.find(FrameIndex);
226 return (
I == SGPRToVGPRSpills.end()) ?
248 WorkGroupIDXSystemSGPR = getNextSystemSGPR();
250 return WorkGroupIDXSystemSGPR;
254 WorkGroupIDYSystemSGPR = getNextSystemSGPR();
256 return WorkGroupIDYSystemSGPR;
260 WorkGroupIDZSystemSGPR = getNextSystemSGPR();
262 return WorkGroupIDZSystemSGPR;
266 WorkGroupInfoSystemSGPR = getNextSystemSGPR();
268 return WorkGroupInfoSystemSGPR;
272 PrivateSegmentWaveByteOffsetSystemSGPR = getNextSystemSGPR();
274 return PrivateSegmentWaveByteOffsetSystemSGPR;
278 PrivateSegmentWaveByteOffsetSystemSGPR =
Reg;
282 return PrivateSegmentBuffer;
294 return KernargSegmentPtr;
302 return FlatScratchInit;
306 return GridWorkgroupCountX;
310 return GridWorkgroupCountY;
314 return GridWorkgroupCountZ;
330 return WorkGroupInfo;
334 return PrivateSegmentWaveByteOffset;
350 return ImplicitBufferPtr;
358 return NumUserSGPRs + NumSystemSGPRs;
362 return PrivateSegmentWaveByteOffsetSystemSGPR;
368 return ScratchRSrcReg;
372 assert(Reg != AMDGPU::NoRegister &&
"Should never be unset");
373 ScratchRSrcReg =
Reg;
377 return ScratchWaveOffsetReg;
381 return FrameOffsetReg;
385 StackPtrOffsetReg =
Reg;
393 return StackPtrOffsetReg;
397 assert(Reg != AMDGPU::NoRegister &&
"Should never be unset");
398 ScratchWaveOffsetReg =
Reg;
400 FrameOffsetReg = ScratchWaveOffsetReg;
404 return QueuePtrUserSGPR;
408 return ImplicitBufferPtrUserSGPR;
412 return HasSpilledSGPRs;
416 HasSpilledSGPRs =
Spill;
420 return HasSpilledVGPRs;
424 HasSpilledVGPRs =
Spill;
428 return HasNonSpillStackObjects;
432 HasNonSpillStackObjects = StackObject;
436 return NumSpilledSGPRs;
440 return NumSpilledVGPRs;
444 NumSpilledSGPRs += num;
448 NumSpilledVGPRs += num;
456 return PSInputEnable;
460 return PSInputAddr & (1 << Index);
464 PSInputAddr |= 1 << Index;
468 PSInputEnable |= 1 << Index;
482 return FlatWorkGroupSizes;
487 return FlatWorkGroupSizes.first;
492 return FlatWorkGroupSizes.second;
503 return WavesPerEU.first;
508 return WavesPerEU.second;
514 return DebuggerWorkGroupIDStackObjectIndices[Dim];
520 DebuggerWorkGroupIDStackObjectIndices[Dim] = ObjectIdx;
526 return DebuggerWorkItemIDStackObjectIndices[Dim];
532 DebuggerWorkItemIDStackObjectIndices[Dim] = ObjectIdx;
540 return WorkGroupIDXSystemSGPR;
543 return WorkGroupIDYSystemSGPR;
546 return WorkGroupIDZSystemSGPR;
556 return AMDGPU::VGPR0;
559 return AMDGPU::VGPR1;
562 return AMDGPU::VGPR2;
568 return LDSWaveSpillSize;
582 #endif // LLVM_LIB_TARGET_AMDGPU_SIMACHINEFUNCTIONINFO_H
unsigned addImplicitBufferPtr(const SIRegisterInfo &TRI)
Interface definition for SIRegisterInfo.
unsigned getNumUserSGPRs() const
int getDebuggerWorkGroupIDStackObjectIndex(unsigned Dim) const
unsigned getQueuePtrUserSGPR() const
bool hasFlatScratchInit() const
void addToSpilledSGPRs(unsigned num)
unsigned getNumPreloadedSGPRs() const
bool hasSpilledVGPRs() const
AMDGPUImagePseudoSourceValue()
void addToSpilledVGPRs(unsigned num)
unsigned getPrivateSegmentWaveByteOffsetSystemSGPR() const
HasNonSpillStackObjects(false)
bool isAliased(const MachineFrameInfo *) const override
Test whether the memory pointed to by this PseudoSourceValue may also be pointed to by an LLVM IR Val...
bool hasDispatchID() const
void removeSGPRToVGPRFrameIndices(MachineFrameInfo &MFI)
unsigned addKernargSegmentPtr(const SIRegisterInfo &TRI)
unsigned addWorkGroupIDY()
GridWorkgroupCountZ(false)
bool hasImplicitBufferPtr() const
bool hasWorkGroupIDZ() const
unsigned getScratchWaveOffsetReg() const
void markPSInputEnabled(unsigned Index)
bool hasWorkItemIDZ() const
PrivateSegmentWaveByteOffset(false)
SIMachineFunctionInfo(const MachineFunction &MF)
const AMDGPUImagePseudoSourceValue * getImagePSV() const
unsigned getScratchRSrcReg() const
Returns the physical register reserved for use as the resource descriptor for scratch accesses...
unsigned getMinFlatWorkGroupSize() const
bool hasWorkGroupIDY() const
std::pair< unsigned, unsigned > getFlatWorkGroupSizes() const
unsigned getMaxFlatWorkGroupSize() const
void setPrivateSegmentWaveByteOffset(unsigned Reg)
void setDebuggerWorkGroupIDStackObjectIndex(unsigned Dim, int ObjectIdx)
Sets stack object index for Dim's work group ID to ObjectIdx.
bool hasSpilledSGPRs() const
void setScratchRSrcReg(unsigned Reg)
const AMDGPUBufferPseudoSourceValue * getBufferPSV() const
bool hasWorkGroupInfo() const
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
void setHasNonSpillStackObjects(bool StackObject=true)
unsigned addDispatchID(const SIRegisterInfo &TRI)
void setDebuggerWorkItemIDStackObjectIndex(unsigned Dim, int ObjectIdx)
Sets stack object index for Dim's work item ID to ObjectIdx.
void setIfReturnsVoid(bool Value)
void setHasSpilledVGPRs(bool Spill=true)
void setTIDReg(unsigned Reg)
Reg
All possible values of the reg field in the ModR/M byte.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
unsigned getPSInputEnable() const
unsigned getWorkItemIDVGPR(unsigned Dim) const
bool hasNonSpillStackObjects() const
unsigned getPSInputAddr() const
void setStackPtrOffsetReg(unsigned Reg)
int getDebuggerWorkItemIDStackObjectIndex(unsigned Dim) const
bool hasWorkGroupIDX() const
unsigned getWorkGroupIDSGPR(unsigned Dim) const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
bool isConstant(const MachineFrameInfo *) const override
Test whether the memory pointed to by this PseudoSourceValue has a constant value.
GridWorkgroupCountY(false)
void markPSInputAllocated(unsigned Index)
unsigned getLDSWaveSpillSize() const
bool allocateSGPRSpillToVGPR(MachineFunction &MF, int FI)
Reserve a slice of a VGPR to support spilling for FrameIndex FI.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
bool isPSInputAllocated(unsigned Index) const
GridWorkgroupCountX(false)
DebuggerWorkItemIDStackObjectIndices({{0, 0, 0}})
unsigned addWorkGroupInfo()
bool hasDispatchPtr() const
bool hasKernargSegmentPtr() const
AMDGPUBufferPseudoSourceValue()
unsigned addQueuePtr(const SIRegisterInfo &TRI)
bool hasWorkItemIDX() const
void setHasSpilledSGPRs(bool Spill=true)
void setScratchWaveOffsetReg(unsigned Reg)
unsigned addDispatchPtr(const SIRegisterInfo &TRI)
bool hasGridWorkgroupCountX() const
unsigned getNumSpilledVGPRs() const
bool isConstant(const MachineFrameInfo *) const override
Test whether the memory pointed to by this PseudoSourceValue has a constant value.
bool mayAlias(const MachineFrameInfo *) const override
Return true if the memory pointed to by this PseudoSourceValue can ever alias an LLVM IR Value...
ArrayRef< SpilledReg > getSGPRToVGPRSpills(int FrameIndex) const
unsigned getMaxWavesPerEU() const
bool isAliased(const MachineFrameInfo *) const override
Test whether the memory pointed to by this PseudoSourceValue may also be pointed to by an LLVM IR Val...
Special value supplied for machine level alias analysis.
bool isEntryFunction() const
unsigned addPrivateSegmentBuffer(const SIRegisterInfo &TRI)
llvm_unreachable("Unknown RegBank!")
unsigned addFlatScratchInit(const SIRegisterInfo &TRI)
unsigned getImplicitBufferPtrUserSGPR() const
Provides AMDGPU specific target descriptions.
This class keeps track of the SPI_SP_INPUT_ADDR config register, which tells the hardware which inter...
std::pair< unsigned, unsigned > getWavesPerEU() const
unsigned getMinWavesPerEU() const
bool hasGridWorkgroupCountZ() const
SpilledReg(unsigned R, int L)
unsigned addWorkGroupIDZ()
unsigned getNumSpilledSGPRs() const
bool hasWorkItemIDY() const
unsigned addPrivateSegmentWaveByteOffset()
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
unsigned getFrameOffsetReg() const
bool mayAlias(const MachineFrameInfo *) const override
Return true if the memory pointed to by this PseudoSourceValue can ever alias an LLVM IR Value...
unsigned getStackPtrOffsetReg() const
PrivateSegmentBuffer(false)
bool hasCalculatedTID() const
unsigned addWorkGroupIDX()
unsigned getTIDReg() const
bool hasGridWorkgroupCountY() const
bool hasPrivateSegmentWaveByteOffset() const
bool hasPrivateSegmentBuffer() const