LLVM  13.0.0git
SystemZFrameLowering.h
Go to the documentation of this file.
1 //===-- SystemZFrameLowering.h - Frame lowering for SystemZ -----*- 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 #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZFRAMELOWERING_H
10 #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZFRAMELOWERING_H
11 
13 #include "llvm/ADT/IndexedMap.h"
15 #include "llvm/Support/TypeSize.h"
16 
17 namespace llvm {
18 class SystemZTargetMachine;
19 class SystemZSubtarget;
20 
22  IndexedMap<unsigned> RegSpillOffsets;
23 
24 public:
26 
27  // Override TargetFrameLowering.
28  bool isFPCloseToIncomingSP() const override { return false; }
29  bool
31  const TargetRegisterInfo *TRI,
32  std::vector<CalleeSavedInfo> &CSI) const override;
33  void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
34  RegScavenger *RS) const override;
38  const TargetRegisterInfo *TRI) const override;
39  bool
43  const TargetRegisterInfo *TRI) const override;
45  RegScavenger *RS) const override;
46  void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
47  void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
49  MachineBasicBlock &PrologMBB) const override;
50  bool hasFP(const MachineFunction &MF) const override;
51  bool hasReservedCallFrame(const MachineFunction &MF) const override;
53  Register &FrameReg) const override;
56  MachineBasicBlock::iterator MI) const override;
57 
58  // Return the byte offset from the incoming stack pointer of Reg's
59  // ABI-defined save slot. Return 0 if no slot is defined for Reg. Adjust
60  // the offset in case MF has packed-stack.
61  unsigned getRegSpillOffset(MachineFunction &MF, Register Reg) const;
62 
63  // Get or create the frame index of where the old frame pointer is stored.
65 
66  bool usePackedStack(MachineFunction &MF) const;
67 
68  // Return the offset of the backchain.
69  unsigned getBackchainOffset(MachineFunction &MF) const {
70  // The back chain is stored topmost with packed-stack.
71  return usePackedStack(MF) ? SystemZMC::ELFCallFrameSize - 8 : 0;
72  }
73 };
74 } // end namespace llvm
75 
76 #endif
llvm::SystemZFrameLowering::spillCalleeSavedRegisters
bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, ArrayRef< CalleeSavedInfo > CSI, const TargetRegisterInfo *TRI) const override
spillCalleeSavedRegisters - Issues instruction(s) to spill all callee saved registers and returns tru...
Definition: SystemZFrameLowering.cpp:199
IndexedMap.h
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:102
llvm::SystemZFrameLowering::isFPCloseToIncomingSP
bool isFPCloseToIncomingSP() const override
isFPCloseToIncomingSP - Return true if the frame pointer is close to the incoming stack pointer,...
Definition: SystemZFrameLowering.h:28
llvm
Definition: AllocatorList.h:23
Reg
unsigned Reg
Definition: MachineSink.cpp:1566
TargetFrameLowering.h
llvm::TargetFrameLowering
Information about stack frame layout on the target.
Definition: TargetFrameLowering.h:43
llvm::SystemZFrameLowering::inlineStackProbe
void inlineStackProbe(MachineFunction &MF, MachineBasicBlock &PrologMBB) const override
Replace a StackProbe stub (if any) with the actual probe code inline.
Definition: SystemZFrameLowering.cpp:622
llvm::SystemZFrameLowering::determineCalleeSaves
void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS) const override
This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() sh...
Definition: SystemZFrameLowering.cpp:133
TypeSize.h
llvm::SystemZFrameLowering::getBackchainOffset
unsigned getBackchainOffset(MachineFunction &MF) const
Definition: SystemZFrameLowering.h:69
llvm::TargetRegisterInfo
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Definition: TargetRegisterInfo.h:231
llvm::SystemZFrameLowering::hasReservedCallFrame
bool hasReservedCallFrame(const MachineFunction &MF) const override
hasReservedCallFrame - Under normal circumstances, when a frame pointer is not required,...
Definition: SystemZFrameLowering.cpp:729
llvm::SystemZFrameLowering::restoreCalleeSavedRegisters
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBII, MutableArrayRef< CalleeSavedInfo > CSI, const TargetRegisterInfo *TRI) const override
restoreCalleeSavedRegisters - Issues instruction(s) to restore all callee saved registers and returns...
Definition: SystemZFrameLowering.cpp:259
SystemZMCTargetDesc.h
llvm::SystemZFrameLowering::usePackedStack
bool usePackedStack(MachineFunction &MF) const
Definition: SystemZFrameLowering.cpp:794
llvm::SystemZFrameLowering::processFunctionBeforeFrameFinalized
void processFunctionBeforeFrameFinalized(MachineFunction &MF, RegScavenger *RS) const override
processFunctionBeforeFrameFinalized - This method is called immediately before the specified function...
Definition: SystemZFrameLowering.cpp:316
TRI
unsigned const TargetRegisterInfo * TRI
Definition: MachineSink.cpp:1567
llvm::SystemZFrameLowering::getOrCreateFramePointerSaveIndex
int getOrCreateFramePointerSaveIndex(MachineFunction &MF) const
Definition: SystemZFrameLowering.cpp:782
llvm::MutableArrayRef
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Definition: ArrayRef.h:307
llvm::IndexedMap< unsigned >
llvm::SystemZFrameLowering::getRegSpillOffset
unsigned getRegSpillOffset(MachineFunction &MF, Register Reg) const
Definition: SystemZFrameLowering.cpp:764
llvm::BitVector
Definition: BitVector.h:74
llvm::SystemZFrameLowering::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: SystemZFrameLowering.cpp:748
llvm::MachineBasicBlock
Definition: MachineBasicBlock.h:95
llvm::SystemZFrameLowering::emitPrologue
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.
Definition: SystemZFrameLowering.cpp:413
llvm::SystemZFrameLowering::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: SystemZFrameLowering.cpp:738
llvm::RegScavenger
Definition: RegisterScavenging.h:34
llvm::MachineFunction
Definition: MachineFunction.h:230
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
llvm::Register
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
MBB
MachineBasicBlock & MBB
Definition: AArch64SLSHardening.cpp:74
llvm::SystemZFrameLowering::SystemZFrameLowering
SystemZFrameLowering()
Definition: SystemZFrameLowering.cpp:49
llvm::SystemZFrameLowering::assignCalleeSavedSpillSlots
bool assignCalleeSavedSpillSlots(MachineFunction &MF, const TargetRegisterInfo *TRI, std::vector< CalleeSavedInfo > &CSI) const override
Definition: SystemZFrameLowering.cpp:67
llvm::SystemZFrameLowering
Definition: SystemZFrameLowering.h:21
llvm::SystemZFrameLowering::emitEpilogue
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override
Definition: SystemZFrameLowering.cpp:576
llvm::MachineInstrBundleIterator< MachineInstr >
llvm::SystemZFrameLowering::hasFP
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register.
Definition: SystemZFrameLowering.cpp:722
llvm::SystemZMC::ELFCallFrameSize
const int64_t ELFCallFrameSize
Definition: SystemZMCTargetDesc.h:35