xref: /freebsd-src/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYMachineFunctionInfo.h (revision 81ad626541db97eb356e2c1d4a20eb2a26a766ab)
1349cc55cSDimitry Andric //=- CSKYMachineFunctionInfo.h - CSKY machine function info -------*- C++ -*-=//
2349cc55cSDimitry Andric //
3349cc55cSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4349cc55cSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5349cc55cSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6349cc55cSDimitry Andric //
7349cc55cSDimitry Andric //===----------------------------------------------------------------------===//
8349cc55cSDimitry Andric //
9349cc55cSDimitry Andric // This file declares CSKY-specific per-machine-function information.
10349cc55cSDimitry Andric //
11349cc55cSDimitry Andric //===----------------------------------------------------------------------===//
12349cc55cSDimitry Andric 
13349cc55cSDimitry Andric #ifndef LLVM_LIB_TARGET_CSKY_CSKYMACHINEFUNCTIONINFO_H
14349cc55cSDimitry Andric #define LLVM_LIB_TARGET_CSKY_CSKYMACHINEFUNCTIONINFO_H
15349cc55cSDimitry Andric 
16349cc55cSDimitry Andric #include "llvm/CodeGen/MachineFunction.h"
17349cc55cSDimitry Andric 
18349cc55cSDimitry Andric namespace llvm {
19349cc55cSDimitry Andric 
20349cc55cSDimitry Andric class CSKYMachineFunctionInfo : public MachineFunctionInfo {
21349cc55cSDimitry Andric   Register GlobalBaseReg = 0;
22349cc55cSDimitry Andric   bool SpillsCR = false;
23349cc55cSDimitry Andric 
24349cc55cSDimitry Andric   int VarArgsFrameIndex = 0;
25349cc55cSDimitry Andric   unsigned VarArgsSaveSize = 0;
26349cc55cSDimitry Andric 
27349cc55cSDimitry Andric   int spillAreaSize = 0;
28349cc55cSDimitry Andric 
29349cc55cSDimitry Andric   bool LRSpilled = false;
30349cc55cSDimitry Andric 
31349cc55cSDimitry Andric   unsigned PICLabelUId = 0;
32349cc55cSDimitry Andric 
33349cc55cSDimitry Andric public:
34*81ad6265SDimitry Andric   CSKYMachineFunctionInfo(MachineFunction &) {}
35*81ad6265SDimitry Andric 
36*81ad6265SDimitry Andric   MachineFunctionInfo *
37*81ad6265SDimitry Andric   clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF,
38*81ad6265SDimitry Andric         const DenseMap<MachineBasicBlock *, MachineBasicBlock *> &Src2DstMBB)
39*81ad6265SDimitry Andric       const override {
40*81ad6265SDimitry Andric     return DestMF.cloneInfo<CSKYMachineFunctionInfo>(*this);
41*81ad6265SDimitry Andric   }
42349cc55cSDimitry Andric 
43349cc55cSDimitry Andric   Register getGlobalBaseReg() const { return GlobalBaseReg; }
44349cc55cSDimitry Andric   void setGlobalBaseReg(Register Reg) { GlobalBaseReg = Reg; }
45349cc55cSDimitry Andric 
46349cc55cSDimitry Andric   void setSpillsCR() { SpillsCR = true; }
47349cc55cSDimitry Andric   bool isCRSpilled() const { return SpillsCR; }
48349cc55cSDimitry Andric 
49349cc55cSDimitry Andric   void setVarArgsFrameIndex(int v) { VarArgsFrameIndex = v; }
50349cc55cSDimitry Andric   int getVarArgsFrameIndex() { return VarArgsFrameIndex; }
51349cc55cSDimitry Andric 
52349cc55cSDimitry Andric   unsigned getVarArgsSaveSize() const { return VarArgsSaveSize; }
53349cc55cSDimitry Andric   void setVarArgsSaveSize(int Size) { VarArgsSaveSize = Size; }
54349cc55cSDimitry Andric 
55349cc55cSDimitry Andric   bool isLRSpilled() const { return LRSpilled; }
56349cc55cSDimitry Andric   void setLRIsSpilled(bool s) { LRSpilled = s; }
57349cc55cSDimitry Andric 
58349cc55cSDimitry Andric   void setCalleeSaveAreaSize(int v) { spillAreaSize = v; }
59349cc55cSDimitry Andric   int getCalleeSaveAreaSize() const { return spillAreaSize; }
60349cc55cSDimitry Andric 
61349cc55cSDimitry Andric   unsigned createPICLabelUId() { return ++PICLabelUId; }
62349cc55cSDimitry Andric   void initPICLabelUId(unsigned UId) { PICLabelUId = UId; }
63349cc55cSDimitry Andric };
64349cc55cSDimitry Andric 
65349cc55cSDimitry Andric } // namespace llvm
66349cc55cSDimitry Andric 
67349cc55cSDimitry Andric #endif // LLVM_LIB_TARGET_CSKY_CSKYMACHINEFUNCTIONINFO_H
68