Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 1 | //===-- 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 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 10 | #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZFRAMELOWERING_H |
| 11 | #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZFRAMELOWERING_H |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 12 | |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 13 | #include "llvm/ADT/IndexedMap.h" |
| 14 | #include "llvm/Target/TargetFrameLowering.h" |
| 15 | |
| 16 | namespace llvm { |
| 17 | class SystemZTargetMachine; |
| 18 | class SystemZSubtarget; |
| 19 | |
| 20 | class SystemZFrameLowering : public TargetFrameLowering { |
| 21 | IndexedMap<unsigned> RegSpillOffsets; |
| 22 | |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 23 | public: |
Eric Christopher | f1bd22d | 2014-07-01 20:18:59 +0000 | [diff] [blame] | 24 | SystemZFrameLowering(); |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 25 | |
Richard Sandiford | db39b4a | 2013-07-03 09:11:00 +0000 | [diff] [blame] | 26 | // Override TargetFrameLowering. |
Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 27 | bool isFPCloseToIncomingSP() const override { return false; } |
| 28 | const SpillSlot *getCalleeSavedSpillSlots(unsigned &NumEntries) const |
Craig Topper | 7315602 | 2014-03-02 09:09:27 +0000 | [diff] [blame] | 29 | override; |
Matthias Braun | 0256486 | 2015-07-14 17:17:13 +0000 | [diff] [blame] | 30 | void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, |
| 31 | RegScavenger *RS) const override; |
Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 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; |
Quentin Colombet | 61b305e | 2015-05-05 17:38:16 +0000 | [diff] [blame] | 43 | void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override; |
Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 44 | void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override; |
| 45 | bool hasFP(const MachineFunction &MF) const override; |
James Y Knight | 5567baf | 2015-08-15 02:32:35 +0000 | [diff] [blame] | 46 | int getFrameIndexReference(const MachineFunction &MF, int FI, |
| 47 | unsigned &FrameReg) const override; |
Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 48 | bool hasReservedCallFrame(const MachineFunction &MF) const override; |
Hans Wennborg | e1a2e90 | 2016-03-31 18:33:38 +0000 | [diff] [blame] | 49 | MachineBasicBlock::iterator |
| 50 | eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, |
| 51 | MachineBasicBlock::iterator MI) const override; |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 52 | |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 53 | // Return the number of bytes in the callee-allocated part of the frame. |
| 54 | uint64_t getAllocatedStackSize(const MachineFunction &MF) const; |
| 55 | |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 56 | // 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 |