23 : IsEntryFunction(
AMDGPU::isEntryFunctionCC(
F.getCallingConv())),
24 IsModuleEntryFunction(
25 AMDGPU::isModuleEntryFunctionCC(
F.getCallingConv())),
26 NoSignedZerosFPMath(
false) {
31 Attribute MemBoundAttr =
F.getFnAttribute(
"amdgpu-memory-bound");
34 Attribute WaveLimitAttr =
F.getFnAttribute(
"amdgpu-wave-limiter");
39 StringRef S =
F.getFnAttribute(
"amdgpu-gds-size").getValueAsString();
51 Attribute NSZAttr =
F.getFnAttribute(
"no-signed-zeros-fp-math");
59 auto Entry = LocalMemoryObjects.insert(std::pair(&GV, 0));
61 return Entry.first->second;
79 "expected region address space");
88 Entry.first->second =
Offset;
95 const Module *M =
F.getParent();
96 std::string KernelLDSName =
"llvm.amdgcn.kernel.";
97 KernelLDSName +=
F.getName();
98 KernelLDSName +=
".lds";
99 return M->getNamedGlobal(KernelLDSName);
104 return F.hasFnAttribute(
"amdgpu-elide-module-lds");
108 const Module *M =
F.getParent();
138 if (!Expect || (
Offset != Expect)) {
148 if (!Expect || (
Offset != Expect)) {
155std::optional<uint32_t>
158 MDNode *MD =
F.getMetadata(
"llvm.amdgcn.lds.kernel.id");
161 mdconst::extract<ConstantInt>(MD->
getOperand(0))) {
162 uint64_t ZExt = KnownSize->getZExtValue();
163 if (ZExt <= UINT32_MAX) {
171std::optional<uint32_t>
180 if (
const APInt *V = AbsSymRange->getSingleElement()) {
181 std::optional<uint64_t> ZExt = V->tryZExtValue();
182 if (ZExt && (*ZExt <= UINT32_MAX)) {
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static constexpr StringLiteral ModuleLDSName
static bool canElideModuleLDS(const Function &F)
static const GlobalVariable * getKernelLDSGlobalFromFunction(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.
void allocateKnownAddressLDSGlobal(const Function &F)
uint32_t LDSSize
Number of bytes in the LDS that are being used.
static std::optional< uint32_t > getLDSAbsoluteAddress(const GlobalValue &GV)
void setDynLDSAlign(const DataLayout &DL, const GlobalVariable &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.
Align getDynLDSAlign() const
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.
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
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.
@ 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.