Skip to content

Commit c0365e8

Browse files
committed
[NewPM][DirectX] Add DirectXPassRegistry.def
Prepare migration for dag-isel
1 parent c67ed2f commit c0365e8

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===- DirectXPassRegistry.def - Registry of DirectX passes -----*- 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 is used as the registry of passes that are part of the
10+
// DirectX backend.
11+
//
12+
//===----------------------------------------------------------------------===//
13+
14+
// NOTE: NO INCLUDE GUARD DESIRED!
15+
16+
#ifndef MODULE_PASS
17+
#define MODULE_PASS(NAME, CREATE_PASS)
18+
#endif
19+
MODULE_PASS("print-dx-shader-flags", DXILResourcePrinterPass(dbgs()))
20+
MODULE_PASS("print-dxil-resource", DXILResourcePrinterPass(dbgs()))
21+
#undef MODULE_PASS

llvm/lib/Target/DirectX/DirectXTargetMachine.cpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,8 @@ DirectXTargetMachine::~DirectXTargetMachine() {}
104104

105105
void DirectXTargetMachine::registerPassBuilderCallbacks(
106106
PassBuilder &PB, bool PopulateClassToPassNames) {
107-
PB.registerPipelineParsingCallback(
108-
[](StringRef PassName, ModulePassManager &PM,
109-
ArrayRef<PassBuilder::PipelineElement>) {
110-
if (PassName == "print-dxil-resource") {
111-
PM.addPass(DXILResourcePrinterPass(dbgs()));
112-
return true;
113-
}
114-
if (PassName == "print-dx-shader-flags") {
115-
PM.addPass(dxil::ShaderFlagsAnalysisPrinter(dbgs()));
116-
return true;
117-
}
118-
return false;
119-
});
107+
#define GET_PASS_REGISTRY "DirectXPassRegistry.def"
108+
#include "llvm/Passes/TargetPassRegistry.inc"
120109

121110
PB.registerAnalysisRegistrationCallback([](ModuleAnalysisManager &MAM) {
122111
MAM.registerPass([&] { return DXILResourceAnalysis(); });

0 commit comments

Comments
 (0)