1241777Sed//===-- MipsFrameLowering.h - Define frame lowering for Mips ----*- C++ -*-===//
2241777Sed//
3241777Sed// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4241777Sed// See https://llvm.org/LICENSE.txt for license information.
5241777Sed// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6241777Sed//
7241777Sed//===----------------------------------------------------------------------===//
8241777Sed//
9241777Sed//
10241777Sed//
11241777Sed//===----------------------------------------------------------------------===//
12241777Sed
13241777Sed#ifndef LLVM_LIB_TARGET_MIPS_MIPSFRAMELOWERING_H
14241777Sed#define LLVM_LIB_TARGET_MIPS_MIPSFRAMELOWERING_H
15241777Sed
16241777Sed#include "Mips.h"
17241777Sed#include "llvm/CodeGen/TargetFrameLowering.h"
18241777Sed
19241777Sednamespace llvm {
20241777Sed  class MipsSubtarget;
21241777Sed
22241777Sedclass MipsFrameLowering : public TargetFrameLowering {
23241777Sedprotected:
24241777Sed  const MipsSubtarget &STI;
25241777Sed
26241777Sedpublic:
27241777Sed  explicit MipsFrameLowering(const MipsSubtarget &sti, Align Alignment)
28241777Sed      : TargetFrameLowering(StackGrowsDown, Alignment, 0, Alignment), STI(sti) {
29241777Sed  }
30241777Sed
31241777Sed  static const MipsFrameLowering *create(const MipsSubtarget &ST);
32263028Sjhb
33241778Sed  bool hasFP(const MachineFunction &MF) const override;
34241778Sed
35  bool hasBP(const MachineFunction &MF) const;
36
37  bool allocateScavengingFrameIndexesNearIncomingSP(
38    const MachineFunction &MF) const override {
39    return false;
40  }
41
42  bool enableShrinkWrapping(const MachineFunction &MF) const override {
43    return true;
44  }
45
46  MachineBasicBlock::iterator
47  eliminateCallFramePseudoInstr(MachineFunction &MF,
48                                MachineBasicBlock &MBB,
49                                MachineBasicBlock::iterator I) const override;
50
51protected:
52  uint64_t estimateStackSize(const MachineFunction &MF) const;
53};
54
55/// Create MipsFrameLowering objects.
56const MipsFrameLowering *createMips16FrameLowering(const MipsSubtarget &ST);
57const MipsFrameLowering *createMipsSEFrameLowering(const MipsSubtarget &ST);
58
59} // End llvm namespace
60
61#endif
62