56 unsigned DstReg = MRI.createGenericVirtualRegister(PtrType);
57 unsigned KernArgSegmentPtr =
59 unsigned KernArgSegmentVReg = MRI.getLiveInVirtReg(KernArgSegmentPtr);
61 unsigned OffsetReg = MRI.createGenericVirtualRegister(
LLT::scalar(64));
64 MIRBuilder.
buildGEP(DstReg, KernArgSegmentVReg, OffsetReg);
72 unsigned DstReg)
const {
79 unsigned PtrReg = lowerParameterPtr(MIRBuilder, ParamTy,
Offset);
87 MIRBuilder.
buildLoad(DstReg, PtrReg, *MMO);
111 MF.
addLiveIn(PrivateSegmentBufferReg, &AMDGPU::SReg_128RegClass);
112 CCInfo.AllocateReg(PrivateSegmentBufferReg);
118 CCInfo.AllocateReg(DispatchPtrReg);
124 CCInfo.AllocateReg(QueuePtrReg);
130 unsigned VReg = MRI.createGenericVirtualRegister(P2);
131 MRI.addLiveIn(InputPtrReg, VReg);
134 CCInfo.AllocateReg(InputPtrReg);
140 CCInfo.AllocateReg(DispatchIDReg);
146 CCInfo.AllocateReg(FlatScratchInitReg);
154 const unsigned KernArgBaseAlign = 16;
156 uint64_t ExplicitArgOffset = 0;
167 uint64_t ArgOffset =
alignTo(ExplicitArgOffset, ABIAlign) + BaseOffset;
168 ExplicitArgOffset =
alignTo(ExplicitArgOffset, ABIAlign) + AllocSize;
170 unsigned Align =
MinAlign(KernArgBaseAlign, ArgOffset);
172 lowerParameter(MIRBuilder, ArgTy, ArgOffset, Align, VRegs[i]);
182 unsigned PSInputNum = 0;
184 for (
unsigned i = 0; i != NumArgs; ++i, ++CurOrigArg) {
194 !OrigArg.Flags.isInReg() && !OrigArg.Flags.isByVal() &&
218 OrigArg.Flags, CCInfo);
238 for (
unsigned i = 0, OrigArgIdx = 0;
239 OrigArgIdx != NumArgs && i != ArgLocs.size(); ++
Arg, ++OrigArgIdx) {
240 if (Skipped.
test(OrigArgIdx))
243 MRI.addLiveIn(VA.
getLocReg(), VRegs[OrigArgIdx]);
bool isVarArg() const
isVarArg - Return true if this function takes a variable number of arguments.
bool hasDispatchPtr() const
virtual MachineInstrBuilder buildConstant(const DstOp &Res, const ConstantInt &Val)
Build and insert Res = G_CONSTANT Val.
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.
MachineInstrBuilder buildGEP(unsigned Res, unsigned Op0, unsigned Op1)
Build and insert Res = G_GEP Op0, Op1.
AMDGPU specific subclass of TargetSubtarget.
bool isPSInputAllocated(unsigned Index) const
This class represents lattice values for constants.
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.
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 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 geometry shaders.
A description of a memory reference used in the backend.
Address space for constant memory (VTX2)
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.
MachineFunction & getMF()
Getter for the function we currently build.
static LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
void setOrigAlign(unsigned A)
void markPSInputAllocated(unsigned Index)
Calling convention used for Mesa vertex shaders, or AMDPAL last shader stage before rasterization (ve...
Analysis containing CSE Info
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...
MachineInstrBuilder buildInstr(unsigned Opcode)
Build and insert <empty> = Opcode <empty>.
Helper class to build MachineInstr.
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. ...
MachineInstrBuilder buildCopy(const DstOp &Res, const SrcOp &Op)
Build and insert Res = COPY Op.
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
Calling convention used for Mesa/AMDPAL pixel shaders.
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.
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.
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.
Calling convention used for Mesa/AMDPAL hull shaders (= tessellation control shaders).
const MachineBasicBlock & getMBB() const
Getter for the basic block we currently build.
The memory access always returns the same value (or traps).
bool lowerReturn(MachineIRBuilder &MIRBuilder, const Value *Val, ArrayRef< unsigned > VRegs) 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).
uint64_t getTypeStoreSize(Type *Ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type...
MachineInstrBuilder buildLoad(unsigned Res, unsigned Addr, MachineMemOperand &MMO)
Build and insert Res = G_LOAD Addr, MMO.
unsigned getLocReg() const
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
Calling convention for AMDGPU code object kernels.
AMDGPUCallLowering(const AMDGPUTargetLowering &TLI)
iterator_range< arg_iterator > args()