3fd6ebec509ec8bb6f0b0fb335d0063cc9b8cece
[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   const TargetRegisterClass* getRegClassForType(const Type* Ty) const;
28
29   /// Code Generation virtual methods...
30   int storeRegToStackSlot(MachineBasicBlock &MBB,
31                           MachineBasicBlock::iterator MI,
32                           unsigned SrcReg, int FrameIndex,
33                           const TargetRegisterClass *RC) const;
34
35   int loadRegFromStackSlot(MachineBasicBlock &MBB,
36                            MachineBasicBlock::iterator MI,
37                            unsigned DestReg, int FrameIndex,
38                            const TargetRegisterClass *RC) const;
39   
40   int copyRegToReg(MachineBasicBlock &MBB,
41                    MachineBasicBlock::iterator MI,
42                    unsigned DestReg, unsigned SrcReg,
43                    const TargetRegisterClass *RC) const;
44
45   /// foldMemoryOperand - If this target supports it, fold a load or store of
46   /// the specified stack slot into the specified machine instruction for the
47   /// specified operand.  If this is possible, the target should perform the
48   /// folding and return true, otherwise it should return false.  If it folds
49   /// the instruction, it is likely that the MachineInstruction the iterator
50   /// references has been changed.
51   virtual MachineInstr* foldMemoryOperand(MachineBasicBlock::iterator MI,
52                                           unsigned OpNum,
53                                           int FrameIndex) const;
54
55
56   void eliminateCallFramePseudoInstr(MachineFunction &MF,
57                                      MachineBasicBlock &MBB,
58                                      MachineBasicBlock::iterator MI) const;
59
60   void eliminateFrameIndex(MachineFunction &MF,
61                            MachineBasicBlock::iterator MI) const;
62
63   void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
64
65   void emitPrologue(MachineFunction &MF) const;
66   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
67 };
68
69 } // End llvm namespace
70
71 #endif