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 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file declares the CellSPU-specific subclass of TargetMachine. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef SPU_TARGETMACHINE_H |
| 15 | #define SPU_TARGETMACHINE_H |
| 16 | |
| 17 | #include "SPUSubtarget.h" |
| 18 | #include "SPUInstrInfo.h" |
| 19 | #include "SPUISelLowering.h" |
| 20 | #include "SPUFrameInfo.h" |
| 21 | #include "llvm/Target/TargetMachine.h" |
| 22 | #include "llvm/Target/TargetData.h" |
| 23 | |
| 24 | namespace llvm { |
| 25 | class PassManager; |
| 26 | class GlobalValue; |
| 27 | class TargetFrameInfo; |
| 28 | |
| 29 | /// SPUTargetMachine |
| 30 | /// |
| 31 | class SPUTargetMachine : public LLVMTargetMachine { |
| 32 | SPUSubtarget Subtarget; |
| 33 | const TargetData DataLayout; |
| 34 | SPUInstrInfo InstrInfo; |
| 35 | SPUFrameInfo FrameInfo; |
| 36 | SPUTargetLowering TLInfo; |
| 37 | InstrItineraryData InstrItins; |
Anton Korobeynikov | e494b9e | 2009-06-19 19:36:55 +0000 | [diff] [blame] | 38 | |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 39 | protected: |
| 40 | virtual const TargetAsmInfo *createTargetAsmInfo() const; |
Anton Korobeynikov | e494b9e | 2009-06-19 19:36:55 +0000 | [diff] [blame] | 41 | |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 42 | public: |
Daniel Dunbar | 51b198a | 2009-07-15 20:24:03 +0000 | [diff] [blame] | 43 | SPUTargetMachine(const Target &T, const Module &M, const std::string &FS); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 44 | |
| 45 | /// Return the subtarget implementation object |
| 46 | virtual const SPUSubtarget *getSubtargetImpl() const { |
| 47 | return &Subtarget; |
| 48 | } |
| 49 | virtual const SPUInstrInfo *getInstrInfo() const { |
| 50 | return &InstrInfo; |
| 51 | } |
Dan Gohman | c9f5f3f | 2008-05-14 01:58:56 +0000 | [diff] [blame] | 52 | virtual const SPUFrameInfo *getFrameInfo() const { |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 53 | return &FrameInfo; |
| 54 | } |
| 55 | /*! |
| 56 | \note Cell SPU does not support JIT today. It could support JIT at some |
| 57 | point. |
| 58 | */ |
| 59 | virtual TargetJITInfo *getJITInfo() { |
| 60 | return NULL; |
| 61 | } |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 62 | |
| 63 | virtual SPUTargetLowering *getTargetLowering() const { |
| 64 | return const_cast<SPUTargetLowering*>(&TLInfo); |
| 65 | } |
| 66 | |
Dan Gohman | c9f5f3f | 2008-05-14 01:58:56 +0000 | [diff] [blame] | 67 | virtual const SPURegisterInfo *getRegisterInfo() const { |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 68 | return &InstrInfo.getRegisterInfo(); |
| 69 | } |
| 70 | |
| 71 | virtual const TargetData *getTargetData() const { |
| 72 | return &DataLayout; |
| 73 | } |
| 74 | |
Anton Korobeynikov | e494b9e | 2009-06-19 19:36:55 +0000 | [diff] [blame] | 75 | virtual const InstrItineraryData getInstrItineraryData() const { |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 76 | return InstrItins; |
| 77 | } |
| 78 | |
| 79 | // Pass Pipeline Configuration |
Bill Wendling | 98a366d | 2009-04-29 23:29:43 +0000 | [diff] [blame] | 80 | virtual bool addInstSelector(PassManagerBase &PM, |
| 81 | CodeGenOpt::Level OptLevel); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 82 | }; |
| 83 | |
| 84 | } // end namespace llvm |
| 85 | |
| 86 | #endif |