xref: /freebsd/contrib/llvm-project/llvm/lib/Target/Xtensa/XtensaMachineFunctionInfo.h (revision 700637cbb5e582861067a11aaca4d053546871d2)
1 //==- XtensaMachineFunctionInfo.h - Xtensa machine function info --*- C++ -*-=//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6 // See https://llvm.org/LICENSE.txt for license information.
7 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //
9 //===----------------------------------------------------------------------===//
10 //
11 // This file declares Xtensa-specific per-machine-function information.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_LIB_TARGET_XTENSA_XTENSAMACHINEFUNCTIONINFO_H
16 #define LLVM_LIB_TARGET_XTENSA_XTENSAMACHINEFUNCTIONINFO_H
17 
18 #include "llvm/CodeGen/MachineFrameInfo.h"
19 #include "llvm/CodeGen/MachineFunction.h"
20 #include "llvm/Target/TargetMachine.h"
21 
22 namespace llvm {
23 
24 class XtensaMachineFunctionInfo : public MachineFunctionInfo {
25   /// FrameIndex of the spill slot for the scratch register in BranchRelaxation.
26   int BranchRelaxationScratchFrameIndex = -1;
27   unsigned VarArgsFirstGPR;
28   int VarArgsOnStackFrameIndex;
29   int VarArgsInRegsFrameIndex;
30   bool SaveFrameRegister = false;
31   unsigned CPLabelId = 0;
32 
33 public:
XtensaMachineFunctionInfo(const Function & F,const TargetSubtargetInfo * STI)34   explicit XtensaMachineFunctionInfo(const Function &F,
35                                      const TargetSubtargetInfo *STI)
36       : VarArgsFirstGPR(0), VarArgsOnStackFrameIndex(0),
37         VarArgsInRegsFrameIndex(0) {}
38 
getBranchRelaxationScratchFrameIndex()39   int getBranchRelaxationScratchFrameIndex() const {
40     return BranchRelaxationScratchFrameIndex;
41   }
setBranchRelaxationScratchFrameIndex(int Index)42   void setBranchRelaxationScratchFrameIndex(int Index) {
43     BranchRelaxationScratchFrameIndex = Index;
44   }
45 
getVarArgsFirstGPR()46   unsigned getVarArgsFirstGPR() const { return VarArgsFirstGPR; }
setVarArgsFirstGPR(unsigned GPR)47   void setVarArgsFirstGPR(unsigned GPR) { VarArgsFirstGPR = GPR; }
48 
getVarArgsOnStackFrameIndex()49   int getVarArgsOnStackFrameIndex() const { return VarArgsOnStackFrameIndex; }
setVarArgsOnStackFrameIndex(int FI)50   void setVarArgsOnStackFrameIndex(int FI) { VarArgsOnStackFrameIndex = FI; }
51 
52   // Get and set the frame index of the first stack vararg.
getVarArgsInRegsFrameIndex()53   int getVarArgsInRegsFrameIndex() const { return VarArgsInRegsFrameIndex; }
setVarArgsInRegsFrameIndex(int FI)54   void setVarArgsInRegsFrameIndex(int FI) { VarArgsInRegsFrameIndex = FI; }
55 
isSaveFrameRegister()56   bool isSaveFrameRegister() const { return SaveFrameRegister; }
setSaveFrameRegister()57   void setSaveFrameRegister() { SaveFrameRegister = true; }
58 
createCPLabelId()59   unsigned createCPLabelId() { return CPLabelId++; }
60 };
61 
62 } // namespace llvm
63 
64 #endif /* LLVM_LIB_TARGET_XTENSA_XTENSAMACHINEFUNCTIONINFO_H */
65