Support for trampolines, except for X86 codegen which is
[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   /// Code Generation virtual methods...
31   void storeRegToStackSlot(MachineBasicBlock &MBB,
32                            MachineBasicBlock::iterator MBBI,
33                            unsigned SrcReg, int FrameIndex,
34                            const TargetRegisterClass *RC) const;
35
36   void loadRegFromStackSlot(MachineBasicBlock &MBB,
37               MachineBasicBlock::iterator MBBI,
38               unsigned DestReg, int FrameIndex,
39               const TargetRegisterClass *RC) const;
40
41   void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
42                      unsigned DestReg, const MachineInstr *Orig) const;
43
44   MachineInstr* foldMemoryOperand(MachineInstr* MI, unsigned OpNum,
45                                   int FrameIndex) const;
46
47   void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
48           unsigned DestReg, unsigned SrcReg,
49           const TargetRegisterClass *RC) const;
50   
51
52   const unsigned *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
53
54   const TargetRegisterClass* const*
55   getCalleeSavedRegClasses(const MachineFunction* MF = 0) const;
56
57   BitVector getReservedRegs(const MachineFunction &MF) const;
58
59   bool hasFP(const MachineFunction &MF) const;
60
61   void eliminateCallFramePseudoInstr(MachineFunction &MF,
62                                      MachineBasicBlock &MBB,
63                                      MachineBasicBlock::iterator I) const;
64
65   void eliminateFrameIndex(MachineBasicBlock::iterator II,
66                            int SPAdj, RegScavenger *RS = NULL) const;
67
68   void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
69
70   void emitPrologue(MachineFunction &MF) const;
71   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
72   
73   // Debug information queries.
74   unsigned getRARegister() const;
75   unsigned getFrameRegister(MachineFunction &MF) const;
76
77   // Exception handling queries.
78   unsigned getEHExceptionRegister() const;
79   unsigned getEHHandlerRegister() const;
80 };
81
82 } // end namespace llvm
83
84 #endif