LLVM  8.0.1
ARMFrameLowering.h
Go to the documentation of this file.
1 //===- ARMTargetFrameLowering.h - Define frame lowering for ARM -*- 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 #ifndef LLVM_LIB_TARGET_ARM_ARMFRAMELOWERING_H
11 #define LLVM_LIB_TARGET_ARM_ARMFRAMELOWERING_H
12 
15 #include <vector>
16 
17 namespace llvm {
18 
19 class ARMSubtarget;
20 class CalleeSavedInfo;
21 class MachineFunction;
22 
24 protected:
25  const ARMSubtarget &STI;
26 
27 public:
28  explicit ARMFrameLowering(const ARMSubtarget &sti);
29 
30  /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
31  /// the function.
32  void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
33  void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
34 
37  const std::vector<CalleeSavedInfo> &CSI,
38  const TargetRegisterInfo *TRI) const override;
39 
42  std::vector<CalleeSavedInfo> &CSI,
43  const TargetRegisterInfo *TRI) const override;
44 
45  bool keepFramePointer(const MachineFunction &MF) const override;
46 
47  bool enableCalleeSaveSkip(const MachineFunction &MF) const override;
48 
49  bool hasFP(const MachineFunction &MF) const override;
50  bool hasReservedCallFrame(const MachineFunction &MF) const override;
51  bool canSimplifyCallFramePseudos(const MachineFunction &MF) const override;
52  int getFrameIndexReference(const MachineFunction &MF, int FI,
53  unsigned &FrameReg) const override;
54  int ResolveFrameIndexReference(const MachineFunction &MF, int FI,
55  unsigned &FrameReg, int SPAdj) const;
56 
57  void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
58  RegScavenger *RS) const override;
59 
61  MachineBasicBlock &MBB) const override;
62 
63  /// Returns true if the target will correctly handle shrink wrapping.
64  bool enableShrinkWrapping(const MachineFunction &MF) const override {
65  return true;
66  }
67 
68 private:
69  void emitPushInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
70  const std::vector<CalleeSavedInfo> &CSI, unsigned StmOpc,
71  unsigned StrOpc, bool NoGap,
72  bool(*Func)(unsigned, bool), unsigned NumAlignedDPRCS2Regs,
73  unsigned MIFlags = 0) const;
74  void emitPopInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
75  std::vector<CalleeSavedInfo> &CSI, unsigned LdmOpc,
76  unsigned LdrOpc, bool isVarArg, bool NoGap,
77  bool(*Func)(unsigned, bool),
78  unsigned NumAlignedDPRCS2Regs) const;
79 
81  eliminateCallFramePseudoInstr(MachineFunction &MF,
82  MachineBasicBlock &MBB,
83  MachineBasicBlock::iterator MI) const override;
84 };
85 
86 } // end namespace llvm
87 
88 #endif // LLVM_LIB_TARGET_ARM_ARMFRAMELOWERING_H
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.
This class represents lattice values for constants.
Definition: AllocatorList.h:24
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register...
void adjustForSegmentedStacks(MachineFunction &MF, MachineBasicBlock &MBB) const override
Adjust the prologue to have the function use segmented stacks.
unsigned const TargetRegisterInfo * TRI
bool hasReservedCallFrame(const MachineFunction &MF) const override
hasReservedCallFrame - Under normal circumstances, when a frame pointer is not required, we reserve argument space for call sites in the function immediately on entry to the current function.
bool keepFramePointer(const MachineFunction &MF) const override
Return true if the target wants to keep the frame pointer regardless of the function attribute "frame...
bool enableCalleeSaveSkip(const MachineFunction &MF) const override
Returns true if the target can safely skip saving callee-saved registers for noreturn nounwind functi...
int ResolveFrameIndexReference(const MachineFunction &MF, int FI, unsigned &FrameReg, int SPAdj) const
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, std::vector< CalleeSavedInfo > &CSI, const TargetRegisterInfo *TRI) const override
restoreCalleeSavedRegisters - Issues instruction(s) to restore all callee saved registers and returns...
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override
void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS) const override
This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() sh...
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
int getFrameIndexReference(const MachineFunction &MF, int FI, unsigned &FrameReg) const override
getFrameIndexReference - Provide a base+offset reference to an FI slot for debug info.
Information about stack frame layout on the target.
ARMFrameLowering(const ARMSubtarget &sti)
bool canSimplifyCallFramePseudos(const MachineFunction &MF) const override
canSimplifyCallFramePseudos - If there is a reserved call frame, the call frame pseudos can be simpli...
bool enableShrinkWrapping(const MachineFunction &MF) const override
Returns true if the target will correctly handle shrink wrapping.
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...
IRTranslator LLVM IR MI
const ARMSubtarget & STI