Allow copyRegToReg to emit cross register classes copies.
[oota-llvm.git] / lib / Target / Sparc / SparcRegisterInfo.h
1 //===- SparcRegisterInfo.h - Sparc 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 Sparc implementation of the MRegisterInfo class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef SPARCREGISTERINFO_H
15 #define SPARCREGISTERINFO_H
16
17 #include "llvm/Target/MRegisterInfo.h"
18 #include "SparcGenRegisterInfo.h.inc"
19
20 namespace llvm {
21
22 class SparcSubtarget;
23 class TargetInstrInfo;
24 class Type;
25
26 struct SparcRegisterInfo : public SparcGenRegisterInfo {
27   SparcSubtarget &Subtarget;
28   const TargetInstrInfo &TII;
29   
30   SparcRegisterInfo(SparcSubtarget &st, const TargetInstrInfo &tii);
31
32   /// Code Generation virtual methods...
33   void storeRegToStackSlot(MachineBasicBlock &MBB,
34                            MachineBasicBlock::iterator MBBI,
35                            unsigned SrcReg, int FrameIndex,
36                            const TargetRegisterClass *RC) const;
37
38   void loadRegFromStackSlot(MachineBasicBlock &MBB,
39                             MachineBasicBlock::iterator MBBI,
40                             unsigned DestReg, int FrameIndex,
41                             const TargetRegisterClass *RC) const;
42
43   void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
44                     unsigned DestReg, unsigned SrcReg,
45                     const TargetRegisterClass *DestRC,
46                     const TargetRegisterClass *SrcRC) const;
47   
48   void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
49                      unsigned DestReg, const MachineInstr *Orig) const;
50
51   virtual MachineInstr* foldMemoryOperand(MachineInstr* MI,
52                                           unsigned OpNum,
53                                           int FrameIndex) const;
54
55   virtual MachineInstr* foldMemoryOperand(MachineInstr* MI,
56                                           unsigned OpNum,
57                                           MachineInstr* LoadMI) const {
58     return 0;
59   }
60
61   const unsigned *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
62
63   const TargetRegisterClass* const* getCalleeSavedRegClasses(
64                                      const MachineFunction *MF = 0) const;
65
66   BitVector getReservedRegs(const MachineFunction &MF) const;
67
68   bool hasFP(const MachineFunction &MF) const;
69
70   void eliminateCallFramePseudoInstr(MachineFunction &MF,
71                                      MachineBasicBlock &MBB,
72                                      MachineBasicBlock::iterator I) const;
73
74   void eliminateFrameIndex(MachineBasicBlock::iterator II,
75                            int SPAdj, RegScavenger *RS = NULL) const;
76
77   void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
78
79   void emitPrologue(MachineFunction &MF) const;
80   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
81   
82   // Debug information queries.
83   unsigned getRARegister() const;
84   unsigned getFrameRegister(MachineFunction &MF) const;
85
86   // Exception handling queries.
87   unsigned getEHExceptionRegister() const;
88   unsigned getEHHandlerRegister() const;
89 };
90
91 } // end namespace llvm
92
93 #endif