Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1 | //====- X86MachineFuctionInfo.h - X86 machine function info -----*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 081ce94 | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 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 | |
| 19 | namespace llvm { |
| 20 | |
| 21 | enum 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. |
| 29 | class 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 Cheng | 0729ccf | 2008-01-05 00:41:47 +0000 | [diff] [blame] | 40 | /// BytesToPopOnReturn - Number of bytes function pops on return. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 41 | /// Used on windows platform for stdcall & fastcall name decoration |
| 42 | unsigned BytesToPopOnReturn; |
| 43 | |
Evan Cheng | 0729ccf | 2008-01-05 00:41:47 +0000 | [diff] [blame] | 44 | /// DecorationStyle - If the function requires additional name decoration, |
| 45 | /// DecorationStyle holds the right way to do so. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 46 | NameDecorationStyle DecorationStyle; |
Anton Korobeynikov | e844e47 | 2007-08-15 17:12:32 +0000 | [diff] [blame] | 47 | |
Evan Cheng | 0729ccf | 2008-01-05 00:41:47 +0000 | [diff] [blame] | 48 | /// ReturnAddrIndex - FrameIndex for return slot. |
Anton Korobeynikov | e844e47 | 2007-08-15 17:12:32 +0000 | [diff] [blame] | 49 | int ReturnAddrIndex; |
Arnold Schwaighofer | e2d6bbb | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 50 | |
Evan Cheng | 0729ccf | 2008-01-05 00:41:47 +0000 | [diff] [blame] | 51 | /// 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 Schwaighofer | e2d6bbb | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 54 | int TailCallReturnAddrDelta; |
| 55 | |
Dan Gohman | b47dabd | 2008-04-21 23:59:07 +0000 | [diff] [blame] | 56 | /// 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 Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 61 | public: |
| 62 | X86MachineFunctionInfo() : ForceFramePointer(false), |
| 63 | CalleeSavedFrameSize(0), |
| 64 | BytesToPopOnReturn(0), |
Anton Korobeynikov | e844e47 | 2007-08-15 17:12:32 +0000 | [diff] [blame] | 65 | DecorationStyle(None), |
Arnold Schwaighofer | e2d6bbb | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 66 | ReturnAddrIndex(0), |
Dan Gohman | b47dabd | 2008-04-21 23:59:07 +0000 | [diff] [blame] | 67 | TailCallReturnAddrDelta(0), |
| 68 | SRetReturnReg(0) {} |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 69 | |
| 70 | X86MachineFunctionInfo(MachineFunction &MF) : ForceFramePointer(false), |
| 71 | CalleeSavedFrameSize(0), |
| 72 | BytesToPopOnReturn(0), |
Anton Korobeynikov | e844e47 | 2007-08-15 17:12:32 +0000 | [diff] [blame] | 73 | DecorationStyle(None), |
Arnold Schwaighofer | e2d6bbb | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 74 | ReturnAddrIndex(0), |
Dan Gohman | b47dabd | 2008-04-21 23:59:07 +0000 | [diff] [blame] | 75 | TailCallReturnAddrDelta(0), |
| 76 | SRetReturnReg(0) {} |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 77 | |
| 78 | bool getForceFramePointer() const { return ForceFramePointer;} |
| 79 | void setForceFramePointer(bool forceFP) { ForceFramePointer = forceFP; } |
| 80 | |
| 81 | unsigned getCalleeSavedFrameSize() const { return CalleeSavedFrameSize; } |
| 82 | void setCalleeSavedFrameSize(unsigned bytes) { CalleeSavedFrameSize = bytes; } |
| 83 | |
| 84 | unsigned getBytesToPopOnReturn() const { return BytesToPopOnReturn; } |
| 85 | void setBytesToPopOnReturn (unsigned bytes) { BytesToPopOnReturn = bytes;} |
| 86 | |
| 87 | NameDecorationStyle getDecorationStyle() const { return DecorationStyle; } |
| 88 | void setDecorationStyle(NameDecorationStyle style) { DecorationStyle = style;} |
Anton Korobeynikov | e844e47 | 2007-08-15 17:12:32 +0000 | [diff] [blame] | 89 | |
| 90 | int getRAIndex() const { return ReturnAddrIndex; } |
| 91 | void setRAIndex(int Index) { ReturnAddrIndex = Index; } |
Arnold Schwaighofer | e2d6bbb | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 92 | |
| 93 | int getTCReturnAddrDelta() const { return TailCallReturnAddrDelta; } |
| 94 | void setTCReturnAddrDelta(int delta) {TailCallReturnAddrDelta = delta;} |
Dan Gohman | b47dabd | 2008-04-21 23:59:07 +0000 | [diff] [blame] | 95 | |
| 96 | unsigned getSRetReturnReg() const { return SRetReturnReg; } |
| 97 | void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 98 | }; |
| 99 | } // End llvm namespace |
| 100 | |
| 101 | #endif |