blob: edce2a9783e785d4754cef2da9e10bd60fadec5b [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001//====- X86MachineFuctionInfo.h - X86 machine function info -----*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner081ce942007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file declares X86-specific per-machine-function information.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef X86MACHINEFUNCTIONINFO_H
15#define X86MACHINEFUNCTIONINFO_H
16
17#include "llvm/CodeGen/MachineFunction.h"
18
19namespace llvm {
20
21enum NameDecorationStyle {
22 None,
23 StdCall,
24 FastCall
25};
26
27/// X86MachineFunctionInfo - This class is derived from MachineFunction private
28/// X86 target-specific information for each MachineFunction.
29class X86MachineFunctionInfo : public MachineFunctionInfo {
30 /// ForceFramePointer - True if the function is required to use of frame
31 /// pointer for reasons other than it containing dynamic allocation or
32 /// that FP eliminatation is turned off. For example, Cygwin main function
33 /// contains stack pointer re-alignment code which requires FP.
34 bool ForceFramePointer;
35
36 /// CalleeSavedFrameSize - Size of the callee-saved register portion of the
37 /// stack frame in bytes.
38 unsigned CalleeSavedFrameSize;
39
Evan Cheng0729ccf2008-01-05 00:41:47 +000040 /// BytesToPopOnReturn - Number of bytes function pops on return.
Dan Gohmanf17a25c2007-07-18 16:29:46 +000041 /// Used on windows platform for stdcall & fastcall name decoration
42 unsigned BytesToPopOnReturn;
43
Evan Cheng0729ccf2008-01-05 00:41:47 +000044 /// DecorationStyle - If the function requires additional name decoration,
45 /// DecorationStyle holds the right way to do so.
Dan Gohmanf17a25c2007-07-18 16:29:46 +000046 NameDecorationStyle DecorationStyle;
Anton Korobeynikove844e472007-08-15 17:12:32 +000047
Evan Cheng0729ccf2008-01-05 00:41:47 +000048 /// ReturnAddrIndex - FrameIndex for return slot.
Anton Korobeynikove844e472007-08-15 17:12:32 +000049 int ReturnAddrIndex;
Arnold Schwaighofere2d6bbb2007-10-11 19:40:01 +000050
Evan Cheng0729ccf2008-01-05 00:41:47 +000051 /// TailCallReturnAddrDelta - Delta the ReturnAddr stack slot is moved
52 /// Used for creating an area before the register spill area on the stack
53 /// the returnaddr can be savely move to this area
Arnold Schwaighofere2d6bbb2007-10-11 19:40:01 +000054 int TailCallReturnAddrDelta;
55
Dan Gohmanb47dabd2008-04-21 23:59:07 +000056 /// SRetReturnReg - Some subtargets require that sret lowering includes
57 /// returning the value of the returned struct in a register. This field
58 /// holds the virtual register into which the sret argument is passed.
59 unsigned SRetReturnReg;
60
Dan Gohman882ab732008-09-30 00:58:23 +000061 /// GlobalBaseReg - keeps track of the virtual register mapped onto global
62 /// base register.
63 unsigned GlobalBaseReg;
64
Dan Gohmanf17a25c2007-07-18 16:29:46 +000065public:
66 X86MachineFunctionInfo() : ForceFramePointer(false),
67 CalleeSavedFrameSize(0),
68 BytesToPopOnReturn(0),
Anton Korobeynikove844e472007-08-15 17:12:32 +000069 DecorationStyle(None),
Arnold Schwaighofere2d6bbb2007-10-11 19:40:01 +000070 ReturnAddrIndex(0),
Dan Gohmanb47dabd2008-04-21 23:59:07 +000071 TailCallReturnAddrDelta(0),
Dan Gohman882ab732008-09-30 00:58:23 +000072 SRetReturnReg(0),
73 GlobalBaseReg(0) {}
Dan Gohmanf17a25c2007-07-18 16:29:46 +000074
75 X86MachineFunctionInfo(MachineFunction &MF) : ForceFramePointer(false),
76 CalleeSavedFrameSize(0),
77 BytesToPopOnReturn(0),
Anton Korobeynikove844e472007-08-15 17:12:32 +000078 DecorationStyle(None),
Arnold Schwaighofere2d6bbb2007-10-11 19:40:01 +000079 ReturnAddrIndex(0),
Dan Gohmanb47dabd2008-04-21 23:59:07 +000080 TailCallReturnAddrDelta(0),
Dan Gohman882ab732008-09-30 00:58:23 +000081 SRetReturnReg(0),
82 GlobalBaseReg(0) {}
Dan Gohmanf17a25c2007-07-18 16:29:46 +000083
84 bool getForceFramePointer() const { return ForceFramePointer;}
85 void setForceFramePointer(bool forceFP) { ForceFramePointer = forceFP; }
86
87 unsigned getCalleeSavedFrameSize() const { return CalleeSavedFrameSize; }
88 void setCalleeSavedFrameSize(unsigned bytes) { CalleeSavedFrameSize = bytes; }
89
90 unsigned getBytesToPopOnReturn() const { return BytesToPopOnReturn; }
91 void setBytesToPopOnReturn (unsigned bytes) { BytesToPopOnReturn = bytes;}
92
93 NameDecorationStyle getDecorationStyle() const { return DecorationStyle; }
94 void setDecorationStyle(NameDecorationStyle style) { DecorationStyle = style;}
Anton Korobeynikove844e472007-08-15 17:12:32 +000095
96 int getRAIndex() const { return ReturnAddrIndex; }
97 void setRAIndex(int Index) { ReturnAddrIndex = Index; }
Arnold Schwaighofere2d6bbb2007-10-11 19:40:01 +000098
99 int getTCReturnAddrDelta() const { return TailCallReturnAddrDelta; }
100 void setTCReturnAddrDelta(int delta) {TailCallReturnAddrDelta = delta;}
Dan Gohmanb47dabd2008-04-21 23:59:07 +0000101
102 unsigned getSRetReturnReg() const { return SRetReturnReg; }
103 void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
Dan Gohman882ab732008-09-30 00:58:23 +0000104
105 unsigned getGlobalBaseReg() const { return GlobalBaseReg; }
106 void setGlobalBaseReg(unsigned Reg) { GlobalBaseReg = Reg; }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000107};
108} // End llvm namespace
109
110#endif