| Evan Cheng | dc614c1 | 2006-06-06 23:30:24 +0000 | [diff] [blame] | 1 | //====- X86MachineFuctionInfo.h - X86 machine function info -----*- C++ -*-===// | 
|  | 2 | // | 
|  | 3 | //                     The LLVM Compiler Infrastructure | 
|  | 4 | // | 
| Chris Lattner | f3ebc3f | 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. | 
| Evan Cheng | dc614c1 | 2006-06-06 23:30:24 +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 |  | 
| Anton Korobeynikov | 3c5b3df | 2006-09-20 22:03:51 +0000 | [diff] [blame] | 21 | enum NameDecorationStyle { | 
|  | 22 | None, | 
|  | 23 | StdCall, | 
|  | 24 | FastCall | 
|  | 25 | }; | 
|  | 26 |  | 
| Chris Lattner | ff0598d | 2007-04-17 17:21:52 +0000 | [diff] [blame] | 27 | /// X86MachineFunctionInfo - This class is derived from MachineFunction private | 
| Evan Cheng | beedf82 | 2006-06-09 06:25:10 +0000 | [diff] [blame] | 28 | /// X86 target-specific information for each MachineFunction. | 
| Chris Lattner | ff0598d | 2007-04-17 17:21:52 +0000 | [diff] [blame] | 29 | class X86MachineFunctionInfo : public MachineFunctionInfo { | 
| Anton Korobeynikov | 3c5b3df | 2006-09-20 22:03:51 +0000 | [diff] [blame] | 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. | 
| Evan Cheng | beedf82 | 2006-06-09 06:25:10 +0000 | [diff] [blame] | 34 | bool ForceFramePointer; | 
| Anton Korobeynikov | 3c5b3df | 2006-09-20 22:03:51 +0000 | [diff] [blame] | 35 |  | 
| Evan Cheng | 9ae2eb4 | 2007-07-17 07:59:08 +0000 | [diff] [blame] | 36 | /// CalleeSavedFrameSize - Size of the callee-saved register portion of the | 
|  | 37 | /// stack frame in bytes. | 
|  | 38 | unsigned CalleeSavedFrameSize; | 
|  | 39 |  | 
| Anton Korobeynikov | 3c5b3df | 2006-09-20 22:03:51 +0000 | [diff] [blame] | 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 Korobeynikov | 597c8b7 | 2007-08-15 17:12:32 +0000 | [diff] [blame] | 47 |  | 
|  | 48 | // FrameIndex for return slot. | 
|  | 49 | int ReturnAddrIndex; | 
| Arnold Schwaighofer | 9ccea99 | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 50 |  | 
|  | 51 | // 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 | 
|  | 54 | int TailCallReturnAddrDelta; | 
|  | 55 |  | 
| Evan Cheng | dc614c1 | 2006-06-06 23:30:24 +0000 | [diff] [blame] | 56 | public: | 
| Chris Lattner | ff0598d | 2007-04-17 17:21:52 +0000 | [diff] [blame] | 57 | X86MachineFunctionInfo() : ForceFramePointer(false), | 
| Evan Cheng | 9ae2eb4 | 2007-07-17 07:59:08 +0000 | [diff] [blame] | 58 | CalleeSavedFrameSize(0), | 
| Chris Lattner | ff0598d | 2007-04-17 17:21:52 +0000 | [diff] [blame] | 59 | BytesToPopOnReturn(0), | 
| Anton Korobeynikov | 597c8b7 | 2007-08-15 17:12:32 +0000 | [diff] [blame] | 60 | DecorationStyle(None), | 
| Arnold Schwaighofer | 9ccea99 | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 61 | ReturnAddrIndex(0), | 
|  | 62 | TailCallReturnAddrDelta(0){} | 
| Anton Korobeynikov | 3c5b3df | 2006-09-20 22:03:51 +0000 | [diff] [blame] | 63 |  | 
| Chris Lattner | ff0598d | 2007-04-17 17:21:52 +0000 | [diff] [blame] | 64 | X86MachineFunctionInfo(MachineFunction &MF) : ForceFramePointer(false), | 
| Evan Cheng | 9ae2eb4 | 2007-07-17 07:59:08 +0000 | [diff] [blame] | 65 | CalleeSavedFrameSize(0), | 
| Chris Lattner | ff0598d | 2007-04-17 17:21:52 +0000 | [diff] [blame] | 66 | BytesToPopOnReturn(0), | 
| Anton Korobeynikov | 597c8b7 | 2007-08-15 17:12:32 +0000 | [diff] [blame] | 67 | DecorationStyle(None), | 
| Arnold Schwaighofer | 9ccea99 | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 68 | ReturnAddrIndex(0), | 
|  | 69 | TailCallReturnAddrDelta(0) {} | 
| Anton Korobeynikov | 3c5b3df | 2006-09-20 22:03:51 +0000 | [diff] [blame] | 70 |  | 
| Evan Cheng | dc614c1 | 2006-06-06 23:30:24 +0000 | [diff] [blame] | 71 | bool getForceFramePointer() const { return ForceFramePointer;} | 
|  | 72 | void setForceFramePointer(bool forceFP) { ForceFramePointer = forceFP; } | 
| Anton Korobeynikov | 3c5b3df | 2006-09-20 22:03:51 +0000 | [diff] [blame] | 73 |  | 
| Evan Cheng | 9ae2eb4 | 2007-07-17 07:59:08 +0000 | [diff] [blame] | 74 | unsigned getCalleeSavedFrameSize() const { return CalleeSavedFrameSize; } | 
|  | 75 | void setCalleeSavedFrameSize(unsigned bytes) { CalleeSavedFrameSize = bytes; } | 
|  | 76 |  | 
| Anton Korobeynikov | 3c5b3df | 2006-09-20 22:03:51 +0000 | [diff] [blame] | 77 | unsigned getBytesToPopOnReturn() const { return BytesToPopOnReturn; } | 
|  | 78 | void setBytesToPopOnReturn (unsigned bytes) { BytesToPopOnReturn = bytes;} | 
|  | 79 |  | 
|  | 80 | NameDecorationStyle getDecorationStyle() const { return DecorationStyle; } | 
|  | 81 | void setDecorationStyle(NameDecorationStyle style) { DecorationStyle = style;} | 
| Anton Korobeynikov | 597c8b7 | 2007-08-15 17:12:32 +0000 | [diff] [blame] | 82 |  | 
|  | 83 | int getRAIndex() const { return ReturnAddrIndex; } | 
|  | 84 | void setRAIndex(int Index) { ReturnAddrIndex = Index; } | 
| Arnold Schwaighofer | 9ccea99 | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 85 |  | 
|  | 86 | int getTCReturnAddrDelta() const { return TailCallReturnAddrDelta; } | 
|  | 87 | void setTCReturnAddrDelta(int delta) {TailCallReturnAddrDelta = delta;} | 
| Evan Cheng | dc614c1 | 2006-06-06 23:30:24 +0000 | [diff] [blame] | 88 | }; | 
|  | 89 | } // End llvm namespace | 
|  | 90 |  | 
|  | 91 | #endif |