1 //===- DirectXTargetMachine.h - DirectX Target Implementation ---*- 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 //===----------------------------------------------------------------------===// 10 11 #ifndef LLVM_DIRECTX_DIRECTXTARGETMACHINE_H 12 #define LLVM_DIRECTX_DIRECTXTARGETMACHINE_H 13 14 #include "DirectXSubtarget.h" 15 #include "llvm/Target/TargetMachine.h" 16 #include <optional> 17 18 namespace llvm { 19 class Function; 20 class DirectXTargetMachine : public LLVMTargetMachine { 21 std::unique_ptr<TargetLoweringObjectFile> TLOF; 22 std::unique_ptr<DirectXSubtarget> Subtarget; 23 24 public: 25 DirectXTargetMachine(const Target &T, const Triple &TT, StringRef CPU, 26 StringRef FS, const TargetOptions &Options, 27 std::optional<Reloc::Model> RM, 28 std::optional<CodeModel::Model> CM, CodeGenOpt::Level OL, 29 bool JIT); 30 31 ~DirectXTargetMachine() override; 32 33 bool addPassesToEmitFile(PassManagerBase &PM, raw_pwrite_stream &Out, 34 raw_pwrite_stream *DwoOut, CodeGenFileType FileType, 35 bool DisableVerify, 36 MachineModuleInfoWrapperPass *MMIWP) override; 37 38 bool addPassesToEmitMC(PassManagerBase &PM, MCContext *&Ctx, 39 raw_pwrite_stream &Out, bool DisableVerify) override; 40 41 const DirectXSubtarget *getSubtargetImpl(const Function &) const override; 42 43 TargetPassConfig *createPassConfig(PassManagerBase &PM) override; 44 45 TargetLoweringObjectFile *getObjFileLowering() const override { 46 return TLOF.get(); 47 } 48 49 TargetTransformInfo getTargetTransformInfo(const Function &F) const override; 50 void registerPassBuilderCallbacks(PassBuilder &PB) override; 51 }; 52 } // namespace llvm 53 54 #endif // LLVM_DIRECTX_DIRECTXTARGETMACHINE_H 55