xref: /freebsd/contrib/llvm-project/llvm/lib/Target/Hexagon/HexagonTargetMachine.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
10b57cec5SDimitry Andric //=-- HexagonTargetMachine.h - Define TargetMachine for Hexagon ---*- C++ -*-=//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric //
90b57cec5SDimitry Andric // This file declares the Hexagon specific subclass of TargetMachine.
100b57cec5SDimitry Andric //
110b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
120b57cec5SDimitry Andric 
130b57cec5SDimitry Andric #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONTARGETMACHINE_H
140b57cec5SDimitry Andric #define LLVM_LIB_TARGET_HEXAGON_HEXAGONTARGETMACHINE_H
150b57cec5SDimitry Andric 
160b57cec5SDimitry Andric #include "HexagonInstrInfo.h"
170b57cec5SDimitry Andric #include "HexagonSubtarget.h"
180b57cec5SDimitry Andric #include "HexagonTargetObjectFile.h"
190b57cec5SDimitry Andric #include "llvm/Target/TargetMachine.h"
20bdd1243dSDimitry Andric #include <optional>
210b57cec5SDimitry Andric 
220b57cec5SDimitry Andric namespace llvm {
230b57cec5SDimitry Andric 
240b57cec5SDimitry Andric class HexagonTargetMachine : public LLVMTargetMachine {
250b57cec5SDimitry Andric   std::unique_ptr<TargetLoweringObjectFile> TLOF;
26*0fca6ea1SDimitry Andric   HexagonSubtarget Subtarget;
270b57cec5SDimitry Andric   mutable StringMap<std::unique_ptr<HexagonSubtarget>> SubtargetMap;
280b57cec5SDimitry Andric 
290b57cec5SDimitry Andric public:
300b57cec5SDimitry Andric   HexagonTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
310b57cec5SDimitry Andric                        StringRef FS, const TargetOptions &Options,
32bdd1243dSDimitry Andric                        std::optional<Reloc::Model> RM,
335f757f3fSDimitry Andric                        std::optional<CodeModel::Model> CM, CodeGenOptLevel OL,
34bdd1243dSDimitry Andric                        bool JIT);
350b57cec5SDimitry Andric   ~HexagonTargetMachine() override;
360b57cec5SDimitry Andric   const HexagonSubtarget *getSubtargetImpl(const Function &F) const override;
370b57cec5SDimitry Andric 
38*0fca6ea1SDimitry Andric   void registerPassBuilderCallbacks(PassBuilder &PB) override;
390b57cec5SDimitry Andric   TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
4081ad6265SDimitry Andric   TargetTransformInfo getTargetTransformInfo(const Function &F) const override;
410b57cec5SDimitry Andric 
getObjFileLowering()420b57cec5SDimitry Andric   HexagonTargetObjectFile *getObjFileLowering() const override {
430b57cec5SDimitry Andric     return static_cast<HexagonTargetObjectFile*>(TLOF.get());
440b57cec5SDimitry Andric   }
45bdd1243dSDimitry Andric 
46bdd1243dSDimitry Andric   MachineFunctionInfo *
47bdd1243dSDimitry Andric   createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F,
48bdd1243dSDimitry Andric                             const TargetSubtargetInfo *STI) const override;
490b57cec5SDimitry Andric };
500b57cec5SDimitry Andric 
510b57cec5SDimitry Andric } // end namespace llvm
520b57cec5SDimitry Andric 
530b57cec5SDimitry Andric #endif
54