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 /// SEH_StartProc/SEH_EndProc pseudos own the function's unwind boundaries.
79 bool HasExplicitWinCFIRanges = false;
80
81 /// Amount of stack frame size, not including callee-saved registers.
82 uint64_t LocalStackSize = 0;
83
84 /// Amount of stack frame size used for saving callee-saved registers.
85 unsigned CalleeSavedStackSize = 0;
86 unsigned ZPRCalleeSavedStackSize = 0;
87 unsigned PPRCalleeSavedStackSize = 0;
88 bool HasCalleeSavedStackSize = false;
89 bool HasSVECalleeSavedStackSize = false;
90
91 /// Number of TLS accesses using the special (combinable)
92 /// _TLS_MODULE_BASE_ symbol.
93 unsigned NumLocalDynamicTLSAccesses = 0;
94
95 /// FrameIndex for start of varargs area for arguments passed on the
96 /// stack.
97 int VarArgsStackIndex = 0;
98
99 /// Offset of start of varargs area for arguments passed on the stack.
100 unsigned VarArgsStackOffset = 0;
101
102 /// FrameIndex for start of varargs area for arguments passed in
103 /// general purpose registers.
104 int VarArgsGPRIndex = 0;
105
106 /// Size of the varargs area for arguments passed in general purpose
107 /// registers.
108 unsigned VarArgsGPRSize = 0;
109
110 /// FrameIndex for start of varargs area for arguments passed in
111 /// floating-point registers.
112 int VarArgsFPRIndex = 0;
113
114 /// Size of the varargs area for arguments passed in floating-point
115 /// registers.
116 unsigned VarArgsFPRSize = 0;
117
118 /// The stack slots used to add space between FPR and GPR accesses when using
119 /// hazard padding. StackHazardCSRSlotIndex is added between GPR and FPR CSRs.
120 /// StackHazardSlotIndex is added between (sorted) stack objects.
121 int StackHazardSlotIndex = std::numeric_limits<int>::max();
122 int StackHazardCSRSlotIndex = std::numeric_limits<int>::max();
123
124 /// True if this function has a subset of CSRs that is handled explicitly via
125 /// copies.
126 bool IsSplitCSR = false;
127
128 /// True when the stack gets realigned dynamically because the size of stack
129 /// frame is unknown at compile time. e.g., in case of VLAs.
130 bool StackRealigned = false;
131
132 /// True when the callee-save stack area has unused gaps that may be used for
133 /// other stack allocations.
134 bool CalleeSaveStackHasFreeSpace = false;
135
136 /// SRetReturnReg - sret lowering includes returning the value of the
137 /// returned struct in a register. This field holds the virtual register into
138 /// which the sret argument is passed.
139 Register SRetReturnReg;
140
141 /// SVE stack size (for predicates and data vectors) are maintained here
142 /// rather than in FrameInfo, as the placement and Stack IDs are target
143 /// specific.
144 uint64_t StackSizeZPR = 0;
145 uint64_t StackSizePPR = 0;
146
147 /// Are SVE objects (vectors and predicates) split into separate regions on
148 /// the stack.
149 bool SplitSVEObjects = false;
150
151 /// HasCalculatedStackSizeSVE indicates whether StackSizeZPR/PPR is valid.
152 bool HasCalculatedStackSizeSVE = false;
153
154 /// Has a value when it is known whether or not the function uses a
155 /// redzone, and no value otherwise.
156 /// Initialized during frame lowering, unless the function has the noredzone
157 /// attribute, in which case it is set to false at construction.
158 std::optional<bool> HasRedZone;
159
160 /// ForwardedMustTailRegParms - A list of virtual and physical registers
161 /// that must be forwarded to every musttail call.
162 SmallVector<ForwardedRegister, 1> ForwardedMustTailRegParms;
163
164 /// FrameIndex for the tagged base pointer.
165 std::optional<int> TaggedBasePointerIndex;
166
167 /// Offset from SP-at-entry to the tagged base pointer.
168 /// Tagged base pointer is set up to point to the first (lowest address)
169 /// tagged stack slot.
170 unsigned TaggedBasePointerOffset;
171
172 /// OutliningStyle denotes, if a function was outined, how it was outlined,
173 /// e.g. Tail Call, Thunk, or Function if none apply.
174 std::optional<std::string> OutliningStyle;
175
176 // Offset from SP-after-callee-saved-spills (i.e. SP-at-entry minus
177 // CalleeSavedStackSize) to the address of the frame record.
178 int CalleeSaveBaseToFrameRecordOffset = 0;
179
180 /// SignCondition controls when PAC-RET protection should be used.
182
183 /// SignWithBKey modifies the default PAC-RET mode to signing with the B key.
184 bool SignWithBKey = false;
185
186 /// HasELFSignedGOT is true if the target binary format is ELF and the IR
187 /// module containing the corresponding function has "ptrauth-elf-got" flag
188 /// set to 1.
189 bool HasELFSignedGOT = false;
190
191 /// SigningInstrOffset captures the offset of the PAC-RET signing instruction
192 /// within the prologue, so it can be re-used for authentication in the
193 /// epilogue when using PC as a second salt (FEAT_PAuth_LR)
194 MCSymbol *SignInstrLabel = nullptr;
195
196 /// SignReturnAddressHardening specifies the PAC-RET hardening scheme.
197 enum class SignReturnAddressHardeningKind { None, LoadReturnAddress };
198
199 SignReturnAddressHardeningKind SignReturnAddressHardening =
200 SignReturnAddressHardeningKind::None;
201
202 /// BranchTargetEnforcement enables placing BTI instructions at potential
203 /// indirect branch destinations.
204 bool BranchTargetEnforcement = false;
205
206 /// Indicates that SP signing should be diversified with PC as-per PAuthLR.
207 /// This is set by -mbranch-protection and will emit NOP instructions unless
208 /// the subtarget feature +pauthlr is also used (in which case non-NOP
209 /// instructions are emitted).
210 bool BranchProtectionPAuthLR = false;
211
212 /// Whether this function has an extended frame record [Ctx, FP, LR]. If so,
213 /// bit 60 of the in-memory FP will be 1 to enable other tools to detect the
214 /// extended record.
215 bool HasSwiftAsyncContext = false;
216
217 /// Whether this function makes a non-tail call, on Windows, to a function
218 /// that pops its own stack arguments. The unwinder gives the SP after that
219 /// pop, which isn't the SP our unwind info describes if we reserved the
220 /// argument area in the prologue, so we must be found via the frame pointer.
221 bool HasWinCallToCalleePopFunction = false;
222
223 /// The stack slot where the Swift asynchronous context is stored.
224 int SwiftAsyncContextFrameIdx = std::numeric_limits<int>::max();
225
226 bool IsMTETagged = false;
227
228 /// The function has Scalable Vector or Scalable Predicate register argument
229 /// or return type
230 bool IsSVECC = false;
231
232 /// Whether this function changes streaming mode within the function.
233 bool HasStreamingModeChanges = false;
234
235 /// True if the function need unwind information.
236 mutable std::optional<bool> NeedsDwarfUnwindInfo;
237
238 /// True if the function need asynchronous unwind information.
239 mutable std::optional<bool> NeedsAsyncDwarfUnwindInfo;
240
241 int64_t StackProbeSize = 0;
242
243 // Holds a register containing pstate.sm. This is set
244 // on function entry to record the initial pstate of a function.
245 Register PStateSMReg = Register();
246
247 // Has the PNReg used to build PTRUE instruction.
248 // The PTRUE is used for the LD/ST of ZReg pairs in save and restore.
249 unsigned PredicateRegForFillSpill = 0;
250
251 // Holds the SME function attributes (streaming mode, ZA/ZT0 state).
252 SMEAttrs SMEFnAttrs;
253
254 // Holds the TPIDR2 block if allocated early (for Windows/stack probes
255 // support).
256 Register EarlyAllocSMESaveBuffer = Register();
257
258public:
260
264 const override;
265
267 EarlyAllocSMESaveBuffer = Ptr;
268 }
269
271 return EarlyAllocSMESaveBuffer;
272 }
273
275 PredicateRegForFillSpill = Reg;
276 }
278 return PredicateRegForFillSpill;
279 }
280
281 Register getPStateSMReg() const { return PStateSMReg; };
282 void setPStateSMReg(Register Reg) { PStateSMReg = Reg; };
283
284 bool isSVECC() const { return IsSVECC; };
285 void setIsSVECC(bool s) { IsSVECC = s; };
286
288
289 unsigned getBytesInStackArgArea() const { return BytesInStackArgArea; }
290 void setBytesInStackArgArea(unsigned bytes) { BytesInStackArgArea = bytes; }
291
292 unsigned getArgumentStackToRestore() const { return ArgumentStackToRestore; }
293 void setArgumentStackToRestore(unsigned bytes) {
294 ArgumentStackToRestore = bytes;
295 }
296
297 unsigned getTailCallReservedStack() const { return TailCallReservedStack; }
298 void setTailCallReservedStack(unsigned bytes) {
299 TailCallReservedStack = bytes;
300 }
301
303 assert(isAligned(Align(16), ZPR) && isAligned(Align(16), PPR) &&
304 "expected SVE stack sizes to be aligned to 16-bytes");
305 StackSizeZPR = ZPR;
306 StackSizePPR = PPR;
307 HasCalculatedStackSizeSVE = true;
308 }
309
312 return StackSizeZPR;
313 }
316 return StackSizePPR;
317 }
318
319 bool hasCalculatedStackSizeSVE() const { return HasCalculatedStackSizeSVE; }
320
321 bool hasSVEStackSize() const {
322 return getStackSizeZPR() > 0 || getStackSizePPR() > 0;
323 }
324
325 bool hasStackFrame() const { return HasStackFrame; }
326 void setHasStackFrame(bool s) { HasStackFrame = s; }
327
328 bool hasExplicitWinCFIRanges() const { return HasExplicitWinCFIRanges; }
330 HasExplicitWinCFIRanges = Value;
331 }
332
333 bool isStackRealigned() const { return StackRealigned; }
334 void setStackRealigned(bool s) { StackRealigned = s; }
336 return CalleeSaveStackHasFreeSpace;
337 }
339 CalleeSaveStackHasFreeSpace = s;
340 }
341 bool isSplitCSR() const { return IsSplitCSR; }
342 void setIsSplitCSR(bool s) { IsSplitCSR = s; }
343
344 void setLocalStackSize(uint64_t Size) { LocalStackSize = Size; }
345 uint64_t getLocalStackSize() const { return LocalStackSize; }
346
347 void setOutliningStyle(const std::string &Style) { OutliningStyle = Style; }
348 std::optional<std::string> getOutliningStyle() const {
349 return OutliningStyle;
350 }
351
353 CalleeSavedStackSize = Size;
354 HasCalleeSavedStackSize = true;
355 }
356
357 // When CalleeSavedStackSize has not been set (for example when
358 // some MachineIR pass is run in isolation), then recalculate
359 // the CalleeSavedStackSize directly from the CalleeSavedInfo.
360 // Note: This information can only be recalculated after PEI
361 // has assigned offsets to the callee save objects.
362 unsigned getCalleeSavedStackSize(const MachineFrameInfo &MFI) const {
363 bool ValidateCalleeSavedStackSize = false;
364
365#ifndef NDEBUG
366 // Make sure the calculated size derived from the CalleeSavedInfo
367 // equals the cached size that was calculated elsewhere (e.g. in
368 // determineCalleeSaves).
369 ValidateCalleeSavedStackSize = HasCalleeSavedStackSize;
370#endif
371
372 if (!HasCalleeSavedStackSize || ValidateCalleeSavedStackSize) {
373 assert(MFI.isCalleeSavedInfoValid() && "CalleeSavedInfo not calculated");
374 if (MFI.getCalleeSavedInfo().empty())
375 return 0;
376
377 int64_t MinOffset = std::numeric_limits<int64_t>::max();
378 int64_t MaxOffset = std::numeric_limits<int64_t>::min();
379 for (const auto &Info : MFI.getCalleeSavedInfo()) {
380 int FrameIdx = Info.getFrameIdx();
381 if (MFI.getStackID(FrameIdx) != TargetStackID::Default)
382 continue;
383 int64_t Offset = MFI.getObjectOffset(FrameIdx);
384 int64_t ObjSize = MFI.getObjectSize(FrameIdx);
385 MinOffset = std::min<int64_t>(Offset, MinOffset);
386 MaxOffset = std::max<int64_t>(Offset + ObjSize, MaxOffset);
387 }
388
389 if (SwiftAsyncContextFrameIdx != std::numeric_limits<int>::max()) {
391 int64_t ObjSize = MFI.getObjectSize(getSwiftAsyncContextFrameIdx());
392 MinOffset = std::min<int64_t>(Offset, MinOffset);
393 MaxOffset = std::max<int64_t>(Offset + ObjSize, MaxOffset);
394 }
395
396 if (StackHazardCSRSlotIndex != std::numeric_limits<int>::max()) {
397 int64_t Offset = MFI.getObjectOffset(StackHazardCSRSlotIndex);
398 int64_t ObjSize = MFI.getObjectSize(StackHazardCSRSlotIndex);
399 MinOffset = std::min<int64_t>(Offset, MinOffset);
400 MaxOffset = std::max<int64_t>(Offset + ObjSize, MaxOffset);
401 }
402
403 unsigned Size = alignTo(MaxOffset - MinOffset, 16);
404 assert((!HasCalleeSavedStackSize || getCalleeSavedStackSize() == Size) &&
405 "Invalid size calculated for callee saves");
406 return Size;
407 }
408
410 }
411
412 unsigned getCalleeSavedStackSize() const {
413 assert(HasCalleeSavedStackSize &&
414 "CalleeSavedStackSize has not been calculated");
415 return CalleeSavedStackSize;
416 }
417
418 // Saves the CalleeSavedStackSize for SVE vectors in 'scalable bytes'
419 void setSVECalleeSavedStackSize(unsigned ZPR, unsigned PPR) {
420 assert(isAligned(Align(16), ZPR) && isAligned(Align(16), PPR) &&
421 "expected SVE callee-save sizes to be aligned to 16-bytes");
422 ZPRCalleeSavedStackSize = ZPR;
423 PPRCalleeSavedStackSize = PPR;
424 HasSVECalleeSavedStackSize = true;
425 }
426 unsigned getZPRCalleeSavedStackSize() const {
427 assert(HasSVECalleeSavedStackSize &&
428 "ZPRCalleeSavedStackSize has not been calculated");
429 return ZPRCalleeSavedStackSize;
430 }
431 unsigned getPPRCalleeSavedStackSize() const {
432 assert(HasSVECalleeSavedStackSize &&
433 "PPRCalleeSavedStackSize has not been calculated");
434 return PPRCalleeSavedStackSize;
435 }
436
437 unsigned getSVECalleeSavedStackSize() const {
439 "ZPRs and PPRs are split. Use get[ZPR|PPR]CalleeSavedStackSize()");
441 }
442
443 void incNumLocalDynamicTLSAccesses() { ++NumLocalDynamicTLSAccesses; }
445 return NumLocalDynamicTLSAccesses;
446 }
447
451
452 std::optional<bool> hasRedZone() const { return HasRedZone; }
453 void setHasRedZone(bool s) { HasRedZone = s; }
454
455 int getVarArgsStackIndex() const { return VarArgsStackIndex; }
456 void setVarArgsStackIndex(int Index) { VarArgsStackIndex = Index; }
457
458 unsigned getVarArgsStackOffset() const { return VarArgsStackOffset; }
459 void setVarArgsStackOffset(unsigned Offset) { VarArgsStackOffset = Offset; }
460
461 int getVarArgsGPRIndex() const { return VarArgsGPRIndex; }
462 void setVarArgsGPRIndex(int Index) { VarArgsGPRIndex = Index; }
463
464 unsigned getVarArgsGPRSize() const { return VarArgsGPRSize; }
465 void setVarArgsGPRSize(unsigned Size) { VarArgsGPRSize = Size; }
466
467 int getVarArgsFPRIndex() const { return VarArgsFPRIndex; }
468 void setVarArgsFPRIndex(int Index) { VarArgsFPRIndex = Index; }
469
470 unsigned getVarArgsFPRSize() const { return VarArgsFPRSize; }
471 void setVarArgsFPRSize(unsigned Size) { VarArgsFPRSize = Size; }
472
474 return StackHazardSlotIndex != std::numeric_limits<int>::max();
475 }
476 int getStackHazardSlotIndex() const { return StackHazardSlotIndex; }
477 void setStackHazardSlotIndex(int Index) {
478 assert(StackHazardSlotIndex == std::numeric_limits<int>::max());
479 StackHazardSlotIndex = Index;
480 }
481 int getStackHazardCSRSlotIndex() const { return StackHazardCSRSlotIndex; }
483 assert(StackHazardCSRSlotIndex == std::numeric_limits<int>::max());
484 StackHazardCSRSlotIndex = Index;
485 }
486
487 bool hasSplitSVEObjects() const { return SplitSVEObjects; }
488 void setSplitSVEObjects(bool s) { SplitSVEObjects = s; }
489
490 bool hasSVE_AAPCS(const MachineFunction &MF) const {
491 return hasSplitSVEObjects() || isSVECC() ||
494 }
495
496 SMEAttrs getSMEFnAttrs() const { return SMEFnAttrs; }
497
498 unsigned getSRetReturnReg() const { return SRetReturnReg; }
499 void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
500
501 unsigned getJumpTableEntrySize(int Idx) const {
502 return JumpTableEntryInfo[Idx].first;
503 }
505 return JumpTableEntryInfo[Idx].second;
506 }
507 void setJumpTableEntryInfo(int Idx, unsigned Size, MCSymbol *PCRelSym) {
508 if ((unsigned)Idx >= JumpTableEntryInfo.size())
509 JumpTableEntryInfo.resize(Idx+1);
510 JumpTableEntryInfo[Idx] = std::make_pair(Size, PCRelSym);
511 }
512
514
515 const SetOfInstructions &getLOHRelated() const { return LOHRelated; }
516
517 // Shortcuts for LOH related types.
519 MCLOHType Kind;
520
521 /// Arguments of this directive. Order matters.
523
524 public:
526
528 : Kind(Kind), Args(Args.begin(), Args.end()) {
529 assert(isValidMCLOHType(Kind) && "Invalid LOH directive type!");
530 }
531
532 MCLOHType getKind() const { return Kind; }
533 LOHArgs getArgs() const { return Args; }
534 };
535
538
539 const MILOHContainer &getLOHContainer() const { return LOHContainerSet; }
540
541 /// Add a LOH directive of this @p Kind and this @p Args.
543 LOHContainerSet.push_back(MILOHDirective(Kind, Args));
544 LOHRelated.insert_range(Args);
545 }
546
547 size_t
549 size_t InitialSize = LOHContainerSet.size();
550 erase_if(LOHContainerSet, [&](const auto &D) {
551 return any_of(D.getArgs(), [&](auto *Arg) { return MIs.contains(Arg); });
552 });
553 // In theory there could be an LOH with one label in MIs and another label
554 // outside MIs, however we don't know if the label outside MIs is used in
555 // any other LOHs, so we can't remove them from LOHRelated. In that case, we
556 // might produce a few extra labels, but it won't break anything.
557 LOHRelated.remove_if([&](auto *MI) { return MIs.contains(MI); });
558 return InitialSize - LOHContainerSet.size();
559 };
560
562 return ForwardedMustTailRegParms;
563 }
564
565 std::optional<int> getTaggedBasePointerIndex() const {
566 return TaggedBasePointerIndex;
567 }
568 void setTaggedBasePointerIndex(int Index) { TaggedBasePointerIndex = Index; }
569
570 unsigned getTaggedBasePointerOffset() const {
571 return TaggedBasePointerOffset;
572 }
574 TaggedBasePointerOffset = Offset;
575 }
576
578 return CalleeSaveBaseToFrameRecordOffset;
579 }
581 CalleeSaveBaseToFrameRecordOffset = Offset;
582 }
583
584 static bool shouldSignReturnAddress(SignReturnAddress Condition,
585 bool IsLRSpilled);
586
587 bool shouldSignReturnAddress(const MachineFunction &MF) const;
588
590 return SignCondition;
591 }
592
594
595 bool shouldSignWithBKey() const { return SignWithBKey; }
596
597 bool hasELFSignedGOT() const { return HasELFSignedGOT; }
598
599 MCSymbol *getSigningInstrLabel() const { return SignInstrLabel; }
600 void setSigningInstrLabel(MCSymbol *Label) { SignInstrLabel = Label; }
601
602 bool isMTETagged() const { return IsMTETagged; }
603
605 return SignReturnAddressHardening != SignReturnAddressHardeningKind::None;
606 }
607
608 bool branchTargetEnforcement() const { return BranchTargetEnforcement; }
609
610 bool branchProtectionPAuthLR() const { return BranchProtectionPAuthLR; }
611
612 void setHasSwiftAsyncContext(bool HasContext) {
613 HasSwiftAsyncContext = HasContext;
614 }
615 bool hasSwiftAsyncContext() const { return HasSwiftAsyncContext; }
616
618 HasWinCallToCalleePopFunction = Has;
619 }
621 return HasWinCallToCalleePopFunction;
622 }
623
625 SwiftAsyncContextFrameIdx = FI;
626 }
627 int getSwiftAsyncContextFrameIdx() const { return SwiftAsyncContextFrameIdx; }
628
629 bool needsDwarfUnwindInfo(const MachineFunction &MF) const;
630 bool needsAsyncDwarfUnwindInfo(const MachineFunction &MF) const;
631
632 bool hasStreamingModeChanges() const { return HasStreamingModeChanges; }
633 void setHasStreamingModeChanges(bool HasChanges) {
634 HasStreamingModeChanges = HasChanges;
635 }
636
637 bool hasStackProbing() const { return StackProbeSize != 0; }
638
639 int64_t getStackProbeSize() const { return StackProbeSize; }
640
641private:
642 // Hold the lists of LOHs.
643 MILOHContainer LOHContainerSet;
644 SetOfInstructions LOHRelated;
645
646 SmallVector<std::pair<unsigned, MCSymbol *>, 2> JumpTableEntryInfo;
647};
648
649namespace yaml {
651 std::optional<bool> HasRedZone;
652 std::optional<uint64_t> StackSizeZPR;
653 std::optional<uint64_t> StackSizePPR;
654 std::optional<bool> HasStackFrame;
655 std::optional<bool> HasStreamingModeChanges;
657
660
661 void mappingImpl(yaml::IO &YamlIO) override;
662 ~AArch64FunctionInfo() override = default;
663};
664
666 static void mapping(IO &YamlIO, AArch64FunctionInfo &MFI) {
667 YamlIO.mapOptional("hasRedZone", MFI.HasRedZone);
668 YamlIO.mapOptional("stackSizeZPR", MFI.StackSizeZPR);
669 YamlIO.mapOptional("stackSizePPR", MFI.StackSizePPR);
670 YamlIO.mapOptional("hasStackFrame", MFI.HasStackFrame);
671 YamlIO.mapOptional("hasStreamingModeChanges", MFI.HasStreamingModeChanges);
672 YamlIO.mapOptional("hasExplicitWinCFIRanges", MFI.HasExplicitWinCFIRanges,
673 false);
674 }
675};
676
677} // end namespace yaml
678
679} // end namespace llvm
680
681#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.
LLVM Value Representation.
Definition Value.h:75
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:2210
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