1 //===- ARM64MachineFuctionInfo.h - ARM64 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 ARM64-specific per-machine-function information.
12 //===----------------------------------------------------------------------===//
14 #ifndef ARM64MACHINEFUNCTIONINFO_H
15 #define ARM64MACHINEFUNCTIONINFO_H
17 #include "llvm/ADT/SmallPtrSet.h"
18 #include "llvm/ADT/SmallVector.h"
19 #include "llvm/CodeGen/MachineFunction.h"
20 #include "llvm/MC/MCLinkerOptimizationHint.h"
24 /// ARM64FunctionInfo - This class is derived from MachineFunctionInfo and
25 /// contains private ARM64-specific information for each MachineFunction.
26 class ARM64FunctionInfo : public MachineFunctionInfo {
28 /// HasStackFrame - True if this function has a stack frame. Set by
29 /// processFunctionBeforeCalleeSavedScan().
32 /// \brief Amount of stack frame size, not including callee-saved registers.
33 unsigned LocalStackSize;
35 /// \brief Number of TLS accesses using the special (combinable)
36 /// _TLS_MODULE_BASE_ symbol.
37 unsigned NumLocalDynamicTLSAccesses;
39 /// \brief FrameIndex for start of varargs area for arguments passed on the
41 int VarArgsStackIndex;
43 /// \brief FrameIndex for start of varargs area for arguments passed in
44 /// general purpose registers.
47 /// \brief Size of the varargs area for arguments passed in general purpose
49 unsigned VarArgsGPRSize;
51 /// \brief FrameIndex for start of varargs area for arguments passed in
52 /// floating-point registers.
55 /// \brief Size of the varargs area for arguments passed in floating-point
57 unsigned VarArgsFPRSize;
61 : HasStackFrame(false), NumLocalDynamicTLSAccesses(0),
62 VarArgsStackIndex(0), VarArgsGPRIndex(0), VarArgsGPRSize(0),
63 VarArgsFPRIndex(0), VarArgsFPRSize(0) {}
65 explicit ARM64FunctionInfo(MachineFunction &MF)
66 : HasStackFrame(false), NumLocalDynamicTLSAccesses(0),
67 VarArgsStackIndex(0), VarArgsGPRIndex(0), VarArgsGPRSize(0),
68 VarArgsFPRIndex(0), VarArgsFPRSize(0) {
72 bool hasStackFrame() const { return HasStackFrame; }
73 void setHasStackFrame(bool s) { HasStackFrame = s; }
75 void setLocalStackSize(unsigned Size) { LocalStackSize = Size; }
76 unsigned getLocalStackSize() const { return LocalStackSize; }
78 void incNumLocalDynamicTLSAccesses() { ++NumLocalDynamicTLSAccesses; }
79 unsigned getNumLocalDynamicTLSAccesses() const {
80 return NumLocalDynamicTLSAccesses;
83 int getVarArgsStackIndex() const { return VarArgsStackIndex; }
84 void setVarArgsStackIndex(int Index) { VarArgsStackIndex = Index; }
86 int getVarArgsGPRIndex() const { return VarArgsGPRIndex; }
87 void setVarArgsGPRIndex(int Index) { VarArgsGPRIndex = Index; }
89 unsigned getVarArgsGPRSize() const { return VarArgsGPRSize; }
90 void setVarArgsGPRSize(unsigned Size) { VarArgsGPRSize = Size; }
92 int getVarArgsFPRIndex() const { return VarArgsFPRIndex; }
93 void setVarArgsFPRIndex(int Index) { VarArgsFPRIndex = Index; }
95 unsigned getVarArgsFPRSize() const { return VarArgsFPRSize; }
96 void setVarArgsFPRSize(unsigned Size) { VarArgsFPRSize = Size; }
98 typedef SmallPtrSet<const MachineInstr *, 16> SetOfInstructions;
100 const SetOfInstructions &getLOHRelated() const { return LOHRelated; }
102 // Shortcuts for LOH related types.
103 typedef LOHDirective<const MachineInstr> MILOHDirective;
104 typedef MILOHDirective::LOHArgs MILOHArgs;
106 typedef LOHContainer<const MachineInstr> MILOHContainer;
107 typedef MILOHContainer::LOHDirectives MILOHDirectives;
109 const MILOHContainer &getLOHContainer() const { return LOHContainerSet; }
111 /// Add a LOH directive of this @p Kind and this @p Args.
112 void addLOHDirective(MCLOHType Kind, const MILOHArgs &Args) {
113 LOHContainerSet.addDirective(Kind, Args);
114 for (MILOHArgs::const_iterator It = Args.begin(), EndIt = Args.end();
116 LOHRelated.insert(*It);
120 // Hold the lists of LOHs.
121 MILOHContainer LOHContainerSet;
122 SetOfInstructions LOHRelated;
124 } // End llvm namespace
126 #endif // ARM64MACHINEFUNCTIONINFO_H