xref: /freebsd/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYMachineFunctionInfo.h (revision d5b0e70f7e04d971691517ce1304d86a1e367e2e)
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   MachineFunction &MF;
22 
23   Register GlobalBaseReg = 0;
24   bool SpillsCR = false;
25 
26   int VarArgsFrameIndex = 0;
27   unsigned VarArgsSaveSize = 0;
28 
29   int spillAreaSize = 0;
30 
31   bool LRSpilled = false;
32 
33   unsigned PICLabelUId = 0;
34 
35 public:
36   CSKYMachineFunctionInfo(MachineFunction &MF) : MF(MF) {}
37 
38   Register getGlobalBaseReg() const { return GlobalBaseReg; }
39   void setGlobalBaseReg(Register Reg) { GlobalBaseReg = Reg; }
40 
41   void setSpillsCR() { SpillsCR = true; }
42   bool isCRSpilled() const { return SpillsCR; }
43 
44   void setVarArgsFrameIndex(int v) { VarArgsFrameIndex = v; }
45   int getVarArgsFrameIndex() { return VarArgsFrameIndex; }
46 
47   unsigned getVarArgsSaveSize() const { return VarArgsSaveSize; }
48   void setVarArgsSaveSize(int Size) { VarArgsSaveSize = Size; }
49 
50   bool isLRSpilled() const { return LRSpilled; }
51   void setLRIsSpilled(bool s) { LRSpilled = s; }
52 
53   void setCalleeSaveAreaSize(int v) { spillAreaSize = v; }
54   int getCalleeSaveAreaSize() const { return spillAreaSize; }
55 
56   unsigned createPICLabelUId() { return ++PICLabelUId; }
57   void initPICLabelUId(unsigned UId) { PICLabelUId = UId; }
58 };
59 
60 } // namespace llvm
61 
62 #endif // LLVM_LIB_TARGET_CSKY_CSKYMACHINEFUNCTIONINFO_H
63