LLVM 24.0.0git
SparcFrameLowering.h
Go to the documentation of this file.
1//===-- SparcFrameLowering.h - Define frame lowering for Sparc --*- 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_SPARC_SPARCFRAMELOWERING_H
14#define LLVM_LIB_TARGET_SPARC_SPARCFRAMELOWERING_H
15
16#include "Sparc.h"
19
20namespace llvm {
21
22class SparcSubtarget;
24 const SparcSubtarget &STI;
25
26public:
27 explicit SparcFrameLowering(const SparcSubtarget &ST);
28
29 /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
30 /// the function.
31 void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
32 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
33
37 MachineBasicBlock::iterator I) const override;
38
39 bool hasReservedCallFrame(const MachineFunction &MF) const override;
41 RegScavenger *RS = nullptr) const override;
42
44 Register &FrameReg) const override;
45
46 /// targetHandlesStackFrameRounding - Returns true if the target is
47 /// responsible for rounding up the stack frame (probably at emitPrologue
48 /// time).
49 bool targetHandlesStackFrameRounding() const override { return true; }
50
52 RegScavenger *RS) const override;
53
54protected:
55 bool hasFPImpl(const MachineFunction &MF) const override;
56
57private:
58 // Remap input registers to output registers for leaf procedure.
59 void remapRegsForLeafProc(MachineFunction &MF) const;
60
61 // Returns true if MF is a leaf procedure.
62 bool isLeafProc(MachineFunction &MF) const;
63
64
65 // Emits code for adjusting SP in function prologue/epilogue.
66 void emitSPAdjustment(MachineFunction &MF, MachineBasicBlock &MBB,
68 int NumBytes, unsigned ADDrr, unsigned ADDri) const;
69};
70
71} // End llvm namespace
72
73#endif
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator MBBI
#define I(x, y, z)
Definition MD5.cpp:57
A debug info location.
Definition DebugLoc.h:126
MachineInstrBundleIterator< MachineInstr > iterator
Wrapper class representing virtual and physical registers.
Definition Register.h:20
void processFunctionBeforeFrameFinalized(MachineFunction &MF, RegScavenger *RS) const override
processFunctionBeforeFrameFinalized - This method is called immediately before the specified function...
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.
SparcFrameLowering(const SparcSubtarget &ST)
bool targetHandlesStackFrameRounding() const override
targetHandlesStackFrameRounding - Returns true if the target is responsible for rounding up the stack...
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override
void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS=nullptr) const override
This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() sh...
bool hasFPImpl(const MachineFunction &MF) const override
StackOffset getFrameIndexReference(const MachineFunction &MF, int FI, Register &FrameReg) const override
getFrameIndexReference - This method should return the base register and offset used to reference a f...
MachineBasicBlock::iterator eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const override
This method is called during prolog/epilog code insertion to eliminate call frame setup and destroy p...
bool hasReservedCallFrame(const MachineFunction &MF) const override
hasReservedCallFrame - Under normal circumstances, when a frame pointer is not required,...
StackOffset holds a fixed and a scalable offset in bytes.
Definition TypeSize.h:31
TargetFrameLowering(StackDirection D, Align StackAl, int LAO, Align TransAl=Align(1), bool StackReal=true)
This is an optimization pass for GlobalISel generic memory operations.