1//===-- MipsFrameLowering.h - Define frame lowering for Mips ----*- C++ -*-===//
2//
3// 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
6//
7//===----------------------------------------------------------------------===//
8//
9//
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_MIPS_MIPSFRAMELOWERING_H
14#define LLVM_LIB_TARGET_MIPS_MIPSFRAMELOWERING_H
15
16#include "Mips.h"
17#include "llvm/CodeGen/TargetFrameLowering.h"
18
19namespace llvm {
20  class MipsSubtarget;
21
22class MipsFrameLowering : public TargetFrameLowering {
23protected:
24  const MipsSubtarget &STI;
25
26public:
27  explicit MipsFrameLowering(const MipsSubtarget &sti, Align Alignment)
28      : TargetFrameLowering(StackGrowsDown, Alignment, 0, Alignment), STI(sti) {
29  }
30
31  static const MipsFrameLowering *create(const MipsSubtarget &ST);
32
33  bool hasFP(const MachineFunction &MF) const override;
34
35  bool hasBP(const MachineFunction &MF) const;
36
37  bool isFPCloseToIncomingSP() const override { return false; }
38
39  bool enableShrinkWrapping(const MachineFunction &MF) const override {
40    return true;
41  }
42
43  MachineBasicBlock::iterator
44  eliminateCallFramePseudoInstr(MachineFunction &MF,
45                                MachineBasicBlock &MBB,
46                                MachineBasicBlock::iterator I) const override;
47
48protected:
49  uint64_t estimateStackSize(const MachineFunction &MF) const;
50};
51
52/// Create MipsFrameLowering objects.
53const MipsFrameLowering *createMips16FrameLowering(const MipsSubtarget &ST);
54const MipsFrameLowering *createMipsSEFrameLowering(const MipsSubtarget &ST);
55
56} // End llvm namespace
57
58#endif
59