LLVM API Documentation
#include <X86FrameLowering.h>
Definition at line 25 of file X86FrameLowering.h.
llvm::X86FrameLowering::X86FrameLowering | ( | StackDirection | D, |
unsigned | StackAl, | ||
int | LAO | ||
) | [inline, explicit] |
Definition at line 27 of file X86FrameLowering.h.
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] |
Adjust the prologue to have the function use segmented stacks. This works by adding a check even before the "normal" function prologue.
Reimplemented from llvm::TargetFrameLowering.
Definition at line 1351 of file X86FrameLowering.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineBasicBlock::addLiveIn(), llvm::MachineInstrBuilder::addReg(), llvm::MachineBasicBlock::addSuccessor(), llvm::BuildMI(), llvm::MachineFunction::CreateMachineBasicBlock(), llvm::N86::ESP, llvm::MachineFunction::front(), llvm::MCInstrInfo::get(), llvm::X86MachineFunctionInfo::getArgumentStackSize(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getInfo(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MachineFunction::getRegInfo(), GetScratchRegister(), llvm::MachineFrameInfo::getStackSize(), llvm::TargetMachine::getSubtarget(), llvm::MachineFunction::getSubtarget(), llvm::MachineFunction::getTarget(), HasNestArgument(), llvm::MachineRegisterInfo::isLiveIn(), llvm::Function::isVarArg(), llvm::RegState::Kill, kSplitStackAvailable, llvm::MachineBasicBlock::livein_begin(), llvm::MachineBasicBlock::livein_end(), llvm::MachineFunction::push_front(), llvm::report_fatal_error(), llvm::MachineRegisterInfo::setPhysRegUsed(), TII, and llvm::MachineFunction::verify().
bool X86FrameLowering::assignCalleeSavedSpillSlots | ( | MachineFunction & | MF, |
const TargetRegisterInfo * | TRI, | ||
std::vector< CalleeSavedInfo > & | CSI | ||
) | const [override, 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 from llvm::TargetFrameLowering.
Definition at line 1125 of file X86FrameLowering.cpp.
References llvm::LibFunc::abs, contains(), llvm::MachineFrameInfo::CreateFixedSpillStackObject(), llvm::MachineFrameInfo::ensureMaxAlignment(), llvm::TargetRegisterClass::getAlignment(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getInfo(), llvm::TargetFrameLowering::getOffsetOfLocalArea(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::TargetRegisterClass::getSize(), llvm::MachineFunction::getSubtarget(), llvm::X86MachineFunctionInfo::getTCReturnAddrDelta(), hasFP(), llvm::TargetRegisterInfo::regsOverlap(), and llvm::X86MachineFunctionInfo::setCalleeSavedFrameSize().
void X86FrameLowering::eliminateCallFramePseudoInstr | ( | MachineFunction & | MF, |
MachineBasicBlock & | MBB, | ||
MachineBasicBlock::iterator | MI | ||
) | const [override, 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 from llvm::TargetFrameLowering.
Definition at line 1695 of file X86FrameLowering.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineBasicBlock::begin(), llvm::BuildMI(), llvm::MachineBasicBlock::erase(), llvm::MCInstrInfo::get(), getADDriOpcode(), llvm::TargetInstrInfo::getCallFrameDestroyOpcode(), llvm::TargetInstrInfo::getCallFrameSetupOpcode(), llvm::TargetSubtargetInfo::getFrameLowering(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MachineInstr::getOperand(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::TargetFrameLowering::getStackAlignment(), getSUBriOpcode(), llvm::TargetMachine::getSubtarget(), llvm::MachineFunction::getSubtarget(), llvm::TargetMachine::getSubtargetImpl(), llvm::MachineFunction::getTarget(), hasReservedCallFrame(), I, llvm::MachineBasicBlock::insert(), llvm::MachineOperand::setIsDead(), and TII.
void X86FrameLowering::emitCalleeSavedFrameMoves | ( | MachineBasicBlock & | MBB, |
MachineBasicBlock::iterator | MBBI, | ||
DebugLoc | DL | ||
) | const |
Definition at line 310 of file X86FrameLowering.cpp.
References llvm::MachineModuleInfo::addFrameInst(), llvm::BuildMI(), llvm::TargetOpcode::CFI_INSTRUCTION, llvm::MCCFIInstruction::createOffset(), llvm::MCInstrInfo::get(), llvm::MachineFrameInfo::getCalleeSavedInfo(), llvm::MachineModuleInfo::getContext(), llvm::MCRegisterInfo::getDwarfRegNum(), llvm::MachineFunction::getFrameInfo(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MachineFunction::getMMI(), llvm::MachineFrameInfo::getObjectOffset(), llvm::MachineBasicBlock::getParent(), llvm::MCContext::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), I, and TII.
Referenced by emitPrologue().
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] |
hasFP - Return true if the specified function should have a dedicated frame pointer register. This is true if the function has variable sized allocas or if frame pointer elimination is disabled.
Implements llvm::TargetFrameLowering.
Definition at line 46 of file X86FrameLowering.cpp.
References llvm::MachineModuleInfo::callsEHReturn(), llvm::MachineModuleInfo::callsUnwindInit(), llvm::TargetOptions::DisableFramePointerElim(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getInfo(), llvm::MachineFunction::getMMI(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), llvm::MachineFunction::getTarget(), llvm::MachineFrameInfo::hasInlineAsmWithSPAdjust(), llvm::MachineFrameInfo::hasVarSizedObjects(), llvm::MachineFrameInfo::isFrameAddressTaken(), llvm::TargetRegisterInfo::needsStackRealignment(), and llvm::TargetMachine::Options.
Referenced by assignCalleeSavedSpillSlots(), emitEpilogue(), emitPrologue(), and getFrameIndexOffset().
bool X86FrameLowering::hasReservedCallFrame | ( | 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().
bool X86FrameLowering::restoreCalleeSavedRegisters | ( | MachineBasicBlock & | MBB, |
MachineBasicBlock::iterator | MI, | ||
const std::vector< CalleeSavedInfo > & | CSI, | ||
const TargetRegisterInfo * | TRI | ||
) | const [override, 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 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.
bool X86FrameLowering::spillCalleeSavedRegisters | ( | MachineBasicBlock & | MBB, |
MachineBasicBlock::iterator | MI, | ||
const std::vector< CalleeSavedInfo > & | CSI, | ||
const TargetRegisterInfo * | TRI | ||
) | const [override, 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 from llvm::TargetFrameLowering.
Definition at line 1190 of file X86FrameLowering.cpp.
References llvm::MachineBasicBlock::addLiveIn(), llvm::BuildMI(), contains(), llvm::MachineBasicBlock::findDebugLoc(), llvm::MachineInstr::FrameSetup, llvm::MCInstrInfo::get(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::TargetRegisterInfo::getMinimalPhysRegClass(), llvm::MachineBasicBlock::getParent(), llvm::TargetMachine::getSubtarget(), llvm::MachineFunction::getSubtarget(), llvm::MachineFunction::getTarget(), llvm::RegState::Kill, llvm::AArch64CC::MI, llvm::MachineInstrBuilder::setMIFlag(), llvm::TargetInstrInfo::storeRegToStackSlot(), and TII.