25#define DEBUG_TYPE "release-vgprs"
47 class LastVGPRUseIsVMEMStore {
50 static std::optional<bool>
75 for (
const auto &
MBB : MF) {
76 auto LastUseIsStore = lastVGPRUseIsStore(
MBB);
77 if (!LastUseIsStore.has_value())
80 if (*LastUseIsStore) {
87 for (
const auto *
MBB : EndWithVMEMStoreBlocks) {
89 BlockVMEMStore[Succ->getNumber()] =
true;
103 const LastVGPRUseIsVMEMStore &BlockVMEMStore) {
105 bool Changed =
false;
109 if (
MI.getOpcode() == AMDGPU::S_ENDPGM ||
110 MI.getOpcode() == AMDGPU::S_ENDPGM_SAVED) {
114 if (BlockVMEMStore.isLastVGPRUseVMEMStore(
MBB)) {
127 if (
skipFunction(
F) || !AMDGPU::isEntryFunctionCC(
F.getCallingConv()))
139 LastVGPRUseIsVMEMStore BlockVMEMStore(MF);
141 bool Changed =
false;
142 for (
auto &
MBB : MF) {
143 Changed |= runOnMachineBasicBlock(
MBB, SII, BlockVMEMStore);
152char AMDGPUReleaseVGPRs::ID = 0;
Provides AMDGPU specific target descriptions.
Base class for AMDGPU specific classes of TargetSubtarget.
This file builds on the ADT/GraphTraits.h file to build generic depth first graph iterator.
AMD GCN specific subclass of TargetSubtarget.
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Represent the analysis usage information of a pass.
void setPreservesAll()
Set by analyses that do not transform their input at all.
bool skipFunction(const Function &F) const
Optional passes call this function to check whether the pass should be skipped.
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
iterator_range< iterator > terminators()
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
virtual bool runOnMachineFunction(MachineFunction &MF)=0
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
Function & getFunction()
Return the LLVM function that this machine code represents.
unsigned getNumBlockIDs() const
getNumBlockIDs - Return the number of MBB ID's allocated.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
static bool isDS(const MachineInstr &MI)
static bool isVMEM(const MachineInstr &MI)
static bool isEXP(const MachineInstr &MI)
static bool isFLAT(const MachineInstr &MI)
static bool isVALU(const MachineInstr &MI)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
@ ID_DEALLOC_VGPRS_GFX11Plus
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
iterator_range< df_ext_iterator< T, SetTy > > depth_first_ext(const T &G, SetTy &S)
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
char & AMDGPUReleaseVGPRsID
auto reverse(ContainerTy &&C)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
std::pair< iterator, bool > insert(NodeRef N)