1 //===-- X86MachineFuctionInfo.h - X86 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 X86-specific per-machine-function information.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_X86_X86MACHINEFUNCTIONINFO_H
15 #define LLVM_LIB_TARGET_X86_X86MACHINEFUNCTIONINFO_H
17 #include "llvm/CodeGen/MachineFunction.h"
18 #include "llvm/CodeGen/MachineValueType.h"
23 /// X86MachineFunctionInfo - This class is derived from MachineFunction and
24 /// contains private X86 target-specific information for each MachineFunction.
25 class X86MachineFunctionInfo : public MachineFunctionInfo {
26 virtual void anchor();
28 /// ForceFramePointer - True if the function is required to use of frame
29 /// pointer for reasons other than it containing dynamic allocation or
30 /// that FP eliminatation is turned off. For example, Cygwin main function
31 /// contains stack pointer re-alignment code which requires FP.
32 bool ForceFramePointer;
34 /// CalleeSavedFrameSize - Size of the callee-saved register portion of the
35 /// stack frame in bytes.
36 unsigned CalleeSavedFrameSize;
38 /// BytesToPopOnReturn - Number of bytes function pops on return (in addition
39 /// to the space used by the return address).
40 /// Used on windows platform for stdcall & fastcall name decoration
41 unsigned BytesToPopOnReturn;
43 /// ReturnAddrIndex - FrameIndex for return slot.
46 /// TailCallReturnAddrDelta - The number of bytes by which return address
47 /// stack slot is moved as the result of tail call optimization.
48 int TailCallReturnAddrDelta;
50 /// SRetReturnReg - Some subtargets require that sret lowering includes
51 /// returning the value of the returned struct in a register. This field
52 /// holds the virtual register into which the sret argument is passed.
53 unsigned SRetReturnReg;
55 /// GlobalBaseReg - keeps track of the virtual register initialized for
56 /// use as the global base register. This is used for PIC in some PIC
57 /// relocation models.
58 unsigned GlobalBaseReg;
60 /// VarArgsFrameIndex - FrameIndex for start of varargs area.
61 int VarArgsFrameIndex;
62 /// RegSaveFrameIndex - X86-64 vararg func register save area.
63 int RegSaveFrameIndex;
64 /// VarArgsGPOffset - X86-64 vararg func int reg offset.
65 unsigned VarArgsGPOffset;
66 /// VarArgsFPOffset - X86-64 vararg func fp reg offset.
67 unsigned VarArgsFPOffset;
68 /// ArgumentStackSize - The number of bytes on stack consumed by the arguments
69 /// being passed on the stack.
70 unsigned ArgumentStackSize;
71 /// NumLocalDynamics - Number of local-dynamic TLS accesses.
72 unsigned NumLocalDynamics;
75 /// Describes a register that needs to be forwarded from the prologue to a
78 Forward(unsigned VReg, MCPhysReg PReg, MVT VT)
79 : VReg(VReg), PReg(PReg), VT(VT) {}
86 /// ForwardedMustTailRegParms - A list of virtual and physical registers
87 /// that must be forwarded to every musttail call.
88 std::vector<Forward> ForwardedMustTailRegParms;
91 X86MachineFunctionInfo() : ForceFramePointer(false),
92 CalleeSavedFrameSize(0),
93 BytesToPopOnReturn(0),
95 TailCallReturnAddrDelta(0),
102 ArgumentStackSize(0),
103 NumLocalDynamics(0) {}
105 explicit X86MachineFunctionInfo(MachineFunction &MF)
106 : ForceFramePointer(false),
107 CalleeSavedFrameSize(0),
108 BytesToPopOnReturn(0),
110 TailCallReturnAddrDelta(0),
113 VarArgsFrameIndex(0),
114 RegSaveFrameIndex(0),
117 ArgumentStackSize(0),
118 NumLocalDynamics(0) {}
120 bool getForceFramePointer() const { return ForceFramePointer;}
121 void setForceFramePointer(bool forceFP) { ForceFramePointer = forceFP; }
123 unsigned getCalleeSavedFrameSize() const { return CalleeSavedFrameSize; }
124 void setCalleeSavedFrameSize(unsigned bytes) { CalleeSavedFrameSize = bytes; }
126 unsigned getBytesToPopOnReturn() const { return BytesToPopOnReturn; }
127 void setBytesToPopOnReturn (unsigned bytes) { BytesToPopOnReturn = bytes;}
129 int getRAIndex() const { return ReturnAddrIndex; }
130 void setRAIndex(int Index) { ReturnAddrIndex = Index; }
132 int getTCReturnAddrDelta() const { return TailCallReturnAddrDelta; }
133 void setTCReturnAddrDelta(int delta) {TailCallReturnAddrDelta = delta;}
135 unsigned getSRetReturnReg() const { return SRetReturnReg; }
136 void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
138 unsigned getGlobalBaseReg() const { return GlobalBaseReg; }
139 void setGlobalBaseReg(unsigned Reg) { GlobalBaseReg = Reg; }
141 int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
142 void setVarArgsFrameIndex(int Idx) { VarArgsFrameIndex = Idx; }
144 int getRegSaveFrameIndex() const { return RegSaveFrameIndex; }
145 void setRegSaveFrameIndex(int Idx) { RegSaveFrameIndex = Idx; }
147 unsigned getVarArgsGPOffset() const { return VarArgsGPOffset; }
148 void setVarArgsGPOffset(unsigned Offset) { VarArgsGPOffset = Offset; }
150 unsigned getVarArgsFPOffset() const { return VarArgsFPOffset; }
151 void setVarArgsFPOffset(unsigned Offset) { VarArgsFPOffset = Offset; }
153 unsigned getArgumentStackSize() const { return ArgumentStackSize; }
154 void setArgumentStackSize(unsigned size) { ArgumentStackSize = size; }
156 unsigned getNumLocalDynamicTLSAccesses() const { return NumLocalDynamics; }
157 void incNumLocalDynamicTLSAccesses() { ++NumLocalDynamics; }
159 std::vector<Forward> &getForwardedMustTailRegParms() {
160 return ForwardedMustTailRegParms;
164 } // End llvm namespace