| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1 | //=-- HexagonTargetMachine.h - Define TargetMachine for Hexagon ---*- C++ -*-=// |
| 2 | // |
| Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This file declares the Hexagon specific subclass of TargetMachine. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 13 | #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONTARGETMACHINE_H |
| 14 | #define LLVM_LIB_TARGET_HEXAGON_HEXAGONTARGETMACHINE_H |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 15 | |
| Chandler Carruth | 802d755 | 2012-12-04 07:12:27 +0000 | [diff] [blame] | 16 | #include "HexagonInstrInfo.h" |
| Chandler Carruth | 802d755 | 2012-12-04 07:12:27 +0000 | [diff] [blame] | 17 | #include "HexagonSubtarget.h" |
| Krzysztof Parzyszek | 21dc8bd | 2015-12-18 20:19:30 +0000 | [diff] [blame] | 18 | #include "HexagonTargetObjectFile.h" |
| Chandler Carruth | 802d755 | 2012-12-04 07:12:27 +0000 | [diff] [blame] | 19 | #include "llvm/Target/TargetMachine.h" |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 20 | |
| 21 | namespace llvm { |
| 22 | |
| 23 | class Module; |
| 24 | |
| Matthias Braun | bb8507e | 2017-10-12 22:57:28 +0000 | [diff] [blame] | 25 | class HexagonTargetMachine : public LLVMTargetMachine { |
| Aditya Nandakumar | a271932 | 2014-11-13 09:26:31 +0000 | [diff] [blame] | 26 | std::unique_ptr<TargetLoweringObjectFile> TLOF; |
| Krzysztof Parzyszek | 73e66f3 | 2015-08-05 18:35:37 +0000 | [diff] [blame] | 27 | mutable StringMap<std::unique_ptr<HexagonSubtarget>> SubtargetMap; |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 28 | |
| 29 | public: |
| Daniel Sanders | 3e5de88 | 2015-06-11 19:41:26 +0000 | [diff] [blame] | 30 | HexagonTargetMachine(const Target &T, const Triple &TT, StringRef CPU, |
| Craig Topper | b545408 | 2012-03-17 09:24:09 +0000 | [diff] [blame] | 31 | StringRef FS, const TargetOptions &Options, |
| Rafael Espindola | 79e238a | 2017-08-03 02:16:21 +0000 | [diff] [blame] | 32 | Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM, |
| 33 | CodeGenOpt::Level OL, bool JIT); |
| Reid Kleckner | 357600e | 2014-11-20 23:37:18 +0000 | [diff] [blame] | 34 | ~HexagonTargetMachine() override; |
| Krzysztof Parzyszek | 73e66f3 | 2015-08-05 18:35:37 +0000 | [diff] [blame] | 35 | const HexagonSubtarget *getSubtargetImpl(const Function &F) const override; |
| 36 | |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 37 | static unsigned getModuleMatchQuality(const Module &M); |
| 38 | |
| Krzysztof Parzyszek | c8b9438 | 2017-01-26 21:41:10 +0000 | [diff] [blame] | 39 | void adjustPassManager(PassManagerBuilder &PMB) override; |
| Craig Topper | 906c2cd | 2014-04-29 07:58:16 +0000 | [diff] [blame] | 40 | TargetPassConfig *createPassConfig(PassManagerBase &PM) override; |
| Sanjoy Das | 26d11ca | 2017-12-22 18:21:59 +0000 | [diff] [blame] | 41 | TargetTransformInfo getTargetTransformInfo(const Function &F) override; |
| Aditya Nandakumar | a271932 | 2014-11-13 09:26:31 +0000 | [diff] [blame] | 42 | |
| Krzysztof Parzyszek | 21dc8bd | 2015-12-18 20:19:30 +0000 | [diff] [blame] | 43 | HexagonTargetObjectFile *getObjFileLowering() const override { |
| 44 | return static_cast<HexagonTargetObjectFile*>(TLOF.get()); |
| Aditya Nandakumar | a271932 | 2014-11-13 09:26:31 +0000 | [diff] [blame] | 45 | } |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 46 | }; |
| 47 | |
| Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 48 | } // end namespace llvm |
| 49 | |
| 50 | #endif |