24 const Module *M =
F.getParent();
26 KernelDynLDSName +=
F.getName();
27 KernelDynLDSName +=
".dynlds";
28 return M->getNamedGlobal(KernelDynLDSName);
33 Type *ArgTy = Arg.getType();
34 if (
auto *PtrTy = dyn_cast<PointerType>(ArgTy)) {
44 : IsEntryFunction(AMDGPU::isEntryFunctionCC(
F.getCallingConv())),
45 IsModuleEntryFunction(
46 AMDGPU::isModuleEntryFunctionCC(
F.getCallingConv())),
47 IsChainFunction(AMDGPU::isChainCC(
F.getCallingConv())) {
52 Attribute MemBoundAttr =
F.getFnAttribute(
"amdgpu-memory-bound");
55 Attribute WaveLimitAttr =
F.getFnAttribute(
"amdgpu-wave-limiter");
60 StringRef S =
F.getFnAttribute(
"amdgpu-gds-size").getValueAsString();
71 F,
"amdgpu-lds-size", {0, UINT32_MAX},
true);
84 Attribute NSZAttr =
F.getFnAttribute(
"no-signed-zeros-fp-math");
96 auto Entry = LocalMemoryObjects.insert(std::pair(&GV, 0));
98 return Entry.first->second;
109 Entry.first->second = BarAddr.value();
110 return BarAddr.value();
124 if (ObjectStart !=
alignTo(ObjectStart, Alignment)) {
126 "variable alignment");
140 "Absolute address LDS variable outside of static frame");
144 Entry.first->second = ObjectStart;
159 "expected region address space");
168 Entry.first->second =
Offset;
172std::optional<uint32_t>
175 MDNode *MD =
F.getMetadata(
"llvm.amdgcn.lds.kernel.id");
178 mdconst::extract<ConstantInt>(MD->
getOperand(0))) {
179 uint64_t ZExt = KnownSize->getZExtValue();
180 if (ZExt <= UINT32_MAX) {
188std::optional<uint32_t>
197 if (
const APInt *V = AbsSymRange->getSingleElement()) {
198 std::optional<uint64_t> ZExt = V->tryZExtValue();
199 if (ZExt && (*ZExt <= UINT32_MAX)) {
209 const Module *M =
F.getParent();
229 if (!Expect || (
Offset != *Expect)) {
static bool hasLDSKernelArgument(const Function &F)
static const GlobalVariable * getKernelDynLDSGlobalFromFunction(const Function &F)
Base class for AMDGPU specific classes of TargetSubtarget.
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file contains the declarations for the subclasses of Constant, which represent the different fla...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
AMDGPUMachineFunction(const Function &F, const AMDGPUSubtarget &ST)
static std::optional< uint32_t > getLDSKernelIdMetadata(const Function &F)
Align DynLDSAlign
Align for dynamic shared memory if any.
bool isDynamicLDSUsed() const
void setUsesDynamicLDS(bool DynLDS)
uint32_t LDSSize
Number of bytes in the LDS that are being used.
void setDynLDSAlign(const Function &F, const GlobalVariable &GV)
static std::optional< uint32_t > getLDSAbsoluteAddress(const GlobalValue &GV)
uint64_t ExplicitKernArgSize
unsigned allocateLDSGlobal(const DataLayout &DL, const GlobalVariable &GV)
bool isModuleEntryFunction() const
uint32_t StaticLDSSize
Number of bytes in the LDS allocated statically.
Class for arbitrary precision integers.
This class represents an incoming formal argument to a Function.
bool isStringAttribute() const
Return true if the attribute is a string (target-dependent) attribute.
bool getValueAsBool() const
Return the attribute's value as a boolean.
StringRef getValueAsString() const
Return the attribute's value as a string.
This is the shared class of boolean and integer constants.
A parsed version of the target data layout string in and methods for querying it.
MaybeAlign getAlign() const
Returns the alignment of the given variable or function.
unsigned getAddressSpace() const
std::optional< ConstantRange > getAbsoluteSymbolRange() const
If this is an absolute symbol reference, returns the range of the symbol, otherwise returns std::null...
Type * getValueType() const
const MDOperand & getOperand(unsigned I) const
unsigned getNumOperands() const
Return number of MDNode operands.
A Module instance is used to store all the information related to an LLVM module.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
StringRef - Represent a constant reference to a string, i.e.
bool consumeInteger(unsigned Radix, T &Result)
Parse the current string as an integer of the specified radix.
constexpr bool empty() const
empty - Check if the string is empty.
The instances of the Type class are immutable: once they are created, they are never changed.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ REGION_ADDRESS
Address space for region memory. (GDS)
@ LOCAL_ADDRESS
Address space for local memory.
TargetExtType * isNamedBarrier(const GlobalVariable &GV)
std::pair< unsigned, unsigned > getIntegerPairAttribute(const Function &F, StringRef Name, std::pair< unsigned, unsigned > Default, bool OnlyFirstRequired)
@ AMDGPU_KERNEL
Used for AMDGPU code object kernels.
@ SPIR_KERNEL
Used for SPIR kernel functions.
This is an optimization pass for GlobalISel generic memory operations.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
This struct is a compact representation of a valid (non-zero power of two) alignment.