Path: blob/main/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZMachineFunctionInfo.h
35294 views
//=== SystemZMachineFunctionInfo.h - SystemZ machine function info -*- C++ -*-//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZMACHINEFUNCTIONINFO_H9#define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZMACHINEFUNCTIONINFO_H1011#include "llvm/CodeGen/MachineFunction.h"1213namespace llvm {1415namespace SystemZ {16// A struct to hold the low and high GPR registers to be saved/restored as17// well as the offset into the register save area of the low register.18struct GPRRegs {19unsigned LowGPR = 0;20unsigned HighGPR = 0;21unsigned GPROffset = 0;22GPRRegs() = default;23};24}2526class SystemZMachineFunctionInfo : public MachineFunctionInfo {27virtual void anchor();2829/// Size of expected parameter area for current function. (Fixed args only).30unsigned SizeOfFnParams;3132SystemZ::GPRRegs SpillGPRRegs;33SystemZ::GPRRegs RestoreGPRRegs;34Register VarArgsFirstGPR;35Register VarArgsFirstFPR;36unsigned VarArgsFrameIndex;37unsigned RegSaveFrameIndex;38int FramePointerSaveIndex;39unsigned NumLocalDynamics;40/// z/OS XPLINK ABI: incoming ADA virtual register.41Register VRegADA;4243public:44SystemZMachineFunctionInfo(const Function &F, const TargetSubtargetInfo *STI)45: SizeOfFnParams(0), VarArgsFirstGPR(0), VarArgsFirstFPR(0),46VarArgsFrameIndex(0), RegSaveFrameIndex(0), FramePointerSaveIndex(0),47NumLocalDynamics(0) {}4849MachineFunctionInfo *50clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF,51const DenseMap<MachineBasicBlock *, MachineBasicBlock *> &Src2DstMBB)52const override;5354// z/OS: Get and set the size of the expected parameter area for the55// current function. (ie. Size of param area in caller).56unsigned getSizeOfFnParams() const { return SizeOfFnParams; }57void setSizeOfFnParams(unsigned Size) { SizeOfFnParams = Size; }5859// Get and set the first and last call-saved GPR that should be saved by60// this function and the SP offset for the STMG. These are 0 if no GPRs61// need to be saved or restored.62SystemZ::GPRRegs getSpillGPRRegs() const { return SpillGPRRegs; }63void setSpillGPRRegs(Register Low, Register High, unsigned Offs) {64SpillGPRRegs.LowGPR = Low;65SpillGPRRegs.HighGPR = High;66SpillGPRRegs.GPROffset = Offs;67}6869// Get and set the first and last call-saved GPR that should be restored by70// this function and the SP offset for the LMG. These are 0 if no GPRs71// need to be saved or restored.72SystemZ::GPRRegs getRestoreGPRRegs() const { return RestoreGPRRegs; }73void setRestoreGPRRegs(Register Low, Register High, unsigned Offs) {74RestoreGPRRegs.LowGPR = Low;75RestoreGPRRegs.HighGPR = High;76RestoreGPRRegs.GPROffset = Offs;77}7879// Get and set the number of fixed (as opposed to variable) arguments80// that are passed in GPRs to this function.81Register getVarArgsFirstGPR() const { return VarArgsFirstGPR; }82void setVarArgsFirstGPR(Register GPR) { VarArgsFirstGPR = GPR; }8384// Likewise FPRs.85Register getVarArgsFirstFPR() const { return VarArgsFirstFPR; }86void setVarArgsFirstFPR(Register FPR) { VarArgsFirstFPR = FPR; }8788// Get and set the frame index of the first stack vararg.89unsigned getVarArgsFrameIndex() const { return VarArgsFrameIndex; }90void setVarArgsFrameIndex(unsigned FI) { VarArgsFrameIndex = FI; }9192// Get and set the frame index of the register save area93// (i.e. the incoming stack pointer).94unsigned getRegSaveFrameIndex() const { return RegSaveFrameIndex; }95void setRegSaveFrameIndex(unsigned FI) { RegSaveFrameIndex = FI; }9697// Get and set the frame index of where the old frame pointer is stored.98int getFramePointerSaveIndex() const { return FramePointerSaveIndex; }99void setFramePointerSaveIndex(int Idx) { FramePointerSaveIndex = Idx; }100101// Count number of local-dynamic TLS symbols used.102unsigned getNumLocalDynamicTLSAccesses() const { return NumLocalDynamics; }103void incNumLocalDynamicTLSAccesses() { ++NumLocalDynamics; }104105// Get and set the function's incoming special XPLINK ABI defined ADA106// register.107Register getADAVirtualRegister() const { return VRegADA; }108void setADAVirtualRegister(Register Reg) { VRegADA = Reg; }109};110111} // end namespace llvm112113#endif114115116