LLVM 24.0.0git
AArch64MachineFunctionInfo.h
Go to the documentation of this file.
1//=- AArch64MachineFunctionInfo.h - AArch64 machine function info -*- C++ -*-=//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file declares AArch64-specific per-machine-function information.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_AARCH64_AARCH64MACHINEFUNCTIONINFO_H
14#define LLVM_LIB_TARGET_AARCH64_AARCH64MACHINEFUNCTIONINFO_H
15
17#include "AArch64Subtarget.h"
18#include "llvm/ADT/ArrayRef.h"
25#include "llvm/IR/Function.h"
27#include "llvm/MC/MCSymbol.h"
28#include <cassert>
29#include <optional>
30
31namespace llvm {
32
33namespace yaml {
35} // end namespace yaml
36
38class MachineInstr;
39
40/// Condition of signing the return address in a function.
41///
42/// Corresponds to possible values of "sign-return-address" function attribute.
48
49/// AArch64FunctionInfo - This class is derived from MachineFunctionInfo and
50/// contains private AArch64-specific information for each MachineFunction.
52 /// Number of bytes of arguments this function has on the stack. If the callee
53 /// is expected to restore the argument stack this should be a multiple of 16,
54 /// all usable during a tail call.
55 ///
56 /// The alternative would forbid tail call optimisation in some cases: if we
57 /// want to transfer control from a function with 8-bytes of stack-argument
58 /// space to a function with 16-bytes then misalignment of this value would
59 /// make a stack adjustment necessary, which could not be undone by the
60 /// callee.
61 unsigned BytesInStackArgArea = 0;
62
63 /// The number of bytes to restore to deallocate space for incoming
64 /// arguments. Canonically 0 in the C calling convention, but non-zero when
65 /// callee is expected to pop the args.
66 unsigned ArgumentStackToRestore = 0;
67
68 /// Space just below incoming stack pointer reserved for arguments being
69 /// passed on the stack during a tail call. This will be the difference
70 /// between the largest tail call argument space needed in this function and
71 /// what's already available by reusing space of incoming arguments.
72 unsigned TailCallReservedStack = 0;
73
74 /// HasStackFrame - True if this function has a stack frame. Set by
75 /// determineCalleeSaves().
76 bool HasStackFrame = false;
77
78 /// Amount of stack frame size, not including callee-saved registers.
79 uint64_t LocalStackSize = 0;
80
81 /// Amount of stack frame size used for saving callee-saved registers.
82 unsigned CalleeSavedStackSize = 0;
83 unsigned ZPRCalleeSavedStackSize = 0;
84 unsigned PPRCalleeSavedStackSize = 0;
85 bool HasCalleeSavedStackSize = false;
86 bool HasSVECalleeSavedStackSize = false;
87
88 /// Number of TLS accesses using the special (combinable)
89 /// _TLS_MODULE_BASE_ symbol.
90 unsigned NumLocalDynamicTLSAccesses = 0;
91
92 /// FrameIndex for start of varargs area for arguments passed on the
93 /// stack.
94 int VarArgsStackIndex = 0;
95
96 /// Offset of start of varargs area for arguments passed on the stack.
97 unsigned VarArgsStackOffset = 0;
98
99 /// FrameIndex for start of varargs area for arguments passed in
100 /// general purpose registers.
101 int VarArgsGPRIndex = 0;
102
103 /// Size of the varargs area for arguments passed in general purpose
104 /// registers.
105 unsigned VarArgsGPRSize = 0;
106
107 /// FrameIndex for start of varargs area for arguments passed in
108 /// floating-point registers.
109 int VarArgsFPRIndex = 0;
110
111 /// Size of the varargs area for arguments passed in floating-point
112 /// registers.
113 unsigned VarArgsFPRSize = 0;
114
115 /// The stack slots used to add space between FPR and GPR accesses when using
116 /// hazard padding. StackHazardCSRSlotIndex is added between GPR and FPR CSRs.
117 /// StackHazardSlotIndex is added between (sorted) stack objects.
118 int StackHazardSlotIndex = std::numeric_limits<int>::max();
119 int StackHazardCSRSlotIndex = std::numeric_limits<int>::max();
120
121 /// True if this function has a subset of CSRs that is handled explicitly via
122 /// copies.
123 bool IsSplitCSR = false;
124
125 /// True when the stack gets realigned dynamically because the size of stack
126 /// frame is unknown at compile time. e.g., in case of VLAs.
127 bool StackRealigned = false;
128
129 /// True when the callee-save stack area has unused gaps that may be used for
130 /// other stack allocations.
131 bool CalleeSaveStackHasFreeSpace = false;
132
133 /// SRetReturnReg - sret lowering includes returning the value of the
134 /// returned struct in a register. This field holds the virtual register into
135 /// which the sret argument is passed.
136 Register SRetReturnReg;
137
138 /// SVE stack size (for predicates and data vectors) are maintained here
139 /// rather than in FrameInfo, as the placement and Stack IDs are target
140 /// specific.
141 uint64_t StackSizeZPR = 0;
142 uint64_t StackSizePPR = 0;
143
144 /// Are SVE objects (vectors and predicates) split into separate regions on
145 /// the stack.
146 bool SplitSVEObjects = false;
147
148 /// HasCalculatedStackSizeSVE indicates whether StackSizeZPR/PPR is valid.
149 bool HasCalculatedStackSizeSVE = false;
150
151 /// Has a value when it is known whether or not the function uses a
152 /// redzone, and no value otherwise.
153 /// Initialized during frame lowering, unless the function has the noredzone
154 /// attribute, in which case it is set to false at construction.
155 std::optional<bool> HasRedZone;
156
157 /// ForwardedMustTailRegParms - A list of virtual and physical registers
158 /// that must be forwarded to every musttail call.
159 SmallVector<ForwardedRegister, 1> ForwardedMustTailRegParms;
160
161 /// FrameIndex for the tagged base pointer.
162 std::optional<int> TaggedBasePointerIndex;
163
164 /// Offset from SP-at-entry to the tagged base pointer.
165 /// Tagged base pointer is set up to point to the first (lowest address)
166 /// tagged stack slot.
167 unsigned TaggedBasePointerOffset;
168
169 /// OutliningStyle denotes, if a function was outined, how it was outlined,
170 /// e.g. Tail Call, Thunk, or Function if none apply.
171 std::optional<std::string> OutliningStyle;
172
173 // Offset from SP-after-callee-saved-spills (i.e. SP-at-entry minus
174 // CalleeSavedStackSize) to the address of the frame record.
175 int CalleeSaveBaseToFrameRecordOffset = 0;
176
177 /// SignCondition controls when PAC-RET protection should be used.
179
180 /// SignWithBKey modifies the default PAC-RET mode to signing with the B key.
181 bool SignWithBKey = false;
182
183 /// HasELFSignedGOT is true if the target binary format is ELF and the IR
184 /// module containing the corresponding function has "ptrauth-elf-got" flag
185 /// set to 1.
186 bool HasELFSignedGOT = false;
187
188 /// SigningInstrOffset captures the offset of the PAC-RET signing instruction
189 /// within the prologue, so it can be re-used for authentication in the
190 /// epilogue when using PC as a second salt (FEAT_PAuth_LR)
191 MCSymbol *SignInstrLabel = nullptr;
192
193 /// SignReturnAddressHardening specifies the PAC-RET hardening scheme.
194 enum class SignReturnAddressHardeningKind { None, LoadReturnAddress };
195
196 SignReturnAddressHardeningKind SignReturnAddressHardening =
197 SignReturnAddressHardeningKind::None;
198
199 /// BranchTargetEnforcement enables placing BTI instructions at potential
200 /// indirect branch destinations.
201 bool BranchTargetEnforcement = false;
202
203 /// Indicates that SP signing should be diversified with PC as-per PAuthLR.
204 /// This is set by -mbranch-protection and will emit NOP instructions unless
205 /// the subtarget feature +pauthlr is also used (in which case non-NOP
206 /// instructions are emitted).
207 bool BranchProtectionPAuthLR = false;
208
209 /// Whether this function has an extended frame record [Ctx, FP, LR]. If so,
210 /// bit 60 of the in-memory FP will be 1 to enable other tools to detect the
211 /// extended record.
212 bool HasSwiftAsyncContext = false;
213
214 /// Whether this function makes a non-tail call, on Windows, to a function
215 /// that pops its own stack arguments. The unwinder gives the SP after that
216 /// pop, which isn't the SP our unwind info describes if we reserved the
217 /// argument area in the prologue, so we must be found via the frame pointer.
218 bool HasWinCallToCalleePopFunction = false;
219
220 /// The stack slot where the Swift asynchronous context is stored.
221 int SwiftAsyncContextFrameIdx = std::numeric_limits<int>::max();
222
223 bool IsMTETagged = false;
224
225 /// The function has Scalable Vector or Scalable Predicate register argument
226 /// or return type
227 bool IsSVECC = false;
228
229 /// Whether this function changes streaming mode within the function.
230 bool HasStreamingModeChanges = false;
231
232 /// True if the function need unwind information.
233 mutable std::optional<bool> NeedsDwarfUnwindInfo;
234
235 /// True if the function need asynchronous unwind information.
236 mutable std::optional<bool> NeedsAsyncDwarfUnwindInfo;
237
238 int64_t StackProbeSize = 0;
239
240 // Holds a register containing pstate.sm. This is set
241 // on function entry to record the initial pstate of a function.
242 Register PStateSMReg = Register();
243
244 // Has the PNReg used to build PTRUE instruction.
245 // The PTRUE is used for the LD/ST of ZReg pairs in save and restore.
246 unsigned PredicateRegForFillSpill = 0;
247
248 // Holds the SME function attributes (streaming mode, ZA/ZT0 state).
249 SMEAttrs SMEFnAttrs;
250
251 // Holds the TPIDR2 block if allocated early (for Windows/stack probes
252 // support).
253 Register EarlyAllocSMESaveBuffer = Register();
254
255public:
257
261 const override;
262
264 EarlyAllocSMESaveBuffer = Ptr;
265 }
266
268 return EarlyAllocSMESaveBuffer;
269 }
270
272 PredicateRegForFillSpill = Reg;
273 }
275 return PredicateRegForFillSpill;
276 }
277
278 Register getPStateSMReg() const { return PStateSMReg; };
279 void setPStateSMReg(Register Reg) { PStateSMReg = Reg; };
280
281 bool isSVECC() const { return IsSVECC; };
282 void setIsSVECC(bool s) { IsSVECC = s; };
283
285
286 unsigned getBytesInStackArgArea() const { return BytesInStackArgArea; }
287 void setBytesInStackArgArea(unsigned bytes) { BytesInStackArgArea = bytes; }
288
289 unsigned getArgumentStackToRestore() const { return ArgumentStackToRestore; }
290 void setArgumentStackToRestore(unsigned bytes) {
291 ArgumentStackToRestore = bytes;
292 }
293
294 unsigned getTailCallReservedStack() const { return TailCallReservedStack; }
295 void setTailCallReservedStack(unsigned bytes) {
296 TailCallReservedStack = bytes;
297 }
298
300 assert(isAligned(Align(16), ZPR) && isAligned(Align(16), PPR) &&
301 "expected SVE stack sizes to be aligned to 16-bytes");
302 StackSizeZPR = ZPR;
303 StackSizePPR = PPR;
304 HasCalculatedStackSizeSVE = true;
305 }
306
309 return StackSizeZPR;
310 }
313 return StackSizePPR;
314 }
315
316 bool hasCalculatedStackSizeSVE() const { return HasCalculatedStackSizeSVE; }
317
318 bool hasSVEStackSize() const {
319 return getStackSizeZPR() > 0 || getStackSizePPR() > 0;
320 }
321
322 bool hasStackFrame() const { return HasStackFrame; }
323 void setHasStackFrame(bool s) { HasStackFrame = s; }
324
325 bool isStackRealigned() const { return StackRealigned; }
326 void setStackRealigned(bool s) { StackRealigned = s; }
328 return CalleeSaveStackHasFreeSpace;
329 }
331 CalleeSaveStackHasFreeSpace = s;
332 }
333 bool isSplitCSR() const { return IsSplitCSR; }
334 void setIsSplitCSR(bool s) { IsSplitCSR = s; }
335
336 void setLocalStackSize(uint64_t Size) { LocalStackSize = Size; }
337 uint64_t getLocalStackSize() const { return LocalStackSize; }
338
339 void setOutliningStyle(const std::string &Style) { OutliningStyle = Style; }
340 std::optional<std::string> getOutliningStyle() const {
341 return OutliningStyle;
342 }
343
345 CalleeSavedStackSize = Size;
346 HasCalleeSavedStackSize = true;
347 }
348
349 // When CalleeSavedStackSize has not been set (for example when
350 // some MachineIR pass is run in isolation), then recalculate
351 // the CalleeSavedStackSize directly from the CalleeSavedInfo.
352 // Note: This information can only be recalculated after PEI
353 // has assigned offsets to the callee save objects.
354 unsigned getCalleeSavedStackSize(const MachineFrameInfo &MFI) const {
355 bool ValidateCalleeSavedStackSize = false;
356
357#ifndef NDEBUG
358 // Make sure the calculated size derived from the CalleeSavedInfo
359 // equals the cached size that was calculated elsewhere (e.g. in
360 // determineCalleeSaves).
361 ValidateCalleeSavedStackSize = HasCalleeSavedStackSize;
362#endif
363
364 if (!HasCalleeSavedStackSize || ValidateCalleeSavedStackSize) {
365 assert(MFI.isCalleeSavedInfoValid() && "CalleeSavedInfo not calculated");
366 if (MFI.getCalleeSavedInfo().empty())
367 return 0;
368
369 int64_t MinOffset = std::numeric_limits<int64_t>::max();
370 int64_t MaxOffset = std::numeric_limits<int64_t>::min();
371 for (const auto &Info : MFI.getCalleeSavedInfo()) {
372 int FrameIdx = Info.getFrameIdx();
373 if (MFI.getStackID(FrameIdx) != TargetStackID::Default)
374 continue;
375 int64_t Offset = MFI.getObjectOffset(FrameIdx);
376 int64_t ObjSize = MFI.getObjectSize(FrameIdx);
377 MinOffset = std::min<int64_t>(Offset, MinOffset);
378 MaxOffset = std::max<int64_t>(Offset + ObjSize, MaxOffset);
379 }
380
381 if (SwiftAsyncContextFrameIdx != std::numeric_limits<int>::max()) {
383 int64_t ObjSize = MFI.getObjectSize(getSwiftAsyncContextFrameIdx());
384 MinOffset = std::min<int64_t>(Offset, MinOffset);
385 MaxOffset = std::max<int64_t>(Offset + ObjSize, MaxOffset);
386 }
387
388 if (StackHazardCSRSlotIndex != std::numeric_limits<int>::max()) {
389 int64_t Offset = MFI.getObjectOffset(StackHazardCSRSlotIndex);
390 int64_t ObjSize = MFI.getObjectSize(StackHazardCSRSlotIndex);
391 MinOffset = std::min<int64_t>(Offset, MinOffset);
392 MaxOffset = std::max<int64_t>(Offset + ObjSize, MaxOffset);
393 }
394
395 unsigned Size = alignTo(MaxOffset - MinOffset, 16);
396 assert((!HasCalleeSavedStackSize || getCalleeSavedStackSize() == Size) &&
397 "Invalid size calculated for callee saves");
398 return Size;
399 }
400
402 }
403
404 unsigned getCalleeSavedStackSize() const {
405 assert(HasCalleeSavedStackSize &&
406 "CalleeSavedStackSize has not been calculated");
407 return CalleeSavedStackSize;
408 }
409
410 // Saves the CalleeSavedStackSize for SVE vectors in 'scalable bytes'
411 void setSVECalleeSavedStackSize(unsigned ZPR, unsigned PPR) {
412 assert(isAligned(Align(16), ZPR) && isAligned(Align(16), PPR) &&
413 "expected SVE callee-save sizes to be aligned to 16-bytes");
414 ZPRCalleeSavedStackSize = ZPR;
415 PPRCalleeSavedStackSize = PPR;
416 HasSVECalleeSavedStackSize = true;
417 }
418 unsigned getZPRCalleeSavedStackSize() const {
419 assert(HasSVECalleeSavedStackSize &&
420 "ZPRCalleeSavedStackSize has not been calculated");
421 return ZPRCalleeSavedStackSize;
422 }
423 unsigned getPPRCalleeSavedStackSize() const {
424 assert(HasSVECalleeSavedStackSize &&
425 "PPRCalleeSavedStackSize has not been calculated");
426 return PPRCalleeSavedStackSize;
427 }
428
429 unsigned getSVECalleeSavedStackSize() const {
431 "ZPRs and PPRs are split. Use get[ZPR|PPR]CalleeSavedStackSize()");
433 }
434
435 void incNumLocalDynamicTLSAccesses() { ++NumLocalDynamicTLSAccesses; }
437 return NumLocalDynamicTLSAccesses;
438 }
439
443
444 std::optional<bool> hasRedZone() const { return HasRedZone; }
445 void setHasRedZone(bool s) { HasRedZone = s; }
446
447 int getVarArgsStackIndex() const { return VarArgsStackIndex; }
448 void setVarArgsStackIndex(int Index) { VarArgsStackIndex = Index; }
449
450 unsigned getVarArgsStackOffset() const { return VarArgsStackOffset; }
451 void setVarArgsStackOffset(unsigned Offset) { VarArgsStackOffset = Offset; }
452
453 int getVarArgsGPRIndex() const { return VarArgsGPRIndex; }
454 void setVarArgsGPRIndex(int Index) { VarArgsGPRIndex = Index; }
455
456 unsigned getVarArgsGPRSize() const { return VarArgsGPRSize; }
457 void setVarArgsGPRSize(unsigned Size) { VarArgsGPRSize = Size; }
458
459 int getVarArgsFPRIndex() const { return VarArgsFPRIndex; }
460 void setVarArgsFPRIndex(int Index) { VarArgsFPRIndex = Index; }
461
462 unsigned getVarArgsFPRSize() const { return VarArgsFPRSize; }
463 void setVarArgsFPRSize(unsigned Size) { VarArgsFPRSize = Size; }
464
466 return StackHazardSlotIndex != std::numeric_limits<int>::max();
467 }
468 int getStackHazardSlotIndex() const { return StackHazardSlotIndex; }
469 void setStackHazardSlotIndex(int Index) {
470 assert(StackHazardSlotIndex == std::numeric_limits<int>::max());
471 StackHazardSlotIndex = Index;
472 }
473 int getStackHazardCSRSlotIndex() const { return StackHazardCSRSlotIndex; }
475 assert(StackHazardCSRSlotIndex == std::numeric_limits<int>::max());
476 StackHazardCSRSlotIndex = Index;
477 }
478
479 bool hasSplitSVEObjects() const { return SplitSVEObjects; }
480 void setSplitSVEObjects(bool s) { SplitSVEObjects = s; }
481
482 bool hasSVE_AAPCS(const MachineFunction &MF) const {
483 return hasSplitSVEObjects() || isSVECC() ||
486 }
487
488 SMEAttrs getSMEFnAttrs() const { return SMEFnAttrs; }
489
490 unsigned getSRetReturnReg() const { return SRetReturnReg; }
491 void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
492
493 unsigned getJumpTableEntrySize(int Idx) const {
494 return JumpTableEntryInfo[Idx].first;
495 }
497 return JumpTableEntryInfo[Idx].second;
498 }
499 void setJumpTableEntryInfo(int Idx, unsigned Size, MCSymbol *PCRelSym) {
500 if ((unsigned)Idx >= JumpTableEntryInfo.size())
501 JumpTableEntryInfo.resize(Idx+1);
502 JumpTableEntryInfo[Idx] = std::make_pair(Size, PCRelSym);
503 }
504
506
507 const SetOfInstructions &getLOHRelated() const { return LOHRelated; }
508
509 // Shortcuts for LOH related types.
511 MCLOHType Kind;
512
513 /// Arguments of this directive. Order matters.
515
516 public:
518
520 : Kind(Kind), Args(Args.begin(), Args.end()) {
521 assert(isValidMCLOHType(Kind) && "Invalid LOH directive type!");
522 }
523
524 MCLOHType getKind() const { return Kind; }
525 LOHArgs getArgs() const { return Args; }
526 };
527
530
531 const MILOHContainer &getLOHContainer() const { return LOHContainerSet; }
532
533 /// Add a LOH directive of this @p Kind and this @p Args.
535 LOHContainerSet.push_back(MILOHDirective(Kind, Args));
536 LOHRelated.insert_range(Args);
537 }
538
539 size_t
541 size_t InitialSize = LOHContainerSet.size();
542 erase_if(LOHContainerSet, [&](const auto &D) {
543 return any_of(D.getArgs(), [&](auto *Arg) { return MIs.contains(Arg); });
544 });
545 // In theory there could be an LOH with one label in MIs and another label
546 // outside MIs, however we don't know if the label outside MIs is used in
547 // any other LOHs, so we can't remove them from LOHRelated. In that case, we
548 // might produce a few extra labels, but it won't break anything.
549 LOHRelated.remove_if([&](auto *MI) { return MIs.contains(MI); });
550 return InitialSize - LOHContainerSet.size();
551 };
552
554 return ForwardedMustTailRegParms;
555 }
556
557 std::optional<int> getTaggedBasePointerIndex() const {
558 return TaggedBasePointerIndex;
559 }
560 void setTaggedBasePointerIndex(int Index) { TaggedBasePointerIndex = Index; }
561
562 unsigned getTaggedBasePointerOffset() const {
563 return TaggedBasePointerOffset;
564 }
566 TaggedBasePointerOffset = Offset;
567 }
568
570 return CalleeSaveBaseToFrameRecordOffset;
571 }
573 CalleeSaveBaseToFrameRecordOffset = Offset;
574 }
575
576 static bool shouldSignReturnAddress(SignReturnAddress Condition,
577 bool IsLRSpilled);
578
579 bool shouldSignReturnAddress(const MachineFunction &MF) const;
580
582 return SignCondition;
583 }
584
586
587 bool shouldSignWithBKey() const { return SignWithBKey; }
588
589 bool hasELFSignedGOT() const { return HasELFSignedGOT; }
590
591 MCSymbol *getSigningInstrLabel() const { return SignInstrLabel; }
592 void setSigningInstrLabel(MCSymbol *Label) { SignInstrLabel = Label; }
593
594 bool isMTETagged() const { return IsMTETagged; }
595
597 return SignReturnAddressHardening != SignReturnAddressHardeningKind::None;
598 }
599
600 bool branchTargetEnforcement() const { return BranchTargetEnforcement; }
601
602 bool branchProtectionPAuthLR() const { return BranchProtectionPAuthLR; }
603
604 void setHasSwiftAsyncContext(bool HasContext) {
605 HasSwiftAsyncContext = HasContext;
606 }
607 bool hasSwiftAsyncContext() const { return HasSwiftAsyncContext; }
608
610 HasWinCallToCalleePopFunction = Has;
611 }
613 return HasWinCallToCalleePopFunction;
614 }
615
617 SwiftAsyncContextFrameIdx = FI;
618 }
619 int getSwiftAsyncContextFrameIdx() const { return SwiftAsyncContextFrameIdx; }
620
621 bool needsDwarfUnwindInfo(const MachineFunction &MF) const;
622 bool needsAsyncDwarfUnwindInfo(const MachineFunction &MF) const;
623
624 bool hasStreamingModeChanges() const { return HasStreamingModeChanges; }
625 void setHasStreamingModeChanges(bool HasChanges) {
626 HasStreamingModeChanges = HasChanges;
627 }
628
629 bool hasStackProbing() const { return StackProbeSize != 0; }
630
631 int64_t getStackProbeSize() const { return StackProbeSize; }
632
633private:
634 // Hold the lists of LOHs.
635 MILOHContainer LOHContainerSet;
636 SetOfInstructions LOHRelated;
637
638 SmallVector<std::pair<unsigned, MCSymbol *>, 2> JumpTableEntryInfo;
639};
640
641namespace yaml {
643 std::optional<bool> HasRedZone;
644 std::optional<uint64_t> StackSizeZPR;
645 std::optional<uint64_t> StackSizePPR;
646 std::optional<bool> HasStackFrame;
647 std::optional<bool> HasStreamingModeChanges;
648
651
652 void mappingImpl(yaml::IO &YamlIO) override;
653 ~AArch64FunctionInfo() override = default;
654};
655
657 static void mapping(IO &YamlIO, AArch64FunctionInfo &MFI) {
658 YamlIO.mapOptional("hasRedZone", MFI.HasRedZone);
659 YamlIO.mapOptional("stackSizeZPR", MFI.StackSizeZPR);
660 YamlIO.mapOptional("stackSizePPR", MFI.StackSizePPR);
661 YamlIO.mapOptional("hasStackFrame", MFI.HasStackFrame);
662 YamlIO.mapOptional("hasStreamingModeChanges", MFI.HasStreamingModeChanges);
663 }
664};
665
666} // end namespace yaml
667
668} // end namespace llvm
669
670#endif // LLVM_LIB_TARGET_AARCH64_AARCH64MACHINEFUNCTIONINFO_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
uint64_t uint64_t
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
IRTranslator LLVM IR MI
#define F(x, y, z)
Definition MD5.cpp:54
Register Reg
Promote Memory to Register
Definition Mem2Reg.cpp:110
Basic Register Allocator
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
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
unsigned getCalleeSavedStackSize(const MachineFrameInfo &MFI) const
void setCalleeSaveBaseToFrameRecordOffset(int Offset)
void setVarArgsStackOffset(unsigned Offset)
void setTailCallReservedStack(unsigned bytes)
SmallVector< MILOHDirective, 32 > MILOHContainer
SmallVectorImpl< ForwardedRegister > & getForwardedMustTailRegParms()
SignReturnAddress getSignReturnAddressCondition() const
void setOutliningStyle(const std::string &Style)
const SetOfInstructions & getLOHRelated() const
void setBytesInStackArgArea(unsigned bytes)
void setSigningInstrLabel(MCSymbol *Label)
void setHasSwiftAsyncContext(bool HasContext)
void setStackSizeSVE(uint64_t ZPR, uint64_t PPR)
std::optional< int > getTaggedBasePointerIndex() const
AArch64FunctionInfo(const Function &F, const AArch64Subtarget *STI)
unsigned getJumpTableEntrySize(int Idx) const
bool needsDwarfUnwindInfo(const MachineFunction &MF) const
size_t clearLinkerOptimizationHints(const SmallPtrSetImpl< MachineInstr * > &MIs)
MCSymbol * getJumpTableEntryPCRelSymbol(int Idx) const
SmallPtrSet< const MachineInstr *, 16 > SetOfInstructions
void setTaggedBasePointerOffset(unsigned Offset)
std::optional< bool > hasRedZone() const
static bool shouldSignReturnAddress(SignReturnAddress Condition, bool IsLRSpilled)
void setSVECalleeSavedStackSize(unsigned ZPR, unsigned PPR)
std::optional< std::string > getOutliningStyle() const
void initializeBaseYamlFields(const yaml::AArch64FunctionInfo &YamlMFI)
const MILOHContainer & getLOHContainer() const
void setJumpTableEntryInfo(int Idx, unsigned Size, MCSymbol *PCRelSym)
bool needsAsyncDwarfUnwindInfo(const MachineFunction &MF) const
MachineFunctionInfo * clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB) const override
Make a functionally equivalent copy of this MachineFunctionInfo in MF.
bool hasSVE_AAPCS(const MachineFunction &MF) const
void setArgumentStackToRestore(unsigned bytes)
void setHasStreamingModeChanges(bool HasChanges)
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
Definition Function.h:273
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
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.
Function & getFunction()
Return the LLVM function that this machine code represents.
Representation of each machine instruction.
Wrapper class representing virtual and physical registers.
Definition Register.h:20
SMEAttrs is a utility class to parse the SME ACLE attributes on functions.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
bool contains(ConstPtrType Ptr) const
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
void mapOptional(StringRef Key, T &Val)
Definition YAMLTraits.h:800
@ AArch64_SVE_VectorCall
Used between AArch64 SVE functions.
This is an optimization pass for GlobalISel generic memory operations.
SignReturnAddress
Condition of signing the return address in a function.
@ Offset
Definition DWP.cpp:577
bool isAligned(Align Lhs, uint64_t SizeInBytes)
Checks that SizeInBytes is a multiple of the alignment.
Definition Alignment.h:139
static bool isValidMCLOHType(unsigned Kind)
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1762
constexpr uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Definition Alignment.h:149
MCLOHType
Linker Optimization Hint Type.
void erase_if(Container &C, UnaryPredicate P)
Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent t...
Definition STLExtras.h:2208
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:391
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
~AArch64FunctionInfo() override=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)
This class should be specialized by any type that needs to be converted to/from a YAML mapping.
Definition YAMLTraits.h:63