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 virtual bool isFPCloseToIncomingSP() const LLVM_OVERRIDE { return false; }
34 virtual const SpillSlot *getCalleeSavedSpillSlots(unsigned &NumEntries) const
37 processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
38 RegScavenger *RS) const LLVM_OVERRIDE;
40 spillCalleeSavedRegisters(MachineBasicBlock &MBB,
41 MachineBasicBlock::iterator MBBI,
42 const std::vector<CalleeSavedInfo> &CSI,
43 const TargetRegisterInfo *TRI) const
46 restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
47 MachineBasicBlock::iterator MBBII,
48 const std::vector<CalleeSavedInfo> &CSI,
49 const TargetRegisterInfo *TRI) const
51 virtual void processFunctionBeforeFrameFinalized(MachineFunction &MF,
52 RegScavenger *RS) const;
53 virtual void emitPrologue(MachineFunction &MF) const LLVM_OVERRIDE;
54 virtual void emitEpilogue(MachineFunction &MF,
55 MachineBasicBlock &MBB) const LLVM_OVERRIDE;
56 virtual bool hasFP(const MachineFunction &MF) const LLVM_OVERRIDE;
57 virtual int getFrameIndexOffset(const MachineFunction &MF,
58 int FI) const LLVM_OVERRIDE;
59 virtual bool hasReservedCallFrame(const MachineFunction &MF) const
62 eliminateCallFramePseudoInstr(MachineFunction &MF,
63 MachineBasicBlock &MBB,
64 MachineBasicBlock::iterator MI) const
67 // Return the number of bytes in the callee-allocated part of the frame.
68 uint64_t getAllocatedStackSize(const MachineFunction &MF) const;
70 // Return the byte offset from the incoming stack pointer of Reg's
71 // ABI-defined save slot. Return 0 if no slot is defined for Reg.
72 unsigned getRegSpillOffset(unsigned Reg) const {
73 return RegSpillOffsets[Reg];
76 } // end namespace llvm