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