mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-07 12:30:44 +00:00
AMDGPU: Check feature attributes in SIMachineFunctionInfo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254091 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d03cf5bb6b
commit
531e80f211
@ -29,11 +29,44 @@ void SIMachineFunctionInfo::anchor() {}
|
||||
SIMachineFunctionInfo::SIMachineFunctionInfo(const MachineFunction &MF)
|
||||
: AMDGPUMachineFunction(MF),
|
||||
TIDReg(AMDGPU::NoRegister),
|
||||
HasSpilledSGPRs(false),
|
||||
HasSpilledVGPRs(false),
|
||||
ScratchRSrcReg(AMDGPU::NoRegister),
|
||||
LDSWaveSpillSize(0),
|
||||
PSInputAddr(0),
|
||||
NumUserSGPRs(0),
|
||||
LDSWaveSpillSize(0) { }
|
||||
HasSpilledSGPRs(false),
|
||||
HasSpilledVGPRs(false),
|
||||
DispatchPtr(false),
|
||||
QueuePtr(false),
|
||||
DispatchID(false),
|
||||
KernargSegmentPtr(true),
|
||||
FlatScratchInit(false),
|
||||
GridWorkgroupCountX(false),
|
||||
GridWorkgroupCountY(false),
|
||||
GridWorkgroupCountZ(false),
|
||||
WorkGroupIDX(true),
|
||||
WorkGroupIDY(false),
|
||||
WorkGroupIDZ(false),
|
||||
WorkGroupInfo(false),
|
||||
WorkItemIDX(true),
|
||||
WorkItemIDY(false),
|
||||
WorkItemIDZ(false) {
|
||||
const Function *F = MF.getFunction();
|
||||
|
||||
if (F->hasFnAttribute("amdgpu-dispatch-ptr"))
|
||||
DispatchPtr = true;
|
||||
|
||||
if (F->hasFnAttribute("amdgpu-work-group-id-y"))
|
||||
WorkGroupIDY = true;
|
||||
|
||||
if (F->hasFnAttribute("amdgpu-work-group-id-z"))
|
||||
WorkGroupIDZ = true;
|
||||
|
||||
if (F->hasFnAttribute("amdgpu-work-item-id-y"))
|
||||
WorkItemIDY = true;
|
||||
|
||||
if (F->hasFnAttribute("amdgpu-work-item-id-z"))
|
||||
WorkItemIDZ = true;
|
||||
}
|
||||
|
||||
SIMachineFunctionInfo::SpilledReg SIMachineFunctionInfo::getSpilledReg(
|
||||
MachineFunction *MF,
|
||||
|
@ -29,11 +29,40 @@ class SIMachineFunctionInfo : public AMDGPUMachineFunction {
|
||||
void anchor() override;
|
||||
|
||||
unsigned TIDReg;
|
||||
unsigned ScratchRSrcReg;
|
||||
|
||||
public:
|
||||
// FIXME: Make private
|
||||
unsigned LDSWaveSpillSize;
|
||||
unsigned PSInputAddr;
|
||||
std::map<unsigned, unsigned> LaneVGPRs;
|
||||
unsigned ScratchOffsetReg;
|
||||
unsigned NumUserSGPRs;
|
||||
|
||||
private:
|
||||
bool HasSpilledSGPRs;
|
||||
bool HasSpilledVGPRs;
|
||||
|
||||
public:
|
||||
// Feature bits required for inputs passed in user / system SGPRs.
|
||||
bool DispatchPtr : 1;
|
||||
bool QueuePtr : 1;
|
||||
bool DispatchID : 1;
|
||||
bool KernargSegmentPtr : 1;
|
||||
bool FlatScratchInit : 1;
|
||||
bool GridWorkgroupCountX : 1;
|
||||
bool GridWorkgroupCountY : 1;
|
||||
bool GridWorkgroupCountZ : 1;
|
||||
|
||||
bool WorkGroupIDX : 1; // Always initialized.
|
||||
bool WorkGroupIDY : 1;
|
||||
bool WorkGroupIDZ : 1;
|
||||
bool WorkGroupInfo : 1;
|
||||
|
||||
bool WorkItemIDX : 1; // Always initialized.
|
||||
bool WorkItemIDY : 1;
|
||||
bool WorkItemIDZ : 1;
|
||||
|
||||
public:
|
||||
struct SpilledReg {
|
||||
unsigned VGPR;
|
||||
int Lane;
|
||||
@ -47,15 +76,78 @@ public:
|
||||
SIMachineFunctionInfo(const MachineFunction &MF);
|
||||
SpilledReg getSpilledReg(MachineFunction *MF, unsigned FrameIndex,
|
||||
unsigned SubIdx);
|
||||
unsigned PSInputAddr;
|
||||
unsigned NumUserSGPRs;
|
||||
std::map<unsigned, unsigned> LaneVGPRs;
|
||||
unsigned LDSWaveSpillSize;
|
||||
unsigned ScratchOffsetReg;
|
||||
bool hasCalculatedTID() const { return TIDReg != AMDGPU::NoRegister; };
|
||||
unsigned getTIDReg() const { return TIDReg; };
|
||||
void setTIDReg(unsigned Reg) { TIDReg = Reg; }
|
||||
|
||||
bool hasDispatchPtr() const {
|
||||
return DispatchPtr;
|
||||
}
|
||||
|
||||
bool hasQueuePtr() const {
|
||||
return QueuePtr;
|
||||
}
|
||||
|
||||
bool hasDispatchID() const {
|
||||
return DispatchID;
|
||||
}
|
||||
|
||||
bool hasKernargSegmentPtr() const {
|
||||
return KernargSegmentPtr;
|
||||
}
|
||||
|
||||
bool hasFlatScratchInit() const {
|
||||
return FlatScratchInit;
|
||||
}
|
||||
|
||||
bool hasGridWorkgroupCountX() const {
|
||||
return GridWorkgroupCountX;
|
||||
}
|
||||
|
||||
bool hasGridWorkgroupCountY() const {
|
||||
return GridWorkgroupCountY;
|
||||
}
|
||||
|
||||
bool hasGridWorkgroupCountZ() const {
|
||||
return GridWorkgroupCountZ;
|
||||
}
|
||||
|
||||
bool hasWorkGroupIDX() const {
|
||||
return WorkGroupIDX;
|
||||
}
|
||||
|
||||
bool hasWorkGroupIDY() const {
|
||||
return WorkGroupIDY;
|
||||
}
|
||||
|
||||
bool hasWorkGroupIDZ() const {
|
||||
return WorkGroupIDZ;
|
||||
}
|
||||
|
||||
bool hasWorkGroupInfo() const {
|
||||
return WorkGroupInfo;
|
||||
}
|
||||
|
||||
bool hasWorkItemIDX() const {
|
||||
return WorkItemIDX;
|
||||
}
|
||||
|
||||
bool hasWorkItemIDY() const {
|
||||
return WorkItemIDY;
|
||||
}
|
||||
|
||||
bool hasWorkItemIDZ() const {
|
||||
return WorkItemIDZ;
|
||||
}
|
||||
|
||||
/// \brief Returns the physical register reserved for use as the resource
|
||||
/// descriptor for scratch accesses.
|
||||
unsigned getScratchRSrcReg() const {
|
||||
return ScratchRSrcReg;
|
||||
}
|
||||
|
||||
void setScratchRSrcReg(const SIRegisterInfo *TRI);
|
||||
|
||||
bool hasSpilledSGPRs() const {
|
||||
return HasSpilledSGPRs;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user