1cf78715cSZi Xuan Wu //=- CSKYMachineFunctionInfo.h - CSKY machine function info -------*- C++ -*-=// 2cf78715cSZi Xuan Wu // 3cf78715cSZi Xuan Wu // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4cf78715cSZi Xuan Wu // See https://llvm.org/LICENSE.txt for license information. 5cf78715cSZi Xuan Wu // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6cf78715cSZi Xuan Wu // 7cf78715cSZi Xuan Wu //===----------------------------------------------------------------------===// 8cf78715cSZi Xuan Wu // 9cf78715cSZi Xuan Wu // This file declares CSKY-specific per-machine-function information. 10cf78715cSZi Xuan Wu // 11cf78715cSZi Xuan Wu //===----------------------------------------------------------------------===// 12cf78715cSZi Xuan Wu 13cf78715cSZi Xuan Wu #ifndef LLVM_LIB_TARGET_CSKY_CSKYMACHINEFUNCTIONINFO_H 14cf78715cSZi Xuan Wu #define LLVM_LIB_TARGET_CSKY_CSKYMACHINEFUNCTIONINFO_H 15cf78715cSZi Xuan Wu 16cf78715cSZi Xuan Wu #include "llvm/CodeGen/MachineFunction.h" 17cf78715cSZi Xuan Wu 18cf78715cSZi Xuan Wu namespace llvm { 19cf78715cSZi Xuan Wu 20cf78715cSZi Xuan Wu class CSKYMachineFunctionInfo : public MachineFunctionInfo { 21cf78715cSZi Xuan Wu Register GlobalBaseReg = 0; 22cf78715cSZi Xuan Wu bool SpillsCR = false; 23cf78715cSZi Xuan Wu 24cf78715cSZi Xuan Wu int VarArgsFrameIndex = 0; 25cf78715cSZi Xuan Wu unsigned VarArgsSaveSize = 0; 26cf78715cSZi Xuan Wu 27cf78715cSZi Xuan Wu int spillAreaSize = 0; 28cf78715cSZi Xuan Wu 29cf78715cSZi Xuan Wu bool LRSpilled = false; 30cf78715cSZi Xuan Wu 31cf78715cSZi Xuan Wu unsigned PICLabelUId = 0; 32cf78715cSZi Xuan Wu 33cf78715cSZi Xuan Wu public: CSKYMachineFunctionInfo(const Function & F,const TargetSubtargetInfo * STI)34*69e75ae6SMatt Arsenault CSKYMachineFunctionInfo(const Function &F, const TargetSubtargetInfo *STI) {} 35cf78715cSZi Xuan Wu 36cc5a1b3dSMatt Arsenault MachineFunctionInfo * clone(BumpPtrAllocator & Allocator,MachineFunction & DestMF,const DenseMap<MachineBasicBlock *,MachineBasicBlock * > & Src2DstMBB)37cc5a1b3dSMatt Arsenault clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF, 38cc5a1b3dSMatt Arsenault const DenseMap<MachineBasicBlock *, MachineBasicBlock *> &Src2DstMBB) 39cc5a1b3dSMatt Arsenault const override { 40cc5a1b3dSMatt Arsenault return DestMF.cloneInfo<CSKYMachineFunctionInfo>(*this); 41cc5a1b3dSMatt Arsenault } 42cc5a1b3dSMatt Arsenault getGlobalBaseReg()43cf78715cSZi Xuan Wu Register getGlobalBaseReg() const { return GlobalBaseReg; } setGlobalBaseReg(Register Reg)44cf78715cSZi Xuan Wu void setGlobalBaseReg(Register Reg) { GlobalBaseReg = Reg; } 45cf78715cSZi Xuan Wu setSpillsCR()46cf78715cSZi Xuan Wu void setSpillsCR() { SpillsCR = true; } isCRSpilled()47cf78715cSZi Xuan Wu bool isCRSpilled() const { return SpillsCR; } 48cf78715cSZi Xuan Wu setVarArgsFrameIndex(int v)49cf78715cSZi Xuan Wu void setVarArgsFrameIndex(int v) { VarArgsFrameIndex = v; } getVarArgsFrameIndex()50cf78715cSZi Xuan Wu int getVarArgsFrameIndex() { return VarArgsFrameIndex; } 51cf78715cSZi Xuan Wu getVarArgsSaveSize()52cf78715cSZi Xuan Wu unsigned getVarArgsSaveSize() const { return VarArgsSaveSize; } setVarArgsSaveSize(int Size)53cf78715cSZi Xuan Wu void setVarArgsSaveSize(int Size) { VarArgsSaveSize = Size; } 54cf78715cSZi Xuan Wu isLRSpilled()55cf78715cSZi Xuan Wu bool isLRSpilled() const { return LRSpilled; } setLRIsSpilled(bool s)56cf78715cSZi Xuan Wu void setLRIsSpilled(bool s) { LRSpilled = s; } 57cf78715cSZi Xuan Wu setCalleeSaveAreaSize(int v)58cf78715cSZi Xuan Wu void setCalleeSaveAreaSize(int v) { spillAreaSize = v; } getCalleeSaveAreaSize()59cf78715cSZi Xuan Wu int getCalleeSaveAreaSize() const { return spillAreaSize; } 60cf78715cSZi Xuan Wu createPICLabelUId()61cf78715cSZi Xuan Wu unsigned createPICLabelUId() { return ++PICLabelUId; } initPICLabelUId(unsigned UId)62cf78715cSZi Xuan Wu void initPICLabelUId(unsigned UId) { PICLabelUId = UId; } 63cf78715cSZi Xuan Wu }; 64cf78715cSZi Xuan Wu 65cf78715cSZi Xuan Wu } // namespace llvm 66cf78715cSZi Xuan Wu 67cf78715cSZi Xuan Wu #endif // LLVM_LIB_TARGET_CSKY_CSKYMACHINEFUNCTIONINFO_H 68