blob: 0537cfd1cb307ea2e0bc6a0b8a0293e6d3a19bf8 [file] [log] [blame]
Jia Liuf54f60f2012-02-28 07:46:26 +00001//===-- MipsFrameLowering.h - Define frame lowering for Mips ----*- C++ -*-===//
Anton Korobeynikovf7183ed2010-11-15 00:06:54 +00002//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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
Anton Korobeynikovf7183ed2010-11-15 00:06:54 +00006//
Akira Hatanakae2489122011-04-15 21:51:11 +00007//===----------------------------------------------------------------------===//
Anton Korobeynikovf7183ed2010-11-15 00:06:54 +00008//
9//
10//
Akira Hatanakae2489122011-04-15 21:51:11 +000011//===----------------------------------------------------------------------===//
Anton Korobeynikovf7183ed2010-11-15 00:06:54 +000012
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000013#ifndef LLVM_LIB_TARGET_MIPS_MIPSFRAMELOWERING_H
14#define LLVM_LIB_TARGET_MIPS_MIPSFRAMELOWERING_H
Anton Korobeynikovf7183ed2010-11-15 00:06:54 +000015
16#include "Mips.h"
David Blaikie1be62f02017-11-03 22:32:11 +000017#include "llvm/CodeGen/TargetFrameLowering.h"
Anton Korobeynikovf7183ed2010-11-15 00:06:54 +000018
19namespace llvm {
20 class MipsSubtarget;
21
Anton Korobeynikov2f931282011-01-10 12:39:04 +000022class MipsFrameLowering : public TargetFrameLowering {
Anton Korobeynikovf7183ed2010-11-15 00:06:54 +000023protected:
24 const MipsSubtarget &STI;
25
26public:
Akira Hatanaka11184e42013-03-29 01:51:04 +000027 explicit MipsFrameLowering(const MipsSubtarget &sti, unsigned Alignment)
28 : TargetFrameLowering(StackGrowsDown, Alignment, 0, Alignment), STI(sti) {}
Anton Korobeynikovf7183ed2010-11-15 00:06:54 +000029
Eric Christophere54f10e2014-07-18 23:33:47 +000030 static const MipsFrameLowering *create(const MipsSubtarget &ST);
Akira Hatanakafab89292012-08-02 18:21:47 +000031
Craig Topper56c590a2014-04-29 07:58:02 +000032 bool hasFP(const MachineFunction &MF) const override;
Akira Hatanaka97b43d8b2012-11-02 21:10:22 +000033
Vasileios Kalintirisbb698c72015-06-02 13:14:46 +000034 bool hasBP(const MachineFunction &MF) const;
35
Petar Jovanovice0de8f42015-05-12 17:14:05 +000036 bool isFPCloseToIncomingSP() const override { return false; }
37
Petar Jovanoviccccc2362018-06-29 16:37:16 +000038 bool enableShrinkWrapping(const MachineFunction &MF) const override {
39 return true;
40 }
41
Hans Wennborge1a2e902016-03-31 18:33:38 +000042 MachineBasicBlock::iterator
Vasileios Kalintiris580f0672015-04-02 11:09:40 +000043 eliminateCallFramePseudoInstr(MachineFunction &MF,
44 MachineBasicBlock &MBB,
45 MachineBasicBlock::iterator I) const override;
46
Akira Hatanaka97b43d8b2012-11-02 21:10:22 +000047protected:
48 uint64_t estimateStackSize(const MachineFunction &MF) const;
Anton Korobeynikovf7183ed2010-11-15 00:06:54 +000049};
50
Akira Hatanaka0bb60d892013-03-12 00:16:36 +000051/// Create MipsFrameLowering objects.
Akira Hatanakafab89292012-08-02 18:21:47 +000052const MipsFrameLowering *createMips16FrameLowering(const MipsSubtarget &ST);
53const MipsFrameLowering *createMipsSEFrameLowering(const MipsSubtarget &ST);
54
Alexander Kornienkof00654e2015-06-23 09:49:53 +000055} // End llvm namespace
Anton Korobeynikovf7183ed2010-11-15 00:06:54 +000056
57#endif