1 //===- Thumb1FrameLowering.h - Thumb1-specific frame info stuff ---*- C++ -*-=//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_LIB_TARGET_ARM_THUMB1FRAMELOWERING_H
11 #define LLVM_LIB_TARGET_ARM_THUMB1FRAMELOWERING_H
13 #include "ARMFrameLowering.h"
18 class MachineFunction;
20 class Thumb1FrameLowering : public ARMFrameLowering {
22 explicit Thumb1FrameLowering(const ARMSubtarget &sti);
24 /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
26 void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
27 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
29 bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
30 MachineBasicBlock::iterator MI,
31 const std::vector<CalleeSavedInfo> &CSI,
32 const TargetRegisterInfo *TRI) const override;
33 bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
34 MachineBasicBlock::iterator MI,
35 std::vector<CalleeSavedInfo> &CSI,
36 const TargetRegisterInfo *TRI) const override;
38 bool hasReservedCallFrame(const MachineFunction &MF) const override;
40 MachineBasicBlock::iterator
41 eliminateCallFramePseudoInstr(MachineFunction &MF,
42 MachineBasicBlock &MBB,
43 MachineBasicBlock::iterator MI) const override;
45 /// Check whether or not the given \p MBB can be used as a epilogue
47 /// The epilogue will be inserted before the first terminator of that block.
48 /// This method is used by the shrink-wrapping pass to decide if
49 /// \p MBB will be correctly handled by the target.
50 bool canUseAsEpilogue(const MachineBasicBlock &MBB) const override;
52 /// Disable shrink wrap as tBfar/BL will be used to adjust for long jumps.
53 bool enableShrinkWrapping(const MachineFunction &MF) const override {
58 /// Check if the frame lowering of \p MF needs a special fixup
59 /// code sequence for the epilogue.
60 /// Unlike T2 and ARM mode, the T1 pop instruction cannot restore
61 /// to LR, and we can't pop the value directly to the PC when
62 /// we need to update the SP after popping the value. So instead
67 /// If this would clobber a return value, then generate this sequence instead:
74 bool needPopSpecialFixUp(const MachineFunction &MF) const;
76 /// Emit the special fixup code sequence for the epilogue.
77 /// \see needPopSpecialFixUp for more details.
78 /// \p DoIt, tells this method whether or not to actually insert
79 /// the code sequence in \p MBB. I.e., when \p DoIt is false,
80 /// \p MBB is left untouched.
81 /// \returns For \p DoIt == true: True when the emission succeeded
82 /// false otherwise. For \p DoIt == false: True when the emission
83 /// would have been possible, false otherwise.
84 bool emitPopSpecialFixUp(MachineBasicBlock &MBB, bool DoIt) const;
87 } // end namespace llvm
89 #endif // LLVM_LIB_TARGET_ARM_THUMB1FRAMELOWERING_H