13#ifndef LLVM_LIB_TARGET_AARCH64_AARCH64MACHINEFUNCTIONINFO_H
14#define LLVM_LIB_TARGET_AARCH64_AARCH64MACHINEFUNCTIONINFO_H
33struct AArch64FunctionInfo;
36class AArch64Subtarget;
56 unsigned BytesInStackArgArea = 0;
61 unsigned ArgumentStackToRestore = 0;
67 unsigned TailCallReservedStack = 0;
71 bool HasStackFrame =
false;
77 int MinSVECSFrameIndex = 0;
78 int MaxSVECSFrameIndex = 0;
81 unsigned CalleeSavedStackSize = 0;
82 unsigned SVECalleeSavedStackSize = 0;
83 bool HasCalleeSavedStackSize =
false;
87 unsigned NumLocalDynamicTLSAccesses = 0;
91 int VarArgsStackIndex = 0;
94 unsigned VarArgsStackOffset = 0;
98 int VarArgsGPRIndex = 0;
102 unsigned VarArgsGPRSize = 0;
106 int VarArgsFPRIndex = 0;
110 unsigned VarArgsFPRSize = 0;
115 int StackHazardSlotIndex = std::numeric_limits<int>::max();
116 int StackHazardCSRSlotIndex = std::numeric_limits<int>::max();
120 bool IsSplitCSR =
false;
124 bool StackRealigned =
false;
128 bool CalleeSaveStackHasFreeSpace =
false;
141 bool HasCalculatedStackSizeSVE =
false;
147 std::optional<bool> HasRedZone;
154 std::optional<int> TaggedBasePointerIndex;
159 unsigned TaggedBasePointerOffset;
163 std::optional<std::string> OutliningStyle;
167 int CalleeSaveBaseToFrameRecordOffset = 0;
171 bool SignReturnAddress =
false;
175 bool SignReturnAddressAll =
false;
178 bool SignWithBKey =
false;
183 bool HasELFSignedGOT =
false;
192 bool BranchTargetEnforcement =
false;
198 bool BranchProtectionPAuthLR =
false;
203 bool HasSwiftAsyncContext =
false;
206 int SwiftAsyncContextFrameIdx = std::numeric_limits<int>::max();
208 bool IsMTETagged =
false;
212 bool IsSVECC =
false;
218 bool HasStreamingModeChanges =
false;
221 mutable std::optional<bool> NeedsDwarfUnwindInfo;
224 mutable std::optional<bool> NeedsAsyncDwarfUnwindInfo;
226 int64_t StackProbeSize = 0;
234 unsigned PredicateRegForFillSpill = 0;
237 int64_t VGIdx = std::numeric_limits<int>::max();
238 int64_t StreamingVGIdx = std::numeric_limits<int>::max();
249 PredicateRegForFillSpill =
Reg;
252 return PredicateRegForFillSpill;
276 ArgumentStackToRestore = bytes;
281 TailCallReservedStack = bytes;
287 HasCalculatedStackSizeSVE =
true;
300 return CalleeSaveStackHasFreeSpace;
303 CalleeSaveStackHasFreeSpace = s;
313 return OutliningStyle;
317 CalleeSavedStackSize =
Size;
318 HasCalleeSavedStackSize =
true;
327 bool ValidateCalleeSavedStackSize =
false;
333 ValidateCalleeSavedStackSize = HasCalleeSavedStackSize;
336 if (!HasCalleeSavedStackSize || ValidateCalleeSavedStackSize) {
341 int64_t MinOffset = std::numeric_limits<int64_t>::max();
342 int64_t MaxOffset = std::numeric_limits<int64_t>::min();
344 int FrameIdx =
Info.getFrameIdx();
349 MinOffset = std::min<int64_t>(
Offset, MinOffset);
350 MaxOffset = std::max<int64_t>(
Offset + ObjSize, MaxOffset);
353 if (SwiftAsyncContextFrameIdx != std::numeric_limits<int>::max()) {
356 MinOffset = std::min<int64_t>(
Offset, MinOffset);
357 MaxOffset = std::max<int64_t>(
Offset + ObjSize, MaxOffset);
360 if (StackHazardCSRSlotIndex != std::numeric_limits<int>::max()) {
362 int64_t ObjSize = MFI.
getObjectSize(StackHazardCSRSlotIndex);
363 MinOffset = std::min<int64_t>(
Offset, MinOffset);
364 MaxOffset = std::max<int64_t>(
Offset + ObjSize, MaxOffset);
367 unsigned Size =
alignTo(MaxOffset - MinOffset, 16);
369 "Invalid size calculated for callee saves");
377 assert(HasCalleeSavedStackSize &&
378 "CalleeSavedStackSize has not been calculated");
379 return CalleeSavedStackSize;
384 SVECalleeSavedStackSize =
Size;
387 return SVECalleeSavedStackSize;
391 MinSVECSFrameIndex = Min;
392 MaxSVECSFrameIndex = Max;
400 return NumLocalDynamicTLSAccesses;
403 std::optional<bool>
hasRedZone()
const {
return HasRedZone; }
425 return StackHazardSlotIndex != std::numeric_limits<int>::max();
429 assert(StackHazardSlotIndex == std::numeric_limits<int>::max());
430 StackHazardSlotIndex =
Index;
434 assert(StackHazardCSRSlotIndex == std::numeric_limits<int>::max());
435 StackHazardCSRSlotIndex =
Index;
442 return JumpTableEntryInfo[
Idx].first;
445 return JumpTableEntryInfo[
Idx].second;
448 if ((
unsigned)
Idx >= JumpTableEntryInfo.size())
449 JumpTableEntryInfo.resize(
Idx+1);
450 JumpTableEntryInfo[
Idx] = std::make_pair(
Size, PCRelSym);
468 : Kind(Kind), Args(Args.begin(), Args.end()) {
484 LOHRelated.
insert(Args.begin(), Args.end());
488 return ForwardedMustTailRegParms;
492 return TaggedBasePointerIndex;
497 return TaggedBasePointerOffset;
500 TaggedBasePointerOffset =
Offset;
504 return CalleeSaveBaseToFrameRecordOffset;
507 CalleeSaveBaseToFrameRecordOffset =
Offset;
529 HasSwiftAsyncContext = HasContext;
534 SwiftAsyncContextFrameIdx = FI;
543 HasStreamingModeChanges = HasChanges;
Analysis containing CSE Info
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
MILOHDirective(MCLOHType Kind, LOHArgs Args)
MCLOHType getKind() const
ArrayRef< const MachineInstr * > LOHArgs
AArch64FunctionInfo - This class is derived from MachineFunctionInfo and contains private AArch64-spe...
void addLOHDirective(MCLOHType Kind, MILOHArgs Args)
Add a LOH directive of this Kind and this Args.
bool needsShadowCallStackPrologueEpilogue(MachineFunction &MF) const
bool branchTargetEnforcement() const
void setHasStackFrame(bool s)
void setSwiftAsyncContextFrameIdx(int FI)
unsigned getTailCallReservedStack() const
unsigned getCalleeSavedStackSize(const MachineFrameInfo &MFI) const
unsigned getVarArgsFPRSize() const
void setCalleeSaveBaseToFrameRecordOffset(int Offset)
void setVarArgsStackOffset(unsigned Offset)
bool hasStackProbing() const
void setVarArgsStackIndex(int Index)
unsigned getArgumentStackToRestore() const
TPIDR2Object & getTPIDR2Obj()
void setTailCallReservedStack(unsigned bytes)
SmallVector< MILOHDirective, 32 > MILOHContainer
void setLocalStackSize(uint64_t Size)
void setCalleeSaveStackHasFreeSpace(bool s)
void setVGIdx(unsigned Idx)
int getCalleeSaveBaseToFrameRecordOffset() const
bool hasELFSignedGOT() const
SmallVectorImpl< ForwardedRegister > & getForwardedMustTailRegParms()
int getMaxSVECSFrameIndex() const
void setIsSplitCSR(bool s)
int getVarArgsFPRIndex() const
bool hasStreamingModeChanges() const
bool shouldSignReturnAddress(const MachineFunction &MF) const
void setPredicateRegForFillSpill(unsigned Reg)
void setOutliningStyle(const std::string &Style)
void incNumLocalDynamicTLSAccesses()
const SetOfInstructions & getLOHRelated() const
void setBytesInStackArgArea(unsigned bytes)
int getVarArgsStackIndex() const
void setVarArgsGPRIndex(int Index)
int getStackHazardSlotIndex() const
unsigned getTaggedBasePointerOffset() const
void setStreamingVGIdx(unsigned FrameIdx)
void setCalleeSavedStackSize(unsigned Size)
int getVarArgsGPRIndex() const
int64_t getStackProbeSize() const
void setSigningInstrLabel(MCSymbol *Label)
uint64_t getStackSizeSVE() const
void setHasSwiftAsyncContext(bool HasContext)
bool branchProtectionPAuthLR() const
void setPStateSMReg(Register Reg)
void setHasRedZone(bool s)
bool hasStackFrame() const
int getStackHazardCSRSlotIndex() const
void setVarArgsFPRSize(unsigned Size)
std::optional< int > getTaggedBasePointerIndex() const
unsigned getVarArgsStackOffset() const
uint64_t getLocalStackSize() const
void setStackRealigned(bool s)
unsigned getJumpTableEntrySize(int Idx) const
bool needsDwarfUnwindInfo(const MachineFunction &MF) const
unsigned getVarArgsGPRSize() const
unsigned getSRetReturnReg() const
void setStackSizeSVE(uint64_t S)
MCSymbol * getJumpTableEntryPCRelSymbol(int Idx) const
bool isStackRealigned() const
Register getPStateSMReg() const
unsigned getNumLocalDynamicTLSAccesses() const
SmallPtrSet< const MachineInstr *, 16 > SetOfInstructions
bool hasSwiftAsyncContext() const
bool hasStackHazardSlotIndex() const
void setTaggedBasePointerOffset(unsigned Offset)
void setStackHazardSlotIndex(int Index)
std::optional< bool > hasRedZone() const
void setSRetReturnReg(unsigned Reg)
void setStackHazardCSRSlotIndex(int Index)
int getSwiftAsyncContextFrameIdx() const
unsigned getPredicateRegForFillSpill() const
bool hasCalculatedStackSizeSVE() const
void setSVECalleeSavedStackSize(unsigned Size)
std::optional< std::string > getOutliningStyle() const
unsigned getBytesInStackArgArea() const
void initializeBaseYamlFields(const yaml::AArch64FunctionInfo &YamlMFI)
const MILOHContainer & getLOHContainer() const
void setJumpTableEntryInfo(int Idx, unsigned Size, MCSymbol *PCRelSym)
unsigned getSVECalleeSavedStackSize() const
int getMinSVECSFrameIndex() const
bool needsAsyncDwarfUnwindInfo(const MachineFunction &MF) const
int64_t getStreamingVGIdx() const
void setVarArgsFPRIndex(int Index)
MachineFunctionInfo * clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB) const override
Make a functionally equivalent copy of this MachineFunctionInfo in MF.
void setVarArgsGPRSize(unsigned Size)
void setTaggedBasePointerIndex(int Index)
MCSymbol * getSigningInstrLabel() const
void setArgumentStackToRestore(unsigned bytes)
void setMinMaxSVECSFrameIndex(int Min, int Max)
void setHasStreamingModeChanges(bool HasChanges)
unsigned getCalleeSavedStackSize() const
bool hasCalleeSaveStackFreeSpace() const
bool shouldSignWithBKey() const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Allocate memory in an ever growing pool, as if by bump-pointer.
static constexpr unsigned NoRegister
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
bool isCalleeSavedInfoValid() const
Has the callee saved info been calculated yet?
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
const std::vector< CalleeSavedInfo > & getCalleeSavedInfo() const
Returns a reference to call saved info vector for the current function.
uint8_t getStackID(int ObjectIdx) const
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
Wrapper class representing virtual and physical registers.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This is an optimization pass for GlobalISel generic memory operations.
static bool isValidMCLOHType(unsigned Kind)
MCLOHType
Linker Optimization Hint Type.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
std::optional< bool > HasRedZone
~AArch64FunctionInfo()=default
AArch64FunctionInfo()=default
void mappingImpl(yaml::IO &YamlIO) override
Targets should override this in a way that mirrors the implementation of llvm::MachineFunctionInfo.
static void mapping(IO &YamlIO, AArch64FunctionInfo &MFI)