blob: 104e52b5f1f367ce8cda652aa81ef6f4f1349340 [file] [log] [blame]
Tim Northover3b0846e2014-05-24 12:50:23 +00001//==-- AArch64FrameLowering.h - TargetFrameLowering for AArch64 --*- C++ -*-==//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10//
11//
12//===----------------------------------------------------------------------===//
13
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000014#ifndef LLVM_LIB_TARGET_AARCH64_AARCH64FRAMELOWERING_H
15#define LLVM_LIB_TARGET_AARCH64_AARCH64FRAMELOWERING_H
Tim Northover3b0846e2014-05-24 12:50:23 +000016
David Blaikie1be62f02017-11-03 22:32:11 +000017#include "llvm/CodeGen/TargetFrameLowering.h"
Tim Northover3b0846e2014-05-24 12:50:23 +000018
19namespace llvm {
20
Tim Northover3b0846e2014-05-24 12:50:23 +000021class AArch64FrameLowering : public TargetFrameLowering {
Tim Northover3b0846e2014-05-24 12:50:23 +000022public:
Eric Christopherbc76b972014-06-10 17:33:39 +000023 explicit AArch64FrameLowering()
Tim Northover3b0846e2014-05-24 12:50:23 +000024 : TargetFrameLowering(StackGrowsDown, 16, 0, 16,
Kristof Beyls17cb8982015-04-09 08:49:47 +000025 true /*StackRealignable*/) {}
Tim Northover3b0846e2014-05-24 12:50:23 +000026
27 void emitCalleeSavedFrameMoves(MachineBasicBlock &MBB,
Geoff Berry62d47252016-02-25 16:36:08 +000028 MachineBasicBlock::iterator MBBI) const;
Tim Northover3b0846e2014-05-24 12:50:23 +000029
Hans Wennborge1a2e902016-03-31 18:33:38 +000030 MachineBasicBlock::iterator
31 eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
32 MachineBasicBlock::iterator I) const override;
Tim Northover3b0846e2014-05-24 12:50:23 +000033
34 /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
35 /// the function.
Quentin Colombet61b305e2015-05-05 17:38:16 +000036 void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
Tim Northover3b0846e2014-05-24 12:50:23 +000037 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
38
Geoff Berry7e4ba3d2016-02-19 18:27:32 +000039 bool canUseAsPrologue(const MachineBasicBlock &MBB) const override;
40
Tim Northover3b0846e2014-05-24 12:50:23 +000041 int getFrameIndexReference(const MachineFunction &MF, int FI,
42 unsigned &FrameReg) const override;
43 int resolveFrameIndexReference(const MachineFunction &MF, int FI,
44 unsigned &FrameReg,
45 bool PreferFP = false) const;
46 bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
47 MachineBasicBlock::iterator MI,
48 const std::vector<CalleeSavedInfo> &CSI,
49 const TargetRegisterInfo *TRI) const override;
50
51 bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
52 MachineBasicBlock::iterator MI,
Krzysztof Parzyszekbea30c62017-08-10 16:17:32 +000053 std::vector<CalleeSavedInfo> &CSI,
Tim Northover3b0846e2014-05-24 12:50:23 +000054 const TargetRegisterInfo *TRI) const override;
55
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000056 /// Can this function use the red zone for local allocations.
Tim Northover3b0846e2014-05-24 12:50:23 +000057 bool canUseRedZone(const MachineFunction &MF) const;
58
59 bool hasFP(const MachineFunction &MF) const override;
60 bool hasReservedCallFrame(const MachineFunction &MF) const override;
61
Matthias Braun02564862015-07-14 17:17:13 +000062 void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
63 RegScavenger *RS) const override;
Quentin Colombetf6645cc2015-11-18 23:12:20 +000064
65 /// Returns true if the target will correctly handle shrink wrapping.
66 bool enableShrinkWrapping(const MachineFunction &MF) const override {
67 return true;
68 }
Geoff Berrya5335642016-05-06 16:34:59 +000069
Geoff Berry66f6b652016-06-02 16:22:07 +000070 bool enableStackSlotScavenging(const MachineFunction &MF) const override;
71
Geoff Berrya5335642016-05-06 16:34:59 +000072private:
73 bool shouldCombineCSRLocalStackBump(MachineFunction &MF,
74 unsigned StackBumpBytes) const;
Tim Northover3b0846e2014-05-24 12:50:23 +000075};
76
Alexander Kornienkof00654e2015-06-23 09:49:53 +000077} // End llvm namespace
Tim Northover3b0846e2014-05-24 12:50:23 +000078
79#endif