10b57cec5SDimitry Andric //===-- SystemZFrameLowering.h - Frame lowering for SystemZ -----*- C++ -*-===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric 90b57cec5SDimitry Andric #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZFRAMELOWERING_H 100b57cec5SDimitry Andric #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZFRAMELOWERING_H 110b57cec5SDimitry Andric 120b57cec5SDimitry Andric #include "llvm/ADT/IndexedMap.h" 130b57cec5SDimitry Andric #include "llvm/CodeGen/TargetFrameLowering.h" 140b57cec5SDimitry Andric 150b57cec5SDimitry Andric namespace llvm { 160b57cec5SDimitry Andric class SystemZTargetMachine; 170b57cec5SDimitry Andric class SystemZSubtarget; 180b57cec5SDimitry Andric 190b57cec5SDimitry Andric class SystemZFrameLowering : public TargetFrameLowering { 200b57cec5SDimitry Andric IndexedMap<unsigned> RegSpillOffsets; 210b57cec5SDimitry Andric 220b57cec5SDimitry Andric public: 230b57cec5SDimitry Andric SystemZFrameLowering(); 240b57cec5SDimitry Andric 250b57cec5SDimitry Andric // Override TargetFrameLowering. 260b57cec5SDimitry Andric bool isFPCloseToIncomingSP() const override { return false; } 27480093f4SDimitry Andric bool 28480093f4SDimitry Andric assignCalleeSavedSpillSlots(MachineFunction &MF, 29480093f4SDimitry Andric const TargetRegisterInfo *TRI, 30480093f4SDimitry Andric std::vector<CalleeSavedInfo> &CSI) const override; 310b57cec5SDimitry Andric void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, 320b57cec5SDimitry Andric RegScavenger *RS) const override; 330b57cec5SDimitry Andric bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, 340b57cec5SDimitry Andric MachineBasicBlock::iterator MBBI, 35*5ffd83dbSDimitry Andric ArrayRef<CalleeSavedInfo> CSI, 360b57cec5SDimitry Andric const TargetRegisterInfo *TRI) const override; 37*5ffd83dbSDimitry Andric bool 38*5ffd83dbSDimitry Andric restoreCalleeSavedRegisters(MachineBasicBlock &MBB, 390b57cec5SDimitry Andric MachineBasicBlock::iterator MBBII, 40*5ffd83dbSDimitry Andric MutableArrayRef<CalleeSavedInfo> CSI, 41*5ffd83dbSDimitry Andric const TargetRegisterInfo *TRI) const override; 420b57cec5SDimitry Andric void processFunctionBeforeFrameFinalized(MachineFunction &MF, 430b57cec5SDimitry Andric RegScavenger *RS) const override; 440b57cec5SDimitry Andric void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override; 450b57cec5SDimitry Andric void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override; 46*5ffd83dbSDimitry Andric void inlineStackProbe(MachineFunction &MF, 47*5ffd83dbSDimitry Andric MachineBasicBlock &PrologMBB) const override; 480b57cec5SDimitry Andric bool hasFP(const MachineFunction &MF) const override; 490b57cec5SDimitry Andric bool hasReservedCallFrame(const MachineFunction &MF) const override; 50480093f4SDimitry Andric int getFrameIndexReference(const MachineFunction &MF, int FI, 51*5ffd83dbSDimitry Andric Register &FrameReg) const override; 520b57cec5SDimitry Andric MachineBasicBlock::iterator 530b57cec5SDimitry Andric eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, 540b57cec5SDimitry Andric MachineBasicBlock::iterator MI) const override; 550b57cec5SDimitry Andric 560b57cec5SDimitry Andric // Return the byte offset from the incoming stack pointer of Reg's 57*5ffd83dbSDimitry Andric // ABI-defined save slot. Return 0 if no slot is defined for Reg. Adjust 58*5ffd83dbSDimitry Andric // the offset in case MF has packed-stack. 59*5ffd83dbSDimitry Andric unsigned getRegSpillOffset(MachineFunction &MF, Register Reg) const; 60480093f4SDimitry Andric 61480093f4SDimitry Andric // Get or create the frame index of where the old frame pointer is stored. 62480093f4SDimitry Andric int getOrCreateFramePointerSaveIndex(MachineFunction &MF) const; 63*5ffd83dbSDimitry Andric 64*5ffd83dbSDimitry Andric bool usePackedStack(MachineFunction &MF) const; 650b57cec5SDimitry Andric }; 660b57cec5SDimitry Andric } // end namespace llvm 670b57cec5SDimitry Andric 680b57cec5SDimitry Andric #endif 69