1 //===--- CSKYTargetMachine.h - Define TargetMachine for CSKY ----*- 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 CSKY specific subclass of TargetMachine. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #ifndef LLVM_LIB_TARGET_CSKY_CSKYTARGETMACHINE_H 14 #define LLVM_LIB_TARGET_CSKY_CSKYTARGETMACHINE_H 15 16 #include "CSKYSubtarget.h" 17 #include "llvm/IR/DataLayout.h" 18 #include "llvm/Target/TargetMachine.h" 19 20 namespace llvm { 21 22 class CSKYTargetMachine : public LLVMTargetMachine { 23 std::unique_ptr<TargetLoweringObjectFile> TLOF; 24 mutable StringMap<std::unique_ptr<CSKYSubtarget>> SubtargetMap; 25 26 public: 27 CSKYTargetMachine(const Target &T, const Triple &TT, StringRef CPU, 28 StringRef FS, const TargetOptions &Options, 29 Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM, 30 CodeGenOpt::Level OL, bool JIT); 31 32 TargetPassConfig *createPassConfig(PassManagerBase &PM) override; 33 34 const CSKYSubtarget *getSubtargetImpl(const Function &F) const override; 35 // DO NOT IMPLEMENT: There is no such thing as a valid default subtarget, 36 // subtargets are per-function entities based on the target-specific 37 // attributes of each function. 38 const CSKYSubtarget *getSubtargetImpl() const = delete; 39 40 TargetLoweringObjectFile *getObjFileLowering() const override { 41 return TLOF.get(); 42 } 43 }; 44 } // namespace llvm 45 46 #endif 47