1 //=- RISCVMachineFunctionInfo.h - RISCV machine function info -----*- C++ -*-=//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares RISCV-specific per-machine-function information.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_RISCV_RISCVMACHINEFUNCTIONINFO_H
15 #define LLVM_LIB_TARGET_RISCV_RISCVMACHINEFUNCTIONINFO_H
17 #include "llvm/CodeGen/MachineFrameInfo.h"
18 #include "llvm/CodeGen/MachineFunction.h"
22 /// RISCVMachineFunctionInfo - This class is derived from MachineFunctionInfo
23 /// and contains private RISCV-specific information for each MachineFunction.
24 class RISCVMachineFunctionInfo
: public MachineFunctionInfo
{
27 /// FrameIndex for start of varargs area
28 int VarArgsFrameIndex
= 0;
29 /// Size of the save area used for varargs
30 int VarArgsSaveSize
= 0;
31 /// FrameIndex used for transferring values between 64-bit FPRs and a pair
32 /// of 32-bit GPRs via the stack.
33 int MoveF64FrameIndex
= -1;
36 // RISCVMachineFunctionInfo() = default;
38 RISCVMachineFunctionInfo(MachineFunction
&MF
) : MF(MF
) {}
40 int getVarArgsFrameIndex() const { return VarArgsFrameIndex
; }
41 void setVarArgsFrameIndex(int Index
) { VarArgsFrameIndex
= Index
; }
43 unsigned getVarArgsSaveSize() const { return VarArgsSaveSize
; }
44 void setVarArgsSaveSize(int Size
) { VarArgsSaveSize
= Size
; }
46 int getMoveF64FrameIndex() {
47 if (MoveF64FrameIndex
== -1)
48 MoveF64FrameIndex
= MF
.getFrameInfo().CreateStackObject(8, 8, false);
49 return MoveF64FrameIndex
;
53 } // end namespace llvm
55 #endif // LLVM_LIB_TARGET_RISCV_RISCVMACHINEFUNCTIONINFO_H