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/CodeGen/MachineFunction.h"
21 /// This class is derived from MachineFunctionInfo and contains private AArch64
22 /// target-specific information for each MachineFunction.
23 class AArch64MachineFunctionInfo : public MachineFunctionInfo {
24 virtual void anchor();
26 /// Number of bytes of arguments this function has on the stack. If the callee
27 /// is expected to restore the argument stack this should be a multiple of 16,
28 /// all usable during a tail call.
30 /// The alternative would forbid tail call optimisation in some cases: if we
31 /// want to transfer control from a function with 8-bytes of stack-argument
32 /// space to a function with 16-bytes then misalignment of this value would
33 /// make a stack adjustment necessary, which could not be undone by the
35 unsigned BytesInStackArgArea;
37 /// The number of bytes to restore to deallocate space for incoming
38 /// arguments. Canonically 0 in the C calling convention, but non-zero when
39 /// callee is expected to pop the args.
40 unsigned ArgumentStackToRestore;
42 /// If the stack needs to be adjusted on frame entry in two stages, this
43 /// records the size of the first adjustment just prior to storing
44 /// callee-saved registers. The callee-saved slots are addressed assuming
45 /// SP == <incoming-SP> - InitialStackAdjust.
46 unsigned InitialStackAdjust;
48 /// Number of local-dynamic TLS accesses.
49 unsigned NumLocalDynamics;
51 /// @see AArch64 Procedure Call Standard, B.3
53 /// The Frame index of the area where LowerFormalArguments puts the
54 /// general-purpose registers that might contain variadic parameters.
57 /// @see AArch64 Procedure Call Standard, B.3
59 /// The size of the frame object used to store the general-purpose registers
60 /// which might contain variadic arguments. This is the offset from
61 /// VariadicGPRIdx to what's stored in __gr_top.
62 unsigned VariadicGPRSize;
64 /// @see AArch64 Procedure Call Standard, B.3
66 /// The Frame index of the area where LowerFormalArguments puts the
67 /// floating-point registers that might contain variadic parameters.
70 /// @see AArch64 Procedure Call Standard, B.3
72 /// The size of the frame object used to store the floating-point registers
73 /// which might contain variadic arguments. This is the offset from
74 /// VariadicFPRIdx to what's stored in __vr_top.
75 unsigned VariadicFPRSize;
77 /// @see AArch64 Procedure Call Standard, B.3
79 /// The Frame index of an object pointing just past the last known stacked
80 /// argument on entry to a variadic function. This goes into the __stack field
81 /// of the va_list type.
84 /// The offset of the frame pointer from the stack pointer on function
85 /// entry. This is expected to be negative.
86 int FramePointerOffset;
89 AArch64MachineFunctionInfo()
90 : BytesInStackArgArea(0),
91 ArgumentStackToRestore(0),
92 InitialStackAdjust(0),
99 FramePointerOffset(0) {}
101 explicit AArch64MachineFunctionInfo(MachineFunction &MF)
102 : BytesInStackArgArea(0),
103 ArgumentStackToRestore(0),
104 InitialStackAdjust(0),
111 FramePointerOffset(0) {}
113 unsigned getBytesInStackArgArea() const { return BytesInStackArgArea; }
114 void setBytesInStackArgArea (unsigned bytes) { BytesInStackArgArea = bytes;}
116 unsigned getArgumentStackToRestore() const { return ArgumentStackToRestore; }
117 void setArgumentStackToRestore(unsigned bytes) {
118 ArgumentStackToRestore = bytes;
121 unsigned getInitialStackAdjust() const { return InitialStackAdjust; }
122 void setInitialStackAdjust(unsigned bytes) { InitialStackAdjust = bytes; }
124 unsigned getNumLocalDynamicTLSAccesses() const { return NumLocalDynamics; }
125 void incNumLocalDynamicTLSAccesses() { ++NumLocalDynamics; }
127 int getVariadicGPRIdx() const { return VariadicGPRIdx; }
128 void setVariadicGPRIdx(int Idx) { VariadicGPRIdx = Idx; }
130 unsigned getVariadicGPRSize() const { return VariadicGPRSize; }
131 void setVariadicGPRSize(unsigned Size) { VariadicGPRSize = Size; }
133 int getVariadicFPRIdx() const { return VariadicFPRIdx; }
134 void setVariadicFPRIdx(int Idx) { VariadicFPRIdx = Idx; }
136 unsigned getVariadicFPRSize() const { return VariadicFPRSize; }
137 void setVariadicFPRSize(unsigned Size) { VariadicFPRSize = Size; }
139 int getVariadicStackIdx() const { return VariadicStackIdx; }
140 void setVariadicStackIdx(int Idx) { VariadicStackIdx = Idx; }
142 int getFramePointerOffset() const { return FramePointerOffset; }
143 void setFramePointerOffset(int Idx) { FramePointerOffset = Idx; }
147 } // End llvm namespace