Remove uses of the TargetMachine from X86FrameLowering.
[oota-llvm.git] / lib / Target / X86 / X86FrameLowering.h
1 //===-- X86TargetFrameLowering.h - Define frame lowering for X86 -*- 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 // This class implements X86-specific bits of TargetFrameLowering class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef X86_FRAMELOWERING_H
15 #define X86_FRAMELOWERING_H
16
17 #include "X86Subtarget.h"
18 #include "llvm/Target/TargetFrameLowering.h"
19
20 namespace llvm {
21
22 class MCSymbol;
23 class X86TargetMachine;
24
25 class X86FrameLowering : public TargetFrameLowering {
26   const X86Subtarget &STI;
27 public:
28   explicit X86FrameLowering(const X86Subtarget &sti)
29     : TargetFrameLowering(StackGrowsDown,
30                           sti.getStackAlignment(),
31                           (sti.is64Bit() ? -8 : -4)),
32       STI(sti) {
33   }
34
35   void emitCalleeSavedFrameMoves(MachineBasicBlock &MBB,
36                                  MachineBasicBlock::iterator MBBI, DebugLoc DL,
37                                  unsigned FramePtr) const;
38
39   /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
40   /// the function.
41   void emitPrologue(MachineFunction &MF) const override;
42   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
43
44   void adjustForSegmentedStacks(MachineFunction &MF) const override;
45
46   void adjustForHiPEPrologue(MachineFunction &MF) const override;
47
48   void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
49                                      RegScavenger *RS = nullptr) const override;
50
51   bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
52                                  MachineBasicBlock::iterator MI,
53                                  const std::vector<CalleeSavedInfo> &CSI,
54                                  const TargetRegisterInfo *TRI) const override;
55
56   bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
57                                   MachineBasicBlock::iterator MI,
58                                   const std::vector<CalleeSavedInfo> &CSI,
59                                   const TargetRegisterInfo *TRI) const override;
60
61   bool hasFP(const MachineFunction &MF) const override;
62   bool hasReservedCallFrame(const MachineFunction &MF) const override;
63
64   int getFrameIndexOffset(const MachineFunction &MF, int FI) const override;
65   int getFrameIndexReference(const MachineFunction &MF, int FI,
66                              unsigned &FrameReg) const override;
67
68   void eliminateCallFramePseudoInstr(MachineFunction &MF,
69                                  MachineBasicBlock &MBB,
70                                  MachineBasicBlock::iterator MI) const override;
71 };
72
73 } // End llvm namespace
74
75 #endif