Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame^] | 1 | //===-- SPUTargetMachine.h - Define TargetMachine for Cell SPU ----*- C++ -*-=// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by a team from the Computer Systems Research |
| 6 | // Department at The Aerospace Corporation. |
| 7 | // |
| 8 | // See README.txt for details. |
| 9 | // |
| 10 | //===----------------------------------------------------------------------===// |
| 11 | // |
| 12 | // This file declares the CellSPU-specific subclass of TargetMachine. |
| 13 | // |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | #ifndef SPU_TARGETMACHINE_H |
| 17 | #define SPU_TARGETMACHINE_H |
| 18 | |
| 19 | #include "SPUSubtarget.h" |
| 20 | #include "SPUInstrInfo.h" |
| 21 | #include "SPUISelLowering.h" |
| 22 | #include "SPUFrameInfo.h" |
| 23 | #include "llvm/Target/TargetMachine.h" |
| 24 | #include "llvm/Target/TargetData.h" |
| 25 | |
| 26 | namespace llvm { |
| 27 | class PassManager; |
| 28 | class GlobalValue; |
| 29 | class TargetFrameInfo; |
| 30 | |
| 31 | /// SPUTargetMachine |
| 32 | /// |
| 33 | class SPUTargetMachine : public LLVMTargetMachine { |
| 34 | SPUSubtarget Subtarget; |
| 35 | const TargetData DataLayout; |
| 36 | SPUInstrInfo InstrInfo; |
| 37 | SPUFrameInfo FrameInfo; |
| 38 | SPUTargetLowering TLInfo; |
| 39 | InstrItineraryData InstrItins; |
| 40 | |
| 41 | protected: |
| 42 | virtual const TargetAsmInfo *createTargetAsmInfo() const; |
| 43 | |
| 44 | public: |
| 45 | SPUTargetMachine(const Module &M, const std::string &FS); |
| 46 | |
| 47 | /// Return the subtarget implementation object |
| 48 | virtual const SPUSubtarget *getSubtargetImpl() const { |
| 49 | return &Subtarget; |
| 50 | } |
| 51 | virtual const SPUInstrInfo *getInstrInfo() const { |
| 52 | return &InstrInfo; |
| 53 | } |
| 54 | virtual const TargetFrameInfo *getFrameInfo() const { |
| 55 | return &FrameInfo; |
| 56 | } |
| 57 | /*! |
| 58 | \note Cell SPU does not support JIT today. It could support JIT at some |
| 59 | point. |
| 60 | */ |
| 61 | virtual TargetJITInfo *getJITInfo() { |
| 62 | return NULL; |
| 63 | } |
| 64 | |
| 65 | //! Module match function |
| 66 | /*! |
| 67 | Module matching function called by TargetMachineRegistry(). |
| 68 | */ |
| 69 | static unsigned getModuleMatchQuality(const Module &M); |
| 70 | |
| 71 | virtual SPUTargetLowering *getTargetLowering() const { |
| 72 | return const_cast<SPUTargetLowering*>(&TLInfo); |
| 73 | } |
| 74 | |
| 75 | virtual const MRegisterInfo *getRegisterInfo() const { |
| 76 | return &InstrInfo.getRegisterInfo(); |
| 77 | } |
| 78 | |
| 79 | virtual const TargetData *getTargetData() const { |
| 80 | return &DataLayout; |
| 81 | } |
| 82 | |
| 83 | virtual const InstrItineraryData getInstrItineraryData() const { |
| 84 | return InstrItins; |
| 85 | } |
| 86 | |
| 87 | // Pass Pipeline Configuration |
| 88 | virtual bool addInstSelector(FunctionPassManager &PM, bool Fast); |
| 89 | virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast, |
| 90 | std::ostream &Out); |
| 91 | }; |
| 92 | |
| 93 | } // end namespace llvm |
| 94 | |
| 95 | #endif |