Home | History | Annotate | Download | only in RISCV
      1 //=- RISCVMachineFunctionInfo.h - RISCV machine function info -----*- C++ -*-=//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // This file declares RISCV-specific per-machine-function information.
     11 //
     12 //===----------------------------------------------------------------------===//
     13 
     14 #ifndef LLVM_LIB_TARGET_RISCV_RISCVMACHINEFUNCTIONINFO_H
     15 #define LLVM_LIB_TARGET_RISCV_RISCVMACHINEFUNCTIONINFO_H
     16 
     17 #include "llvm/CodeGen/MachineFrameInfo.h"
     18 #include "llvm/CodeGen/MachineFunction.h"
     19 
     20 namespace llvm {
     21 
     22 /// RISCVMachineFunctionInfo - This class is derived from MachineFunctionInfo
     23 /// and contains private RISCV-specific information for each MachineFunction.
     24 class RISCVMachineFunctionInfo : public MachineFunctionInfo {
     25 private:
     26   MachineFunction &MF;
     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;
     34 
     35 public:
     36   //  RISCVMachineFunctionInfo() = default;
     37 
     38   RISCVMachineFunctionInfo(MachineFunction &MF) : MF(MF) {}
     39 
     40   int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
     41   void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; }
     42 
     43   unsigned getVarArgsSaveSize() const { return VarArgsSaveSize; }
     44   void setVarArgsSaveSize(int Size) { VarArgsSaveSize = Size; }
     45 
     46   int getMoveF64FrameIndex() {
     47     if (MoveF64FrameIndex == -1)
     48       MoveF64FrameIndex = MF.getFrameInfo().CreateStackObject(8, 8, false);
     49     return MoveF64FrameIndex;
     50   }
     51 };
     52 
     53 } // end namespace llvm
     54 
     55 #endif // LLVM_LIB_TARGET_RISCV_RISCVMACHINEFUNCTIONINFO_H
     56