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 "HexagonInstrInfo.h" |
| 18 | #include "HexagonSubtarget.h" |
| 19 | #include "HexagonISelLowering.h" |
| 20 | #include "HexagonSelectionDAGInfo.h" |
| 21 | #include "HexagonFrameLowering.h" |
Craig Topper | 79aa341 | 2012-03-17 18:46:09 +0000 | [diff] [blame] | 22 | #include "llvm/Target/TargetMachine.h" |
| 23 | #include "llvm/Target/TargetData.h" |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 24 | |
| 25 | namespace llvm { |
| 26 | |
| 27 | class Module; |
| 28 | |
| 29 | class HexagonTargetMachine : public LLVMTargetMachine { |
| 30 | const TargetData DataLayout; // Calculates type size & alignment. |
| 31 | HexagonSubtarget Subtarget; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 32 | HexagonInstrInfo InstrInfo; |
Benjamin Kramer | 9034562 | 2011-12-16 19:08:59 +0000 | [diff] [blame] | 33 | HexagonTargetLowering TLInfo; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 34 | HexagonSelectionDAGInfo TSInfo; |
| 35 | HexagonFrameLowering FrameLowering; |
| 36 | const InstrItineraryData* InstrItins; |
| 37 | |
| 38 | public: |
| 39 | HexagonTargetMachine(const Target &T, StringRef TT,StringRef CPU, |
Craig Topper | 1e0c9ab | 2012-03-17 09:24:09 +0000 | [diff] [blame] | 40 | StringRef FS, const TargetOptions &Options, |
| 41 | Reloc::Model RM, CodeModel::Model CM, |
| 42 | CodeGenOpt::Level OL); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 43 | |
| 44 | virtual const HexagonInstrInfo *getInstrInfo() const { |
| 45 | return &InstrInfo; |
| 46 | } |
| 47 | virtual const HexagonSubtarget *getSubtargetImpl() const { |
| 48 | return &Subtarget; |
| 49 | } |
| 50 | virtual const HexagonRegisterInfo *getRegisterInfo() const { |
| 51 | return &InstrInfo.getRegisterInfo(); |
| 52 | } |
| 53 | |
| 54 | virtual const InstrItineraryData* getInstrItineraryData() const { |
| 55 | return InstrItins; |
| 56 | } |
| 57 | |
| 58 | |
| 59 | virtual const HexagonTargetLowering* getTargetLowering() const { |
| 60 | return &TLInfo; |
| 61 | } |
| 62 | |
| 63 | virtual const HexagonFrameLowering* getFrameLowering() const { |
| 64 | return &FrameLowering; |
| 65 | } |
| 66 | |
| 67 | virtual const HexagonSelectionDAGInfo* getSelectionDAGInfo() const { |
| 68 | return &TSInfo; |
| 69 | } |
| 70 | |
| 71 | virtual const TargetData *getTargetData() const { return &DataLayout; } |
| 72 | static unsigned getModuleMatchQuality(const Module &M); |
| 73 | |
| 74 | // Pass Pipeline Configuration. |
| 75 | virtual bool addPassesForOptimizations(PassManagerBase &PM); |
Andrew Trick | 061efcf | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 76 | virtual TargetPassConfig *createPassConfig(PassManagerBase &PM); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 77 | }; |
| 78 | |
| 79 | extern bool flag_aligned_memcpy; |
| 80 | |
| 81 | } // end namespace llvm |
| 82 | |
| 83 | #endif |