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