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; }
28 assignCalleeSavedSpillSlots(MachineFunction &MF,
29 const TargetRegisterInfo *TRI,
30 std::vector<CalleeSavedInfo> &CSI) const override;
31 void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
32 RegScavenger *RS) const override;
33 bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
34 MachineBasicBlock::iterator MBBI,
35 const std::vector<CalleeSavedInfo> &CSI,
36 const TargetRegisterInfo *TRI) const override;
37 bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
38 MachineBasicBlock::iterator MBBII,
39 std::vector<CalleeSavedInfo> &CSI,
40 const TargetRegisterInfo *TRI) const
42 void processFunctionBeforeFrameFinalized(MachineFunction &MF,
43 RegScavenger *RS) const override;
44 void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
45 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
46 bool hasFP(const MachineFunction &MF) const override;
47 bool hasReservedCallFrame(const MachineFunction &MF) const override;
48 int getFrameIndexReference(const MachineFunction &MF, int FI,
49 unsigned &FrameReg) const override;
50 MachineBasicBlock::iterator
51 eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
52 MachineBasicBlock::iterator MI) const override;
54 // Return the byte offset from the incoming stack pointer of Reg's
55 // ABI-defined save slot. Return 0 if no slot is defined for Reg.
56 unsigned getRegSpillOffset(unsigned Reg) const {
57 return RegSpillOffsets[Reg];
60 // Get or create the frame index of where the old frame pointer is stored.
61 int getOrCreateFramePointerSaveIndex(MachineFunction &MF) const;
63 } // end namespace llvm