xref: /freebsd/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h (revision 5ffd83dbcc34f10e07f6d3e968ae6365869615f4)
10b57cec5SDimitry Andric //=- AArch64MachineFunctionInfo.h - AArch64 machine function info -*- C++ -*-=//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric //
90b57cec5SDimitry Andric // This file declares AArch64-specific per-machine-function information.
100b57cec5SDimitry Andric //
110b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
120b57cec5SDimitry Andric 
130b57cec5SDimitry Andric #ifndef LLVM_LIB_TARGET_AARCH64_AARCH64MACHINEFUNCTIONINFO_H
140b57cec5SDimitry Andric #define LLVM_LIB_TARGET_AARCH64_AARCH64MACHINEFUNCTIONINFO_H
150b57cec5SDimitry Andric 
160b57cec5SDimitry Andric #include "llvm/ADT/ArrayRef.h"
170b57cec5SDimitry Andric #include "llvm/ADT/Optional.h"
180b57cec5SDimitry Andric #include "llvm/ADT/SmallPtrSet.h"
190b57cec5SDimitry Andric #include "llvm/ADT/SmallVector.h"
200b57cec5SDimitry Andric #include "llvm/CodeGen/CallingConvLower.h"
21*5ffd83dbSDimitry Andric #include "llvm/CodeGen/MIRYamlMapping.h"
220b57cec5SDimitry Andric #include "llvm/CodeGen/MachineFunction.h"
23480093f4SDimitry Andric #include "llvm/CodeGen/TargetFrameLowering.h"
248bcb0991SDimitry Andric #include "llvm/IR/Function.h"
250b57cec5SDimitry Andric #include "llvm/MC/MCLinkerOptimizationHint.h"
260b57cec5SDimitry Andric #include <cassert>
270b57cec5SDimitry Andric 
280b57cec5SDimitry Andric namespace llvm {
290b57cec5SDimitry Andric 
30*5ffd83dbSDimitry Andric namespace yaml {
31*5ffd83dbSDimitry Andric struct AArch64FunctionInfo;
32*5ffd83dbSDimitry Andric } // end namespace yaml
33*5ffd83dbSDimitry Andric 
340b57cec5SDimitry Andric class MachineInstr;
350b57cec5SDimitry Andric 
360b57cec5SDimitry Andric /// AArch64FunctionInfo - This class is derived from MachineFunctionInfo and
370b57cec5SDimitry Andric /// contains private AArch64-specific information for each MachineFunction.
380b57cec5SDimitry Andric class AArch64FunctionInfo final : public MachineFunctionInfo {
390b57cec5SDimitry Andric   /// Number of bytes of arguments this function has on the stack. If the callee
400b57cec5SDimitry Andric   /// is expected to restore the argument stack this should be a multiple of 16,
410b57cec5SDimitry Andric   /// all usable during a tail call.
420b57cec5SDimitry Andric   ///
430b57cec5SDimitry Andric   /// The alternative would forbid tail call optimisation in some cases: if we
440b57cec5SDimitry Andric   /// want to transfer control from a function with 8-bytes of stack-argument
450b57cec5SDimitry Andric   /// space to a function with 16-bytes then misalignment of this value would
460b57cec5SDimitry Andric   /// make a stack adjustment necessary, which could not be undone by the
470b57cec5SDimitry Andric   /// callee.
480b57cec5SDimitry Andric   unsigned BytesInStackArgArea = 0;
490b57cec5SDimitry Andric 
500b57cec5SDimitry Andric   /// The number of bytes to restore to deallocate space for incoming
510b57cec5SDimitry Andric   /// arguments. Canonically 0 in the C calling convention, but non-zero when
520b57cec5SDimitry Andric   /// callee is expected to pop the args.
530b57cec5SDimitry Andric   unsigned ArgumentStackToRestore = 0;
540b57cec5SDimitry Andric 
550b57cec5SDimitry Andric   /// HasStackFrame - True if this function has a stack frame. Set by
560b57cec5SDimitry Andric   /// determineCalleeSaves().
570b57cec5SDimitry Andric   bool HasStackFrame = false;
580b57cec5SDimitry Andric 
590b57cec5SDimitry Andric   /// Amount of stack frame size, not including callee-saved registers.
60480093f4SDimitry Andric   uint64_t LocalStackSize = 0;
61480093f4SDimitry Andric 
62480093f4SDimitry Andric   /// The start and end frame indices for the SVE callee saves.
63480093f4SDimitry Andric   int MinSVECSFrameIndex = 0;
64480093f4SDimitry Andric   int MaxSVECSFrameIndex = 0;
650b57cec5SDimitry Andric 
660b57cec5SDimitry Andric   /// Amount of stack frame size used for saving callee-saved registers.
67480093f4SDimitry Andric   unsigned CalleeSavedStackSize = 0;
68480093f4SDimitry Andric   unsigned SVECalleeSavedStackSize = 0;
69480093f4SDimitry Andric   bool HasCalleeSavedStackSize = false;
700b57cec5SDimitry Andric 
710b57cec5SDimitry Andric   /// Number of TLS accesses using the special (combinable)
720b57cec5SDimitry Andric   /// _TLS_MODULE_BASE_ symbol.
730b57cec5SDimitry Andric   unsigned NumLocalDynamicTLSAccesses = 0;
740b57cec5SDimitry Andric 
750b57cec5SDimitry Andric   /// FrameIndex for start of varargs area for arguments passed on the
760b57cec5SDimitry Andric   /// stack.
770b57cec5SDimitry Andric   int VarArgsStackIndex = 0;
780b57cec5SDimitry Andric 
790b57cec5SDimitry Andric   /// FrameIndex for start of varargs area for arguments passed in
800b57cec5SDimitry Andric   /// general purpose registers.
810b57cec5SDimitry Andric   int VarArgsGPRIndex = 0;
820b57cec5SDimitry Andric 
830b57cec5SDimitry Andric   /// Size of the varargs area for arguments passed in general purpose
840b57cec5SDimitry Andric   /// registers.
850b57cec5SDimitry Andric   unsigned VarArgsGPRSize = 0;
860b57cec5SDimitry Andric 
870b57cec5SDimitry Andric   /// FrameIndex for start of varargs area for arguments passed in
880b57cec5SDimitry Andric   /// floating-point registers.
890b57cec5SDimitry Andric   int VarArgsFPRIndex = 0;
900b57cec5SDimitry Andric 
910b57cec5SDimitry Andric   /// Size of the varargs area for arguments passed in floating-point
920b57cec5SDimitry Andric   /// registers.
930b57cec5SDimitry Andric   unsigned VarArgsFPRSize = 0;
940b57cec5SDimitry Andric 
950b57cec5SDimitry Andric   /// True if this function has a subset of CSRs that is handled explicitly via
960b57cec5SDimitry Andric   /// copies.
970b57cec5SDimitry Andric   bool IsSplitCSR = false;
980b57cec5SDimitry Andric 
990b57cec5SDimitry Andric   /// True when the stack gets realigned dynamically because the size of stack
1000b57cec5SDimitry Andric   /// frame is unknown at compile time. e.g., in case of VLAs.
1010b57cec5SDimitry Andric   bool StackRealigned = false;
1020b57cec5SDimitry Andric 
1030b57cec5SDimitry Andric   /// True when the callee-save stack area has unused gaps that may be used for
1040b57cec5SDimitry Andric   /// other stack allocations.
1050b57cec5SDimitry Andric   bool CalleeSaveStackHasFreeSpace = false;
1060b57cec5SDimitry Andric 
1070b57cec5SDimitry Andric   /// SRetReturnReg - sret lowering includes returning the value of the
1080b57cec5SDimitry Andric   /// returned struct in a register. This field holds the virtual register into
1090b57cec5SDimitry Andric   /// which the sret argument is passed.
1100b57cec5SDimitry Andric   unsigned SRetReturnReg = 0;
1118bcb0991SDimitry Andric   /// SVE stack size (for predicates and data vectors) are maintained here
1128bcb0991SDimitry Andric   /// rather than in FrameInfo, as the placement and Stack IDs are target
1138bcb0991SDimitry Andric   /// specific.
1148bcb0991SDimitry Andric   uint64_t StackSizeSVE = 0;
1158bcb0991SDimitry Andric 
1168bcb0991SDimitry Andric   /// HasCalculatedStackSizeSVE indicates whether StackSizeSVE is valid.
1178bcb0991SDimitry Andric   bool HasCalculatedStackSizeSVE = false;
1180b57cec5SDimitry Andric 
1190b57cec5SDimitry Andric   /// Has a value when it is known whether or not the function uses a
1200b57cec5SDimitry Andric   /// redzone, and no value otherwise.
1210b57cec5SDimitry Andric   /// Initialized during frame lowering, unless the function has the noredzone
1220b57cec5SDimitry Andric   /// attribute, in which case it is set to false at construction.
1230b57cec5SDimitry Andric   Optional<bool> HasRedZone;
1240b57cec5SDimitry Andric 
1250b57cec5SDimitry Andric   /// ForwardedMustTailRegParms - A list of virtual and physical registers
1260b57cec5SDimitry Andric   /// that must be forwarded to every musttail call.
1270b57cec5SDimitry Andric   SmallVector<ForwardedRegister, 1> ForwardedMustTailRegParms;
1280b57cec5SDimitry Andric 
1290b57cec5SDimitry Andric   // Offset from SP-at-entry to the tagged base pointer.
1300b57cec5SDimitry Andric   // Tagged base pointer is set up to point to the first (lowest address) tagged
1310b57cec5SDimitry Andric   // stack slot.
132480093f4SDimitry Andric   unsigned TaggedBasePointerOffset = 0;
1330b57cec5SDimitry Andric 
134*5ffd83dbSDimitry Andric   /// OutliningStyle denotes, if a function was outined, how it was outlined,
135*5ffd83dbSDimitry Andric   /// e.g. Tail Call, Thunk, or Function if none apply.
136*5ffd83dbSDimitry Andric   Optional<std::string> OutliningStyle;
137*5ffd83dbSDimitry Andric 
1380b57cec5SDimitry Andric public:
1390b57cec5SDimitry Andric   AArch64FunctionInfo() = default;
1400b57cec5SDimitry Andric 
1410b57cec5SDimitry Andric   explicit AArch64FunctionInfo(MachineFunction &MF) {
1420b57cec5SDimitry Andric     (void)MF;
1430b57cec5SDimitry Andric 
1440b57cec5SDimitry Andric     // If we already know that the function doesn't have a redzone, set
1450b57cec5SDimitry Andric     // HasRedZone here.
1460b57cec5SDimitry Andric     if (MF.getFunction().hasFnAttribute(Attribute::NoRedZone))
1470b57cec5SDimitry Andric       HasRedZone = false;
1480b57cec5SDimitry Andric   }
149*5ffd83dbSDimitry Andric   void initializeBaseYamlFields(const yaml::AArch64FunctionInfo &YamlMFI);
1500b57cec5SDimitry Andric 
1510b57cec5SDimitry Andric   unsigned getBytesInStackArgArea() const { return BytesInStackArgArea; }
1520b57cec5SDimitry Andric   void setBytesInStackArgArea(unsigned bytes) { BytesInStackArgArea = bytes; }
1530b57cec5SDimitry Andric 
1540b57cec5SDimitry Andric   unsigned getArgumentStackToRestore() const { return ArgumentStackToRestore; }
1550b57cec5SDimitry Andric   void setArgumentStackToRestore(unsigned bytes) {
1560b57cec5SDimitry Andric     ArgumentStackToRestore = bytes;
1570b57cec5SDimitry Andric   }
1580b57cec5SDimitry Andric 
1598bcb0991SDimitry Andric   bool hasCalculatedStackSizeSVE() const { return HasCalculatedStackSizeSVE; }
1608bcb0991SDimitry Andric 
1618bcb0991SDimitry Andric   void setStackSizeSVE(uint64_t S) {
1628bcb0991SDimitry Andric     HasCalculatedStackSizeSVE = true;
1638bcb0991SDimitry Andric     StackSizeSVE = S;
1648bcb0991SDimitry Andric   }
1658bcb0991SDimitry Andric 
1668bcb0991SDimitry Andric   uint64_t getStackSizeSVE() const { return StackSizeSVE; }
1678bcb0991SDimitry Andric 
1680b57cec5SDimitry Andric   bool hasStackFrame() const { return HasStackFrame; }
1690b57cec5SDimitry Andric   void setHasStackFrame(bool s) { HasStackFrame = s; }
1700b57cec5SDimitry Andric 
1710b57cec5SDimitry Andric   bool isStackRealigned() const { return StackRealigned; }
1720b57cec5SDimitry Andric   void setStackRealigned(bool s) { StackRealigned = s; }
1730b57cec5SDimitry Andric 
1740b57cec5SDimitry Andric   bool hasCalleeSaveStackFreeSpace() const {
1750b57cec5SDimitry Andric     return CalleeSaveStackHasFreeSpace;
1760b57cec5SDimitry Andric   }
1770b57cec5SDimitry Andric   void setCalleeSaveStackHasFreeSpace(bool s) {
1780b57cec5SDimitry Andric     CalleeSaveStackHasFreeSpace = s;
1790b57cec5SDimitry Andric   }
1800b57cec5SDimitry Andric   bool isSplitCSR() const { return IsSplitCSR; }
1810b57cec5SDimitry Andric   void setIsSplitCSR(bool s) { IsSplitCSR = s; }
1820b57cec5SDimitry Andric 
183480093f4SDimitry Andric   void setLocalStackSize(uint64_t Size) { LocalStackSize = Size; }
184480093f4SDimitry Andric   uint64_t getLocalStackSize() const { return LocalStackSize; }
1850b57cec5SDimitry Andric 
186*5ffd83dbSDimitry Andric   void setOutliningStyle(std::string Style) { OutliningStyle = Style; }
187*5ffd83dbSDimitry Andric   Optional<std::string> getOutliningStyle() const { return OutliningStyle; }
188*5ffd83dbSDimitry Andric 
189480093f4SDimitry Andric   void setCalleeSavedStackSize(unsigned Size) {
190480093f4SDimitry Andric     CalleeSavedStackSize = Size;
191480093f4SDimitry Andric     HasCalleeSavedStackSize = true;
192480093f4SDimitry Andric   }
193480093f4SDimitry Andric 
194480093f4SDimitry Andric   // When CalleeSavedStackSize has not been set (for example when
195480093f4SDimitry Andric   // some MachineIR pass is run in isolation), then recalculate
196480093f4SDimitry Andric   // the CalleeSavedStackSize directly from the CalleeSavedInfo.
197480093f4SDimitry Andric   // Note: This information can only be recalculated after PEI
198480093f4SDimitry Andric   // has assigned offsets to the callee save objects.
199480093f4SDimitry Andric   unsigned getCalleeSavedStackSize(const MachineFrameInfo &MFI) const {
200480093f4SDimitry Andric     bool ValidateCalleeSavedStackSize = false;
201480093f4SDimitry Andric 
202480093f4SDimitry Andric #ifndef NDEBUG
203480093f4SDimitry Andric     // Make sure the calculated size derived from the CalleeSavedInfo
204480093f4SDimitry Andric     // equals the cached size that was calculated elsewhere (e.g. in
205480093f4SDimitry Andric     // determineCalleeSaves).
206480093f4SDimitry Andric     ValidateCalleeSavedStackSize = HasCalleeSavedStackSize;
207480093f4SDimitry Andric #endif
208480093f4SDimitry Andric 
209480093f4SDimitry Andric     if (!HasCalleeSavedStackSize || ValidateCalleeSavedStackSize) {
210480093f4SDimitry Andric       assert(MFI.isCalleeSavedInfoValid() && "CalleeSavedInfo not calculated");
211480093f4SDimitry Andric       if (MFI.getCalleeSavedInfo().empty())
212480093f4SDimitry Andric         return 0;
213480093f4SDimitry Andric 
214480093f4SDimitry Andric       int64_t MinOffset = std::numeric_limits<int64_t>::max();
215480093f4SDimitry Andric       int64_t MaxOffset = std::numeric_limits<int64_t>::min();
216480093f4SDimitry Andric       for (const auto &Info : MFI.getCalleeSavedInfo()) {
217480093f4SDimitry Andric         int FrameIdx = Info.getFrameIdx();
218480093f4SDimitry Andric         if (MFI.getStackID(FrameIdx) != TargetStackID::Default)
219480093f4SDimitry Andric           continue;
220480093f4SDimitry Andric         int64_t Offset = MFI.getObjectOffset(FrameIdx);
221480093f4SDimitry Andric         int64_t ObjSize = MFI.getObjectSize(FrameIdx);
222480093f4SDimitry Andric         MinOffset = std::min<int64_t>(Offset, MinOffset);
223480093f4SDimitry Andric         MaxOffset = std::max<int64_t>(Offset + ObjSize, MaxOffset);
224480093f4SDimitry Andric       }
225480093f4SDimitry Andric 
226480093f4SDimitry Andric       unsigned Size = alignTo(MaxOffset - MinOffset, 16);
227480093f4SDimitry Andric       assert((!HasCalleeSavedStackSize || getCalleeSavedStackSize() == Size) &&
228480093f4SDimitry Andric              "Invalid size calculated for callee saves");
229480093f4SDimitry Andric       return Size;
230480093f4SDimitry Andric     }
231480093f4SDimitry Andric 
232480093f4SDimitry Andric     return getCalleeSavedStackSize();
233480093f4SDimitry Andric   }
234480093f4SDimitry Andric 
235480093f4SDimitry Andric   unsigned getCalleeSavedStackSize() const {
236480093f4SDimitry Andric     assert(HasCalleeSavedStackSize &&
237480093f4SDimitry Andric            "CalleeSavedStackSize has not been calculated");
238480093f4SDimitry Andric     return CalleeSavedStackSize;
239480093f4SDimitry Andric   }
240480093f4SDimitry Andric 
241480093f4SDimitry Andric   // Saves the CalleeSavedStackSize for SVE vectors in 'scalable bytes'
242480093f4SDimitry Andric   void setSVECalleeSavedStackSize(unsigned Size) {
243480093f4SDimitry Andric     SVECalleeSavedStackSize = Size;
244480093f4SDimitry Andric   }
245480093f4SDimitry Andric   unsigned getSVECalleeSavedStackSize() const {
246480093f4SDimitry Andric     return SVECalleeSavedStackSize;
247480093f4SDimitry Andric   }
248480093f4SDimitry Andric 
249480093f4SDimitry Andric   void setMinMaxSVECSFrameIndex(int Min, int Max) {
250480093f4SDimitry Andric     MinSVECSFrameIndex = Min;
251480093f4SDimitry Andric     MaxSVECSFrameIndex = Max;
252480093f4SDimitry Andric   }
253480093f4SDimitry Andric 
254480093f4SDimitry Andric   int getMinSVECSFrameIndex() const { return MinSVECSFrameIndex; }
255480093f4SDimitry Andric   int getMaxSVECSFrameIndex() const { return MaxSVECSFrameIndex; }
2560b57cec5SDimitry Andric 
2570b57cec5SDimitry Andric   void incNumLocalDynamicTLSAccesses() { ++NumLocalDynamicTLSAccesses; }
2580b57cec5SDimitry Andric   unsigned getNumLocalDynamicTLSAccesses() const {
2590b57cec5SDimitry Andric     return NumLocalDynamicTLSAccesses;
2600b57cec5SDimitry Andric   }
2610b57cec5SDimitry Andric 
2620b57cec5SDimitry Andric   Optional<bool> hasRedZone() const { return HasRedZone; }
2630b57cec5SDimitry Andric   void setHasRedZone(bool s) { HasRedZone = s; }
2640b57cec5SDimitry Andric 
2650b57cec5SDimitry Andric   int getVarArgsStackIndex() const { return VarArgsStackIndex; }
2660b57cec5SDimitry Andric   void setVarArgsStackIndex(int Index) { VarArgsStackIndex = Index; }
2670b57cec5SDimitry Andric 
2680b57cec5SDimitry Andric   int getVarArgsGPRIndex() const { return VarArgsGPRIndex; }
2690b57cec5SDimitry Andric   void setVarArgsGPRIndex(int Index) { VarArgsGPRIndex = Index; }
2700b57cec5SDimitry Andric 
2710b57cec5SDimitry Andric   unsigned getVarArgsGPRSize() const { return VarArgsGPRSize; }
2720b57cec5SDimitry Andric   void setVarArgsGPRSize(unsigned Size) { VarArgsGPRSize = Size; }
2730b57cec5SDimitry Andric 
2740b57cec5SDimitry Andric   int getVarArgsFPRIndex() const { return VarArgsFPRIndex; }
2750b57cec5SDimitry Andric   void setVarArgsFPRIndex(int Index) { VarArgsFPRIndex = Index; }
2760b57cec5SDimitry Andric 
2770b57cec5SDimitry Andric   unsigned getVarArgsFPRSize() const { return VarArgsFPRSize; }
2780b57cec5SDimitry Andric   void setVarArgsFPRSize(unsigned Size) { VarArgsFPRSize = Size; }
2790b57cec5SDimitry Andric 
2800b57cec5SDimitry Andric   unsigned getSRetReturnReg() const { return SRetReturnReg; }
2810b57cec5SDimitry Andric   void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
2820b57cec5SDimitry Andric 
2830b57cec5SDimitry Andric   unsigned getJumpTableEntrySize(int Idx) const {
2840b57cec5SDimitry Andric     auto It = JumpTableEntryInfo.find(Idx);
2850b57cec5SDimitry Andric     if (It != JumpTableEntryInfo.end())
2860b57cec5SDimitry Andric       return It->second.first;
2870b57cec5SDimitry Andric     return 4;
2880b57cec5SDimitry Andric   }
2890b57cec5SDimitry Andric   MCSymbol *getJumpTableEntryPCRelSymbol(int Idx) const {
2900b57cec5SDimitry Andric     return JumpTableEntryInfo.find(Idx)->second.second;
2910b57cec5SDimitry Andric   }
2920b57cec5SDimitry Andric   void setJumpTableEntryInfo(int Idx, unsigned Size, MCSymbol *PCRelSym) {
2930b57cec5SDimitry Andric     JumpTableEntryInfo[Idx] = std::make_pair(Size, PCRelSym);
2940b57cec5SDimitry Andric   }
2950b57cec5SDimitry Andric 
2960b57cec5SDimitry Andric   using SetOfInstructions = SmallPtrSet<const MachineInstr *, 16>;
2970b57cec5SDimitry Andric 
2980b57cec5SDimitry Andric   const SetOfInstructions &getLOHRelated() const { return LOHRelated; }
2990b57cec5SDimitry Andric 
3000b57cec5SDimitry Andric   // Shortcuts for LOH related types.
3010b57cec5SDimitry Andric   class MILOHDirective {
3020b57cec5SDimitry Andric     MCLOHType Kind;
3030b57cec5SDimitry Andric 
3040b57cec5SDimitry Andric     /// Arguments of this directive. Order matters.
3050b57cec5SDimitry Andric     SmallVector<const MachineInstr *, 3> Args;
3060b57cec5SDimitry Andric 
3070b57cec5SDimitry Andric   public:
3080b57cec5SDimitry Andric     using LOHArgs = ArrayRef<const MachineInstr *>;
3090b57cec5SDimitry Andric 
3100b57cec5SDimitry Andric     MILOHDirective(MCLOHType Kind, LOHArgs Args)
3110b57cec5SDimitry Andric         : Kind(Kind), Args(Args.begin(), Args.end()) {
3120b57cec5SDimitry Andric       assert(isValidMCLOHType(Kind) && "Invalid LOH directive type!");
3130b57cec5SDimitry Andric     }
3140b57cec5SDimitry Andric 
3150b57cec5SDimitry Andric     MCLOHType getKind() const { return Kind; }
3160b57cec5SDimitry Andric     LOHArgs getArgs() const { return Args; }
3170b57cec5SDimitry Andric   };
3180b57cec5SDimitry Andric 
3190b57cec5SDimitry Andric   using MILOHArgs = MILOHDirective::LOHArgs;
3200b57cec5SDimitry Andric   using MILOHContainer = SmallVector<MILOHDirective, 32>;
3210b57cec5SDimitry Andric 
3220b57cec5SDimitry Andric   const MILOHContainer &getLOHContainer() const { return LOHContainerSet; }
3230b57cec5SDimitry Andric 
3240b57cec5SDimitry Andric   /// Add a LOH directive of this @p Kind and this @p Args.
3250b57cec5SDimitry Andric   void addLOHDirective(MCLOHType Kind, MILOHArgs Args) {
3260b57cec5SDimitry Andric     LOHContainerSet.push_back(MILOHDirective(Kind, Args));
3270b57cec5SDimitry Andric     LOHRelated.insert(Args.begin(), Args.end());
3280b57cec5SDimitry Andric   }
3290b57cec5SDimitry Andric 
3300b57cec5SDimitry Andric   SmallVectorImpl<ForwardedRegister> &getForwardedMustTailRegParms() {
3310b57cec5SDimitry Andric     return ForwardedMustTailRegParms;
3320b57cec5SDimitry Andric   }
3330b57cec5SDimitry Andric 
3340b57cec5SDimitry Andric   unsigned getTaggedBasePointerOffset() const {
3350b57cec5SDimitry Andric     return TaggedBasePointerOffset;
3360b57cec5SDimitry Andric   }
3370b57cec5SDimitry Andric   void setTaggedBasePointerOffset(unsigned Offset) {
3380b57cec5SDimitry Andric     TaggedBasePointerOffset = Offset;
3390b57cec5SDimitry Andric   }
3400b57cec5SDimitry Andric 
3410b57cec5SDimitry Andric private:
3420b57cec5SDimitry Andric   // Hold the lists of LOHs.
3430b57cec5SDimitry Andric   MILOHContainer LOHContainerSet;
3440b57cec5SDimitry Andric   SetOfInstructions LOHRelated;
3450b57cec5SDimitry Andric 
3460b57cec5SDimitry Andric   DenseMap<int, std::pair<unsigned, MCSymbol *>> JumpTableEntryInfo;
3470b57cec5SDimitry Andric };
3480b57cec5SDimitry Andric 
349*5ffd83dbSDimitry Andric namespace yaml {
350*5ffd83dbSDimitry Andric struct AArch64FunctionInfo final : public yaml::MachineFunctionInfo {
351*5ffd83dbSDimitry Andric   Optional<bool> HasRedZone;
352*5ffd83dbSDimitry Andric 
353*5ffd83dbSDimitry Andric   AArch64FunctionInfo() = default;
354*5ffd83dbSDimitry Andric   AArch64FunctionInfo(const llvm::AArch64FunctionInfo &MFI);
355*5ffd83dbSDimitry Andric 
356*5ffd83dbSDimitry Andric   void mappingImpl(yaml::IO &YamlIO) override;
357*5ffd83dbSDimitry Andric   ~AArch64FunctionInfo() = default;
358*5ffd83dbSDimitry Andric };
359*5ffd83dbSDimitry Andric 
360*5ffd83dbSDimitry Andric template <> struct MappingTraits<AArch64FunctionInfo> {
361*5ffd83dbSDimitry Andric   static void mapping(IO &YamlIO, AArch64FunctionInfo &MFI) {
362*5ffd83dbSDimitry Andric     YamlIO.mapOptional("hasRedZone", MFI.HasRedZone);
363*5ffd83dbSDimitry Andric   }
364*5ffd83dbSDimitry Andric };
365*5ffd83dbSDimitry Andric 
366*5ffd83dbSDimitry Andric } // end namespace yaml
367*5ffd83dbSDimitry Andric 
3680b57cec5SDimitry Andric } // end namespace llvm
3690b57cec5SDimitry Andric 
3700b57cec5SDimitry Andric #endif // LLVM_LIB_TARGET_AARCH64_AARCH64MACHINEFUNCTIONINFO_H
371