Jia Liu | 31d157a | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 1 | //===-- MBlazeTargetMachine.h - Define TargetMachine for MBlaze -*- C++ -*-===// |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 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" |
Dan Gohman | ff7a562 | 2010-05-11 17:31:57 +0000 | [diff] [blame] | 20 | #include "MBlazeSelectionDAGInfo.h" |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 21 | #include "MBlazeIntrinsicInfo.h" |
Anton Korobeynikov | 16c29b5 | 2011-01-10 12:39:04 +0000 | [diff] [blame] | 22 | #include "MBlazeFrameLowering.h" |
Wesley Peck | 4e9141f | 2010-10-21 03:57:26 +0000 | [diff] [blame] | 23 | #include "MBlazeELFWriterInfo.h" |
| 24 | #include "llvm/MC/MCStreamer.h" |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 25 | #include "llvm/Target/TargetMachine.h" |
| 26 | #include "llvm/Target/TargetData.h" |
Anton Korobeynikov | 16c29b5 | 2011-01-10 12:39:04 +0000 | [diff] [blame] | 27 | #include "llvm/Target/TargetFrameLowering.h" |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 28 | |
| 29 | namespace llvm { |
| 30 | class formatted_raw_ostream; |
| 31 | |
| 32 | class MBlazeTargetMachine : public LLVMTargetMachine { |
Anton Korobeynikov | 16c29b5 | 2011-01-10 12:39:04 +0000 | [diff] [blame] | 33 | MBlazeSubtarget Subtarget; |
| 34 | const TargetData DataLayout; // Calculates type size & alignment |
| 35 | MBlazeInstrInfo InstrInfo; |
| 36 | MBlazeFrameLowering FrameLowering; |
| 37 | MBlazeTargetLowering TLInfo; |
Dan Gohman | ff7a562 | 2010-05-11 17:31:57 +0000 | [diff] [blame] | 38 | MBlazeSelectionDAGInfo TSInfo; |
Anton Korobeynikov | 16c29b5 | 2011-01-10 12:39:04 +0000 | [diff] [blame] | 39 | MBlazeIntrinsicInfo IntrinsicInfo; |
Wesley Peck | 4e9141f | 2010-10-21 03:57:26 +0000 | [diff] [blame] | 40 | MBlazeELFWriterInfo ELFWriterInfo; |
Wesley Peck | 3d820ba | 2011-04-11 22:31:52 +0000 | [diff] [blame] | 41 | InstrItineraryData InstrItins; |
| 42 | |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 43 | public: |
Evan Cheng | 4396613 | 2011-07-19 06:37:02 +0000 | [diff] [blame] | 44 | MBlazeTargetMachine(const Target &T, StringRef TT, |
Evan Cheng | 34ad6db | 2011-07-20 07:51:56 +0000 | [diff] [blame] | 45 | StringRef CPU, StringRef FS, |
Nick Lewycky | 8a8d479 | 2011-12-02 22:16:29 +0000 | [diff] [blame] | 46 | const TargetOptions &Options, |
Evan Cheng | b95fc31 | 2011-11-16 08:38:26 +0000 | [diff] [blame] | 47 | Reloc::Model RM, CodeModel::Model CM, |
| 48 | CodeGenOpt::Level OL); |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 49 | |
| 50 | virtual const MBlazeInstrInfo *getInstrInfo() const |
| 51 | { return &InstrInfo; } |
| 52 | |
Wesley Peck | 3d820ba | 2011-04-11 22:31:52 +0000 | [diff] [blame] | 53 | virtual const InstrItineraryData *getInstrItineraryData() const |
| 54 | { return &InstrItins; } |
| 55 | |
Anton Korobeynikov | 16c29b5 | 2011-01-10 12:39:04 +0000 | [diff] [blame] | 56 | virtual const TargetFrameLowering *getFrameLowering() const |
| 57 | { return &FrameLowering; } |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 58 | |
| 59 | virtual const MBlazeSubtarget *getSubtargetImpl() const |
| 60 | { return &Subtarget; } |
| 61 | |
| 62 | virtual const TargetData *getTargetData() const |
| 63 | { return &DataLayout;} |
| 64 | |
| 65 | virtual const MBlazeRegisterInfo *getRegisterInfo() const |
| 66 | { return &InstrInfo.getRegisterInfo(); } |
| 67 | |
Dan Gohman | d858e90 | 2010-04-17 15:26:15 +0000 | [diff] [blame] | 68 | virtual const MBlazeTargetLowering *getTargetLowering() const |
| 69 | { return &TLInfo; } |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 70 | |
Dan Gohman | ff7a562 | 2010-05-11 17:31:57 +0000 | [diff] [blame] | 71 | virtual const MBlazeSelectionDAGInfo* getSelectionDAGInfo() const |
| 72 | { return &TSInfo; } |
| 73 | |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 74 | const TargetIntrinsicInfo *getIntrinsicInfo() const |
| 75 | { return &IntrinsicInfo; } |
| 76 | |
Wesley Peck | 4e9141f | 2010-10-21 03:57:26 +0000 | [diff] [blame] | 77 | virtual const MBlazeELFWriterInfo *getELFWriterInfo() const { |
| 78 | return &ELFWriterInfo; |
| 79 | } |
| 80 | |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 81 | // Pass Pipeline Configuration |
Andrew Trick | 061efcf | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 82 | virtual TargetPassConfig *createPassConfig(PassManagerBase &PM); |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 83 | }; |
| 84 | } // End llvm namespace |
| 85 | |
| 86 | #endif |