LLVM API Documentation

SPURegisterInfo.h

Go to the documentation of this file.
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     /// getPointerRegClass - Return the register class to use to hold pointers.
00045     /// This is used for addressing modes.
00046     virtual const TargetRegisterClass *
00047     getPointerRegClass(unsigned Kind = 0) const;
00048 
00049     //! Return the array of callee-saved registers
00050     virtual const unsigned* getCalleeSavedRegs(const MachineFunction *MF) const;
00051 
00052     //! Return the register class array of the callee-saved registers
00053     virtual const TargetRegisterClass* const *
00054       getCalleeSavedRegClasses(const MachineFunction *MF) const;
00055 
00056     //! Return the reserved registers
00057     BitVector getReservedRegs(const MachineFunction &MF) const;
00058 
00059     //! Prediate: Target has dedicated frame pointer
00060     bool hasFP(const MachineFunction &MF) const;
00061     //! Eliminate the call frame setup pseudo-instructions
00062     void eliminateCallFramePseudoInstr(MachineFunction &MF,
00063                                        MachineBasicBlock &MBB,
00064                                        MachineBasicBlock::iterator I) const;
00065     //! Convert frame indicies into machine operands
00066     void eliminateFrameIndex(MachineBasicBlock::iterator II, int,
00067                              RegScavenger *RS) const;
00068     //! Determine the frame's layour
00069     void determineFrameLayout(MachineFunction &MF) const;
00070 
00071     void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
00072                                               RegScavenger *RS = NULL) const;
00073     //! Emit the function prologue
00074     void emitPrologue(MachineFunction &MF) const;
00075     //! Emit the function epilogue
00076     void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
00077     //! Get return address register (LR, aka R0)
00078     unsigned getRARegister() const;
00079     //! Get the stack frame register (SP, aka R1)
00080     unsigned getFrameRegister(MachineFunction &MF) const;
00081     //! Perform target-specific stack frame setup.
00082     void getInitialFrameState(std::vector<MachineMove> &Moves) const;
00083 
00084     //------------------------------------------------------------------------
00085     // New methods added:
00086     //------------------------------------------------------------------------
00087 
00088     //! Return the array of argument passing registers
00089     /*!
00090       \note The size of this array is returned by getArgRegsSize().
00091      */
00092     static const unsigned *getArgRegs();
00093 
00094     //! Return the size of the argument passing register array
00095     static unsigned getNumArgRegs();
00096 
00097     //! Get DWARF debugging register number
00098     int getDwarfRegNum(unsigned RegNum, bool isEH) const;
00099   };
00100 } // end namespace llvm
00101 
00102 #endif