24#define DEBUG_TYPE "amdgpu-mark-last-scratch-load"
53 return "AMDGPU Mark Last Scratch Load";
59bool AMDGPUMarkLastScratchLoad::runOnMachineFunction(
MachineFunction &MF) {
67 LS = &getAnalysis<LiveStacksWrapperLegacy>().getLS();
68 LIS = &getAnalysis<LiveIntervalsWrapperPass>().getLIS();
69 SI = &getAnalysis<SlotIndexesWrapperPass>().getSI();
70 SII =
ST.getInstrInfo();
73 const unsigned NumSlots =
LS->getNumIntervals();
83 for (
auto &[SS, LI] : *LS) {
100 MISegmentEnd =
SI->getInstructionFromIndex(NextSlot);
109 if (MISegmentStart && MISegmentStart->
getParent() == BB)
115 if (SII->isLoadFromStackSlot(*
MI, LoadFI) && LoadFI == FrameIndex) {
133char AMDGPUMarkLastScratchLoad::ID = 0;
138 "AMDGPU Mark last scratch load",
false,
false)
AMDGPU Mark last scratch load
AMD GCN specific subclass of TargetSubtarget.
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
void setPreservesAll()
Set by analyses that do not transform their input at all.
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.
Function & getFunction()
Return the LLVM function that this machine code represents.
Representation of each machine instruction.
const MachineBasicBlock * getParent() const
bool memoperands_empty() const
Return true if we don't have any memory operands which described the memory access done by this instr...
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.
A description of a memory reference used in the backend.
void setFlags(Flags f)
Bitwise OR the current flags with the given flags.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
static int stackSlot2Index(Register Reg)
Compute the frame index from a register value representing a stack slot.
SlotIndex - An opaque wrapper around machine indexes.
bool isBlock() const
isBlock - Returns true if this is a block boundary slot.
SlotIndex getNextNonNullIndex(SlotIndex Index)
Returns the next non-null index, if one exists.
StringRef - Represent a constant reference to a string, i.e.
reverse_self_iterator getReverseIterator()
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void initializeAMDGPUMarkLastScratchLoadPass(PassRegistry &)
static const MachineMemOperand::Flags MOLastUse
Mark the MMO of a load as the last use.
char & AMDGPUMarkLastScratchLoadID
This represents a simple continuous liveness interval for a value.