[C++11] Add 'override' keywords and remove 'virtual'. Additionally add 'final' and...
[oota-llvm.git] / lib / Target / ARM / ARMFrameLowering.h
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 ARM_FRAMEINFO_H
15 #define ARM_FRAMEINFO_H
16
17 #include "ARMSubtarget.h"
18 #include "llvm/Target/TargetFrameLowering.h"
19
20 namespace llvm {
21   class ARMSubtarget;
22
23 class ARMFrameLowering : public TargetFrameLowering {
24 protected:
25   const ARMSubtarget &STI;
26
27 public:
28   explicit ARMFrameLowering(const ARMSubtarget &sti)
29     : TargetFrameLowering(StackGrowsDown, sti.getStackAlignment(), 0, 4),
30       STI(sti) {
31   }
32
33   /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
34   /// the function.
35   void emitPrologue(MachineFunction &MF) const override;
36   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
37
38   bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
39                                  MachineBasicBlock::iterator MI,
40                                  const std::vector<CalleeSavedInfo> &CSI,
41                                  const TargetRegisterInfo *TRI) const override;
42
43   bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
44                                   MachineBasicBlock::iterator MI,
45                                   const std::vector<CalleeSavedInfo> &CSI,
46                                   const TargetRegisterInfo *TRI) 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 processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
58                                             RegScavenger *RS) const override;
59
60   void adjustForSegmentedStacks(MachineFunction &MF) const override;
61
62  private:
63   void emitPushInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
64                     const std::vector<CalleeSavedInfo> &CSI, unsigned StmOpc,
65                     unsigned StrOpc, bool NoGap,
66                     bool(*Func)(unsigned, bool), unsigned NumAlignedDPRCS2Regs,
67                     unsigned MIFlags = 0) const;
68   void emitPopInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
69                    const std::vector<CalleeSavedInfo> &CSI, unsigned LdmOpc,
70                    unsigned LdrOpc, bool isVarArg, bool NoGap,
71                    bool(*Func)(unsigned, bool),
72                    unsigned NumAlignedDPRCS2Regs) const;
73
74   void
75   eliminateCallFramePseudoInstr(MachineFunction &MF,
76                                 MachineBasicBlock &MBB,
77                                 MachineBasicBlock::iterator MI) const override;
78 };
79
80 } // End llvm namespace
81
82 #endif