Use TableGen to emit information for dwarf register numbers.
[oota-llvm.git] / lib / Target / Mips / MipsRegisterInfo.h
1 //===- MipsRegisterInfo.h - Mips Register Information Impl ------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by Bruno Cardoso Lopes and is distributed under the 
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the Mips implementation of the MRegisterInfo class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef MIPSREGISTERINFO_H
15 #define MIPSREGISTERINFO_H
16
17 #include "llvm/Target/MRegisterInfo.h"
18 #include "MipsGenRegisterInfo.h.inc"
19
20 namespace llvm {
21
22 class TargetInstrInfo;
23 class Type;
24
25 struct MipsRegisterInfo : public MipsGenRegisterInfo {
26   const TargetInstrInfo &TII;
27   
28   MipsRegisterInfo(const TargetInstrInfo &tii);
29
30   /// getRegisterNumbering - Given the enum value for some register, e.g.
31   /// Mips::RA, return the number that it corresponds to (e.g. 31).
32   static unsigned getRegisterNumbering(unsigned RegEnum);
33
34   /// Code Generation virtual methods...
35   void storeRegToStackSlot(MachineBasicBlock &MBB,
36                            MachineBasicBlock::iterator MBBI,
37                            unsigned SrcReg, int FrameIndex,
38                            const TargetRegisterClass *RC) const;
39
40   void storeRegToAddr(MachineFunction &MF, unsigned SrcReg,
41                       SmallVectorImpl<MachineOperand> &Addr,
42                       const TargetRegisterClass *RC,
43                       SmallVectorImpl<MachineInstr*> &NewMIs) const;
44
45   void loadRegFromStackSlot(MachineBasicBlock &MBB,
46               MachineBasicBlock::iterator MBBI,
47               unsigned DestReg, int FrameIndex,
48               const TargetRegisterClass *RC) const;
49
50   void loadRegFromAddr(MachineFunction &MF, unsigned DestReg,
51                        SmallVectorImpl<MachineOperand> &Addr,
52                        const TargetRegisterClass *RC,
53                        SmallVectorImpl<MachineInstr*> &NewMIs) const;
54
55   void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
56                      unsigned DestReg, const MachineInstr *Orig) const;
57
58   MachineInstr* foldMemoryOperand(MachineInstr* MI, unsigned OpNum,
59                                   int FrameIndex) const;
60
61   MachineInstr* foldMemoryOperand(MachineInstr* MI, unsigned OpNum,
62                                   MachineInstr* LoadMI) const;
63
64   void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
65           unsigned DestReg, unsigned SrcReg,
66           const TargetRegisterClass *DestRC,
67           const TargetRegisterClass *SrcRC) const;
68   
69
70   const unsigned *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
71
72   const TargetRegisterClass* const*
73   getCalleeSavedRegClasses(const MachineFunction* MF = 0) const;
74
75   BitVector getReservedRegs(const MachineFunction &MF) const;
76
77   bool hasFP(const MachineFunction &MF) const;
78
79   void eliminateCallFramePseudoInstr(MachineFunction &MF,
80                                      MachineBasicBlock &MBB,
81                                      MachineBasicBlock::iterator I) const;
82
83   /// Stack Frame Processing Methods
84   void eliminateFrameIndex(MachineBasicBlock::iterator II,
85                            int SPAdj, RegScavenger *RS = NULL) const;
86
87   void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
88
89   void emitPrologue(MachineFunction &MF) const;
90   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
91   
92   /// Debug information queries.
93   unsigned getRARegister() const;
94   unsigned getFrameRegister(MachineFunction &MF) const;
95
96   /// Exception handling queries.
97   unsigned getEHExceptionRegister() const;
98   unsigned getEHHandlerRegister() const;
99
100   int getDwarfRegNum(unsigned RegNum) const;
101 };
102
103 } // end namespace llvm
104
105 #endif