1 //=== SystemZMachineFunctionInfo.h - SystemZ machine function info -*- C++ -*-//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZMACHINEFUNCTIONINFO_H
10 #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZMACHINEFUNCTIONINFO_H
12 #include "llvm/CodeGen/MachineFunction.h"
17 // A struct to hold the low and high GPR registers to be saved/restored as
18 // well as the offset into the register save area of the low register.
22 unsigned GPROffset
= 0;
27 class SystemZMachineFunctionInfo
: public MachineFunctionInfo
{
28 virtual void anchor();
30 /// Size of expected parameter area for current function. (Fixed args only).
31 unsigned SizeOfFnParams
;
33 SystemZ::GPRRegs SpillGPRRegs
;
34 SystemZ::GPRRegs RestoreGPRRegs
;
35 Register VarArgsFirstGPR
;
36 Register VarArgsFirstFPR
;
37 unsigned VarArgsFrameIndex
;
38 unsigned RegSaveFrameIndex
;
39 int FramePointerSaveIndex
;
40 unsigned NumLocalDynamics
;
41 /// z/OS XPLINK ABI: incoming ADA virtual register.
45 SystemZMachineFunctionInfo(const Function
&F
, const TargetSubtargetInfo
*STI
)
46 : SizeOfFnParams(0), VarArgsFirstGPR(0), VarArgsFirstFPR(0),
47 VarArgsFrameIndex(0), RegSaveFrameIndex(0), FramePointerSaveIndex(0),
48 NumLocalDynamics(0) {}
51 clone(BumpPtrAllocator
&Allocator
, MachineFunction
&DestMF
,
52 const DenseMap
<MachineBasicBlock
*, MachineBasicBlock
*> &Src2DstMBB
)
55 // z/OS: Get and set the size of the expected parameter area for the
56 // current function. (ie. Size of param area in caller).
57 unsigned getSizeOfFnParams() const { return SizeOfFnParams
; }
58 void setSizeOfFnParams(unsigned Size
) { SizeOfFnParams
= Size
; }
60 // Get and set the first and last call-saved GPR that should be saved by
61 // this function and the SP offset for the STMG. These are 0 if no GPRs
62 // need to be saved or restored.
63 SystemZ::GPRRegs
getSpillGPRRegs() const { return SpillGPRRegs
; }
64 void setSpillGPRRegs(Register Low
, Register High
, unsigned Offs
) {
65 SpillGPRRegs
.LowGPR
= Low
;
66 SpillGPRRegs
.HighGPR
= High
;
67 SpillGPRRegs
.GPROffset
= Offs
;
70 // Get and set the first and last call-saved GPR that should be restored by
71 // this function and the SP offset for the LMG. These are 0 if no GPRs
72 // need to be saved or restored.
73 SystemZ::GPRRegs
getRestoreGPRRegs() const { return RestoreGPRRegs
; }
74 void setRestoreGPRRegs(Register Low
, Register High
, unsigned Offs
) {
75 RestoreGPRRegs
.LowGPR
= Low
;
76 RestoreGPRRegs
.HighGPR
= High
;
77 RestoreGPRRegs
.GPROffset
= Offs
;
80 // Get and set the number of fixed (as opposed to variable) arguments
81 // that are passed in GPRs to this function.
82 Register
getVarArgsFirstGPR() const { return VarArgsFirstGPR
; }
83 void setVarArgsFirstGPR(Register GPR
) { VarArgsFirstGPR
= GPR
; }
86 Register
getVarArgsFirstFPR() const { return VarArgsFirstFPR
; }
87 void setVarArgsFirstFPR(Register FPR
) { VarArgsFirstFPR
= FPR
; }
89 // Get and set the frame index of the first stack vararg.
90 unsigned getVarArgsFrameIndex() const { return VarArgsFrameIndex
; }
91 void setVarArgsFrameIndex(unsigned FI
) { VarArgsFrameIndex
= FI
; }
93 // Get and set the frame index of the register save area
94 // (i.e. the incoming stack pointer).
95 unsigned getRegSaveFrameIndex() const { return RegSaveFrameIndex
; }
96 void setRegSaveFrameIndex(unsigned FI
) { RegSaveFrameIndex
= FI
; }
98 // Get and set the frame index of where the old frame pointer is stored.
99 int getFramePointerSaveIndex() const { return FramePointerSaveIndex
; }
100 void setFramePointerSaveIndex(int Idx
) { FramePointerSaveIndex
= Idx
; }
102 // Count number of local-dynamic TLS symbols used.
103 unsigned getNumLocalDynamicTLSAccesses() const { return NumLocalDynamics
; }
104 void incNumLocalDynamicTLSAccesses() { ++NumLocalDynamics
; }
106 // Get and set the function's incoming special XPLINK ABI defined ADA
108 Register
getADAVirtualRegister() const { return VRegADA
; }
109 void setADAVirtualRegister(Register Reg
) { VRegADA
= Reg
; }
112 } // end namespace llvm