Factor the addressing mode and the load/store VT out of LoadSDNode
[oota-llvm.git] / lib / Target / CellSPU / SPURegisterInfo.h
1 //===- SPURegisterInfo.h - Cell SPU Register Information Impl ----*- C++ -*-==//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the Cell SPU implementation of the MRegisterInfo class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef SPU_REGISTERINFO_H
15 #define SPU_REGISTERINFO_H
16
17 #include "SPU.h"
18 #include "SPUGenRegisterInfo.h.inc"
19
20 namespace llvm {
21   class SPUSubtarget;
22   class TargetInstrInfo;
23   class Type;
24
25   class SPURegisterInfo : public SPUGenRegisterInfo {
26   private:
27     const SPUSubtarget &Subtarget;
28     const TargetInstrInfo &TII;
29
30     //! Predicate: Does the machine function use the link register?
31     bool usesLR(MachineFunction &MF) const;
32
33   public:
34     SPURegisterInfo(const SPUSubtarget &subtarget, const TargetInstrInfo &tii);
35     
36     //! Translate a register's enum value to a register number
37     /*!
38       This method translates a register's enum value to it's regiser number,
39       e.g. SPU::R14 -> 14.
40      */
41     static unsigned getRegisterNumbering(unsigned RegEnum);
42
43     void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
44                        unsigned DestReg, const MachineInstr *Orig) const;
45     
46     //! Return the array of callee-saved registers
47     virtual const unsigned* getCalleeSavedRegs(const MachineFunction *MF) const;
48
49     //! Return the register class array of the callee-saved registers
50     virtual const TargetRegisterClass* const *
51       getCalleeSavedRegClasses(const MachineFunction *MF) const;
52
53     //! Return the reserved registers
54     BitVector getReservedRegs(const MachineFunction &MF) const;
55
56     //! Prediate: Target has dedicated frame pointer
57     bool hasFP(const MachineFunction &MF) const;
58     //! Eliminate the call frame setup pseudo-instructions
59     void eliminateCallFramePseudoInstr(MachineFunction &MF,
60                                        MachineBasicBlock &MBB,
61                                        MachineBasicBlock::iterator I) const;
62     //! Convert frame indicies into machine operands
63     void eliminateFrameIndex(MachineBasicBlock::iterator II, int,
64                              RegScavenger *RS) const;
65     //! Determine the frame's layour
66     void determineFrameLayout(MachineFunction &MF) const;
67
68     void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
69                                               RegScavenger *RS = NULL) const;
70     //! Emit the function prologue
71     void emitPrologue(MachineFunction &MF) const;
72     //! Emit the function epilogue
73     void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
74     //! Get return address register (LR, aka R0)
75     unsigned getRARegister() const;
76     //! Get the stack frame register (SP, aka R1)
77     unsigned getFrameRegister(MachineFunction &MF) const;
78     //! Perform target-specific stack frame setup.
79     void getInitialFrameState(std::vector<MachineMove> &Moves) const;
80
81     //------------------------------------------------------------------------
82     // New methods added:
83     //------------------------------------------------------------------------
84
85     //! Return the array of argument passing registers
86     /*!
87       \note The size of this array is returned by getArgRegsSize().
88      */
89     static const unsigned *getArgRegs();
90
91     //! Return the size of the argument passing register array
92     static const unsigned getNumArgRegs();
93
94     //! Get DWARF debugging register number
95     int getDwarfRegNum(unsigned RegNum, bool isEH) const;
96   };
97 } // end namespace llvm
98
99 #endif