LLVM  16.0.0git
SIFrameLowering.h
Go to the documentation of this file.
1 //===--------------------- SIFrameLowering.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_SIFRAMELOWERING_H
10 #define LLVM_LIB_TARGET_AMDGPU_SIFRAMELOWERING_H
11 
12 #include "AMDGPUFrameLowering.h"
13 
14 namespace llvm {
15 
16 class SIFrameLowering final : public AMDGPUFrameLowering {
17 public:
19  Align TransAl = Align(1))
20  : AMDGPUFrameLowering(D, StackAl, LAO, TransAl) {}
21  ~SIFrameLowering() override = default;
22 
24  MachineBasicBlock &MBB) const;
26  MachineBasicBlock &MBB) const override;
28  MachineBasicBlock &MBB) const override;
30  Register &FrameReg) const override;
31 
32  void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
33  RegScavenger *RS = nullptr) const override;
35  RegScavenger *RS = nullptr) const;
36  bool
38  const TargetRegisterInfo *TRI,
39  std::vector<CalleeSavedInfo> &CSI) const override;
40 
42  const MachineFunction &MF) const override;
43 
44  bool isSupportedStackID(TargetStackID::Value ID) const override;
45 
47  MachineFunction &MF,
48  RegScavenger *RS = nullptr) const override;
49 
51  MachineFunction &MF, RegScavenger *RS = nullptr) const override;
52 
56  MachineBasicBlock::iterator MI) const override;
57 
58 private:
59  void emitEntryFunctionFlatScratchInit(MachineFunction &MF,
62  const DebugLoc &DL,
63  Register ScratchWaveOffsetReg) const;
64 
65  Register getEntryFunctionReservedScratchRsrcReg(MachineFunction &MF) const;
66 
67  void emitEntryFunctionScratchRsrcRegSetup(
70  Register PreloadedPrivateBufferReg, Register ScratchRsrcReg,
71  Register ScratchWaveOffsetReg) const;
72 
73 public:
74  bool hasFP(const MachineFunction &MF) const override;
75 
76  bool requiresStackPointerReference(const MachineFunction &MF) const;
77 };
78 
79 } // end namespace llvm
80 
81 #endif // LLVM_LIB_TARGET_AMDGPU_SIFRAMELOWERING_H
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:109
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::SIFrameLowering::emitEpilogue
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override
Definition: SIFrameLowering.cpp:960
llvm::TargetRegisterInfo
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Definition: TargetRegisterInfo.h:236
llvm::AMDGPUFrameLowering
Information about the stack frame layout on the AMDGPU targets.
Definition: AMDGPUFrameLowering.h:26
TRI
unsigned const TargetRegisterInfo * TRI
Definition: MachineSink.cpp:1628
llvm::TargetFrameLowering::StackDirection
StackDirection
Definition: TargetFrameLowering.h:45
llvm::SIFrameLowering::hasFP
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register.
Definition: SIFrameLowering.cpp:1472
llvm::SIFrameLowering::requiresStackPointerReference
bool requiresStackPointerReference(const MachineFunction &MF) const
Definition: SIFrameLowering.cpp:1498
llvm::SIFrameLowering::SIFrameLowering
SIFrameLowering(StackDirection D, Align StackAl, int LAO, Align TransAl=Align(1))
Definition: SIFrameLowering.h:18
llvm::BitVector
Definition: BitVector.h:75
Align
uint64_t Align
Definition: ELFObjHandler.cpp:82
llvm::SIFrameLowering::allocateScavengingFrameIndexesNearIncomingSP
bool allocateScavengingFrameIndexesNearIncomingSP(const MachineFunction &MF) const override
Control the placement of special register scavenging spill slots when allocating a stack frame.
Definition: SIFrameLowering.cpp:1395
llvm::SIFrameLowering
Definition: SIFrameLowering.h:16
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
llvm::MachineBasicBlock
Definition: MachineBasicBlock.h:94
llvm::SIFrameLowering::assignCalleeSavedSpillSlots
bool assignCalleeSavedSpillSlots(MachineFunction &MF, const TargetRegisterInfo *TRI, std::vector< CalleeSavedInfo > &CSI) const override
Definition: SIFrameLowering.cpp:1357
llvm::SIFrameLowering::emitPrologue
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.
Definition: SIFrameLowering.cpp:743
llvm::SIFrameLowering::determineCalleeSaves
void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS=nullptr) const override
This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() sh...
Definition: SIFrameLowering.cpp:1253
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::RegScavenger
Definition: RegisterScavenging.h:34
llvm::SIFrameLowering::processFunctionBeforeFrameIndicesReplaced
void processFunctionBeforeFrameIndicesReplaced(MachineFunction &MF, RegScavenger *RS=nullptr) const override
processFunctionBeforeFrameIndicesReplaced - This method is called immediately before MO_FrameIndex op...
Definition: SIFrameLowering.cpp:1226
AMDGPUFrameLowering.h
llvm::MachineFunction
Definition: MachineFunction.h:257
llvm::SIFrameLowering::isSupportedStackID
bool isSupportedStackID(TargetStackID::Value ID) const override
Definition: SIFrameLowering.cpp:676
llvm::StackOffset
StackOffset is a class to represent an offset with 2 dimensions, named fixed and scalable,...
Definition: TypeSize.h:134
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::SIFrameLowering::processFunctionBeforeFrameFinalized
void processFunctionBeforeFrameFinalized(MachineFunction &MF, RegScavenger *RS=nullptr) const override
processFunctionBeforeFrameFinalized - This method is called immediately before the specified function...
Definition: SIFrameLowering.cpp:1115
llvm::Register
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
MBB
MachineBasicBlock & MBB
Definition: AArch64SLSHardening.cpp:74
llvm::SIFrameLowering::determineCalleeSavesSGPR
void determineCalleeSavesSGPR(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS=nullptr) const
Definition: SIFrameLowering.cpp:1312
llvm::SIFrameLowering::eliminateCallFramePseudoInstr
MachineBasicBlock::iterator eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const override
This method is called during prolog/epilog code insertion to eliminate call frame setup and destroy p...
Definition: SIFrameLowering.cpp:1423
llvm::SIFrameLowering::~SIFrameLowering
~SIFrameLowering() override=default
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::SIFrameLowering::emitEntryFunctionPrologue
void emitEntryFunctionPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const
Definition: SIFrameLowering.cpp:403
llvm::DebugLoc
A debug info location.
Definition: DebugLoc.h:33
llvm::MachineInstrBundleIterator< MachineInstr >
llvm::SIFrameLowering::getFrameIndexReference
StackOffset getFrameIndexReference(const MachineFunction &MF, int FI, Register &FrameReg) const override
getFrameIndexReference - This method should return the base register and offset used to reference a f...
Definition: SIFrameLowering.cpp:1106