LLVM  14.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 SIInstrInfo;
17 class SIMachineFunctionInfo;
18 class SIRegisterInfo;
19 class GCNSubtarget;
20 
21 class SIFrameLowering final : public AMDGPUFrameLowering {
22 public:
24  Align TransAl = Align(1))
25  : AMDGPUFrameLowering(D, StackAl, LAO, TransAl) {}
26  ~SIFrameLowering() override = default;
27 
29  MachineBasicBlock &MBB) const;
31  MachineBasicBlock &MBB) const override;
33  MachineBasicBlock &MBB) const override;
35  Register &FrameReg) const override;
36 
37  void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
38  RegScavenger *RS = nullptr) const override;
40  RegScavenger *RS = nullptr) const;
41  bool
43  const TargetRegisterInfo *TRI,
44  std::vector<CalleeSavedInfo> &CSI) const override;
45 
46  bool isSupportedStackID(TargetStackID::Value ID) const override;
47 
49  MachineFunction &MF,
50  RegScavenger *RS = nullptr) const override;
51 
55  MachineBasicBlock::iterator MI) const override;
56 
57 private:
58  void emitEntryFunctionFlatScratchInit(MachineFunction &MF,
61  const DebugLoc &DL,
62  Register ScratchWaveOffsetReg) const;
63 
64  Register getEntryFunctionReservedScratchRsrcReg(MachineFunction &MF) const;
65 
66  void emitEntryFunctionScratchRsrcRegSetup(
69  Register PreloadedPrivateBufferReg, Register ScratchRsrcReg,
70  Register ScratchWaveOffsetReg) const;
71 
72 public:
73  bool hasFP(const MachineFunction &MF) const override;
74 
75  bool requiresStackPointerReference(const MachineFunction &MF) const;
76 };
77 
78 } // end namespace llvm
79 
80 #endif // LLVM_LIB_TARGET_AMDGPU_SIFRAMELOWERING_H
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:105
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::SIFrameLowering::emitEpilogue
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override
Definition: SIFrameLowering.cpp:978
llvm::TargetRegisterInfo
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Definition: TargetRegisterInfo.h:233
llvm::AMDGPUFrameLowering
Information about the stack frame layout on the AMDGPU targets.
Definition: AMDGPUFrameLowering.h:26
TRI
unsigned const TargetRegisterInfo * TRI
Definition: MachineSink.cpp:1567
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:1405
llvm::SIFrameLowering::requiresStackPointerReference
bool requiresStackPointerReference(const MachineFunction &MF) const
Definition: SIFrameLowering.cpp:1431
llvm::SIFrameLowering::SIFrameLowering
SIFrameLowering(StackDirection D, Align StackAl, int LAO, Align TransAl=Align(1))
Definition: SIFrameLowering.h:23
llvm::BitVector
Definition: BitVector.h:74
Align
uint64_t Align
Definition: ELFObjHandler.cpp:83
llvm::SIFrameLowering
Definition: SIFrameLowering.h:21
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
llvm::MachineBasicBlock
Definition: MachineBasicBlock.h:95
llvm::SIFrameLowering::assignCalleeSavedSpillSlots
bool assignCalleeSavedSpillSlots(MachineFunction &MF, const TargetRegisterInfo *TRI, std::vector< CalleeSavedInfo > &CSI) const override
Definition: SIFrameLowering.cpp:1319
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:735
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:1227
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::RegScavenger
Definition: RegisterScavenging.h:34
AMDGPUFrameLowering.h
llvm::MachineFunction
Definition: MachineFunction.h:234
llvm::SIFrameLowering::isSupportedStackID
bool isSupportedStackID(TargetStackID::Value ID) const override
Definition: SIFrameLowering.cpp:669
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:1139
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:1286
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:1357
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:395
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:1130
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:37