]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/Mips/MipsMachineFunction.h
Merge ^/head r320573 through r320970.
[FreeBSD/FreeBSD.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 LLVM_LIB_TARGET_MIPS_MIPSMACHINEFUNCTION_H
15 #define LLVM_LIB_TARGET_MIPS_MIPSMACHINEFUNCTION_H
16
17 #include "Mips16HardFloatInfo.h"
18 #include "llvm/CodeGen/MachineFunction.h"
19 #include "llvm/CodeGen/MachineMemOperand.h"
20 #include <map>
21
22 namespace llvm {
23
24 /// MipsFunctionInfo - This class is derived from MachineFunction private
25 /// Mips target-specific information for each MachineFunction.
26 class MipsFunctionInfo : public MachineFunctionInfo {
27 public:
28   MipsFunctionInfo(MachineFunction &MF) : MF(MF) {}
29
30   ~MipsFunctionInfo() override;
31
32   unsigned getSRetReturnReg() const { return SRetReturnReg; }
33   void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
34
35   bool globalBaseRegSet() const;
36   unsigned getGlobalBaseReg();
37
38   int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
39   void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; }
40
41   bool hasByvalArg() const { return HasByvalArg; }
42   void setFormalArgInfo(unsigned Size, bool HasByval) {
43     IncomingArgSize = Size;
44     HasByvalArg = HasByval;
45   }
46
47   unsigned getIncomingArgSize() const { return IncomingArgSize; }
48
49   bool callsEhReturn() const { return CallsEhReturn; }
50   void setCallsEhReturn() { CallsEhReturn = true; }
51
52   void createEhDataRegsFI();
53   int getEhDataRegFI(unsigned Reg) const { return EhDataRegFI[Reg]; }
54   bool isEhDataRegFI(int FI) const;
55
56   /// Create a MachinePointerInfo that has an ExternalSymbolPseudoSourceValue
57   /// object representing a GOT entry for an external function.
58   MachinePointerInfo callPtrInfo(const char *ES);
59
60   // Functions with the "interrupt" attribute require special prologues,
61   // epilogues and additional spill slots.
62   bool isISR() const { return IsISR; }
63   void setISR() { IsISR = true; }
64   void createISRRegFI();
65   int getISRRegFI(unsigned Reg) const { return ISRDataRegFI[Reg]; }
66   bool isISRRegFI(int FI) const;
67
68   /// Create a MachinePointerInfo that has a GlobalValuePseudoSourceValue object
69   /// representing a GOT entry for a global function.
70   MachinePointerInfo callPtrInfo(const GlobalValue *GV);
71
72   void setSaveS2() { SaveS2 = true; }
73   bool hasSaveS2() const { return SaveS2; }
74
75   int getMoveF64ViaSpillFI(const TargetRegisterClass *RC);
76
77   std::map<const char *, const Mips16HardFloatInfo::FuncSignature *>
78   StubsNeeded;
79
80 private:
81   virtual void anchor();
82
83   MachineFunction& MF;
84
85   /// SRetReturnReg - Some subtargets require that sret lowering includes
86   /// returning the value of the returned struct in a register. This field
87   /// holds the virtual register into which the sret argument is passed.
88   unsigned SRetReturnReg = 0;
89
90   /// GlobalBaseReg - keeps track of the virtual register initialized for
91   /// use as the global base register. This is used for PIC in some PIC
92   /// relocation models.
93   unsigned GlobalBaseReg = 0;
94
95   /// VarArgsFrameIndex - FrameIndex for start of varargs area.
96   int VarArgsFrameIndex = 0;
97
98   /// True if function has a byval argument.
99   bool HasByvalArg;
100
101   /// Size of incoming argument area.
102   unsigned IncomingArgSize;
103
104   /// CallsEhReturn - Whether the function calls llvm.eh.return.
105   bool CallsEhReturn = false;
106
107   /// Frame objects for spilling eh data registers.
108   int EhDataRegFI[4];
109
110   /// ISR - Whether the function is an Interrupt Service Routine.
111   bool IsISR = false;
112
113   /// Frame objects for spilling C0_STATUS, C0_EPC
114   int ISRDataRegFI[2];
115
116   // saveS2
117   bool SaveS2 = false;
118
119   /// FrameIndex for expanding BuildPairF64 nodes to spill and reload when the
120   /// O32 FPXX ABI is enabled. -1 is used to denote invalid index.
121   int MoveF64ViaSpillFI = -1;
122 };
123
124 } // end namespace llvm
125
126 #endif // LLVM_LIB_TARGET_MIPS_MIPSMACHINEFUNCTION_H