1 //===-- MipsMachineFunctionInfo.h - Private data used for Mips ----*- C++ -*-=//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
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/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"
31 /// MipsFunctionInfo - This class is derived from MachineFunction private
32 /// Mips target-specific information for each MachineFunction.
33 class MipsFunctionInfo : public MachineFunctionInfo {
35 MipsFunctionInfo(MachineFunction &MF)
36 : MF(MF), SRetReturnReg(0), GlobalBaseReg(0), Mips16SPAliasReg(0),
37 VarArgsFrameIndex(0), CallsEhReturn(false), IsISR(false), SaveS2(false),
38 MoveF64ViaSpillFI(-1) {}
42 unsigned getSRetReturnReg() const { return SRetReturnReg; }
43 void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
45 bool globalBaseRegSet() const;
46 unsigned getGlobalBaseReg();
48 bool mips16SPAliasRegSet() const;
49 unsigned getMips16SPAliasReg();
51 int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
52 void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; }
54 bool hasByvalArg() const { return HasByvalArg; }
55 void setFormalArgInfo(unsigned Size, bool HasByval) {
56 IncomingArgSize = Size;
57 HasByvalArg = HasByval;
60 unsigned getIncomingArgSize() const { return IncomingArgSize; }
62 bool callsEhReturn() const { return CallsEhReturn; }
63 void setCallsEhReturn() { CallsEhReturn = true; }
65 void createEhDataRegsFI();
66 int getEhDataRegFI(unsigned Reg) const { return EhDataRegFI[Reg]; }
67 bool isEhDataRegFI(int FI) const;
69 /// Create a MachinePointerInfo that has an ExternalSymbolPseudoSourceValue
70 /// object representing a GOT entry for an external function.
71 MachinePointerInfo callPtrInfo(const char *ES);
73 // Functions with the "interrupt" attribute require special prologues,
74 // epilogues and additional spill slots.
75 bool isISR() const { return IsISR; }
76 void setISR() { IsISR = true; }
77 void createISRRegFI();
78 int getISRRegFI(unsigned Reg) const { return ISRDataRegFI[Reg]; }
79 bool isISRRegFI(int FI) const;
81 /// Create a MachinePointerInfo that has a GlobalValuePseudoSourceValue object
82 /// representing a GOT entry for a global function.
83 MachinePointerInfo callPtrInfo(const GlobalValue *GV);
85 void setSaveS2() { SaveS2 = true; }
86 bool hasSaveS2() const { return SaveS2; }
88 int getMoveF64ViaSpillFI(const TargetRegisterClass *RC);
90 std::map<const char *, const llvm::Mips16HardFloatInfo::FuncSignature *>
94 virtual void anchor();
97 /// SRetReturnReg - Some subtargets require that sret lowering includes
98 /// returning the value of the returned struct in a register. This field
99 /// holds the virtual register into which the sret argument is passed.
100 unsigned SRetReturnReg;
102 /// GlobalBaseReg - keeps track of the virtual register initialized for
103 /// use as the global base register. This is used for PIC in some PIC
104 /// relocation models.
105 unsigned GlobalBaseReg;
107 /// Mips16SPAliasReg - keeps track of the virtual register initialized for
108 /// use as an alias for SP for use in load/store of halfword/byte from/to
110 unsigned Mips16SPAliasReg;
112 /// VarArgsFrameIndex - FrameIndex for start of varargs area.
113 int VarArgsFrameIndex;
115 /// True if function has a byval argument.
118 /// Size of incoming argument area.
119 unsigned IncomingArgSize;
121 /// CallsEhReturn - Whether the function calls llvm.eh.return.
124 /// Frame objects for spilling eh data registers.
127 /// ISR - Whether the function is an Interrupt Service Routine.
130 /// Frame objects for spilling C0_STATUS, C0_EPC
136 /// FrameIndex for expanding BuildPairF64 nodes to spill and reload when the
137 /// O32 FPXX ABI is enabled. -1 is used to denote invalid index.
138 int MoveF64ViaSpillFI;
141 } // end of namespace llvm