LLVM: lib/Target/AArch64/AArch64FrameLowering.cpp File Reference (original) (raw)

Go to the source code of this file.

Macros
#define DEBUG_TYPE "frame-info"
#define CASE(n)
#define CASE(n)
Enumerations
enum class AssignObjectOffsets { No, Yes }
Functions
static bool produceCompactUnwindFrame (const AArch64FrameLowering &, MachineFunction &MF)
static SVEStackSizes determineSVEStackSizes (MachineFunction &MF, AssignObjectOffsets AssignOffsets)
Process all the SVE stack objects and the SVE stack size and offsets for each object.
static unsigned getStackHazardSize (const MachineFunction &MF)
static bool isLikelyToHaveSVEStack (const AArch64FrameLowering &AFL, const MachineFunction &MF)
static unsigned estimateRSStackSizeLimit (MachineFunction &MF)
Look at each instruction that references stack frames and return the stack size limit beyond which some of these instructions will require a scratch register during their expansion later.
static MCRegister getRegisterOrZero (MCRegister Reg, bool HasSVE)
static void getLiveRegsForEntryMBB (LivePhysRegs &LiveRegs, const MachineBasicBlock &MBB)
static bool isTargetWindows (const MachineFunction &MF)
static unsigned getPrologueDeath (MachineFunction &MF, unsigned Reg)
static bool invalidateWindowsRegisterPairing (bool SpillExtendedVolatile, unsigned SpillCount, unsigned Reg1, unsigned Reg2, bool NeedsWinCFI, bool IsFirst, const TargetRegisterInfo *TRI)
static bool invalidateRegisterPairing (bool SpillExtendedVolatile, unsigned SpillCount, unsigned Reg1, unsigned Reg2, bool UsesWinAAPCS, bool NeedsWinCFI, bool NeedsFrameRecord, bool IsFirst, const TargetRegisterInfo *TRI)
Returns true if Reg1 and Reg2 cannot be paired using a ldp/stp instruction.
MCRegister findFreePredicateReg (BitVector &SavedRegs)
bool enableMultiVectorSpillFill (const AArch64Subtarget &Subtarget, MachineFunction &MF)
void computeCalleeSaveRegisterPairs (const AArch64FrameLowering &AFL, MachineFunction &MF, ArrayRef< CalleeSavedInfo > CSI, const TargetRegisterInfo *TRI, SmallVectorImpl< RegPairInfo > &RegPairs, bool NeedsFrameRecord)
static std::optional< int > getMMOFrameID (MachineMemOperand *MMO, const MachineFrameInfo &MFI)
static std::optional< int > getLdStFrameID (const MachineInstr &MI, const MachineFrameInfo &MFI)
static bool isPPRAccess (const MachineInstr &MI)
static bool getSVECalleeSaveSlotRange (const MachineFrameInfo &MFI, int &Min, int &Max)
returns true if there are any SVE callee saves.
static raw_ostream & operator<< (raw_ostream &OS, const StackAccess &SA)
Variables
static cl::opt< bool > EnableRedZone ("aarch64-redzone", cl::desc("enable use of redzone on AArch64"), cl::init(false), cl::Hidden)
static cl::opt< bool > StackTaggingMergeSetTag ("stack-tagging-merge-settag", cl::desc("merge settag instruction in function epilog"), cl::init(true), cl::Hidden)
static cl::opt< bool > OrderFrameObjects ("aarch64-order-frame-objects", cl::desc("sort stack allocations"), cl::init(true), cl::Hidden)
static cl::opt< bool > SplitSVEObjects ("aarch64-split-sve-objects", cl::desc("Split allocation of ZPR & PPR objects"), cl::init(true), cl::Hidden)
cl::opt< bool > EnableHomogeneousPrologEpilog ("homogeneous-prolog-epilog", cl::Hidden, cl::desc("Emit homogeneous prologue and epilogue for the size " "optimization (default = off)"))
static cl::opt< unsigned > StackHazardRemarkSize ("aarch64-stack-hazard-remark-size", cl::init(0), cl::Hidden)
static cl::opt< bool > StackHazardInNonStreaming ("aarch64-stack-hazard-in-non-streaming", cl::init(false), cl::Hidden)
static cl::opt< bool > DisableMultiVectorSpillFill ("aarch64-disable-multivector-spill-fill", cl::desc("Disable use of LD/ST pairs for SME2 or SVE2p1"), cl::init(false), cl::Hidden)
static const unsigned DefaultSafeSPDisplacement = 255
This is the biggest offset to the stack pointer we can encode in aarch64 instructions (without using a separate calculation and a temp register).

