Home | History | Annotate | Download | only in CellSPU
      1 //===-- SPUTargetMachine.h - Define TargetMachine for Cell SPU --*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      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 "SPUSelectionDAGInfo.h"
     21 #include "SPUFrameLowering.h"
     22 #include "llvm/Target/TargetMachine.h"
     23 #include "llvm/Target/TargetData.h"
     24 
     25 namespace llvm {
     26 
     27 /// SPUTargetMachine
     28 ///
     29 class SPUTargetMachine : public LLVMTargetMachine {
     30   SPUSubtarget        Subtarget;
     31   const TargetData    DataLayout;
     32   SPUInstrInfo        InstrInfo;
     33   SPUFrameLowering    FrameLowering;
     34   SPUTargetLowering   TLInfo;
     35   SPUSelectionDAGInfo TSInfo;
     36   InstrItineraryData  InstrItins;
     37 public:
     38   SPUTargetMachine(const Target &T, StringRef TT,
     39                    StringRef CPU, StringRef FS, const TargetOptions &Options,
     40                    Reloc::Model RM, CodeModel::Model CM,
     41                    CodeGenOpt::Level OL);
     42 
     43   /// Return the subtarget implementation object
     44   virtual const SPUSubtarget     *getSubtargetImpl() const {
     45     return &Subtarget;
     46   }
     47   virtual const SPUInstrInfo     *getInstrInfo() const {
     48     return &InstrInfo;
     49   }
     50   virtual const SPUFrameLowering *getFrameLowering() const {
     51     return &FrameLowering;
     52   }
     53   /*!
     54     \note Cell SPU does not support JIT today. It could support JIT at some
     55     point.
     56    */
     57   virtual       TargetJITInfo    *getJITInfo() {
     58     return NULL;
     59   }
     60 
     61   virtual const SPUTargetLowering *getTargetLowering() const {
     62    return &TLInfo;
     63   }
     64 
     65   virtual const SPUSelectionDAGInfo* getSelectionDAGInfo() const {
     66     return &TSInfo;
     67   }
     68 
     69   virtual const SPURegisterInfo *getRegisterInfo() const {
     70     return &InstrInfo.getRegisterInfo();
     71   }
     72 
     73   virtual const TargetData *getTargetData() const {
     74     return &DataLayout;
     75   }
     76 
     77   virtual const InstrItineraryData *getInstrItineraryData() const {
     78     return &InstrItins;
     79   }
     80 
     81   // Pass Pipeline Configuration
     82   virtual TargetPassConfig *createPassConfig(PassManagerBase &PM);
     83 };
     84 
     85 } // end namespace llvm
     86 
     87 #endif
     88