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