[ARM] Better patterns for fp <> predicate vectors
[llvm-complete.git] / lib / Target / AArch64 / AArch64FrameLowering.h
blob6dbd34b2189f5d8e1ff042316379c9192efa4b8b
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, bool PreferFP,
44 bool ForSimm) const;
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 {
69 return true;
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,
82 unsigned &FrameReg,
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;
88 private:
89 bool shouldCombineCSRLocalStackBump(MachineFunction &MF,
90 unsigned StackBumpBytes) const;
93 } // End llvm namespace
95 #endif