LLVM  3.7.0
PPCFrameLowering.h
Go to the documentation of this file.
1 //===-- PPCFrameLowering.h - Define frame lowering for PowerPC --*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_POWERPC_PPCFRAMELOWERING_H
14 #define LLVM_LIB_TARGET_POWERPC_PPCFRAMELOWERING_H
15 
16 #include "PPC.h"
17 #include "llvm/ADT/STLExtras.h"
20 
21 namespace llvm {
22 class PPCSubtarget;
23 
25  const PPCSubtarget &Subtarget;
26  const unsigned ReturnSaveOffset;
27  const unsigned TOCSaveOffset;
28  const unsigned FramePointerSaveOffset;
29  const unsigned LinkageSize;
30  const unsigned BasePointerSaveOffset;
31 
32 public:
33  PPCFrameLowering(const PPCSubtarget &STI);
34 
36  bool UpdateMF = true,
37  bool UseEstimate = false) const;
38 
39  /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
40  /// the function.
41  void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
42  void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
43 
44  bool hasFP(const MachineFunction &MF) const override;
45  bool needsFP(const MachineFunction &MF) const;
46  void replaceFPWithRealFP(MachineFunction &MF) const;
47 
48  void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
49  RegScavenger *RS = nullptr) const override;
51  RegScavenger *RS = nullptr) const override;
53 
56  const std::vector<CalleeSavedInfo> &CSI,
57  const TargetRegisterInfo *TRI) const override;
58 
60  MachineBasicBlock &MBB,
61  MachineBasicBlock::iterator I) const override;
62 
65  const std::vector<CalleeSavedInfo> &CSI,
66  const TargetRegisterInfo *TRI) const override;
67 
68  /// targetHandlesStackFrameRounding - Returns true if the target is
69  /// responsible for rounding up the stack frame (probably at emitPrologue
70  /// time).
71  bool targetHandlesStackFrameRounding() const override { return true; }
72 
73  /// getReturnSaveOffset - Return the previous frame offset to save the
74  /// return address.
75  unsigned getReturnSaveOffset() const { return ReturnSaveOffset; }
76 
77  /// getTOCSaveOffset - Return the previous frame offset to save the
78  /// TOC register -- 64-bit SVR4 ABI only.
79  unsigned getTOCSaveOffset() const { return TOCSaveOffset; }
80 
81  /// getFramePointerSaveOffset - Return the previous frame offset to save the
82  /// frame pointer.
83  unsigned getFramePointerSaveOffset() const { return FramePointerSaveOffset; }
84 
85  /// getBasePointerSaveOffset - Return the previous frame offset to save the
86  /// base pointer.
87  unsigned getBasePointerSaveOffset() const { return BasePointerSaveOffset; }
88 
89  /// getLinkageSize - Return the size of the PowerPC ABI linkage area.
90  ///
91  unsigned getLinkageSize() const { return LinkageSize; }
92 
93  const SpillSlot *
94  getCalleeSavedSpillSlots(unsigned &NumEntries) const override;
95 };
96 } // End llvm namespace
97 
98 #endif
void replaceFPWithRealFP(MachineFunction &MF) const
bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const std::vector< CalleeSavedInfo > &CSI, const TargetRegisterInfo *TRI) const override
spillCalleeSavedRegisters - Issues instruction(s) to spill all callee saved registers and returns tru...
const SpillSlot * getCalleeSavedSpillSlots(unsigned &NumEntries) const override
getCalleeSavedSpillSlots - This method returns a pointer to an array of pairs, that contains an entry...
void eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const override
eliminateCallFramePseudoInstr - This method is called during prolog/epilog code insertion to eliminat...
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override
void processFunctionBeforeFrameFinalized(MachineFunction &MF, RegScavenger *RS=nullptr) const override
processFunctionBeforeFrameFinalized - This method is called immediately before the specified function...
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register...
unsigned getReturnSaveOffset() const
getReturnSaveOffset - Return the previous frame offset to save the return address.
void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS=nullptr) const override
This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() sh...
unsigned getBasePointerSaveOffset() const
getBasePointerSaveOffset - Return the previous frame offset to save the base pointer.
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.
bool targetHandlesStackFrameRounding() const override
targetHandlesStackFrameRounding - Returns true if the target is responsible for rounding up the stack...
bundle_iterator< MachineInstr, instr_iterator > iterator
unsigned getFramePointerSaveOffset() const
getFramePointerSaveOffset - Return the previous frame offset to save the frame pointer.
void addScavengingSpillSlot(MachineFunction &MF, RegScavenger *RS) const
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
unsigned getTOCSaveOffset() const
getTOCSaveOffset - Return the previous frame offset to save the TOC register – 64-bit SVR4 ABI only...
Information about stack frame layout on the target.
unsigned determineFrameLayout(MachineFunction &MF, bool UpdateMF=true, bool UseEstimate=false) const
determineFrameLayout - Determine the size of the frame and maximum call frame size.
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const std::vector< CalleeSavedInfo > &CSI, const TargetRegisterInfo *TRI) const override
restoreCalleeSavedRegisters - Issues instruction(s) to restore all callee saved registers and returns...
bool needsFP(const MachineFunction &MF) const
PPCFrameLowering(const PPCSubtarget &STI)
#define I(x, y, z)
Definition: MD5.cpp:54
unsigned getLinkageSize() const
getLinkageSize - Return the size of the PowerPC ABI linkage area.