blob: 0e00d168003f4c42e44ec94826306178b1ff7c60 [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
14#ifndef AArch64_FRAMELOWERING_H
15#define AArch64_FRAMELOWERING_H
16
17#include "llvm/Target/TargetFrameLowering.h"
18
19namespace llvm {
20
21class AArch64Subtarget;
22class AArch64TargetMachine;
23
24class AArch64FrameLowering : public TargetFrameLowering {
25 const AArch64TargetMachine &TM;
26
27public:
28 explicit AArch64FrameLowering(const AArch64TargetMachine &TM,
29 const AArch64Subtarget &STI)
30 : TargetFrameLowering(StackGrowsDown, 16, 0, 16,
31 false /*StackRealignable*/),
32 TM(TM) {}
33
34 void emitCalleeSavedFrameMoves(MachineBasicBlock &MBB,
35 MachineBasicBlock::iterator MBBI,
36 unsigned FramePtr) const;
37
38 void eliminateCallFramePseudoInstr(MachineFunction &MF,
39 MachineBasicBlock &MBB,
40 MachineBasicBlock::iterator I) const override;
41
42 /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
43 /// the function.
44 void emitPrologue(MachineFunction &MF) const override;
45 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
46
47 int getFrameIndexOffset(const MachineFunction &MF, int FI) const override;
48 int getFrameIndexReference(const MachineFunction &MF, int FI,
49 unsigned &FrameReg) const override;
50 int resolveFrameIndexReference(const MachineFunction &MF, int FI,
51 unsigned &FrameReg,
52 bool PreferFP = false) const;
53 bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
54 MachineBasicBlock::iterator MI,
55 const std::vector<CalleeSavedInfo> &CSI,
56 const TargetRegisterInfo *TRI) const override;
57
58 bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
59 MachineBasicBlock::iterator MI,
60 const std::vector<CalleeSavedInfo> &CSI,
61 const TargetRegisterInfo *TRI) const override;
62
63 /// \brief Can this function use the red zone for local allocations.
64 bool canUseRedZone(const MachineFunction &MF) const;
65
66 bool hasFP(const MachineFunction &MF) const override;
67 bool hasReservedCallFrame(const MachineFunction &MF) const override;
68
69 void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
70 RegScavenger *RS) const override;
71};
72
73} // End llvm namespace
74
75#endif