[llvm-exegesis][NFC] Pass Instruction instead of bare Opcode
[llvm-core.git] / lib / Target / Mips / MipsMachineFunction.h
blob553a66703b268eab3462473ad1752e13a62f48cc
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.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_MIPS_MIPSMACHINEFUNCTION_H
15 #define LLVM_LIB_TARGET_MIPS_MIPSMACHINEFUNCTION_H
17 #include "Mips16HardFloatInfo.h"
18 #include "llvm/CodeGen/MachineFunction.h"
19 #include "llvm/CodeGen/MachineMemOperand.h"
20 #include <map>
22 namespace llvm {
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) {}
30 ~MipsFunctionInfo() override;
32 unsigned getSRetReturnReg() const { return SRetReturnReg; }
33 void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
35 bool globalBaseRegSet() const;
36 unsigned getGlobalBaseReg();
38 int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
39 void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; }
41 bool hasByvalArg() const { return HasByvalArg; }
42 void setFormalArgInfo(unsigned Size, bool HasByval) {
43 IncomingArgSize = Size;
44 HasByvalArg = HasByval;
47 unsigned getIncomingArgSize() const { return IncomingArgSize; }
49 bool callsEhReturn() const { return CallsEhReturn; }
50 void setCallsEhReturn() { CallsEhReturn = true; }
52 void createEhDataRegsFI();
53 int getEhDataRegFI(unsigned Reg) const { return EhDataRegFI[Reg]; }
54 bool isEhDataRegFI(int FI) const;
56 /// Create a MachinePointerInfo that has an ExternalSymbolPseudoSourceValue
57 /// object representing a GOT entry for an external function.
58 MachinePointerInfo callPtrInfo(const char *ES);
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;
68 /// Create a MachinePointerInfo that has a GlobalValuePseudoSourceValue object
69 /// representing a GOT entry for a global function.
70 MachinePointerInfo callPtrInfo(const GlobalValue *GV);
72 void setSaveS2() { SaveS2 = true; }
73 bool hasSaveS2() const { return SaveS2; }
75 int getMoveF64ViaSpillFI(const TargetRegisterClass *RC);
77 std::map<const char *, const Mips16HardFloatInfo::FuncSignature *>
78 StubsNeeded;
80 private:
81 virtual void anchor();
83 MachineFunction& MF;
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;
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;
95 /// VarArgsFrameIndex - FrameIndex for start of varargs area.
96 int VarArgsFrameIndex = 0;
98 /// True if function has a byval argument.
99 bool HasByvalArg;
101 /// Size of incoming argument area.
102 unsigned IncomingArgSize;
104 /// CallsEhReturn - Whether the function calls llvm.eh.return.
105 bool CallsEhReturn = false;
107 /// Frame objects for spilling eh data registers.
108 int EhDataRegFI[4];
110 /// ISR - Whether the function is an Interrupt Service Routine.
111 bool IsISR = false;
113 /// Frame objects for spilling C0_STATUS, C0_EPC
114 int ISRDataRegFI[2];
116 // saveS2
117 bool SaveS2 = false;
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;
124 } // end namespace llvm
126 #endif // LLVM_LIB_TARGET_MIPS_MIPSMACHINEFUNCTION_H