1336809Sdim//=- RISCVMachineFunctionInfo.h - RISCV machine function info -----*- C++ -*-=// 2336809Sdim// 3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4353358Sdim// See https://llvm.org/LICENSE.txt for license information. 5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6336809Sdim// 7336809Sdim//===----------------------------------------------------------------------===// 8336809Sdim// 9336809Sdim// This file declares RISCV-specific per-machine-function information. 10336809Sdim// 11336809Sdim//===----------------------------------------------------------------------===// 12336809Sdim 13336809Sdim#ifndef LLVM_LIB_TARGET_RISCV_RISCVMACHINEFUNCTIONINFO_H 14336809Sdim#define LLVM_LIB_TARGET_RISCV_RISCVMACHINEFUNCTIONINFO_H 15336809Sdim 16336809Sdim#include "llvm/CodeGen/MachineFrameInfo.h" 17336809Sdim#include "llvm/CodeGen/MachineFunction.h" 18336809Sdim 19336809Sdimnamespace llvm { 20336809Sdim 21336809Sdim/// RISCVMachineFunctionInfo - This class is derived from MachineFunctionInfo 22336809Sdim/// and contains private RISCV-specific information for each MachineFunction. 23336809Sdimclass RISCVMachineFunctionInfo : public MachineFunctionInfo { 24336809Sdimprivate: 25336809Sdim MachineFunction &MF; 26336809Sdim /// FrameIndex for start of varargs area 27336809Sdim int VarArgsFrameIndex = 0; 28336809Sdim /// Size of the save area used for varargs 29336809Sdim int VarArgsSaveSize = 0; 30336809Sdim /// FrameIndex used for transferring values between 64-bit FPRs and a pair 31336809Sdim /// of 32-bit GPRs via the stack. 32336809Sdim int MoveF64FrameIndex = -1; 33336809Sdim 34336809Sdimpublic: 35336809Sdim RISCVMachineFunctionInfo(MachineFunction &MF) : MF(MF) {} 36336809Sdim 37336809Sdim int getVarArgsFrameIndex() const { return VarArgsFrameIndex; } 38336809Sdim void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; } 39336809Sdim 40336809Sdim unsigned getVarArgsSaveSize() const { return VarArgsSaveSize; } 41336809Sdim void setVarArgsSaveSize(int Size) { VarArgsSaveSize = Size; } 42336809Sdim 43336809Sdim int getMoveF64FrameIndex() { 44336809Sdim if (MoveF64FrameIndex == -1) 45336809Sdim MoveF64FrameIndex = MF.getFrameInfo().CreateStackObject(8, 8, false); 46336809Sdim return MoveF64FrameIndex; 47336809Sdim } 48336809Sdim}; 49336809Sdim 50336809Sdim} // end namespace llvm 51336809Sdim 52336809Sdim#endif // LLVM_LIB_TARGET_RISCV_RISCVMACHINEFUNCTIONINFO_H 53