35 const Value *Val,
unsigned VReg)
const {
55 unsigned DstReg = MRI.createGenericVirtualRegister(PtrType);
56 unsigned KernArgSegmentPtr =
58 unsigned KernArgSegmentVReg = MRI.getLiveInVirtReg(KernArgSegmentPtr);
60 unsigned OffsetReg = MRI.createGenericVirtualRegister(
LLT::scalar(64));
63 MIRBuilder.
buildGEP(DstReg, KernArgSegmentVReg, OffsetReg);
71 unsigned DstReg)
const {
78 unsigned PtrReg = lowerParameterPtr(MIRBuilder, ParamTy,
Offset);
86 MIRBuilder.
buildLoad(DstReg, PtrReg, *MMO);
110 MF.
addLiveIn(PrivateSegmentBufferReg, &AMDGPU::SReg_128RegClass);
111 CCInfo.AllocateReg(PrivateSegmentBufferReg);
117 CCInfo.AllocateReg(DispatchPtrReg);
123 CCInfo.AllocateReg(QueuePtrReg);
129 unsigned VReg = MRI.createGenericVirtualRegister(P2);
130 MRI.addLiveIn(InputPtrReg, VReg);
133 CCInfo.AllocateReg(InputPtrReg);
139 CCInfo.AllocateReg(DispatchIDReg);
145 CCInfo.AllocateReg(FlatScratchInitReg);
153 const unsigned KernArgBaseAlign = 16;
155 uint64_t ExplicitArgOffset = 0;
166 uint64_t ArgOffset =
alignTo(ExplicitArgOffset, ABIAlign) + BaseOffset;
167 ExplicitArgOffset =
alignTo(ExplicitArgOffset, ABIAlign) + AllocSize;
169 unsigned Align =
MinAlign(KernArgBaseAlign, ArgOffset);
171 lowerParameter(MIRBuilder, ArgTy, ArgOffset, Align, VRegs[i]);
181 unsigned PSInputNum = 0;
183 for (
unsigned i = 0; i != NumArgs; ++i, ++CurOrigArg) {
193 !OrigArg.Flags.isInReg() && !OrigArg.Flags.isByVal() &&
217 OrigArg.Flags, CCInfo);
237 for (
unsigned i = 0, OrigArgIdx = 0;
238 OrigArgIdx != NumArgs && i != ArgLocs.size(); ++
Arg, ++OrigArgIdx) {
239 if (Skipped.
test(OrigArgIdx))
242 MRI.addLiveIn(VA.
getLocReg(), VRegs[OrigArgIdx]);
bool isVarArg() const
isVarArg - Return true if this function takes a variable number of arguments.
bool hasDispatchPtr() const
MachineInstrBuilder buildCopy(unsigned Res, unsigned Op)
Build and insert Res = COPY Op.
A parsed version of the target data layout string in and methods for querying it. ...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
Interface definition for SIRegisterInfo.
bool hasPrivateSegmentBuffer() const
This class represents an incoming formal argument to a Function.
AMDGPU specific subclass of TargetSubtarget.
bool isPSInputAllocated(unsigned Index) const
Compute iterated dominance frontiers using a linear time algorithm.
MachineInstrBuilder buildGEP(unsigned Res, unsigned Op0, unsigned Op1)
Build and insert Res = G_GEP Op0, Op1.
unsigned addLiveIn(unsigned PReg, const TargetRegisterClass *RC)
addLiveIn - Add the specified physical register as a live-in value and create a corresponding virtual...
This file describes how to lower LLVM calls to machine code calls.
unsigned addKernargSegmentPtr(const SIRegisterInfo &TRI)
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
AMDGPUAS getAMDGPUAS(const Module &M)
static PointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space...
bool CCAssignFn(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
CCAssignFn - This function assigns a location for Val, updating State to reflect the change...
bool test(unsigned Idx) const
static const MCPhysReg VRegs[32]
static CCAssignFn * CCAssignFnForCall(CallingConv::ID CC, bool IsVarArg)
unsigned const TargetRegisterInfo * TRI
void markPSInputEnabled(unsigned Index)
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...
bool hasDispatchID() const
bool hasFlatScratchInit() const
Calling convention used for Mesa/AMDPAL pixel shaders.
Address space for constant memory (VTX2)
A description of a memory reference used in the backend.
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
unsigned addDispatchID(const SIRegisterInfo &TRI)
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s, unsigned base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
Type * getType() const
All values are typed, get the type of this value.
static LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
void setOrigAlign(unsigned A)
void markPSInputAllocated(unsigned Index)
Class to represent pointers.
constexpr uint64_t MinAlign(uint64_t A, uint64_t B)
A and B are either alignments or offsets.
void addLiveIn(MCPhysReg PhysReg, LaneBitmask LaneMask=LaneBitmask::getAll())
Adds the specified register as a live in.
unsigned const MachineRegisterInfo * MRI
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
The instances of the Type class are immutable: once they are created, they are never changed...
SI DAG Lowering interface definition.
unsigned addQueuePtr(const SIRegisterInfo &TRI)
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
The memory access is non-temporal.
void setArgFlags(ArgInfo &Arg, unsigned OpIdx, const DataLayout &DL, const FuncInfoTy &FuncInfo) const
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
This class contains a discriminated union of information about pointers in memory operands...
EVT getValueType(const DataLayout &DL, Type *Ty, bool AllowUnknown=false) const
Return the EVT corresponding to this LLVM type.
unsigned addDispatchPtr(const SIRegisterInfo &TRI)
LLT getLLTForType(Type &Ty, const DataLayout &DL)
Construct a low-level type based on an LLVM type.
CCState - This class holds information needed while lowering arguments and return values...
bool hasKernargSegmentPtr() const
EVT getVectorElementType() const
Given a vector type, return the type of each element.
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
Interface definition of the TargetLowering class that is common to all AMD GPUs.
unsigned getExplicitKernelArgOffset(const Function &F) const
Returns the offset in bytes from the start of the input buffer of the first explicit kernel argument...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
CCValAssign - Represent assignment of one arg/retval to a location.
unsigned getABITypeAlignment(Type *Ty) const
Returns the minimum ABI-required alignment for the specified type.
bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F, ArrayRef< unsigned > VRegs) const override
This hook must be implemented to lower the incoming (formal) arguments, described by Args...
const Function & getFunction() const
Return the LLVM function that this machine code represents.
This file declares the MachineIRBuilder class.
Calling convention for AMDGPU code object kernels.
MachineInstrBuilder buildConstant(unsigned Res, const ConstantInt &Val)
Build and insert Res = G_CONSTANT Val.
unsigned addPrivateSegmentBuffer(const SIRegisterInfo &TRI)
amdgpu Simplify well known AMD library false Value Value * Arg
unsigned addFlatScratchInit(const SIRegisterInfo &TRI)
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
The memory access reads data.
uint64_t getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
Provides AMDGPU specific target descriptions.
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...
unsigned getPreloadedReg(AMDGPUFunctionArgInfo::PreloadedValue Value) const
bool isVector() const
Return true if this is a vector value type.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
MachineInstrBuilder buildLoad(unsigned Res, unsigned Addr, MachineMemOperand &MMO)
Build and insert Res = G_LOAD Addr, MMO.
The memory access always returns the same value (or traps).
MachineFunction & getMF()
Getter for the function we currently build.
bool lowerReturn(MachineIRBuilder &MIRBuiler, const Value *Val, unsigned VReg) const override
This hook must be implemented to lower outgoing return values, described by Val, into the specified v...
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
static LLT pointer(uint16_t AddressSpace, unsigned SizeInBits)
Get a low-level pointer in the given address space (defaulting to 0).
Calling convention used for Mesa vertex shaders, or AMDPAL last shader stage before rasterization (ve...
uint64_t getTypeStoreSize(Type *Ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type...
MachineBasicBlock & getMBB()
Getter for the basic block we currently build.
MachineInstrBuilder buildInstr(unsigned Opc, DstTy &&Ty, UseArgsTy &&... Args)
DAG like Generic method for building arbitrary instructions as above.
unsigned getLocReg() const
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
Calling convention used for Mesa/AMDPAL hull shaders (= tessellation control shaders).
AMDGPUCallLowering(const AMDGPUTargetLowering &TLI)
iterator_range< arg_iterator > args()