blob: 70e25fb243b2945f76f70e35c02460900643d170 [file] [log] [blame]
Ulrich Weigand5f613df2013-05-06 16:15:19 +00001//===-- SystemZFrameLowering.h - Frame lowering for SystemZ -----*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef SYSTEMZFRAMELOWERING_H
11#define SYSTEMZFRAMELOWERING_H
12
13#include "SystemZSubtarget.h"
14#include "llvm/ADT/IndexedMap.h"
15#include "llvm/Target/TargetFrameLowering.h"
16
17namespace llvm {
18class SystemZTargetMachine;
19class SystemZSubtarget;
20
21class SystemZFrameLowering : public TargetFrameLowering {
22 IndexedMap<unsigned> RegSpillOffsets;
23
24protected:
25 const SystemZTargetMachine &TM;
26 const SystemZSubtarget &STI;
27
28public:
29 SystemZFrameLowering(const SystemZTargetMachine &tm,
30 const SystemZSubtarget &sti);
31
Richard Sandiforddb39b4a2013-07-03 09:11:00 +000032 // Override TargetFrameLowering.
Richard Sandifordb4d67b52014-03-06 12:03:36 +000033 bool isFPCloseToIncomingSP() const override { return false; }
34 const SpillSlot *getCalleeSavedSpillSlots(unsigned &NumEntries) const
Craig Topper73156022014-03-02 09:09:27 +000035 override;
Richard Sandifordb4d67b52014-03-06 12:03:36 +000036 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
46 override;
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
57 override;
Ulrich Weigand5f613df2013-05-06 16:15:19 +000058
Ulrich Weigand5f613df2013-05-06 16:15:19 +000059 // Return the number of bytes in the callee-allocated part of the frame.
60 uint64_t getAllocatedStackSize(const MachineFunction &MF) const;
61
Ulrich Weigand5f613df2013-05-06 16:15:19 +000062 // 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];
66 }
67};
68} // end namespace llvm
69
70#endif