| 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/CodeGen/CodeGenTargetMachineImpl.h" |
| 20 | #include <optional> |
| 21 | |
| 22 | namespace llvm { |
| 23 | |
| 24 | class HexagonTargetMachine : public CodeGenTargetMachineImpl { |
| 25 | std::unique_ptr<TargetLoweringObjectFile> TLOF; |
| 26 | HexagonSubtarget Subtarget; |
| 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 | std::optional<Reloc::Model> RM, |
| 33 | std::optional<CodeModel::Model> CM, CodeGenOptLevel OL, |
| 34 | bool JIT); |
| 35 | ~HexagonTargetMachine() override; |
| 36 | const HexagonSubtarget *getSubtargetImpl(const Function &F) const override; |
| 37 | |
| 38 | void registerPassBuilderCallbacks(PassBuilder &PB) override; |
| 39 | TargetPassConfig *createPassConfig(PassManagerBase &PM) override; |
| 40 | TargetTransformInfo getTargetTransformInfo(const Function &F) const override; |
| 41 | |
| 42 | HexagonTargetObjectFile *getObjFileLowering() const override { |
| 43 | return static_cast<HexagonTargetObjectFile*>(TLOF.get()); |
| 44 | } |
| 45 | |
| 46 | MachineFunctionInfo * |
| 47 | createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F, |
| 48 | const TargetSubtargetInfo *STI) const override; |
| 49 | |
| 50 | bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override { |
| 51 | return true; |
| 52 | } |
| 53 | ScheduleDAGInstrs * |
| 54 | createMachineScheduler(MachineSchedContext *C) const override; |
| 55 | }; |
| 56 | |
| 57 | } // end namespace llvm |
| 58 | |
| 59 | #endif |
| 60 | |