xref: /freebsd/contrib/llvm-project/llvm/lib/Target/MSP430/MSP430MachineFunctionInfo.h (revision 81ad626541db97eb356e2c1d4a20eb2a26a766ab)
10b57cec5SDimitry Andric //=== MSP430MachineFunctionInfo.h - MSP430 machine function info -*- C++ -*-==//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric //
90b57cec5SDimitry Andric // This file declares MSP430-specific per-machine-function information.
100b57cec5SDimitry Andric //
110b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
120b57cec5SDimitry Andric 
130b57cec5SDimitry Andric #ifndef LLVM_LIB_TARGET_MSP430_MSP430MACHINEFUNCTIONINFO_H
140b57cec5SDimitry Andric #define LLVM_LIB_TARGET_MSP430_MSP430MACHINEFUNCTIONINFO_H
150b57cec5SDimitry Andric 
160b57cec5SDimitry Andric #include "llvm/CodeGen/MachineFunction.h"
170b57cec5SDimitry Andric 
180b57cec5SDimitry Andric namespace llvm {
190b57cec5SDimitry Andric 
200b57cec5SDimitry Andric /// MSP430MachineFunctionInfo - This class is derived from MachineFunction and
210b57cec5SDimitry Andric /// contains private MSP430 target-specific information for each MachineFunction.
220b57cec5SDimitry Andric class MSP430MachineFunctionInfo : public MachineFunctionInfo {
230b57cec5SDimitry Andric   virtual void anchor();
240b57cec5SDimitry Andric 
250b57cec5SDimitry Andric   /// CalleeSavedFrameSize - Size of the callee-saved register portion of the
260b57cec5SDimitry Andric   /// stack frame in bytes.
27480093f4SDimitry Andric   unsigned CalleeSavedFrameSize = 0;
280b57cec5SDimitry Andric 
290b57cec5SDimitry Andric   /// ReturnAddrIndex - FrameIndex for return slot.
30480093f4SDimitry Andric   int ReturnAddrIndex = 0;
310b57cec5SDimitry Andric 
320b57cec5SDimitry Andric   /// VarArgsFrameIndex - FrameIndex for start of varargs area.
33480093f4SDimitry Andric   int VarArgsFrameIndex = 0;
340b57cec5SDimitry Andric 
350b57cec5SDimitry Andric   /// SRetReturnReg - Some subtargets require that sret lowering includes
360b57cec5SDimitry Andric   /// returning the value of the returned struct in a register. This field
370b57cec5SDimitry Andric   /// holds the virtual register into which the sret argument is passed.
385ffd83dbSDimitry Andric   Register SRetReturnReg;
390b57cec5SDimitry Andric 
400b57cec5SDimitry Andric public:
41480093f4SDimitry Andric   MSP430MachineFunctionInfo() = default;
420b57cec5SDimitry Andric 
430b57cec5SDimitry Andric   explicit MSP430MachineFunctionInfo(MachineFunction &MF)
440b57cec5SDimitry Andric     : CalleeSavedFrameSize(0), ReturnAddrIndex(0), SRetReturnReg(0) {}
450b57cec5SDimitry Andric 
46*81ad6265SDimitry Andric   MachineFunctionInfo *
47*81ad6265SDimitry Andric   clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF,
48*81ad6265SDimitry Andric         const DenseMap<MachineBasicBlock *, MachineBasicBlock *> &Src2DstMBB)
49*81ad6265SDimitry Andric       const override;
50*81ad6265SDimitry Andric 
510b57cec5SDimitry Andric   unsigned getCalleeSavedFrameSize() const { return CalleeSavedFrameSize; }
520b57cec5SDimitry Andric   void setCalleeSavedFrameSize(unsigned bytes) { CalleeSavedFrameSize = bytes; }
530b57cec5SDimitry Andric 
545ffd83dbSDimitry Andric   Register getSRetReturnReg() const { return SRetReturnReg; }
555ffd83dbSDimitry Andric   void setSRetReturnReg(Register Reg) { SRetReturnReg = Reg; }
560b57cec5SDimitry Andric 
570b57cec5SDimitry Andric   int getRAIndex() const { return ReturnAddrIndex; }
580b57cec5SDimitry Andric   void setRAIndex(int Index) { ReturnAddrIndex = Index; }
590b57cec5SDimitry Andric 
600b57cec5SDimitry Andric   int getVarArgsFrameIndex() const { return VarArgsFrameIndex;}
610b57cec5SDimitry Andric   void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; }
620b57cec5SDimitry Andric };
630b57cec5SDimitry Andric 
640b57cec5SDimitry Andric } // End llvm namespace
650b57cec5SDimitry Andric 
660b57cec5SDimitry Andric #endif
67