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