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 X86MACHINEFUNCTIONINFO_H
15 #define X86MACHINEFUNCTIONINFO_H
17 #include "llvm/CodeGen/MachineFunction.h"
21 /// X86MachineFunctionInfo - This class is derived from MachineFunction and
22 /// contains private X86 target-specific information for each MachineFunction.
23 class X86MachineFunctionInfo : public MachineFunctionInfo {
24 virtual void anchor();
26 /// ForceFramePointer - True if the function is required to use of frame
27 /// pointer for reasons other than it containing dynamic allocation or
28 /// that FP eliminatation is turned off. For example, Cygwin main function
29 /// contains stack pointer re-alignment code which requires FP.
30 bool ForceFramePointer;
32 /// CalleeSavedFrameSize - Size of the callee-saved register portion of the
33 /// stack frame in bytes.
34 unsigned CalleeSavedFrameSize;
36 /// BytesToPopOnReturn - Number of bytes function pops on return (in addition
37 /// to the space used by the return address).
38 /// Used on windows platform for stdcall & fastcall name decoration
39 unsigned BytesToPopOnReturn;
41 /// ReturnAddrIndex - FrameIndex for return slot.
44 /// TailCallReturnAddrDelta - The number of bytes by which return address
45 /// stack slot is moved as the result of tail call optimization.
46 int TailCallReturnAddrDelta;
48 /// SRetReturnReg - Some subtargets require that sret lowering includes
49 /// returning the value of the returned struct in a register. This field
50 /// holds the virtual register into which the sret argument is passed.
51 unsigned SRetReturnReg;
53 /// GlobalBaseReg - keeps track of the virtual register initialized for
54 /// use as the global base register. This is used for PIC in some PIC
55 /// relocation models.
56 unsigned GlobalBaseReg;
58 /// VarArgsFrameIndex - FrameIndex for start of varargs area.
59 int VarArgsFrameIndex;
60 /// RegSaveFrameIndex - X86-64 vararg func register save area.
61 int RegSaveFrameIndex;
62 /// VarArgsGPOffset - X86-64 vararg func int reg offset.
63 unsigned VarArgsGPOffset;
64 /// VarArgsFPOffset - X86-64 vararg func fp reg offset.
65 unsigned VarArgsFPOffset;
66 /// ArgumentStackSize - The number of bytes on stack consumed by the arguments
67 /// being passed on the stack.
68 unsigned ArgumentStackSize;
71 X86MachineFunctionInfo() : ForceFramePointer(false),
72 CalleeSavedFrameSize(0),
73 BytesToPopOnReturn(0),
75 TailCallReturnAddrDelta(0),
82 ArgumentStackSize(0) {}
84 explicit X86MachineFunctionInfo(MachineFunction &MF)
85 : ForceFramePointer(false),
86 CalleeSavedFrameSize(0),
87 BytesToPopOnReturn(0),
89 TailCallReturnAddrDelta(0),
96 ArgumentStackSize(0) {}
98 bool getForceFramePointer() const { return ForceFramePointer;}
99 void setForceFramePointer(bool forceFP) { ForceFramePointer = forceFP; }
101 unsigned getCalleeSavedFrameSize() const { return CalleeSavedFrameSize; }
102 void setCalleeSavedFrameSize(unsigned bytes) { CalleeSavedFrameSize = bytes; }
104 unsigned getBytesToPopOnReturn() const { return BytesToPopOnReturn; }
105 void setBytesToPopOnReturn (unsigned bytes) { BytesToPopOnReturn = bytes;}
107 int getRAIndex() const { return ReturnAddrIndex; }
108 void setRAIndex(int Index) { ReturnAddrIndex = Index; }
110 int getTCReturnAddrDelta() const { return TailCallReturnAddrDelta; }
111 void setTCReturnAddrDelta(int delta) {TailCallReturnAddrDelta = delta;}
113 unsigned getSRetReturnReg() const { return SRetReturnReg; }
114 void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
116 unsigned getGlobalBaseReg() const { return GlobalBaseReg; }
117 void setGlobalBaseReg(unsigned Reg) { GlobalBaseReg = Reg; }
119 int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
120 void setVarArgsFrameIndex(int Idx) { VarArgsFrameIndex = Idx; }
122 int getRegSaveFrameIndex() const { return RegSaveFrameIndex; }
123 void setRegSaveFrameIndex(int Idx) { RegSaveFrameIndex = Idx; }
125 unsigned getVarArgsGPOffset() const { return VarArgsGPOffset; }
126 void setVarArgsGPOffset(unsigned Offset) { VarArgsGPOffset = Offset; }
128 unsigned getVarArgsFPOffset() const { return VarArgsFPOffset; }
129 void setVarArgsFPOffset(unsigned Offset) { VarArgsFPOffset = Offset; }
131 unsigned getArgumentStackSize() const { return ArgumentStackSize; }
132 void setArgumentStackSize(unsigned size) { ArgumentStackSize = size; }
135 } // End llvm namespace