1 //===-- SystemZFrameLowering.h - Frame lowering for SystemZ -----*- C++ -*-===// 2 // 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 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZFRAMELOWERING_H 10 #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZFRAMELOWERING_H 11 12 #include "llvm/ADT/IndexedMap.h" 13 #include "llvm/CodeGen/TargetFrameLowering.h" 14 15 namespace llvm { 16 class SystemZTargetMachine; 17 class SystemZSubtarget; 18 19 class SystemZFrameLowering : public TargetFrameLowering { 20 IndexedMap<unsigned> RegSpillOffsets; 21 22 public: 23 SystemZFrameLowering(); 24 25 // Override TargetFrameLowering. 26 bool isFPCloseToIncomingSP() const override { return false; } 27 bool 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 ArrayRef<CalleeSavedInfo> CSI, 36 const TargetRegisterInfo *TRI) const override; 37 bool 38 restoreCalleeSavedRegisters(MachineBasicBlock &MBB, 39 MachineBasicBlock::iterator MBBII, 40 MutableArrayRef<CalleeSavedInfo> CSI, 41 const TargetRegisterInfo *TRI) const override; 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 void inlineStackProbe(MachineFunction &MF, 47 MachineBasicBlock &PrologMBB) const override; 48 bool hasFP(const MachineFunction &MF) const override; 49 bool hasReservedCallFrame(const MachineFunction &MF) const override; 50 int getFrameIndexReference(const MachineFunction &MF, int FI, 51 Register &FrameReg) const override; 52 MachineBasicBlock::iterator 53 eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, 54 MachineBasicBlock::iterator MI) const override; 55 56 // Return the byte offset from the incoming stack pointer of Reg's 57 // ABI-defined save slot. Return 0 if no slot is defined for Reg. Adjust 58 // the offset in case MF has packed-stack. 59 unsigned getRegSpillOffset(MachineFunction &MF, Register Reg) const; 60 61 // Get or create the frame index of where the old frame pointer is stored. 62 int getOrCreateFramePointerSaveIndex(MachineFunction &MF) const; 63 64 bool usePackedStack(MachineFunction &MF) const; 65 }; 66 } // end namespace llvm 67 68 #endif 69