1 //===- SIMachineFunctionInfo.h - SIMachineFunctionInfo interface -*- C++ -*-==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_LIB_TARGET_R600_SIMACHINEFUNCTIONINFO_H
16 #define LLVM_LIB_TARGET_R600_SIMACHINEFUNCTIONINFO_H
18 #include "AMDGPUMachineFunction.h"
19 #include "SIRegisterInfo.h"
24 class MachineRegisterInfo;
26 /// This class keeps track of the SPI_SP_INPUT_ADDR config register, which
27 /// tells the hardware which interpolation parameters to load.
28 class SIMachineFunctionInfo : public AMDGPUMachineFunction {
29 void anchor() override;
32 unsigned ScratchRSrcReg;
35 // FIXME: Make private
36 unsigned LDSWaveSpillSize;
38 std::map<unsigned, unsigned> LaneVGPRs;
39 unsigned ScratchOffsetReg;
40 unsigned NumUserSGPRs;
46 // Feature bits required for inputs passed in user / system SGPRs.
50 bool KernargSegmentPtr : 1;
51 bool FlatScratchInit : 1;
52 bool GridWorkgroupCountX : 1;
53 bool GridWorkgroupCountY : 1;
54 bool GridWorkgroupCountZ : 1;
56 bool WorkGroupIDX : 1; // Always initialized.
57 bool WorkGroupIDY : 1;
58 bool WorkGroupIDZ : 1;
59 bool WorkGroupInfo : 1;
61 bool WorkItemIDX : 1; // Always initialized.
69 SpilledReg(unsigned R, int L) : VGPR (R), Lane (L) { }
70 SpilledReg() : VGPR(0), Lane(-1) { }
71 bool hasLane() { return Lane != -1;}
74 // SIMachineFunctionInfo definition
76 SIMachineFunctionInfo(const MachineFunction &MF);
77 SpilledReg getSpilledReg(MachineFunction *MF, unsigned FrameIndex,
79 bool hasCalculatedTID() const { return TIDReg != AMDGPU::NoRegister; };
80 unsigned getTIDReg() const { return TIDReg; };
81 void setTIDReg(unsigned Reg) { TIDReg = Reg; }
83 bool hasDispatchPtr() const {
87 bool hasQueuePtr() const {
91 bool hasDispatchID() const {
95 bool hasKernargSegmentPtr() const {
96 return KernargSegmentPtr;
99 bool hasFlatScratchInit() const {
100 return FlatScratchInit;
103 bool hasGridWorkgroupCountX() const {
104 return GridWorkgroupCountX;
107 bool hasGridWorkgroupCountY() const {
108 return GridWorkgroupCountY;
111 bool hasGridWorkgroupCountZ() const {
112 return GridWorkgroupCountZ;
115 bool hasWorkGroupIDX() const {
119 bool hasWorkGroupIDY() const {
123 bool hasWorkGroupIDZ() const {
127 bool hasWorkGroupInfo() const {
128 return WorkGroupInfo;
131 bool hasWorkItemIDX() const {
135 bool hasWorkItemIDY() const {
139 bool hasWorkItemIDZ() const {
143 /// \brief Returns the physical register reserved for use as the resource
144 /// descriptor for scratch accesses.
145 unsigned getScratchRSrcReg() const {
146 return ScratchRSrcReg;
149 void setScratchRSrcReg(const SIRegisterInfo *TRI);
151 bool hasSpilledSGPRs() const {
152 return HasSpilledSGPRs;
155 void setHasSpilledSGPRs(bool Spill = true) {
156 HasSpilledSGPRs = Spill;
159 bool hasSpilledVGPRs() const {
160 return HasSpilledVGPRs;
163 void setHasSpilledVGPRs(bool Spill = true) {
164 HasSpilledVGPRs = Spill;
167 unsigned getMaximumWorkGroupSize(const MachineFunction &MF) const;
170 } // End namespace llvm