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 | |
Dan Gohman | 1e93df6 | 2010-04-17 14:41:14 +0000 | [diff] [blame] | 42 | /// VarArgsFrameIndex - FrameIndex for start of varargs area. |
| 43 | int VarArgsFrameIndex; |
| 44 | |
Akira Hatanaka | da0a357 | 2011-05-20 01:17:58 +0000 | [diff] [blame] | 45 | // Range of frame object indices. |
| 46 | // InArgFIRange: Range of indices of all frame objects created during call to |
| 47 | // LowerFormalArguments. |
Akira Hatanaka | c878f38 | 2012-09-26 19:18:19 +0000 | [diff] [blame] | 48 | std::pair<int, int> InArgFIRange; |
Bruno Cardoso Lopes | 4e694c9 | 2011-05-31 02:54:07 +0000 | [diff] [blame] | 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) |
Akira Hatanaka | 21afc63 | 2011-06-21 00:40:49 +0000 | [diff] [blame] | 54 | : MF(MF), SRetReturnReg(0), GlobalBaseReg(0), |
Akira Hatanaka | e06ce4c | 2012-10-19 21:18:38 +0000 | [diff] [blame] | 55 | VarArgsFrameIndex(0), InArgFIRange(std::make_pair(-1, 0)), EmitNOAT(false) |
Bruno Cardoso Lopes | 4215a59 | 2007-07-11 22:44:21 +0000 | [diff] [blame] | 56 | {} |
| 57 | |
Akira Hatanaka | da0a357 | 2011-05-20 01:17:58 +0000 | [diff] [blame] | 58 | bool isInArgFI(int FI) const { |
| 59 | return FI <= InArgFIRange.first && FI >= InArgFIRange.second; |
| 60 | } |
| 61 | void setLastInArgFI(int FI) { InArgFIRange.second = FI; } |
| 62 | |
Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 63 | unsigned getSRetReturnReg() const { return SRetReturnReg; } |
| 64 | void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; } |
Dan Gohman | 9911405 | 2009-06-03 20:30:14 +0000 | [diff] [blame] | 65 | |
Akira Hatanaka | 648f00c | 2012-02-24 22:34:47 +0000 | [diff] [blame] | 66 | bool globalBaseRegSet() const; |
| 67 | unsigned getGlobalBaseReg(); |
Dan Gohman | 1e93df6 | 2010-04-17 14:41:14 +0000 | [diff] [blame] | 68 | |
| 69 | int getVarArgsFrameIndex() const { return VarArgsFrameIndex; } |
| 70 | void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; } |
Akira Hatanaka | da0a357 | 2011-05-20 01:17:58 +0000 | [diff] [blame] | 71 | |
Akira Hatanaka | 95f95a7 | 2012-03-27 19:08:42 +0000 | [diff] [blame] | 72 | bool getEmitNOAT() const { return EmitNOAT; } |
| 73 | void setEmitNOAT() { EmitNOAT = true; } |
Bruno Cardoso Lopes | 4215a59 | 2007-07-11 22:44:21 +0000 | [diff] [blame] | 74 | }; |
| 75 | |
| 76 | } // end of namespace llvm |
| 77 | |
Bruno Cardoso Lopes | 2d4575e | 2007-08-28 05:04:41 +0000 | [diff] [blame] | 78 | #endif // MIPS_MACHINE_FUNCTION_INFO_H |