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 | 4215a59 | 2007-07-11 22:44:21 +0000 | [diff] [blame] | 18 | #include "llvm/CodeGen/MachineFunction.h" |
Bruno Cardoso Lopes | 2d4575e | 2007-08-28 05:04:41 +0000 | [diff] [blame] | 19 | #include "llvm/CodeGen/MachineFrameInfo.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 { |
David Blaikie | 2d24e2a | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 29 | virtual void anchor(); |
Bruno Cardoso Lopes | 4215a59 | 2007-07-11 22:44:21 +0000 | [diff] [blame] | 30 | |
Akira Hatanaka | 21afc63 | 2011-06-21 00:40:49 +0000 | [diff] [blame] | 31 | MachineFunction& MF; |
Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 32 | /// SRetReturnReg - Some subtargets require that sret lowering includes |
| 33 | /// returning the value of the returned struct in a register. This field |
| 34 | /// holds the virtual register into which the sret argument is passed. |
| 35 | unsigned SRetReturnReg; |
| 36 | |
Dan Gohman | 9911405 | 2009-06-03 20:30:14 +0000 | [diff] [blame] | 37 | /// GlobalBaseReg - keeps track of the virtual register initialized for |
| 38 | /// use as the global base register. This is used for PIC in some PIC |
| 39 | /// relocation models. |
| 40 | unsigned GlobalBaseReg; |
| 41 | |
Reed Kotler | f99998a | 2012-10-28 06:02:37 +0000 | [diff] [blame^] | 42 | /// Mips16SPAliasReg - keeps track of the virtual register initialized for |
| 43 | /// use as an alias for SP for use in load/store of halfword/byte from/to |
| 44 | /// the stack |
| 45 | unsigned Mips16SPAliasReg; |
| 46 | |
Dan Gohman | 1e93df6 | 2010-04-17 14:41:14 +0000 | [diff] [blame] | 47 | /// VarArgsFrameIndex - FrameIndex for start of varargs area. |
| 48 | int VarArgsFrameIndex; |
| 49 | |
Akira Hatanaka | 95f95a7 | 2012-03-27 19:08:42 +0000 | [diff] [blame] | 50 | bool EmitNOAT; |
| 51 | |
Bruno Cardoso Lopes | 4215a59 | 2007-07-11 22:44:21 +0000 | [diff] [blame] | 52 | public: |
Che-Liang Chiou | acf1d48 | 2010-09-28 10:06:53 +0000 | [diff] [blame] | 53 | MipsFunctionInfo(MachineFunction& MF) |
Reed Kotler | f99998a | 2012-10-28 06:02:37 +0000 | [diff] [blame^] | 54 | : MF(MF), SRetReturnReg(0), GlobalBaseReg(0), Mips16SPAliasReg(0), |
| 55 | VarArgsFrameIndex(0), EmitNOAT(false) |
Bruno Cardoso Lopes | 4215a59 | 2007-07-11 22:44:21 +0000 | [diff] [blame] | 56 | {} |
| 57 | |
Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 58 | unsigned getSRetReturnReg() const { return SRetReturnReg; } |
| 59 | void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; } |
Dan Gohman | 9911405 | 2009-06-03 20:30:14 +0000 | [diff] [blame] | 60 | |
Akira Hatanaka | 648f00c | 2012-02-24 22:34:47 +0000 | [diff] [blame] | 61 | bool globalBaseRegSet() const; |
| 62 | unsigned getGlobalBaseReg(); |
Dan Gohman | 1e93df6 | 2010-04-17 14:41:14 +0000 | [diff] [blame] | 63 | |
Reed Kotler | f99998a | 2012-10-28 06:02:37 +0000 | [diff] [blame^] | 64 | bool mips16SPAliasRegSet() const; |
| 65 | unsigned getMips16SPAliasReg(); |
| 66 | |
Dan Gohman | 1e93df6 | 2010-04-17 14:41:14 +0000 | [diff] [blame] | 67 | int getVarArgsFrameIndex() const { return VarArgsFrameIndex; } |
| 68 | void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; } |
Akira Hatanaka | da0a357 | 2011-05-20 01:17:58 +0000 | [diff] [blame] | 69 | |
Akira Hatanaka | 95f95a7 | 2012-03-27 19:08:42 +0000 | [diff] [blame] | 70 | bool getEmitNOAT() const { return EmitNOAT; } |
| 71 | void setEmitNOAT() { EmitNOAT = true; } |
Bruno Cardoso Lopes | 4215a59 | 2007-07-11 22:44:21 +0000 | [diff] [blame] | 72 | }; |
| 73 | |
| 74 | } // end of namespace llvm |
| 75 | |
Bruno Cardoso Lopes | 2d4575e | 2007-08-28 05:04:41 +0000 | [diff] [blame] | 76 | #endif // MIPS_MACHINE_FUNCTION_INFO_H |