1 //=- AArch64MachineFuctionInfo.h - AArch64 machine function info -*- C++ -*-==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares AArch64-specific per-machine-function information.
12 //===----------------------------------------------------------------------===//
14 #ifndef AARCH64MACHINEFUNCTIONINFO_H
15 #define AARCH64MACHINEFUNCTIONINFO_H
17 #include "llvm/ADT/DenseMap.h"
18 #include "llvm/CodeGen/MachineFunction.h"
22 /// This class is derived from MachineFunctionInfo and contains private AArch64
23 /// target-specific information for each MachineFunction.
24 class AArch64MachineFunctionInfo : public MachineFunctionInfo {
25 virtual void anchor();
27 /// Number of bytes of arguments this function has on the stack. If the callee
28 /// is expected to restore the argument stack this should be a multiple of 16,
29 /// all usable during a tail call.
31 /// The alternative would forbid tail call optimisation in some cases: if we
32 /// want to transfer control from a function with 8-bytes of stack-argument
33 /// space to a function with 16-bytes then misalignment of this value would
34 /// make a stack adjustment necessary, which could not be undone by the
36 unsigned BytesInStackArgArea;
38 /// The number of bytes to restore to deallocate space for incoming
39 /// arguments. Canonically 0 in the C calling convention, but non-zero when
40 /// callee is expected to pop the args.
41 unsigned ArgumentStackToRestore;
43 /// If the stack needs to be adjusted on frame entry in two stages, this
44 /// records the size of the first adjustment just prior to storing
45 /// callee-saved registers. The callee-saved slots are addressed assuming
46 /// SP == <incoming-SP> - InitialStackAdjust.
47 unsigned InitialStackAdjust;
49 /// Number of local-dynamic TLS accesses.
50 unsigned NumLocalDynamics;
52 /// Keep track of the next label to be created within this function to
53 /// represent a cloned constant pool entry. Used by constant islands pass.
56 /// @see AArch64 Procedure Call Standard, B.3
58 /// The Frame index of the area where LowerFormalArguments puts the
59 /// general-purpose registers that might contain variadic parameters.
62 /// @see AArch64 Procedure Call Standard, B.3
64 /// The size of the frame object used to store the general-purpose registers
65 /// which might contain variadic arguments. This is the offset from
66 /// VariadicGPRIdx to what's stored in __gr_top.
67 unsigned VariadicGPRSize;
69 /// @see AArch64 Procedure Call Standard, B.3
71 /// The Frame index of the area where LowerFormalArguments puts the
72 /// floating-point registers that might contain variadic parameters.
75 /// @see AArch64 Procedure Call Standard, B.3
77 /// The size of the frame object used to store the floating-point registers
78 /// which might contain variadic arguments. This is the offset from
79 /// VariadicFPRIdx to what's stored in __vr_top.
80 unsigned VariadicFPRSize;
82 /// @see AArch64 Procedure Call Standard, B.3
84 /// The Frame index of an object pointing just past the last known stacked
85 /// argument on entry to a variadic function. This goes into the __stack field
86 /// of the va_list type.
89 /// The offset of the frame pointer from the stack pointer on function
90 /// entry. This is expected to be negative.
91 int FramePointerOffset;
94 AArch64MachineFunctionInfo()
95 : BytesInStackArgArea(0),
96 ArgumentStackToRestore(0),
97 InitialStackAdjust(0),
105 FramePointerOffset(0) {}
107 explicit AArch64MachineFunctionInfo(MachineFunction &MF)
108 : BytesInStackArgArea(0),
109 ArgumentStackToRestore(0),
110 InitialStackAdjust(0),
118 FramePointerOffset(0) {}
120 unsigned getBytesInStackArgArea() const { return BytesInStackArgArea; }
121 void setBytesInStackArgArea (unsigned bytes) { BytesInStackArgArea = bytes;}
123 unsigned getArgumentStackToRestore() const { return ArgumentStackToRestore; }
124 void setArgumentStackToRestore(unsigned bytes) { ArgumentStackToRestore = bytes; }
126 unsigned getInitialStackAdjust() const { return InitialStackAdjust; }
127 void setInitialStackAdjust(unsigned bytes) { InitialStackAdjust = bytes; }
129 unsigned getNumLocalDynamicTLSAccesses() const { return NumLocalDynamics; }
130 void incNumLocalDynamicTLSAccesses() { ++NumLocalDynamics; }
132 void initPICLabelUId(unsigned UId) { PICLabelUId = UId; }
133 unsigned getNumPICLabels() const { return PICLabelUId; }
134 unsigned createPICLabelUId() { return PICLabelUId++; }
136 int getVariadicGPRIdx() const { return VariadicGPRIdx; }
137 void setVariadicGPRIdx(int Idx) { VariadicGPRIdx = Idx; }
139 unsigned getVariadicGPRSize() const { return VariadicGPRSize; }
140 void setVariadicGPRSize(unsigned Size) { VariadicGPRSize = Size; }
142 int getVariadicFPRIdx() const { return VariadicFPRIdx; }
143 void setVariadicFPRIdx(int Idx) { VariadicFPRIdx = Idx; }
145 unsigned getVariadicFPRSize() const { return VariadicFPRSize; }
146 void setVariadicFPRSize(unsigned Size) { VariadicFPRSize = Size; }
148 int getVariadicStackIdx() const { return VariadicStackIdx; }
149 void setVariadicStackIdx(int Idx) { VariadicStackIdx = Idx; }
151 int getFramePointerOffset() const { return FramePointerOffset; }
152 void setFramePointerOffset(int Idx) { FramePointerOffset = Idx; }
156 } // End llvm namespace