LLVM 23.0.0git
SIFrameLowering.cpp File Reference

Go to the source code of this file.

Classes

class  llvm::PrologEpilogSGPRSpillBuilder

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.

Macros

#define DEBUG_TYPE   "frame-info"

Functions

static MCRegister findUnusedRegister (MachineRegisterInfo &MRI, const LiveRegUnits &LiveUnits, const TargetRegisterClass &RC)
static void encodeDwarfRegisterLocation (int DwarfReg, raw_ostream &OS)
static MCCFIInstruction createScaledCFAInPrivateWave (const GCNSubtarget &ST, MCRegister DwarfStackPtrReg)
static MCRegister findScratchNonCalleeSaveRegister (MachineRegisterInfo &MRI, LiveRegUnits &LiveUnits, const TargetRegisterClass &RC, bool Unused=false)
static void getVGPRSpillLaneOrTempRegister (MachineFunction &MF, LiveRegUnits &LiveUnits, Register SGPR, const TargetRegisterClass &RC=AMDGPU::SReg_32_XM0_XEXECRegClass, bool IncludeScratchCopy=true)
 Query target location for spilling SGPRs IncludeScratchCopy : Also look for free scratch SGPRs.
static void buildPrologSpill (const GCNSubtarget &ST, const SIRegisterInfo &TRI, const SIMachineFunctionInfo &FuncInfo, LiveRegUnits &LiveUnits, MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, Register SpillReg, int FI, Register FrameReg, int64_t DwordOff=0)
static void buildEpilogRestore (const GCNSubtarget &ST, const SIRegisterInfo &TRI, const SIMachineFunctionInfo &FuncInfo, LiveRegUnits &LiveUnits, MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, Register SpillReg, int FI, Register FrameReg, int64_t DwordOff=0)
static void buildGitPtr (MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, const SIInstrInfo *TII, Register TargetReg)
static void initLiveUnits (LiveRegUnits &LiveUnits, const SIRegisterInfo &TRI, const SIMachineFunctionInfo *FuncInfo, MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, bool IsProlog)
static bool allStackObjectsAreDead (const MachineFrameInfo &MFI)
static unsigned getScratchScaleFactor (const GCNSubtarget &ST)
static Register buildScratchExecCopy (LiveRegUnits &LiveUnits, MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &DL, bool IsProlog, bool EnableInactiveLanes)
static bool allSGPRSpillsAreDead (const MachineFunction &MF)
static void assignSlotsUsingVGPRBlocks (MachineFunction &MF, const GCNSubtarget &ST, std::vector< CalleeSavedInfo > &CSI)
static SparseBitVector buildLiveInRoots (const MachineBasicBlock &MBB, const SIRegisterInfo &TRI)
 Return the set of all root registers of regunits live-in to MBB.
static bool isAnyRootLiveIn (const SparseBitVector<> &LiveInRoots, const SIRegisterInfo &TRI, MCRegister Reg)
 Returns true iff any root of Reg is in LiveInRoots (see buildLiveInRoots).
static bool frameTriviallyRequiresSP (const MachineFrameInfo &MFI)
 Returns true if the frame will require a reference to the stack pointer.

Variables

static cl::opt< boolEnableSpillVGPRToAGPR ("amdgpu-spill-vgpr-to-agpr", cl::desc("Enable spilling VGPRs to AGPRs"), cl::ReallyHidden, cl::init(true))
static constexpr unsigned SGPRBitSize = 32
static constexpr unsigned SGPRByteSize = SGPRBitSize / 8
static constexpr unsigned VGPRLaneBitSize = 32

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "frame-info"

Definition at line 26 of file SIFrameLowering.cpp.

Function Documentation

◆ allSGPRSpillsAreDead()

◆ allStackObjectsAreDead()

◆ assignSlotsUsingVGPRBlocks()

◆ buildEpilogRestore()

◆ buildGitPtr()

◆ buildLiveInRoots()

SparseBitVector buildLiveInRoots ( const MachineBasicBlock & MBB,
const SIRegisterInfo & TRI )
static

Return the set of all root registers of regunits live-in to MBB.

Intended to avoid using the expensive MCRegAliasIterator when deciding if a register to be spilled is already live-in (see isAnyRootLiveIn).

Definition at line 2249 of file SIFrameLowering.cpp.

References llvm::MCRegUnitRootIterator::isValid(), MBB, MI, llvm::SparseBitVector< ElementSize >::set(), and TRI.

Referenced by llvm::SIFrameLowering::spillCalleeSavedRegisters().

◆ buildPrologSpill()

◆ buildScratchExecCopy()

◆ createScaledCFAInPrivateWave()

◆ encodeDwarfRegisterLocation()

void encodeDwarfRegisterLocation ( int DwarfReg,
raw_ostream & OS )
static

Definition at line 54 of file SIFrameLowering.cpp.

References assert(), and llvm::encodeULEB128().

Referenced by createScaledCFAInPrivateWave().

◆ findScratchNonCalleeSaveRegister()

◆ findUnusedRegister()

◆ frameTriviallyRequiresSP()

bool frameTriviallyRequiresSP ( const MachineFrameInfo & MFI)
static

Returns true if the frame will require a reference to the stack pointer.

This is the set of conditions common to setting up the stack pointer in a kernel, and for using a frame pointer in a callable function.

FIXME: Should also check hasOpaqueSPAdjustment and if any inline asm references SP.

Definition at line 2464 of file SIFrameLowering.cpp.

References llvm::MachineFrameInfo::hasPatchPoint(), llvm::MachineFrameInfo::hasStackMap(), and llvm::MachineFrameInfo::hasVarSizedObjects().

Referenced by llvm::SIFrameLowering::hasFPImpl(), and llvm::SIFrameLowering::requiresStackPointerReference().

◆ getScratchScaleFactor()

◆ getVGPRSpillLaneOrTempRegister()

◆ initLiveUnits()

◆ isAnyRootLiveIn()

bool isAnyRootLiveIn ( const SparseBitVector<> & LiveInRoots,
const SIRegisterInfo & TRI,
MCRegister Reg )
static

Returns true iff any root of Reg is in LiveInRoots (see buildLiveInRoots).

Definition at line 2266 of file SIFrameLowering.cpp.

References llvm::MCRegUnitIterator::isValid(), llvm::MCRegUnitRootIterator::isValid(), Reg, llvm::SparseBitVector< ElementSize >::test(), and TRI.

Variable Documentation

◆ EnableSpillVGPRToAGPR

cl::opt< bool > EnableSpillVGPRToAGPR("amdgpu-spill-vgpr-to-agpr", cl::desc("Enable spilling VGPRs to AGPRs"), cl::ReallyHidden, cl::init(true)) ( "amdgpu-spill-vgpr-to-agpr" ,
cl::desc("Enable spilling VGPRs to AGPRs") ,
cl::ReallyHidden ,
cl::init(true)  )
static

◆ SGPRBitSize

unsigned SGPRBitSize = 32
staticconstexpr

◆ SGPRByteSize

unsigned SGPRByteSize = SGPRBitSize / 8
staticconstexpr

Definition at line 35 of file SIFrameLowering.cpp.

Referenced by createScaledCFAInPrivateWave().

◆ VGPRLaneBitSize