24 : IsEntryFunction(AMDGPU::isEntryFunctionCC(
F.getCallingConv())),
25 IsModuleEntryFunction(
26 AMDGPU::isModuleEntryFunctionCC(
F.getCallingConv())),
27 IsChainFunction(AMDGPU::isChainCC(
F.getCallingConv())),
28 NoSignedZerosFPMath(
false) {
33 Attribute MemBoundAttr =
F.getFnAttribute(
"amdgpu-memory-bound");
36 Attribute WaveLimitAttr =
F.getFnAttribute(
"amdgpu-wave-limiter");
41 StringRef S =
F.getFnAttribute(
"amdgpu-gds-size").getValueAsString();
52 F,
"amdgpu-lds-size", {0, UINT32_MAX},
true);
65 Attribute NSZAttr =
F.getFnAttribute(
"no-signed-zeros-fp-math");
73 auto Entry = LocalMemoryObjects.insert(std::pair(&GV, 0));
75 return Entry.first->second;
94 if (ObjectStart !=
alignTo(ObjectStart, Alignment)) {
96 "variable alignment");
110 "Absolute address LDS variable outside of static frame");
114 Entry.first->second = ObjectStart;
129 "expected region address space");
138 Entry.first->second =
Offset;
144 const Module *M =
F.getParent();
145 std::string KernelDynLDSName =
"llvm.amdgcn.";
146 KernelDynLDSName +=
F.getName();
147 KernelDynLDSName +=
".dynlds";
148 return M->getNamedGlobal(KernelDynLDSName);
151std::optional<uint32_t>
154 MDNode *MD =
F.getMetadata(
"llvm.amdgcn.lds.kernel.id");
157 mdconst::extract<ConstantInt>(MD->
getOperand(0))) {
158 uint64_t ZExt = KnownSize->getZExtValue();
159 if (ZExt <= UINT32_MAX) {
167std::optional<uint32_t>
176 if (
const APInt *V = AbsSymRange->getSingleElement()) {
177 std::optional<uint64_t> ZExt = V->tryZExtValue();
178 if (ZExt && (*ZExt <= UINT32_MAX)) {
188 const Module *M =
F.getParent();
208 if (!Expect || (
Offset != *Expect)) {
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static const GlobalVariable * getKernelDynLDSGlobalFromFunction(const Function &F)
Analyzes if a function potentially memory bound and if a kernel kernel may benefit from limiting numb...
Base class for AMDGPU specific classes of TargetSubtarget.
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.
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.
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.
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.
@ REGION_ADDRESS
Address space for region memory. (GDS)
@ LOCAL_ADDRESS
Address space for local memory.
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.