Add gfx950 mfma instructions to ROCDL dialect (#123361)
[llvm-project.git] / llvm / lib / Target / VE / VEFrameLowering.h
blobbe9cdc01d6f446b79660917b9d2d72b7343bebcc
1 //===-- VEFrameLowering.h - Define frame lowering for VE --*- 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 // This class implements VE-specific bits of TargetFrameLowering class.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_VE_VEFRAMELOWERING_H
14 #define LLVM_LIB_TARGET_VE_VEFRAMELOWERING_H
16 #include "VE.h"
17 #include "llvm/CodeGen/TargetFrameLowering.h"
18 #include "llvm/Support/TypeSize.h"
20 namespace llvm {
22 class VESubtarget;
23 class VEFrameLowering : public TargetFrameLowering {
24 public:
25 explicit VEFrameLowering(const VESubtarget &ST);
27 /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
28 /// the function.
29 void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
30 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
31 void emitPrologueInsns(MachineFunction &MF, MachineBasicBlock &MBB,
32 MachineBasicBlock::iterator MBBI, uint64_t NumBytes,
33 bool RequireFPUpdate) const;
34 void emitEpilogueInsns(MachineFunction &MF, MachineBasicBlock &MBB,
35 MachineBasicBlock::iterator MBBI, uint64_t NumBytes,
36 bool RequireFPUpdate) const;
38 MachineBasicBlock::iterator
39 eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
40 MachineBasicBlock::iterator I) const override;
42 bool hasBP(const MachineFunction &MF) const;
43 bool hasGOT(const MachineFunction &MF) const;
45 // VE reserves argument space always for call sites in the function
46 // immediately on entry of the current function.
47 bool hasReservedCallFrame(const MachineFunction &MF) const override {
48 return true;
50 void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
51 RegScavenger *RS = nullptr) const override;
53 StackOffset getFrameIndexReference(const MachineFunction &MF, int FI,
54 Register &FrameReg) const override;
56 const SpillSlot *
57 getCalleeSavedSpillSlots(unsigned &NumEntries) const override {
58 static const SpillSlot Offsets[] = {
59 {VE::SX17, 40}, {VE::SX18, 48}, {VE::SX19, 56}, {VE::SX20, 64},
60 {VE::SX21, 72}, {VE::SX22, 80}, {VE::SX23, 88}, {VE::SX24, 96},
61 {VE::SX25, 104}, {VE::SX26, 112}, {VE::SX27, 120}, {VE::SX28, 128},
62 {VE::SX29, 136}, {VE::SX30, 144}, {VE::SX31, 152}, {VE::SX32, 160},
63 {VE::SX33, 168}};
64 NumEntries = std::size(Offsets);
65 return Offsets;
68 protected:
69 const VESubtarget &STI;
71 bool hasFPImpl(const MachineFunction &MF) const override;
73 private:
74 // Returns true if MF is a leaf procedure.
75 bool isLeafProc(MachineFunction &MF) const;
77 // Emits code for adjusting SP in function prologue/epilogue.
78 void emitSPAdjustment(MachineFunction &MF, MachineBasicBlock &MBB,
79 MachineBasicBlock::iterator MBBI, int64_t NumBytes,
80 MaybeAlign MayAlign = MaybeAlign()) const;
82 // Emits code for extending SP in function prologue/epilogue.
83 void emitSPExtend(MachineFunction &MF, MachineBasicBlock &MBB,
84 MachineBasicBlock::iterator MBBI) const;
87 } // namespace llvm
89 #endif