Revert r354244 "[DAGCombiner] Eliminate dead stores to stack."
[llvm-complete.git] / lib / Target / AArch64 / AArch64FrameLowering.h
blobf4bbeb4bdaef8434107d71b57993b02c9bf16fac
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 //
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_AARCH64_AARCH64FRAMELOWERING_H
14 #define LLVM_LIB_TARGET_AARCH64_AARCH64FRAMELOWERING_H
16 #include "llvm/CodeGen/TargetFrameLowering.h"
18 namespace llvm {
20 class AArch64FrameLowering : public TargetFrameLowering {
21 public:
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
34 /// the function.
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,
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 {
66 return true;
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,
79 unsigned &FrameReg,
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;
85 private:
86 bool shouldCombineCSRLocalStackBump(MachineFunction &MF,
87 unsigned StackBumpBytes) const;
90 } // End llvm namespace
92 #endif