| 1 | //===- DXILTranslateMetadata.h - Pass to emit DXIL metadata -----*- 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 | #ifndef LLVM_TARGET_DIRECTX_DXILTRANSLATEMETADATA_H |
| 10 | #define LLVM_TARGET_DIRECTX_DXILTRANSLATEMETADATA_H |
| 11 | |
| 12 | #include "llvm/IR/PassManager.h" |
| 13 | #include "llvm/Pass.h" |
| 14 | |
| 15 | namespace llvm { |
| 16 | |
| 17 | /// A pass that transforms LLVM Metadata in the module to it's DXIL equivalent, |
| 18 | /// then emits all recognized DXIL Metadata |
| 19 | class DXILTranslateMetadata |
| 20 | : public OptionalPassInfoMixin<DXILTranslateMetadata> { |
| 21 | public: |
| 22 | PreservedAnalyses run(Module &M, ModuleAnalysisManager &); |
| 23 | }; |
| 24 | |
| 25 | /// Wrapper pass for the legacy pass manager. |
| 26 | /// |
| 27 | /// This is required because the passes that will depend on this are codegen |
| 28 | /// passes which run through the legacy pass manager. |
| 29 | class DXILTranslateMetadataLegacy : public ModulePass { |
| 30 | public: |
| 31 | static char ID; // Pass identification, replacement for typeid |
| 32 | explicit DXILTranslateMetadataLegacy() : ModulePass(ID) {} |
| 33 | |
| 34 | StringRef getPassName() const override { return "DXIL Translate Metadata" ; } |
| 35 | |
| 36 | void getAnalysisUsage(AnalysisUsage &AU) const override; |
| 37 | |
| 38 | bool runOnModule(Module &M) override; |
| 39 | }; |
| 40 | |
| 41 | } // namespace llvm |
| 42 | |
| 43 | #endif // LLVM_TARGET_DIRECTX_DXILTRANSLATEMETADATA_H |
| 44 | |