[RISCV] Match vcompress during shuffle lowering (#117748)
[llvm-project.git] / llvm / lib / Target / Mips / MipsMachineFunction.h
blobb7b748838569f84d779416ca08f03c3e510dba94
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.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_MIPS_MIPSMACHINEFUNCTION_H
14 #define LLVM_LIB_TARGET_MIPS_MIPSMACHINEFUNCTION_H
16 #include "Mips16HardFloatInfo.h"
17 #include "llvm/CodeGen/MachineFunction.h"
18 #include "llvm/CodeGen/MachineMemOperand.h"
19 #include <map>
21 namespace llvm {
23 /// MipsFunctionInfo - This class is derived from MachineFunction private
24 /// Mips target-specific information for each MachineFunction.
25 class MipsFunctionInfo : public MachineFunctionInfo {
26 public:
27 MipsFunctionInfo(const Function &F, const TargetSubtargetInfo *STI) {}
29 MachineFunctionInfo *
30 clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF,
31 const DenseMap<MachineBasicBlock *, MachineBasicBlock *> &Src2DstMBB)
32 const override;
34 ~MipsFunctionInfo() override;
36 unsigned getSRetReturnReg() const { return SRetReturnReg; }
37 void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
39 bool globalBaseRegSet() const;
40 Register getGlobalBaseReg(MachineFunction &MF);
41 Register getGlobalBaseRegForGlobalISel(MachineFunction &MF);
43 // Insert instructions to initialize the global base register in the
44 // first MBB of the function.
45 void initGlobalBaseReg(MachineFunction &MF);
47 int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
48 void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; }
50 bool hasByvalArg() const { return HasByvalArg; }
51 void setFormalArgInfo(unsigned Size, bool HasByval) {
52 IncomingArgSize = Size;
53 HasByvalArg = HasByval;
56 unsigned getIncomingArgSize() const { return IncomingArgSize; }
58 bool callsEhReturn() const { return CallsEhReturn; }
59 void setCallsEhReturn() { CallsEhReturn = true; }
61 void createEhDataRegsFI(MachineFunction &MF);
62 int getEhDataRegFI(unsigned Reg) const { return EhDataRegFI[Reg]; }
63 bool isEhDataRegFI(int FI) const;
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);
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; }
73 void createISRRegFI(MachineFunction &MF);
74 int getISRRegFI(Register Reg) const { return ISRDataRegFI[Reg]; }
75 bool isISRRegFI(int FI) const;
77 /// Create a MachinePointerInfo that has a GlobalValuePseudoSourceValue object
78 /// representing a GOT entry for a global function.
79 MachinePointerInfo callPtrInfo(MachineFunction &MF, const GlobalValue *GV);
81 void setSaveS2() { SaveS2 = true; }
82 bool hasSaveS2() const { return SaveS2; }
84 int getMoveF64ViaSpillFI(MachineFunction &MF, const TargetRegisterClass *RC);
86 std::map<const char *, const Mips16HardFloatInfo::FuncSignature *>
87 StubsNeeded;
89 private:
90 virtual void anchor();
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;
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;
102 /// VarArgsFrameIndex - FrameIndex for start of varargs area.
103 int VarArgsFrameIndex = 0;
105 /// True if function has a byval argument.
106 bool HasByvalArg;
108 /// Size of incoming argument area.
109 unsigned IncomingArgSize;
111 /// CallsEhReturn - Whether the function calls llvm.eh.return.
112 bool CallsEhReturn = false;
114 /// Frame objects for spilling eh data registers.
115 int EhDataRegFI[4];
117 /// ISR - Whether the function is an Interrupt Service Routine.
118 bool IsISR = false;
120 /// Frame objects for spilling C0_STATUS, C0_EPC
121 int ISRDataRegFI[2];
123 // saveS2
124 bool SaveS2 = false;
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;
131 } // end namespace llvm
133 #endif // LLVM_LIB_TARGET_MIPS_MIPSMACHINEFUNCTION_H