blob: 4d5fe6dce62daf226e93c633827504bccff2604b [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
Ulrich Weigand5f613df2013-05-06 16:15:19 +000013#include "llvm/ADT/IndexedMap.h"
14#include "llvm/Target/TargetFrameLowering.h"
15
16namespace llvm {
17class SystemZTargetMachine;
18class SystemZSubtarget;
19
20class SystemZFrameLowering : public TargetFrameLowering {
21 IndexedMap<unsigned> RegSpillOffsets;
22
Ulrich Weigand5f613df2013-05-06 16:15:19 +000023public:
Eric Christopherf1bd22d2014-07-01 20:18:59 +000024 SystemZFrameLowering();
Ulrich Weigand5f613df2013-05-06 16:15:19 +000025
Richard Sandiforddb39b4a2013-07-03 09:11:00 +000026 // Override TargetFrameLowering.
Richard Sandifordb4d67b52014-03-06 12:03:36 +000027 bool isFPCloseToIncomingSP() const override { return false; }
28 const SpillSlot *getCalleeSavedSpillSlots(unsigned &NumEntries) const
Craig Topper73156022014-03-02 09:09:27 +000029 override;
Richard Sandifordb4d67b52014-03-06 12:03:36 +000030 void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
31 RegScavenger *RS) const override;
32 bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
33 MachineBasicBlock::iterator MBBI,
34 const std::vector<CalleeSavedInfo> &CSI,
35 const TargetRegisterInfo *TRI) const override;
36 bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
37 MachineBasicBlock::iterator MBBII,
38 const std::vector<CalleeSavedInfo> &CSI,
39 const TargetRegisterInfo *TRI) const
40 override;
41 void processFunctionBeforeFrameFinalized(MachineFunction &MF,
42 RegScavenger *RS) const override;
43 void emitPrologue(MachineFunction &MF) const override;
44 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
45 bool hasFP(const MachineFunction &MF) const override;
46 int getFrameIndexOffset(const MachineFunction &MF, int FI) const override;
47 bool hasReservedCallFrame(const MachineFunction &MF) const override;
48 void eliminateCallFramePseudoInstr(MachineFunction &MF,
49 MachineBasicBlock &MBB,
50 MachineBasicBlock::iterator MI) const
51 override;
Ulrich Weigand5f613df2013-05-06 16:15:19 +000052
Ulrich Weigand5f613df2013-05-06 16:15:19 +000053 // Return the number of bytes in the callee-allocated part of the frame.
54 uint64_t getAllocatedStackSize(const MachineFunction &MF) const;
55
Ulrich Weigand5f613df2013-05-06 16:15:19 +000056 // Return the byte offset from the incoming stack pointer of Reg's
57 // ABI-defined save slot. Return 0 if no slot is defined for Reg.
58 unsigned getRegSpillOffset(unsigned Reg) const {
59 return RegSpillOffsets[Reg];
60 }
61};
62} // end namespace llvm
63
64#endif