blob: 7a21fb2f27749a512bfbb7f9896f2895fd0e30b6 [file] [log] [blame]
Evan Chenge8bd0a32006-06-06 23:30:24 +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
Anton Korobeynikovf8248682006-09-20 22:03:51 +000021enum NameDecorationStyle {
22 None,
23 StdCall,
24 FastCall
25};
26
Chris Lattnerd15dff22007-04-17 17:21:52 +000027/// X86MachineFunctionInfo - This class is derived from MachineFunction private
Evan Chenge5e228d2006-06-09 06:25:10 +000028/// X86 target-specific information for each MachineFunction.
Chris Lattnerd15dff22007-04-17 17:21:52 +000029class X86MachineFunctionInfo : public MachineFunctionInfo {
Anton Korobeynikovf8248682006-09-20 22:03:51 +000030 /// 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.
Evan Chenge5e228d2006-06-09 06:25:10 +000034 bool ForceFramePointer;
Anton Korobeynikovf8248682006-09-20 22:03:51 +000035
Evan Cheng89d16592007-07-17 07:59:08 +000036 /// CalleeSavedFrameSize - Size of the callee-saved register portion of the
37 /// stack frame in bytes.
38 unsigned CalleeSavedFrameSize;
39
Anton Korobeynikovf8248682006-09-20 22:03:51 +000040 /// 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;
47
Evan Chenge8bd0a32006-06-06 23:30:24 +000048public:
Chris Lattnerd15dff22007-04-17 17:21:52 +000049 X86MachineFunctionInfo() : ForceFramePointer(false),
Evan Cheng89d16592007-07-17 07:59:08 +000050 CalleeSavedFrameSize(0),
Chris Lattnerd15dff22007-04-17 17:21:52 +000051 BytesToPopOnReturn(0),
52 DecorationStyle(None) {}
Anton Korobeynikovf8248682006-09-20 22:03:51 +000053
Chris Lattnerd15dff22007-04-17 17:21:52 +000054 X86MachineFunctionInfo(MachineFunction &MF) : ForceFramePointer(false),
Evan Cheng89d16592007-07-17 07:59:08 +000055 CalleeSavedFrameSize(0),
Chris Lattnerd15dff22007-04-17 17:21:52 +000056 BytesToPopOnReturn(0),
57 DecorationStyle(None) {}
Anton Korobeynikovf8248682006-09-20 22:03:51 +000058
Evan Chenge8bd0a32006-06-06 23:30:24 +000059 bool getForceFramePointer() const { return ForceFramePointer;}
60 void setForceFramePointer(bool forceFP) { ForceFramePointer = forceFP; }
Anton Korobeynikovf8248682006-09-20 22:03:51 +000061
Evan Cheng89d16592007-07-17 07:59:08 +000062 unsigned getCalleeSavedFrameSize() const { return CalleeSavedFrameSize; }
63 void setCalleeSavedFrameSize(unsigned bytes) { CalleeSavedFrameSize = bytes; }
64
Anton Korobeynikovf8248682006-09-20 22:03:51 +000065 unsigned getBytesToPopOnReturn() const { return BytesToPopOnReturn; }
66 void setBytesToPopOnReturn (unsigned bytes) { BytesToPopOnReturn = bytes;}
67
68 NameDecorationStyle getDecorationStyle() const { return DecorationStyle; }
69 void setDecorationStyle(NameDecorationStyle style) { DecorationStyle = style;}
70
Evan Chenge8bd0a32006-06-06 23:30:24 +000071};
72} // End llvm namespace
73
74#endif