Revert r354244 "[DAGCombiner] Eliminate dead stores to stack."
[llvm-complete.git] / lib / Target / Mips / MipsMachineFunction.h
blob9e7b9b704eac5a188845ac0df7ccedd2b6f6a449
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(MachineFunction &MF) : MF(MF) {}
29 ~MipsFunctionInfo() override;
31 unsigned getSRetReturnReg() const { return SRetReturnReg; }
32 void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
34 bool globalBaseRegSet() const;
35 unsigned getGlobalBaseReg();
37 int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
38 void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; }
40 bool hasByvalArg() const { return HasByvalArg; }
41 void setFormalArgInfo(unsigned Size, bool HasByval) {
42 IncomingArgSize = Size;
43 HasByvalArg = HasByval;
46 unsigned getIncomingArgSize() const { return IncomingArgSize; }
48 bool callsEhReturn() const { return CallsEhReturn; }
49 void setCallsEhReturn() { CallsEhReturn = true; }
51 void createEhDataRegsFI();
52 int getEhDataRegFI(unsigned Reg) const { return EhDataRegFI[Reg]; }
53 bool isEhDataRegFI(int FI) const;
55 /// Create a MachinePointerInfo that has an ExternalSymbolPseudoSourceValue
56 /// object representing a GOT entry for an external function.
57 MachinePointerInfo callPtrInfo(const char *ES);
59 // Functions with the "interrupt" attribute require special prologues,
60 // epilogues and additional spill slots.
61 bool isISR() const { return IsISR; }
62 void setISR() { IsISR = true; }
63 void createISRRegFI();
64 int getISRRegFI(unsigned Reg) const { return ISRDataRegFI[Reg]; }
65 bool isISRRegFI(int FI) const;
67 /// Create a MachinePointerInfo that has a GlobalValuePseudoSourceValue object
68 /// representing a GOT entry for a global function.
69 MachinePointerInfo callPtrInfo(const GlobalValue *GV);
71 void setSaveS2() { SaveS2 = true; }
72 bool hasSaveS2() const { return SaveS2; }
74 int getMoveF64ViaSpillFI(const TargetRegisterClass *RC);
76 std::map<const char *, const Mips16HardFloatInfo::FuncSignature *>
77 StubsNeeded;
79 private:
80 virtual void anchor();
82 MachineFunction& MF;
84 /// SRetReturnReg - Some subtargets require that sret lowering includes
85 /// returning the value of the returned struct in a register. This field
86 /// holds the virtual register into which the sret argument is passed.
87 unsigned SRetReturnReg = 0;
89 /// GlobalBaseReg - keeps track of the virtual register initialized for
90 /// use as the global base register. This is used for PIC in some PIC
91 /// relocation models.
92 unsigned GlobalBaseReg = 0;
94 /// VarArgsFrameIndex - FrameIndex for start of varargs area.
95 int VarArgsFrameIndex = 0;
97 /// True if function has a byval argument.
98 bool HasByvalArg;
100 /// Size of incoming argument area.
101 unsigned IncomingArgSize;
103 /// CallsEhReturn - Whether the function calls llvm.eh.return.
104 bool CallsEhReturn = false;
106 /// Frame objects for spilling eh data registers.
107 int EhDataRegFI[4];
109 /// ISR - Whether the function is an Interrupt Service Routine.
110 bool IsISR = false;
112 /// Frame objects for spilling C0_STATUS, C0_EPC
113 int ISRDataRegFI[2];
115 // saveS2
116 bool SaveS2 = false;
118 /// FrameIndex for expanding BuildPairF64 nodes to spill and reload when the
119 /// O32 FPXX ABI is enabled. -1 is used to denote invalid index.
120 int MoveF64ViaSpillFI = -1;
123 } // end namespace llvm
125 #endif // LLVM_LIB_TARGET_MIPS_MIPSMACHINEFUNCTION_H