LLVM  10.0.0
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 
19 namespace llvm {
20 
21 class VESubtarget;
23 public:
24  explicit VEFrameLowering(const VESubtarget &ST);
25 
26  /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
27  /// the function.
28  void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
29  void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
31  MachineBasicBlock::iterator MBBI, int NumBytes,
32  bool RequireFPUpdate) const;
34  MachineBasicBlock::iterator MBBI, int NumBytes,
35  bool RequireFPUpdate) const;
36 
39  MachineBasicBlock::iterator I) const override;
40 
41  bool hasReservedCallFrame(const MachineFunction &MF) const override;
42  bool hasFP(const MachineFunction &MF) const override;
43  void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
44  RegScavenger *RS = nullptr) const override;
45 
46  int getFrameIndexReference(const MachineFunction &MF, int FI,
47  unsigned &FrameReg) const override;
48 
49  const SpillSlot *
50  getCalleeSavedSpillSlots(unsigned &NumEntries) const override {
51  static const SpillSlot Offsets[] = {
52  {VE::SX17, 40}, {VE::SX18, 48}, {VE::SX19, 56}, {VE::SX20, 64},
53  {VE::SX21, 72}, {VE::SX22, 80}, {VE::SX23, 88}, {VE::SX24, 96},
54  {VE::SX25, 104}, {VE::SX26, 112}, {VE::SX27, 120}, {VE::SX28, 128},
55  {VE::SX29, 136}, {VE::SX30, 144}, {VE::SX31, 152}, {VE::SX32, 160},
56  {VE::SX33, 168}};
57  NumEntries = array_lengthof(Offsets);
58  return Offsets;
59  }
60 
61  /// targetHandlesStackFrameRounding - Returns true if the target is
62  /// responsible for rounding up the stack frame (probably at emitPrologue
63  /// time).
64  bool targetHandlesStackFrameRounding() const override { return true; }
65 
66 private:
67  // Returns true if MF is a leaf procedure.
68  bool isLeafProc(MachineFunction &MF) const;
69 
70  // Emits code for adjusting SP in function prologue/epilogue.
71  void emitSPAdjustment(MachineFunction &MF, MachineBasicBlock &MBB,
72  MachineBasicBlock::iterator MBBI, int NumBytes) const;
73 
74  // Emits code for extending SP in function prologue/epilogue.
75  void emitSPExtend(MachineFunction &MF, MachineBasicBlock &MBB,
76  MachineBasicBlock::iterator MBBI, int NumBytes) const;
77 };
78 
79 } // namespace llvm
80 
81 #endif
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override
This class represents lattice values for constants.
Definition: AllocatorList.h:23
VEFrameLowering(const VESubtarget &ST)
Offsets
Offsets in bytes from the start of the input buffer.
Definition: SIInstrInfo.h:1157
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, int NumBytes, bool RequireFPUpdate) const
void emitEpilogueInsns(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, int NumBytes, bool RequireFPUpdate) const
bool targetHandlesStackFrameRounding() const override
targetHandlesStackFrameRounding - Returns true if the target is responsible for rounding up the stack...
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register...
int getFrameIndexReference(const MachineFunction &MF, int FI, unsigned &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...
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 hasReservedCallFrame(const MachineFunction &MF) const override
hasReservedCallFrame - Under normal circumstances, when a frame pointer is not required, we reserve argument space for call sites in the function immediately on entry to the current function.
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.
constexpr size_t array_lengthof(T(&)[N])
Find the length of an array.
Definition: STLExtras.h:1027
Information about stack frame layout on the target.
#define I(x, y, z)
Definition: MD5.cpp:58