Canonicalize header guards into a common format.
[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 LLVM_LIB_TARGET_ARM_ARMFRAMELOWERING_H
15 #define LLVM_LIB_TARGET_ARM_ARMFRAMELOWERING_H
16
17 #include "llvm/Target/TargetFrameLowering.h"
18
19 namespace llvm {
20   class ARMSubtarget;
21
22 class ARMFrameLowering : public TargetFrameLowering {
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) const override;
32   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
33
34   bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
35                                  MachineBasicBlock::iterator MI,
36                                  const std::vector<CalleeSavedInfo> &CSI,
37                                  const TargetRegisterInfo *TRI) const override;
38
39   bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
40                                   MachineBasicBlock::iterator MI,
41                                   const std::vector<CalleeSavedInfo> &CSI,
42                                   const TargetRegisterInfo *TRI) const override;
43
44   bool hasFP(const MachineFunction &MF) const override;
45   bool hasReservedCallFrame(const MachineFunction &MF) const override;
46   bool canSimplifyCallFramePseudos(const MachineFunction &MF) const override;
47   int getFrameIndexReference(const MachineFunction &MF, int FI,
48                              unsigned &FrameReg) const override;
49   int ResolveFrameIndexReference(const MachineFunction &MF, int FI,
50                                  unsigned &FrameReg, int SPAdj) const;
51   int getFrameIndexOffset(const MachineFunction &MF, int FI) const override;
52
53   void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
54                                             RegScavenger *RS) const override;
55
56   void adjustForSegmentedStacks(MachineFunction &MF) const override;
57
58  private:
59   void emitPushInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
60                     const std::vector<CalleeSavedInfo> &CSI, unsigned StmOpc,
61                     unsigned StrOpc, bool NoGap,
62                     bool(*Func)(unsigned, bool), unsigned NumAlignedDPRCS2Regs,
63                     unsigned MIFlags = 0) const;
64   void emitPopInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
65                    const std::vector<CalleeSavedInfo> &CSI, unsigned LdmOpc,
66                    unsigned LdrOpc, bool isVarArg, bool NoGap,
67                    bool(*Func)(unsigned, bool),
68                    unsigned NumAlignedDPRCS2Regs) const;
69
70   void
71   eliminateCallFramePseudoInstr(MachineFunction &MF,
72                                 MachineBasicBlock &MBB,
73                                 MachineBasicBlock::iterator MI) const override;
74 };
75
76 } // End llvm namespace
77
78 #endif