LLVM API Documentation

Public Member Functions | Static Public Member Functions
llvm::X86FrameLowering Class Reference

#include <X86FrameLowering.h>

Inheritance diagram for llvm::X86FrameLowering:
Inheritance graph
[legend]
Collaboration diagram for llvm::X86FrameLowering:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 X86FrameLowering (StackDirection D, unsigned StackAl, int LAO)
void emitCalleeSavedFrameMoves (MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, DebugLoc DL) const
void emitPrologue (MachineFunction &MF) const override
void emitEpilogue (MachineFunction &MF, MachineBasicBlock &MBB) const override
void adjustForSegmentedStacks (MachineFunction &MF) const override
void adjustForHiPEPrologue (MachineFunction &MF) const override
void processFunctionBeforeCalleeSavedScan (MachineFunction &MF, RegScavenger *RS=nullptr) const override
bool assignCalleeSavedSpillSlots (MachineFunction &MF, const TargetRegisterInfo *TRI, std::vector< CalleeSavedInfo > &CSI) const override
bool spillCalleeSavedRegisters (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const std::vector< CalleeSavedInfo > &CSI, const TargetRegisterInfo *TRI) const override
bool restoreCalleeSavedRegisters (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const std::vector< CalleeSavedInfo > &CSI, const TargetRegisterInfo *TRI) const override
bool hasFP (const MachineFunction &MF) const override
bool hasReservedCallFrame (const MachineFunction &MF) const override
int getFrameIndexOffset (const MachineFunction &MF, int FI) const override
int getFrameIndexReference (const MachineFunction &MF, int FI, unsigned &FrameReg) const override
void eliminateCallFramePseudoInstr (MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const override

Static Public Member Functions

static void getStackProbeFunction (const X86Subtarget &STI, unsigned &CallOp, const char *&Symbol)

Detailed Description

Definition at line 25 of file X86FrameLowering.h.


Constructor & Destructor Documentation

llvm::X86FrameLowering::X86FrameLowering ( StackDirection  D,
unsigned  StackAl,
int  LAO 
) [inline, explicit]

Definition at line 27 of file X86FrameLowering.h.


Member Function Documentation

void X86FrameLowering::adjustForHiPEPrologue ( MachineFunction MF) const [override, virtual]

Erlang programs may need a special prologue to handle the stack size they might need at runtime. That is because Erlang/OTP does not implement a C stack but uses a custom implementation of hybrid stack/heap architecture. (for more information see Eric Stenman's Ph.D. thesis: http://publications.uu.se/uu/fulltext/nbn_se_uu_diva-2688.pdf)

CheckStack: temp0 = sp - MaxStack if( temp0 < SP_LIMIT(P) ) goto IncStack else goto OldStart OldStart: ... IncStack: call inc_stack # doubles the stack space temp0 = sp - MaxStack if( temp0 < SP_LIMIT(P) ) goto IncStack else goto OldStart

Reimplemented from llvm::TargetFrameLowering.

Definition at line 1562 of file X86FrameLowering.cpp.

References llvm::MachineBasicBlock::addLiveIn(), llvm::addRegOffset(), llvm::MachineBasicBlock::addSuccessor(), llvm::Function::arg_size(), llvm::MachineFunction::begin(), llvm::BuildMI(), llvm::MachineFunction::CreateMachineBasicBlock(), llvm::dyn_cast(), llvm::N86::EBP, llvm::MachineFunction::end(), llvm::N86::ESP, F(), llvm::StringRef::find(), llvm::StringRef::find_first_of(), llvm::MachineFunction::front(), llvm::MCInstrInfo::get(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::MachineOperand::getGlobal(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::Value::getName(), llvm::MachineFunction::getRegInfo(), llvm::TargetSubtargetInfo::getRegisterInfo(), GetScratchRegister(), llvm::MachineFrameInfo::getStackSize(), llvm::TargetMachine::getSubtarget(), llvm::MachineFunction::getSubtarget(), llvm::MachineFunction::getTarget(), llvm::MachineFrameInfo::hasCalls(), I, llvm::MachineOperand::isGlobal(), llvm::MachineRegisterInfo::isLiveIn(), llvm::MachineBasicBlock::livein_begin(), llvm::MachineBasicBlock::livein_end(), llvm::AArch64CC::MI, llvm::StringRef::npos, llvm::MachineFunction::push_front(), TII, and llvm::MachineFunction::verify().

void X86FrameLowering::adjustForSegmentedStacks ( MachineFunction MF) const [override, virtual]
bool X86FrameLowering::assignCalleeSavedSpillSlots ( MachineFunction MF,
const TargetRegisterInfo TRI,
std::vector< CalleeSavedInfo > &  CSI 
) const [override, virtual]
void X86FrameLowering::emitEpilogue ( MachineFunction MF,
MachineBasicBlock MBB 
) const [override, virtual]

Implements llvm::TargetFrameLowering.

Definition at line 848 of file X86FrameLowering.cpp.

References llvm::MachineInstrBuilder::addExternalSymbol(), llvm::MachineInstrBuilder::addGlobalAddress(), llvm::MachineInstrBuilder::addOperand(), llvm::addRegOffset(), llvm::MachineBasicBlock::begin(), llvm::BuildMI(), llvm::MachineInstr::copyImplicitOps(), llvm::TargetOpcode::DBG_VALUE, llvm::ISD::EH_RETURN, emitSPUpdate(), llvm::MachineBasicBlock::end(), llvm::MachineBasicBlock::erase(), ForceStackAlign, FramePtr, llvm::MCInstrInfo::get(), llvm::X86MachineFunctionInfo::getCalleeSavedFrameSize(), llvm::MCAsmInfo::getExceptionHandlingType(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::MachineOperand::getGlobal(), llvm::MachineOperand::getImm(), llvm::MachineFunction::getInfo(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MachineBasicBlock::getLastNonDebugInstr(), getLEArOpcode(), llvm::MachineFrameInfo::getMaxAlignment(), llvm::TargetMachine::getMCAsmInfo(), llvm::MachineOperand::getOffset(), llvm::MachineOperand::getReg(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::TargetFrameLowering::getStackAlignment(), llvm::MachineFrameInfo::getStackSize(), llvm::TargetMachine::getSubtarget(), llvm::MachineFunction::getSubtarget(), llvm::MachineOperand::getSymbolName(), llvm::MachineFunction::getTarget(), llvm::MachineOperand::getTargetFlags(), llvm::X86MachineFunctionInfo::getTCReturnAddrDelta(), llvm::getX86SubSuperRegister(), llvm::MachineFrameInfo::hasCalls(), hasFP(), llvm::MachineFrameInfo::hasVarSizedObjects(), llvm::MVT::i64, llvm::MachineOperand::isGlobal(), llvm::MachineOperand::isImm(), llvm::isMem(), llvm::MachineOperand::isReg(), llvm::MachineOperand::isSymbol(), llvm::RegState::Kill, llvm_unreachable, mergeSPUpdates(), mergeSPUpdatesUp(), llvm::Function::needsUnwindTableEntry(), TII, and llvm::WinEH.

void X86FrameLowering::emitPrologue ( MachineFunction MF) const [override, virtual]

emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.

emitPrologue - Push callee-saved registers onto the stack, which automatically adjust the stack pointer. Adjust the stack pointer to allocate space for local variables. Also emit labels used by the exception handler to generate the exception handling frames.

Implements llvm::TargetFrameLowering.

Definition at line 454 of file X86FrameLowering.cpp.

References llvm::LibFunc::abs, llvm::MachineModuleInfo::addFrameInst(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::addRegOffset(), llvm::MachineFrameInfo::adjustsStack(), llvm::MachineBasicBlock::begin(), llvm::MachineFunction::begin(), llvm::BuildMI(), llvm::TargetOpcode::CFI_INSTRUCTION, contains(), llvm::MCCFIInstruction::createDefCfaOffset(), llvm::MCCFIInstruction::createDefCfaRegister(), llvm::MCCFIInstruction::createOffset(), llvm::RegState::Define, llvm::N86::EAX, emitCalleeSavedFrameMoves(), emitSPUpdate(), llvm::MachineBasicBlock::end(), llvm::MachineFunction::end(), ForceStackAlign, FramePtr, llvm::MachineInstr::FrameSetup, llvm::MachineFunction::front(), llvm::AttributeSet::FunctionIndex, llvm::MCInstrInfo::get(), llvm::Function::getAttributes(), llvm::X86MachineFunctionInfo::getCalleeSavedFrameSize(), llvm::MachineFrameInfo::getCalleeSavedInfo(), llvm::MCAsmInfo::getExceptionHandlingType(), getFrameIndexOffset(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getInfo(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MachineFrameInfo::getMaxAlignment(), llvm::TargetMachine::getMCAsmInfo(), llvm::MachineFunction::getMMI(), llvm::MachineFrameInfo::getObjectOffset(), llvm::MachineInstr::getOperand(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::TargetFrameLowering::getStackAlignment(), getStackProbeFunction(), llvm::MachineFrameInfo::getStackSize(), getSUBriOpcode(), llvm::TargetMachine::getSubtarget(), llvm::MachineFunction::getSubtarget(), llvm::MachineFunction::getTarget(), llvm::X86MachineFunctionInfo::getTCReturnAddrDelta(), llvm::getX86SubSuperRegister(), llvm::AttributeSet::hasAttribute(), llvm::MachineFrameInfo::hasCalls(), llvm::MachineModuleInfo::hasDebugInfo(), hasFP(), llvm::MachineFrameInfo::hasVarSizedObjects(), I, llvm::MVT::i64, llvm::RegState::Implicit, llvm::MachineBasicBlock::insert(), isEAXLiveIn(), llvm::RegState::Kill, mergeSPUpdates(), mergeSPUpdatesDown(), llvm::AArch64CC::MI, llvm::Function::needsUnwindTableEntry(), llvm::Attribute::NoRedZone, llvm::X86MachineFunctionInfo::setCalleeSavedFrameSize(), llvm::MachineInstr::setFlag(), llvm::MachineOperand::setIsDead(), llvm::MachineInstrBuilder::setMIFlag(), llvm::MachineFrameInfo::setOffsetAdjustment(), llvm::MachineFrameInfo::setStackSize(), llvm::MachineFunction::shouldSplitStack(), TII, usesTheStack(), and llvm::WinEH.

int X86FrameLowering::getFrameIndexOffset ( const MachineFunction MF,
int  FI 
) const [override, 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 from llvm::TargetFrameLowering.

Definition at line 1066 of file X86FrameLowering.cpp.

References llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getInfo(), llvm::MachineFrameInfo::getObjectAlignment(), llvm::MachineFrameInfo::getObjectOffset(), llvm::TargetFrameLowering::getOffsetOfLocalArea(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFrameInfo::getStackSize(), llvm::MachineFunction::getSubtarget(), llvm::X86MachineFunctionInfo::getTCReturnAddrDelta(), and hasFP().

Referenced by emitPrologue(), and getFrameIndexReference().

int X86FrameLowering::getFrameIndexReference ( const MachineFunction MF,
int  FI,
unsigned FrameReg 
) const [override, 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 from llvm::TargetFrameLowering.

Definition at line 1109 of file X86FrameLowering.cpp.

References getFrameIndexOffset(), llvm::TargetSubtargetInfo::getRegisterInfo(), and llvm::MachineFunction::getSubtarget().

void X86FrameLowering::getStackProbeFunction ( const X86Subtarget &  STI,
unsigned CallOp,
const char *&  Symbol 
) [static]

Definition at line 355 of file X86FrameLowering.cpp.

Referenced by emitPrologue().

bool X86FrameLowering::hasFP ( const MachineFunction MF) const [override, 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 from llvm::TargetFrameLowering.

Definition at line 39 of file X86FrameLowering.cpp.

References llvm::MachineFunction::getFrameInfo(), and llvm::MachineFrameInfo::hasVarSizedObjects().

Referenced by eliminateCallFramePseudoInstr().

void X86FrameLowering::processFunctionBeforeCalleeSavedScan ( MachineFunction MF,
RegScavenger RS = nullptr 
) const [override, 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 from llvm::TargetFrameLowering.

Definition at line 1273 of file X86FrameLowering.cpp.

References llvm::MachineFrameInfo::CreateFixedObject(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getInfo(), llvm::MachineFunction::getRegInfo(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), llvm::X86MachineFunctionInfo::getTCReturnAddrDelta(), and llvm::MachineRegisterInfo::setPhysRegUsed().

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 from llvm::TargetFrameLowering.

Definition at line 1235 of file X86FrameLowering.cpp.

References llvm::BuildMI(), contains(), llvm::MachineBasicBlock::findDebugLoc(), llvm::MCInstrInfo::get(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::TargetRegisterInfo::getMinimalPhysRegClass(), llvm::MachineBasicBlock::getParent(), llvm::TargetMachine::getSubtarget(), llvm::MachineFunction::getSubtarget(), llvm::MachineFunction::getTarget(), llvm::TargetInstrInfo::loadRegFromStackSlot(), and TII.


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