LLVM  8.0.1
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
llvm::TargetFrameLowering Class Referenceabstract

Information about stack frame layout on the target. More...

#include "llvm/CodeGen/TargetFrameLowering.h"

Inheritance diagram for llvm::TargetFrameLowering:
Inheritance graph
[legend]

Classes

struct  SpillSlot
 

Public Types

enum  StackDirection { StackGrowsUp, StackGrowsDown }
 

Public Member Functions

 TargetFrameLowering (StackDirection D, unsigned StackAl, int LAO, unsigned TransAl=1, bool StackReal=true)
 
virtual ~TargetFrameLowering ()
 
StackDirection getStackGrowthDirection () const
 getStackGrowthDirection - Return the direction the stack grows More...
 
unsigned getStackAlignment () const
 getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligned on entry to a function. More...
 
int alignSPAdjust (int SPAdj) const
 alignSPAdjust - This method aligns the stack adjustment to the correct alignment. More...
 
unsigned getTransientStackAlignment () const
 getTransientStackAlignment - This method returns the number of bytes to which the stack pointer must be aligned at all times, even between calls. More...
 
bool isStackRealignable () const
 isStackRealignable - This method returns whether the stack can be realigned. More...
 
virtual unsigned getStackAlignmentSkew (const MachineFunction &MF) const
 Return the skew that has to be applied to stack alignment under certain conditions (e.g. More...
 
int getOffsetOfLocalArea () const
 getOffsetOfLocalArea - This method returns the offset of the local area from the stack pointer on entrance to a function. More...
 
virtual bool isFPCloseToIncomingSP () const
 isFPCloseToIncomingSP - Return true if the frame pointer is close to the incoming stack pointer, false if it is close to the post-prologue stack pointer. More...
 
virtual bool assignCalleeSavedSpillSlots (MachineFunction &MF, const TargetRegisterInfo *TRI, std::vector< CalleeSavedInfo > &CSI) const
 assignCalleeSavedSpillSlots - Allows target to override spill slot assignment logic. More...
 
virtual const SpillSlotgetCalleeSavedSpillSlots (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. More...
 
virtual bool targetHandlesStackFrameRounding () const
 targetHandlesStackFrameRounding - Returns true if the target is responsible for rounding up the stack frame (probably at emitPrologue time). More...
 
virtual bool enableShrinkWrapping (const MachineFunction &MF) const
 Returns true if the target will correctly handle shrink wrapping. More...
 
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. More...
 
virtual bool enableCalleeSaveSkip (const MachineFunction &MF) const
 Returns true if the target can safely skip saving callee-saved registers for noreturn nounwind functions. More...
 
virtual void emitPrologue (MachineFunction &MF, MachineBasicBlock &MBB) const =0
 emitProlog/emitEpilog - These methods insert prolog and epilog code into the function. More...
 
virtual void emitEpilogue (MachineFunction &MF, MachineBasicBlock &MBB) const =0
 
virtual void inlineStackProbe (MachineFunction &MF, MachineBasicBlock &PrologueMBB) const
 Replace a StackProbe stub (if any) with the actual probe code inline. More...
 
virtual void adjustForSegmentedStacks (MachineFunction &MF, MachineBasicBlock &PrologueMBB) const
 Adjust the prologue to have the function use segmented stacks. More...
 
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. More...
 
virtual bool spillCalleeSavedRegisters (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const std::vector< 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(). More...
 
virtual bool restoreCalleeSavedRegisters (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, std::vector< 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(). More...
 
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". More...
 
virtual bool hasFP (const MachineFunction &MF) const =0
 hasFP - Return true if the specified function should have a dedicated frame pointer register. More...
 
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. More...
 
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. More...
 
virtual bool needsFrameIndexResolution (const MachineFunction &MF) const
 
virtual int getFrameIndexReference (const MachineFunction &MF, int FI, unsigned &FrameReg) const
 getFrameIndexReference - This method should return the base register and offset used to reference a frame index location. More...
 
virtual int getFrameIndexReferencePreferSP (const MachineFunction &MF, int FI, unsigned &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. More...
 
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. More...
 
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. More...
 
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). More...
 
virtual void orderFrameObjects (const MachineFunction &MF, SmallVectorImpl< int > &objectsToAllocate) const
 Order the symbols in the local stack frame. More...
 
virtual bool canUseAsPrologue (const MachineBasicBlock &MBB) const
 Check whether or not the given MBB can be used as a prologue for the target. More...
 
virtual bool canUseAsEpilogue (const MachineBasicBlock &MBB) const
 Check whether or not the given MBB can be used as a epilogue for the target. More...
 
virtual int getInitialCFAOffset (const MachineFunction &MF) const
 Return initial CFA offset value i.e. More...
 
virtual unsigned getInitialCFARegister (const MachineFunction &MF) const
 Return initial CFA register value i.e. More...
 

Static Public Member Functions

static bool isSafeForNoCSROpt (const Function &F)
 Check if given function is safe for not having callee saved registers. More...
 

Detailed Description

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 34 of file TargetFrameLowering.h.

Member Enumeration Documentation

◆ StackDirection

Enumerator
StackGrowsUp 
StackGrowsDown 

Definition at line 36 of file TargetFrameLowering.h.

Constructor & Destructor Documentation

◆ TargetFrameLowering()

llvm::TargetFrameLowering::TargetFrameLowering ( StackDirection  D,
unsigned  StackAl,
int  LAO,
unsigned  TransAl = 1,
bool  StackReal = true 
)
inline

Definition at line 53 of file TargetFrameLowering.h.

References ~TargetFrameLowering().

◆ ~TargetFrameLowering()

TargetFrameLowering::~TargetFrameLowering ( )
virtualdefault

Referenced by TargetFrameLowering().

Member Function Documentation

◆ adjustForHiPEPrologue()

virtual void llvm::TargetFrameLowering::adjustForHiPEPrologue ( MachineFunction MF,
MachineBasicBlock PrologueMBB 
) const
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 183 of file TargetFrameLowering.h.

Referenced by AssignProtectedObjSet().

◆ adjustForSegmentedStacks()

virtual void llvm::TargetFrameLowering::adjustForSegmentedStacks ( MachineFunction MF,
MachineBasicBlock PrologueMBB 
) const
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::X86FrameLowering, and llvm::ARMFrameLowering.

Definition at line 178 of file TargetFrameLowering.h.

Referenced by AssignProtectedObjSet().

◆ alignSPAdjust()

int llvm::TargetFrameLowering::alignSPAdjust ( int  SPAdj) const
inline

alignSPAdjust - This method aligns the stack adjustment to the correct alignment.

Definition at line 76 of file TargetFrameLowering.h.

References llvm::alignTo().

Referenced by llvm::ARMFrameLowering::determineCalleeSaves(), llvm::RISCVFrameLowering::eliminateCallFramePseudoInstr(), and llvm::TargetInstrInfo::getSPAdjust().

◆ assignCalleeSavedSpillSlots()

virtual bool llvm::TargetFrameLowering::assignCalleeSavedSpillSlots ( MachineFunction MF,
const TargetRegisterInfo TRI,
std::vector< CalleeSavedInfo > &  CSI 
) const
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::PPCFrameLowering, llvm::HexagonFrameLowering, llvm::X86FrameLowering, and llvm::ARCFrameLowering.

Definition at line 121 of file TargetFrameLowering.h.

Referenced by assignCalleeSavedSpillSlots().

◆ canSimplifyCallFramePseudos()

virtual bool llvm::TargetFrameLowering::canSimplifyCallFramePseudos ( const MachineFunction MF) const
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::X86FrameLowering, llvm::HexagonFrameLowering, llvm::ARMFrameLowering, and llvm::AVRFrameLowering.

Definition at line 237 of file TargetFrameLowering.h.

References getFrameIndexReference(), hasFP(), hasReservedCallFrame(), and needsFrameIndexResolution().

◆ canUseAsEpilogue()

virtual bool llvm::TargetFrameLowering::canUseAsEpilogue ( const MachineBasicBlock MBB) const
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::PPCFrameLowering, llvm::X86FrameLowering, and llvm::Thumb1FrameLowering.

Definition at line 334 of file TargetFrameLowering.h.

Referenced by giveUpWithRemarks().

◆ canUseAsPrologue()

virtual bool llvm::TargetFrameLowering::canUseAsPrologue ( const MachineBasicBlock MBB) const
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::PPCFrameLowering, llvm::X86FrameLowering, and llvm::AArch64FrameLowering.

Definition at line 322 of file TargetFrameLowering.h.

Referenced by giveUpWithRemarks().

◆ determineCalleeSaves()

void TargetFrameLowering::determineCalleeSaves ( MachineFunction MF,
BitVector SavedRegs,
RegScavenger RS = nullptr 
) const
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.

Reimplemented in llvm::PPCFrameLowering, llvm::X86FrameLowering, llvm::HexagonFrameLowering, llvm::AArch64FrameLowering, llvm::ARMFrameLowering, llvm::LanaiFrameLowering, llvm::XCoreFrameLowering, llvm::ARCFrameLowering, llvm::Mips16FrameLowering, llvm::MipsSEFrameLowering, llvm::SparcFrameLowering, llvm::SIFrameLowering, llvm::AVRFrameLowering, llvm::RISCVFrameLowering, llvm::BPFFrameLowering, and llvm::SystemZFrameLowering.

Definition at line 63 of file TargetFrameLoweringImpl.cpp.

References llvm::MachineFunction::callsUnwindInit(), enableCalleeSaveSkip(), llvm::TargetOptions::EnableIPRA, llvm::MachineRegisterInfo::getCalleeSavedRegs(), llvm::MachineFunction::getFunction(), llvm::MCRegisterInfo::getNumRegs(), llvm::MachineFunction::getRegInfo(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), llvm::MachineFunction::getTarget(), llvm::Function::hasFnAttribute(), llvm::MachineRegisterInfo::isPhysRegModified(), isSafeForNoCSROpt(), MRI, llvm::Attribute::Naked, llvm::Attribute::NoReturn, llvm::Attribute::NoUnwind, llvm::TargetMachine::Options, Reg, llvm::BitVector::resize(), llvm::BitVector::set(), TRI, and llvm::Attribute::UWTable.

Referenced by llvm::createRegUsageInfoCollector(), llvm::SystemZFrameLowering::determineCalleeSaves(), llvm::BPFFrameLowering::determineCalleeSaves(), llvm::RISCVFrameLowering::determineCalleeSaves(), llvm::AVRFrameLowering::determineCalleeSaves(), llvm::SIFrameLowering::determineCalleeSaves(), llvm::SparcFrameLowering::determineCalleeSaves(), llvm::ARCFrameLowering::determineCalleeSaves(), llvm::Mips16FrameLowering::determineCalleeSaves(), llvm::MipsSEFrameLowering::determineCalleeSaves(), llvm::XCoreFrameLowering::determineCalleeSaves(), llvm::LanaiFrameLowering::determineCalleeSaves(), llvm::ARMFrameLowering::determineCalleeSaves(), llvm::AArch64FrameLowering::determineCalleeSaves(), llvm::HexagonFrameLowering::determineCalleeSaves(), llvm::X86FrameLowering::determineCalleeSaves(), llvm::PPCFrameLowering::determineCalleeSaves(), getFrameIndexReferencePreferSP(), INITIALIZE_PASS(), insertCSRRestores(), and llvm::scavengeFrameVirtualRegs().

◆ eliminateCallFramePseudoInstr()

virtual MachineBasicBlock::iterator llvm::TargetFrameLowering::eliminateCallFramePseudoInstr ( MachineFunction MF,
MachineBasicBlock MBB,
MachineBasicBlock::iterator  MI 
) const
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::PPCFrameLowering, llvm::X86FrameLowering, llvm::HexagonFrameLowering, llvm::ARCFrameLowering, llvm::SystemZFrameLowering, llvm::SIFrameLowering, llvm::LanaiFrameLowering, llvm::RISCVFrameLowering, llvm::XCoreFrameLowering, llvm::MipsFrameLowering, llvm::Thumb1FrameLowering, llvm::AVRFrameLowering, llvm::WebAssemblyFrameLowering, llvm::BPFFrameLowering, llvm::MSP430FrameLowering, llvm::SparcFrameLowering, llvm::NVPTXFrameLowering, and llvm::AArch64FrameLowering.

Definition at line 295 of file TargetFrameLowering.h.

References llvm_unreachable.

Referenced by AssignProtectedObjSet().

◆ emitEpilogue()

virtual void llvm::TargetFrameLowering::emitEpilogue ( MachineFunction MF,
MachineBasicBlock MBB 
) const
pure virtual

◆ emitPrologue()

virtual void llvm::TargetFrameLowering::emitPrologue ( MachineFunction MF,
MachineBasicBlock MBB 
) const
pure virtual

◆ enableCalleeSaveSkip()

bool TargetFrameLowering::enableCalleeSaveSkip ( const MachineFunction MF) const
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 33 of file TargetFrameLoweringImpl.cpp.

References assert(), llvm::MachineFunction::getFunction(), llvm::Function::hasFnAttribute(), llvm::Attribute::NoReturn, llvm::Attribute::NoUnwind, and llvm::Attribute::UWTable.

Referenced by determineCalleeSaves(), and enableStackSlotScavenging().

◆ enableShrinkWrapping()

virtual bool llvm::TargetFrameLowering::enableShrinkWrapping ( const MachineFunction MF) const
inlinevirtual

Returns true if the target will correctly handle shrink wrapping.

Reimplemented in llvm::X86FrameLowering, llvm::PPCFrameLowering, llvm::AArch64FrameLowering, llvm::ARMFrameLowering, llvm::Thumb1FrameLowering, and llvm::MipsFrameLowering.

Definition at line 150 of file TargetFrameLowering.h.

Referenced by giveUpWithRemarks().

◆ enableStackSlotScavenging()

virtual bool llvm::TargetFrameLowering::enableStackSlotScavenging ( const MachineFunction MF) const
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 157 of file TargetFrameLowering.h.

References emitEpilogue(), emitPrologue(), and enableCalleeSaveSkip().

Referenced by AssignProtectedObjSet().

◆ getCalleeSavedSpillSlots()

virtual const SpillSlot* llvm::TargetFrameLowering::getCalleeSavedSpillSlots ( unsigned NumEntries) const
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::PPCFrameLowering, llvm::HexagonFrameLowering, and llvm::SystemZFrameLowering.

Definition at line 137 of file TargetFrameLowering.h.

Referenced by assignCalleeSavedSpillSlots().

◆ getFrameIndexReference()

int TargetFrameLowering::getFrameIndexReference ( const MachineFunction MF,
int  FI,
unsigned FrameReg 
) const
virtual

◆ getFrameIndexReferencePreferSP()

virtual int llvm::TargetFrameLowering::getFrameIndexReferencePreferSP ( const MachineFunction MF,
int  FI,
unsigned FrameReg,
bool  IgnoreSPUpdates 
) const
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::X86FrameLowering, and llvm::AArch64FrameLowering.

Definition at line 258 of file TargetFrameLowering.h.

References determineCalleeSaves(), and getFrameIndexReference().

Referenced by AssignProtectedObjSet(), and llvm::WinException::endFunclet().

◆ getInitialCFAOffset()

int TargetFrameLowering::getInitialCFAOffset ( const MachineFunction MF) const
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 122 of file TargetFrameLoweringImpl.cpp.

References llvm_unreachable.

Referenced by INITIALIZE_PASS(), and isSafeForNoCSROpt().

◆ getInitialCFARegister()

unsigned TargetFrameLowering::getInitialCFARegister ( const MachineFunction MF) const
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 126 of file TargetFrameLoweringImpl.cpp.

References llvm_unreachable.

Referenced by INITIALIZE_PASS(), and isSafeForNoCSROpt().

◆ getOffsetOfLocalArea()

int llvm::TargetFrameLowering::getOffsetOfLocalArea ( ) const
inline

◆ getStackAlignment()

unsigned llvm::TargetFrameLowering::getStackAlignment ( ) const
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 71 of file TargetFrameLowering.h.

Referenced by llvm::PPCFrameLowering::addScavengingSpillSlot(), AdjustStackOffset(), assignCalleeSavedSpillSlots(), AssignProtectedObjSet(), calculateSetFPREG(), checkNumAlignedDPRCS2Regs(), llvm::ARMFrameLowering::determineCalleeSaves(), llvm::PPCFrameLowering::determineFrameLayout(), llvm::AArch64FrameLowering::eliminateCallFramePseudoInstr(), llvm::MSP430FrameLowering::eliminateCallFramePseudoInstr(), llvm::Thumb1FrameLowering::eliminateCallFramePseudoInstr(), llvm::XCoreFrameLowering::eliminateCallFramePseudoInstr(), llvm::SIFrameLowering::eliminateCallFramePseudoInstr(), llvm::X86FrameLowering::eliminateCallFramePseudoInstr(), llvm::SparcFrameLowering::emitPrologue(), llvm::XCoreFrameLowering::emitPrologue(), llvm::ARMFrameLowering::emitPrologue(), EnsureStackAlignment(), llvm::MachineFrameInfo::estimateStackSize(), getFnStackAlignment(), getMOVL(), llvm::X86InstrInfo::getSPAdjust(), llvm::AArch64FrameLowering::getWinEHFuncletFrameSize(), llvm::MipsTargetLowering::HandleByVal(), llvm::RISCVFrameLowering::hasFP(), hasOnlySelectUsers(), llvm::MipsSEFrameLowering::hasReservedCallFrame(), isFuncletReturnInstr(), llvm::HexagonInstrInfo::loadRegFromStackSlot(), LowerADJUST_TRAMPOLINE(), llvm::MipsCallLowering::lowerCall(), LowerDYNAMIC_STACKALLOC(), llvm::PPCRegisterInfo::lowerDynamicAlloc(), llvm::ARMBaseRegisterInfo::needsFrameBaseReg(), llvm::TargetRegisterInfo::needsStackRealignment(), llvm::HexagonDAGToDAGISel::SelectFrameIndex(), llvm::FunctionLoweringInfo::set(), and llvm::HexagonInstrInfo::storeRegToStackSlot().

◆ getStackAlignmentSkew()

unsigned TargetFrameLowering::getStackAlignmentSkew ( const MachineFunction MF) const
virtual

Return the skew that has to be applied to stack alignment under certain conditions (e.g.

stack was adjusted before function MF was called).

Definition at line 112 of file TargetFrameLoweringImpl.cpp.

References llvm::TargetMachine::getAllocaPointerSize(), llvm::Function::getCallingConv(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getTarget(), llvm::CallingConv::HHVM, and LLVM_UNLIKELY.

Referenced by AssignProtectedObjSet(), and isStackRealignable().

◆ getStackGrowthDirection()

StackDirection llvm::TargetFrameLowering::getStackGrowthDirection ( ) const
inline

getStackGrowthDirection - Return the direction the stack grows

Definition at line 65 of file TargetFrameLowering.h.

Referenced by AdjustStackOffset(), AssignProtectedObjSet(), llvm::TargetInstrInfo::getSPAdjust(), INITIALIZE_PASS(), lookupCandidateBaseReg(), and llvm::ScheduleDAGMILive::scheduleMI().

◆ getTransientStackAlignment()

unsigned llvm::TargetFrameLowering::getTransientStackAlignment ( ) const
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 89 of file TargetFrameLowering.h.

Referenced by AdjustStackOffset(), AssignProtectedObjSet(), llvm::MachineFrameInfo::estimateStackSize(), and mayCombineMisaligned().

◆ getWinEHParentFrameOffset()

virtual unsigned llvm::TargetFrameLowering::getWinEHParentFrameOffset ( const MachineFunction MF) const
inlinevirtual

Reimplemented in llvm::X86FrameLowering, and llvm::AArch64FrameLowering.

Definition at line 284 of file TargetFrameLowering.h.

References llvm::report_fatal_error().

◆ hasFP()

virtual bool llvm::TargetFrameLowering::hasFP ( const MachineFunction MF) const
pure virtual

◆ hasReservedCallFrame()

virtual bool llvm::TargetFrameLowering::hasReservedCallFrame ( const MachineFunction MF) const
inlinevirtual

◆ inlineStackProbe()

virtual void llvm::TargetFrameLowering::inlineStackProbe ( MachineFunction MF,
MachineBasicBlock PrologueMBB 
) const
inlinevirtual

Replace a StackProbe stub (if any) with the actual probe code inline.

Reimplemented in llvm::X86FrameLowering.

Definition at line 173 of file TargetFrameLowering.h.

Referenced by AssignProtectedObjSet().

◆ isFPCloseToIncomingSP()

virtual bool llvm::TargetFrameLowering::isFPCloseToIncomingSP ( ) const
inlinevirtual

isFPCloseToIncomingSP - Return true if the frame pointer is close to the incoming stack pointer, false if it is close to the post-prologue stack pointer.

Reimplemented in llvm::MipsFrameLowering, and llvm::SystemZFrameLowering.

Definition at line 112 of file TargetFrameLowering.h.

Referenced by AssignProtectedObjSet().

◆ isSafeForNoCSROpt()

static bool llvm::TargetFrameLowering::isSafeForNoCSROpt ( const Function F)
inlinestatic

Check if given function is safe for not having callee saved registers.

This is used when interprocedural register allocation is enabled.

Definition at line 340 of file TargetFrameLowering.h.

References getInitialCFAOffset(), getInitialCFARegister(), llvm::Function::hasAddressTaken(), llvm::Function::hasFnAttribute(), llvm::GlobalValue::hasLocalLinkage(), llvm::Attribute::NoRecurse, and llvm::Value::users().

Referenced by llvm::createRegUsageInfoCollector(), and determineCalleeSaves().

◆ isStackRealignable()

bool llvm::TargetFrameLowering::isStackRealignable ( ) const
inline

isStackRealignable - This method returns whether the stack can be realigned.

Definition at line 95 of file TargetFrameLowering.h.

References getStackAlignmentSkew().

Referenced by llvm::MachineFunction::MachineFunction(), and llvm::FunctionLoweringInfo::set().

◆ keepFramePointer()

virtual bool llvm::TargetFrameLowering::keepFramePointer ( const MachineFunction MF) const
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 212 of file TargetFrameLowering.h.

References hasFP().

Referenced by llvm::TargetOptions::DisableFramePointerElim().

◆ needsFrameIndexResolution()

bool TargetFrameLowering::needsFrameIndexResolution ( const MachineFunction MF) const
virtual

◆ orderFrameObjects()

virtual void llvm::TargetFrameLowering::orderFrameObjects ( const MachineFunction MF,
SmallVectorImpl< int > &  objectsToAllocate 
) const
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::X86FrameLowering.

Definition at line 310 of file TargetFrameLowering.h.

Referenced by AssignProtectedObjSet().

◆ processFunctionBeforeFrameFinalized()

virtual void llvm::TargetFrameLowering::processFunctionBeforeFrameFinalized ( MachineFunction MF,
RegScavenger RS = nullptr 
) const
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::X86FrameLowering, llvm::PPCFrameLowering, llvm::AArch64FrameLowering, llvm::HexagonFrameLowering, llvm::ARCFrameLowering, llvm::XCoreFrameLowering, llvm::MSP430FrameLowering, llvm::SIFrameLowering, llvm::SystemZFrameLowering, and llvm::RISCVFrameLowering.

Definition at line 280 of file TargetFrameLowering.h.

Referenced by llvm::scavengeFrameVirtualRegs().

◆ restoreCalleeSavedRegisters()

virtual bool llvm::TargetFrameLowering::restoreCalleeSavedRegisters ( MachineBasicBlock MBB,
MachineBasicBlock::iterator  MI,
std::vector< CalleeSavedInfo > &  CSI,
const TargetRegisterInfo TRI 
) const
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::PPCFrameLowering, llvm::X86FrameLowering, llvm::HexagonFrameLowering, llvm::AArch64FrameLowering, llvm::ARCFrameLowering, llvm::MSP430FrameLowering, llvm::ARMFrameLowering, llvm::XCoreFrameLowering, llvm::SystemZFrameLowering, llvm::Mips16FrameLowering, llvm::Thumb1FrameLowering, and llvm::AVRFrameLowering.

Definition at line 203 of file TargetFrameLowering.h.

Referenced by insertCSRRestores().

◆ spillCalleeSavedRegisters()

virtual bool llvm::TargetFrameLowering::spillCalleeSavedRegisters ( MachineBasicBlock MBB,
MachineBasicBlock::iterator  MI,
const std::vector< CalleeSavedInfo > &  CSI,
const TargetRegisterInfo TRI 
) const
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::PPCFrameLowering, llvm::X86FrameLowering, llvm::AArch64FrameLowering, llvm::HexagonFrameLowering, llvm::ARCFrameLowering, llvm::MSP430FrameLowering, llvm::ARMFrameLowering, llvm::XCoreFrameLowering, llvm::MipsSEFrameLowering, llvm::SystemZFrameLowering, llvm::Thumb1FrameLowering, llvm::Mips16FrameLowering, and llvm::AVRFrameLowering.

Definition at line 190 of file TargetFrameLowering.h.

Referenced by insertCSRSaves().

◆ targetHandlesStackFrameRounding()

virtual bool llvm::TargetFrameLowering::targetHandlesStackFrameRounding ( ) const
inlinevirtual

targetHandlesStackFrameRounding - Returns true if the target is responsible for rounding up the stack frame (probably at emitPrologue time).

Reimplemented in llvm::PPCFrameLowering, llvm::HexagonFrameLowering, and llvm::SparcFrameLowering.

Definition at line 145 of file TargetFrameLowering.h.

Referenced by AdjustStackOffset(), and AssignProtectedObjSet().


The documentation for this class was generated from the following files: