LLVM API Documentation
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 public: 00039 SPUTargetMachine(const Target &T, const std::string &TT, 00040 const std::string &FS); 00041 00042 /// Return the subtarget implementation object 00043 virtual const SPUSubtarget *getSubtargetImpl() const { 00044 return &Subtarget; 00045 } 00046 virtual const SPUInstrInfo *getInstrInfo() const { 00047 return &InstrInfo; 00048 } 00049 virtual const SPUFrameInfo *getFrameInfo() const { 00050 return &FrameInfo; 00051 } 00052 /*! 00053 \note Cell SPU does not support JIT today. It could support JIT at some 00054 point. 00055 */ 00056 virtual TargetJITInfo *getJITInfo() { 00057 return NULL; 00058 } 00059 00060 virtual SPUTargetLowering *getTargetLowering() const { 00061 return const_cast<SPUTargetLowering*>(&TLInfo); 00062 } 00063 00064 virtual const SPURegisterInfo *getRegisterInfo() const { 00065 return &InstrInfo.getRegisterInfo(); 00066 } 00067 00068 virtual const TargetData *getTargetData() const { 00069 return &DataLayout; 00070 } 00071 00072 virtual const InstrItineraryData getInstrItineraryData() const { 00073 return InstrItins; 00074 } 00075 00076 // Pass Pipeline Configuration 00077 virtual bool addInstSelector(PassManagerBase &PM, 00078 CodeGenOpt::Level OptLevel); 00079 }; 00080 00081 } // end namespace llvm 00082 00083 #endif