1//=== SystemZMachineFunctionInfo.h - SystemZ machine function info -*- C++ -*-//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZMACHINEFUNCTIONINFO_H
10#define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZMACHINEFUNCTIONINFO_H
11
12#include "llvm/CodeGen/MachineFunction.h"
13
14namespace llvm {
15
16namespace SystemZ {
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.
19struct GPRRegs {
20 unsigned LowGPR = 0;
21 unsigned HighGPR = 0;
22 unsigned GPROffset = 0;
23 GPRRegs() = default;
24 };
25}
26
27class SystemZMachineFunctionInfo : public MachineFunctionInfo {
28 virtual void anchor();
29
30 /// Size of expected parameter area for current function. (Fixed args only).
31 unsigned SizeOfFnParams;
32
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.
42 Register VRegADA;
43
44public:
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) {}
49
50 MachineFunctionInfo *
51 clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF,
52 const DenseMap<MachineBasicBlock *, MachineBasicBlock *> &Src2DstMBB)
53 const override;
54
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; }
59
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;
68 }
69
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;
78 }
79
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; }
84
85 // Likewise FPRs.
86 Register getVarArgsFirstFPR() const { return VarArgsFirstFPR; }
87 void setVarArgsFirstFPR(Register FPR) { VarArgsFirstFPR = FPR; }
88
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; }
92
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; }
97
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; }
101
102 // Count number of local-dynamic TLS symbols used.
103 unsigned getNumLocalDynamicTLSAccesses() const { return NumLocalDynamics; }
104 void incNumLocalDynamicTLSAccesses() { ++NumLocalDynamics; }
105
106 // Get and set the function's incoming special XPLINK ABI defined ADA
107 // register.
108 Register getADAVirtualRegister() const { return VRegADA; }
109 void setADAVirtualRegister(Register Reg) { VRegADA = Reg; }
110};
111
112} // end namespace llvm
113
114#endif
115

source code of llvm/lib/Target/SystemZ/SystemZMachineFunctionInfo.h