24#define DEBUG_TYPE "amdgpu-mark-last-scratch-load"
28class AMDGPUMarkLastScratchLoad {
37 : LS(LS), LIS(LIS),
SI(
SI) {}
58 return "AMDGPU Mark Last Scratch Load";
64bool AMDGPUMarkLastScratchLoadLegacy::runOnMachineFunction(
69 auto &
LS = getAnalysis<LiveStacksWrapperLegacy>().getLS();
70 auto &LIS = getAnalysis<LiveIntervalsWrapperPass>().getLIS();
71 auto &
SI = getAnalysis<SlotIndexesWrapperPass>().getSI();
73 return AMDGPUMarkLastScratchLoad(&LS, &LIS, &SI).run(MF);
83 AMDGPUMarkLastScratchLoad(&LS, &LIS, &
SI).
run(MF);
92 SII = ST.getInstrInfo();
105 for (
auto &[SS, LI] : *LS) {
113 const int FrameIndex = LI.reg().stackSlotIndex();
122 MISegmentEnd =
SI->getInstructionFromIndex(NextSlot);
126 MachineBasicBlock *BB = MISegmentEnd->
getParent();
130 auto End = BB->
rend();
131 if (MISegmentStart && MISegmentStart->
getParent() == BB)
155char AMDGPUMarkLastScratchLoadLegacy::ID = 0;
160 "AMDGPU Mark last scratch load",
false,
false)
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)
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &AM)
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
void setPreservesAll()
Set by analyses that do not transform their input at all.
SlotIndexes * getSlotIndexes() const
unsigned getNumIntervals() const
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.
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.
void setFlags(Flags f)
Bitwise OR the current flags with the given flags.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Register isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const override
SlotIndex - An opaque wrapper around machine indexes.
bool isBlock() const
isBlock - Returns true if this is a block boundary slot.
LLVM_ABI Result run(MachineFunction &MF, MachineFunctionAnalysisManager &)
SlotIndex getNextNonNullIndex(SlotIndex Index)
Returns the next non-null index, if one exists.
MachineInstr * getInstructionFromIndex(SlotIndex index) const
Returns the instruction for the given index, or null if the given index has no instruction associated...
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.
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
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.