Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1 | //=-- HexagonTargetMachine.h - Define TargetMachine for Hexagon ---*- 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 Hexagon specific subclass of TargetMachine. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef HexagonTARGETMACHINE_H |
| 15 | #define HexagonTARGETMACHINE_H |
| 16 | |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 17 | #include "HexagonFrameLowering.h" |
Chandler Carruth | a1514e2 | 2012-12-04 07:12:27 +0000 | [diff] [blame] | 18 | #include "HexagonISelLowering.h" |
| 19 | #include "HexagonInstrInfo.h" |
| 20 | #include "HexagonSelectionDAGInfo.h" |
| 21 | #include "HexagonSubtarget.h" |
Chandler Carruth | 0b8c9a8 | 2013-01-02 11:36:10 +0000 | [diff] [blame^] | 22 | #include "llvm/IR/DataLayout.h" |
Chandler Carruth | a1514e2 | 2012-12-04 07:12:27 +0000 | [diff] [blame] | 23 | #include "llvm/Target/TargetMachine.h" |
Nadav Rotem | cbd9a19 | 2012-10-18 23:22:48 +0000 | [diff] [blame] | 24 | #include "llvm/Target/TargetTransformImpl.h" |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 25 | |
| 26 | namespace llvm { |
| 27 | |
| 28 | class Module; |
| 29 | |
| 30 | class HexagonTargetMachine : public LLVMTargetMachine { |
Micah Villmow | 3574eca | 2012-10-08 16:38:25 +0000 | [diff] [blame] | 31 | const DataLayout DL; // Calculates type size & alignment. |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 32 | HexagonSubtarget Subtarget; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 33 | HexagonInstrInfo InstrInfo; |
Benjamin Kramer | 9034562 | 2011-12-16 19:08:59 +0000 | [diff] [blame] | 34 | HexagonTargetLowering TLInfo; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 35 | HexagonSelectionDAGInfo TSInfo; |
| 36 | HexagonFrameLowering FrameLowering; |
| 37 | const InstrItineraryData* InstrItins; |
Nadav Rotem | cbd9a19 | 2012-10-18 23:22:48 +0000 | [diff] [blame] | 38 | ScalarTargetTransformImpl STTI; |
| 39 | VectorTargetTransformImpl VTTI; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 40 | |
| 41 | public: |
| 42 | HexagonTargetMachine(const Target &T, StringRef TT,StringRef CPU, |
Craig Topper | 1e0c9ab | 2012-03-17 09:24:09 +0000 | [diff] [blame] | 43 | StringRef FS, const TargetOptions &Options, |
| 44 | Reloc::Model RM, CodeModel::Model CM, |
| 45 | CodeGenOpt::Level OL); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 46 | |
| 47 | virtual const HexagonInstrInfo *getInstrInfo() const { |
| 48 | return &InstrInfo; |
| 49 | } |
| 50 | virtual const HexagonSubtarget *getSubtargetImpl() const { |
| 51 | return &Subtarget; |
| 52 | } |
| 53 | virtual const HexagonRegisterInfo *getRegisterInfo() const { |
| 54 | return &InstrInfo.getRegisterInfo(); |
| 55 | } |
| 56 | |
| 57 | virtual const InstrItineraryData* getInstrItineraryData() const { |
| 58 | return InstrItins; |
| 59 | } |
| 60 | |
| 61 | |
| 62 | virtual const HexagonTargetLowering* getTargetLowering() const { |
| 63 | return &TLInfo; |
| 64 | } |
| 65 | |
| 66 | virtual const HexagonFrameLowering* getFrameLowering() const { |
| 67 | return &FrameLowering; |
| 68 | } |
| 69 | |
| 70 | virtual const HexagonSelectionDAGInfo* getSelectionDAGInfo() const { |
| 71 | return &TSInfo; |
| 72 | } |
| 73 | |
Nadav Rotem | cbd9a19 | 2012-10-18 23:22:48 +0000 | [diff] [blame] | 74 | virtual const ScalarTargetTransformInfo *getScalarTargetTransformInfo()const { |
| 75 | return &STTI; |
| 76 | } |
| 77 | |
| 78 | virtual const VectorTargetTransformInfo *getVectorTargetTransformInfo()const { |
| 79 | return &VTTI; |
| 80 | } |
| 81 | |
Micah Villmow | 3574eca | 2012-10-08 16:38:25 +0000 | [diff] [blame] | 82 | virtual const DataLayout *getDataLayout() const { return &DL; } |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 83 | static unsigned getModuleMatchQuality(const Module &M); |
| 84 | |
| 85 | // Pass Pipeline Configuration. |
| 86 | virtual bool addPassesForOptimizations(PassManagerBase &PM); |
Andrew Trick | 061efcf | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 87 | virtual TargetPassConfig *createPassConfig(PassManagerBase &PM); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 88 | }; |
| 89 | |
| 90 | extern bool flag_aligned_memcpy; |
| 91 | |
| 92 | } // end namespace llvm |
| 93 | |
| 94 | #endif |