LLVM API Documentation
00001 //===- SPURegisterInfo.h - Cell SPU Register Information Impl ----*- C++ -*-==// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file contains the Cell SPU implementation of the TargetRegisterInfo 00011 // class. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef SPU_REGISTERINFO_H 00016 #define SPU_REGISTERINFO_H 00017 00018 #include "SPU.h" 00019 #include "SPUGenRegisterInfo.h.inc" 00020 00021 namespace llvm { 00022 class SPUSubtarget; 00023 class TargetInstrInfo; 00024 class Type; 00025 00026 class SPURegisterInfo : public SPUGenRegisterInfo { 00027 private: 00028 const SPUSubtarget &Subtarget; 00029 const TargetInstrInfo &TII; 00030 00031 //! Predicate: Does the machine function use the link register? 00032 bool usesLR(MachineFunction &MF) const; 00033 00034 public: 00035 SPURegisterInfo(const SPUSubtarget &subtarget, const TargetInstrInfo &tii); 00036 00037 //! Translate a register's enum value to a register number 00038 /*! 00039 This method translates a register's enum value to it's regiser number, 00040 e.g. SPU::R14 -> 14. 00041 */ 00042 static unsigned getRegisterNumbering(unsigned RegEnum); 00043 00044 //! Return the array of callee-saved registers 00045 virtual const unsigned* getCalleeSavedRegs(const MachineFunction *MF) const; 00046 00047 //! Return the register class array of the callee-saved registers 00048 virtual const TargetRegisterClass* const * 00049 getCalleeSavedRegClasses(const MachineFunction *MF) const; 00050 00051 //! Return the reserved registers 00052 BitVector getReservedRegs(const MachineFunction &MF) const; 00053 00054 //! Prediate: Target has dedicated frame pointer 00055 bool hasFP(const MachineFunction &MF) const; 00056 //! Eliminate the call frame setup pseudo-instructions 00057 void eliminateCallFramePseudoInstr(MachineFunction &MF, 00058 MachineBasicBlock &MBB, 00059 MachineBasicBlock::iterator I) const; 00060 //! Convert frame indicies into machine operands 00061 void eliminateFrameIndex(MachineBasicBlock::iterator II, int, 00062 RegScavenger *RS) const; 00063 //! Determine the frame's layour 00064 void determineFrameLayout(MachineFunction &MF) const; 00065 00066 void processFunctionBeforeCalleeSavedScan(MachineFunction &MF, 00067 RegScavenger *RS = NULL) const; 00068 //! Emit the function prologue 00069 void emitPrologue(MachineFunction &MF) const; 00070 //! Emit the function epilogue 00071 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const; 00072 //! Get return address register (LR, aka R0) 00073 unsigned getRARegister() const; 00074 //! Get the stack frame register (SP, aka R1) 00075 unsigned getFrameRegister(MachineFunction &MF) const; 00076 //! Perform target-specific stack frame setup. 00077 void getInitialFrameState(std::vector<MachineMove> &Moves) const; 00078 00079 //------------------------------------------------------------------------ 00080 // New methods added: 00081 //------------------------------------------------------------------------ 00082 00083 //! Return the array of argument passing registers 00084 /*! 00085 \note The size of this array is returned by getArgRegsSize(). 00086 */ 00087 static const unsigned *getArgRegs(); 00088 00089 //! Return the size of the argument passing register array 00090 static unsigned getNumArgRegs(); 00091 00092 //! Get DWARF debugging register number 00093 int getDwarfRegNum(unsigned RegNum, bool isEH) const; 00094 }; 00095 } // end namespace llvm 00096 00097 #endif