LLVM API Documentation

SPUTargetMachine.h

Go to the documentation of this file.
00001 //===-- SPUTargetMachine.h - Define TargetMachine for Cell SPU ----*- 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 declares the CellSPU-specific subclass of TargetMachine.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef SPU_TARGETMACHINE_H
00015 #define SPU_TARGETMACHINE_H
00016 
00017 #include "SPUSubtarget.h"
00018 #include "SPUInstrInfo.h"
00019 #include "SPUISelLowering.h"
00020 #include "SPUFrameInfo.h"
00021 #include "llvm/Target/TargetMachine.h"
00022 #include "llvm/Target/TargetData.h"
00023 
00024 namespace llvm {
00025 class PassManager;
00026 class GlobalValue;
00027 class TargetFrameInfo;
00028 
00029 /// SPUTargetMachine
00030 ///
00031 class SPUTargetMachine : public LLVMTargetMachine {
00032   SPUSubtarget        Subtarget;
00033   const TargetData    DataLayout;
00034   SPUInstrInfo        InstrInfo;
00035   SPUFrameInfo        FrameInfo;
00036   SPUTargetLowering   TLInfo;
00037   InstrItineraryData  InstrItins;
00038   
00039 protected:
00040   virtual const TargetAsmInfo *createTargetAsmInfo() const;
00041   
00042 public:
00043   SPUTargetMachine(const Module &M, const std::string &FS);
00044 
00045   /// Return the subtarget implementation object
00046   virtual const SPUSubtarget     *getSubtargetImpl() const {
00047     return &Subtarget;
00048   }
00049   virtual const SPUInstrInfo     *getInstrInfo() const {
00050     return &InstrInfo;
00051   }
00052   virtual const SPUFrameInfo     *getFrameInfo() const {
00053     return &FrameInfo;
00054   }
00055   /*!
00056     \note Cell SPU does not support JIT today. It could support JIT at some
00057     point.
00058    */
00059   virtual       TargetJITInfo    *getJITInfo() {
00060     return NULL;
00061   }
00062   
00063   //! Module match function
00064   /*!
00065     Module matching function called by TargetMachineRegistry().
00066    */
00067   static unsigned getModuleMatchQuality(const Module &M);
00068 
00069   virtual       SPUTargetLowering *getTargetLowering() const { 
00070    return const_cast<SPUTargetLowering*>(&TLInfo); 
00071   }
00072 
00073   virtual const SPURegisterInfo *getRegisterInfo() const {
00074     return &InstrInfo.getRegisterInfo();
00075   }
00076   
00077   virtual const TargetData *getTargetData() const {
00078     return &DataLayout;
00079   }
00080 
00081   virtual const InstrItineraryData getInstrItineraryData() const {  
00082     return InstrItins;
00083   }
00084   
00085   // Pass Pipeline Configuration
00086   virtual bool addInstSelector(PassManagerBase &PM, bool /*Fast*/);
00087   virtual bool addAssemblyEmitter(PassManagerBase &PM, bool /*Fast*/, 
00088                                   raw_ostream &Out);
00089 };
00090 
00091 } // end namespace llvm
00092 
00093 #endif