blob: 585bff2bc20a2cff0db638b2f20e5f2ccbdbd98e [file] [log] [blame]
Alex Bradburyc85be0d2018-01-10 19:41:03 +00001//=- RISCVMachineFunctionInfo.h - RISCV machine function info -----*- C++ -*-=//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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
Alex Bradburyc85be0d2018-01-10 19:41:03 +00006//
7//===----------------------------------------------------------------------===//
8//
9// This file declares RISCV-specific per-machine-function information.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_RISCV_RISCVMACHINEFUNCTIONINFO_H
14#define LLVM_LIB_TARGET_RISCV_RISCVMACHINEFUNCTIONINFO_H
15
Alex Bradbury0b4175f2018-04-12 05:34:25 +000016#include "llvm/CodeGen/MachineFrameInfo.h"
Alex Bradburyc85be0d2018-01-10 19:41:03 +000017#include "llvm/CodeGen/MachineFunction.h"
18
19namespace llvm {
20
21/// RISCVMachineFunctionInfo - This class is derived from MachineFunctionInfo
22/// and contains private RISCV-specific information for each MachineFunction.
23class RISCVMachineFunctionInfo : public MachineFunctionInfo {
Alex Bradbury0b4175f2018-04-12 05:34:25 +000024private:
25 MachineFunction &MF;
Alex Bradburyc85be0d2018-01-10 19:41:03 +000026 /// FrameIndex for start of varargs area
27 int VarArgsFrameIndex = 0;
28 /// Size of the save area used for varargs
29 int VarArgsSaveSize = 0;
Alex Bradbury0b4175f2018-04-12 05:34:25 +000030 /// FrameIndex used for transferring values between 64-bit FPRs and a pair
31 /// of 32-bit GPRs via the stack.
32 int MoveF64FrameIndex = -1;
Alex Bradburyc85be0d2018-01-10 19:41:03 +000033
34public:
Alex Bradbury0b4175f2018-04-12 05:34:25 +000035 RISCVMachineFunctionInfo(MachineFunction &MF) : MF(MF) {}
Alex Bradburyc85be0d2018-01-10 19:41:03 +000036
37 int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
38 void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; }
39
40 unsigned getVarArgsSaveSize() const { return VarArgsSaveSize; }
41 void setVarArgsSaveSize(int Size) { VarArgsSaveSize = Size; }
Alex Bradbury0b4175f2018-04-12 05:34:25 +000042
43 int getMoveF64FrameIndex() {
44 if (MoveF64FrameIndex == -1)
45 MoveF64FrameIndex = MF.getFrameInfo().CreateStackObject(8, 8, false);
46 return MoveF64FrameIndex;
47 }
Alex Bradburyc85be0d2018-01-10 19:41:03 +000048};
49
50} // end namespace llvm
51
52#endif // LLVM_LIB_TARGET_RISCV_RISCVMACHINEFUNCTIONINFO_H