Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 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" |
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 | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 41 | public: |
| 42 | MBlazeTargetMachine(const Target &T, const std::string &TT, |
| 43 | const std::string &FS); |
| 44 | |
| 45 | virtual const MBlazeInstrInfo *getInstrInfo() const |
| 46 | { return &InstrInfo; } |
| 47 | |
Anton Korobeynikov | 16c29b5 | 2011-01-10 12:39:04 +0000 | [diff] [blame^] | 48 | virtual const TargetFrameLowering *getFrameLowering() const |
| 49 | { return &FrameLowering; } |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 50 | |
| 51 | virtual const MBlazeSubtarget *getSubtargetImpl() const |
| 52 | { return &Subtarget; } |
| 53 | |
| 54 | virtual const TargetData *getTargetData() const |
| 55 | { return &DataLayout;} |
| 56 | |
| 57 | virtual const MBlazeRegisterInfo *getRegisterInfo() const |
| 58 | { return &InstrInfo.getRegisterInfo(); } |
| 59 | |
Dan Gohman | d858e90 | 2010-04-17 15:26:15 +0000 | [diff] [blame] | 60 | virtual const MBlazeTargetLowering *getTargetLowering() const |
| 61 | { return &TLInfo; } |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 62 | |
Dan Gohman | ff7a562 | 2010-05-11 17:31:57 +0000 | [diff] [blame] | 63 | virtual const MBlazeSelectionDAGInfo* getSelectionDAGInfo() const |
| 64 | { return &TSInfo; } |
| 65 | |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 66 | const TargetIntrinsicInfo *getIntrinsicInfo() const |
| 67 | { return &IntrinsicInfo; } |
| 68 | |
Wesley Peck | 4e9141f | 2010-10-21 03:57:26 +0000 | [diff] [blame] | 69 | virtual const MBlazeELFWriterInfo *getELFWriterInfo() const { |
| 70 | return &ELFWriterInfo; |
| 71 | } |
| 72 | |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 73 | // Pass Pipeline Configuration |
Wesley Peck | 8397be0 | 2010-12-09 03:42:04 +0000 | [diff] [blame] | 74 | virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level Opt); |
| 75 | virtual bool addPreEmitPass(PassManagerBase &PM,CodeGenOpt::Level Opt); |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 76 | }; |
| 77 | } // End llvm namespace |
| 78 | |
| 79 | #endif |