1 //===-- SystemZFrameLowering.h - Frame lowering for SystemZ -----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef SYSTEMZFRAMELOWERING_H
11 #define SYSTEMZFRAMELOWERING_H
13 #include "SystemZSubtarget.h"
14 #include "llvm/ADT/IndexedMap.h"
15 #include "llvm/Target/TargetFrameLowering.h"
18 class SystemZTargetMachine;
19 class SystemZSubtarget;
21 class SystemZFrameLowering : public TargetFrameLowering {
22 IndexedMap<unsigned> RegSpillOffsets;
25 const SystemZTargetMachine &TM;
26 const SystemZSubtarget &STI;
29 SystemZFrameLowering(const SystemZTargetMachine &tm,
30 const SystemZSubtarget &sti);
32 // Override TargetFrameLowering.
33 bool isFPCloseToIncomingSP() const override { return false; }
34 const SpillSlot *getCalleeSavedSpillSlots(unsigned &NumEntries) const
36 void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
37 RegScavenger *RS) const override;
38 bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
39 MachineBasicBlock::iterator MBBI,
40 const std::vector<CalleeSavedInfo> &CSI,
41 const TargetRegisterInfo *TRI) const override;
42 bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
43 MachineBasicBlock::iterator MBBII,
44 const std::vector<CalleeSavedInfo> &CSI,
45 const TargetRegisterInfo *TRI) const
47 void processFunctionBeforeFrameFinalized(MachineFunction &MF,
48 RegScavenger *RS) const override;
49 void emitPrologue(MachineFunction &MF) const override;
50 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
51 bool hasFP(const MachineFunction &MF) const override;
52 int getFrameIndexOffset(const MachineFunction &MF, int FI) const override;
53 bool hasReservedCallFrame(const MachineFunction &MF) const override;
54 void eliminateCallFramePseudoInstr(MachineFunction &MF,
55 MachineBasicBlock &MBB,
56 MachineBasicBlock::iterator MI) const
59 // Return the number of bytes in the callee-allocated part of the frame.
60 uint64_t getAllocatedStackSize(const MachineFunction &MF) const;
62 // Return the byte offset from the incoming stack pointer of Reg's
63 // ABI-defined save slot. Return 0 if no slot is defined for Reg.
64 unsigned getRegSpillOffset(unsigned Reg) const {
65 return RegSpillOffsets[Reg];
68 } // end namespace llvm