xref: /freebsd/contrib/llvm-project/llvm/lib/Target/DirectX/DirectXTargetMachine.h (revision e6bfd18d21b225af6a0ed67ceeaf1293b7b9eba5)
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 
17 namespace llvm {
18 class Function;
19 class DirectXTargetMachine : public LLVMTargetMachine {
20   std::unique_ptr<TargetLoweringObjectFile> TLOF;
21   std::unique_ptr<DirectXSubtarget> Subtarget;
22 
23 public:
24   DirectXTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
25                        StringRef FS, const TargetOptions &Options,
26                        Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
27                        CodeGenOpt::Level OL, bool JIT);
28 
29   ~DirectXTargetMachine() override;
30 
31   bool addPassesToEmitFile(PassManagerBase &PM, raw_pwrite_stream &Out,
32                            raw_pwrite_stream *DwoOut, CodeGenFileType FileType,
33                            bool DisableVerify,
34                            MachineModuleInfoWrapperPass *MMIWP) override;
35 
36   bool addPassesToEmitMC(PassManagerBase &PM, MCContext *&Ctx,
37                          raw_pwrite_stream &Out, bool DisableVerify) override;
38 
39   const DirectXSubtarget *getSubtargetImpl(const Function &) const override;
40 
41   TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
42 
43   TargetLoweringObjectFile *getObjFileLowering() const override {
44     return TLOF.get();
45   }
46 
47   TargetTransformInfo getTargetTransformInfo(const Function &F) const override;
48 };
49 } // namespace llvm
50 
51 #endif // LLVM_DIRECTX_DIRECTXTARGETMACHINE_H
52