1 //===-- SystemZFrameLowering.h - Frame lowering for SystemZ -----*- 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_SYSTEMZFRAMELOWERING_H
10 #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZFRAMELOWERING_H
12 #include "llvm/ADT/IndexedMap.h"
13 #include "llvm/CodeGen/TargetFrameLowering.h"
16 class SystemZTargetMachine;
17 class SystemZSubtarget;
19 class SystemZFrameLowering : public TargetFrameLowering {
20 IndexedMap<unsigned> RegSpillOffsets;
23 SystemZFrameLowering();
25 // Override TargetFrameLowering.
26 bool isFPCloseToIncomingSP() const override { return false; }
27 const SpillSlot *getCalleeSavedSpillSlots(unsigned &NumEntries) const
29 void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
30 RegScavenger *RS) const override;
31 bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
32 MachineBasicBlock::iterator MBBI,
33 const std::vector<CalleeSavedInfo> &CSI,
34 const TargetRegisterInfo *TRI) const override;
35 bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
36 MachineBasicBlock::iterator MBBII,
37 std::vector<CalleeSavedInfo> &CSI,
38 const TargetRegisterInfo *TRI) const
40 void processFunctionBeforeFrameFinalized(MachineFunction &MF,
41 RegScavenger *RS) const override;
42 void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
43 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
44 bool hasFP(const MachineFunction &MF) const override;
45 bool hasReservedCallFrame(const MachineFunction &MF) const override;
46 MachineBasicBlock::iterator
47 eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
48 MachineBasicBlock::iterator MI) const override;
50 // Return the byte offset from the incoming stack pointer of Reg's
51 // ABI-defined save slot. Return 0 if no slot is defined for Reg.
52 unsigned getRegSpillOffset(unsigned Reg) const {
53 return RegSpillOffsets[Reg];
56 } // end namespace llvm