|
LLVM
3.7.0
|
#include <X86FrameLowering.h>
Public Member Functions | |
| X86FrameLowering (const X86Subtarget &STI, unsigned StackAlignOverride) | |
| void | emitStackProbeCall (MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, DebugLoc DL) const |
| Emit a call to the target's stack probe function. More... | |
| void | emitCalleeSavedFrameMoves (MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, DebugLoc DL) const |
| void | emitPrologue (MachineFunction &MF, MachineBasicBlock &MBB) const override |
| emitProlog/emitEpilog - These methods insert prolog and epilog code into the function. More... | |
| void | emitEpilogue (MachineFunction &MF, MachineBasicBlock &MBB) const override |
| void | adjustForSegmentedStacks (MachineFunction &MF, MachineBasicBlock &PrologueMBB) const override |
| Adjust the prologue to have the function use segmented stacks. More... | |
| void | adjustForHiPEPrologue (MachineFunction &MF, MachineBasicBlock &PrologueMBB) const override |
| Erlang programs may need a special prologue to handle the stack size they might need at runtime. More... | |
| void | determineCalleeSaves (MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS=nullptr) const override |
| This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() should actually get saved. More... | |
| bool | assignCalleeSavedSpillSlots (MachineFunction &MF, const TargetRegisterInfo *TRI, std::vector< CalleeSavedInfo > &CSI) const override |
| assignCalleeSavedSpillSlots - Allows target to override spill slot assignment logic. More... | |
| bool | spillCalleeSavedRegisters (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const std::vector< CalleeSavedInfo > &CSI, const TargetRegisterInfo *TRI) const override |
| 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... | |
| bool | restoreCalleeSavedRegisters (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const std::vector< CalleeSavedInfo > &CSI, const TargetRegisterInfo *TRI) const override |
| 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... | |
| bool | hasFP (const MachineFunction &MF) const override |
| hasFP - Return true if the specified function should have a dedicated frame pointer register. More... | |
| bool | hasReservedCallFrame (const MachineFunction &MF) const override |
| 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... | |
| bool | canSimplifyCallFramePseudos (const MachineFunction &MF) const override |
| canSimplifyCallFramePseudos - If there is a reserved call frame, the call frame pseudos can be simplified. More... | |
| bool | needsFrameIndexResolution (const MachineFunction &MF) const override |
| int | getFrameIndexOffset (const MachineFunction &MF, int FI) const override |
| getFrameIndexOffset - Returns the displacement from the frame register to the stack frame of the specified index. More... | |
| int | getFrameIndexReference (const MachineFunction &MF, int FI, unsigned &FrameReg) const override |
| getFrameIndexReference - This method should return the base register and offset used to reference a frame index location. More... | |
| int | getFrameIndexOffsetFromSP (const MachineFunction &MF, int FI) const |
| int | getFrameIndexReferenceFromSP (const MachineFunction &MF, int FI, unsigned &FrameReg) const override |
| Same as above, except that the 'base register' will always be RSP, not RBP on x86. More... | |
| void | eliminateCallFramePseudoInstr (MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const override |
| 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). More... | |
| int | mergeSPUpdates (MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, bool doMergeWithPrevious) const |
| Check the instruction before/after the passed instruction. More... | |
| void | emitSPUpdate (MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, int64_t NumBytes, bool InEpilogue) const |
| Emit a series of instructions to increment / decrement the stack pointer by a constant value. More... | |
| bool | canUseLEAForSPInEpilogue (const MachineFunction &MF) const |
Check that LEA can be used on SP in an epilogue sequence for MF. More... | |
| bool | canUseAsEpilogue (const MachineBasicBlock &MBB) const override |
Check whether or not the given MBB can be used as a epilogue for the target. More... | |
Public Member Functions inherited from llvm::TargetFrameLowering | |
| 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... | |
| 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... | |
| 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 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. 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 void | adjustForFrameAllocatePrologue (MachineFunction &MF, MachineBasicBlock &PrologueMBB) const |
| Adjust the prologue to add an allocation at a fixed offset from the frame pointer. More... | |
| virtual bool | noFramePointerElim (const MachineFunction &MF) const |
| Return true if the target needs to disable frame pointer elimination. 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 bool | canUseAsPrologue (const MachineBasicBlock &MBB) const |
Check whether or not the given MBB can be used as a prologue for the target. More... | |
Public Attributes | |
| const X86Subtarget & | STI |
| const TargetInstrInfo & | TII |
| const X86RegisterInfo * | TRI |
| unsigned | SlotSize |
| bool | Is64Bit |
| Is64Bit implies that x86_64 instructions are available. More... | |
| bool | IsLP64 |
| bool | Uses64BitFramePtr |
| True if the 64-bit frame or stack pointer should be used. More... | |
| unsigned | StackPtr |
Additional Inherited Members | |
Public Types inherited from llvm::TargetFrameLowering | |
| enum | StackDirection { StackGrowsUp, StackGrowsDown } |
Definition at line 26 of file X86FrameLowering.h.
| X86FrameLowering::X86FrameLowering | ( | const X86Subtarget & | STI, |
| unsigned | StackAlignOverride | ||
| ) |
Definition at line 40 of file X86FrameLowering.cpp.
References llvm::X86RegisterInfo::getSlotSize(), llvm::X86RegisterInfo::getStackRegister(), Is64Bit, llvm::X86Subtarget::is64Bit(), IsLP64, llvm::X86Subtarget::isTarget64BitLP64(), llvm::X86Subtarget::isTargetNaCl64(), SlotSize, StackPtr, TRI, and Uses64BitFramePtr.
|
overridevirtual |
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 1756 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::DL, llvm::dyn_cast(), llvm::MachineFunction::end(), F(), llvm::StringRef::find(), llvm::StringRef::find_first_of(), llvm::MCInstrInfo::get(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::MachineOperand::getGlobal(), llvm::Value::getName(), llvm::MachineInstr::getOperand(), llvm::MachineFunction::getRegInfo(), GetScratchRegister(), llvm::MachineFrameInfo::getStackSize(), llvm::MachineFrameInfo::hasCalls(), I, Is64Bit, llvm::MachineInstr::isCall(), llvm::MachineOperand::isGlobal(), llvm::MachineRegisterInfo::isLiveIn(), IsLP64, llvm::X86Subtarget::isTargetLinux(), llvm::MachineBasicBlock::livein_begin(), llvm::MachineBasicBlock::livein_end(), llvm::AArch64CC::MI, llvm::StringRef::npos, llvm::MachineFunction::push_front(), SlotSize, STI, TII, and llvm::MachineFunction::verify().
|
overridevirtual |
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 1509 of file X86FrameLowering.cpp.
References llvm::MachineInstrBuilder::addExternalSymbol(), llvm::MachineInstrBuilder::addImm(), llvm::MachineBasicBlock::addLiveIn(), llvm::MachineInstrBuilder::addReg(), llvm::MachineBasicBlock::addSuccessor(), llvm::BuildMI(), llvm::MachineFunction::CreateMachineBasicBlock(), llvm::DL, llvm::MCInstrInfo::get(), llvm::X86MachineFunctionInfo::getArgumentStackSize(), llvm::TargetMachine::getCodeModel(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getInfo(), llvm::MachineFunction::getMMI(), llvm::MachineFunction::getRegInfo(), GetScratchRegister(), llvm::MachineFrameInfo::getStackSize(), llvm::MachineFunction::getTarget(), HasNestArgument(), Is64Bit, llvm::MachineRegisterInfo::isLiveIn(), IsLP64, llvm::X86Subtarget::isTargetDarwin(), llvm::X86Subtarget::isTargetDragonFly(), llvm::X86Subtarget::isTargetFreeBSD(), llvm::X86Subtarget::isTargetLinux(), llvm::X86Subtarget::isTargetWin32(), llvm::X86Subtarget::isTargetWin64(), llvm::Function::isVarArg(), llvm::RegState::Kill, kSplitStackAvailable, llvm::CodeModel::Large, llvm::MachineBasicBlock::livein_begin(), llvm::MachineBasicBlock::livein_end(), llvm::MachineFunction::push_front(), llvm::report_fatal_error(), llvm::MachineRegisterInfo::setPhysRegUsed(), llvm::MachineModuleInfo::setUsesMorestackAddr(), STI, TII, and llvm::MachineFunction::verify().
|
overridevirtual |
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 1293 of file X86FrameLowering.cpp.
References llvm::abs(), contains(), llvm::MachineFrameInfo::CreateFixedSpillStackObject(), llvm::MachineFrameInfo::ensureMaxAlignment(), llvm::TargetRegisterClass::getAlignment(), llvm::MachineFunction::getFrameInfo(), llvm::TargetRegisterInfo::getFrameRegister(), llvm::MachineFunction::getInfo(), llvm::TargetRegisterInfo::getMinimalPhysRegClass(), llvm::TargetFrameLowering::getOffsetOfLocalArea(), llvm::TargetRegisterClass::getSize(), llvm::X86MachineFunctionInfo::getTCReturnAddrDelta(), hasFP(), llvm::TargetRegisterInfo::regsOverlap(), llvm::X86MachineFunctionInfo::setCalleeSavedFrameSize(), and SlotSize.
|
overridevirtual |
canSimplifyCallFramePseudos - If there is a reserved call frame, the call frame pseudos can be simplified.
Having a FP, as in the default implementation, is not sufficient here since we can't always use it. Use a more nuanced condition.
Reimplemented from llvm::TargetFrameLowering.
Definition at line 64 of file X86FrameLowering.cpp.
References llvm::X86RegisterInfo::hasBasePointer(), hasFP(), hasReservedCallFrame(), llvm::X86RegisterInfo::needsStackRealignment(), and TRI.
|
overridevirtual |
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.
Reimplemented from llvm::TargetFrameLowering.
Definition at line 1933 of file X86FrameLowering.cpp.
References canUseLEAForSPInEpilogue(), llvm::MachineBasicBlock::getParent(), and terminatorsNeedFlagsAsInput().
| bool X86FrameLowering::canUseLEAForSPInEpilogue | ( | const MachineFunction & | MF | ) | const |
Check that LEA can be used on SP in an epilogue sequence for MF.
Definition at line 1007 of file X86FrameLowering.cpp.
References llvm::TargetMachine::getMCAsmInfo(), llvm::MachineFunction::getTarget(), hasFP(), and llvm::MCAsmInfo::usesWindowsCFI().
Referenced by canUseAsEpilogue().
|
overridevirtual |
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 from llvm::TargetFrameLowering.
Definition at line 1428 of file X86FrameLowering.cpp.
References llvm::MachineFrameInfo::CreateFixedObject(), llvm::TargetFrameLowering::determineCalleeSaves(), llvm::X86RegisterInfo::getBaseRegister(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getInfo(), llvm::X86MachineFunctionInfo::getTCReturnAddrDelta(), llvm::X86RegisterInfo::hasBasePointer(), llvm::BitVector::set(), SlotSize, and TRI.
|
overridevirtual |
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 1884 of file X86FrameLowering.cpp.
References llvm::MachineBasicBlock::begin(), llvm::MachineBasicBlock::erase(), llvm::TargetInstrInfo::getCallFrameDestroyOpcode(), llvm::TargetFrameLowering::getStackAlignment(), hasReservedCallFrame(), I, llvm::RoundUpToAlignment(), and TII.
| void X86FrameLowering::emitCalleeSavedFrameMoves | ( | MachineBasicBlock & | MBB, |
| MachineBasicBlock::iterator | MBBI, | ||
| DebugLoc | DL | ||
| ) | const |
Definition at line 415 of file X86FrameLowering.cpp.
References llvm::MCCFIInstruction::createOffset(), llvm::MachineFrameInfo::getCalleeSavedInfo(), llvm::MachineModuleInfo::getContext(), llvm::MCRegisterInfo::getDwarfRegNum(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getMMI(), llvm::MachineFrameInfo::getObjectOffset(), llvm::MachineBasicBlock::getParent(), llvm::MCContext::getRegisterInfo(), and I.
Referenced by emitPrologue().
|
overridevirtual |
Implements llvm::TargetFrameLowering.
Definition at line 1018 of file X86FrameLowering.cpp.
References llvm::addRegOffset(), llvm::MachineBasicBlock::begin(), llvm::BuildMI(), calculateSetFPREG(), llvm::TargetOpcode::DBG_VALUE, llvm::DL, emitSPUpdate(), llvm::MachineBasicBlock::end(), FramePtr, llvm::MCInstrInfo::get(), llvm::X86MachineFunctionInfo::getCalleeSavedFrameSize(), llvm::MachineBasicBlock::getFirstTerminator(), llvm::MachineFunction::getFrameInfo(), llvm::X86RegisterInfo::getFrameRegister(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getInfo(), getLEArOpcode(), llvm::TargetMachine::getMCAsmInfo(), llvm::MachineFrameInfo::getStackSize(), llvm::MachineFunction::getTarget(), llvm::X86MachineFunctionInfo::getTCReturnAddrDelta(), llvm::getX86SubSuperRegister(), hasFP(), llvm::MachineFrameInfo::hasVarSizedObjects(), llvm::MVT::i64, Is64Bit, llvm::X86Subtarget::isTarget64BitILP32(), mergeSPUpdates(), mergeSPUpdatesUp(), llvm::X86RegisterInfo::needsStackRealignment(), llvm::Function::needsUnwindTableEntry(), llvm::RoundUpToAlignment(), SlotSize, StackPtr, STI, TII, TRI, Uses64BitFramePtr, and llvm::MCAsmInfo::usesWindowsCFI().
|
overridevirtual |
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 638 of file X86FrameLowering.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::addRegOffset(), llvm::MachineFrameInfo::adjustsStack(), llvm::MachineBasicBlock::begin(), llvm::MachineFunction::begin(), llvm::BuildMI(), calculateSetFPREG(), contains(), llvm::MCCFIInstruction::createDefCfaOffset(), llvm::MCCFIInstruction::createDefCfaRegister(), llvm::MCCFIInstruction::createOffset(), llvm::DL, emitCalleeSavedFrameMoves(), emitSPUpdate(), emitStackProbeCall(), llvm::MachineBasicBlock::end(), llvm::MachineFunction::end(), FramePtr, llvm::MachineInstr::FrameSetup, llvm::MCInstrInfo::get(), llvm::StringRef::getAsInteger(), llvm::X86RegisterInfo::getBaseRegister(), llvm::X86MachineFunctionInfo::getCalleeSavedFrameSize(), llvm::Function::getCallingConv(), llvm::Function::getFnAttribute(), getFrameIndexOffset(), llvm::MachineFunction::getFrameInfo(), llvm::X86RegisterInfo::getFrameRegister(), llvm::MachineFunction::getFunction(), llvm::X86MachineFunctionInfo::getHasSEHFramePtrSave(), llvm::MachineFunction::getInfo(), llvm::TargetMachine::getMCAsmInfo(), llvm::MachineFunction::getMMI(), llvm::X86MachineFunctionInfo::getRestoreBasePointer(), llvm::X86MachineFunctionInfo::getRestoreBasePointerOffset(), llvm::X86MachineFunctionInfo::getSEHFramePtrSaveIndex(), llvm::MachineFrameInfo::getStackSize(), llvm::MachineFunction::getSubtarget(), llvm::MachineFunction::getTarget(), llvm::X86MachineFunctionInfo::getTCReturnAddrDelta(), llvm::Attribute::getValueAsString(), llvm::getX86SubSuperRegister(), llvm::X86RegisterInfo::hasBasePointer(), llvm::MachineModuleInfo::hasDebugInfo(), llvm::Function::hasFnAttribute(), hasFP(), llvm::MachineFrameInfo::hasVarSizedObjects(), I, llvm::MVT::i64, llvm::MachineBasicBlock::insert(), Is64Bit, llvm::X86Subtarget::isCallingConvWin64(), isEAXLiveIn(), llvm::isInt< 32 >(), llvm::X86Subtarget::isOSWindows(), llvm::TargetInstrInfo::isStoreToStackSlot(), llvm::X86Subtarget::isTarget64BitILP32(), llvm::X86Subtarget::isTargetMachO(), llvm::isUInt< 32 >(), llvm::RegState::Kill, mergeSPUpdates(), llvm::X86RegisterInfo::needsStackRealignment(), llvm::Function::needsUnwindTableEntry(), llvm::Attribute::NoRedZone, llvm::report_fatal_error(), llvm::RoundUpToAlignment(), llvm::X86MachineFunctionInfo::setCalleeSavedFrameSize(), llvm::MachineInstr::setFlag(), llvm::MachineInstrBuilder::setMIFlag(), llvm::MachineFrameInfo::setOffsetAdjustment(), llvm::MachineFrameInfo::setStackSize(), llvm::MachineFunction::shouldSplitStack(), SlotSize, StackPtr, STI, TII, TRI, Uses64BitFramePtr, usesTheStack(), and llvm::MCAsmInfo::usesWindowsCFI().
| void X86FrameLowering::emitSPUpdate | ( | MachineBasicBlock & | MBB, |
| MachineBasicBlock::iterator & | MBBI, | ||
| int64_t | NumBytes, | ||
| bool | InEpilogue | ||
| ) | const |
Emit a series of instructions to increment / decrement the stack pointer by a constant value.
emitSPUpdate - Emit a series of instructions to increment / decrement the stack pointer by a constant value.
Definition at line 242 of file X86FrameLowering.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::DL, findDeadCallerSavedReg(), llvm::MachineBasicBlock::findDebugLoc(), llvm::MachineInstr::FrameSetup, llvm::MCInstrInfo::get(), getADDrrOpcode(), llvm::getDefRegState(), llvm::MachineInstr::getOperand(), llvm::MachineBasicBlock::getParent(), getSUBrrOpcode(), llvm::getUndefRegState(), Is64Bit, isEAXLiveIn(), llvm::AArch64CC::MI, fuzzer::min(), llvm::MachineInstr::setFlag(), llvm::MachineOperand::setIsDead(), llvm::MachineInstrBuilder::setMIFlag(), StackPtr, TII, and TRI.
Referenced by emitEpilogue(), and emitPrologue().
| void X86FrameLowering::emitStackProbeCall | ( | MachineFunction & | MF, |
| MachineBasicBlock & | MBB, | ||
| MachineBasicBlock::iterator | MBBI, | ||
| DebugLoc | DL | ||
| ) | const |
Emit a call to the target's stack probe function.
This is required for all large stack allocations on Windows. The caller is required to materialize the number of bytes to probe in RAX/EAX.
Definition at line 456 of file X86FrameLowering.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::AX, llvm::BuildMI(), llvm::RegState::Define, llvm::MCInstrInfo::get(), llvm::TargetMachine::getCodeModel(), llvm::MachineFunction::getTarget(), llvm::RegState::Implicit, Is64Bit, llvm::X86Subtarget::isTargetCygMing(), llvm::CodeModel::Large, llvm::SP, STI, llvm::ARMBuildAttrs::Symbol, and TII.
Referenced by emitPrologue().
|
overridevirtual |
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 1137 of file X86FrameLowering.cpp.
References calculateSetFPREG(), llvm::X86MachineFunctionInfo::getCalleeSavedFrameSize(), llvm::X86MachineFunctionInfo::getFAIndex(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getInfo(), llvm::TargetMachine::getMCAsmInfo(), llvm::MachineFrameInfo::getObjectAlignment(), llvm::MachineFrameInfo::getObjectOffset(), llvm::TargetFrameLowering::getOffsetOfLocalArea(), llvm::X86MachineFunctionInfo::getRestoreBasePointer(), llvm::MachineFrameInfo::getStackSize(), llvm::MachineFunction::getTarget(), llvm::X86MachineFunctionInfo::getTCReturnAddrDelta(), llvm::X86RegisterInfo::hasBasePointer(), llvm::MachineFrameInfo::hasCalls(), hasFP(), llvm::X86RegisterInfo::needsStackRealignment(), SlotSize, TRI, and llvm::MCAsmInfo::usesWindowsCFI().
Referenced by llvm::X86RegisterInfo::eliminateFrameIndex(), emitPrologue(), and getFrameIndexReference().
| int X86FrameLowering::getFrameIndexOffsetFromSP | ( | const MachineFunction & | MF, |
| int | FI | ||
| ) | const |
Definition at line 1225 of file X86FrameLowering.cpp.
References llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getInfo(), llvm::MachineFrameInfo::getObjectOffset(), llvm::TargetFrameLowering::getOffsetOfLocalArea(), llvm::MachineFrameInfo::getStackSize(), llvm::X86RegisterInfo::hasBasePointer(), and TRI.
Referenced by llvm::X86RegisterInfo::eliminateFrameIndex(), and getFrameIndexReferenceFromSP().
|
overridevirtual |
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 1210 of file X86FrameLowering.cpp.
References llvm::X86RegisterInfo::getBaseRegister(), getFrameIndexOffset(), llvm::X86RegisterInfo::getFrameRegister(), llvm::X86RegisterInfo::getStackRegister(), llvm::X86RegisterInfo::hasBasePointer(), llvm::X86RegisterInfo::needsStackRealignment(), and TRI.
|
overridevirtual |
Same as above, except that the 'base register' will always be RSP, not RBP on x86.
This is used exclusively for lowering STATEPOINT nodes. TODO: This should really be a parameterizable choice.
Reimplemented from llvm::TargetFrameLowering.
Definition at line 1284 of file X86FrameLowering.cpp.
References getFrameIndexOffsetFromSP(), llvm::X86RegisterInfo::getStackRegister(), llvm::X86RegisterInfo::hasBasePointer(), and TRI.
|
overridevirtual |
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 86 of file X86FrameLowering.cpp.
References llvm::MachineModuleInfo::callsEHReturn(), llvm::MachineModuleInfo::callsUnwindInit(), llvm::TargetOptions::DisableFramePointerElim(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getInfo(), llvm::MachineFunction::getMMI(), llvm::MachineFunction::getTarget(), llvm::MachineFrameInfo::hasOpaqueSPAdjustment(), llvm::MachineFrameInfo::hasPatchPoint(), llvm::MachineFrameInfo::hasStackMap(), llvm::MachineFrameInfo::hasVarSizedObjects(), llvm::MachineFrameInfo::isFrameAddressTaken(), llvm::X86RegisterInfo::needsStackRealignment(), llvm::TargetMachine::Options, and TRI.
Referenced by assignCalleeSavedSpillSlots(), canSimplifyCallFramePseudos(), canUseLEAForSPInEpilogue(), llvm::X86RegisterInfo::eliminateFrameIndex(), emitEpilogue(), emitPrologue(), getFrameIndexOffset(), llvm::X86RegisterInfo::getFrameRegister(), llvm::X86RegisterInfo::getRegPressureLimit(), llvm::X86RegisterInfo::getReservedRegs(), and LowerSEHRESTOREFRAME().
|
overridevirtual |
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 54 of file X86FrameLowering.cpp.
References llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getInfo(), and llvm::MachineFrameInfo::hasVarSizedObjects().
Referenced by canSimplifyCallFramePseudos(), and eliminateCallFramePseudoInstr().
| int X86FrameLowering::mergeSPUpdates | ( | MachineBasicBlock & | MBB, |
| MachineBasicBlock::iterator & | MBBI, | ||
| bool | doMergeWithPrevious | ||
| ) | const |
Check the instruction before/after the passed instruction.
If it is an ADD/SUB/LEA instruction it is deleted argument and the stack adjustment is returned as a positive value for ADD/LEA and a negative for SUB.
Definition at line 374 of file X86FrameLowering.cpp.
References llvm::MachineBasicBlock::begin(), llvm::MachineBasicBlock::end(), llvm::MachineBasicBlock::erase(), and StackPtr.
Referenced by emitEpilogue(), and emitPrologue().
|
overridevirtual |
Reimplemented from llvm::TargetFrameLowering.
Definition at line 78 of file X86FrameLowering.cpp.
References llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getInfo(), and llvm::MachineFrameInfo::hasStackObjects().
|
overridevirtual |
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 1395 of file X86FrameLowering.cpp.
References llvm::BuildMI(), contains(), llvm::MachineBasicBlock::findDebugLoc(), llvm::MCInstrInfo::get(), llvm::TargetRegisterInfo::getMinimalPhysRegClass(), llvm::X86Subtarget::is64Bit(), llvm::TargetInstrInfo::loadRegFromStackSlot(), STI, and TII.
|
overridevirtual |
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 1355 of file X86FrameLowering.cpp.
References llvm::MachineBasicBlock::addLiveIn(), llvm::BuildMI(), contains(), llvm::MachineBasicBlock::findDebugLoc(), llvm::MachineInstr::FrameSetup, llvm::MCInstrInfo::get(), llvm::TargetRegisterInfo::getMinimalPhysRegClass(), llvm::X86Subtarget::is64Bit(), llvm::RegState::Kill, llvm::AArch64CC::MI, llvm::MachineInstrBuilder::setMIFlag(), STI, llvm::TargetInstrInfo::storeRegToStackSlot(), and TII.
| bool llvm::X86FrameLowering::Is64Bit |
Is64Bit implies that x86_64 instructions are available.
Definition at line 39 of file X86FrameLowering.h.
Referenced by adjustForHiPEPrologue(), adjustForSegmentedStacks(), emitEpilogue(), emitPrologue(), emitSPUpdate(), emitStackProbeCall(), and X86FrameLowering().
| bool llvm::X86FrameLowering::IsLP64 |
Definition at line 41 of file X86FrameLowering.h.
Referenced by adjustForHiPEPrologue(), adjustForSegmentedStacks(), and X86FrameLowering().
| unsigned llvm::X86FrameLowering::SlotSize |
Definition at line 36 of file X86FrameLowering.h.
Referenced by adjustForHiPEPrologue(), assignCalleeSavedSpillSlots(), determineCalleeSaves(), emitEpilogue(), emitPrologue(), getFrameIndexOffset(), and X86FrameLowering().
| unsigned llvm::X86FrameLowering::StackPtr |
Definition at line 48 of file X86FrameLowering.h.
Referenced by emitEpilogue(), emitPrologue(), emitSPUpdate(), mergeSPUpdates(), and X86FrameLowering().
| const X86Subtarget& llvm::X86FrameLowering::STI |
Definition at line 32 of file X86FrameLowering.h.
Referenced by adjustForHiPEPrologue(), adjustForSegmentedStacks(), emitEpilogue(), emitPrologue(), emitStackProbeCall(), restoreCalleeSavedRegisters(), and spillCalleeSavedRegisters().
| const TargetInstrInfo& llvm::X86FrameLowering::TII |
Definition at line 33 of file X86FrameLowering.h.
Referenced by adjustForHiPEPrologue(), adjustForSegmentedStacks(), eliminateCallFramePseudoInstr(), emitEpilogue(), emitPrologue(), emitSPUpdate(), emitStackProbeCall(), restoreCalleeSavedRegisters(), and spillCalleeSavedRegisters().
| const X86RegisterInfo* llvm::X86FrameLowering::TRI |
Definition at line 34 of file X86FrameLowering.h.
Referenced by canSimplifyCallFramePseudos(), determineCalleeSaves(), emitEpilogue(), emitPrologue(), emitSPUpdate(), getFrameIndexOffset(), getFrameIndexOffsetFromSP(), getFrameIndexReference(), getFrameIndexReferenceFromSP(), hasFP(), and X86FrameLowering().
| bool llvm::X86FrameLowering::Uses64BitFramePtr |
True if the 64-bit frame or stack pointer should be used.
True for most 64-bit targets with the exception of x32. If this is false, 32-bit instruction operands should be used to manipulate StackPtr and FramePtr.
Definition at line 46 of file X86FrameLowering.h.
Referenced by emitEpilogue(), emitPrologue(), and X86FrameLowering().
1.8.6