CASE [1/2]

Value:

case AArch64::W##n: \

case AArch64::X##n: \

return AArch64::X##n

CASE [2/2]

Value:

case AArch64::B##n: \

case AArch64::H##n: \

case AArch64::S##n: \

case AArch64::D##n: \

case AArch64::Q##n: \

return HasSVE ? AArch64::Z##n : AArch64::Q##n

DEBUG_TYPE

#define DEBUG_TYPE "frame-info"

AssignObjectOffsets

enum class AssignObjectOffsets strong

computeCalleeSaveRegisterPairs()

Definition at line 1665 of file AArch64FrameLowering.cpp.

References llvm::alignTo(), llvm::any_of(), assert(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), contains(), llvm::Count, llvm::CallingConv::CXX_FAST_TLS, llvm::ArrayRef< T >::empty(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::AArch64FunctionInfo::getCalleeSavedStackSize(), llvm::Function::getCallingConv(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getInfo(), llvm::MachineFrameInfo::getObjectAlign(), llvm::AArch64FunctionInfo::getPPRCalleeSavedStackSize(), llvm::AArch64FunctionInfo::getPredicateRegForFillSpill(), getStackHazardSize(), llvm::AArch64FunctionInfo::getSVECalleeSavedStackSize(), llvm::AArch64FunctionInfo::getZPRCalleeSavedStackSize(), llvm::AArch64FunctionInfo::hasCalleeSaveStackFreeSpace(), llvm::AArch64FunctionInfo::hasSplitSVEObjects(), llvm::AArch64FunctionInfo::hasStackHazardSlotIndex(), llvm::AArch64FunctionInfo::hasSwiftAsyncContext(), invalidateRegisterPairing(), invalidateWindowsRegisterPairing(), llvm::AArch64InstrInfo::isFpOrNEON(), isTargetWindows(), llvm_unreachable, llvm::AArch64FrameLowering::needsWinCFI(), llvm::Offset, llvm::CallingConv::PreserveAll, llvm::CallingConv::PreserveMost, produceCompactUnwindFrame(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), Reg, llvm::AArch64FunctionInfo::setCalleeSaveBaseToFrameRecordOffset(), llvm::MachineFrameInfo::setObjectAlignment(), llvm::ArrayRef< T >::size(), TRI, and llvm::CallingConv::Win64.

Referenced by llvm::AArch64FrameLowering::restoreCalleeSavedRegisters(), and llvm::AArch64FrameLowering::spillCalleeSavedRegisters().

determineSVEStackSizes()

Process all the SVE stack objects and the SVE stack size and offsets for each object.

If AssignOffsets is "Yes", the offsets get assigned (and SVE stack sizes set). Returns the size of the SVE stack.

Definition at line 2882 of file AArch64FrameLowering.cpp.

References llvm::alignTo(), assert(), llvm::dbgs(), E(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getInfo(), llvm::MachineFrameInfo::getObjectAlign(), llvm::MachineFrameInfo::getObjectIndexBegin(), llvm::MachineFrameInfo::getObjectIndexEnd(), llvm::MachineFrameInfo::getObjectSize(), llvm::MachineFrameInfo::getStackID(), llvm::MachineFrameInfo::getStackProtectorIndex(), getSVECalleeSaveSlotRange(), llvm::MachineFrameInfo::hasScalableStackID(), llvm::AArch64FunctionInfo::hasSplitSVEObjects(), llvm::MachineFrameInfo::hasStackProtectorIndex(), I, llvm::MachineFrameInfo::isCalleeSavedObjectIndex(), llvm::MachineFrameInfo::isDeadObjectIndex(), LLVM_DEBUG, llvm::Offset, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::report_fatal_error(), llvm::TargetStackID::ScalablePredicateVector, llvm::TargetStackID::ScalableVector, llvm::MachineFrameInfo::setObjectOffset(), llvm::AArch64FunctionInfo::setStackSizeSVE(), and Yes.

Referenced by llvm::AArch64FrameLowering::determineCalleeSaves(), and llvm::AArch64FrameLowering::processFunctionBeforeFrameFinalized().

enableMultiVectorSpillFill()

estimateRSStackSizeLimit()

findFreePredicateReg()

getLdStFrameID()

getLiveRegsForEntryMBB()

getMMOFrameID()

getPrologueDeath()

getRegisterOrZero()

getStackHazardSize()

getSVECalleeSaveSlotRange()

invalidateRegisterPairing()

invalidateWindowsRegisterPairing()

isLikelyToHaveSVEStack()

isPPRAccess()

isTargetWindows()

operator<<()

produceCompactUnwindFrame()

Definition at line 1544 of file AArch64FrameLowering.cpp.

References llvm::Function::getAttributes(), llvm::Function::getCallingConv(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getInfo(), llvm::MachineFunction::getSubtarget(), llvm::AArch64Subtarget::getTargetLowering(), llvm::AArch64FunctionInfo::isSVECC(), llvm::AArch64Subtarget::isTargetMachO(), llvm::AArch64FrameLowering::requiresSaveVG(), and llvm::CallingConv::SwiftTail.

Referenced by computeCalleeSaveRegisterPairs(), and llvm::AArch64FrameLowering::determineCalleeSaves().

DefaultSafeSPDisplacement

DisableMultiVectorSpillFill

cl::opt< bool > DisableMultiVectorSpillFill("aarch64-disable-multivector-spill-fill", cl::desc("Disable use of LD/ST pairs for SME2 or SVE2p1"), cl::init(false), cl::Hidden) ( "aarch64-disable-multivector-spill-fill" , cl::desc("Disable use of LD/ST pairs for SME2 or SVE2p1") , cl::init(false) , cl::Hidden ) static

EnableHomogeneousPrologEpilog

cl::opt< bool > EnableHomogeneousPrologEpilog("homogeneous-prolog-epilog", cl::Hidden, cl::desc("Emit homogeneous prologue and epilogue for the size " "optimization (default = off)")) ( "homogeneous-prolog-epilog" ,
cl::Hidden ,
cl::desc("Emit homogeneous prologue and epilogue for the size " "optimization (default = off)") )

EnableRedZone

cl::opt< bool > EnableRedZone("aarch64-redzone", cl::desc("enable use of redzone on AArch64"), cl::init(false), cl::Hidden) ( "aarch64-redzone" , cl::desc("enable use of redzone on AArch64") , cl::init(false) , cl::Hidden ) static

OrderFrameObjects

cl::opt< bool > OrderFrameObjects("aarch64-order-frame-objects", cl::desc("sort stack allocations"), cl::init(true), cl::Hidden) ( "aarch64-order-frame-objects" , cl::desc("sort stack allocations") , cl::init(true) , cl::Hidden ) static

SplitSVEObjects

cl::opt< bool > SplitSVEObjects("aarch64-split-sve-objects", cl::desc("Split allocation of ZPR & PPR objects"), cl::init(true), cl::Hidden) ( "aarch64-split-sve-objects" , cl::desc("Split allocation of ZPR & PPR objects") , cl::init(true) , cl::Hidden ) static

StackHazardInNonStreaming

cl::opt< bool > StackHazardInNonStreaming("aarch64-stack-hazard-in-non-streaming", cl::init(false), cl::Hidden) ( "aarch64-stack-hazard-in-non-streaming" , cl::init(false) , cl::Hidden ) static

StackHazardRemarkSize

cl::opt< unsigned > StackHazardRemarkSize("aarch64-stack-hazard-remark-size", cl::init(0), cl::Hidden) ( "aarch64-stack-hazard-remark-size" , cl::init(0) , cl::Hidden ) static

StackTaggingMergeSetTag

cl::opt< bool > StackTaggingMergeSetTag("stack-tagging-merge-settag", cl::desc("merge settag instruction in function epilog"), cl::init(true), cl::Hidden) ( "stack-tagging-merge-settag" , cl::desc("merge settag instruction in function epilog") , cl::init(true) , cl::Hidden ) static