LLVM 20.0.0git
VEFrameLowering.h
Go to the documentation of this file.
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.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_VE_VEFRAMELOWERING_H
14#define LLVM_LIB_TARGET_VE_VEFRAMELOWERING_H
15
16#include "VE.h"
19
20namespace llvm {
21
22class VESubtarget;
24public:
25 explicit VEFrameLowering(const VESubtarget &ST);
26
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;
33 bool RequireFPUpdate) const;
36 bool RequireFPUpdate) const;
37
40 MachineBasicBlock::iterator I) const override;
41
42 bool hasFP(const MachineFunction &MF) const override;
43 bool hasBP(const MachineFunction &MF) const;
44 bool hasGOT(const MachineFunction &MF) const;
45
46 // VE reserves argument space always for call sites in the function
47 // immediately on entry of the current function.
48 bool hasReservedCallFrame(const MachineFunction &MF) const override {
49 return true;
50 }
52 RegScavenger *RS = nullptr) const override;
53
55 Register &FrameReg) const override;
56
57 const SpillSlot *
58 getCalleeSavedSpillSlots(unsigned &NumEntries) const override {
59 static const SpillSlot Offsets[] = {
60 {VE::SX17, 40}, {VE::SX18, 48}, {VE::SX19, 56}, {VE::SX20, 64},
61 {VE::SX21, 72}, {VE::SX22, 80}, {VE::SX23, 88}, {VE::SX24, 96},
62 {VE::SX25, 104}, {VE::SX26, 112}, {VE::SX27, 120}, {VE::SX28, 128},
63 {VE::SX29, 136}, {VE::SX30, 144}, {VE::SX31, 152}, {VE::SX32, 160},
64 {VE::SX33, 168}};
65 NumEntries = std::size(Offsets);
66 return Offsets;
67 }
68
69protected:
71
72private:
73 // Returns true if MF is a leaf procedure.
74 bool isLeafProc(MachineFunction &MF) const;
75
76 // Emits code for adjusting SP in function prologue/epilogue.
77 void emitSPAdjustment(MachineFunction &MF, MachineBasicBlock &MBB,
78 MachineBasicBlock::iterator MBBI, int64_t NumBytes,
79 MaybeAlign MayAlign = MaybeAlign()) const;
80
81 // Emits code for extending SP in function prologue/epilogue.
82 void emitSPExtend(MachineFunction &MF, MachineBasicBlock &MBB,
84};
85
86} // namespace llvm
87
88#endif
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator MBBI
#define I(x, y, z)
Definition: MD5.cpp:58
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
StackOffset holds a fixed and a scalable offset in bytes.
Definition: TypeSize.h:33
Information about stack frame layout on the target.
void emitEpilogueInsns(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, uint64_t NumBytes, bool RequireFPUpdate) const
bool hasBP(const MachineFunction &MF) const
const VESubtarget & STI
const SpillSlot * getCalleeSavedSpillSlots(unsigned &NumEntries) const override
getCalleeSavedSpillSlots - This method returns a pointer to an array of pairs, that contains an entry...
void emitPrologueInsns(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, uint64_t NumBytes, bool RequireFPUpdate) const
MachineBasicBlock::iterator eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const override
This method is called during prolog/epilog code insertion to eliminate call frame setup and destroy p...
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register.
StackOffset getFrameIndexReference(const MachineFunction &MF, int FI, Register &FrameReg) const override
getFrameIndexReference - This method should return the base register and offset used to reference a f...
void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS=nullptr) const override
This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() sh...
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.
bool hasGOT(const MachineFunction &MF) const
bool hasReservedCallFrame(const MachineFunction &MF) const override
hasReservedCallFrame - Under normal circumstances, when a frame pointer is not required,...
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition: Alignment.h:117