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
,
43 unsigned &FrameReg
, bool PreferFP
,
45 int resolveFrameOffsetReference(const MachineFunction
&MF
, int ObjectOffset
,
46 bool isFixed
, unsigned &FrameReg
,
47 bool PreferFP
, bool ForSimm
) const;
48 bool spillCalleeSavedRegisters(MachineBasicBlock
&MBB
,
49 MachineBasicBlock::iterator MI
,
50 const std::vector
<CalleeSavedInfo
> &CSI
,
51 const TargetRegisterInfo
*TRI
) const override
;
53 bool restoreCalleeSavedRegisters(MachineBasicBlock
&MBB
,
54 MachineBasicBlock::iterator MI
,
55 std::vector
<CalleeSavedInfo
> &CSI
,
56 const TargetRegisterInfo
*TRI
) const override
;
58 /// Can this function use the red zone for local allocations.
59 bool canUseRedZone(const MachineFunction
&MF
) const;
61 bool hasFP(const MachineFunction
&MF
) const override
;
62 bool hasReservedCallFrame(const MachineFunction
&MF
) const override
;
64 void determineCalleeSaves(MachineFunction
&MF
, BitVector
&SavedRegs
,
65 RegScavenger
*RS
) const override
;
67 /// Returns true if the target will correctly handle shrink wrapping.
68 bool enableShrinkWrapping(const MachineFunction
&MF
) const override
{
72 bool enableStackSlotScavenging(const MachineFunction
&MF
) const override
;
74 void processFunctionBeforeFrameFinalized(MachineFunction
&MF
,
75 RegScavenger
*RS
) const override
;
77 unsigned getWinEHParentFrameOffset(const MachineFunction
&MF
) const override
;
79 unsigned getWinEHFuncletFrameSize(const MachineFunction
&MF
) const;
81 int getFrameIndexReferencePreferSP(const MachineFunction
&MF
, int FI
,
83 bool IgnoreSPUpdates
) const override
;
84 int getNonLocalFrameIndexReference(const MachineFunction
&MF
,
85 int FI
) const override
;
86 int getSEHFrameIndexOffset(const MachineFunction
&MF
, int FI
) const;
89 bool shouldCombineCSRLocalStackBump(MachineFunction
&MF
,
90 unsigned StackBumpBytes
) const;
93 } // End llvm namespace