blob: 427afdf4acbf0736dfea29551023b9264bb453c4 [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
17#include "llvm/Target/TargetFrameLowering.h"
18
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,
28 MachineBasicBlock::iterator MBBI,
29 unsigned FramePtr) const;
30
31 void eliminateCallFramePseudoInstr(MachineFunction &MF,
32 MachineBasicBlock &MBB,
33 MachineBasicBlock::iterator I) const override;
34
35 /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
36 /// the function.
Quentin Colombet61b305e2015-05-05 17:38:16 +000037 void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
Tim Northover3b0846e2014-05-24 12:50:23 +000038 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
39
Tim Northover3b0846e2014-05-24 12:50:23 +000040 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;
49
50 bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
51 MachineBasicBlock::iterator MI,
52 const std::vector<CalleeSavedInfo> &CSI,
53 const TargetRegisterInfo *TRI) const override;
54
55 /// \brief Can this function use the red zone for local allocations.
56 bool canUseRedZone(const MachineFunction &MF) const;
57
58 bool hasFP(const MachineFunction &MF) const override;
59 bool hasReservedCallFrame(const MachineFunction &MF) const override;
60
Matthias Braun02564862015-07-14 17:17:13 +000061 void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
62 RegScavenger *RS) const override;
Quentin Colombetf6645cc2015-11-18 23:12:20 +000063
64 /// Returns true if the target will correctly handle shrink wrapping.
65 bool enableShrinkWrapping(const MachineFunction &MF) const override {
66 return true;
67 }
Tim Northover3b0846e2014-05-24 12:50:23 +000068};
69
Alexander Kornienkof00654e2015-06-23 09:49:53 +000070} // End llvm namespace
Tim Northover3b0846e2014-05-24 12:50:23 +000071
72#endif