1*fe6060f1SDimitry Andric //===-- M68kMachineFunctionInfo.h - M68k private data ---------*- C++ -*-=// 2*fe6060f1SDimitry Andric // 3*fe6060f1SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*fe6060f1SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5*fe6060f1SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*fe6060f1SDimitry Andric // 7*fe6060f1SDimitry Andric //===----------------------------------------------------------------------===// 8*fe6060f1SDimitry Andric /// 9*fe6060f1SDimitry Andric /// \file 10*fe6060f1SDimitry Andric /// This file declares the M68k specific subclass of MachineFunctionInfo. 11*fe6060f1SDimitry Andric /// 12*fe6060f1SDimitry Andric //===----------------------------------------------------------------------===// 13*fe6060f1SDimitry Andric 14*fe6060f1SDimitry Andric #ifndef LLVM_LIB_TARGET_M68K_M68KMACHINEFUNCTION_H 15*fe6060f1SDimitry Andric #define LLVM_LIB_TARGET_M68K_M68KMACHINEFUNCTION_H 16*fe6060f1SDimitry Andric 17*fe6060f1SDimitry Andric #include "llvm/CodeGen/CallingConvLower.h" 18*fe6060f1SDimitry Andric #include "llvm/CodeGen/MachineFunction.h" 19*fe6060f1SDimitry Andric #include "llvm/Support/MachineValueType.h" 20*fe6060f1SDimitry Andric 21*fe6060f1SDimitry Andric namespace llvm { 22*fe6060f1SDimitry Andric 23*fe6060f1SDimitry Andric class M68kMachineFunctionInfo : public MachineFunctionInfo { 24*fe6060f1SDimitry Andric MachineFunction &MF; 25*fe6060f1SDimitry Andric 26*fe6060f1SDimitry Andric /// Non-zero if the function has base pointer and makes call to 27*fe6060f1SDimitry Andric /// llvm.eh.sjlj.setjmp. When non-zero, the value is a displacement from the 28*fe6060f1SDimitry Andric /// frame pointer to a slot where the base pointer is stashed. 29*fe6060f1SDimitry Andric signed char RestoreBasePointerOffset = 0; 30*fe6060f1SDimitry Andric 31*fe6060f1SDimitry Andric /// Size of the callee-saved register portion of the stack frame in bytes. 32*fe6060f1SDimitry Andric unsigned CalleeSavedFrameSize = 0; 33*fe6060f1SDimitry Andric 34*fe6060f1SDimitry Andric /// Number of bytes function pops on return (in addition to the space used by 35*fe6060f1SDimitry Andric /// the return address). Used on windows platform for stdcall & fastcall 36*fe6060f1SDimitry Andric /// name decoration 37*fe6060f1SDimitry Andric unsigned BytesToPopOnReturn = 0; 38*fe6060f1SDimitry Andric 39*fe6060f1SDimitry Andric /// FrameIndex for return slot. 40*fe6060f1SDimitry Andric int ReturnAddrIndex = 0; 41*fe6060f1SDimitry Andric 42*fe6060f1SDimitry Andric /// The number of bytes by which return address stack slot is moved as the 43*fe6060f1SDimitry Andric /// result of tail call optimization. 44*fe6060f1SDimitry Andric int TailCallReturnAddrDelta = 0; 45*fe6060f1SDimitry Andric 46*fe6060f1SDimitry Andric /// keeps track of the virtual register initialized for use as the global 47*fe6060f1SDimitry Andric /// base register. This is used for PIC in some PIC relocation models. 48*fe6060f1SDimitry Andric unsigned GlobalBaseReg = 0; 49*fe6060f1SDimitry Andric 50*fe6060f1SDimitry Andric /// FrameIndex for start of varargs area. 51*fe6060f1SDimitry Andric int VarArgsFrameIndex = 0; 52*fe6060f1SDimitry Andric 53*fe6060f1SDimitry Andric /// Keeps track of whether this function uses sequences of pushes to pass 54*fe6060f1SDimitry Andric /// function parameters. 55*fe6060f1SDimitry Andric bool HasPushSequences = false; 56*fe6060f1SDimitry Andric 57*fe6060f1SDimitry Andric /// Some subtargets require that sret lowering includes 58*fe6060f1SDimitry Andric /// returning the value of the returned struct in a register. This field 59*fe6060f1SDimitry Andric /// holds the virtual register into which the sret argument is passed. 60*fe6060f1SDimitry Andric unsigned SRetReturnReg = 0; 61*fe6060f1SDimitry Andric 62*fe6060f1SDimitry Andric /// A list of virtual and physical registers that must be forwarded to every 63*fe6060f1SDimitry Andric /// musttail call. 64*fe6060f1SDimitry Andric SmallVector<ForwardedRegister, 1> ForwardedMustTailRegParms; 65*fe6060f1SDimitry Andric 66*fe6060f1SDimitry Andric /// The number of bytes on stack consumed by the arguments being passed on 67*fe6060f1SDimitry Andric /// the stack. 68*fe6060f1SDimitry Andric unsigned ArgumentStackSize = 0; 69*fe6060f1SDimitry Andric 70*fe6060f1SDimitry Andric public: 71*fe6060f1SDimitry Andric explicit M68kMachineFunctionInfo(MachineFunction &MF) : MF(MF) {} 72*fe6060f1SDimitry Andric 73*fe6060f1SDimitry Andric bool getRestoreBasePointer() const { return RestoreBasePointerOffset != 0; } 74*fe6060f1SDimitry Andric void setRestoreBasePointer(const MachineFunction *MF); 75*fe6060f1SDimitry Andric int getRestoreBasePointerOffset() const { return RestoreBasePointerOffset; } 76*fe6060f1SDimitry Andric 77*fe6060f1SDimitry Andric unsigned getCalleeSavedFrameSize() const { return CalleeSavedFrameSize; } 78*fe6060f1SDimitry Andric void setCalleeSavedFrameSize(unsigned bytes) { CalleeSavedFrameSize = bytes; } 79*fe6060f1SDimitry Andric 80*fe6060f1SDimitry Andric unsigned getBytesToPopOnReturn() const { return BytesToPopOnReturn; } 81*fe6060f1SDimitry Andric void setBytesToPopOnReturn(unsigned bytes) { BytesToPopOnReturn = bytes; } 82*fe6060f1SDimitry Andric 83*fe6060f1SDimitry Andric int getRAIndex() const { return ReturnAddrIndex; } 84*fe6060f1SDimitry Andric void setRAIndex(int Index) { ReturnAddrIndex = Index; } 85*fe6060f1SDimitry Andric 86*fe6060f1SDimitry Andric int getTCReturnAddrDelta() const { return TailCallReturnAddrDelta; } 87*fe6060f1SDimitry Andric void setTCReturnAddrDelta(int delta) { TailCallReturnAddrDelta = delta; } 88*fe6060f1SDimitry Andric 89*fe6060f1SDimitry Andric unsigned getGlobalBaseReg() const { return GlobalBaseReg; } 90*fe6060f1SDimitry Andric void setGlobalBaseReg(unsigned Reg) { GlobalBaseReg = Reg; } 91*fe6060f1SDimitry Andric 92*fe6060f1SDimitry Andric int getVarArgsFrameIndex() const { return VarArgsFrameIndex; } 93*fe6060f1SDimitry Andric void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; } 94*fe6060f1SDimitry Andric 95*fe6060f1SDimitry Andric bool getHasPushSequences() const { return HasPushSequences; } 96*fe6060f1SDimitry Andric void setHasPushSequences(bool HasPush) { HasPushSequences = HasPush; } 97*fe6060f1SDimitry Andric 98*fe6060f1SDimitry Andric unsigned getSRetReturnReg() const { return SRetReturnReg; } 99*fe6060f1SDimitry Andric void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; } 100*fe6060f1SDimitry Andric 101*fe6060f1SDimitry Andric unsigned getArgumentStackSize() const { return ArgumentStackSize; } 102*fe6060f1SDimitry Andric void setArgumentStackSize(unsigned size) { ArgumentStackSize = size; } 103*fe6060f1SDimitry Andric 104*fe6060f1SDimitry Andric SmallVectorImpl<ForwardedRegister> &getForwardedMustTailRegParms() { 105*fe6060f1SDimitry Andric return ForwardedMustTailRegParms; 106*fe6060f1SDimitry Andric } 107*fe6060f1SDimitry Andric 108*fe6060f1SDimitry Andric private: 109*fe6060f1SDimitry Andric virtual void anchor(); 110*fe6060f1SDimitry Andric }; 111*fe6060f1SDimitry Andric 112*fe6060f1SDimitry Andric } // end of namespace llvm 113*fe6060f1SDimitry Andric 114*fe6060f1SDimitry Andric #endif // M68K_MACHINE_FUNCTION_INFO_H 115