LLVM  14.0.0git
MipsMachineFunction.h
Go to the documentation of this file.
1 //===- MipsMachineFunctionInfo.h - Private data used for Mips ---*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file declares the Mips specific subclass of MachineFunctionInfo.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_MIPS_MIPSMACHINEFUNCTION_H
14 #define LLVM_LIB_TARGET_MIPS_MIPSMACHINEFUNCTION_H
15 
16 #include "Mips16HardFloatInfo.h"
19 #include <map>
20 
21 namespace llvm {
22 
23 /// MipsFunctionInfo - This class is derived from MachineFunction private
24 /// Mips target-specific information for each MachineFunction.
26 public:
28 
29  ~MipsFunctionInfo() override;
30 
31  unsigned getSRetReturnReg() const { return SRetReturnReg; }
32  void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
33 
34  bool globalBaseRegSet() const;
37 
38  // Insert instructions to initialize the global base register in the
39  // first MBB of the function.
41 
42  int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
43  void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; }
44 
45  bool hasByvalArg() const { return HasByvalArg; }
46  void setFormalArgInfo(unsigned Size, bool HasByval) {
47  IncomingArgSize = Size;
48  HasByvalArg = HasByval;
49  }
50 
51  unsigned getIncomingArgSize() const { return IncomingArgSize; }
52 
53  bool callsEhReturn() const { return CallsEhReturn; }
54  void setCallsEhReturn() { CallsEhReturn = true; }
55 
57  int getEhDataRegFI(unsigned Reg) const { return EhDataRegFI[Reg]; }
58  bool isEhDataRegFI(int FI) const;
59 
60  /// Create a MachinePointerInfo that has an ExternalSymbolPseudoSourceValue
61  /// object representing a GOT entry for an external function.
62  MachinePointerInfo callPtrInfo(MachineFunction &MF, const char *ES);
63 
64  // Functions with the "interrupt" attribute require special prologues,
65  // epilogues and additional spill slots.
66  bool isISR() const { return IsISR; }
67  void setISR() { IsISR = true; }
69  int getISRRegFI(Register Reg) const { return ISRDataRegFI[Reg]; }
70  bool isISRRegFI(int FI) const;
71 
72  /// Create a MachinePointerInfo that has a GlobalValuePseudoSourceValue object
73  /// representing a GOT entry for a global function.
75 
76  void setSaveS2() { SaveS2 = true; }
77  bool hasSaveS2() const { return SaveS2; }
78 
80 
81  std::map<const char *, const Mips16HardFloatInfo::FuncSignature *>
83 
84 private:
85  virtual void anchor();
86 
87  /// SRetReturnReg - Some subtargets require that sret lowering includes
88  /// returning the value of the returned struct in a register. This field
89  /// holds the virtual register into which the sret argument is passed.
90  Register SRetReturnReg;
91 
92  /// GlobalBaseReg - keeps track of the virtual register initialized for
93  /// use as the global base register. This is used for PIC in some PIC
94  /// relocation models.
95  Register GlobalBaseReg;
96 
97  /// VarArgsFrameIndex - FrameIndex for start of varargs area.
98  int VarArgsFrameIndex = 0;
99 
100  /// True if function has a byval argument.
101  bool HasByvalArg;
102 
103  /// Size of incoming argument area.
104  unsigned IncomingArgSize;
105 
106  /// CallsEhReturn - Whether the function calls llvm.eh.return.
107  bool CallsEhReturn = false;
108 
109  /// Frame objects for spilling eh data registers.
110  int EhDataRegFI[4];
111 
112  /// ISR - Whether the function is an Interrupt Service Routine.
113  bool IsISR = false;
114 
115  /// Frame objects for spilling C0_STATUS, C0_EPC
116  int ISRDataRegFI[2];
117 
118  // saveS2
119  bool SaveS2 = false;
120 
121  /// FrameIndex for expanding BuildPairF64 nodes to spill and reload when the
122  /// O32 FPXX ABI is enabled. -1 is used to denote invalid index.
123  int MoveF64ViaSpillFI = -1;
124 };
125 
126 } // end namespace llvm
127 
128 #endif // LLVM_LIB_TARGET_MIPS_MIPSMACHINEFUNCTION_H
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
llvm::MipsFunctionInfo::StubsNeeded
std::map< const char *, const Mips16HardFloatInfo::FuncSignature * > StubsNeeded
Definition: MipsMachineFunction.h:82
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
Reg
unsigned Reg
Definition: MachineSink.cpp:1566
llvm::MipsFunctionInfo::MipsFunctionInfo
MipsFunctionInfo(MachineFunction &MF)
Definition: MipsMachineFunction.h:27
llvm::MipsFunctionInfo::createISRRegFI
void createISRRegFI(MachineFunction &MF)
Definition: MipsMachineFunction.cpp:162
llvm::MipsFunctionInfo::setCallsEhReturn
void setCallsEhReturn()
Definition: MipsMachineFunction.h:54
llvm::MipsFunctionInfo::getISRRegFI
int getISRRegFI(Register Reg) const
Definition: MipsMachineFunction.h:69
llvm::MipsFunctionInfo::hasSaveS2
bool hasSaveS2() const
Definition: MipsMachineFunction.h:77
llvm::MipsFunctionInfo::setSRetReturnReg
void setSRetReturnReg(unsigned Reg)
Definition: MipsMachineFunction.h:32
llvm::MipsFunctionInfo
MipsFunctionInfo - This class is derived from MachineFunction private Mips target-specific informatio...
Definition: MipsMachineFunction.h:25
llvm::MipsFunctionInfo::getIncomingArgSize
unsigned getIncomingArgSize() const
Definition: MipsMachineFunction.h:51
llvm::MipsFunctionInfo::~MipsFunctionInfo
~MipsFunctionInfo() override
llvm::MipsFunctionInfo::setISR
void setISR()
Definition: MipsMachineFunction.h:67
llvm::TargetRegisterClass
Definition: TargetRegisterInfo.h:46
llvm::MipsFunctionInfo::initGlobalBaseReg
void initGlobalBaseReg(MachineFunction &MF)
Definition: MipsMachineFunction.cpp:62
llvm::MipsFunctionInfo::setVarArgsFrameIndex
void setVarArgsFrameIndex(int Index)
Definition: MipsMachineFunction.h:43
llvm::MipsFunctionInfo::isEhDataRegFI
bool isEhDataRegFI(int FI) const
Definition: MipsMachineFunction.cpp:175
llvm::GlobalValue
Definition: GlobalValue.h:44
llvm::MipsFunctionInfo::createEhDataRegsFI
void createEhDataRegsFI(MachineFunction &MF)
Definition: MipsMachineFunction.cpp:149
Index
uint32_t Index
Definition: ELFObjHandler.cpp:84
llvm::MipsFunctionInfo::setFormalArgInfo
void setFormalArgInfo(unsigned Size, bool HasByval)
Definition: MipsMachineFunction.h:46
llvm::MachinePointerInfo
This class contains a discriminated union of information about pointers in memory operands,...
Definition: MachineMemOperand.h:38
llvm::MipsFunctionInfo::getVarArgsFrameIndex
int getVarArgsFrameIndex() const
Definition: MipsMachineFunction.h:42
llvm::MipsFunctionInfo::callsEhReturn
bool callsEhReturn() const
Definition: MipsMachineFunction.h:53
llvm::MachineFunction
Definition: MachineFunction.h:230
llvm::MipsFunctionInfo::isISR
bool isISR() const
Definition: MipsMachineFunction.h:66
llvm::MipsFunctionInfo::getGlobalBaseRegForGlobalISel
Register getGlobalBaseRegForGlobalISel(MachineFunction &MF)
Definition: MipsMachineFunction.cpp:54
llvm::MipsFunctionInfo::getGlobalBaseReg
Register getGlobalBaseReg(MachineFunction &MF)
Definition: MipsMachineFunction.cpp:47
llvm::MipsFunctionInfo::getEhDataRegFI
int getEhDataRegFI(unsigned Reg) const
Definition: MipsMachineFunction.h:57
llvm::MipsFunctionInfo::isISRRegFI
bool isISRRegFI(int FI) const
Definition: MipsMachineFunction.cpp:180
llvm::MipsFunctionInfo::hasByvalArg
bool hasByvalArg() const
Definition: MipsMachineFunction.h:45
llvm::Register
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
Mips16HardFloatInfo.h
llvm::MipsFunctionInfo::getSRetReturnReg
unsigned getSRetReturnReg() const
Definition: MipsMachineFunction.h:31
MachineMemOperand.h
llvm::MipsFunctionInfo::getMoveF64ViaSpillFI
int getMoveF64ViaSpillFI(MachineFunction &MF, const TargetRegisterClass *RC)
Definition: MipsMachineFunction.cpp:193
llvm::MipsFunctionInfo::setSaveS2
void setSaveS2()
Definition: MipsMachineFunction.h:76
llvm::MipsFunctionInfo::globalBaseRegSet
bool globalBaseRegSet() const
Definition: MipsMachineFunction.cpp:27
MachineFunction.h
llvm::MachineFunctionInfo
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
Definition: MachineFunction.h:95
llvm::MipsFunctionInfo::callPtrInfo
MachinePointerInfo callPtrInfo(MachineFunction &MF, const char *ES)
Create a MachinePointerInfo that has an ExternalSymbolPseudoSourceValue object representing a GOT ent...
Definition: MipsMachineFunction.cpp:183