LLVM  13.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"
18 #include "llvm/Support/TypeSize.h"
19 
20 namespace llvm {
21 
22 class VESubtarget;
24 public:
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;
32  MachineBasicBlock::iterator MBBI, uint64_t NumBytes,
33  bool RequireFPUpdate) const;
35  MachineBasicBlock::iterator MBBI, uint64_t NumBytes,
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  }
51  void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
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 = array_lengthof(Offsets);
66  return Offsets;
67  }
68 
69 protected:
70  const VESubtarget &STI;
71 
72 private:
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
llvm
This class represents lattice values for constants.
Definition: AllocatorList.h:23
TargetFrameLowering.h
llvm::TargetFrameLowering
Information about stack frame layout on the target.
Definition: TargetFrameLowering.h:42
llvm::VEFrameLowering::emitPrologue
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.
Definition: VEFrameLowering.cpp:308
TypeSize.h
llvm::VEFrameLowering::emitEpilogueInsns
void emitEpilogueInsns(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, uint64_t NumBytes, bool RequireFPUpdate) const
Definition: VEFrameLowering.cpp:183
llvm::VEFrameLowering::eliminateCallFramePseudoInstr
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...
Definition: VEFrameLowering.cpp:382
llvm::VEFrameLowering::determineCalleeSaves
void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS=nullptr) const override
This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() sh...
Definition: VEFrameLowering.cpp:491
llvm::MaybeAlign
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition: Alignment.h:119
llvm::VEFrameLowering::hasBP
bool hasBP(const MachineFunction &MF) const
Definition: VEFrameLowering.cpp:435
llvm::BitVector
Definition: BitVector.h:74
llvm::array_lengthof
constexpr size_t array_lengthof(T(&)[N])
Find the length of an array.
Definition: STLExtras.h:1341
llvm::MachineBasicBlock
Definition: MachineBasicBlock.h:95
llvm::VEFrameLowering::hasReservedCallFrame
bool hasReservedCallFrame(const MachineFunction &MF) const override
hasReservedCallFrame - Under normal circumstances, when a frame pointer is not required,...
Definition: VEFrameLowering.h:48
llvm::VEFrameLowering::getCalleeSavedSpillSlots
const SpillSlot * getCalleeSavedSpillSlots(unsigned &NumEntries) const override
getCalleeSavedSpillSlots - This method returns a pointer to an array of pairs, that contains an entry...
Definition: VEFrameLowering.h:58
llvm::ARM_MB::ST
@ ST
Definition: ARMBaseInfo.h:73
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::RegScavenger
Definition: RegisterScavenging.h:34
llvm::VEFrameLowering
Definition: VEFrameLowering.h:23
llvm::VEFrameLowering::emitEpilogue
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override
Definition: VEFrameLowering.cpp:397
llvm::VEFrameLowering::hasFP
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register.
Definition: VEFrameLowering.cpp:426
llvm::MachineFunction
Definition: MachineFunction.h:227
MBBI
MachineBasicBlock MachineBasicBlock::iterator MBBI
Definition: AArch64SLSHardening.cpp:75
llvm::StackOffset
StackOffset is a class to represent an offset with 2 dimensions, named fixed and scalable,...
Definition: TypeSize.h:130
llvm::VEFrameLowering::VEFrameLowering
VEFrameLowering(const VESubtarget &ST)
Definition: VEFrameLowering.cpp:130
llvm::Register
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
MBB
MachineBasicBlock & MBB
Definition: AArch64SLSHardening.cpp:74
llvm::VEFrameLowering::emitPrologueInsns
void emitPrologueInsns(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, uint64_t NumBytes, bool RequireFPUpdate) const
Definition: VEFrameLowering.cpp:135
VE.h
llvm::VESubtarget
Definition: VESubtarget.h:31
llvm::VEFrameLowering::hasGOT
bool hasGOT(const MachineFunction &MF) const
Definition: VEFrameLowering.cpp:442
llvm::SI::KernelInputOffsets::Offsets
Offsets
Offsets in bytes from the start of the input buffer.
Definition: SIInstrInfo.h:1224
llvm::MachineInstrBundleIterator< MachineInstr >
llvm::TargetFrameLowering::SpillSlot
Definition: TargetFrameLowering.h:50
llvm::VEFrameLowering::STI
const VESubtarget & STI
Definition: VEFrameLowering.h:70
llvm::VEFrameLowering::getFrameIndexReference
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...
Definition: VEFrameLowering.cpp:449