LLVM 22.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#include "SIRegisterInfo.h"
14
15namespace llvm {
16
18public:
20 Align TransAl = Align(1))
21 : AMDGPUFrameLowering(D, StackAl, LAO, TransAl) {}
22 ~SIFrameLowering() override = default;
23
25 MachineBasicBlock &MBB) const;
27 MachineBasicBlock &MBB) const override;
29 MachineBasicBlock &MBB) const override;
31 Register &FrameReg) const override;
32
34 RegScavenger *RS = nullptr) const override;
36 RegScavenger *RS = nullptr) const;
38 bool NeedExecCopyReservedReg) const;
41 LiveRegUnits &LiveUnits, Register FrameReg,
42 Register FramePtrRegScratchCopy) const;
45 LiveRegUnits &LiveUnits, Register FrameReg,
46 Register FramePtrRegScratchCopy) const;
47 bool
50 std::vector<CalleeSavedInfo> &CSI) const override;
51
54 std::vector<CalleeSavedInfo> &CSI,
55 unsigned &MinCSFrameIndex,
56 unsigned &MaxCSFrameIndex) const override;
57
61 const TargetRegisterInfo *TRI) const override;
62
63 bool
67 const TargetRegisterInfo *TRI) const override;
68
70 const MachineFunction &MF) const override;
71
72 bool isSupportedStackID(TargetStackID::Value ID) const override;
73
76 RegScavenger *RS = nullptr) const override;
77
79 MachineFunction &MF, RegScavenger *RS = nullptr) const override;
80
84 MachineBasicBlock::iterator MI) const override;
85
86protected:
87 bool hasFPImpl(const MachineFunction &MF) const override;
88
89private:
90 void emitEntryFunctionFlatScratchInit(MachineFunction &MF,
93 const DebugLoc &DL,
94 Register ScratchWaveOffsetReg) const;
95
96 Register getEntryFunctionReservedScratchRsrcReg(MachineFunction &MF) const;
97
98 void emitEntryFunctionScratchRsrcRegSetup(
101 Register PreloadedPrivateBufferReg, Register ScratchRsrcReg,
102 Register ScratchWaveOffsetReg) const;
103
104public:
106
107 // Returns true if the function may need to reserve space on the stack for the
108 // CWSR trap handler.
109 bool mayReserveScratchForCWSR(const MachineFunction &MF) const;
110};
111
112} // end namespace llvm
113
114#endif // LLVM_LIB_TARGET_AMDGPU_SIFRAMELOWERING_H
Interface to describe a layout of a stack frame on an AMDGPU target.
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
IRTranslator LLVM IR MI
#define I(x, y, z)
Definition MD5.cpp:58
Register const TargetRegisterInfo * TRI
Interface definition for SIRegisterInfo.
AMDGPUFrameLowering(StackDirection D, Align StackAl, int LAO, Align TransAl=Align(1))
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:41
A debug info location.
Definition DebugLoc.h:124
A set of register units used to track register liveness.
MachineInstrBundleIterator< MachineInstr > iterator
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Definition ArrayRef.h:303
Wrapper class representing virtual and physical registers.
Definition Register.h:19
void determinePrologEpilogSGPRSaves(MachineFunction &MF, BitVector &SavedRegs, bool NeedExecCopyReservedReg) const
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...
void processFunctionBeforeFrameFinalized(MachineFunction &MF, RegScavenger *RS=nullptr) const override
processFunctionBeforeFrameFinalized - This method is called immediately before the specified function...
bool mayReserveScratchForCWSR(const MachineFunction &MF) const
bool allocateScavengingFrameIndexesNearIncomingSP(const MachineFunction &MF) const override
Control the placement of special register scavenging spill slots when allocating a stack frame.
SIFrameLowering(StackDirection D, Align StackAl, int LAO, Align TransAl=Align(1))
bool requiresStackPointerReference(const MachineFunction &MF) const
void emitEntryFunctionPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const
void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS=nullptr) const override
This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() sh...
void emitCSRSpillStores(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, DebugLoc &DL, LiveRegUnits &LiveUnits, Register FrameReg, Register FramePtrRegScratchCopy) const
bool hasFPImpl(const MachineFunction &MF) const override
bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, ArrayRef< CalleeSavedInfo > CSI, const TargetRegisterInfo *TRI) const override
spillCalleeSavedRegisters - Issues instruction(s) to spill all callee saved registers and returns tru...
bool assignCalleeSavedSpillSlots(MachineFunction &MF, const TargetRegisterInfo *TRI, std::vector< CalleeSavedInfo > &CSI) const override
void determineCalleeSavesSGPR(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS=nullptr) const
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override
void emitCSRSpillRestores(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, DebugLoc &DL, LiveRegUnits &LiveUnits, Register FrameReg, Register FramePtrRegScratchCopy) const
~SIFrameLowering() override=default
void processFunctionBeforeFrameIndicesReplaced(MachineFunction &MF, RegScavenger *RS=nullptr) const override
processFunctionBeforeFrameIndicesReplaced - This method is called immediately before MO_FrameIndex op...
bool isSupportedStackID(TargetStackID::Value ID) const override
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.
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...
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, MutableArrayRef< CalleeSavedInfo > CSI, const TargetRegisterInfo *TRI) const override
restoreCalleeSavedRegisters - Issues instruction(s) to restore all callee saved registers and returns...
StackOffset holds a fixed and a scalable offset in bytes.
Definition TypeSize.h:31
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
This is an optimization pass for GlobalISel generic memory operations.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39