add a method
[oota-llvm.git] / lib / Target / X86 / X86RegisterInfo.h
1 //===- X86RegisterInfo.h - X86 Register Information Impl --------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the X86 implementation of the MRegisterInfo class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef X86REGISTERINFO_H
15 #define X86REGISTERINFO_H
16
17 #include "llvm/Target/MRegisterInfo.h"
18
19 class llvm::Type;
20
21 #include "X86GenRegisterInfo.h.inc"
22
23 namespace llvm {
24
25 struct X86RegisterInfo : public X86GenRegisterInfo {
26   X86RegisterInfo();
27
28   /// Code Generation virtual methods...
29   void storeRegToStackSlot(MachineBasicBlock &MBB,
30                            MachineBasicBlock::iterator MI,
31                            unsigned SrcReg, int FrameIndex,
32                            const TargetRegisterClass *RC) const;
33
34   void loadRegFromStackSlot(MachineBasicBlock &MBB,
35                             MachineBasicBlock::iterator MI,
36                             unsigned DestReg, int FrameIndex,
37                             const TargetRegisterClass *RC) const;
38
39   void copyRegToReg(MachineBasicBlock &MBB,
40                     MachineBasicBlock::iterator MI,
41                     unsigned DestReg, unsigned SrcReg,
42                     const TargetRegisterClass *RC) const;
43
44   unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const;
45   unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const;
46
47
48   /// foldMemoryOperand - If this target supports it, fold a load or store of
49   /// the specified stack slot into the specified machine instruction for the
50   /// specified operand.  If this is possible, the target should perform the
51   /// folding and return true, otherwise it should return false.  If it folds
52   /// the instruction, it is likely that the MachineInstruction the iterator
53   /// references has been changed.
54   virtual MachineInstr* foldMemoryOperand(MachineInstr* MI,
55                                           unsigned OpNum,
56                                           int FrameIndex) const;
57
58
59   void eliminateCallFramePseudoInstr(MachineFunction &MF,
60                                      MachineBasicBlock &MBB,
61                                      MachineBasicBlock::iterator MI) const;
62
63   void eliminateFrameIndex(MachineBasicBlock::iterator MI) const;
64
65   void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
66
67   void emitPrologue(MachineFunction &MF) const;
68   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
69 };
70
71 } // End llvm namespace
72
73 #endif