Jia Liu | 31d157a | 2012-02-18 12:03:15 +0000 | [diff] [blame^] | 1 | //===-- SPUTargetMachine.h - Define TargetMachine for Cell SPU --*- C++ -*-===// |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 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" |
Dan Gohman | ff7a562 | 2010-05-11 17:31:57 +0000 | [diff] [blame] | 20 | #include "SPUSelectionDAGInfo.h" |
Anton Korobeynikov | 16c29b5 | 2011-01-10 12:39:04 +0000 | [diff] [blame] | 21 | #include "SPUFrameLowering.h" |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 22 | #include "llvm/Target/TargetMachine.h" |
| 23 | #include "llvm/Target/TargetData.h" |
| 24 | |
| 25 | namespace llvm { |
| 26 | class PassManager; |
| 27 | class GlobalValue; |
Anton Korobeynikov | 16c29b5 | 2011-01-10 12:39:04 +0000 | [diff] [blame] | 28 | class TargetFrameLowering; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 29 | |
| 30 | /// SPUTargetMachine |
| 31 | /// |
| 32 | class SPUTargetMachine : public LLVMTargetMachine { |
| 33 | SPUSubtarget Subtarget; |
| 34 | const TargetData DataLayout; |
| 35 | SPUInstrInfo InstrInfo; |
Anton Korobeynikov | 16c29b5 | 2011-01-10 12:39:04 +0000 | [diff] [blame] | 36 | SPUFrameLowering FrameLowering; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 37 | SPUTargetLowering TLInfo; |
Dan Gohman | ff7a562 | 2010-05-11 17:31:57 +0000 | [diff] [blame] | 38 | SPUSelectionDAGInfo TSInfo; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 39 | InstrItineraryData InstrItins; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 40 | public: |
Evan Cheng | 4396613 | 2011-07-19 06:37:02 +0000 | [diff] [blame] | 41 | SPUTargetMachine(const Target &T, StringRef TT, |
Nick Lewycky | 8a8d479 | 2011-12-02 22:16:29 +0000 | [diff] [blame] | 42 | StringRef CPU, StringRef FS, const TargetOptions &Options, |
Evan Cheng | b95fc31 | 2011-11-16 08:38:26 +0000 | [diff] [blame] | 43 | Reloc::Model RM, CodeModel::Model CM, |
| 44 | CodeGenOpt::Level OL); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 45 | |
| 46 | /// Return the subtarget implementation object |
| 47 | virtual const SPUSubtarget *getSubtargetImpl() const { |
| 48 | return &Subtarget; |
| 49 | } |
| 50 | virtual const SPUInstrInfo *getInstrInfo() const { |
| 51 | return &InstrInfo; |
| 52 | } |
Anton Korobeynikov | 16c29b5 | 2011-01-10 12:39:04 +0000 | [diff] [blame] | 53 | virtual const SPUFrameLowering *getFrameLowering() const { |
| 54 | return &FrameLowering; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 55 | } |
| 56 | /*! |
| 57 | \note Cell SPU does not support JIT today. It could support JIT at some |
| 58 | point. |
| 59 | */ |
| 60 | virtual TargetJITInfo *getJITInfo() { |
| 61 | return NULL; |
| 62 | } |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 63 | |
Andrew Trick | 843ee2e | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 64 | virtual const SPUTargetLowering *getTargetLowering() const { |
Dan Gohman | d858e90 | 2010-04-17 15:26:15 +0000 | [diff] [blame] | 65 | return &TLInfo; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 66 | } |
| 67 | |
Dan Gohman | ff7a562 | 2010-05-11 17:31:57 +0000 | [diff] [blame] | 68 | virtual const SPUSelectionDAGInfo* getSelectionDAGInfo() const { |
| 69 | return &TSInfo; |
| 70 | } |
| 71 | |
Dan Gohman | c9f5f3f | 2008-05-14 01:58:56 +0000 | [diff] [blame] | 72 | virtual const SPURegisterInfo *getRegisterInfo() const { |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 73 | return &InstrInfo.getRegisterInfo(); |
| 74 | } |
Andrew Trick | 843ee2e | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 75 | |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 76 | virtual const TargetData *getTargetData() const { |
| 77 | return &DataLayout; |
| 78 | } |
| 79 | |
Evan Cheng | 3ef1c87 | 2010-09-10 01:29:16 +0000 | [diff] [blame] | 80 | virtual const InstrItineraryData *getInstrItineraryData() const { |
| 81 | return &InstrItins; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 82 | } |
Andrew Trick | 843ee2e | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 83 | |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 84 | // Pass Pipeline Configuration |
Andrew Trick | 061efcf | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 85 | virtual TargetPassConfig *createPassConfig(PassManagerBase &PM); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 86 | }; |
| 87 | |
| 88 | } // end namespace llvm |
| 89 | |
| 90 | #endif |