LLVM API Documentation
#include <TargetFrameLowering.h>
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 33 of file TargetFrameLowering.h.
Definition at line 35 of file TargetFrameLowering.h.
llvm::TargetFrameLowering::TargetFrameLowering | ( | StackDirection | D, |
unsigned | StackAl, | ||
int | LAO, | ||
unsigned | TransAl = 1 , |
||
bool | StackReal = true |
||
) | [inline] |
Definition at line 52 of file TargetFrameLowering.h.
TargetFrameLowering::~TargetFrameLowering | ( | ) | [virtual] |
Definition at line 23 of file TargetFrameLoweringImpl.cpp.
virtual void llvm::TargetFrameLowering::adjustForHiPEPrologue | ( | MachineFunction & | MF | ) | const [inline, virtual] |
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 143 of file TargetFrameLowering.h.
virtual void llvm::TargetFrameLowering::adjustForSegmentedStacks | ( | MachineFunction & | MF | ) | const [inline, virtual] |
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 139 of file TargetFrameLowering.h.
virtual bool llvm::TargetFrameLowering::assignCalleeSavedSpillSlots | ( | MachineFunction & | MF, |
const TargetRegisterInfo * | TRI, | ||
std::vector< CalleeSavedInfo > & | CSI | ||
) | const [inline, virtual] |
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::X86FrameLowering.
Definition at line 103 of file TargetFrameLowering.h.
virtual bool llvm::TargetFrameLowering::canSimplifyCallFramePseudos | ( | const MachineFunction & | MF | ) | const [inline, virtual] |
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.
Definition at line 188 of file TargetFrameLowering.h.
References hasFP(), and hasReservedCallFrame().
virtual void llvm::TargetFrameLowering::eliminateCallFramePseudoInstr | ( | MachineFunction & | MF, |
MachineBasicBlock & | MBB, | ||
MachineBasicBlock::iterator | MI | ||
) | const [inline, virtual] |
eliminateCallFramePseudoInstr - 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.
Reimplemented in llvm::X86FrameLowering, llvm::PPCFrameLowering, llvm::SystemZFrameLowering, llvm::Thumb1FrameLowering, llvm::XCoreFrameLowering, llvm::HexagonFrameLowering, llvm::MSP430FrameLowering, llvm::SparcFrameLowering, llvm::AArch64FrameLowering, llvm::NVPTXFrameLowering, llvm::MipsSEFrameLowering, and llvm::Mips16FrameLowering.
Definition at line 227 of file TargetFrameLowering.h.
References llvm_unreachable.
virtual void llvm::TargetFrameLowering::emitEpilogue | ( | MachineFunction & | MF, |
MachineBasicBlock & | MBB | ||
) | const [pure virtual] |
Implemented in llvm::SystemZFrameLowering, llvm::AMDGPUFrameLowering, llvm::X86FrameLowering, llvm::AArch64FrameLowering, llvm::PPCFrameLowering, llvm::ARMFrameLowering, llvm::XCoreFrameLowering, llvm::Thumb1FrameLowering, llvm::MSP430FrameLowering, llvm::SparcFrameLowering, llvm::NVPTXFrameLowering, llvm::HexagonFrameLowering, llvm::MipsSEFrameLowering, and llvm::Mips16FrameLowering.
virtual void llvm::TargetFrameLowering::emitPrologue | ( | MachineFunction & | MF | ) | const [pure virtual] |
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.
Implemented in llvm::SystemZFrameLowering, llvm::AMDGPUFrameLowering, llvm::X86FrameLowering, llvm::AArch64FrameLowering, llvm::PPCFrameLowering, llvm::ARMFrameLowering, llvm::Thumb1FrameLowering, llvm::MSP430FrameLowering, llvm::XCoreFrameLowering, llvm::SparcFrameLowering, llvm::NVPTXFrameLowering, llvm::HexagonFrameLowering, llvm::MipsSEFrameLowering, and llvm::Mips16FrameLowering.
virtual const SpillSlot* llvm::TargetFrameLowering::getCalleeSavedSpillSlots | ( | unsigned & | NumEntries | ) | const [inline, virtual] |
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::AMDGPUFrameLowering, and llvm::SystemZFrameLowering.
Definition at line 119 of file TargetFrameLowering.h.
int TargetFrameLowering::getFrameIndexOffset | ( | const MachineFunction & | MF, |
int | FI | ||
) | const [virtual] |
getFrameIndexOffset - Returns the displacement from the frame register to the stack frame of the specified index.
getFrameIndexOffset - Returns the displacement from the frame register to the stack frame of the specified index. This is the default implementation which is overridden for some targets.
Reimplemented in llvm::X86FrameLowering, llvm::ARMFrameLowering, llvm::SystemZFrameLowering, llvm::HexagonFrameLowering, llvm::AArch64FrameLowering, and llvm::AMDGPUFrameLowering.
Definition at line 29 of file TargetFrameLoweringImpl.cpp.
References llvm::MachineFunction::getFrameInfo(), llvm::MachineFrameInfo::getObjectOffset(), llvm::MachineFrameInfo::getOffsetAdjustment(), getOffsetOfLocalArea(), and llvm::MachineFrameInfo::getStackSize().
Referenced by llvm::SystemZRegisterInfo::eliminateFrameIndex(), getFrameIndexReference(), and llvm::AMDGPUInstrInfo::getIndirectIndexEnd().
int TargetFrameLowering::getFrameIndexReference | ( | const MachineFunction & | MF, |
int | FI, | ||
unsigned & | FrameReg | ||
) | const [virtual] |
getFrameIndexReference - This method should return the base register and offset used to reference a frame index location. The offset is returned directly, and the base register is returned via FrameReg.
Reimplemented in llvm::X86FrameLowering, llvm::ARMFrameLowering, and llvm::AArch64FrameLowering.
Definition at line 36 of file TargetFrameLoweringImpl.cpp.
References getFrameIndexOffset(), llvm::TargetRegisterInfo::getFrameRegister(), llvm::TargetSubtargetInfo::getRegisterInfo(), and llvm::MachineFunction::getSubtarget().
Referenced by emitDebugValueComment().
int llvm::TargetFrameLowering::getOffsetOfLocalArea | ( | ) | const [inline] |
getOffsetOfLocalArea - This method returns the offset of the local area from the stack pointer on entrance to a function.
Definition at line 89 of file TargetFrameLowering.h.
Referenced by llvm::X86FrameLowering::assignCalleeSavedSpillSlots(), llvm::AArch64FrameLowering::emitCalleeSavedFrameMoves(), llvm::SystemZFrameLowering::getFrameIndexOffset(), llvm::X86FrameLowering::getFrameIndexOffset(), getFrameIndexOffset(), and llvm::MachineFrameInfo::print().
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 70 of file TargetFrameLowering.h.
Referenced by llvm::PPCFrameLowering::addScavengingSpillSlot(), checkNumAlignedDPRCS2Regs(), llvm::MachineFrameInfo::CreateFixedObject(), llvm::MachineFrameInfo::CreateFixedSpillStackObject(), llvm::PPCFrameLowering::determineFrameLayout(), llvm::AArch64FrameLowering::eliminateCallFramePseudoInstr(), llvm::MSP430FrameLowering::eliminateCallFramePseudoInstr(), llvm::XCoreFrameLowering::eliminateCallFramePseudoInstr(), llvm::Thumb1FrameLowering::eliminateCallFramePseudoInstr(), llvm::X86FrameLowering::eliminateCallFramePseudoInstr(), llvm::Thumb1FrameLowering::emitEpilogue(), llvm::ARMFrameLowering::emitEpilogue(), llvm::X86FrameLowering::emitEpilogue(), llvm::Thumb1FrameLowering::emitPrologue(), llvm::XCoreFrameLowering::emitPrologue(), llvm::ARMFrameLowering::emitPrologue(), llvm::X86FrameLowering::emitPrologue(), EnsureStackAlignment(), llvm::MipsFrameLowering::estimateStackSize(), llvm::MachineFrameInfo::estimateStackSize(), llvm::MipsSEFrameLowering::hasReservedCallFrame(), llvm::PPCRegisterInfo::lowerDynamicAlloc(), llvm::ARMBaseRegisterInfo::needsFrameBaseReg(), llvm::PPCRegisterInfo::needsStackRealignment(), llvm::ARMBaseRegisterInfo::needsStackRealignment(), and llvm::ARMFrameLowering::processFunctionBeforeCalleeSavedScan().
StackDirection llvm::TargetFrameLowering::getStackGrowthDirection | ( | ) | const [inline] |
getStackGrowthDirection - Return the direction the stack grows
Definition at line 64 of file TargetFrameLowering.h.
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 76 of file TargetFrameLowering.h.
Referenced by llvm::MachineFrameInfo::estimateStackSize().
virtual bool llvm::TargetFrameLowering::hasFP | ( | const MachineFunction & | MF | ) | const [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::X86FrameLowering, llvm::AArch64FrameLowering, llvm::XCoreFrameLowering, llvm::MSP430FrameLowering, llvm::HexagonFrameLowering, llvm::SystemZFrameLowering, llvm::ARMFrameLowering, llvm::AMDGPUFrameLowering, llvm::PPCFrameLowering, llvm::SparcFrameLowering, llvm::MipsFrameLowering, and llvm::NVPTXFrameLowering.
Referenced by canSimplifyCallFramePseudos(), llvm::MSP430RegisterInfo::eliminateFrameIndex(), llvm::XCoreRegisterInfo::eliminateFrameIndex(), llvm::Thumb1RegisterInfo::eliminateFrameIndex(), llvm::HexagonRegisterInfo::eliminateFrameIndex(), estimateRSStackSizeLimit(), llvm::MSP430RegisterInfo::getCalleeSavedRegs(), llvm::XCoreRegisterInfo::getCalleeSavedRegs(), llvm::MSP430RegisterInfo::getFrameRegister(), llvm::XCoreRegisterInfo::getFrameRegister(), llvm::SystemZRegisterInfo::getFrameRegister(), llvm::MipsRegisterInfo::getFrameRegister(), llvm::HexagonRegisterInfo::getFrameRegister(), llvm::AArch64RegisterInfo::getFrameRegister(), llvm::PPCRegisterInfo::getFrameRegister(), llvm::ARMBaseRegisterInfo::getFrameRegister(), llvm::PPCRegisterInfo::getRegPressureLimit(), llvm::MipsRegisterInfo::getRegPressureLimit(), llvm::AArch64RegisterInfo::getRegPressureLimit(), llvm::ARMBaseRegisterInfo::getRegPressureLimit(), llvm::MSP430RegisterInfo::getReservedRegs(), llvm::XCoreRegisterInfo::getReservedRegs(), llvm::SystemZRegisterInfo::getReservedRegs(), llvm::MipsRegisterInfo::getReservedRegs(), llvm::AArch64RegisterInfo::getReservedRegs(), llvm::ARMBaseRegisterInfo::getReservedRegs(), hasReservedCallFrame(), llvm::AArch64RegisterInfo::isReservedReg(), llvm::AArch64RegisterInfo::needsFrameBaseReg(), and llvm::ARMBaseRegisterInfo::needsFrameBaseReg().
virtual bool llvm::TargetFrameLowering::hasReservedCallFrame | ( | const MachineFunction & | MF | ) | const [inline, virtual] |
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::X86FrameLowering, llvm::AArch64FrameLowering, llvm::MSP430FrameLowering, llvm::SystemZFrameLowering, llvm::ARMFrameLowering, llvm::Mips16FrameLowering, llvm::Thumb1FrameLowering, llvm::MipsSEFrameLowering, and llvm::SparcFrameLowering.
Definition at line 177 of file TargetFrameLowering.h.
References hasFP().
Referenced by llvm::ARMBaseRegisterInfo::canRealignStack(), canSimplifyCallFramePseudos(), llvm::AArch64FrameLowering::eliminateCallFramePseudoInstr(), llvm::XCoreFrameLowering::eliminateCallFramePseudoInstr(), llvm::Thumb1RegisterInfo::eliminateFrameIndex(), llvm::MipsFrameLowering::estimateStackSize(), and llvm::MachineFrameInfo::estimateStackSize().
virtual bool llvm::TargetFrameLowering::isFPCloseToIncomingSP | ( | ) | const [inline, virtual] |
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::SystemZFrameLowering.
Definition at line 94 of file TargetFrameLowering.h.
bool llvm::TargetFrameLowering::isStackRealignable | ( | ) | const [inline] |
isStackRealignable - This method returns whether the stack can be realigned.
Definition at line 82 of file TargetFrameLowering.h.
virtual void llvm::TargetFrameLowering::processFunctionBeforeCalleeSavedScan | ( | MachineFunction & | MF, |
RegScavenger * | RS = nullptr |
||
) | const [inline, virtual] |
processFunctionBeforeCalleeSavedScan - This method is called immediately before PrologEpilogInserter scans the physical registers used to determine what callee saved registers should be spilled. This method is optional.
Reimplemented in llvm::AArch64FrameLowering, llvm::ARMFrameLowering, llvm::XCoreFrameLowering, llvm::X86FrameLowering, llvm::Mips16FrameLowering, llvm::PPCFrameLowering, llvm::MipsSEFrameLowering, llvm::SparcFrameLowering, and llvm::SystemZFrameLowering.
Definition at line 205 of file TargetFrameLowering.h.
Referenced by llvm::PEI::runOnMachineFunction().
virtual void llvm::TargetFrameLowering::processFunctionBeforeFrameFinalized | ( | MachineFunction & | MF, |
RegScavenger * | RS = nullptr |
||
) | const [inline, virtual] |
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::XCoreFrameLowering, llvm::MSP430FrameLowering, llvm::PPCFrameLowering, and llvm::SystemZFrameLowering.
Definition at line 215 of file TargetFrameLowering.h.
Referenced by llvm::PEI::runOnMachineFunction().
virtual bool llvm::TargetFrameLowering::restoreCalleeSavedRegisters | ( | MachineBasicBlock & | MBB, |
MachineBasicBlock::iterator | MI, | ||
const std::vector< CalleeSavedInfo > & | CSI, | ||
const TargetRegisterInfo * | TRI | ||
) | const [inline, virtual] |
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(). Returns false otherwise.
Reimplemented in llvm::X86FrameLowering, llvm::PPCFrameLowering, llvm::AArch64FrameLowering, llvm::MSP430FrameLowering, llvm::HexagonFrameLowering, llvm::ARMFrameLowering, llvm::Mips16FrameLowering, llvm::XCoreFrameLowering, llvm::Thumb1FrameLowering, and llvm::SystemZFrameLowering.
Definition at line 160 of file TargetFrameLowering.h.
virtual bool llvm::TargetFrameLowering::spillCalleeSavedRegisters | ( | MachineBasicBlock & | MBB, |
MachineBasicBlock::iterator | MI, | ||
const std::vector< CalleeSavedInfo > & | CSI, | ||
const TargetRegisterInfo * | TRI | ||
) | const [inline, virtual] |
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::X86FrameLowering, llvm::PPCFrameLowering, llvm::AArch64FrameLowering, llvm::MSP430FrameLowering, llvm::ARMFrameLowering, llvm::MipsSEFrameLowering, llvm::XCoreFrameLowering, llvm::Thumb1FrameLowering, llvm::Mips16FrameLowering, llvm::SystemZFrameLowering, and llvm::HexagonFrameLowering.
Definition at line 149 of file TargetFrameLowering.h.
virtual bool llvm::TargetFrameLowering::targetHandlesStackFrameRounding | ( | ) | const [inline, virtual] |
targetHandlesStackFrameRounding - Returns true if the target is responsible for rounding up the stack frame (probably at emitPrologue time).
Reimplemented in llvm::PPCFrameLowering.
Definition at line 127 of file TargetFrameLowering.h.