Home | History | Annotate | Download | only in MBlaze
      1 //===-- MBlazeTargetMachine.h - Define TargetMachine for MBlaze --- 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 MBlaze specific subclass of TargetMachine.
     11 //
     12 //===----------------------------------------------------------------------===//
     13 
     14 #ifndef MBLAZE_TARGETMACHINE_H
     15 #define MBLAZE_TARGETMACHINE_H
     16 
     17 #include "MBlazeSubtarget.h"
     18 #include "MBlazeInstrInfo.h"
     19 #include "MBlazeISelLowering.h"
     20 #include "MBlazeSelectionDAGInfo.h"
     21 #include "MBlazeIntrinsicInfo.h"
     22 #include "MBlazeFrameLowering.h"
     23 #include "MBlazeELFWriterInfo.h"
     24 #include "llvm/MC/MCStreamer.h"
     25 #include "llvm/Target/TargetMachine.h"
     26 #include "llvm/Target/TargetData.h"
     27 #include "llvm/Target/TargetFrameLowering.h"
     28 
     29 namespace llvm {
     30   class formatted_raw_ostream;
     31 
     32   class MBlazeTargetMachine : public LLVMTargetMachine {
     33     MBlazeSubtarget        Subtarget;
     34     const TargetData       DataLayout; // Calculates type size & alignment
     35     MBlazeInstrInfo        InstrInfo;
     36     MBlazeFrameLowering    FrameLowering;
     37     MBlazeTargetLowering   TLInfo;
     38     MBlazeSelectionDAGInfo TSInfo;
     39     MBlazeIntrinsicInfo    IntrinsicInfo;
     40     MBlazeELFWriterInfo    ELFWriterInfo;
     41     InstrItineraryData     InstrItins;
     42 
     43   public:
     44     MBlazeTargetMachine(const Target &T, StringRef TT,
     45                         StringRef CPU, StringRef FS,
     46                         Reloc::Model RM, CodeModel::Model CM);
     47 
     48     virtual const MBlazeInstrInfo *getInstrInfo() const
     49     { return &InstrInfo; }
     50 
     51     virtual const InstrItineraryData *getInstrItineraryData() const
     52     {  return &InstrItins; }
     53 
     54     virtual const TargetFrameLowering *getFrameLowering() const
     55     { return &FrameLowering; }
     56 
     57     virtual const MBlazeSubtarget *getSubtargetImpl() const
     58     { return &Subtarget; }
     59 
     60     virtual const TargetData *getTargetData() const
     61     { return &DataLayout;}
     62 
     63     virtual const MBlazeRegisterInfo *getRegisterInfo() const
     64     { return &InstrInfo.getRegisterInfo(); }
     65 
     66     virtual const MBlazeTargetLowering *getTargetLowering() const
     67     { return &TLInfo; }
     68 
     69     virtual const MBlazeSelectionDAGInfo* getSelectionDAGInfo() const
     70     { return &TSInfo; }
     71 
     72     const TargetIntrinsicInfo *getIntrinsicInfo() const
     73     { return &IntrinsicInfo; }
     74 
     75     virtual const MBlazeELFWriterInfo *getELFWriterInfo() const {
     76       return &ELFWriterInfo;
     77     }
     78 
     79     // Pass Pipeline Configuration
     80     virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level Opt);
     81     virtual bool addPreEmitPass(PassManagerBase &PM,CodeGenOpt::Level Opt);
     82   };
     83 } // End llvm namespace
     84 
     85 #endif
     86