| 1 | //===-- XCoreTargetMachine.h - Define TargetMachine for XCore ---*- 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 XCore specific subclass of TargetMachine. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #ifndef LLVM_LIB_TARGET_XCORE_XCORETARGETMACHINE_H |
| 14 | #define LLVM_LIB_TARGET_XCORE_XCORETARGETMACHINE_H |
| 15 | |
| 16 | #include "XCoreSubtarget.h" |
| 17 | #include "llvm/Analysis/TargetTransformInfo.h" |
| 18 | #include "llvm/CodeGen/CodeGenTargetMachineImpl.h" |
| 19 | #include "llvm/Support/CodeGen.h" |
| 20 | #include <memory> |
| 21 | #include <optional> |
| 22 | |
| 23 | namespace llvm { |
| 24 | class StringRef; |
| 25 | |
| 26 | class XCoreTargetMachine : public CodeGenTargetMachineImpl { |
| 27 | std::unique_ptr<TargetLoweringObjectFile> TLOF; |
| 28 | XCoreSubtarget Subtarget; |
| 29 | |
| 30 | public: |
| 31 | XCoreTargetMachine(const Target &T, const Triple &TT, StringRef CPU, |
| 32 | StringRef FS, const TargetOptions &Options, |
| 33 | std::optional<Reloc::Model> RM, |
| 34 | std::optional<CodeModel::Model> CM, CodeGenOptLevel OL, |
| 35 | bool JIT); |
| 36 | ~XCoreTargetMachine() override; |
| 37 | |
| 38 | const XCoreSubtarget *getSubtargetImpl() const { return &Subtarget; } |
| 39 | const XCoreSubtarget *getSubtargetImpl(const Function &) const override { |
| 40 | return &Subtarget; |
| 41 | } |
| 42 | |
| 43 | // Pass Pipeline Configuration |
| 44 | TargetPassConfig *createPassConfig(PassManagerBase &PM) override; |
| 45 | |
| 46 | TargetTransformInfo getTargetTransformInfo(const Function &F) const override; |
| 47 | |
| 48 | TargetLoweringObjectFile *getObjFileLowering() const override { |
| 49 | return TLOF.get(); |
| 50 | } |
| 51 | |
| 52 | MachineFunctionInfo * |
| 53 | createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F, |
| 54 | const TargetSubtargetInfo *STI) const override; |
| 55 | }; |
| 56 | |
| 57 | } // end namespace llvm |
| 58 | |
| 59 | #endif // LLVM_LIB_TARGET_XCORE_XCORETARGETMACHINE_H |
| 60 | |