[X86][SSE] Vector integer/float conversion memory folding
[oota-llvm.git] / lib / Target / X86 / X86MachineFunctionInfo.h
1 //===-- X86MachineFuctionInfo.h - X86 machine function info -----*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares X86-specific per-machine-function information.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_LIB_TARGET_X86_X86MACHINEFUNCTIONINFO_H
15 #define LLVM_LIB_TARGET_X86_X86MACHINEFUNCTIONINFO_H
16
17 #include "llvm/CodeGen/MachineFunction.h"
18 #include "llvm/CodeGen/MachineValueType.h"
19 #include <vector>
20
21 namespace llvm {
22
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();
27
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;
33
34   /// CalleeSavedFrameSize - Size of the callee-saved register portion of the
35   /// stack frame in bytes.
36   unsigned CalleeSavedFrameSize;
37
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;
42
43   /// ReturnAddrIndex - FrameIndex for return slot.
44   int ReturnAddrIndex;
45
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;
49
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;
54
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;
59
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;
73
74 public:
75   /// Describes a register that needs to be forwarded from the prologue to a
76   /// musttail call.
77   struct Forward {
78     Forward(unsigned VReg, MCPhysReg PReg, MVT VT)
79         : VReg(VReg), PReg(PReg), VT(VT) {}
80     unsigned VReg;
81     MCPhysReg PReg;
82     MVT VT;
83   };
84
85 private:
86   /// ForwardedMustTailRegParms - A list of virtual and physical registers
87   /// that must be forwarded to every musttail call.
88   std::vector<Forward> ForwardedMustTailRegParms;
89
90 public:
91   X86MachineFunctionInfo() : ForceFramePointer(false),
92                              CalleeSavedFrameSize(0),
93                              BytesToPopOnReturn(0),
94                              ReturnAddrIndex(0),
95                              TailCallReturnAddrDelta(0),
96                              SRetReturnReg(0),
97                              GlobalBaseReg(0),
98                              VarArgsFrameIndex(0),
99                              RegSaveFrameIndex(0),
100                              VarArgsGPOffset(0),
101                              VarArgsFPOffset(0),
102                              ArgumentStackSize(0),
103                              NumLocalDynamics(0) {}
104
105   explicit X86MachineFunctionInfo(MachineFunction &MF)
106     : ForceFramePointer(false),
107       CalleeSavedFrameSize(0),
108       BytesToPopOnReturn(0),
109       ReturnAddrIndex(0),
110       TailCallReturnAddrDelta(0),
111       SRetReturnReg(0),
112       GlobalBaseReg(0),
113       VarArgsFrameIndex(0),
114       RegSaveFrameIndex(0),
115       VarArgsGPOffset(0),
116       VarArgsFPOffset(0),
117       ArgumentStackSize(0),
118       NumLocalDynamics(0) {}
119
120   bool getForceFramePointer() const { return ForceFramePointer;}
121   void setForceFramePointer(bool forceFP) { ForceFramePointer = forceFP; }
122
123   unsigned getCalleeSavedFrameSize() const { return CalleeSavedFrameSize; }
124   void setCalleeSavedFrameSize(unsigned bytes) { CalleeSavedFrameSize = bytes; }
125
126   unsigned getBytesToPopOnReturn() const { return BytesToPopOnReturn; }
127   void setBytesToPopOnReturn (unsigned bytes) { BytesToPopOnReturn = bytes;}
128
129   int getRAIndex() const { return ReturnAddrIndex; }
130   void setRAIndex(int Index) { ReturnAddrIndex = Index; }
131
132   int getTCReturnAddrDelta() const { return TailCallReturnAddrDelta; }
133   void setTCReturnAddrDelta(int delta) {TailCallReturnAddrDelta = delta;}
134
135   unsigned getSRetReturnReg() const { return SRetReturnReg; }
136   void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
137
138   unsigned getGlobalBaseReg() const { return GlobalBaseReg; }
139   void setGlobalBaseReg(unsigned Reg) { GlobalBaseReg = Reg; }
140
141   int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
142   void setVarArgsFrameIndex(int Idx) { VarArgsFrameIndex = Idx; }
143
144   int getRegSaveFrameIndex() const { return RegSaveFrameIndex; }
145   void setRegSaveFrameIndex(int Idx) { RegSaveFrameIndex = Idx; }
146
147   unsigned getVarArgsGPOffset() const { return VarArgsGPOffset; }
148   void setVarArgsGPOffset(unsigned Offset) { VarArgsGPOffset = Offset; }
149
150   unsigned getVarArgsFPOffset() const { return VarArgsFPOffset; }
151   void setVarArgsFPOffset(unsigned Offset) { VarArgsFPOffset = Offset; }
152
153   unsigned getArgumentStackSize() const { return ArgumentStackSize; }
154   void setArgumentStackSize(unsigned size) { ArgumentStackSize = size; }
155
156   unsigned getNumLocalDynamicTLSAccesses() const { return NumLocalDynamics; }
157   void incNumLocalDynamicTLSAccesses() { ++NumLocalDynamics; }
158
159   std::vector<Forward> &getForwardedMustTailRegParms() {
160     return ForwardedMustTailRegParms;
161   }
162 };
163
164 } // End llvm namespace
165
166 #endif