LLVM API Documentation

BlackfinRegisterInfo.h

Go to the documentation of this file.
00001 //===- BlackfinRegisterInfo.h - Blackfin Register Information ..-*- 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 Blackfin implementation of the TargetRegisterInfo
00011 // class.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef BLACKFINREGISTERINFO_H
00016 #define BLACKFINREGISTERINFO_H
00017 
00018 #include "llvm/Target/TargetRegisterInfo.h"
00019 #include "BlackfinGenRegisterInfo.h.inc"
00020 
00021 namespace llvm {
00022 
00023   class BlackfinSubtarget;
00024   class TargetInstrInfo;
00025   class Type;
00026 
00027   // Subregister indices, keep in sync with BlackfinRegisterInfo.td
00028   enum BfinSubregIdx {
00029     bfin_subreg_lo16 = 1,
00030     bfin_subreg_hi16 = 2,
00031     bfin_subreg_lo32 = 3
00032   };
00033 
00034   struct BlackfinRegisterInfo : public BlackfinGenRegisterInfo {
00035     BlackfinSubtarget &Subtarget;
00036     const TargetInstrInfo &TII;
00037 
00038     BlackfinRegisterInfo(BlackfinSubtarget &st, const TargetInstrInfo &tii);
00039 
00040     /// Code Generation virtual methods...
00041     const unsigned *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
00042 
00043     const TargetRegisterClass* const*
00044     getCalleeSavedRegClasses(const MachineFunction *MF = 0) const;
00045 
00046     BitVector getReservedRegs(const MachineFunction &MF) const;
00047 
00048     // getSubReg implemented by tablegen
00049 
00050     const TargetRegisterClass *getPointerRegClass(unsigned Kind = 0) const {
00051       return &BF::PRegClass;
00052     }
00053 
00054     const TargetRegisterClass *getPhysicalRegisterRegClass(unsigned reg,
00055                                                            EVT VT) const;
00056 
00057     bool hasFP(const MachineFunction &MF) const;
00058 
00059     // bool hasReservedCallFrame(MachineFunction &MF) const;
00060 
00061     bool requiresRegisterScavenging(const MachineFunction &MF) const;
00062 
00063     void eliminateCallFramePseudoInstr(MachineFunction &MF,
00064                                        MachineBasicBlock &MBB,
00065                                        MachineBasicBlock::iterator I) const;
00066 
00067     void eliminateFrameIndex(MachineBasicBlock::iterator II,
00068                              int SPAdj, RegScavenger *RS = NULL) const;
00069 
00070     void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
00071                                               RegScavenger *RS) const;
00072 
00073     void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
00074 
00075     void emitPrologue(MachineFunction &MF) const;
00076     void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
00077 
00078     unsigned getFrameRegister(MachineFunction &MF) const;
00079     int getFrameIndexOffset(MachineFunction &MF, int FI) const;
00080     unsigned getRARegister() const;
00081 
00082     // Exception handling queries.
00083     unsigned getEHExceptionRegister() const;
00084     unsigned getEHHandlerRegister() const;
00085 
00086     int getDwarfRegNum(unsigned RegNum, bool isEH) const;
00087 
00088     // Utility functions
00089     void adjustRegister(MachineBasicBlock &MBB,
00090                         MachineBasicBlock::iterator I,
00091                         DebugLoc DL,
00092                         unsigned Reg,
00093                         unsigned ScratchReg,
00094                         int delta) const;
00095     void loadConstant(MachineBasicBlock &MBB,
00096                       MachineBasicBlock::iterator I,
00097                       DebugLoc DL,
00098                       unsigned Reg,
00099                       int value) const;
00100   };
00101 
00102 } // end namespace llvm
00103 
00104 #endif