]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZFrameLowering.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm-project / llvm / lib / Target / SystemZ / SystemZFrameLowering.h
1 //===-- SystemZFrameLowering.h - Frame lowering for SystemZ -----*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZFRAMELOWERING_H
10 #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZFRAMELOWERING_H
11
12 #include "llvm/ADT/IndexedMap.h"
13 #include "llvm/CodeGen/TargetFrameLowering.h"
14
15 namespace llvm {
16 class SystemZTargetMachine;
17 class SystemZSubtarget;
18
19 class SystemZFrameLowering : public TargetFrameLowering {
20   IndexedMap<unsigned> RegSpillOffsets;
21
22 public:
23   SystemZFrameLowering();
24
25   // Override TargetFrameLowering.
26   bool isFPCloseToIncomingSP() const override { return false; }
27   const SpillSlot *getCalleeSavedSpillSlots(unsigned &NumEntries) const
28     override;
29   void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
30                             RegScavenger *RS) const override;
31   bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
32                                  MachineBasicBlock::iterator MBBI,
33                                  const std::vector<CalleeSavedInfo> &CSI,
34                                  const TargetRegisterInfo *TRI) const override;
35   bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
36                                    MachineBasicBlock::iterator MBBII,
37                                    std::vector<CalleeSavedInfo> &CSI,
38                                    const TargetRegisterInfo *TRI) const
39     override;
40   void processFunctionBeforeFrameFinalized(MachineFunction &MF,
41                                            RegScavenger *RS) const override;
42   void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
43   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
44   bool hasFP(const MachineFunction &MF) const override;
45   bool hasReservedCallFrame(const MachineFunction &MF) const override;
46   MachineBasicBlock::iterator
47   eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
48                                 MachineBasicBlock::iterator MI) const override;
49
50   // Return the byte offset from the incoming stack pointer of Reg's
51   // ABI-defined save slot.  Return 0 if no slot is defined for Reg.
52   unsigned getRegSpillOffset(unsigned Reg) const {
53     return RegSpillOffsets[Reg];
54   }
55 };
56 } // end namespace llvm
57
58 #endif