LLVM  16.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 
32  const override;
33 
34  ~MipsFunctionInfo() override;
35 
36  unsigned getSRetReturnReg() const { return SRetReturnReg; }
37  void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
38 
39  bool globalBaseRegSet() const;
42 
43  // Insert instructions to initialize the global base register in the
44  // first MBB of the function.
46 
47  int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
48  void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; }
49 
50  bool hasByvalArg() const { return HasByvalArg; }
51  void setFormalArgInfo(unsigned Size, bool HasByval) {
52  IncomingArgSize = Size;
53  HasByvalArg = HasByval;
54  }
55 
56  unsigned getIncomingArgSize() const { return IncomingArgSize; }
57 
58  bool callsEhReturn() const { return CallsEhReturn; }
59  void setCallsEhReturn() { CallsEhReturn = true; }
60 
62  int getEhDataRegFI(unsigned Reg) const { return EhDataRegFI[Reg]; }
63  bool isEhDataRegFI(int FI) const;
64 
65  /// Create a MachinePointerInfo that has an ExternalSymbolPseudoSourceValue
66  /// object representing a GOT entry for an external function.
67  MachinePointerInfo callPtrInfo(MachineFunction &MF, const char *ES);
68 
69  // Functions with the "interrupt" attribute require special prologues,
70  // epilogues and additional spill slots.
71  bool isISR() const { return IsISR; }
72  void setISR() { IsISR = true; }
74  int getISRRegFI(Register Reg) const { return ISRDataRegFI[Reg]; }
75  bool isISRRegFI(int FI) const;
76 
77  /// Create a MachinePointerInfo that has a GlobalValuePseudoSourceValue object
78  /// representing a GOT entry for a global function.
80 
81  void setSaveS2() { SaveS2 = true; }
82  bool hasSaveS2() const { return SaveS2; }
83 
85 
86  std::map<const char *, const Mips16HardFloatInfo::FuncSignature *>
88 
89 private:
90  virtual void anchor();
91 
92  /// SRetReturnReg - Some subtargets require that sret lowering includes
93  /// returning the value of the returned struct in a register. This field
94  /// holds the virtual register into which the sret argument is passed.
95  Register SRetReturnReg;
96 
97  /// GlobalBaseReg - keeps track of the virtual register initialized for
98  /// use as the global base register. This is used for PIC in some PIC
99  /// relocation models.
100  Register GlobalBaseReg;
101 
102  /// VarArgsFrameIndex - FrameIndex for start of varargs area.
103  int VarArgsFrameIndex = 0;
104 
105  /// True if function has a byval argument.
106  bool HasByvalArg;
107 
108  /// Size of incoming argument area.
109  unsigned IncomingArgSize;
110 
111  /// CallsEhReturn - Whether the function calls llvm.eh.return.
112  bool CallsEhReturn = false;
113 
114  /// Frame objects for spilling eh data registers.
115  int EhDataRegFI[4];
116 
117  /// ISR - Whether the function is an Interrupt Service Routine.
118  bool IsISR = false;
119 
120  /// Frame objects for spilling C0_STATUS, C0_EPC
121  int ISRDataRegFI[2];
122 
123  // saveS2
124  bool SaveS2 = false;
125 
126  /// FrameIndex for expanding BuildPairF64 nodes to spill and reload when the
127  /// O32 FPXX ABI is enabled. -1 is used to denote invalid index.
128  int MoveF64ViaSpillFI = -1;
129 };
130 
131 } // end namespace llvm
132 
133 #endif // LLVM_LIB_TARGET_MIPS_MIPSMACHINEFUNCTION_H
llvm::MipsFunctionInfo::StubsNeeded
std::map< const char *, const Mips16HardFloatInfo::FuncSignature * > StubsNeeded
Definition: MipsMachineFunction.h:87
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::MipsFunctionInfo::MipsFunctionInfo
MipsFunctionInfo(MachineFunction &MF)
Definition: MipsMachineFunction.h:27
llvm::MipsFunctionInfo::createISRRegFI
void createISRRegFI(MachineFunction &MF)
Definition: MipsMachineFunction.cpp:169
llvm::X86Disassembler::Reg
Reg
All possible values of the reg field in the ModR/M byte.
Definition: X86DisassemblerDecoder.h:462
llvm::MipsFunctionInfo::setCallsEhReturn
void setCallsEhReturn()
Definition: MipsMachineFunction.h:59
llvm::MipsFunctionInfo::getISRRegFI
int getISRRegFI(Register Reg) const
Definition: MipsMachineFunction.h:74
llvm::MipsFunctionInfo::hasSaveS2
bool hasSaveS2() const
Definition: MipsMachineFunction.h:82
llvm::MipsFunctionInfo::setSRetReturnReg
void setSRetReturnReg(unsigned Reg)
Definition: MipsMachineFunction.h:37
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:56
llvm::MipsFunctionInfo::~MipsFunctionInfo
~MipsFunctionInfo() override
llvm::MipsFunctionInfo::setISR
void setISR()
Definition: MipsMachineFunction.h:72
llvm::TargetRegisterClass
Definition: TargetRegisterInfo.h:46
llvm::MipsFunctionInfo::initGlobalBaseReg
void initGlobalBaseReg(MachineFunction &MF)
Definition: MipsMachineFunction.cpp:69
llvm::dwarf::Index
Index
Definition: Dwarf.h:472
llvm::MipsFunctionInfo::setVarArgsFrameIndex
void setVarArgsFrameIndex(int Index)
Definition: MipsMachineFunction.h:48
llvm::MipsFunctionInfo::isEhDataRegFI
bool isEhDataRegFI(int FI) const
Definition: MipsMachineFunction.cpp:182
llvm::GlobalValue
Definition: GlobalValue.h:44
llvm::MipsFunctionInfo::createEhDataRegsFI
void createEhDataRegsFI(MachineFunction &MF)
Definition: MipsMachineFunction.cpp:156
Index
uint32_t Index
Definition: ELFObjHandler.cpp:82
llvm::MipsFunctionInfo::setFormalArgInfo
void setFormalArgInfo(unsigned Size, bool HasByval)
Definition: MipsMachineFunction.h:51
llvm::BumpPtrAllocatorImpl
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:63
llvm::MachinePointerInfo
This class contains a discriminated union of information about pointers in memory operands,...
Definition: MachineMemOperand.h:39
llvm::DenseMap
Definition: DenseMap.h:714
llvm::MipsFunctionInfo::getVarArgsFrameIndex
int getVarArgsFrameIndex() const
Definition: MipsMachineFunction.h:47
llvm::MipsFunctionInfo::clone
MachineFunctionInfo * clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB) const override
Make a functionally equivalent copy of this MachineFunctionInfo in MF.
Definition: MipsMachineFunction.cpp:26
llvm::MipsFunctionInfo::callsEhReturn
bool callsEhReturn() const
Definition: MipsMachineFunction.h:58
llvm::MachineFunction
Definition: MachineFunction.h:257
llvm::MipsFunctionInfo::isISR
bool isISR() const
Definition: MipsMachineFunction.h:71
llvm::MipsFunctionInfo::getGlobalBaseRegForGlobalISel
Register getGlobalBaseRegForGlobalISel(MachineFunction &MF)
Definition: MipsMachineFunction.cpp:61
llvm::MipsFunctionInfo::getGlobalBaseReg
Register getGlobalBaseReg(MachineFunction &MF)
Definition: MipsMachineFunction.cpp:54
llvm::MipsFunctionInfo::getEhDataRegFI
int getEhDataRegFI(unsigned Reg) const
Definition: MipsMachineFunction.h:62
llvm::MipsFunctionInfo::isISRRegFI
bool isISRRegFI(int FI) const
Definition: MipsMachineFunction.cpp:187
llvm::MipsFunctionInfo::hasByvalArg
bool hasByvalArg() const
Definition: MipsMachineFunction.h:50
llvm::Register
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
Mips16HardFloatInfo.h
Allocator
Basic Register Allocator
Definition: RegAllocBasic.cpp:143
llvm::MipsFunctionInfo::getSRetReturnReg
unsigned getSRetReturnReg() const
Definition: MipsMachineFunction.h:36
MachineMemOperand.h
llvm::MipsFunctionInfo::getMoveF64ViaSpillFI
int getMoveF64ViaSpillFI(MachineFunction &MF, const TargetRegisterClass *RC)
Definition: MipsMachineFunction.cpp:200
llvm::MipsFunctionInfo::setSaveS2
void setSaveS2()
Definition: MipsMachineFunction.h:81
llvm::MipsFunctionInfo::globalBaseRegSet
bool globalBaseRegSet() const
Definition: MipsMachineFunction.cpp:34
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:190