LLVM  10.0.0
AArch64FrameLowering.h
Go to the documentation of this file.
1 //==-- AArch64FrameLowering.h - TargetFrameLowering for AArch64 --*- 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 //
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_AARCH64_AARCH64FRAMELOWERING_H
14 #define LLVM_LIB_TARGET_AARCH64_AARCH64FRAMELOWERING_H
15 
16 #include "AArch64StackOffset.h"
18 
19 namespace llvm {
20 
22 public:
25  true /*StackRealignable*/) {}
26 
28  MachineBasicBlock::iterator MBBI) const;
29 
32  MachineBasicBlock::iterator I) const override;
33 
34  /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
35  /// the function.
36  void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
37  void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
38 
39  bool canUseAsPrologue(const MachineBasicBlock &MBB) const override;
40 
41  int getFrameIndexReference(const MachineFunction &MF, int FI,
42  unsigned &FrameReg) const override;
44  unsigned &FrameReg, bool PreferFP,
45  bool ForSimm) const;
47  int64_t ObjectOffset, bool isFixed,
48  bool isSVE, unsigned &FrameReg,
49  bool PreferFP, bool ForSimm) const;
52  const std::vector<CalleeSavedInfo> &CSI,
53  const TargetRegisterInfo *TRI) const override;
54 
57  std::vector<CalleeSavedInfo> &CSI,
58  const TargetRegisterInfo *TRI) const override;
59 
60  /// Can this function use the red zone for local allocations.
61  bool canUseRedZone(const MachineFunction &MF) const;
62 
63  bool hasFP(const MachineFunction &MF) const override;
64  bool hasReservedCallFrame(const MachineFunction &MF) const override;
65 
66  void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
67  RegScavenger *RS) const override;
68 
69  /// Returns true if the target will correctly handle shrink wrapping.
70  bool enableShrinkWrapping(const MachineFunction &MF) const override {
71  return true;
72  }
73 
74  bool enableStackSlotScavenging(const MachineFunction &MF) const override;
76 
78  RegScavenger *RS) const override;
79 
80  unsigned getWinEHParentFrameOffset(const MachineFunction &MF) const override;
81 
82  unsigned getWinEHFuncletFrameSize(const MachineFunction &MF) const;
83 
84  int getFrameIndexReferencePreferSP(const MachineFunction &MF, int FI,
85  unsigned &FrameReg,
86  bool IgnoreSPUpdates) const override;
88  int FI) const override;
89  int getSEHFrameIndexOffset(const MachineFunction &MF, int FI) const;
90 
92  switch (ID) {
93  default:
94  return false;
98  return true;
99  }
100  }
101 
102 private:
103  bool shouldCombineCSRLocalStackBump(MachineFunction &MF,
104  uint64_t StackBumpBytes) const;
105 
106  int64_t estimateSVEStackObjectOffsets(MachineFrameInfo &MF) const;
107  int64_t assignSVEStackObjectOffsets(MachineFrameInfo &MF,
108  int &MinCSFrameIndex,
109  int &MaxCSFrameIndex) const;
110 };
111 
112 } // End llvm namespace
113 
114 #endif
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, std::vector< CalleeSavedInfo > &CSI, const TargetRegisterInfo *TRI) const override
restoreCalleeSavedRegisters - Issues instruction(s) to restore all callee saved registers and returns...
TargetStackID::Value getStackIDForScalableVectors() const override
Returns the StackID that scalable vectors should be associated with.
StackOffset is a wrapper around scalable and non-scalable offsets and is used in several functions su...
This class represents lattice values for constants.
Definition: AllocatorList.h:23
bool enableShrinkWrapping(const MachineFunction &MF) const override
Returns true if the target will correctly handle shrink wrapping.
unsigned const TargetRegisterInfo * TRI
bool canUseRedZone(const MachineFunction &MF) const
Can this function use the red zone for local allocations.
block Block Frequency true
bool isSupportedStackID(TargetStackID::Value ID) const override
int getSEHFrameIndexOffset(const MachineFunction &MF, int FI) const
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.
int getFrameIndexReference(const MachineFunction &MF, int FI, unsigned &FrameReg) const override
getFrameIndexReference - Provide a base+offset reference to an FI slot for debug info.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
int getFrameIndexReferencePreferSP(const MachineFunction &MF, int FI, unsigned &FrameReg, bool IgnoreSPUpdates) const override
For Win64 AArch64 EH, the offset to the Unwind object is from the SP before the update.
bool canUseAsPrologue(const MachineBasicBlock &MBB) const override
Check whether or not the given MBB can be used as a prologue for the target.
unsigned getWinEHParentFrameOffset(const MachineFunction &MF) const override
The parent frame offset (aka dispFrame) is only used on X86_64 to retrieve the parent&#39;s frame pointer...
void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS) const override
This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() sh...
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override
unsigned getWinEHFuncletFrameSize(const MachineFunction &MF) const
Funclets only need to account for space for the callee saved registers, as the locals are accounted f...
int getNonLocalFrameIndexReference(const MachineFunction &MF, int FI) const override
getNonLocalFrameIndexReference - This method returns the offset used to reference a frame index locat...
StackOffset resolveFrameIndexReference(const MachineFunction &MF, int FI, unsigned &FrameReg, bool PreferFP, bool ForSimm) const
StackOffset resolveFrameOffsetReference(const MachineFunction &MF, int64_t ObjectOffset, bool isFixed, bool isSVE, unsigned &FrameReg, bool PreferFP, bool ForSimm) const
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:40
void emitCalleeSavedFrameMoves(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI) const
Information about stack frame layout on the target.
bool enableStackSlotScavenging(const MachineFunction &MF) const override
Returns true if the stack slot holes in the fixed and callee-save stack area should be used when allo...
void processFunctionBeforeFrameFinalized(MachineFunction &MF, RegScavenger *RS) const override
processFunctionBeforeFrameFinalized - This method is called immediately before the specified function...
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register...
#define I(x, y, z)
Definition: MD5.cpp:58
bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const std::vector< CalleeSavedInfo > &CSI, const TargetRegisterInfo *TRI) const override
spillCalleeSavedRegisters - Issues instruction(s) to spill all callee saved registers and returns tru...
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...
IRTranslator LLVM IR MI