LLVM 17.0.0git
AMDGPUMachineFunction.h
Go to the documentation of this file.
1//===-- AMDGPUMachineFunctionInfo.h -------------------------------*- C++ -*-=//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
10#define LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
11
13#include "llvm/ADT/DenseMap.h"
15#include "llvm/IR/DataLayout.h"
16#include "llvm/IR/Function.h"
17#include "llvm/IR/GlobalValue.h"
19
20namespace llvm {
21
22class AMDGPUSubtarget;
23class GCNSubtarget;
24
26 /// A map to keep track of local memory objects and their offsets within the
27 /// local memory space.
29
30protected:
31 uint64_t ExplicitKernArgSize = 0; // Cache for this.
32 Align MaxKernArgAlign; // Cache for this.
33
34 /// Number of bytes in the LDS that are being used.
37
38 /// Number of bytes in the LDS allocated statically. This field is only used
39 /// in the instruction selector and not part of the machine function info.
42
43 /// Align for dynamic shared memory if any. Dynamic shared memory is
44 /// allocated directly after the static one, i.e., LDSSize. Need to pad
45 /// LDSSize to ensure that dynamic one is aligned accordingly.
46 /// The maximal alignment is updated during IR translation or lowering
47 /// stages.
49
50 // Kernels + shaders. i.e. functions called by the hardware and not called
51 // by other functions.
52 bool IsEntryFunction = false;
53
54 // Entry points called by other functions instead of directly by the hardware.
56
57 bool NoSignedZerosFPMath = false;
58
59 // Function may be memory bound.
60 bool MemoryBound = false;
61
62 // Kernel may need limited waves per EU for better performance.
63 bool WaveLimiter = false;
64
65public:
67
70 }
71
73
75 return LDSSize;
76 }
77
79 return GDSSize;
80 }
81
82 bool isEntryFunction() const {
83 return IsEntryFunction;
84 }
85
87
90 }
91
92 bool isMemoryBound() const {
93 return MemoryBound;
94 }
95
96 bool needsWaveLimiter() const {
97 return WaveLimiter;
98 }
99
100 unsigned allocateLDSGlobal(const DataLayout &DL, const GlobalVariable &GV) {
101 return allocateLDSGlobal(DL, GV, DynLDSAlign);
102 }
103
104 unsigned allocateLDSGlobal(const DataLayout &DL, const GlobalVariable &GV,
105 Align Trailing);
106
108
109 static std::optional<uint32_t> getLDSKernelIdMetadata(const Function &F);
110 static std::optional<uint32_t> getLDSAbsoluteAddress(const GlobalValue &GV);
111
112 Align getDynLDSAlign() const { return DynLDSAlign; }
113
114 void setDynLDSAlign(const Function &F, const GlobalVariable &GV);
115};
116
117}
118#endif
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
#define AMDGPUSubtarget
This file defines the DenseMap class.
#define F(x, y, z)
Definition: MD5.cpp:55
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.
void setDynLDSAlign(const Function &F, const GlobalVariable &GV)
static std::optional< uint32_t > getLDSAbsoluteAddress(const GlobalValue &GV)
unsigned allocateLDSGlobal(const DataLayout &DL, const GlobalVariable &GV)
uint32_t StaticLDSSize
Number of bytes in the LDS allocated statically.
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:110
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...