xref: /freebsd/contrib/llvm-project/llvm/lib/Target/Mips/MipsFrameLowering.h (revision 4824e7fd18a1223177218d4aec1b3c6c5c4a444e)
10b57cec5SDimitry Andric //===-- MipsFrameLowering.h - Define frame lowering for Mips ----*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric //
90b57cec5SDimitry Andric //
100b57cec5SDimitry Andric //
110b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
120b57cec5SDimitry Andric 
130b57cec5SDimitry Andric #ifndef LLVM_LIB_TARGET_MIPS_MIPSFRAMELOWERING_H
140b57cec5SDimitry Andric #define LLVM_LIB_TARGET_MIPS_MIPSFRAMELOWERING_H
150b57cec5SDimitry Andric 
160b57cec5SDimitry Andric #include "Mips.h"
170b57cec5SDimitry Andric #include "llvm/CodeGen/TargetFrameLowering.h"
180b57cec5SDimitry Andric 
190b57cec5SDimitry Andric namespace llvm {
200b57cec5SDimitry Andric   class MipsSubtarget;
210b57cec5SDimitry Andric 
220b57cec5SDimitry Andric class MipsFrameLowering : public TargetFrameLowering {
230b57cec5SDimitry Andric protected:
240b57cec5SDimitry Andric   const MipsSubtarget &STI;
250b57cec5SDimitry Andric 
260b57cec5SDimitry Andric public:
MipsFrameLowering(const MipsSubtarget & sti,Align Alignment)278bcb0991SDimitry Andric   explicit MipsFrameLowering(const MipsSubtarget &sti, Align Alignment)
288bcb0991SDimitry Andric       : TargetFrameLowering(StackGrowsDown, Alignment, 0, Alignment), STI(sti) {
298bcb0991SDimitry Andric   }
300b57cec5SDimitry Andric 
310b57cec5SDimitry Andric   static const MipsFrameLowering *create(const MipsSubtarget &ST);
320b57cec5SDimitry Andric 
330b57cec5SDimitry Andric   bool hasFP(const MachineFunction &MF) const override;
340b57cec5SDimitry Andric 
350b57cec5SDimitry Andric   bool hasBP(const MachineFunction &MF) const;
360b57cec5SDimitry Andric 
allocateScavengingFrameIndexesNearIncomingSP(const MachineFunction & MF)37*4824e7fdSDimitry Andric   bool allocateScavengingFrameIndexesNearIncomingSP(
38*4824e7fdSDimitry Andric     const MachineFunction &MF) const override {
39*4824e7fdSDimitry Andric     return false;
40*4824e7fdSDimitry Andric   }
410b57cec5SDimitry Andric 
enableShrinkWrapping(const MachineFunction & MF)420b57cec5SDimitry Andric   bool enableShrinkWrapping(const MachineFunction &MF) const override {
430b57cec5SDimitry Andric     return true;
440b57cec5SDimitry Andric   }
450b57cec5SDimitry Andric 
460b57cec5SDimitry Andric   MachineBasicBlock::iterator
470b57cec5SDimitry Andric   eliminateCallFramePseudoInstr(MachineFunction &MF,
480b57cec5SDimitry Andric                                 MachineBasicBlock &MBB,
490b57cec5SDimitry Andric                                 MachineBasicBlock::iterator I) const override;
500b57cec5SDimitry Andric 
510b57cec5SDimitry Andric protected:
520b57cec5SDimitry Andric   uint64_t estimateStackSize(const MachineFunction &MF) const;
530b57cec5SDimitry Andric };
540b57cec5SDimitry Andric 
550b57cec5SDimitry Andric /// Create MipsFrameLowering objects.
560b57cec5SDimitry Andric const MipsFrameLowering *createMips16FrameLowering(const MipsSubtarget &ST);
570b57cec5SDimitry Andric const MipsFrameLowering *createMipsSEFrameLowering(const MipsSubtarget &ST);
580b57cec5SDimitry Andric 
590b57cec5SDimitry Andric } // End llvm namespace
600b57cec5SDimitry Andric 
610b57cec5SDimitry Andric #endif
62