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