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/ADT/Optional.h" 18 #include "llvm/Analysis/TargetTransformInfo.h" 19 #include "llvm/Support/CodeGen.h" 20 #include "llvm/Target/TargetMachine.h" 21 #include <memory> 22 23 namespace llvm { 24 class StringRef; 25 26 class XCoreTargetMachine : public LLVMTargetMachine { 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 Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM, 34 CodeGenOpt::Level OL, bool JIT); 35 ~XCoreTargetMachine() override; 36 37 const XCoreSubtarget *getSubtargetImpl() const { return &Subtarget; } 38 const XCoreSubtarget *getSubtargetImpl(const Function &) const override { 39 return &Subtarget; 40 } 41 42 // Pass Pipeline Configuration 43 TargetPassConfig *createPassConfig(PassManagerBase &PM) override; 44 45 TargetTransformInfo getTargetTransformInfo(const Function &F) const override; 46 47 TargetLoweringObjectFile *getObjFileLowering() const override { 48 return TLOF.get(); 49 } 50 }; 51 52 } // end namespace llvm 53 54 #endif // LLVM_LIB_TARGET_XCORE_XCORETARGETMACHINE_H 55