]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/ARM/ARMFrameLowering.h
Merge compiler-rt trunk r321414 to contrib/compiler-rt.
[FreeBSD/FreeBSD.git] / contrib / llvm / 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 #ifndef LLVM_LIB_TARGET_ARM_ARMFRAMELOWERING_H
11 #define LLVM_LIB_TARGET_ARM_ARMFRAMELOWERING_H
12
13 #include "llvm/CodeGen/MachineBasicBlock.h"
14 #include "llvm/CodeGen/TargetFrameLowering.h"
15 #include <vector>
16
17 namespace llvm {
18
19 class ARMSubtarget;
20 class CalleeSavedInfo;
21 class MachineFunction;
22
23 class ARMFrameLowering : public TargetFrameLowering {
24 protected:
25   const ARMSubtarget &STI;
26
27 public:
28   explicit ARMFrameLowering(const ARMSubtarget &sti);
29
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;
34
35   bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
36                                  MachineBasicBlock::iterator MI,
37                                  const std::vector<CalleeSavedInfo> &CSI,
38                                  const TargetRegisterInfo *TRI) const override;
39
40   bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
41                                   MachineBasicBlock::iterator MI,
42                                   std::vector<CalleeSavedInfo> &CSI,
43                                   const TargetRegisterInfo *TRI) const override;
44
45   bool noFramePointerElim(const MachineFunction &MF) const override;
46
47   bool hasFP(const MachineFunction &MF) const override;
48   bool hasReservedCallFrame(const MachineFunction &MF) const override;
49   bool canSimplifyCallFramePseudos(const MachineFunction &MF) const override;
50   int getFrameIndexReference(const MachineFunction &MF, int FI,
51                              unsigned &FrameReg) const override;
52   int ResolveFrameIndexReference(const MachineFunction &MF, int FI,
53                                  unsigned &FrameReg, int SPAdj) const;
54
55   void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
56                             RegScavenger *RS) const override;
57
58   void adjustForSegmentedStacks(MachineFunction &MF,
59                                 MachineBasicBlock &MBB) const override;
60
61   /// Returns true if the target will correctly handle shrink wrapping.
62   bool enableShrinkWrapping(const MachineFunction &MF) const override {
63     return true;
64   }
65
66 private:
67   void emitPushInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
68                     const std::vector<CalleeSavedInfo> &CSI, unsigned StmOpc,
69                     unsigned StrOpc, bool NoGap,
70                     bool(*Func)(unsigned, bool), unsigned NumAlignedDPRCS2Regs,
71                     unsigned MIFlags = 0) const;
72   void emitPopInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
73                    std::vector<CalleeSavedInfo> &CSI, unsigned LdmOpc,
74                    unsigned LdrOpc, bool isVarArg, bool NoGap,
75                    bool(*Func)(unsigned, bool),
76                    unsigned NumAlignedDPRCS2Regs) const;
77
78   MachineBasicBlock::iterator
79   eliminateCallFramePseudoInstr(MachineFunction &MF,
80                                 MachineBasicBlock &MBB,
81                                 MachineBasicBlock::iterator MI) const override;
82 };
83
84 } // end namespace llvm
85
86 #endif // LLVM_LIB_TARGET_ARM_ARMFRAMELOWERING_H