blob: 612b2b712fa884de8418211bbe1eafba827b6cc3 [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:
Guillaume Chatelet882c43d2019-10-17 07:49:39 +000027 explicit MipsFrameLowering(const MipsSubtarget &sti, Align Alignment)
Guillaume Chatelet3cc48352019-10-21 08:31:25 +000028 : TargetFrameLowering(StackGrowsDown, Alignment, 0, Alignment), STI(sti) {
29 }
Anton Korobeynikovf7183ed2010-11-15 00:06:54 +000030
Eric Christophere54f10e2014-07-18 23:33:47 +000031 static const MipsFrameLowering *create(const MipsSubtarget &ST);
Akira Hatanakafab89292012-08-02 18:21:47 +000032
Craig Topper56c590a2014-04-29 07:58:02 +000033 bool hasFP(const MachineFunction &MF) const override;
Akira Hatanaka97b43d8b2012-11-02 21:10:22 +000034
Vasileios Kalintirisbb698c72015-06-02 13:14:46 +000035 bool hasBP(const MachineFunction &MF) const;
36
Petar Jovanovice0de8f42015-05-12 17:14:05 +000037 bool isFPCloseToIncomingSP() const override { return false; }
38
Petar Jovanoviccccc2362018-06-29 16:37:16 +000039 bool enableShrinkWrapping(const MachineFunction &MF) const override {
40 return true;
41 }
42
Hans Wennborge1a2e902016-03-31 18:33:38 +000043 MachineBasicBlock::iterator
Vasileios Kalintiris580f0672015-04-02 11:09:40 +000044 eliminateCallFramePseudoInstr(MachineFunction &MF,
45 MachineBasicBlock &MBB,
46 MachineBasicBlock::iterator I) const override;
47
Akira Hatanaka97b43d8b2012-11-02 21:10:22 +000048protected:
49 uint64_t estimateStackSize(const MachineFunction &MF) const;
Anton Korobeynikovf7183ed2010-11-15 00:06:54 +000050};
51
Akira Hatanaka0bb60d892013-03-12 00:16:36 +000052/// Create MipsFrameLowering objects.
Akira Hatanakafab89292012-08-02 18:21:47 +000053const MipsFrameLowering *createMips16FrameLowering(const MipsSubtarget &ST);
54const MipsFrameLowering *createMipsSEFrameLowering(const MipsSubtarget &ST);
55
Alexander Kornienkof00654e2015-06-23 09:49:53 +000056} // End llvm namespace
Anton Korobeynikovf7183ed2010-11-15 00:06:54 +000057
58#endif