xref: /freebsd/contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonTargetMachine.h (revision d5b0e70f7e04d971691517ce1304d86a1e367e2e)
1 //=-- HexagonTargetMachine.h - Define TargetMachine for Hexagon ---*- C++ -*-=//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file declares the Hexagon specific subclass of TargetMachine.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONTARGETMACHINE_H
14 #define LLVM_LIB_TARGET_HEXAGON_HEXAGONTARGETMACHINE_H
15 
16 #include "HexagonInstrInfo.h"
17 #include "HexagonSubtarget.h"
18 #include "HexagonTargetObjectFile.h"
19 #include "llvm/Target/TargetMachine.h"
20 
21 namespace llvm {
22 
23 class Module;
24 
25 class HexagonTargetMachine : public LLVMTargetMachine {
26   std::unique_ptr<TargetLoweringObjectFile> TLOF;
27   mutable StringMap<std::unique_ptr<HexagonSubtarget>> SubtargetMap;
28 
29 public:
30   HexagonTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
31                        StringRef FS, const TargetOptions &Options,
32                        Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
33                        CodeGenOpt::Level OL, bool JIT);
34   ~HexagonTargetMachine() override;
35   const HexagonSubtarget *getSubtargetImpl(const Function &F) const override;
36 
37   static unsigned getModuleMatchQuality(const Module &M);
38 
39   void adjustPassManager(PassManagerBuilder &PMB) override;
40   void registerPassBuilderCallbacks(PassBuilder &PB) override;
41   TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
42   TargetTransformInfo getTargetTransformInfo(const Function &F) override;
43 
44   HexagonTargetObjectFile *getObjFileLowering() const override {
45     return static_cast<HexagonTargetObjectFile*>(TLOF.get());
46   }
47 };
48 
49 } // end namespace llvm
50 
51 #endif
52