LLVM 20.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
21namespace llvm {
22
23/// MipsFunctionInfo - This class is derived from MachineFunction private
24/// Mips target-specific information for each MachineFunction.
26public:
28
32 const override;
33
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.
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
89private:
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
uint64_t Size
#define F(x, y, z)
Definition: MD5.cpp:55
unsigned Reg
Basic Register Allocator
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:66
MipsFunctionInfo - This class is derived from MachineFunction private Mips target-specific informatio...
void setVarArgsFrameIndex(int Index)
Register getGlobalBaseRegForGlobalISel(MachineFunction &MF)
unsigned getSRetReturnReg() const
bool isISRRegFI(int FI) const
MachinePointerInfo callPtrInfo(MachineFunction &MF, const char *ES)
Create a MachinePointerInfo that has an ExternalSymbolPseudoSourceValue object representing a GOT ent...
int getMoveF64ViaSpillFI(MachineFunction &MF, const TargetRegisterClass *RC)
Register getGlobalBaseReg(MachineFunction &MF)
MachineFunctionInfo * clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB) const override
Make a functionally equivalent copy of this MachineFunctionInfo in MF.
int getEhDataRegFI(unsigned Reg) const
void setSRetReturnReg(unsigned Reg)
int getISRRegFI(Register Reg) const
MipsFunctionInfo(const Function &F, const TargetSubtargetInfo *STI)
bool isEhDataRegFI(int FI) const
std::map< const char *, const Mips16HardFloatInfo::FuncSignature * > StubsNeeded
void createEhDataRegsFI(MachineFunction &MF)
unsigned getIncomingArgSize() const
void setFormalArgInfo(unsigned Size, bool HasByval)
void initGlobalBaseReg(MachineFunction &MF)
~MipsFunctionInfo() override
void createISRRegFI(MachineFunction &MF)
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
TargetSubtargetInfo - Generic base class for all target subtargets.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
This class contains a discriminated union of information about pointers in memory operands,...