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 "MipsReturnProtectorLowering.h" 18 #include "llvm/CodeGen/TargetFrameLowering.h" 19 20 namespace llvm { 21 class MipsSubtarget; 22 23 class MipsFrameLowering : public TargetFrameLowering { 24 protected: 25 const MipsSubtarget &STI; 26 27 public: 28 29 const MipsReturnProtectorLowering RPL; 30 MipsFrameLowering(const MipsSubtarget & sti,Align Alignment)31 explicit MipsFrameLowering(const MipsSubtarget &sti, Align Alignment) 32 : TargetFrameLowering(StackGrowsDown, Alignment, 0, Alignment), STI(sti), RPL() { 33 } 34 35 static const MipsFrameLowering *create(const MipsSubtarget &ST); 36 37 bool hasFP(const MachineFunction &MF) const override; 38 39 bool hasBP(const MachineFunction &MF) const; 40 allocateScavengingFrameIndexesNearIncomingSP(const MachineFunction & MF)41 bool allocateScavengingFrameIndexesNearIncomingSP( 42 const MachineFunction &MF) const override { 43 return false; 44 } 45 enableShrinkWrapping(const MachineFunction & MF)46 bool enableShrinkWrapping(const MachineFunction &MF) const override { 47 return true; 48 } 49 50 const ReturnProtectorLowering *getReturnProtector() const override; 51 52 MachineBasicBlock::iterator 53 eliminateCallFramePseudoInstr(MachineFunction &MF, 54 MachineBasicBlock &MBB, 55 MachineBasicBlock::iterator I) const override; 56 57 protected: 58 uint64_t estimateStackSize(const MachineFunction &MF) const; 59 }; 60 61 /// Create MipsFrameLowering objects. 62 const MipsFrameLowering *createMips16FrameLowering(const MipsSubtarget &ST); 63 const MipsFrameLowering *createMipsSEFrameLowering(const MipsSubtarget &ST); 64 65 } // End llvm namespace 66 67 #endif 68