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" |
| 20 | #include "MBlazeIntrinsicInfo.h" |
| 21 | #include "llvm/Target/TargetMachine.h" |
| 22 | #include "llvm/Target/TargetData.h" |
| 23 | #include "llvm/Target/TargetFrameInfo.h" |
| 24 | |
| 25 | namespace llvm { |
| 26 | class formatted_raw_ostream; |
| 27 | |
| 28 | class MBlazeTargetMachine : public LLVMTargetMachine { |
| 29 | MBlazeSubtarget Subtarget; |
| 30 | const TargetData DataLayout; // Calculates type size & alignment |
| 31 | MBlazeInstrInfo InstrInfo; |
| 32 | TargetFrameInfo FrameInfo; |
| 33 | MBlazeTargetLowering TLInfo; |
| 34 | MBlazeIntrinsicInfo IntrinsicInfo; |
| 35 | public: |
| 36 | MBlazeTargetMachine(const Target &T, const std::string &TT, |
| 37 | const std::string &FS); |
| 38 | |
| 39 | virtual const MBlazeInstrInfo *getInstrInfo() const |
| 40 | { return &InstrInfo; } |
| 41 | |
| 42 | virtual const TargetFrameInfo *getFrameInfo() const |
| 43 | { return &FrameInfo; } |
| 44 | |
| 45 | virtual const MBlazeSubtarget *getSubtargetImpl() const |
| 46 | { return &Subtarget; } |
| 47 | |
| 48 | virtual const TargetData *getTargetData() const |
| 49 | { return &DataLayout;} |
| 50 | |
| 51 | virtual const MBlazeRegisterInfo *getRegisterInfo() const |
| 52 | { return &InstrInfo.getRegisterInfo(); } |
| 53 | |
| 54 | virtual MBlazeTargetLowering *getTargetLowering() const |
| 55 | { return const_cast<MBlazeTargetLowering*>(&TLInfo); } |
| 56 | |
| 57 | const TargetIntrinsicInfo *getIntrinsicInfo() const |
| 58 | { return &IntrinsicInfo; } |
| 59 | |
| 60 | // Pass Pipeline Configuration |
| 61 | virtual bool addInstSelector(PassManagerBase &PM, |
| 62 | CodeGenOpt::Level OptLevel); |
| 63 | |
| 64 | virtual bool addPreEmitPass(PassManagerBase &PM, |
| 65 | CodeGenOpt::Level OptLevel); |
| 66 | }; |
| 67 | } // End llvm namespace |
| 68 | |
| 69 | #endif |