LLVM  16.0.0git
CSKYFrameLowering.h
Go to the documentation of this file.
1 //===-- CSKYFrameLowering.h - Define frame lowering for CSKY -*- 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 // This class implements CSKY-specific bits of TargetFrameLowering class.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_CSKY_CSKYFRAMELOWERING_H
14 #define LLVM_LIB_TARGET_CSKY_CSKYFRAMELOWERING_H
15 
17 
18 namespace llvm {
19 class CSKYSubtarget;
20 
22  const CSKYSubtarget &STI;
23 
24  void determineFrameLayout(MachineFunction &MF) const;
26  const DebugLoc &DL, Register DestReg, Register SrcReg,
27  int64_t Val, MachineInstr::MIFlag Flag) const;
28 
29 public:
30  explicit CSKYFrameLowering(const CSKYSubtarget &STI)
32  /*StackAlignment=*/Align(4),
33  /*LocalAreaOffset=*/0),
34  STI(STI) {}
35 
36  void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
37  void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
38 
40  Register &FrameReg) const override;
41 
42  void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
43  RegScavenger *RS) const override;
44 
47  std::vector<CalleeSavedInfo> &CSI) const override {
48 
49  std::reverse(CSI.begin(), CSI.end());
50 
51  return false;
52  }
53 
57  const TargetRegisterInfo *TRI) const override;
58  bool
62  const TargetRegisterInfo *TRI) const override;
63 
64  bool hasFP(const MachineFunction &MF) const override;
65  bool hasBP(const MachineFunction &MF) const;
66 
67  bool hasReservedCallFrame(const MachineFunction &MF) const override;
68 
71  MachineBasicBlock::iterator MI) const override;
72 };
73 } // namespace llvm
74 #endif
llvm::CSKYFrameLowering::spillCalleeSavedRegisters
bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, ArrayRef< CalleeSavedInfo > CSI, const TargetRegisterInfo *TRI) const override
spillCalleeSavedRegisters - Issues instruction(s) to spill all callee saved registers and returns tru...
Definition: CSKYFrameLowering.cpp:463
llvm::CSKYFrameLowering
Definition: CSKYFrameLowering.h:21
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:108
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
TargetFrameLowering.h
llvm::TargetFrameLowering
Information about stack frame layout on the target.
Definition: TargetFrameLowering.h:43
llvm::CSKYFrameLowering::eliminateCallFramePseudoInstr
MachineBasicBlock::iterator eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const override
This method is called during prolog/epilog code insertion to eliminate call frame setup and destroy p...
Definition: CSKYFrameLowering.cpp:508
llvm::CSKYFrameLowering::restoreCalleeSavedRegisters
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, MutableArrayRef< CalleeSavedInfo > CSI, const TargetRegisterInfo *TRI) const override
restoreCalleeSavedRegisters - Issues instruction(s) to restore all callee saved registers and returns...
Definition: CSKYFrameLowering.cpp:485
llvm::TargetRegisterInfo
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Definition: TargetRegisterInfo.h:237
llvm::CSKYFrameLowering::emitEpilogue
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override
Definition: CSKYFrameLowering.cpp:223
TRI
unsigned const TargetRegisterInfo * TRI
Definition: MachineSink.cpp:1628
llvm::CSKYFrameLowering::emitPrologue
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.
Definition: CSKYFrameLowering.cpp:78
llvm::CSKYFrameLowering::getFrameIndexReference
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...
Definition: CSKYFrameLowering.cpp:580
llvm::MutableArrayRef
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Definition: ArrayRef.h:28
llvm::CSKYFrameLowering::hasReservedCallFrame
bool hasReservedCallFrame(const MachineFunction &MF) const override
hasReservedCallFrame - Under normal circumstances, when a frame pointer is not required,...
Definition: CSKYFrameLowering.cpp:459
llvm::MCID::Flag
Flag
These should be considered private to the implementation of the MCInstrDesc class.
Definition: MCInstrDesc.h:147
llvm::BitVector
Definition: BitVector.h:75
llvm::CSKYFrameLowering::determineCalleeSaves
void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS) const override
This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() sh...
Definition: CSKYFrameLowering.cpp:357
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
llvm::CSKYFrameLowering::hasBP
bool hasBP(const MachineFunction &MF) const
Definition: CSKYFrameLowering.cpp:45
llvm::CSKYSubtarget
Definition: CSKYSubtarget.h:30
llvm::MachineBasicBlock
Definition: MachineBasicBlock.h:94
llvm::CSKYFrameLowering::hasFP
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register.
Definition: CSKYFrameLowering.cpp:36
llvm::RegScavenger
Definition: RegisterScavenging.h:34
llvm::MachineInstr::MIFlag
MIFlag
Definition: MachineInstr.h:82
llvm::MachineFunction
Definition: MachineFunction.h:257
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
MBBI
MachineBasicBlock MachineBasicBlock::iterator MBBI
Definition: AArch64SLSHardening.cpp:75
llvm::StackOffset
StackOffset is a class to represent an offset with 2 dimensions, named fixed and scalable,...
Definition: TypeSize.h:134
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::Register
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
MBB
MachineBasicBlock & MBB
Definition: AArch64SLSHardening.cpp:74
llvm::CSKYFrameLowering::CSKYFrameLowering
CSKYFrameLowering(const CSKYSubtarget &STI)
Definition: CSKYFrameLowering.h:30
llvm::CSKYFrameLowering::assignCalleeSavedSpillSlots
bool assignCalleeSavedSpillSlots(MachineFunction &MF, const TargetRegisterInfo *TRI, std::vector< CalleeSavedInfo > &CSI) const override
Definition: CSKYFrameLowering.h:45
llvm::reverse
auto reverse(ContainerTy &&C)
Definition: STLExtras.h:485
llvm::TargetFrameLowering::StackGrowsDown
@ StackGrowsDown
Definition: TargetFrameLowering.h:47
llvm::DebugLoc
A debug info location.
Definition: DebugLoc.h:33
llvm::MachineInstrBundleIterator< MachineInstr >