Skip to content

Commit ca8ef6f

Browse files
hekotafrederik-h
authored andcommitted
[DirectX] Remove DXILResourceMDAnalysis (llvm#130323)
Removing `DXILResourceMDAnalysis` that gathers information about resources for the `DXILTranslateMetadata` pass. It collects the info based on obsolete resource metadata annotations that are going to be removed soon. Part 1/2 of llvm#114126
1 parent 37a05a2 commit ca8ef6f

15 files changed

+8
-639
lines changed

llvm/lib/Target/DirectX/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ add_llvm_target(DirectXCodeGen
2828
DXILOpLowering.cpp
2929
DXILPrepare.cpp
3030
DXILPrettyPrinter.cpp
31-
DXILResource.cpp
32-
DXILResourceAnalysis.cpp
3331
DXILResourceAccess.cpp
3432
DXILShaderFlags.cpp
3533
DXILTranslateMetadata.cpp

llvm/lib/Target/DirectX/DXILDataScalarization.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#ifndef LLVM_TARGET_DIRECTX_DXILDATASCALARIZATION_H
1010
#define LLVM_TARGET_DIRECTX_DXILDATASCALARIZATION_H
1111

12-
#include "DXILResource.h"
1312
#include "llvm/IR/PassManager.h"
1413
#include "llvm/Pass.h"
1514

llvm/lib/Target/DirectX/DXILIntrinsicExpansion.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#ifndef LLVM_TARGET_DIRECTX_DXILINTRINSICEXPANSION_H
99
#define LLVM_TARGET_DIRECTX_DXILINTRINSICEXPANSION_H
1010

11-
#include "DXILResource.h"
1211
#include "llvm/IR/PassManager.h"
1312
#include "llvm/Pass.h"
1413

llvm/lib/Target/DirectX/DXILOpLowering.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "DXILConstants.h"
1111
#include "DXILIntrinsicExpansion.h"
1212
#include "DXILOpBuilder.h"
13-
#include "DXILResourceAnalysis.h"
1413
#include "DXILShaderFlags.h"
1514
#include "DirectX.h"
1615
#include "llvm/ADT/SmallVector.h"
@@ -889,7 +888,6 @@ class DXILOpLoweringLegacy : public ModulePass {
889888
AU.addRequired<DXILResourceTypeWrapperPass>();
890889
AU.addRequired<DXILResourceBindingWrapperPass>();
891890
AU.addPreserved<DXILResourceBindingWrapperPass>();
892-
AU.addPreserved<DXILResourceMDWrapper>();
893891
AU.addPreserved<DXILMetadataAnalysisWrapperPass>();
894892
AU.addPreserved<ShaderFlagsAnalysisWrapper>();
895893
}

llvm/lib/Target/DirectX/DXILPrepare.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
/// Language (DXIL).
1212
//===----------------------------------------------------------------------===//
1313

14-
#include "DXILResourceAnalysis.h"
1514
#include "DXILShaderFlags.h"
1615
#include "DirectX.h"
1716
#include "DirectXIRPasses/PointerTypeAnalysis.h"
@@ -248,7 +247,6 @@ class DXILPrepareModule : public ModulePass {
248247
void getAnalysisUsage(AnalysisUsage &AU) const override {
249248
AU.addRequired<DXILMetadataAnalysisWrapperPass>();
250249
AU.addPreserved<ShaderFlagsAnalysisWrapper>();
251-
AU.addPreserved<DXILResourceMDWrapper>();
252250
AU.addPreserved<DXILMetadataAnalysisWrapperPass>();
253251
AU.addPreserved<DXILResourceBindingWrapperPass>();
254252
}

llvm/lib/Target/DirectX/DXILPrettyPrinter.cpp

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "DXILPrettyPrinter.h"
10-
#include "DXILResourceAnalysis.h"
1110
#include "DirectX.h"
1211
#include "llvm/ADT/StringRef.h"
1312
#include "llvm/Analysis/DXILResource.h"
@@ -222,8 +221,7 @@ struct FormatBindingSize
222221
} // namespace
223222

224223
static void prettyPrintResources(raw_ostream &OS, const DXILBindingMap &DBM,
225-
DXILResourceTypeMap &DRTM,
226-
const dxil::Resources &MDResources) {
224+
DXILResourceTypeMap &DRTM) {
227225
// Column widths are arbitrary but match the widths DXC uses.
228226
OS << ";\n; Resource Bindings:\n;\n";
229227
OS << formatv("; {0,-30} {1,10} {2,7} {3,11} {4,7} {5,14} {6,9}\n", "Name",
@@ -237,11 +235,6 @@ static void prettyPrintResources(raw_ostream &OS, const DXILBindingMap &DBM,
237235
const dxil::ResourceTypeInfo &RTI = DRTM[RBI.getHandleTy()];
238236

239237
dxil::ResourceClass RC = RTI.getResourceClass();
240-
assert((RC != dxil::ResourceClass::CBuffer || !MDResources.hasCBuffers()) &&
241-
"Old and new cbuffer representations can't coexist");
242-
assert((RC != dxil::ResourceClass::UAV || !MDResources.hasUAVs()) &&
243-
"Old and new UAV representations can't coexist");
244-
245238
StringRef Name(RBI.getName());
246239
StringRef Type(getRCName(RC));
247240
StringRef Format(getFormatName(RTI));
@@ -252,21 +245,14 @@ static void prettyPrintResources(raw_ostream &OS, const DXILBindingMap &DBM,
252245
OS << formatv("; {0,-30} {1,10} {2,7} {3,11} {4,7} {5,14} {6,9}\n", Name,
253246
Type, Format, Dim, ID, Bind, Count);
254247
}
255-
256-
if (MDResources.hasCBuffers())
257-
MDResources.printCBuffers(OS);
258-
if (MDResources.hasUAVs())
259-
MDResources.printUAVs(OS);
260-
261248
OS << ";\n";
262249
}
263250

264251
PreservedAnalyses DXILPrettyPrinterPass::run(Module &M,
265252
ModuleAnalysisManager &MAM) {
266253
const DXILBindingMap &DBM = MAM.getResult<DXILResourceBindingAnalysis>(M);
267254
DXILResourceTypeMap &DRTM = MAM.getResult<DXILResourceTypeAnalysis>(M);
268-
const dxil::Resources &MDResources = MAM.getResult<DXILResourceMDAnalysis>(M);
269-
prettyPrintResources(OS, DBM, DRTM, MDResources);
255+
prettyPrintResources(OS, DBM, DRTM);
270256
return PreservedAnalyses::all();
271257
}
272258

@@ -293,7 +279,6 @@ class DXILPrettyPrinterLegacy : public llvm::ModulePass {
293279
AU.setPreservesAll();
294280
AU.addRequired<DXILResourceTypeWrapperPass>();
295281
AU.addRequired<DXILResourceBindingWrapperPass>();
296-
AU.addRequired<DXILResourceMDWrapper>();
297282
}
298283
};
299284
} // namespace
@@ -303,7 +288,6 @@ INITIALIZE_PASS_BEGIN(DXILPrettyPrinterLegacy, "dxil-pretty-printer",
303288
"DXIL Metadata Pretty Printer", true, true)
304289
INITIALIZE_PASS_DEPENDENCY(DXILResourceTypeWrapperPass)
305290
INITIALIZE_PASS_DEPENDENCY(DXILResourceBindingWrapperPass)
306-
INITIALIZE_PASS_DEPENDENCY(DXILResourceMDWrapper)
307291
INITIALIZE_PASS_END(DXILPrettyPrinterLegacy, "dxil-pretty-printer",
308292
"DXIL Metadata Pretty Printer", true, true)
309293

@@ -312,8 +296,7 @@ bool DXILPrettyPrinterLegacy::runOnModule(Module &M) {
312296
getAnalysis<DXILResourceBindingWrapperPass>().getBindingMap();
313297
DXILResourceTypeMap &DRTM =
314298
getAnalysis<DXILResourceTypeWrapperPass>().getResourceTypeMap();
315-
dxil::Resources &Res = getAnalysis<DXILResourceMDWrapper>().getDXILResource();
316-
prettyPrintResources(OS, DBM, DRTM, Res);
299+
prettyPrintResources(OS, DBM, DRTM);
317300
return false;
318301
}
319302

0 commit comments

Comments
 (0)