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 #include "llvm/Support/TypeSize.h" 15 16 namespace llvm { 17 class SystemZTargetMachine; 18 class SystemZSubtarget; 19 20 class SystemZFrameLowering : public TargetFrameLowering { 21 IndexedMap<unsigned> RegSpillOffsets; 22 23 public: 24 SystemZFrameLowering(); 25 26 // Override TargetFrameLowering. isFPCloseToIncomingSP()27 bool isFPCloseToIncomingSP() const override { return false; } 28 bool 29 assignCalleeSavedSpillSlots(MachineFunction &MF, 30 const TargetRegisterInfo *TRI, 31 std::vector<CalleeSavedInfo> &CSI) const override; 32 void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, 33 RegScavenger *RS) const override; 34 bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, 35 MachineBasicBlock::iterator MBBI, 36 ArrayRef<CalleeSavedInfo> CSI, 37 const TargetRegisterInfo *TRI) const override; 38 bool 39 restoreCalleeSavedRegisters(MachineBasicBlock &MBB, 40 MachineBasicBlock::iterator MBBII, 41 MutableArrayRef<CalleeSavedInfo> CSI, 42 const TargetRegisterInfo *TRI) const override; 43 void processFunctionBeforeFrameFinalized(MachineFunction &MF, 44 RegScavenger *RS) const override; 45 void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override; 46 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override; 47 void inlineStackProbe(MachineFunction &MF, 48 MachineBasicBlock &PrologMBB) const override; 49 bool hasFP(const MachineFunction &MF) const override; 50 bool hasReservedCallFrame(const MachineFunction &MF) const override; 51 StackOffset getFrameIndexReference(const MachineFunction &MF, int FI, 52 Register &FrameReg) const override; 53 MachineBasicBlock::iterator 54 eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, 55 MachineBasicBlock::iterator MI) const override; 56 57 // Return the byte offset from the incoming stack pointer of Reg's 58 // ABI-defined save slot. Return 0 if no slot is defined for Reg. Adjust 59 // the offset in case MF has packed-stack. 60 unsigned getRegSpillOffset(MachineFunction &MF, Register Reg) const; 61 62 // Get or create the frame index of where the old frame pointer is stored. 63 int getOrCreateFramePointerSaveIndex(MachineFunction &MF) const; 64 65 bool usePackedStack(MachineFunction &MF) const; 66 }; 67 } // end namespace llvm 68 69 #endif 70