diff options
Diffstat (limited to 'lib/Target/RISCV/RISCVMachineFunctionInfo.h')
| -rw-r--r-- | lib/Target/RISCV/RISCVMachineFunctionInfo.h | 55 | 
1 files changed, 55 insertions, 0 deletions
diff --git a/lib/Target/RISCV/RISCVMachineFunctionInfo.h b/lib/Target/RISCV/RISCVMachineFunctionInfo.h new file mode 100644 index 000000000000..2fea3a1bdd2f --- /dev/null +++ b/lib/Target/RISCV/RISCVMachineFunctionInfo.h @@ -0,0 +1,55 @@ +//=- RISCVMachineFunctionInfo.h - RISCV machine function info -----*- C++ -*-=// +// +//                     The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file declares RISCV-specific per-machine-function information. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIB_TARGET_RISCV_RISCVMACHINEFUNCTIONINFO_H +#define LLVM_LIB_TARGET_RISCV_RISCVMACHINEFUNCTIONINFO_H + +#include "llvm/CodeGen/MachineFrameInfo.h" +#include "llvm/CodeGen/MachineFunction.h" + +namespace llvm { + +/// RISCVMachineFunctionInfo - This class is derived from MachineFunctionInfo +/// and contains private RISCV-specific information for each MachineFunction. +class RISCVMachineFunctionInfo : public MachineFunctionInfo { +private: +  MachineFunction &MF; +  /// FrameIndex for start of varargs area +  int VarArgsFrameIndex = 0; +  /// Size of the save area used for varargs +  int VarArgsSaveSize = 0; +  /// FrameIndex used for transferring values between 64-bit FPRs and a pair +  /// of 32-bit GPRs via the stack. +  int MoveF64FrameIndex = -1; + +public: +  //  RISCVMachineFunctionInfo() = default; + +  RISCVMachineFunctionInfo(MachineFunction &MF) : MF(MF) {} + +  int getVarArgsFrameIndex() const { return VarArgsFrameIndex; } +  void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; } + +  unsigned getVarArgsSaveSize() const { return VarArgsSaveSize; } +  void setVarArgsSaveSize(int Size) { VarArgsSaveSize = Size; } + +  int getMoveF64FrameIndex() { +    if (MoveF64FrameIndex == -1) +      MoveF64FrameIndex = MF.getFrameInfo().CreateStackObject(8, 8, false); +    return MoveF64FrameIndex; +  } +}; + +} // end namespace llvm + +#endif // LLVM_LIB_TARGET_RISCV_RISCVMACHINEFUNCTIONINFO_H  | 
