xref: /freebsd/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYMachineFunctionInfo.h (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
1 //=- CSKYMachineFunctionInfo.h - CSKY machine function info -------*- C++ -*-=//
2 //
3 // 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
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file declares CSKY-specific per-machine-function information.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_CSKY_CSKYMACHINEFUNCTIONINFO_H
14 #define LLVM_LIB_TARGET_CSKY_CSKYMACHINEFUNCTIONINFO_H
15 
16 #include "llvm/CodeGen/MachineFunction.h"
17 
18 namespace llvm {
19 
20 class CSKYMachineFunctionInfo : public MachineFunctionInfo {
21   Register GlobalBaseReg = 0;
22   bool SpillsCR = false;
23 
24   int VarArgsFrameIndex = 0;
25   unsigned VarArgsSaveSize = 0;
26 
27   int spillAreaSize = 0;
28 
29   bool LRSpilled = false;
30 
31   unsigned PICLabelUId = 0;
32 
33 public:
CSKYMachineFunctionInfo(const Function & F,const TargetSubtargetInfo * STI)34   CSKYMachineFunctionInfo(const Function &F, const TargetSubtargetInfo *STI) {}
35 
36   MachineFunctionInfo *
clone(BumpPtrAllocator & Allocator,MachineFunction & DestMF,const DenseMap<MachineBasicBlock *,MachineBasicBlock * > & Src2DstMBB)37   clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF,
38         const DenseMap<MachineBasicBlock *, MachineBasicBlock *> &Src2DstMBB)
39       const override {
40     return DestMF.cloneInfo<CSKYMachineFunctionInfo>(*this);
41   }
42 
getGlobalBaseReg()43   Register getGlobalBaseReg() const { return GlobalBaseReg; }
setGlobalBaseReg(Register Reg)44   void setGlobalBaseReg(Register Reg) { GlobalBaseReg = Reg; }
45 
setSpillsCR()46   void setSpillsCR() { SpillsCR = true; }
isCRSpilled()47   bool isCRSpilled() const { return SpillsCR; }
48 
setVarArgsFrameIndex(int v)49   void setVarArgsFrameIndex(int v) { VarArgsFrameIndex = v; }
getVarArgsFrameIndex()50   int getVarArgsFrameIndex() { return VarArgsFrameIndex; }
51 
getVarArgsSaveSize()52   unsigned getVarArgsSaveSize() const { return VarArgsSaveSize; }
setVarArgsSaveSize(int Size)53   void setVarArgsSaveSize(int Size) { VarArgsSaveSize = Size; }
54 
isLRSpilled()55   bool isLRSpilled() const { return LRSpilled; }
setLRIsSpilled(bool s)56   void setLRIsSpilled(bool s) { LRSpilled = s; }
57 
setCalleeSaveAreaSize(int v)58   void setCalleeSaveAreaSize(int v) { spillAreaSize = v; }
getCalleeSaveAreaSize()59   int getCalleeSaveAreaSize() const { return spillAreaSize; }
60 
createPICLabelUId()61   unsigned createPICLabelUId() { return ++PICLabelUId; }
initPICLabelUId(unsigned UId)62   void initPICLabelUId(unsigned UId) { PICLabelUId = UId; }
63 };
64 
65 } // namespace llvm
66 
67 #endif // LLVM_LIB_TARGET_CSKY_CSKYMACHINEFUNCTIONINFO_H
68