Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 1 | //==-- 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 Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 14 | #ifndef LLVM_LIB_TARGET_AARCH64_AARCH64FRAMELOWERING_H |
| 15 | #define LLVM_LIB_TARGET_AARCH64_AARCH64FRAMELOWERING_H |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 16 | |
| 17 | #include "llvm/Target/TargetFrameLowering.h" |
| 18 | |
| 19 | namespace llvm { |
| 20 | |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 21 | class AArch64FrameLowering : public TargetFrameLowering { |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 22 | public: |
Eric Christopher | bc76b97 | 2014-06-10 17:33:39 +0000 | [diff] [blame] | 23 | explicit AArch64FrameLowering() |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 24 | : TargetFrameLowering(StackGrowsDown, 16, 0, 16, |
Kristof Beyls | 17cb898 | 2015-04-09 08:49:47 +0000 | [diff] [blame] | 25 | true /*StackRealignable*/) {} |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 26 | |
| 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 Colombet | 61b305e | 2015-05-05 17:38:16 +0000 | [diff] [blame] | 37 | void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override; |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 38 | void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override; |
| 39 | |
Geoff Berry | 7e4ba3d | 2016-02-19 18:27:32 +0000 | [diff] [blame^] | 40 | bool canUseAsPrologue(const MachineBasicBlock &MBB) const override; |
| 41 | |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 42 | int getFrameIndexReference(const MachineFunction &MF, int FI, |
| 43 | unsigned &FrameReg) const override; |
| 44 | int resolveFrameIndexReference(const MachineFunction &MF, int FI, |
| 45 | unsigned &FrameReg, |
| 46 | bool PreferFP = false) const; |
| 47 | bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, |
| 48 | MachineBasicBlock::iterator MI, |
| 49 | const std::vector<CalleeSavedInfo> &CSI, |
| 50 | const TargetRegisterInfo *TRI) const override; |
| 51 | |
| 52 | bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB, |
| 53 | MachineBasicBlock::iterator MI, |
| 54 | const std::vector<CalleeSavedInfo> &CSI, |
| 55 | const TargetRegisterInfo *TRI) const override; |
| 56 | |
| 57 | /// \brief Can this function use the red zone for local allocations. |
| 58 | bool canUseRedZone(const MachineFunction &MF) const; |
| 59 | |
| 60 | bool hasFP(const MachineFunction &MF) const override; |
| 61 | bool hasReservedCallFrame(const MachineFunction &MF) const override; |
| 62 | |
Matthias Braun | 0256486 | 2015-07-14 17:17:13 +0000 | [diff] [blame] | 63 | void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, |
| 64 | RegScavenger *RS) const override; |
Quentin Colombet | f6645cc | 2015-11-18 23:12:20 +0000 | [diff] [blame] | 65 | |
| 66 | /// Returns true if the target will correctly handle shrink wrapping. |
| 67 | bool enableShrinkWrapping(const MachineFunction &MF) const override { |
| 68 | return true; |
| 69 | } |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 70 | }; |
| 71 | |
Alexander Kornienko | f00654e | 2015-06-23 09:49:53 +0000 | [diff] [blame] | 72 | } // End llvm namespace |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 73 | |
| 74 | #endif |