| Akira Hatanaka | 4552c9a | 2011-04-15 21:51:11 +0000 | [diff] [blame] | 1 | //===-- MipsMachineFunctionInfo.h - Private data used for Mips ----*- C++ -*-=// |
| Bruno Cardoso Lopes | 4215a59 | 2007-07-11 22:44:21 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| Chris Lattner | 4ee451d | 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. |
| Bruno Cardoso Lopes | 4215a59 | 2007-07-11 22:44:21 +0000 | [diff] [blame] | 7 | // |
| Akira Hatanaka | 4552c9a | 2011-04-15 21:51:11 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
| Bruno Cardoso Lopes | 4215a59 | 2007-07-11 22:44:21 +0000 | [diff] [blame] | 9 | // |
| 10 | // This file declares the Mips specific subclass of MachineFunctionInfo. |
| 11 | // |
| Akira Hatanaka | 4552c9a | 2011-04-15 21:51:11 +0000 | [diff] [blame] | 12 | //===----------------------------------------------------------------------===// |
| Bruno Cardoso Lopes | 4215a59 | 2007-07-11 22:44:21 +0000 | [diff] [blame] | 13 | |
| 14 | #ifndef MIPS_MACHINE_FUNCTION_INFO_H |
| 15 | #define MIPS_MACHINE_FUNCTION_INFO_H |
| 16 | |
| Akira Hatanaka | a76220a | 2012-06-14 01:15:36 +0000 | [diff] [blame] | 17 | #include "MipsSubtarget.h" |
| Bruno Cardoso Lopes | 2d4575e | 2007-08-28 05:04:41 +0000 | [diff] [blame] | 18 | #include "llvm/CodeGen/MachineFrameInfo.h" |
| Chandler Carruth | a1514e2 | 2012-12-04 07:12:27 +0000 | [diff] [blame] | 19 | #include "llvm/CodeGen/MachineFunction.h" |
| Akira Hatanaka | a76220a | 2012-06-14 01:15:36 +0000 | [diff] [blame] | 20 | #include "llvm/Target/TargetFrameLowering.h" |
| 21 | #include "llvm/Target/TargetMachine.h" |
| Craig Topper | 79aa341 | 2012-03-17 18:46:09 +0000 | [diff] [blame] | 22 | #include <utility> |
| Bruno Cardoso Lopes | 4215a59 | 2007-07-11 22:44:21 +0000 | [diff] [blame] | 23 | |
| 24 | namespace llvm { |
| 25 | |
| 26 | /// MipsFunctionInfo - This class is derived from MachineFunction private |
| 27 | /// Mips target-specific information for each MachineFunction. |
| 28 | class MipsFunctionInfo : public MachineFunctionInfo { |
| Bruno Cardoso Lopes | 4215a59 | 2007-07-11 22:44:21 +0000 | [diff] [blame] | 29 | public: |
| Che-Liang Chiou | acf1d48 | 2010-09-28 10:06:53 +0000 | [diff] [blame] | 30 | MipsFunctionInfo(MachineFunction& MF) |
| Reed Kotler | f99998a | 2012-10-28 06:02:37 +0000 | [diff] [blame] | 31 | : MF(MF), SRetReturnReg(0), GlobalBaseReg(0), Mips16SPAliasReg(0), |
| Akira Hatanaka | 544cc21 | 2013-01-30 00:26:49 +0000 | [diff] [blame] | 32 | VarArgsFrameIndex(0), CallsEhReturn(false) |
| Bruno Cardoso Lopes | 4215a59 | 2007-07-11 22:44:21 +0000 | [diff] [blame] | 33 | {} |
| 34 | |
| Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 35 | unsigned getSRetReturnReg() const { return SRetReturnReg; } |
| 36 | void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; } |
| Dan Gohman | 9911405 | 2009-06-03 20:30:14 +0000 | [diff] [blame] | 37 | |
| Akira Hatanaka | 648f00c | 2012-02-24 22:34:47 +0000 | [diff] [blame] | 38 | bool globalBaseRegSet() const; |
| 39 | unsigned getGlobalBaseReg(); |
| Dan Gohman | 1e93df6 | 2010-04-17 14:41:14 +0000 | [diff] [blame] | 40 | |
| Reed Kotler | f99998a | 2012-10-28 06:02:37 +0000 | [diff] [blame] | 41 | bool mips16SPAliasRegSet() const; |
| 42 | unsigned getMips16SPAliasReg(); |
| 43 | |
| Dan Gohman | 1e93df6 | 2010-04-17 14:41:14 +0000 | [diff] [blame] | 44 | int getVarArgsFrameIndex() const { return VarArgsFrameIndex; } |
| 45 | void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; } |
| Akira Hatanaka | da0a357 | 2011-05-20 01:17:58 +0000 | [diff] [blame] | 46 | |
| Akira Hatanaka | b33b34a | 2012-10-30 19:37:25 +0000 | [diff] [blame] | 47 | bool hasByvalArg() const { return HasByvalArg; } |
| Akira Hatanaka | 7085221 | 2012-11-07 19:04:26 +0000 | [diff] [blame] | 48 | void setFormalArgInfo(unsigned Size, bool HasByval) { |
| 49 | IncomingArgSize = Size; |
| Akira Hatanaka | b33b34a | 2012-10-30 19:37:25 +0000 | [diff] [blame] | 50 | HasByvalArg = HasByval; |
| 51 | } |
| Akira Hatanaka | 294166d | 2012-11-02 21:03:58 +0000 | [diff] [blame] | 52 | |
| 53 | unsigned getIncomingArgSize() const { return IncomingArgSize; } |
| Akira Hatanaka | 544cc21 | 2013-01-30 00:26:49 +0000 | [diff] [blame] | 54 | |
| 55 | bool callsEhReturn() const { return CallsEhReturn; } |
| 56 | void setCallsEhReturn() { CallsEhReturn = true; } |
| 57 | |
| 58 | void createEhDataRegsFI(); |
| 59 | int getEhDataRegFI(unsigned Reg) const { return EhDataRegFI[Reg]; } |
| 60 | bool isEhDataRegFI(int FI) const; |
| 61 | |
| Akira Hatanaka | d47aa3a | 2013-09-25 00:34:42 +0000 | [diff] [blame^] | 62 | private: |
| 63 | virtual void anchor(); |
| 64 | |
| 65 | MachineFunction& MF; |
| 66 | /// SRetReturnReg - Some subtargets require that sret lowering includes |
| 67 | /// returning the value of the returned struct in a register. This field |
| 68 | /// holds the virtual register into which the sret argument is passed. |
| 69 | unsigned SRetReturnReg; |
| 70 | |
| 71 | /// GlobalBaseReg - keeps track of the virtual register initialized for |
| 72 | /// use as the global base register. This is used for PIC in some PIC |
| 73 | /// relocation models. |
| 74 | unsigned GlobalBaseReg; |
| 75 | |
| 76 | /// Mips16SPAliasReg - keeps track of the virtual register initialized for |
| 77 | /// use as an alias for SP for use in load/store of halfword/byte from/to |
| 78 | /// the stack |
| 79 | unsigned Mips16SPAliasReg; |
| 80 | |
| 81 | /// VarArgsFrameIndex - FrameIndex for start of varargs area. |
| 82 | int VarArgsFrameIndex; |
| 83 | |
| 84 | /// True if function has a byval argument. |
| 85 | bool HasByvalArg; |
| 86 | |
| 87 | /// Size of incoming argument area. |
| 88 | unsigned IncomingArgSize; |
| 89 | |
| 90 | /// CallsEhReturn - Whether the function calls llvm.eh.return. |
| 91 | bool CallsEhReturn; |
| 92 | |
| 93 | /// Frame objects for spilling eh data registers. |
| 94 | int EhDataRegFI[4]; |
| Bruno Cardoso Lopes | 4215a59 | 2007-07-11 22:44:21 +0000 | [diff] [blame] | 95 | }; |
| 96 | |
| 97 | } // end of namespace llvm |
| 98 | |
| Bruno Cardoso Lopes | 2d4575e | 2007-08-28 05:04:41 +0000 | [diff] [blame] | 99 | #endif // MIPS_MACHINE_FUNCTION_INFO_H |