LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
llvm::ARMFrameLowering Class Reference

#include <ARMFrameLowering.h>

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

Public Member Functions

 ARMFrameLowering (const ARMSubtarget &sti)
 
void emitPrologue (MachineFunction &MF) const
 
void emitEpilogue (MachineFunction &MF, MachineBasicBlock &MBB) const
 
bool spillCalleeSavedRegisters (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const std::vector< CalleeSavedInfo > &CSI, const TargetRegisterInfo *TRI) const
 
bool restoreCalleeSavedRegisters (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const std::vector< CalleeSavedInfo > &CSI, const TargetRegisterInfo *TRI) const
 
bool hasFP (const MachineFunction &MF) const
 
bool hasReservedCallFrame (const MachineFunction &MF) const
 
bool canSimplifyCallFramePseudos (const MachineFunction &MF) const
 
int getFrameIndexReference (const MachineFunction &MF, int FI, unsigned &FrameReg) const
 
int ResolveFrameIndexReference (const MachineFunction &MF, int FI, unsigned &FrameReg, int SPAdj) const
 
int getFrameIndexOffset (const MachineFunction &MF, int FI) const
 
void processFunctionBeforeCalleeSavedScan (MachineFunction &MF, RegScavenger *RS) const
 
- 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
 
unsigned getStackAlignment () const
 
unsigned getTransientStackAlignment () const
 
bool isStackRealignable () const
 
int getOffsetOfLocalArea () const
 
virtual bool isFPCloseToIncomingSP () const
 
virtual const SpillSlotgetCalleeSavedSpillSlots (unsigned &NumEntries) const
 
virtual bool targetHandlesStackFrameRounding () const
 
virtual void adjustForSegmentedStacks (MachineFunction &MF) const
 
virtual void adjustForHiPEPrologue (MachineFunction &MF) const
 
virtual void processFunctionBeforeFrameFinalized (MachineFunction &MF, RegScavenger *RS=NULL) const
 

Protected Attributes

const ARMSubtargetSTI
 

Additional Inherited Members

- Public Types inherited from llvm::TargetFrameLowering
enum  StackDirection { StackGrowsUp, StackGrowsDown }
 

Detailed Description

Definition at line 24 of file ARMFrameLowering.h.

Constructor & Destructor Documentation

llvm::ARMFrameLowering::ARMFrameLowering ( const ARMSubtarget sti)
inlineexplicit

Definition at line 29 of file ARMFrameLowering.h.

Member Function Documentation

bool ARMFrameLowering::canSimplifyCallFramePseudos ( const MachineFunction MF) const
virtual

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 81 of file ARMFrameLowering.cpp.

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

Referenced by processFunctionBeforeCalleeSavedScan().

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

Implements llvm::TargetFrameLowering.

Reimplemented in llvm::Thumb1FrameLowering.

