SPU section handling is really huge mess. Replace remaining TAI calls for sections...
[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 TargetRegisterInfo
11 // class.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef SPU_REGISTERINFO_H
16 #define SPU_REGISTERINFO_H
17
18 #include "SPU.h"
19 #include "SPUGenRegisterInfo.h.inc"
20
21 namespace llvm {
22   class SPUSubtarget;
23   class TargetInstrInfo;
24   class Type;
25
26   class SPURegisterInfo : public SPUGenRegisterInfo {
27   private:
28     const SPUSubtarget &Subtarget;
29     const TargetInstrInfo &TII;
30
31     //! Predicate: Does the machine function use the link register?
32     bool usesLR(MachineFunction &MF) const;
33
34   public:
35     SPURegisterInfo(const SPUSubtarget &subtarget, const TargetInstrInfo &tii);
36     
37     //! Translate a register's enum value to a register number
38     /*!
39       This method translates a register's enum value to it's regiser number,
40       e.g. SPU::R14 -> 14.
41      */
42     static unsigned getRegisterNumbering(unsigned RegEnum);
43
44     //! Return the array of callee-saved registers
45     virtual const unsigned* getCalleeSavedRegs(const MachineFunction *MF) const;
46
47     //! Return the register class array of the callee-saved registers
48     virtual const TargetRegisterClass* const *
49       getCalleeSavedRegClasses(const MachineFunction *MF) const;
50
51     //! Return the reserved registers
52     BitVector getReservedRegs(const MachineFunction &MF) const;
53
54     //! Prediate: Target has dedicated frame pointer
55     bool hasFP(const MachineFunction &MF) const;
56     //! Eliminate the call frame setup pseudo-instructions
57     void eliminateCallFramePseudoInstr(MachineFunction &MF,
58                                        MachineBasicBlock &MBB,
59                                        MachineBasicBlock::iterator I) const;
60     //! Convert frame indicies into machine operands
61     void eliminateFrameIndex(MachineBasicBlock::iterator II, int,
62                              RegScavenger *RS) const;
63     //! Determine the frame's layour
64     void determineFrameLayout(MachineFunction &MF) const;
65
66     void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
67                                               RegScavenger *RS = NULL) const;
68     //! Emit the function prologue
69     void emitPrologue(MachineFunction &MF) const;
70     //! Emit the function epilogue
71     void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
72     //! Get return address register (LR, aka R0)
73     unsigned getRARegister() const;
74     //! Get the stack frame register (SP, aka R1)
75     unsigned getFrameRegister(MachineFunction &MF) const;
76     //! Perform target-specific stack frame setup.
77     void getInitialFrameState(std::vector<MachineMove> &Moves) const;
78
79     //------------------------------------------------------------------------
80     // New methods added:
81     //------------------------------------------------------------------------
82
83     //! Return the array of argument passing registers
84     /*!
85       \note The size of this array is returned by getArgRegsSize().
86      */
87     static const unsigned *getArgRegs();
88
89     //! Return the size of the argument passing register array
90     static unsigned getNumArgRegs();
91
92     //! Get DWARF debugging register number
93     int getDwarfRegNum(unsigned RegNum, bool isEH) const;
94   };
95 } // end namespace llvm
96
97 #endif