blob: e50a104f2167949e403645ac7890cc0fd427feae [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//
5// This file was developed by the Evan Cheng and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
7//
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
40 /// BytesToPopOnReturn - amount of bytes function pops on return.
41 /// Used on windows platform for stdcall & fastcall name decoration
42 unsigned BytesToPopOnReturn;
43
44 /// If the function requires additional name decoration, DecorationStyle holds
45 /// the right way to do so.
46 NameDecorationStyle DecorationStyle;
Anton Korobeynikove844e472007-08-15 17:12:32 +000047
48 // FrameIndex for return slot.
49 int ReturnAddrIndex;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000050public:
51 X86MachineFunctionInfo() : ForceFramePointer(false),
52 CalleeSavedFrameSize(0),
53 BytesToPopOnReturn(0),
Anton Korobeynikove844e472007-08-15 17:12:32 +000054 DecorationStyle(None),
55 ReturnAddrIndex(0) {}
Dan Gohmanf17a25c2007-07-18 16:29:46 +000056
57 X86MachineFunctionInfo(MachineFunction &MF) : ForceFramePointer(false),
58 CalleeSavedFrameSize(0),
59 BytesToPopOnReturn(0),
Anton Korobeynikove844e472007-08-15 17:12:32 +000060 DecorationStyle(None),
61 ReturnAddrIndex(0) {}
Dan Gohmanf17a25c2007-07-18 16:29:46 +000062
63 bool getForceFramePointer() const { return ForceFramePointer;}
64 void setForceFramePointer(bool forceFP) { ForceFramePointer = forceFP; }
65
66 unsigned getCalleeSavedFrameSize() const { return CalleeSavedFrameSize; }
67 void setCalleeSavedFrameSize(unsigned bytes) { CalleeSavedFrameSize = bytes; }
68
69 unsigned getBytesToPopOnReturn() const { return BytesToPopOnReturn; }
70 void setBytesToPopOnReturn (unsigned bytes) { BytesToPopOnReturn = bytes;}
71
72 NameDecorationStyle getDecorationStyle() const { return DecorationStyle; }
73 void setDecorationStyle(NameDecorationStyle style) { DecorationStyle = style;}
Anton Korobeynikove844e472007-08-15 17:12:32 +000074
75 int getRAIndex() const { return ReturnAddrIndex; }
76 void setRAIndex(int Index) { ReturnAddrIndex = Index; }
Dan Gohmanf17a25c2007-07-18 16:29:46 +000077};
78} // End llvm namespace
79
80#endif