10b57cec5SDimitry Andric //=== SystemZMachineFunctionInfo.h - SystemZ 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 #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZMACHINEFUNCTIONINFO_H 100b57cec5SDimitry Andric #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZMACHINEFUNCTIONINFO_H 110b57cec5SDimitry Andric 120b57cec5SDimitry Andric #include "llvm/CodeGen/MachineFunction.h" 130b57cec5SDimitry Andric 140b57cec5SDimitry Andric namespace llvm { 150b57cec5SDimitry Andric 16480093f4SDimitry Andric namespace SystemZ { 17480093f4SDimitry Andric // A struct to hold the low and high GPR registers to be saved/restored as 18480093f4SDimitry Andric // well as the offset into the register save area of the low register. 19480093f4SDimitry Andric struct GPRRegs { 20480093f4SDimitry Andric unsigned LowGPR; 21480093f4SDimitry Andric unsigned HighGPR; 22480093f4SDimitry Andric unsigned GPROffset; 23480093f4SDimitry Andric GPRRegs() : LowGPR(0), HighGPR(0), GPROffset(0) {} 24480093f4SDimitry Andric }; 25480093f4SDimitry Andric } 26480093f4SDimitry Andric 270b57cec5SDimitry Andric class SystemZMachineFunctionInfo : public MachineFunctionInfo { 280b57cec5SDimitry Andric virtual void anchor(); 29480093f4SDimitry Andric 30480093f4SDimitry Andric SystemZ::GPRRegs SpillGPRRegs; 31480093f4SDimitry Andric SystemZ::GPRRegs RestoreGPRRegs; 325ffd83dbSDimitry Andric Register VarArgsFirstGPR; 335ffd83dbSDimitry Andric Register VarArgsFirstFPR; 340b57cec5SDimitry Andric unsigned VarArgsFrameIndex; 350b57cec5SDimitry Andric unsigned RegSaveFrameIndex; 360b57cec5SDimitry Andric int FramePointerSaveIndex; 370b57cec5SDimitry Andric unsigned NumLocalDynamics; 380b57cec5SDimitry Andric 390b57cec5SDimitry Andric public: 400b57cec5SDimitry Andric explicit SystemZMachineFunctionInfo(MachineFunction &MF) 41480093f4SDimitry Andric : VarArgsFirstGPR(0), VarArgsFirstFPR(0), VarArgsFrameIndex(0), 42*04eeddc0SDimitry Andric RegSaveFrameIndex(0), FramePointerSaveIndex(0), NumLocalDynamics(0) {} 430b57cec5SDimitry Andric 44480093f4SDimitry Andric // Get and set the first and last call-saved GPR that should be saved by 45480093f4SDimitry Andric // this function and the SP offset for the STMG. These are 0 if no GPRs 46480093f4SDimitry Andric // need to be saved or restored. 47480093f4SDimitry Andric SystemZ::GPRRegs getSpillGPRRegs() const { return SpillGPRRegs; } 485ffd83dbSDimitry Andric void setSpillGPRRegs(Register Low, Register High, unsigned Offs) { 49480093f4SDimitry Andric SpillGPRRegs.LowGPR = Low; 50480093f4SDimitry Andric SpillGPRRegs.HighGPR = High; 51480093f4SDimitry Andric SpillGPRRegs.GPROffset = Offs; 52480093f4SDimitry Andric } 530b57cec5SDimitry Andric 54480093f4SDimitry Andric // Get and set the first and last call-saved GPR that should be restored by 55480093f4SDimitry Andric // this function and the SP offset for the LMG. These are 0 if no GPRs 56480093f4SDimitry Andric // need to be saved or restored. 57480093f4SDimitry Andric SystemZ::GPRRegs getRestoreGPRRegs() const { return RestoreGPRRegs; } 585ffd83dbSDimitry Andric void setRestoreGPRRegs(Register Low, Register High, unsigned Offs) { 59480093f4SDimitry Andric RestoreGPRRegs.LowGPR = Low; 60480093f4SDimitry Andric RestoreGPRRegs.HighGPR = High; 61480093f4SDimitry Andric RestoreGPRRegs.GPROffset = Offs; 62480093f4SDimitry Andric } 630b57cec5SDimitry Andric 640b57cec5SDimitry Andric // Get and set the number of fixed (as opposed to variable) arguments 650b57cec5SDimitry Andric // that are passed in GPRs to this function. 665ffd83dbSDimitry Andric Register getVarArgsFirstGPR() const { return VarArgsFirstGPR; } 675ffd83dbSDimitry Andric void setVarArgsFirstGPR(Register GPR) { VarArgsFirstGPR = GPR; } 680b57cec5SDimitry Andric 690b57cec5SDimitry Andric // Likewise FPRs. 705ffd83dbSDimitry Andric Register getVarArgsFirstFPR() const { return VarArgsFirstFPR; } 715ffd83dbSDimitry Andric void setVarArgsFirstFPR(Register FPR) { VarArgsFirstFPR = FPR; } 720b57cec5SDimitry Andric 730b57cec5SDimitry Andric // Get and set the frame index of the first stack vararg. 740b57cec5SDimitry Andric unsigned getVarArgsFrameIndex() const { return VarArgsFrameIndex; } 750b57cec5SDimitry Andric void setVarArgsFrameIndex(unsigned FI) { VarArgsFrameIndex = FI; } 760b57cec5SDimitry Andric 770b57cec5SDimitry Andric // Get and set the frame index of the register save area 780b57cec5SDimitry Andric // (i.e. the incoming stack pointer). 790b57cec5SDimitry Andric unsigned getRegSaveFrameIndex() const { return RegSaveFrameIndex; } 800b57cec5SDimitry Andric void setRegSaveFrameIndex(unsigned FI) { RegSaveFrameIndex = FI; } 810b57cec5SDimitry Andric 820b57cec5SDimitry Andric // Get and set the frame index of where the old frame pointer is stored. 830b57cec5SDimitry Andric int getFramePointerSaveIndex() const { return FramePointerSaveIndex; } 840b57cec5SDimitry Andric void setFramePointerSaveIndex(int Idx) { FramePointerSaveIndex = Idx; } 850b57cec5SDimitry Andric 860b57cec5SDimitry Andric // Count number of local-dynamic TLS symbols used. 870b57cec5SDimitry Andric unsigned getNumLocalDynamicTLSAccesses() const { return NumLocalDynamics; } 880b57cec5SDimitry Andric void incNumLocalDynamicTLSAccesses() { ++NumLocalDynamics; } 890b57cec5SDimitry Andric }; 900b57cec5SDimitry Andric 910b57cec5SDimitry Andric } // end namespace llvm 920b57cec5SDimitry Andric 930b57cec5SDimitry Andric #endif 94