LLVM API Documentation

Public Member Functions | Protected Attributes
llvm::ARMFrameLowering Class Reference

#include <ARMFrameLowering.h>

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

List of all members.

Public Member Functions

 ARMFrameLowering (const ARMSubtarget &sti)
void emitPrologue (MachineFunction &MF) const override
void emitEpilogue (MachineFunction &MF, MachineBasicBlock &MBB) 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
bool canSimplifyCallFramePseudos (const MachineFunction &MF) const override
int getFrameIndexReference (const MachineFunction &MF, int FI, unsigned &FrameReg) const override
int ResolveFrameIndexReference (const MachineFunction &MF, int FI, unsigned &FrameReg, int SPAdj) const
int getFrameIndexOffset (const MachineFunction &MF, int FI) const override
void processFunctionBeforeCalleeSavedScan (MachineFunction &MF, RegScavenger *RS) const override
void adjustForSegmentedStacks (MachineFunction &MF) const override

Protected Attributes

const ARMSubtargetSTI

Detailed Description

Definition at line 22 of file ARMFrameLowering.h.


Constructor & Destructor Documentation

Definition at line 42 of file ARMFrameLowering.cpp.


Member Function Documentation

void ARMFrameLowering::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 1737 of file ARMFrameLowering.cpp.

References llvm::AddDefaultCC(), llvm::AddDefaultPred(), llvm::MachineInstrBuilder::addExternalSymbol(), llvm::MachineModuleInfo::addFrameInst(), llvm::MachineInstrBuilder::addImm(), llvm::MachineBasicBlock::addLiveIn(), llvm::MachineInstrBuilder::addReg(), llvm::MachineBasicBlock::addSuccessor(), alignToARMConstant(), llvm::XCoreISD::BL, llvm::BuildMI(), llvm::TargetOpcode::CFI_INSTRUCTION, llvm::ARMConstantPoolSymbol::Create(), llvm::MCCFIInstruction::createDefCfaOffset(), llvm::MachineFunction::CreateMachineBasicBlock(), llvm::MCCFIInstruction::createOffset(), llvm::ARMFunctionInfo::createPICLabelUId(), llvm::MCCFIInstruction::createSameValue(), llvm::RegState::Define, llvm::MachineFunction::front(), llvm::MachineFunction::getAlignment(), llvm::ARMFunctionInfo::getArgumentStackSize(), llvm::MachineFunction::getConstantPool(), llvm::MachineConstantPool::getConstantPoolIndex(), llvm::Function::getContext(), llvm::MachineModuleInfo::getContext(), llvm::MCRegisterInfo::getDwarfRegNum(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getInfo(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MachineFunction::getMMI(), llvm::MCContext::getRegisterInfo(), llvm::MachineFrameInfo::getStackSize(), llvm::TargetMachine::getSubtarget(), llvm::MachineFunction::getSubtarget(), llvm::MachineFunction::getTarget(), llvm::ARMSubtarget::isTargetAndroid(), llvm::ARMSubtarget::isTargetLinux(), llvm::ARMSubtarget::isThumb(), llvm::ARMSubtarget::isThumb1Only(), llvm::Function::isVarArg(), kSplitStackAvailable, llvm::MachineBasicBlock::livein_begin(), llvm::MachineBasicBlock::livein_end(), llvm::ARMCC::LO, llvm::MachineFunction::push_front(), llvm::report_fatal_error(), llvm::AArch64DB::ST, and llvm::MachineFunction::verify().

canSimplifyCallFramePseudos - If there is a reserved call frame, the call frame pseudos can be simplified. Unlike most targets, having a FP is not sufficient here since we still may reference some objects via SP even when FP is available in Thumb2 mode.

Reimplemented from llvm::TargetFrameLowering.

Definition at line 88 of file ARMFrameLowering.cpp.

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

Referenced by processFunctionBeforeCalleeSavedScan().

void ARMFrameLowering::emitEpilogue ( MachineFunction MF,
MachineBasicBlock MBB 
) const [override, virtual]

Implements llvm::TargetFrameLowering.

Reimplemented in llvm::Thumb1FrameLowering.

Definition at line 570 of file ARMFrameLowering.cpp.

References llvm::AddDefaultPred(), llvm::MachineInstrBuilder::addExternalSymbol(), llvm::MachineInstrBuilder::addGlobalAddress(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstr::addOperand(), llvm::MachineInstrBuilder::addReg(), llvm::ARMCC::AL, Align(), llvm::MachineBasicBlock::begin(), llvm::BuildMI(), llvm::emitARMRegPlusImmediate(), emitSPUpdate(), llvm::emitT2RegPlusImmediate(), llvm::MachineBasicBlock::erase(), FramePtr, llvm::ARMFunctionInfo::getArgRegsSaveSize(), llvm::Function::getCallingConv(), llvm::ARMFunctionInfo::getDPRCalleeSavedAreaSize(), llvm::MachineFunction::getFrameInfo(), llvm::TargetSubtargetInfo::getFrameLowering(), llvm::ARMFunctionInfo::getFramePtrSpillOffset(), llvm::MachineFunction::getFunction(), llvm::MachineOperand::getGlobal(), llvm::ARMFunctionInfo::getGPRCalleeSavedArea1Size(), llvm::ARMFunctionInfo::getGPRCalleeSavedArea2Size(), llvm::MachineFunction::getInfo(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MachineBasicBlock::getLastNonDebugInstr(), llvm::MachineOperand::getOffset(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::TargetFrameLowering::getStackAlignment(), llvm::MachineFrameInfo::getStackSize(), llvm::MachineFunction::getSubtarget(), llvm::TargetMachine::getSubtargetImpl(), llvm::MachineOperand::getSymbolName(), llvm::MachineFunction::getTarget(), llvm::MachineOperand::getTargetFlags(), llvm::CallingConv::GHC, llvm::ARMFunctionInfo::hasStackFrame(), isCSRestore(), llvm::MachineOperand::isGlobal(), llvm::MachineRegisterInfo::isPhysRegUsed(), llvm::MachineOperand::isSymbol(), llvm::ARMSubtarget::isTargetMachO(), llvm::ARMSubtarget::isThumb(), llvm::ARMFunctionInfo::isThumb1OnlyFunction(), llvm::ARMFunctionInfo::isThumbFunction(), llvm::RegState::Kill, llvm::ARMFunctionInfo::shouldRestoreSPFromFP(), STI, TII, and llvm::tryFoldSPUpdateIntoPushPop().

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

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

Implements llvm::TargetFrameLowering.

Reimplemented in llvm::Thumb1FrameLowering.

Definition at line 157 of file ARMFrameLowering.cpp.

References llvm::AddDefaultCC(), llvm::AddDefaultPred(), llvm::MachineInstrBuilder::addExternalSymbol(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::ARMCC::AL, llvm::AArch64CC::AL, Align(), llvm::MachineBasicBlock::begin(), llvm::BuildMI(), llvm::TargetOpcode::CFI_INSTRUCTION, llvm::MCCFIInstruction::createDefCfa(), llvm::MCCFIInstruction::createDefCfaOffset(), llvm::MCCFIInstruction::createDefCfaRegister(), llvm::MCCFIInstruction::createOffset(), llvm::CodeModel::Default, llvm::RegState::Define, emitRegPlusImmediate(), emitSPUpdate(), llvm::MachineBasicBlock::end(), FramePtr, llvm::MachineInstr::FrameSetup, llvm::MachineFunction::front(), llvm::ARMFunctionInfo::getArgRegsSaveSize(), llvm::ARMBaseRegisterInfo::getBaseRegister(), llvm::MachineFrameInfo::getCalleeSavedInfo(), llvm::Function::getCallingConv(), llvm::TargetMachine::getCodeModel(), llvm::MCRegisterInfo::getDwarfRegNum(), llvm::MachineFunction::getFrameInfo(), llvm::TargetSubtargetInfo::getFrameLowering(), llvm::ARMFunctionInfo::getFramePtrSpillOffset(), llvm::ARMBaseRegisterInfo::getFrameRegister(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getInfo(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MachineFrameInfo::getMaxAlignment(), llvm::MachineFunction::getMMI(), llvm::ARMFunctionInfo::getNumAlignedDPRCS2Regs(), llvm::MachineFrameInfo::getObjectOffset(), llvm::MachineFrameInfo::getOffsetAdjustment(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MCContext::getRegisterInfo(), llvm::TargetFrameLowering::getStackAlignment(), llvm::MachineFrameInfo::getStackSize(), llvm::TargetMachine::getSubtargetImpl(), llvm::MachineFunction::getTarget(), llvm::CallingConv::GHC, llvm::ARMBaseRegisterInfo::hasBasePointer(), hasFP(), llvm::ARMFunctionInfo::hasStackFrame(), llvm::MachineFrameInfo::hasVarSizedObjects(), llvm::RegState::Implicit, llvm::ARMSubtarget::isTargetDarwin(), llvm::ARMSubtarget::isTargetELF(), llvm::ARMSubtarget::isTargetWindows(), llvm::ARMFunctionInfo::isThumb1OnlyFunction(), llvm::ARMFunctionInfo::isThumbFunction(), llvm::CodeModel::JITDefault, llvm::CodeModel::Kernel, llvm::RegState::Kill, llvm::CodeModel::Large, llvm::CodeModel::Medium, llvm::ARMBaseRegisterInfo::needsStackRealignment(), llvm::ARMFunctionInfo::setDPRCalleeSavedAreaOffset(), llvm::ARMFunctionInfo::setDPRCalleeSavedAreaSize(), llvm::ARMFunctionInfo::setFramePtrSpillOffset(), llvm::ARMFunctionInfo::setGPRCalleeSavedArea1Offset(), llvm::ARMFunctionInfo::setGPRCalleeSavedArea1Size(), llvm::ARMFunctionInfo::setGPRCalleeSavedArea2Offset(), llvm::ARMFunctionInfo::setGPRCalleeSavedArea2Size(), llvm::MachineInstrBuilder::setMIFlags(), llvm::MachineFrameInfo::setOffsetAdjustment(), llvm::ARMFunctionInfo::setShouldRestoreSPFromFP(), sizeOfSPAdjustment(), skipAlignedDPRCS2Spills(), llvm::CodeModel::Small, STI, TII, llvm::SystemZISD::TM, llvm::tryFoldSPUpdateIntoPushPop(), and WindowsRequiresStackProbe().

int ARMFrameLowering::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 795 of file ARMFrameLowering.cpp.

References getFrameIndexReference().

int ARMFrameLowering::getFrameIndexReference ( const MachineFunction MF,
int  FI,
unsigned FrameReg 
) const [override, virtual]

getFrameIndexReference - Provide a base+offset reference to an FI slot for debug info. It's the same as what we use for resolving the code-gen references for now. FIXME: This can go wrong when references are SP-relative and simple call frames aren't used.

Reimplemented from llvm::TargetFrameLowering.

Definition at line 714 of file ARMFrameLowering.cpp.

References ResolveFrameIndexReference().

Referenced by getFrameIndexOffset().

bool ARMFrameLowering::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.

Reimplemented in llvm::Thumb1FrameLowering.

Definition at line 70 of file ARMFrameLowering.cpp.

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

Referenced by canSimplifyCallFramePseudos(), llvm::ARMBaseRegisterInfo::eliminateFrameIndex(), and ResolveFrameIndexReference().

void ARMFrameLowering::processFunctionBeforeCalleeSavedScan ( MachineFunction MF,
RegScavenger RS 
) 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 1382 of file ARMFrameLowering.cpp.

References llvm::RegScavenger::addScavengingFrameIndex(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::ARMBaseRegisterInfo::cannotEliminateFrame(), canSimplifyCallFramePseudos(), checkNumAlignedDPRCS2Regs(), contains(), llvm::SmallVectorBase::empty(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::SmallVectorImpl< T >::erase(), estimateRSStackSizeLimit(), llvm::HexagonII::FPPos, FramePtr, llvm::SmallVectorTemplateCommon< T, typename >::front(), llvm::TargetRegisterClass::getAlignment(), llvm::ARMFunctionInfo::getArgRegsSaveSize(), llvm::ARMBaseRegisterInfo::getBaseRegister(), llvm::ARMBaseRegisterInfo::getCalleeSavedRegs(), llvm::MachineFunction::getFrameInfo(), llvm::ARMBaseRegisterInfo::getFrameRegister(), GetFunctionSizeInBytes(), llvm::MachineFunction::getInfo(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MachineFunction::getRegInfo(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::TargetRegisterClass::getSize(), llvm::TargetFrameLowering::getStackAlignment(), llvm::MachineFunction::getSubtarget(), llvm::ARMBaseRegisterInfo::hasBasePointer(), hasFP(), llvm::ARMFunctionInfo::hasStackFrame(), llvm::isARMLowRegister(), llvm::MachineRegisterInfo::isPhysRegUsed(), llvm::MachineRegisterInfo::isReserved(), llvm::ARMSubtarget::isTargetDarwin(), llvm::ARMFunctionInfo::isThumb1OnlyFunction(), llvm::ARMFunctionInfo::isThumb2Function(), llvm::ARMBaseRegisterInfo::needsStackRealignment(), llvm::SmallVectorTemplateBase< T, isPodLike >::pop_back(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::ARMFunctionInfo::setHasStackFrame(), llvm::ARMFunctionInfo::setLRIsSpilledForFarJump(), llvm::MachineRegisterInfo::setPhysRegUsed(), llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::SmallVectorTemplateCommon< T >::size(), and STI.

int ARMFrameLowering::ResolveFrameIndexReference ( const MachineFunction MF,
int  FI,
unsigned FrameReg,
int  SPAdj 
) 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(). Returns false otherwise.

Reimplemented from llvm::TargetFrameLowering.

Reimplemented in llvm::Thumb1FrameLowering.

Definition at line 1234 of file ARMFrameLowering.cpp.

References emitAlignedDPRCS2Restores(), llvm::ARMFunctionInfo::getArgRegsSaveSize(), llvm::MachineFunction::getInfo(), llvm::ARMFunctionInfo::getNumAlignedDPRCS2Regs(), llvm::MachineBasicBlock::getParent(), llvm::isARMArea1Register(), llvm::isARMArea2Register(), llvm::isARMArea3Register(), and llvm::ARMFunctionInfo::isThumbFunction().

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.

Reimplemented in llvm::Thumb1FrameLowering.

Definition at line 1203 of file ARMFrameLowering.cpp.

References emitAlignedDPRCS2Spills(), llvm::MachineInstr::FrameSetup, llvm::MachineFunction::getInfo(), llvm::ARMFunctionInfo::getNumAlignedDPRCS2Regs(), llvm::MachineBasicBlock::getParent(), llvm::isARMArea1Register(), llvm::isARMArea2Register(), llvm::isARMArea3Register(), and llvm::ARMFunctionInfo::isThumbFunction().


Member Data Documentation


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