Definition at line 361 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(), llvm::emitSPUpdate(), llvm::emitT2RegPlusImmediate(), llvm::MachineBasicBlock::erase(), llvm::ARMFunctionInfo::getArgRegsSaveSize(), llvm::Function::getCallingConv(), llvm::ARMFunctionInfo::getDPRCalleeSavedAreaSize(), llvm::MachineFunction::getFrameInfo(), llvm::TargetMachine::getFrameLowering(), llvm::ARMFunctionInfo::getFramePtrSpillOffset(), llvm::MachineFunction::getFunction(), llvm::MachineOperand::getGlobal(), llvm::ARMFunctionInfo::getGPRCalleeSavedArea1Size(), llvm::ARMFunctionInfo::getGPRCalleeSavedArea2Size(), llvm::MachineFunction::getInfo(), llvm::TargetMachine::getInstrInfo(), llvm::MachineBasicBlock::getLastNonDebugInstr(), llvm::MachineOperand::getOffset(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::TargetMachine::getRegisterInfo(), llvm::TargetFrameLowering::getStackAlignment(), llvm::MachineFrameInfo::getStackSize(), llvm::MachineOperand::getSymbolName(), llvm::MachineFunction::getTarget(), llvm::MachineOperand::getTargetFlags(), llvm::CallingConv::GHC, llvm::ARMFunctionInfo::hasStackFrame(), isCSRestore(), llvm::MachineOperand::isGlobal(), llvm::MachineRegisterInfo::isPhysRegUsed(), llvm::isPopOpcode(), llvm::MachineOperand::isSymbol(), llvm::ARMSubtarget::isTargetIOS(), llvm::ARMSubtarget::isThumb(), llvm::ARMFunctionInfo::isThumb1OnlyFunction(), llvm::ARMFunctionInfo::isThumbFunction(), llvm::RegState::Kill, llvm::prior(), R4, llvm::ARMFunctionInfo::shouldRestoreSPFromFP(), STI, TII, and llvm::tryFoldSPUpdateIntoPushPop().

void ARMFrameLowering::emitPrologue ( MachineFunction MF) const
virtual

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

Implements llvm::TargetFrameLowering.

Reimplemented in llvm::Thumb1FrameLowering.

Definition at line 139 of file ARMFrameLowering.cpp.

References llvm::AddDefaultCC(), llvm::AddDefaultPred(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::ARMCC::AL, Align(), llvm::MachineBasicBlock::begin(), llvm::BuildMI(), llvm::X86II::D8, emitRegPlusImmediate(), llvm::emitSPUpdate(), llvm::MachineBasicBlock::end(), llvm::MachineInstr::FrameSetup, llvm::MachineFunction::front(), llvm::ARMFunctionInfo::getArgRegsSaveSize(), llvm::MachineFrameInfo::getCalleeSavedInfo(), llvm::Function::getCallingConv(), llvm::MachineFunction::getFrameInfo(), llvm::TargetMachine::getFrameLowering(), llvm::ARMFunctionInfo::getFramePtrSpillOffset(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getInfo(), llvm::TargetMachine::getInstrInfo(), llvm::MachineFrameInfo::getMaxAlignment(), llvm::ARMFunctionInfo::getNumAlignedDPRCS2Regs(), llvm::MachineFrameInfo::getObjectOffset(), llvm::MachineFrameInfo::getOffsetAdjustment(), llvm::TargetMachine::getRegisterInfo(), llvm::TargetFrameLowering::getStackAlignment(), llvm::MachineFrameInfo::getStackSize(), llvm::MachineFunction::getTarget(), llvm::CallingConv::GHC, hasFP(), llvm::ARMFunctionInfo::hasStackFrame(), llvm::MachineFrameInfo::hasVarSizedObjects(), llvm::ARMSubtarget::isTargetELF(), llvm::ARMSubtarget::isTargetIOS(), llvm::ARMFunctionInfo::isThumb1OnlyFunction(), llvm::ARMFunctionInfo::isThumbFunction(), llvm::RegState::Kill, R2, R4, R6, llvm::ARMFunctionInfo::setDPRCalleeSavedAreaOffset(), llvm::ARMFunctionInfo::setDPRCalleeSavedAreaSize(), llvm::ARMFunctionInfo::setFramePtrSpillOffset(), llvm::ARMFunctionInfo::setGPRCalleeSavedArea1Offset(), llvm::ARMFunctionInfo::setGPRCalleeSavedArea1Size(), llvm::ARMFunctionInfo::setGPRCalleeSavedArea2Offset(), llvm::ARMFunctionInfo::setGPRCalleeSavedArea2Size(), llvm::MachineFrameInfo::setOffsetAdjustment(), llvm::ARMFunctionInfo::setShouldRestoreSPFromFP(), skipAlignedDPRCS2Spills(), STI, TII, and llvm::tryFoldSPUpdateIntoPushPop().

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

Definition at line 586 of file ARMFrameLowering.cpp.

References getFrameIndexReference().

int ARMFrameLowering::getFrameIndexReference ( const MachineFunction MF,
int  FI,
unsigned FrameReg 
) const
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 505 of file ARMFrameLowering.cpp.

References ResolveFrameIndexReference().

Referenced by getFrameIndexOffset().

bool ARMFrameLowering::hasFP ( const MachineFunction MF) const
virtual
bool ARMFrameLowering::hasReservedCallFrame ( const MachineFunction MF) const
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 63 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
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 1164 of file ARMFrameLowering.cpp.

References llvm::RegScavenger::addScavengingFrameIndex(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::ARMBaseRegisterInfo::cannotEliminateFrame(), canSimplifyCallFramePseudos(), checkNumAlignedDPRCS2Regs(), llvm::SmallVectorBase::empty(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::SmallVectorImpl< T >::erase(), estimateRSStackSizeLimit(), 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::TargetMachine::getInstrInfo(), llvm::MachineFunction::getRegInfo(), llvm::TargetMachine::getRegisterInfo(), llvm::TargetRegisterClass::getSize(), llvm::TargetFrameLowering::getStackAlignment(), llvm::MachineFunction::getTarget(), llvm::ARMBaseRegisterInfo::hasBasePointer(), hasFP(), llvm::ARMFunctionInfo::hasStackFrame(), llvm::isARMLowRegister(), llvm::MachineRegisterInfo::isPhysRegUsed(), llvm::MachineRegisterInfo::isReserved(), llvm::ARMSubtarget::isTargetIOS(), llvm::ARMFunctionInfo::isThumb1OnlyFunction(), llvm::ARMFunctionInfo::isThumb2Function(), MRI, llvm::ARMBaseRegisterInfo::needsStackRealignment(), llvm::SmallVectorTemplateBase< T, isPodLike >::pop_back(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), R2, R4, R6, llvm::ARMFunctionInfo::setHasStackFrame(), llvm::ARMFunctionInfo::setLRIsSpilledForFarJump(), llvm::MachineRegisterInfo::setPhysRegUsed(), llvm::SmallVectorTemplateCommon< T >::size(), llvm::SmallVectorTemplateCommon< T, typename >::size(), and STI.

int ARMFrameLowering::ResolveFrameIndexReference ( const MachineFunction MF,
int  FI,
unsigned FrameReg,
int  SPAdj 
) const
bool ARMFrameLowering::restoreCalleeSavedRegisters ( MachineBasicBlock MBB,
MachineBasicBlock::iterator  MI,
const std::vector< CalleeSavedInfo > &  CSI,
const TargetRegisterInfo TRI 
) const
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.

Reimplemented in llvm::Thumb1FrameLowering.

Definition at line 1016 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().

bool ARMFrameLowering::spillCalleeSavedRegisters ( MachineBasicBlock MBB,
MachineBasicBlock::iterator  MI,
const std::vector< CalleeSavedInfo > &  CSI,
const TargetRegisterInfo TRI 
) const
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.

Reimplemented in llvm::Thumb1FrameLowering.

Definition at line 985 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

const ARMSubtarget& llvm::ARMFrameLowering::STI
protected

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