File tree Expand file tree Collapse file tree 2 files changed +31
-18
lines changed
Expand file tree Collapse file tree 2 files changed +31
-18
lines changed Original file line number Diff line number Diff line change 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_ANALYSIS
17+ #define MODULE_ANALYSIS(NAME, CREATE_PASS)
18+ #endif
19+ MODULE_ANALYSIS("dx-shader-flags", dxil::ShaderFlagsAnalysis())
20+ MODULE_ANALYSIS("dxil-resource", DXILResourceAnalysis())
21+ #undef MODULE_ANALYSIS
22+
23+ #ifndef MODULE_PASS
24+ #define MODULE_PASS(NAME, CREATE_PASS)
25+ #endif
26+ // TODO: rename to print<foo> after NPM switch
27+ MODULE_PASS("print-dx-shader-flags", DXILResourcePrinterPass(dbgs()))
28+ MODULE_PASS("print-dxil-resource", DXILResourcePrinterPass(dbgs()))
29+ #undef MODULE_PASS
Original file line number Diff line number Diff line change @@ -104,24 +104,8 @@ DirectXTargetMachine::~DirectXTargetMachine() {}
104104
105105void 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- });
120-
121- PB.registerAnalysisRegistrationCallback ([](ModuleAnalysisManager &MAM) {
122- MAM.registerPass ([&] { return DXILResourceAnalysis (); });
123- MAM.registerPass ([&] { return dxil::ShaderFlagsAnalysis (); });
124- });
107+ #define GET_PASS_REGISTRY " DirectXPassRegistry.def"
108+ #include " llvm/Passes/TargetPassRegistry.inc"
125109}
126110
127111bool DirectXTargetMachine::addPassesToEmitFile (
You can’t perform that action at this time.
0 commit comments