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.
23 GPRRegs() : LowGPR(0), HighGPR(0), GPROffset(0) {}
27 class SystemZMachineFunctionInfo : public MachineFunctionInfo {
28 virtual void anchor();
30 SystemZ::GPRRegs SpillGPRRegs;
31 SystemZ::GPRRegs RestoreGPRRegs;
32 Register VarArgsFirstGPR;
33 Register VarArgsFirstFPR;
34 unsigned VarArgsFrameIndex;
35 unsigned RegSaveFrameIndex;
36 int FramePointerSaveIndex;
38 unsigned NumLocalDynamics;
41 explicit SystemZMachineFunctionInfo(MachineFunction &MF)
42 : VarArgsFirstGPR(0), VarArgsFirstFPR(0), VarArgsFrameIndex(0),
43 RegSaveFrameIndex(0), FramePointerSaveIndex(0), ManipulatesSP(false),
44 NumLocalDynamics(0) {}
46 // Get and set the first and last call-saved GPR that should be saved by
47 // this function and the SP offset for the STMG. These are 0 if no GPRs
48 // need to be saved or restored.
49 SystemZ::GPRRegs getSpillGPRRegs() const { return SpillGPRRegs; }
50 void setSpillGPRRegs(Register Low, Register High, unsigned Offs) {
51 SpillGPRRegs.LowGPR = Low;
52 SpillGPRRegs.HighGPR = High;
53 SpillGPRRegs.GPROffset = Offs;
56 // Get and set the first and last call-saved GPR that should be restored by
57 // this function and the SP offset for the LMG. These are 0 if no GPRs
58 // need to be saved or restored.
59 SystemZ::GPRRegs getRestoreGPRRegs() const { return RestoreGPRRegs; }
60 void setRestoreGPRRegs(Register Low, Register High, unsigned Offs) {
61 RestoreGPRRegs.LowGPR = Low;
62 RestoreGPRRegs.HighGPR = High;
63 RestoreGPRRegs.GPROffset = Offs;
66 // Get and set the number of fixed (as opposed to variable) arguments
67 // that are passed in GPRs to this function.
68 Register getVarArgsFirstGPR() const { return VarArgsFirstGPR; }
69 void setVarArgsFirstGPR(Register GPR) { VarArgsFirstGPR = GPR; }
72 Register getVarArgsFirstFPR() const { return VarArgsFirstFPR; }
73 void setVarArgsFirstFPR(Register FPR) { VarArgsFirstFPR = FPR; }
75 // Get and set the frame index of the first stack vararg.
76 unsigned getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
77 void setVarArgsFrameIndex(unsigned FI) { VarArgsFrameIndex = FI; }
79 // Get and set the frame index of the register save area
80 // (i.e. the incoming stack pointer).
81 unsigned getRegSaveFrameIndex() const { return RegSaveFrameIndex; }
82 void setRegSaveFrameIndex(unsigned FI) { RegSaveFrameIndex = FI; }
84 // Get and set the frame index of where the old frame pointer is stored.
85 int getFramePointerSaveIndex() const { return FramePointerSaveIndex; }
86 void setFramePointerSaveIndex(int Idx) { FramePointerSaveIndex = Idx; }
88 // Get and set whether the function directly manipulates the stack pointer,
89 // e.g. through STACKSAVE or STACKRESTORE.
90 bool getManipulatesSP() const { return ManipulatesSP; }
91 void setManipulatesSP(bool MSP) { ManipulatesSP = MSP; }
93 // Count number of local-dynamic TLS symbols used.
94 unsigned getNumLocalDynamicTLSAccesses() const { return NumLocalDynamics; }
95 void incNumLocalDynamicTLSAccesses() { ++NumLocalDynamics; }
98 } // end namespace llvm