1 //===-- SparcFrameLowering.h - Define frame lowering for Sparc --*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_SPARC_SPARCFRAMELOWERING_H
14 #define LLVM_LIB_TARGET_SPARC_SPARCFRAMELOWERING_H
17 #include "llvm/CodeGen/TargetFrameLowering.h"
22 class SparcFrameLowering
: public TargetFrameLowering
{
24 explicit SparcFrameLowering(const SparcSubtarget
&ST
);
26 /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
28 void emitPrologue(MachineFunction
&MF
, MachineBasicBlock
&MBB
) const override
;
29 void emitEpilogue(MachineFunction
&MF
, MachineBasicBlock
&MBB
) const override
;
31 MachineBasicBlock::iterator
32 eliminateCallFramePseudoInstr(MachineFunction
&MF
,
33 MachineBasicBlock
&MBB
,
34 MachineBasicBlock::iterator I
) const override
;
36 bool hasReservedCallFrame(const MachineFunction
&MF
) const override
;
37 bool hasFP(const MachineFunction
&MF
) const override
;
38 void determineCalleeSaves(MachineFunction
&MF
, BitVector
&SavedRegs
,
39 RegScavenger
*RS
= nullptr) const override
;
41 int getFrameIndexReference(const MachineFunction
&MF
, int FI
,
42 unsigned &FrameReg
) const override
;
44 /// targetHandlesStackFrameRounding - Returns true if the target is
45 /// responsible for rounding up the stack frame (probably at emitPrologue
47 bool targetHandlesStackFrameRounding() const override
{ return true; }
50 // Remap input registers to output registers for leaf procedure.
51 void remapRegsForLeafProc(MachineFunction
&MF
) const;
53 // Returns true if MF is a leaf procedure.
54 bool isLeafProc(MachineFunction
&MF
) const;
57 // Emits code for adjusting SP in function prologue/epilogue.
58 void emitSPAdjustment(MachineFunction
&MF
,
59 MachineBasicBlock
&MBB
,
60 MachineBasicBlock::iterator MBBI
,
61 int NumBytes
, unsigned ADDrr
, unsigned ADDri
) const;
65 } // End llvm namespace