]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/llvm/lib/Target/Mips/MipsMachineFunction.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / llvm / lib / Target / Mips / MipsMachineFunction.h
1 //===-- MipsMachineFunctionInfo.h - Private data used for Mips ----*- C++ -*-=//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares the Mips specific subclass of MachineFunctionInfo.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef MIPS_MACHINE_FUNCTION_INFO_H
15 #define MIPS_MACHINE_FUNCTION_INFO_H
16
17 #include "MipsSubtarget.h"
18 #include "llvm/CodeGen/MachineFrameInfo.h"
19 #include "llvm/CodeGen/MachineFunction.h"
20 #include "llvm/Target/TargetFrameLowering.h"
21 #include "llvm/Target/TargetMachine.h"
22 #include <utility>
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 {
29   virtual void anchor();
30
31   MachineFunction& MF;
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
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
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
47   /// VarArgsFrameIndex - FrameIndex for start of varargs area.
48   int VarArgsFrameIndex;
49
50   /// True if function has a byval argument.
51   bool HasByvalArg;
52
53   /// Size of incoming argument area.
54   unsigned IncomingArgSize;
55
56   /// CallsEhReturn - Whether the function calls llvm.eh.return.
57   bool CallsEhReturn;
58
59   /// Frame objects for spilling eh data registers.
60   int EhDataRegFI[4];
61
62 public:
63   MipsFunctionInfo(MachineFunction& MF)
64    : MF(MF), SRetReturnReg(0), GlobalBaseReg(0), Mips16SPAliasReg(0),
65      VarArgsFrameIndex(0), CallsEhReturn(false)
66   {}
67
68   unsigned getSRetReturnReg() const { return SRetReturnReg; }
69   void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
70
71   bool globalBaseRegSet() const;
72   unsigned getGlobalBaseReg();
73
74   bool mips16SPAliasRegSet() const;
75   unsigned getMips16SPAliasReg();
76
77   int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
78   void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; }
79
80   bool hasByvalArg() const { return HasByvalArg; }
81   void setFormalArgInfo(unsigned Size, bool HasByval) {
82     IncomingArgSize = Size;
83     HasByvalArg = HasByval;
84   }
85
86   unsigned getIncomingArgSize() const { return IncomingArgSize; }
87
88   bool callsEhReturn() const { return CallsEhReturn; }
89   void setCallsEhReturn() { CallsEhReturn = true; }
90
91   void createEhDataRegsFI();
92   int getEhDataRegFI(unsigned Reg) const { return EhDataRegFI[Reg]; }
93   bool isEhDataRegFI(int FI) const;
94
95 };
96
97 } // end of namespace llvm
98
99 #endif // MIPS_MACHINE_FUNCTION_INFO_H