[llvm] [NewPM][DirectX] Add DirectXPassRegistry.def NFCI (PR #86242)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 21 21:17:35 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-directx
Author: None (paperchalice)
<details>
<summary>Changes</summary>
Prepare migration for dag-isel
---
Full diff: https://github.com/llvm/llvm-project/pull/86242.diff
2 Files Affected:
- (added) llvm/lib/Target/DirectX/DirectXPassRegistry.def (+21)
- (modified) llvm/lib/Target/DirectX/DirectXTargetMachine.cpp (+2-13)
``````````diff
diff --git a/llvm/lib/Target/DirectX/DirectXPassRegistry.def b/llvm/lib/Target/DirectX/DirectXPassRegistry.def
new file mode 100644
index 00000000000000..58c86aaff8c70f
--- /dev/null
+++ b/llvm/lib/Target/DirectX/DirectXPassRegistry.def
@@ -0,0 +1,21 @@
+//===- DirectXPassRegistry.def - Registry of DirectX passes -----*- C++--*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is used as the registry of passes that are part of the
+// DirectX backend.
+//
+//===----------------------------------------------------------------------===//
+
+// NOTE: NO INCLUDE GUARD DESIRED!
+
+#ifndef MODULE_PASS
+#define MODULE_PASS(NAME, CREATE_PASS)
+#endif
+MODULE_PASS("print-dx-shader-flags", DXILResourcePrinterPass(dbgs()))
+MODULE_PASS("print-dxil-resource", DXILResourcePrinterPass(dbgs()))
+#undef MODULE_PASS
diff --git a/llvm/lib/Target/DirectX/DirectXTargetMachine.cpp b/llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
index 03c825b3977db3..55765a109f11ae 100644
--- a/llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
+++ b/llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
@@ -104,19 +104,8 @@ DirectXTargetMachine::~DirectXTargetMachine() {}
void DirectXTargetMachine::registerPassBuilderCallbacks(
PassBuilder &PB, bool PopulateClassToPassNames) {
- PB.registerPipelineParsingCallback(
- [](StringRef PassName, ModulePassManager &PM,
- ArrayRef<PassBuilder::PipelineElement>) {
- if (PassName == "print-dxil-resource") {
- PM.addPass(DXILResourcePrinterPass(dbgs()));
- return true;
- }
- if (PassName == "print-dx-shader-flags") {
- PM.addPass(dxil::ShaderFlagsAnalysisPrinter(dbgs()));
- return true;
- }
- return false;
- });
+#define GET_PASS_REGISTRY "DirectXPassRegistry.def"
+#include "llvm/Passes/TargetPassRegistry.inc"
PB.registerAnalysisRegistrationCallback([](ModuleAnalysisManager &MAM) {
MAM.registerPass([&] { return DXILResourceAnalysis(); });
``````````
</details>
https://github.com/llvm/llvm-project/pull/86242
More information about the llvm-commits
mailing list