LLVM  3.7.0
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 //
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_ARM_ARMFRAMELOWERING_H
15 #define LLVM_LIB_TARGET_ARM_ARMFRAMELOWERING_H
16 
18 
19 namespace llvm {
20  class ARMSubtarget;
21 
23 protected:
24  const ARMSubtarget &STI;
25 
26 public:
27  explicit ARMFrameLowering(const ARMSubtarget &sti);
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 
34  void fixTCReturn(MachineFunction &MF, MachineBasicBlock &MBB) const;
35 
38  const std::vector<CalleeSavedInfo> &CSI,
39  const TargetRegisterInfo *TRI) const override;
40 
43  const std::vector<CalleeSavedInfo> &CSI,
44  const TargetRegisterInfo *TRI) const override;
45 
46  bool noFramePointerElim(const MachineFunction &MF) const override;
47 
48  bool hasFP(const MachineFunction &MF) const override;
49  bool hasReservedCallFrame(const MachineFunction &MF) const override;
50  bool canSimplifyCallFramePseudos(const MachineFunction &MF) const override;
51  int getFrameIndexReference(const MachineFunction &MF, int FI,
52  unsigned &FrameReg) const override;
53  int ResolveFrameIndexReference(const MachineFunction &MF, int FI,
54  unsigned &FrameReg, int SPAdj) const;
55  int getFrameIndexOffset(const MachineFunction &MF, int FI) const override;
56 
57  void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
58  RegScavenger *RS) const override;
59 
61  MachineBasicBlock &MBB) const override;
62 
63  private:
64  void emitPushInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
65  const std::vector<CalleeSavedInfo> &CSI, unsigned StmOpc,
66  unsigned StrOpc, bool NoGap,
67  bool(*Func)(unsigned, bool), unsigned NumAlignedDPRCS2Regs,
68  unsigned MIFlags = 0) const;
69  void emitPopInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
70  const std::vector<CalleeSavedInfo> &CSI, unsigned LdmOpc,
71  unsigned LdrOpc, bool isVarArg, bool NoGap,
72  bool(*Func)(unsigned, bool),
73  unsigned NumAlignedDPRCS2Regs) const;
74 
75  void
76  eliminateCallFramePseudoInstr(MachineFunction &MF,
77  MachineBasicBlock &MBB,
78  MachineBasicBlock::iterator MI) const override;
79 };
80 
81 } // End llvm namespace
82 
83 #endif
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.
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.
int ResolveFrameIndexReference(const MachineFunction &MF, int FI, unsigned &FrameReg, int SPAdj) const
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.
int getFrameIndexOffset(const MachineFunction &MF, int FI) const override
getFrameIndexOffset - Returns the displacement from the frame register to the stack frame of the spec...
bundle_iterator< MachineInstr, instr_iterator > iterator
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.
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...
void fixTCReturn(MachineFunction &MF, MachineBasicBlock &MBB) const
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 noFramePointerElim(const MachineFunction &MF) const override
Return true if the target needs to disable frame pointer elimination.
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 ARMSubtarget & STI