1 //==-- AArch64FrameLowering.h - TargetFrameLowering for AArch64 --*- C++ -*-==//
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
7 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_AARCH64_AARCH64FRAMELOWERING_H
14 #define LLVM_LIB_TARGET_AARCH64_AARCH64FRAMELOWERING_H
16 #include "llvm/CodeGen/TargetFrameLowering.h"
20 class AArch64FrameLowering
: public TargetFrameLowering
{
22 explicit AArch64FrameLowering()
23 : TargetFrameLowering(StackGrowsDown
, 16, 0, 16,
24 true /*StackRealignable*/) {}
26 void emitCalleeSavedFrameMoves(MachineBasicBlock
&MBB
,
27 MachineBasicBlock::iterator MBBI
) const;
29 MachineBasicBlock::iterator
30 eliminateCallFramePseudoInstr(MachineFunction
&MF
, MachineBasicBlock
&MBB
,
31 MachineBasicBlock::iterator I
) const override
;
33 /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
35 void emitPrologue(MachineFunction
&MF
, MachineBasicBlock
&MBB
) const override
;
36 void emitEpilogue(MachineFunction
&MF
, MachineBasicBlock
&MBB
) const override
;
38 bool canUseAsPrologue(const MachineBasicBlock
&MBB
) const override
;
40 int getFrameIndexReference(const MachineFunction
&MF
, int FI
,
41 unsigned &FrameReg
) const override
;
42 int resolveFrameIndexReference(const MachineFunction
&MF
, int FI
,
44 bool PreferFP
= false) const;
45 bool spillCalleeSavedRegisters(MachineBasicBlock
&MBB
,
46 MachineBasicBlock::iterator MI
,
47 const std::vector
<CalleeSavedInfo
> &CSI
,
48 const TargetRegisterInfo
*TRI
) const override
;
50 bool restoreCalleeSavedRegisters(MachineBasicBlock
&MBB
,
51 MachineBasicBlock::iterator MI
,
52 std::vector
<CalleeSavedInfo
> &CSI
,
53 const TargetRegisterInfo
*TRI
) const override
;
55 /// Can this function use the red zone for local allocations.
56 bool canUseRedZone(const MachineFunction
&MF
) const;
58 bool hasFP(const MachineFunction
&MF
) const override
;
59 bool hasReservedCallFrame(const MachineFunction
&MF
) const override
;
61 void determineCalleeSaves(MachineFunction
&MF
, BitVector
&SavedRegs
,
62 RegScavenger
*RS
) const override
;
64 /// Returns true if the target will correctly handle shrink wrapping.
65 bool enableShrinkWrapping(const MachineFunction
&MF
) const override
{
69 bool enableStackSlotScavenging(const MachineFunction
&MF
) const override
;
71 void processFunctionBeforeFrameFinalized(MachineFunction
&MF
,
72 RegScavenger
*RS
) const override
;
74 unsigned getWinEHParentFrameOffset(const MachineFunction
&MF
) const override
;
76 unsigned getWinEHFuncletFrameSize(const MachineFunction
&MF
) const;
78 int getFrameIndexReferencePreferSP(const MachineFunction
&MF
, int FI
,
80 bool IgnoreSPUpdates
) const override
;
81 int getNonLocalFrameIndexReference(const MachineFunction
&MF
,
82 int FI
) const override
;
83 int getSEHFrameIndexOffset(const MachineFunction
&MF
, int FI
) const;
86 bool shouldCombineCSRLocalStackBump(MachineFunction
&MF
,
87 unsigned StackBumpBytes
) const;
90 } // End llvm namespace