LLVM 18.0.0git
|
Information about stack frame layout on the target. More...
#include "llvm/CodeGen/TargetFrameLowering.h"
Classes | |
struct | DwarfFrameBase |
struct | SpillSlot |
Public Types | |
enum | StackDirection { StackGrowsUp , StackGrowsDown } |
Public Member Functions | |
TargetFrameLowering (StackDirection D, Align StackAl, int LAO, Align TransAl=Align(1), bool StackReal=true) | |
virtual | ~TargetFrameLowering () |
StackDirection | getStackGrowthDirection () const |
getStackGrowthDirection - Return the direction the stack grows | |
unsigned | getStackAlignment () const |
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligned on entry to a function. | |
Align | getStackAlign () const |
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligned on entry to a function. | |
virtual uint64_t | getStackThreshold () const |
getStackThreshold - Return the maximum stack size | |
int | alignSPAdjust (int SPAdj) const |
alignSPAdjust - This method aligns the stack adjustment to the correct alignment. | |
Align | getTransientStackAlign () const |
getTransientStackAlignment - This method returns the number of bytes to which the stack pointer must be aligned at all times, even between calls. | |
bool | isStackRealignable () const |
isStackRealignable - This method returns whether the stack can be realigned. | |
virtual bool | isStackIdSafeForLocalArea (unsigned StackId) const |
This method returns whether or not it is safe for an object with the given stack id to be bundled into the local area. | |
int | getOffsetOfLocalArea () const |
getOffsetOfLocalArea - This method returns the offset of the local area from the stack pointer on entrance to a function. | |
virtual bool | allocateScavengingFrameIndexesNearIncomingSP (const MachineFunction &MF) const |
Control the placement of special register scavenging spill slots when allocating a stack frame. | |
virtual bool | assignCalleeSavedSpillSlots (MachineFunction &MF, const TargetRegisterInfo *TRI, std::vector< CalleeSavedInfo > &CSI, unsigned &MinCSFrameIndex, unsigned &MaxCSFrameIndex) const |
assignCalleeSavedSpillSlots - Allows target to override spill slot assignment logic. | |
virtual bool | assignCalleeSavedSpillSlots (MachineFunction &MF, const TargetRegisterInfo *TRI, std::vector< CalleeSavedInfo > &CSI) const |
virtual const SpillSlot * | getCalleeSavedSpillSlots (unsigned &NumEntries) const |
getCalleeSavedSpillSlots - This method returns a pointer to an array of pairs, that contains an entry for each callee saved register that must be spilled to a particular stack location if it is spilled. | |
virtual bool | targetHandlesStackFrameRounding () const |
targetHandlesStackFrameRounding - Returns true if the target is responsible for rounding up the stack frame (probably at emitPrologue time). | |
virtual bool | enableShrinkWrapping (const MachineFunction &MF) const |
Returns true if the target will correctly handle shrink wrapping. | |
virtual bool | enableStackSlotScavenging (const MachineFunction &MF) const |
Returns true if the stack slot holes in the fixed and callee-save stack area should be used when allocating other stack locations to reduce stack size. | |
virtual bool | enableCalleeSaveSkip (const MachineFunction &MF) const |
Returns true if the target can safely skip saving callee-saved registers for noreturn nounwind functions. | |
virtual void | emitPrologue (MachineFunction &MF, MachineBasicBlock &MBB) const =0 |
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function. | |
virtual void | emitEpilogue (MachineFunction &MF, MachineBasicBlock &MBB) const =0 |
virtual void | emitZeroCallUsedRegs (BitVector RegsToZero, MachineBasicBlock &MBB) const |
emitZeroCallUsedRegs - Zeros out call used registers. | |
virtual void | emitCalleeSavedFrameMovesFullCFA (MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI) const |
With basic block sections, emit callee saved frame moves for basic blocks that are in a different section. | |
virtual bool | enableCFIFixup (MachineFunction &MF) const |
Returns true if we may need to fix the unwind information for the function. | |
virtual void | resetCFIToInitialState (MachineBasicBlock &MBB) const |
Emit CFI instructions that recreate the state of the unwind information upon fucntion entry. | |
virtual void | inlineStackProbe (MachineFunction &MF, MachineBasicBlock &PrologueMBB) const |
Replace a StackProbe stub (if any) with the actual probe code inline. | |
virtual bool | stackProbeFunctionModifiesSP () const |
Does the stack probe function call return with a modified stack pointer? | |
virtual void | adjustForSegmentedStacks (MachineFunction &MF, MachineBasicBlock &PrologueMBB) const |
Adjust the prologue to have the function use segmented stacks. | |
virtual void | adjustForHiPEPrologue (MachineFunction &MF, MachineBasicBlock &PrologueMBB) const |
Adjust the prologue to add Erlang Run-Time System (ERTS) specific code in the assembly prologue to explicitly handle the stack. | |
virtual bool | spillCalleeSavedRegisters (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, ArrayRef< CalleeSavedInfo > CSI, const TargetRegisterInfo *TRI) const |
spillCalleeSavedRegisters - Issues instruction(s) to spill all callee saved registers and returns true if it isn't possible / profitable to do so by issuing a series of store instructions via storeRegToStackSlot(). | |
virtual bool | restoreCalleeSavedRegisters (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, MutableArrayRef< CalleeSavedInfo > CSI, const TargetRegisterInfo *TRI) const |
restoreCalleeSavedRegisters - Issues instruction(s) to restore all callee saved registers and returns true if it isn't possible / profitable to do so by issuing a series of load instructions via loadRegToStackSlot(). | |
virtual bool | keepFramePointer (const MachineFunction &MF) const |
Return true if the target wants to keep the frame pointer regardless of the function attribute "frame-pointer". | |
virtual bool | hasFP (const MachineFunction &MF) const =0 |
hasFP - Return true if the specified function should have a dedicated frame pointer register. | |
virtual bool | hasReservedCallFrame (const MachineFunction &MF) const |
hasReservedCallFrame - Under normal circumstances, when a frame pointer is not required, we reserve argument space for call sites in the function immediately on entry to the current function. | |
virtual bool | canSimplifyCallFramePseudos (const MachineFunction &MF) const |
canSimplifyCallFramePseudos - When possible, it's best to simplify the call frame pseudo ops before doing frame index elimination. | |
virtual bool | needsFrameIndexResolution (const MachineFunction &MF) const |
virtual StackOffset | getFrameIndexReference (const MachineFunction &MF, int FI, Register &FrameReg) const |
getFrameIndexReference - This method should return the base register and offset used to reference a frame index location. | |
virtual StackOffset | getFrameIndexReferencePreferSP (const MachineFunction &MF, int FI, Register &FrameReg, bool IgnoreSPUpdates) const |
Same as getFrameIndexReference , except that the stack pointer (as opposed to the frame pointer) will be the preferred value for FrameReg . | |
virtual StackOffset | getNonLocalFrameIndexReference (const MachineFunction &MF, int FI) const |
getNonLocalFrameIndexReference - This method returns the offset used to reference a frame index location. | |
virtual void | getCalleeSaves (const MachineFunction &MF, BitVector &SavedRegs) const |
Returns the callee-saved registers as computed by determineCalleeSaves in the BitVector SavedRegs . | |
virtual void | determineCalleeSaves (MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS=nullptr) const |
This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() should actually get saved. | |
virtual void | processFunctionBeforeFrameFinalized (MachineFunction &MF, RegScavenger *RS=nullptr) const |
processFunctionBeforeFrameFinalized - This method is called immediately before the specified function's frame layout (MF.getFrameInfo()) is finalized. | |
virtual void | processFunctionBeforeFrameIndicesReplaced (MachineFunction &MF, RegScavenger *RS=nullptr) const |
processFunctionBeforeFrameIndicesReplaced - This method is called immediately before MO_FrameIndex operands are eliminated, but after the frame is finalized. | |
virtual unsigned | getWinEHParentFrameOffset (const MachineFunction &MF) const |
virtual MachineBasicBlock::iterator | eliminateCallFramePseudoInstr (MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const |
This method is called during prolog/epilog code insertion to eliminate call frame setup and destroy pseudo instructions (but only if the Target is using them). | |
virtual void | orderFrameObjects (const MachineFunction &MF, SmallVectorImpl< int > &objectsToAllocate) const |
Order the symbols in the local stack frame. | |
virtual bool | canUseAsPrologue (const MachineBasicBlock &MBB) const |
Check whether or not the given MBB can be used as a prologue for the target. | |
virtual bool | canUseAsEpilogue (const MachineBasicBlock &MBB) const |
Check whether or not the given MBB can be used as a epilogue for the target. | |
virtual TargetStackID::Value | getStackIDForScalableVectors () const |
Returns the StackID that scalable vectors should be associated with. | |
virtual bool | isSupportedStackID (TargetStackID::Value ID) const |
virtual bool | isProfitableForNoCSROpt (const Function &F) const |
Check if the no-CSR optimisation is profitable for the given function. | |
virtual int | getInitialCFAOffset (const MachineFunction &MF) const |
Return initial CFA offset value i.e. | |
virtual Register | getInitialCFARegister (const MachineFunction &MF) const |
Return initial CFA register value i.e. | |
virtual DwarfFrameBase | getDwarfFrameBase (const MachineFunction &MF) const |
Return the frame base information to be encoded in the DWARF subprogram debug info. | |
Static Public Member Functions | |
static bool | isSafeForNoCSROpt (const Function &F) |
Check if given function is safe for not having callee saved registers. | |
Information about stack frame layout on the target.
It holds the direction of stack growth, the known stack alignment on entry to each function, and the offset to the locals area.
The offset to the local area is the offset from the stack pointer on function entry to the first location where function data (local variables, spill locations) can be stored.
Definition at line 44 of file TargetFrameLowering.h.
Enumerator | |
---|---|
StackGrowsUp | |
StackGrowsDown |
Definition at line 46 of file TargetFrameLowering.h.
|
inline |
Definition at line 81 of file TargetFrameLowering.h.
|
virtualdefault |
|
inlinevirtual |
Adjust the prologue to add Erlang Run-Time System (ERTS) specific code in the assembly prologue to explicitly handle the stack.
Reimplemented in llvm::X86FrameLowering.
Definition at line 251 of file TargetFrameLowering.h.
|
inlinevirtual |
Adjust the prologue to have the function use segmented stacks.
This works by adding a check even before the "normal" function prologue.
Reimplemented in llvm::ARMFrameLowering, and llvm::X86FrameLowering.
Definition at line 246 of file TargetFrameLowering.h.
|
inline |
alignSPAdjust - This method aligns the stack adjustment to the correct alignment.
Definition at line 113 of file TargetFrameLowering.h.
References llvm::alignTo().
Referenced by llvm::CSKYFrameLowering::eliminateCallFramePseudoInstr(), llvm::LoongArchFrameLowering::eliminateCallFramePseudoInstr(), llvm::RISCVFrameLowering::eliminateCallFramePseudoInstr(), and llvm::TargetInstrInfo::getSPAdjust().
|
virtual |
Control the placement of special register scavenging spill slots when allocating a stack frame.
If this returns true, the frame indexes used by the RegScavenger will be allocated closest to the incoming stack pointer.
Reimplemented in llvm::SIFrameLowering, llvm::MipsFrameLowering, and llvm::SystemZFrameLowering.
Definition at line 133 of file TargetFrameLoweringImpl.cpp.
References llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), hasFP(), llvm::TargetRegisterInfo::hasStackRealignment(), and llvm::TargetRegisterInfo::useFPForScavengingIndex().
|
inlinevirtual |
Reimplemented in llvm::ARCFrameLowering, llvm::SIFrameLowering, llvm::ARMFrameLowering, llvm::CSKYFrameLowering, llvm::HexagonFrameLowering, llvm::M68kFrameLowering, llvm::PPCFrameLowering, llvm::SystemZELFFrameLowering, llvm::SystemZXPLINKFrameLowering, and llvm::X86FrameLowering.
Definition at line 168 of file TargetFrameLowering.h.
|
inlinevirtual |
assignCalleeSavedSpillSlots - Allows target to override spill slot assignment logic.
If implemented, assignCalleeSavedSpillSlots() should assign frame slots to all CSI entries and return true. If this method returns false, spill slots will be assigned using generic implementation. assignCalleeSavedSpillSlots() may add, delete or rearrange elements of CSI.
Reimplemented in llvm::AArch64FrameLowering.
Definition at line 159 of file TargetFrameLowering.h.
References assignCalleeSavedSpillSlots(), and TRI.
Referenced by assignCalleeSavedSpillSlots(), and assignCalleeSavedSpillSlots().
|
inlinevirtual |
canSimplifyCallFramePseudos - When possible, it's best to simplify the call frame pseudo ops before doing frame index elimination.
This is possible only when frame index references between the pseudos won't need adjusting for the call frame adjustments. Normally, that's true if the function has a reserved call frame or a frame pointer. Some targets (Thumb2, for example) may have more complicated criteria, however, and can override this behavior.
Reimplemented in llvm::ARMFrameLowering, llvm::AVRFrameLowering, llvm::HexagonFrameLowering, llvm::M68kFrameLowering, and llvm::X86FrameLowering.
Definition at line 306 of file TargetFrameLowering.h.
References hasFP(), and hasReservedCallFrame().
|
inlinevirtual |
Check whether or not the given MBB
can be used as a epilogue for the target.
The epilogue will be inserted before the first terminator of that block. This method is used by the shrink-wrapping pass to decide if MBB
will be correctly handled by the target. As soon as the target enable shrink-wrapping without overriding this method, we assume that each basic block is a valid epilogue.
Reimplemented in llvm::Thumb1FrameLowering, llvm::PPCFrameLowering, llvm::RISCVFrameLowering, and llvm::X86FrameLowering.
Definition at line 430 of file TargetFrameLowering.h.
|
inlinevirtual |
Check whether or not the given MBB
can be used as a prologue for the target.
The prologue will be inserted first in this basic block. This method is used by the shrink-wrapping pass to decide if MBB
will be correctly handled by the target. As soon as the target enable shrink-wrapping without overriding this method, we assume that each basic block is a valid prologue.
Reimplemented in llvm::AArch64FrameLowering, llvm::PPCFrameLowering, llvm::RISCVFrameLowering, and llvm::X86FrameLowering.
Definition at line 418 of file TargetFrameLowering.h.
|
virtual |
This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() should actually get saved.
The default implementation checks populates the SavedRegs
bitset with all registers which are modified in the function, targets may override this function to save additional registers. This method also sets up the register scavenger ensuring there is a free register or a frameindex available. This method should not be called by any passes outside of PEI, because it may change state passed in by MF
and RS
. The preferred interface outside PEI is getCalleeSaves.
Reimplemented in llvm::AArch64FrameLowering, llvm::ARCFrameLowering, llvm::ARMFrameLowering, llvm::BPFFrameLowering, llvm::CSKYFrameLowering, llvm::HexagonFrameLowering, llvm::LoongArchFrameLowering, llvm::Mips16FrameLowering, llvm::MipsSEFrameLowering, llvm::RISCVFrameLowering, llvm::SystemZELFFrameLowering, llvm::SystemZXPLINKFrameLowering, llvm::SIFrameLowering, llvm::AVRFrameLowering, llvm::LanaiFrameLowering, llvm::M68kFrameLowering, llvm::PPCFrameLowering, llvm::SparcFrameLowering, llvm::VEFrameLowering, llvm::X86FrameLowering, and llvm::XCoreFrameLowering.
Definition at line 82 of file TargetFrameLoweringImpl.cpp.
References llvm::MachineFunction::callsUnwindInit(), enableCalleeSaveSkip(), llvm::TargetOptions::EnableIPRA, llvm::MachineRegisterInfo::getCalleeSavedRegs(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getRegInfo(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), llvm::MachineFunction::getTarget(), llvm::Function::hasFnAttribute(), isProfitableForNoCSROpt(), isSafeForNoCSROpt(), MRI, llvm::TargetMachine::Options, llvm::BitVector::resize(), llvm::BitVector::set(), and TRI.
Referenced by llvm::AArch64FrameLowering::determineCalleeSaves(), llvm::ARCFrameLowering::determineCalleeSaves(), llvm::ARMFrameLowering::determineCalleeSaves(), llvm::BPFFrameLowering::determineCalleeSaves(), llvm::CSKYFrameLowering::determineCalleeSaves(), llvm::HexagonFrameLowering::determineCalleeSaves(), llvm::LoongArchFrameLowering::determineCalleeSaves(), llvm::Mips16FrameLowering::determineCalleeSaves(), llvm::MipsSEFrameLowering::determineCalleeSaves(), llvm::RISCVFrameLowering::determineCalleeSaves(), llvm::SystemZELFFrameLowering::determineCalleeSaves(), llvm::SystemZXPLINKFrameLowering::determineCalleeSaves(), llvm::SIFrameLowering::determineCalleeSaves(), llvm::AVRFrameLowering::determineCalleeSaves(), llvm::LanaiFrameLowering::determineCalleeSaves(), llvm::M68kFrameLowering::determineCalleeSaves(), llvm::PPCFrameLowering::determineCalleeSaves(), llvm::SparcFrameLowering::determineCalleeSaves(), llvm::VEFrameLowering::determineCalleeSaves(), llvm::X86FrameLowering::determineCalleeSaves(), llvm::XCoreFrameLowering::determineCalleeSaves(), and llvm::SIFrameLowering::determineCalleeSavesSGPR().
|
inlinevirtual |
This method is called during prolog/epilog code insertion to eliminate call frame setup and destroy pseudo instructions (but only if the Target is using them).
It is responsible for eliminating these instructions, replacing them with concrete instructions. This method need only be implemented if using call frame setup/destroy pseudo instructions. Returns an iterator pointing to the instruction after the replaced one.
Reimplemented in llvm::AArch64FrameLowering, llvm::ARCFrameLowering, llvm::HexagonFrameLowering, llvm::LanaiFrameLowering, llvm::MipsFrameLowering, llvm::MSP430FrameLowering, llvm::NVPTXFrameLowering, llvm::PPCFrameLowering, llvm::SparcFrameLowering, llvm::VEFrameLowering, llvm::WebAssemblyFrameLowering, llvm::XCoreFrameLowering, llvm::SIFrameLowering, llvm::Thumb1FrameLowering, llvm::AVRFrameLowering, llvm::BPFFrameLowering, llvm::CSKYFrameLowering, llvm::LoongArchFrameLowering, llvm::M68kFrameLowering, llvm::RISCVFrameLowering, llvm::SystemZFrameLowering, and llvm::X86FrameLowering.
Definition at line 391 of file TargetFrameLowering.h.
References llvm_unreachable.
|
inlinevirtual |
With basic block sections, emit callee saved frame moves for basic blocks that are in a different section.
Reimplemented in llvm::X86FrameLowering.
Definition at line 226 of file TargetFrameLowering.h.
|
pure virtual |
Implemented in llvm::DirectXFrameLowering, llvm::AArch64FrameLowering, llvm::R600FrameLowering, llvm::SIFrameLowering, llvm::ARCFrameLowering, llvm::ARMFrameLowering, llvm::Thumb1FrameLowering, llvm::AVRFrameLowering, llvm::BPFFrameLowering, llvm::CSKYFrameLowering, llvm::HexagonFrameLowering, llvm::LanaiFrameLowering, llvm::LoongArchFrameLowering, llvm::M68kFrameLowering, llvm::Mips16FrameLowering, llvm::MipsSEFrameLowering, llvm::MSP430FrameLowering, llvm::NVPTXFrameLowering, llvm::PPCFrameLowering, llvm::RISCVFrameLowering, llvm::SparcFrameLowering, llvm::SPIRVFrameLowering, llvm::SystemZELFFrameLowering, llvm::SystemZXPLINKFrameLowering, llvm::VEFrameLowering, llvm::WebAssemblyFrameLowering, llvm::X86FrameLowering, and llvm::XCoreFrameLowering.
|
pure virtual |
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.
Implemented in llvm::DirectXFrameLowering, llvm::AArch64FrameLowering, llvm::R600FrameLowering, llvm::SIFrameLowering, llvm::ARCFrameLowering, llvm::ARMFrameLowering, llvm::Thumb1FrameLowering, llvm::AVRFrameLowering, llvm::BPFFrameLowering, llvm::CSKYFrameLowering, llvm::HexagonFrameLowering, llvm::LanaiFrameLowering, llvm::LoongArchFrameLowering, llvm::M68kFrameLowering, llvm::Mips16FrameLowering, llvm::MipsSEFrameLowering, llvm::MSP430FrameLowering, llvm::NVPTXFrameLowering, llvm::PPCFrameLowering, llvm::RISCVFrameLowering, llvm::SparcFrameLowering, llvm::SPIRVFrameLowering, llvm::SystemZELFFrameLowering, llvm::SystemZXPLINKFrameLowering, llvm::VEFrameLowering, llvm::WebAssemblyFrameLowering, llvm::X86FrameLowering, and llvm::XCoreFrameLowering.
|
inlinevirtual |
emitZeroCallUsedRegs - Zeros out call used registers.
Definition at line 220 of file TargetFrameLowering.h.
|
virtual |
Returns true if the target can safely skip saving callee-saved registers for noreturn nounwind functions.
Reimplemented in llvm::ARMFrameLowering, and llvm::HexagonFrameLowering.
Definition at line 32 of file TargetFrameLoweringImpl.cpp.
References assert(), llvm::MachineFunction::getFunction(), and llvm::Function::hasFnAttribute().
Referenced by determineCalleeSaves().
|
virtual |
Returns true if we may need to fix the unwind information for the function.
Reimplemented in llvm::AArch64FrameLowering.
Definition at line 39 of file TargetFrameLoweringImpl.cpp.
References llvm::TargetMachine::getMCAsmInfo(), llvm::MachineFunction::getTarget(), llvm::MachineFunction::needsFrameMoves(), and llvm::MCAsmInfo::usesWindowsCFI().
Referenced by llvm::AArch64FrameLowering::enableCFIFixup(), and llvm::CFIFixup::runOnMachineFunction().
|
inlinevirtual |
Returns true if the target will correctly handle shrink wrapping.
Reimplemented in llvm::AArch64FrameLowering, llvm::ARMFrameLowering, llvm::Thumb1FrameLowering, llvm::LoongArchFrameLowering, llvm::MipsFrameLowering, llvm::PPCFrameLowering, llvm::RISCVFrameLowering, and llvm::X86FrameLowering.
Definition at line 197 of file TargetFrameLowering.h.
|
inlinevirtual |
Returns true if the stack slot holes in the fixed and callee-save stack area should be used when allocating other stack locations to reduce stack size.
Reimplemented in llvm::AArch64FrameLowering.
Definition at line 204 of file TargetFrameLowering.h.
|
inlinevirtual |
getCalleeSavedSpillSlots - This method returns a pointer to an array of pairs, that contains an entry for each callee saved register that must be spilled to a particular stack location if it is spilled.
Each entry in this array contains a <register,offset> pair, indicating the fixed offset from the incoming stack pointer that each register should be spilled at. If a register is not listed here, the code generator is allowed to spill it anywhere it chooses.
Reimplemented in llvm::ARMFrameLowering, llvm::HexagonFrameLowering, llvm::PPCFrameLowering, and llvm::VEFrameLowering.
Definition at line 184 of file TargetFrameLowering.h.
Referenced by assignCalleeSavedSpillSlots().
|
virtual |
Returns the callee-saved registers as computed by determineCalleeSaves in the BitVector SavedRegs
.
Reimplemented in llvm::ARMFrameLowering.
Definition at line 69 of file TargetFrameLoweringImpl.cpp.
References llvm::MachineFrameInfo::getCalleeSavedInfo(), llvm::MachineFunction::getFrameInfo(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), Info, llvm::MachineFrameInfo::isCalleeSavedInfoValid(), llvm::BitVector::resize(), llvm::BitVector::set(), and TRI.
Referenced by llvm::ARMFrameLowering::getCalleeSaves().
|
virtual |
Return the frame base information to be encoded in the DWARF subprogram debug info.
Reimplemented in llvm::NVPTXFrameLowering, llvm::WebAssemblyFrameLowering, and llvm::X86FrameLowering.
Definition at line 165 of file TargetFrameLoweringImpl.cpp.
References llvm::TargetRegisterInfo::getFrameRegister(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), and llvm::TargetFrameLowering::DwarfFrameBase::Register.
Referenced by llvm::DwarfCompileUnit::updateSubprogramScopeDIE().
|
virtual |
getFrameIndexReference - This method should return the base register and offset used to reference a frame index location.
Returns the displacement from the frame register to the stack frame of the specified index, along with the frame register used (in output arg FrameReg).
The offset is returned directly, and the base register is returned via FrameReg.
This is the default implementation which is overridden for some targets.
Reimplemented in llvm::AArch64FrameLowering, llvm::R600FrameLowering, llvm::SIFrameLowering, llvm::ARMFrameLowering, llvm::CSKYFrameLowering, llvm::HexagonFrameLowering, llvm::LoongArchFrameLowering, llvm::M68kFrameLowering, llvm::MipsSEFrameLowering, llvm::NVPTXFrameLowering, llvm::RISCVFrameLowering, llvm::SparcFrameLowering, llvm::SystemZELFFrameLowering, llvm::VEFrameLowering, and llvm::X86FrameLowering.
Definition at line 49 of file TargetFrameLoweringImpl.cpp.
References llvm::StackOffset::getFixed(), llvm::MachineFunction::getFrameInfo(), llvm::TargetRegisterInfo::getFrameRegister(), llvm::MachineFrameInfo::getObjectOffset(), llvm::MachineFrameInfo::getOffsetAdjustment(), getOffsetOfLocalArea(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFrameInfo::getStackSize(), and llvm::MachineFunction::getSubtarget().
Referenced by canSpillOnFrameIndexAccess(), llvm::SystemZRegisterInfo::eliminateFrameIndex(), llvm::LoongArchRegisterInfo::eliminateFrameIndex(), emitDebugValueComment(), llvm::SystemZELFFrameLowering::getFrameIndexReference(), getFrameIndexReferencePreferSP(), and getNonLocalFrameIndexReference().
|
inlinevirtual |
Same as getFrameIndexReference
, except that the stack pointer (as opposed to the frame pointer) will be the preferred value for FrameReg
.
This is generally used for emitting statepoint or EH tables that use offsets from RSP. If IgnoreSPUpdates
is true, the returned offset is only guaranteed to be valid with respect to the value of SP at the end of the prologue.
Reimplemented in llvm::AArch64FrameLowering, and llvm::X86FrameLowering.
Definition at line 328 of file TargetFrameLowering.h.
References getFrameIndexReference().
|
virtual |
Return initial CFA offset value i.e.
the one valid at the beginning of the function (before any stack operations).
Reimplemented in llvm::X86FrameLowering.
Definition at line 155 of file TargetFrameLoweringImpl.cpp.
References llvm_unreachable.
|
virtual |
Return initial CFA register value i.e.
the one valid at the beginning of the function (before any stack operations).
Reimplemented in llvm::X86FrameLowering.
Definition at line 160 of file TargetFrameLoweringImpl.cpp.
References llvm_unreachable.
|
inlinevirtual |
getNonLocalFrameIndexReference - This method returns the offset used to reference a frame index location.
The offset can be from either FP/BP/SP based on which base register is returned by llvm.localaddress.
Reimplemented in llvm::AArch64FrameLowering.
Definition at line 338 of file TargetFrameLowering.h.
References getFrameIndexReference().
|
inline |
getOffsetOfLocalArea - This method returns the offset of the local area from the stack pointer on entrance to a function.
Definition at line 143 of file TargetFrameLowering.h.
Referenced by llvm::M68kFrameLowering::assignCalleeSavedSpillSlots(), llvm::X86FrameLowering::assignCalleeSavedSpillSlots(), llvm::M68kRegisterInfo::eliminateFrameIndex(), llvm::AVRRegisterInfo::eliminateFrameIndex(), llvm::SystemZXPLINKFrameLowering::emitPrologue(), getFrameIndexReference(), llvm::LoongArchFrameLowering::getFrameIndexReference(), llvm::M68kFrameLowering::getFrameIndexReference(), llvm::MipsSEFrameLowering::getFrameIndexReference(), llvm::NVPTXFrameLowering::getFrameIndexReference(), llvm::RISCVFrameLowering::getFrameIndexReference(), llvm::X86FrameLowering::getFrameIndexReference(), llvm::X86FrameLowering::getFrameIndexReferenceSP(), and llvm::MachineFrameInfo::print().
|
inline |
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligned on entry to a function.
Typically, this is the largest alignment for any data object in the target.
Definition at line 104 of file TargetFrameLowering.h.
Referenced by llvm::PPCFrameLowering::addScavengingSpillSlot(), assignCalleeSavedSpillSlots(), llvm::HexagonFrameLowering::assignCalleeSavedSpillSlots(), llvm::SystemZXPLINKFrameLowering::assignCalleeSavedSpillSlots(), checkNumAlignedDPRCS2Regs(), llvm::ARMFrameLowering::determineCalleeSaves(), llvm::PPCFrameLowering::determineFrameLayout(), llvm::AArch64FrameLowering::eliminateCallFramePseudoInstr(), llvm::MSP430FrameLowering::eliminateCallFramePseudoInstr(), llvm::XCoreFrameLowering::eliminateCallFramePseudoInstr(), llvm::SIFrameLowering::eliminateCallFramePseudoInstr(), llvm::Thumb1FrameLowering::eliminateCallFramePseudoInstr(), llvm::AVRFrameLowering::eliminateCallFramePseudoInstr(), llvm::RISCVFrameLowering::eliminateCallFramePseudoInstr(), llvm::X86FrameLowering::eliminateCallFramePseudoInstr(), llvm::RISCVFrameLowering::emitEpilogue(), llvm::ARMFrameLowering::emitPrologue(), llvm::RISCVFrameLowering::emitPrologue(), llvm::XCoreFrameLowering::emitPrologue(), llvm::MachineFrameInfo::estimateStackSize(), llvm::X86InstrInfo::foldMemoryOperandImpl(), llvm::VESubtarget::getAdjustedFrameSize(), llvm::RISCVFrameLowering::getFirstSPAdjustAmount(), llvm::LoongArchFrameLowering::getFirstSPAdjustAmount(), getFnStackAlignment(), llvm::SelectionDAG::getReducedAlign(), llvm::X86InstrInfo::getSPAdjust(), llvm::RISCVFrameLowering::getStackSizeWithRVVPadding(), llvm::X86FrameLowering::getWin64EHFrameIndexRef(), llvm::AArch64FrameLowering::getWinEHFuncletFrameSize(), llvm::MipsTargetLowering::HandleByVal(), llvm::X86InstrInfo::loadRegFromStackSlot(), llvm::VETargetLowering::lowerDYNAMIC_STACKALLOC(), LowerDYNAMIC_STACKALLOC(), llvm::SITargetLowering::lowerDYNAMIC_STACKALLOCImpl(), llvm::ARMBaseRegisterInfo::needsFrameBaseReg(), llvm::PPCRegisterInfo::prepareDynamicAlloca(), llvm::HexagonFrameLowering::processFunctionBeforeFrameFinalized(), llvm::HexagonDAGToDAGISel::SelectFrameIndex(), llvm::FunctionLoweringInfo::set(), llvm::TargetRegisterInfo::shouldRealignStack(), and llvm::X86InstrInfo::storeRegToStackSlot().
|
inline |
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligned on entry to a function.
Typically, this is the largest alignment for any data object in the target.
Definition at line 99 of file TargetFrameLowering.h.
References llvm::Align::value().
Referenced by llvm::M68kFrameLowering::eliminateCallFramePseudoInstr(), llvm::PPCTargetLowering::getStackProbeSize(), llvm::SystemZTargetLowering::getStackProbeSize(), llvm::MipsSEFrameLowering::hasReservedCallFrame(), and llvm::MipsCallLowering::lowerCall().
|
inline |
getStackGrowthDirection - Return the direction the stack grows
Definition at line 93 of file TargetFrameLowering.h.
Referenced by llvm::TargetInstrInfo::getSPAdjust(), llvm::SITargetLowering::lowerDYNAMIC_STACKALLOCImpl(), and llvm::AArch64FrameLowering::processFunctionBeforeFrameFinalized().
|
inlinevirtual |
Returns the StackID that scalable vectors should be associated with.
Reimplemented in llvm::AArch64FrameLowering, and llvm::RISCVFrameLowering.
Definition at line 435 of file TargetFrameLowering.h.
References llvm::TargetStackID::Default.
Referenced by llvm::SelectionDAG::CreateStackTemporary(), and llvm::FunctionLoweringInfo::set().
|
inlinevirtual |
getStackThreshold - Return the maximum stack size
Reimplemented in llvm::PPCFrameLowering.
Definition at line 108 of file TargetFrameLowering.h.
Referenced by llvm::PPCFrameLowering::getStackThreshold().
|
inline |
getTransientStackAlignment - This method returns the number of bytes to which the stack pointer must be aligned at all times, even between calls.
Definition at line 126 of file TargetFrameLowering.h.
Referenced by llvm::AArch64FunctionInfo::AArch64FunctionInfo(), llvm::MachineFrameInfo::estimateStackSize(), and mayCombineMisaligned().
|
inlinevirtual |
Reimplemented in llvm::AArch64FrameLowering, and llvm::X86FrameLowering.
Definition at line 380 of file TargetFrameLowering.h.
References llvm::report_fatal_error().
|
pure virtual |
hasFP - Return true if the specified function should have a dedicated frame pointer register.
For most targets this is true only if the function has variable sized allocas or if frame pointer elimination is disabled.
Implemented in llvm::DirectXFrameLowering, llvm::LanaiFrameLowering, llvm::AArch64FrameLowering, llvm::R600FrameLowering, llvm::SIFrameLowering, llvm::ARCFrameLowering, llvm::ARMFrameLowering, llvm::AVRFrameLowering, llvm::BPFFrameLowering, llvm::CSKYFrameLowering, llvm::HexagonFrameLowering, llvm::LoongArchFrameLowering, llvm::M68kFrameLowering, llvm::MipsFrameLowering, llvm::MSP430FrameLowering, llvm::NVPTXFrameLowering, llvm::PPCFrameLowering, llvm::RISCVFrameLowering, llvm::SparcFrameLowering, llvm::SPIRVFrameLowering, llvm::SystemZELFFrameLowering, llvm::SystemZXPLINKFrameLowering, llvm::VEFrameLowering, llvm::WebAssemblyFrameLowering, llvm::X86FrameLowering, and llvm::XCoreFrameLowering.
Referenced by allocateScavengingFrameIndexesNearIncomingSP(), llvm::CodeViewDebug::beginFunctionImpl(), canSimplifyCallFramePseudos(), llvm::LanaiRegisterInfo::eliminateFrameIndex(), estimateRSStackSizeLimit(), llvm::AVRRegisterInfo::getFrameRegister(), llvm::CSKYRegisterInfo::getFrameRegister(), llvm::LoongArchRegisterInfo::getFrameRegister(), llvm::M68kRegisterInfo::getFrameRegister(), llvm::RISCVRegisterInfo::getFrameRegister(), llvm::SystemZRegisterInfo::getFrameRegister(), llvm::X86TargetLowering::getRegisterByName(), llvm::MipsRegisterInfo::getRegPressureLimit(), llvm::MipsRegisterInfo::getReservedRegs(), llvm::SystemZRegisterInfo::getReservedRegs(), and hasReservedCallFrame().
|
inlinevirtual |
hasReservedCallFrame - Under normal circumstances, when a frame pointer is not required, we reserve argument space for call sites in the function immediately on entry to the current function.
This eliminates the need for add/sub sp brackets around call sites. Returns true if the call frame is included as part of the stack frame.
Reimplemented in llvm::AArch64FrameLowering, llvm::ARMFrameLowering, llvm::Thumb1FrameLowering, llvm::AVRFrameLowering, llvm::CSKYFrameLowering, llvm::HexagonFrameLowering, llvm::LoongArchFrameLowering, llvm::M68kFrameLowering, llvm::Mips16FrameLowering, llvm::MipsSEFrameLowering, llvm::MSP430FrameLowering, llvm::RISCVFrameLowering, llvm::SparcFrameLowering, llvm::SystemZFrameLowering, llvm::VEFrameLowering, llvm::WebAssemblyFrameLowering, and llvm::X86FrameLowering.
Definition at line 295 of file TargetFrameLowering.h.
References hasFP().
Referenced by llvm::MipsRegisterInfo::canRealignStack(), canSimplifyCallFramePseudos(), llvm::MipsFrameLowering::eliminateCallFramePseudoInstr(), llvm::XCoreFrameLowering::eliminateCallFramePseudoInstr(), llvm::SIFrameLowering::eliminateCallFramePseudoInstr(), and llvm::MachineFrameInfo::estimateStackSize().
|
inlinevirtual |
Replace a StackProbe stub (if any) with the actual probe code inline.
Reimplemented in llvm::PPCFrameLowering, llvm::SystemZELFFrameLowering, llvm::SystemZXPLINKFrameLowering, and llvm::X86FrameLowering.
Definition at line 238 of file TargetFrameLowering.h.
|
inlinevirtual |
Check if the no-CSR optimisation is profitable for the given function.
Reimplemented in llvm::ARMFrameLowering.
Definition at line 454 of file TargetFrameLowering.h.
Referenced by determineCalleeSaves().
Check if given function is safe for not having callee saved registers.
This is used when interprocedural register allocation is enabled.
Definition at line 143 of file TargetFrameLoweringImpl.cpp.
References F.
Referenced by determineCalleeSaves().
|
inlinevirtual |
This method returns whether or not it is safe for an object with the given stack id to be bundled into the local area.
Reimplemented in llvm::AArch64FrameLowering, and llvm::RISCVFrameLowering.
Definition at line 136 of file TargetFrameLowering.h.
|
inline |
isStackRealignable - This method returns whether the stack can be realigned.
Definition at line 130 of file TargetFrameLowering.h.
Referenced by llvm::FunctionLoweringInfo::set().
|
inlinevirtual |
Reimplemented in llvm::AArch64FrameLowering, llvm::SIFrameLowering, llvm::RISCVFrameLowering, and llvm::WebAssemblyFrameLowering.
Definition at line 439 of file TargetFrameLowering.h.
References llvm::TargetStackID::Default, and llvm::TargetStackID::NoAlloc.
Referenced by llvm::MIRParserImpl::initializeFrameInfo(), and llvm::WebAssemblyFrameLowering::isSupportedStackID().
|
inlinevirtual |
Return true if the target wants to keep the frame pointer regardless of the function attribute "frame-pointer".
Reimplemented in llvm::ARMFrameLowering.
Definition at line 281 of file TargetFrameLowering.h.
Referenced by llvm::TargetOptions::DisableFramePointerElim().
|
virtual |
Reimplemented in llvm::M68kFrameLowering, and llvm::X86FrameLowering.
Definition at line 64 of file TargetFrameLoweringImpl.cpp.
References llvm::MachineFunction::getFrameInfo(), and llvm::MachineFrameInfo::hasStackObjects().
|
inlinevirtual |
Order the symbols in the local stack frame.
The list of objects that we want to order is in objectsToAllocate
as indices into the MachineFrameInfo. The array can be reordered in any way upon return. The contents of the array, however, may not be modified (i.e. only their order may be changed). By default, just maintain the original order.
Reimplemented in llvm::AArch64FrameLowering, llvm::SystemZELFFrameLowering, and llvm::X86FrameLowering.
Definition at line 406 of file TargetFrameLowering.h.
|
inlinevirtual |
processFunctionBeforeFrameFinalized - This method is called immediately before the specified function's frame layout (MF.getFrameInfo()) is finalized.
Once the frame is finalized, MO_FrameIndex operands are replaced with direct constants. This method is optional.
Reimplemented in llvm::AArch64FrameLowering, llvm::ARCFrameLowering, llvm::LoongArchFrameLowering, llvm::RISCVFrameLowering, llvm::SystemZELFFrameLowering, llvm::SystemZXPLINKFrameLowering, llvm::X86FrameLowering, llvm::SIFrameLowering, llvm::HexagonFrameLowering, llvm::MSP430FrameLowering, llvm::PPCFrameLowering, and llvm::XCoreFrameLowering.
Definition at line 369 of file TargetFrameLowering.h.
|
inlinevirtual |
processFunctionBeforeFrameIndicesReplaced - This method is called immediately before MO_FrameIndex operands are eliminated, but after the frame is finalized.
This method is optional.
Reimplemented in llvm::AArch64FrameLowering, llvm::X86FrameLowering, and llvm::SIFrameLowering.
Definition at line 377 of file TargetFrameLowering.h.
|
inlinevirtual |
Emit CFI instructions that recreate the state of the unwind information upon fucntion entry.
Reimplemented in llvm::AArch64FrameLowering.
Definition at line 235 of file TargetFrameLowering.h.
Referenced by llvm::CFIFixup::runOnMachineFunction().
|
inlinevirtual |
restoreCalleeSavedRegisters - Issues instruction(s) to restore all callee saved registers and returns true if it isn't possible / profitable to do so by issuing a series of load instructions via loadRegToStackSlot().
If it returns true, and any of the registers in CSI is not restored, it sets the corresponding Restored flag in CSI to false. Returns false otherwise.
Reimplemented in llvm::SystemZELFFrameLowering, llvm::SystemZXPLINKFrameLowering, llvm::AArch64FrameLowering, llvm::ARCFrameLowering, llvm::ARMFrameLowering, llvm::Thumb1FrameLowering, llvm::AVRFrameLowering, llvm::CSKYFrameLowering, llvm::HexagonFrameLowering, llvm::M68kFrameLowering, llvm::Mips16FrameLowering, llvm::MSP430FrameLowering, llvm::PPCFrameLowering, llvm::RISCVFrameLowering, llvm::X86FrameLowering, and llvm::XCoreFrameLowering.
Definition at line 272 of file TargetFrameLowering.h.
Referenced by insertCSRRestores().
|
inlinevirtual |
spillCalleeSavedRegisters - Issues instruction(s) to spill all callee saved registers and returns true if it isn't possible / profitable to do so by issuing a series of store instructions via storeRegToStackSlot().
Returns false otherwise.
Reimplemented in llvm::SystemZELFFrameLowering, llvm::SystemZXPLINKFrameLowering, llvm::AArch64FrameLowering, llvm::ARCFrameLowering, llvm::ARMFrameLowering, llvm::Thumb1FrameLowering, llvm::AVRFrameLowering, llvm::CSKYFrameLowering, llvm::HexagonFrameLowering, llvm::LoongArchFrameLowering, llvm::M68kFrameLowering, llvm::Mips16FrameLowering, llvm::MipsSEFrameLowering, llvm::MSP430FrameLowering, llvm::PPCFrameLowering, llvm::RISCVFrameLowering, llvm::X86FrameLowering, and llvm::XCoreFrameLowering.
Definition at line 258 of file TargetFrameLowering.h.
Referenced by insertCSRSaves().
|
inlinevirtual |
Does the stack probe function call return with a modified stack pointer?
Reimplemented in llvm::X86FrameLowering.
Definition at line 242 of file TargetFrameLowering.h.
|
inlinevirtual |
targetHandlesStackFrameRounding - Returns true if the target is responsible for rounding up the stack frame (probably at emitPrologue time).
Reimplemented in llvm::HexagonFrameLowering, llvm::PPCFrameLowering, and llvm::SparcFrameLowering.
Definition at line 192 of file TargetFrameLowering.h.