xref: /freebsd/contrib/llvm-project/llvm/lib/Target/ARC/ARCMachineFunctionInfo.h (revision ebacd8013fe5f7fdf9f6a5b286f6680dd2891036)
1 //===- ARCMachineFunctionInfo.h - ARC 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 ARC-specific per-machine-function information.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_ARC_ARCMACHINEFUNCTIONINFO_H
14 #define LLVM_LIB_TARGET_ARC_ARCMACHINEFUNCTIONINFO_H
15 
16 #include "llvm/CodeGen/MachineFunction.h"
17 #include <vector>
18 
19 namespace llvm {
20 
21 /// ARCFunctionInfo - This class is derived from MachineFunction private
22 /// ARC target-specific information for each MachineFunction.
23 class ARCFunctionInfo : public MachineFunctionInfo {
24   virtual void anchor();
25   bool ReturnStackOffsetSet;
26   int VarArgsFrameIndex;
27   unsigned ReturnStackOffset;
28 
29 public:
30   ARCFunctionInfo()
31       : ReturnStackOffsetSet(false), VarArgsFrameIndex(0),
32         ReturnStackOffset(-1U), MaxCallStackReq(0) {}
33 
34   explicit ARCFunctionInfo(MachineFunction &MF)
35       : ReturnStackOffsetSet(false), VarArgsFrameIndex(0),
36         ReturnStackOffset(-1U), MaxCallStackReq(0) {}
37   ~ARCFunctionInfo() {}
38 
39   MachineFunctionInfo *
40   clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF,
41         const DenseMap<MachineBasicBlock *, MachineBasicBlock *> &Src2DstMBB)
42       const override;
43 
44   void setVarArgsFrameIndex(int off) { VarArgsFrameIndex = off; }
45   int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
46 
47   void setReturnStackOffset(unsigned value) {
48     assert(!ReturnStackOffsetSet && "Return stack offset set twice");
49     ReturnStackOffset = value;
50     ReturnStackOffsetSet = true;
51   }
52 
53   unsigned getReturnStackOffset() const {
54     assert(ReturnStackOffsetSet && "Return stack offset not set");
55     return ReturnStackOffset;
56   }
57 
58   unsigned MaxCallStackReq;
59 };
60 
61 } // end namespace llvm
62 
63 #endif // LLVM_LIB_TARGET_ARC_ARCMACHINEFUNCTIONINFO_H
64