Skip to content

[DirectX] Remove DXILResourceMDAnalysis #130323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions llvm/lib/Target/DirectX/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ add_llvm_target(DirectXCodeGen
DXILOpLowering.cpp
DXILPrepare.cpp
DXILPrettyPrinter.cpp
DXILResource.cpp
DXILResourceAnalysis.cpp
DXILResourceAccess.cpp
DXILShaderFlags.cpp
DXILTranslateMetadata.cpp
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/Target/DirectX/DXILDataScalarization.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#ifndef LLVM_TARGET_DIRECTX_DXILDATASCALARIZATION_H
#define LLVM_TARGET_DIRECTX_DXILDATASCALARIZATION_H

#include "DXILResource.h"
#include "llvm/IR/PassManager.h"
#include "llvm/Pass.h"

Expand Down
1 change: 0 additions & 1 deletion llvm/lib/Target/DirectX/DXILIntrinsicExpansion.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#ifndef LLVM_TARGET_DIRECTX_DXILINTRINSICEXPANSION_H
#define LLVM_TARGET_DIRECTX_DXILINTRINSICEXPANSION_H

#include "DXILResource.h"
#include "llvm/IR/PassManager.h"
#include "llvm/Pass.h"

Expand Down
2 changes: 0 additions & 2 deletions llvm/lib/Target/DirectX/DXILOpLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "DXILConstants.h"
#include "DXILIntrinsicExpansion.h"
#include "DXILOpBuilder.h"
#include "DXILResourceAnalysis.h"
#include "DXILShaderFlags.h"
#include "DirectX.h"
#include "llvm/ADT/SmallVector.h"
Expand Down Expand Up @@ -889,7 +888,6 @@ class DXILOpLoweringLegacy : public ModulePass {
AU.addRequired<DXILResourceTypeWrapperPass>();
AU.addRequired<DXILResourceBindingWrapperPass>();
AU.addPreserved<DXILResourceBindingWrapperPass>();
AU.addPreserved<DXILResourceMDWrapper>();
AU.addPreserved<DXILMetadataAnalysisWrapperPass>();
AU.addPreserved<ShaderFlagsAnalysisWrapper>();
}
Expand Down
2 changes: 0 additions & 2 deletions llvm/lib/Target/DirectX/DXILPrepare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
/// Language (DXIL).
//===----------------------------------------------------------------------===//

#include "DXILResourceAnalysis.h"
#include "DXILShaderFlags.h"
#include "DirectX.h"
#include "DirectXIRPasses/PointerTypeAnalysis.h"
Expand Down Expand Up @@ -248,7 +247,6 @@ class DXILPrepareModule : public ModulePass {
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<DXILMetadataAnalysisWrapperPass>();
AU.addPreserved<ShaderFlagsAnalysisWrapper>();
AU.addPreserved<DXILResourceMDWrapper>();
AU.addPreserved<DXILMetadataAnalysisWrapperPass>();
AU.addPreserved<DXILResourceBindingWrapperPass>();
}
Expand Down
23 changes: 3 additions & 20 deletions llvm/lib/Target/DirectX/DXILPrettyPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//

#include "DXILPrettyPrinter.h"
#include "DXILResourceAnalysis.h"
#include "DirectX.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Analysis/DXILResource.h"
Expand Down Expand Up @@ -222,8 +221,7 @@ struct FormatBindingSize
} // namespace

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

dxil::ResourceClass RC = RTI.getResourceClass();
assert((RC != dxil::ResourceClass::CBuffer || !MDResources.hasCBuffers()) &&
"Old and new cbuffer representations can't coexist");
assert((RC != dxil::ResourceClass::UAV || !MDResources.hasUAVs()) &&
"Old and new UAV representations can't coexist");

StringRef Name(RBI.getName());
StringRef Type(getRCName(RC));
StringRef Format(getFormatName(RTI));
Expand All @@ -252,21 +245,14 @@ static void prettyPrintResources(raw_ostream &OS, const DXILBindingMap &DBM,
OS << formatv("; {0,-30} {1,10} {2,7} {3,11} {4,7} {5,14} {6,9}\n", Name,
Type, Format, Dim, ID, Bind, Count);
}

if (MDResources.hasCBuffers())
MDResources.printCBuffers(OS);
if (MDResources.hasUAVs())
MDResources.printUAVs(OS);

OS << ";\n";
}

PreservedAnalyses DXILPrettyPrinterPass::run(Module &M,
ModuleAnalysisManager &MAM) {
const DXILBindingMap &DBM = MAM.getResult<DXILResourceBindingAnalysis>(M);
DXILResourceTypeMap &DRTM = MAM.getResult<DXILResourceTypeAnalysis>(M);
const dxil::Resources &MDResources = MAM.getResult<DXILResourceMDAnalysis>(M);
prettyPrintResources(OS, DBM, DRTM, MDResources);
prettyPrintResources(OS, DBM, DRTM);
return PreservedAnalyses::all();
}

Expand All @@ -293,7 +279,6 @@ class DXILPrettyPrinterLegacy : public llvm::ModulePass {
AU.setPreservesAll();
AU.addRequired<DXILResourceTypeWrapperPass>();
AU.addRequired<DXILResourceBindingWrapperPass>();
AU.addRequired<DXILResourceMDWrapper>();
}
};
} // namespace
Expand All @@ -303,7 +288,6 @@ INITIALIZE_PASS_BEGIN(DXILPrettyPrinterLegacy, "dxil-pretty-printer",
"DXIL Metadata Pretty Printer", true, true)
INITIALIZE_PASS_DEPENDENCY(DXILResourceTypeWrapperPass)
INITIALIZE_PASS_DEPENDENCY(DXILResourceBindingWrapperPass)
INITIALIZE_PASS_DEPENDENCY(DXILResourceMDWrapper)
INITIALIZE_PASS_END(DXILPrettyPrinterLegacy, "dxil-pretty-printer",
"DXIL Metadata Pretty Printer", true, true)

Expand All @@ -312,8 +296,7 @@ bool DXILPrettyPrinterLegacy::runOnModule(Module &M) {
getAnalysis<DXILResourceBindingWrapperPass>().getBindingMap();
DXILResourceTypeMap &DRTM =
getAnalysis<DXILResourceTypeWrapperPass>().getResourceTypeMap();
dxil::Resources &Res = getAnalysis<DXILResourceMDWrapper>().getDXILResource();
prettyPrintResources(OS, DBM, DRTM, Res);
prettyPrintResources(OS, DBM, DRTM);
return false;
}

Expand Down
Loading