[PowerPC] Materialize more constants with CR-field set in late peephole
[llvm-core.git] / lib / Target / ARM / ARMFrameLowering.h
blobe994cab28fe7783b14dc8b349b8c66e3a1bb7966
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 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_LIB_TARGET_ARM_ARMFRAMELOWERING_H
11 #define LLVM_LIB_TARGET_ARM_ARMFRAMELOWERING_H
13 #include "llvm/CodeGen/MachineBasicBlock.h"
14 #include "llvm/CodeGen/TargetFrameLowering.h"
15 #include <vector>
17 namespace llvm {
19 class ARMSubtarget;
20 class CalleeSavedInfo;
21 class MachineFunction;
23 class ARMFrameLowering : public TargetFrameLowering {
24 protected:
25 const ARMSubtarget &STI;
27 public:
28 explicit ARMFrameLowering(const ARMSubtarget &sti);
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;
35 bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
36 MachineBasicBlock::iterator MI,
37 const std::vector<CalleeSavedInfo> &CSI,
38 const TargetRegisterInfo *TRI) const override;
40 bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
41 MachineBasicBlock::iterator MI,
42 std::vector<CalleeSavedInfo> &CSI,
43 const TargetRegisterInfo *TRI) const override;
45 bool noFramePointerElim(const MachineFunction &MF) const override;
47 bool enableCalleeSaveSkip(const MachineFunction &MF) const override;
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;
57 void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
58 RegScavenger *RS) const override;
60 void adjustForSegmentedStacks(MachineFunction &MF,
61 MachineBasicBlock &MBB) const override;
63 /// Returns true if the target will correctly handle shrink wrapping.
64 bool enableShrinkWrapping(const MachineFunction &MF) const override {
65 return true;
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;
80 MachineBasicBlock::iterator
81 eliminateCallFramePseudoInstr(MachineFunction &MF,
82 MachineBasicBlock &MBB,
83 MachineBasicBlock::iterator MI) const override;
86 } // end namespace llvm
88 #endif // LLVM_LIB_TARGET_ARM_ARMFRAMELOWERING_H