1*7a7e6055SDimitry Andric //===- MipsMachineFunctionInfo.h - Private data used for Mips ---*- C++ -*-===// 2f22ef01cSRoman Divacky // 3f22ef01cSRoman Divacky // The LLVM Compiler Infrastructure 4f22ef01cSRoman Divacky // 5f22ef01cSRoman Divacky // This file is distributed under the University of Illinois Open Source 6f22ef01cSRoman Divacky // License. See LICENSE.TXT for details. 7f22ef01cSRoman Divacky // 8f22ef01cSRoman Divacky //===----------------------------------------------------------------------===// 9f22ef01cSRoman Divacky // 10f22ef01cSRoman Divacky // This file declares the Mips specific subclass of MachineFunctionInfo. 11f22ef01cSRoman Divacky // 12f22ef01cSRoman Divacky //===----------------------------------------------------------------------===// 13f22ef01cSRoman Divacky 1439d628a0SDimitry Andric #ifndef LLVM_LIB_TARGET_MIPS_MIPSMACHINEFUNCTION_H 1539d628a0SDimitry Andric #define LLVM_LIB_TARGET_MIPS_MIPSMACHINEFUNCTION_H 16f22ef01cSRoman Divacky 1791bc56edSDimitry Andric #include "Mips16HardFloatInfo.h" 18139f7f9bSDimitry Andric #include "llvm/CodeGen/MachineFunction.h" 19f785676fSDimitry Andric #include "llvm/CodeGen/MachineMemOperand.h" 2091bc56edSDimitry Andric #include <map> 21f22ef01cSRoman Divacky 22f22ef01cSRoman Divacky namespace llvm { 23f22ef01cSRoman Divacky 24f22ef01cSRoman Divacky /// MipsFunctionInfo - This class is derived from MachineFunction private 25f22ef01cSRoman Divacky /// Mips target-specific information for each MachineFunction. 26f22ef01cSRoman Divacky class MipsFunctionInfo : public MachineFunctionInfo { 27f785676fSDimitry Andric public: MipsFunctionInfo(MachineFunction & MF)28*7a7e6055SDimitry Andric MipsFunctionInfo(MachineFunction &MF) : MF(MF) {} 29f785676fSDimitry Andric 30*7a7e6055SDimitry Andric ~MipsFunctionInfo() override; 31f785676fSDimitry Andric getSRetReturnReg()32f785676fSDimitry Andric unsigned getSRetReturnReg() const { return SRetReturnReg; } setSRetReturnReg(unsigned Reg)33f785676fSDimitry Andric void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; } 34f785676fSDimitry Andric 35f785676fSDimitry Andric bool globalBaseRegSet() const; 36f785676fSDimitry Andric unsigned getGlobalBaseReg(); 37f785676fSDimitry Andric getVarArgsFrameIndex()38f785676fSDimitry Andric int getVarArgsFrameIndex() const { return VarArgsFrameIndex; } setVarArgsFrameIndex(int Index)39f785676fSDimitry Andric void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; } 40f785676fSDimitry Andric hasByvalArg()41f785676fSDimitry Andric bool hasByvalArg() const { return HasByvalArg; } setFormalArgInfo(unsigned Size,bool HasByval)42f785676fSDimitry Andric void setFormalArgInfo(unsigned Size, bool HasByval) { 43f785676fSDimitry Andric IncomingArgSize = Size; 44f785676fSDimitry Andric HasByvalArg = HasByval; 45f785676fSDimitry Andric } 46f785676fSDimitry Andric getIncomingArgSize()47f785676fSDimitry Andric unsigned getIncomingArgSize() const { return IncomingArgSize; } 48f785676fSDimitry Andric callsEhReturn()49f785676fSDimitry Andric bool callsEhReturn() const { return CallsEhReturn; } setCallsEhReturn()50f785676fSDimitry Andric void setCallsEhReturn() { CallsEhReturn = true; } 51f785676fSDimitry Andric 52f785676fSDimitry Andric void createEhDataRegsFI(); getEhDataRegFI(unsigned Reg)53f785676fSDimitry Andric int getEhDataRegFI(unsigned Reg) const { return EhDataRegFI[Reg]; } 54f785676fSDimitry Andric bool isEhDataRegFI(int FI) const; 55f785676fSDimitry Andric 567d523365SDimitry Andric /// Create a MachinePointerInfo that has an ExternalSymbolPseudoSourceValue 577d523365SDimitry Andric /// object representing a GOT entry for an external function. 587d523365SDimitry Andric MachinePointerInfo callPtrInfo(const char *ES); 59f785676fSDimitry Andric 607d523365SDimitry Andric // Functions with the "interrupt" attribute require special prologues, 617d523365SDimitry Andric // epilogues and additional spill slots. isISR()627d523365SDimitry Andric bool isISR() const { return IsISR; } setISR()637d523365SDimitry Andric void setISR() { IsISR = true; } 647d523365SDimitry Andric void createISRRegFI(); getISRRegFI(unsigned Reg)657d523365SDimitry Andric int getISRRegFI(unsigned Reg) const { return ISRDataRegFI[Reg]; } 667d523365SDimitry Andric bool isISRRegFI(int FI) const; 677d523365SDimitry Andric 687d523365SDimitry Andric /// Create a MachinePointerInfo that has a GlobalValuePseudoSourceValue object 69f785676fSDimitry Andric /// representing a GOT entry for a global function. 707d523365SDimitry Andric MachinePointerInfo callPtrInfo(const GlobalValue *GV); 71f785676fSDimitry Andric setSaveS2()7291bc56edSDimitry Andric void setSaveS2() { SaveS2 = true; } hasSaveS2()7391bc56edSDimitry Andric bool hasSaveS2() const { return SaveS2; } 7491bc56edSDimitry Andric 7591bc56edSDimitry Andric int getMoveF64ViaSpillFI(const TargetRegisterClass *RC); 7691bc56edSDimitry Andric 77*7a7e6055SDimitry Andric std::map<const char *, const Mips16HardFloatInfo::FuncSignature *> 7891bc56edSDimitry Andric StubsNeeded; 7991bc56edSDimitry Andric 80f785676fSDimitry Andric private: 81dff0c46cSDimitry Andric virtual void anchor(); 82f22ef01cSRoman Divacky 8317a519f9SDimitry Andric MachineFunction& MF; 84*7a7e6055SDimitry Andric 85f22ef01cSRoman Divacky /// SRetReturnReg - Some subtargets require that sret lowering includes 86f22ef01cSRoman Divacky /// returning the value of the returned struct in a register. This field 87f22ef01cSRoman Divacky /// holds the virtual register into which the sret argument is passed. 88*7a7e6055SDimitry Andric unsigned SRetReturnReg = 0; 89f22ef01cSRoman Divacky 90f22ef01cSRoman Divacky /// GlobalBaseReg - keeps track of the virtual register initialized for 91f22ef01cSRoman Divacky /// use as the global base register. This is used for PIC in some PIC 92f22ef01cSRoman Divacky /// relocation models. 93*7a7e6055SDimitry Andric unsigned GlobalBaseReg = 0; 94f22ef01cSRoman Divacky 95f22ef01cSRoman Divacky /// VarArgsFrameIndex - FrameIndex for start of varargs area. 96*7a7e6055SDimitry Andric int VarArgsFrameIndex = 0; 97f22ef01cSRoman Divacky 983861d79fSDimitry Andric /// True if function has a byval argument. 993861d79fSDimitry Andric bool HasByvalArg; 100bd5abe19SDimitry Andric 1013861d79fSDimitry Andric /// Size of incoming argument area. 1023861d79fSDimitry Andric unsigned IncomingArgSize; 103dff0c46cSDimitry Andric 104139f7f9bSDimitry Andric /// CallsEhReturn - Whether the function calls llvm.eh.return. 105*7a7e6055SDimitry Andric bool CallsEhReturn = false; 106139f7f9bSDimitry Andric 107139f7f9bSDimitry Andric /// Frame objects for spilling eh data registers. 108139f7f9bSDimitry Andric int EhDataRegFI[4]; 109139f7f9bSDimitry Andric 1107d523365SDimitry Andric /// ISR - Whether the function is an Interrupt Service Routine. 111*7a7e6055SDimitry Andric bool IsISR = false; 1127d523365SDimitry Andric 1137d523365SDimitry Andric /// Frame objects for spilling C0_STATUS, C0_EPC 1147d523365SDimitry Andric int ISRDataRegFI[2]; 1157d523365SDimitry Andric 11691bc56edSDimitry Andric // saveS2 117*7a7e6055SDimitry Andric bool SaveS2 = false; 11891bc56edSDimitry Andric 11991bc56edSDimitry Andric /// FrameIndex for expanding BuildPairF64 nodes to spill and reload when the 12091bc56edSDimitry Andric /// O32 FPXX ABI is enabled. -1 is used to denote invalid index. 121*7a7e6055SDimitry Andric int MoveF64ViaSpillFI = -1; 122f22ef01cSRoman Divacky }; 123f22ef01cSRoman Divacky 124*7a7e6055SDimitry Andric } // end namespace llvm 125f22ef01cSRoman Divacky 126*7a7e6055SDimitry Andric #endif // LLVM_LIB_TARGET_MIPS_MIPSMACHINEFUNCTION_H 127