1296417Sdim//=== MSP430MachineFunctionInfo.h - MSP430 machine function info -*- C++ -*-==//
2193323Sed//
3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4353358Sdim// See https://llvm.org/LICENSE.txt for license information.
5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6193323Sed//
7193323Sed//===----------------------------------------------------------------------===//
8193323Sed//
9193323Sed// This file declares MSP430-specific per-machine-function information.
10193323Sed//
11193323Sed//===----------------------------------------------------------------------===//
12193323Sed
13280031Sdim#ifndef LLVM_LIB_TARGET_MSP430_MSP430MACHINEFUNCTIONINFO_H
14280031Sdim#define LLVM_LIB_TARGET_MSP430_MSP430MACHINEFUNCTIONINFO_H
15193323Sed
16193323Sed#include "llvm/CodeGen/MachineFunction.h"
17193323Sed
18193323Sednamespace llvm {
19193323Sed
20193323Sed/// MSP430MachineFunctionInfo - This class is derived from MachineFunction and
21193323Sed/// contains private MSP430 target-specific information for each MachineFunction.
22193323Sedclass MSP430MachineFunctionInfo : public MachineFunctionInfo {
23234353Sdim  virtual void anchor();
24234353Sdim
25193323Sed  /// CalleeSavedFrameSize - Size of the callee-saved register portion of the
26193323Sed  /// stack frame in bytes.
27360784Sdim  unsigned CalleeSavedFrameSize = 0;
28193323Sed
29200581Srdivacky  /// ReturnAddrIndex - FrameIndex for return slot.
30360784Sdim  int ReturnAddrIndex = 0;
31200581Srdivacky
32249423Sdim  /// VarArgsFrameIndex - FrameIndex for start of varargs area.
33360784Sdim  int VarArgsFrameIndex = 0;
34249423Sdim
35321369Sdim  /// SRetReturnReg - Some subtargets require that sret lowering includes
36321369Sdim  /// returning the value of the returned struct in a register. This field
37321369Sdim  /// holds the virtual register into which the sret argument is passed.
38360784Sdim  unsigned SRetReturnReg = 0;
39321369Sdim
40193323Sedpublic:
41360784Sdim  MSP430MachineFunctionInfo() = default;
42193323Sed
43193574Sed  explicit MSP430MachineFunctionInfo(MachineFunction &MF)
44321369Sdim    : CalleeSavedFrameSize(0), ReturnAddrIndex(0), SRetReturnReg(0) {}
45193323Sed
46193323Sed  unsigned getCalleeSavedFrameSize() const { return CalleeSavedFrameSize; }
47193323Sed  void setCalleeSavedFrameSize(unsigned bytes) { CalleeSavedFrameSize = bytes; }
48200581Srdivacky
49321369Sdim  unsigned getSRetReturnReg() const { return SRetReturnReg; }
50321369Sdim  void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
51321369Sdim
52200581Srdivacky  int getRAIndex() const { return ReturnAddrIndex; }
53200581Srdivacky  void setRAIndex(int Index) { ReturnAddrIndex = Index; }
54249423Sdim
55249423Sdim  int getVarArgsFrameIndex() const { return VarArgsFrameIndex;}
56249423Sdim  void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; }
57193323Sed};
58193323Sed
59193323Sed} // End llvm namespace
60193323Sed
61193323Sed#endif
62