Skip to content

[NFC][HLSL] Rename ResourceBinding Types #134165

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 3 commits into from
Apr 4, 2025
Merged

Conversation

V-FEXrt
Copy link
Contributor

@V-FEXrt V-FEXrt commented Apr 2, 2025

Non-functional change as first step in llvm/wg-hlsl#207

Removes Binding from "Resource Instance" types

@llvmbot
Copy link
Member

llvmbot commented Apr 2, 2025

@llvm/pr-subscribers-llvm-analysis

@llvm/pr-subscribers-backend-directx

Author: Ashley Coleman (V-FEXrt)

Changes

Non-functional change as first step in llvm/wg-hlsl#207

Removes Binding from "Resource Instance" types


Patch is 39.80 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/134165.diff

10 Files Affected:

  • (modified) llvm/include/llvm/Analysis/DXILResource.h (+19-23)
  • (modified) llvm/lib/Analysis/DXILResource.cpp (+31-34)
  • (modified) llvm/lib/Passes/PassRegistry.def (+3-3)
  • (modified) llvm/lib/Target/DirectX/DXContainerGlobals.cpp (+11-15)
  • (modified) llvm/lib/Target/DirectX/DXILOpLowering.cpp (+5-5)
  • (modified) llvm/lib/Target/DirectX/DXILPrettyPrinter.cpp (+16-16)
  • (modified) llvm/lib/Target/DirectX/DXILTranslateMetadata.cpp (+6-6)
  • (modified) llvm/test/Analysis/DXILResource/buffer-frombinding.ll (+1-1)
  • (modified) llvm/unittests/Analysis/DXILResourceTest.cpp (+60-60)
  • (modified) llvm/unittests/Target/DirectX/UniqueResourceFromUseTests.cpp (+5-5)
diff --git a/llvm/include/llvm/Analysis/DXILResource.h b/llvm/include/llvm/Analysis/DXILResource.h
index d399457e16916..6a7be779cb2a3 100644
--- a/llvm/include/llvm/Analysis/DXILResource.h
+++ b/llvm/include/llvm/Analysis/DXILResource.h
@@ -326,7 +326,7 @@ class ResourceTypeInfo {
 
 //===----------------------------------------------------------------------===//
 
-class ResourceBindingInfo {
+class ResourceInfo {
 public:
   struct ResourceBinding {
     uint32_t RecordID;
@@ -353,9 +353,9 @@ class ResourceBindingInfo {
   GlobalVariable *Symbol = nullptr;
 
 public:
-  ResourceBindingInfo(uint32_t RecordID, uint32_t Space, uint32_t LowerBound,
-                      uint32_t Size, TargetExtType *HandleTy,
-                      GlobalVariable *Symbol = nullptr)
+  ResourceInfo(uint32_t RecordID, uint32_t Space, uint32_t LowerBound,
+               uint32_t Size, TargetExtType *HandleTy,
+               GlobalVariable *Symbol = nullptr)
       : Binding{RecordID, Space, LowerBound, Size}, HandleTy(HandleTy),
         Symbol(Symbol) {}
 
@@ -372,14 +372,12 @@ class ResourceBindingInfo {
   std::pair<uint32_t, uint32_t>
   getAnnotateProps(Module &M, dxil::ResourceTypeInfo &RTI) const;
 
-  bool operator==(const ResourceBindingInfo &RHS) const {
+  bool operator==(const ResourceInfo &RHS) const {
     return std::tie(Binding, HandleTy, Symbol) ==
            std::tie(RHS.Binding, RHS.HandleTy, RHS.Symbol);
   }
-  bool operator!=(const ResourceBindingInfo &RHS) const {
-    return !(*this == RHS);
-  }
-  bool operator<(const ResourceBindingInfo &RHS) const {
+  bool operator!=(const ResourceInfo &RHS) const { return !(*this == RHS); }
+  bool operator<(const ResourceInfo &RHS) const {
     return Binding < RHS.Binding;
   }
 
@@ -441,7 +439,7 @@ ModulePass *createDXILResourceTypeWrapperPassPass();
 //===----------------------------------------------------------------------===//
 
 class DXILBindingMap {
-  SmallVector<dxil::ResourceBindingInfo> Infos;
+  SmallVector<dxil::ResourceInfo> Infos;
   DenseMap<CallInst *, unsigned> CallMap;
   unsigned FirstUAV = 0;
   unsigned FirstCBuffer = 0;
@@ -451,8 +449,8 @@ class DXILBindingMap {
   void populate(Module &M, DXILResourceTypeMap &DRTM);
 
 public:
-  using iterator = SmallVector<dxil::ResourceBindingInfo>::iterator;
-  using const_iterator = SmallVector<dxil::ResourceBindingInfo>::const_iterator;
+  using iterator = SmallVector<dxil::ResourceInfo>::iterator;
+  using const_iterator = SmallVector<dxil::ResourceInfo>::const_iterator;
 
   iterator begin() { return Infos.begin(); }
   const_iterator begin() const { return Infos.begin(); }
@@ -466,12 +464,12 @@ class DXILBindingMap {
     return Pos == CallMap.end() ? Infos.end() : (Infos.begin() + Pos->second);
   }
 
-  /// Resolves a resource handle into a vector of ResourceBindingInfos that
+  /// Resolves a resource handle into a vector of ResourceInfos that
   /// represent the possible unique creations of the handle. Certain cases are
   /// ambiguous so multiple creation instructions may be returned. The resulting
-  /// ResourceBindingInfo can be used to depuplicate unique handles that
+  /// ResourceInfo can be used to depuplicate unique handles that
   /// reference the same resource
-  SmallVector<dxil::ResourceBindingInfo> findByUse(const Value *Key) const;
+  SmallVector<dxil::ResourceInfo> findByUse(const Value *Key) const;
 
   const_iterator find(const CallInst *Key) const {
     auto Pos = CallMap.find(Key);
@@ -521,13 +519,12 @@ class DXILBindingMap {
   void print(raw_ostream &OS, DXILResourceTypeMap &DRTM,
              const DataLayout &DL) const;
 
-  friend class DXILResourceBindingAnalysis;
+  friend class DXILResourceAnalysis;
   friend class DXILResourceBindingWrapperPass;
 };
 
-class DXILResourceBindingAnalysis
-    : public AnalysisInfoMixin<DXILResourceBindingAnalysis> {
-  friend AnalysisInfoMixin<DXILResourceBindingAnalysis>;
+class DXILResourceAnalysis : public AnalysisInfoMixin<DXILResourceAnalysis> {
+  friend AnalysisInfoMixin<DXILResourceAnalysis>;
 
   static AnalysisKey Key;
 
@@ -538,13 +535,12 @@ class DXILResourceBindingAnalysis
   DXILBindingMap run(Module &M, ModuleAnalysisManager &AM);
 };
 
-/// Printer pass for the \c DXILResourceBindingAnalysis results.
-class DXILResourceBindingPrinterPass
-    : public PassInfoMixin<DXILResourceBindingPrinterPass> {
+/// Printer pass for the \c DXILResourceAnalysis results.
+class DXILResourcePrinterPass : public PassInfoMixin<DXILResourcePrinterPass> {
   raw_ostream &OS;
 
 public:
-  explicit DXILResourceBindingPrinterPass(raw_ostream &OS) : OS(OS) {}
+  explicit DXILResourcePrinterPass(raw_ostream &OS) : OS(OS) {}
 
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 
diff --git a/llvm/lib/Analysis/DXILResource.cpp b/llvm/lib/Analysis/DXILResource.cpp
index 22afb4cba6f26..8f2cae1f53f70 100644
--- a/llvm/lib/Analysis/DXILResource.cpp
+++ b/llvm/lib/Analysis/DXILResource.cpp
@@ -531,8 +531,8 @@ void ResourceTypeInfo::print(raw_ostream &OS, const DataLayout &DL) const {
   }
 }
 
-GlobalVariable *ResourceBindingInfo::createSymbol(Module &M, StructType *Ty,
-                                                  StringRef Name) {
+GlobalVariable *ResourceInfo::createSymbol(Module &M, StructType *Ty,
+                                           StringRef Name) {
   assert(!Symbol && "Symbol has already been created");
   Symbol = new GlobalVariable(M, Ty, /*isConstant=*/true,
                               GlobalValue::ExternalLinkage,
@@ -540,8 +540,8 @@ GlobalVariable *ResourceBindingInfo::createSymbol(Module &M, StructType *Ty,
   return Symbol;
 }
 
-MDTuple *ResourceBindingInfo::getAsMetadata(Module &M,
-                                            dxil::ResourceTypeInfo &RTI) const {
+MDTuple *ResourceInfo::getAsMetadata(Module &M,
+                                     dxil::ResourceTypeInfo &RTI) const {
   LLVMContext &Ctx = M.getContext();
   const DataLayout &DL = M.getDataLayout();
 
@@ -610,8 +610,7 @@ MDTuple *ResourceBindingInfo::getAsMetadata(Module &M,
 }
 
 std::pair<uint32_t, uint32_t>
-ResourceBindingInfo::getAnnotateProps(Module &M,
-                                      dxil::ResourceTypeInfo &RTI) const {
+ResourceInfo::getAnnotateProps(Module &M, dxil::ResourceTypeInfo &RTI) const {
   const DataLayout &DL = M.getDataLayout();
 
   uint32_t ResourceKind = llvm::to_underlying(RTI.getResourceKind());
@@ -658,8 +657,8 @@ ResourceBindingInfo::getAnnotateProps(Module &M,
   return {Word0, Word1};
 }
 
-void ResourceBindingInfo::print(raw_ostream &OS, dxil::ResourceTypeInfo &RTI,
-                                const DataLayout &DL) const {
+void ResourceInfo::print(raw_ostream &OS, dxil::ResourceTypeInfo &RTI,
+                         const DataLayout &DL) const {
   if (Symbol) {
     OS << "  Symbol: ";
     Symbol->printAsOperand(OS);
@@ -687,8 +686,7 @@ bool DXILResourceTypeMap::invalidate(Module &M, const PreservedAnalyses &PA,
 //===----------------------------------------------------------------------===//
 
 void DXILBindingMap::populate(Module &M, DXILResourceTypeMap &DRTM) {
-  SmallVector<std::tuple<CallInst *, ResourceBindingInfo, ResourceTypeInfo>>
-      CIToInfos;
+  SmallVector<std::tuple<CallInst *, ResourceInfo, ResourceTypeInfo>> CIToInfos;
 
   for (Function &F : M.functions()) {
     if (!F.isDeclaration())
@@ -711,10 +709,10 @@ void DXILBindingMap::populate(Module &M, DXILResourceTypeMap &DRTM) {
               cast<ConstantInt>(CI->getArgOperand(1))->getZExtValue();
           uint32_t Size =
               cast<ConstantInt>(CI->getArgOperand(2))->getZExtValue();
-          ResourceBindingInfo RBI = ResourceBindingInfo{
-              /*RecordID=*/0, Space, LowerBound, Size, HandleTy};
+          ResourceInfo RI =
+              ResourceInfo{/*RecordID=*/0, Space, LowerBound, Size, HandleTy};
 
-          CIToInfos.emplace_back(CI, RBI, RTI);
+          CIToInfos.emplace_back(CI, RI, RTI);
         }
 
       break;
@@ -723,18 +721,18 @@ void DXILBindingMap::populate(Module &M, DXILResourceTypeMap &DRTM) {
   }
 
   llvm::stable_sort(CIToInfos, [](auto &LHS, auto &RHS) {
-    const auto &[LCI, LRBI, LRTI] = LHS;
-    const auto &[RCI, RRBI, RRTI] = RHS;
+    const auto &[LCI, LRI, LRTI] = LHS;
+    const auto &[RCI, RRI, RRTI] = RHS;
     // Sort by resource class first for grouping purposes, and then by the
     // binding and type so we can remove duplicates.
     ResourceClass LRC = LRTI.getResourceClass();
     ResourceClass RRC = RRTI.getResourceClass();
 
-    return std::tie(LRC, LRBI, LRTI) < std::tie(RRC, RRBI, RRTI);
+    return std::tie(LRC, LRI, LRTI) < std::tie(RRC, RRI, RRTI);
   });
-  for (auto [CI, RBI, RTI] : CIToInfos) {
-    if (Infos.empty() || RBI != Infos.back())
-      Infos.push_back(RBI);
+  for (auto [CI, RI, RTI] : CIToInfos) {
+    if (Infos.empty() || RI != Infos.back())
+      Infos.push_back(RI);
     CallMap[CI] = Infos.size() - 1;
   }
 
@@ -743,8 +741,8 @@ void DXILBindingMap::populate(Module &M, DXILResourceTypeMap &DRTM) {
   FirstUAV = FirstCBuffer = FirstSampler = Size;
   uint32_t NextID = 0;
   for (unsigned I = 0, E = Size; I != E; ++I) {
-    ResourceBindingInfo &RBI = Infos[I];
-    ResourceTypeInfo &RTI = DRTM[RBI.getHandleTy()];
+    ResourceInfo &RI = Infos[I];
+    ResourceTypeInfo &RTI = DRTM[RI.getHandleTy()];
     if (RTI.isUAV() && FirstUAV == Size) {
       FirstUAV = I;
       NextID = 0;
@@ -762,7 +760,7 @@ void DXILBindingMap::populate(Module &M, DXILResourceTypeMap &DRTM) {
     FirstUAV = std::min({FirstUAV, FirstCBuffer});
 
     // Adjust the resource binding to use the next ID.
-    RBI.setBindingID(NextID++);
+    RI.setBindingID(NextID++);
   }
 }
 
@@ -770,8 +768,8 @@ void DXILBindingMap::print(raw_ostream &OS, DXILResourceTypeMap &DRTM,
                            const DataLayout &DL) const {
   for (unsigned I = 0, E = Infos.size(); I != E; ++I) {
     OS << "Binding " << I << ":\n";
-    const dxil::ResourceBindingInfo &RBI = Infos[I];
-    RBI.print(OS, DRTM[RBI.getHandleTy()], DL);
+    const dxil::ResourceInfo &RI = Infos[I];
+    RI.print(OS, DRTM[RI.getHandleTy()], DL);
     OS << "\n";
   }
 
@@ -782,10 +780,10 @@ void DXILBindingMap::print(raw_ostream &OS, DXILResourceTypeMap &DRTM,
   }
 }
 
-SmallVector<dxil::ResourceBindingInfo>
+SmallVector<dxil::ResourceInfo>
 DXILBindingMap::findByUse(const Value *Key) const {
   if (const PHINode *Phi = dyn_cast<PHINode>(Key)) {
-    SmallVector<dxil::ResourceBindingInfo> Children;
+    SmallVector<dxil::ResourceInfo> Children;
     for (const Value *V : Phi->operands()) {
       Children.append(findByUse(V));
     }
@@ -810,7 +808,7 @@ DXILBindingMap::findByUse(const Value *Key) const {
   // Check if any of the parameters are the resource we are following. If so
   // keep searching. If none of them are return an empty list
   const Type *UseType = CI->getType();
-  SmallVector<dxil::ResourceBindingInfo> Children;
+  SmallVector<dxil::ResourceInfo> Children;
   for (const Value *V : CI->args()) {
     if (V->getType() != UseType)
       continue;
@@ -824,19 +822,18 @@ DXILBindingMap::findByUse(const Value *Key) const {
 //===----------------------------------------------------------------------===//
 
 AnalysisKey DXILResourceTypeAnalysis::Key;
-AnalysisKey DXILResourceBindingAnalysis::Key;
+AnalysisKey DXILResourceAnalysis::Key;
 
-DXILBindingMap DXILResourceBindingAnalysis::run(Module &M,
-                                                ModuleAnalysisManager &AM) {
+DXILBindingMap DXILResourceAnalysis::run(Module &M, ModuleAnalysisManager &AM) {
   DXILBindingMap Data;
   DXILResourceTypeMap &DRTM = AM.getResult<DXILResourceTypeAnalysis>(M);
   Data.populate(M, DRTM);
   return Data;
 }
 
-PreservedAnalyses
-DXILResourceBindingPrinterPass::run(Module &M, ModuleAnalysisManager &AM) {
-  DXILBindingMap &DBM = AM.getResult<DXILResourceBindingAnalysis>(M);
+PreservedAnalyses DXILResourcePrinterPass::run(Module &M,
+                                               ModuleAnalysisManager &AM) {
+  DXILBindingMap &DBM = AM.getResult<DXILResourceAnalysis>(M);
   DXILResourceTypeMap &DRTM = AM.getResult<DXILResourceTypeAnalysis>(M);
 
   DBM.print(OS, DRTM, M.getDataLayout());
@@ -895,7 +892,7 @@ LLVM_DUMP_METHOD
 void DXILResourceBindingWrapperPass::dump() const { print(dbgs(), nullptr); }
 #endif
 
-INITIALIZE_PASS(DXILResourceBindingWrapperPass, "dxil-resource-binding",
+INITIALIZE_PASS(DXILResourceBindingWrapperPass, "dxil-resource",
                 "DXIL Resource Binding Analysis", false, true)
 char DXILResourceBindingWrapperPass::ID = 0;
 
diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index 510a505995304..a34ea45bad7de 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -22,7 +22,7 @@ MODULE_ANALYSIS("callgraph", CallGraphAnalysis())
 MODULE_ANALYSIS("collector-metadata", CollectorMetadataAnalysis())
 MODULE_ANALYSIS("ctx-prof-analysis", CtxProfAnalysis())
 MODULE_ANALYSIS("dxil-metadata", DXILMetadataAnalysis())
-MODULE_ANALYSIS("dxil-resource-binding", DXILResourceBindingAnalysis())
+MODULE_ANALYSIS("dxil-resource", DXILResourceAnalysis())
 MODULE_ANALYSIS("dxil-resource-type", DXILResourceTypeAnalysis())
 MODULE_ANALYSIS("inline-advisor", InlineAdvisorAnalysis())
 MODULE_ANALYSIS("ir-similarity", IRSimilarityAnalysis())
@@ -128,8 +128,8 @@ MODULE_PASS("print-must-be-executed-contexts",
 MODULE_PASS("print-profile-summary", ProfileSummaryPrinterPass(errs()))
 MODULE_PASS("print-stack-safety", StackSafetyGlobalPrinterPass(errs()))
 MODULE_PASS("print<dxil-metadata>", DXILMetadataAnalysisPrinterPass(errs()))
-MODULE_PASS("print<dxil-resource-binding>",
-            DXILResourceBindingPrinterPass(errs()))
+MODULE_PASS("print<dxil-resource>",
+            DXILResourcePrinterPass(errs()))
 MODULE_PASS("print<inline-advisor>", InlineAdvisorAnalysisPrinterPass(errs()))
 MODULE_PASS("print<module-debuginfo>", ModuleDebugInfoPrinterPass(errs()))
 MODULE_PASS("print<reg-usage>", PhysicalRegisterUsageInfoPrinterPass(errs()))
diff --git a/llvm/lib/Target/DirectX/DXContainerGlobals.cpp b/llvm/lib/Target/DirectX/DXContainerGlobals.cpp
index c7a130a1f9c8a..8ab9352986fd9 100644
--- a/llvm/lib/Target/DirectX/DXContainerGlobals.cpp
+++ b/llvm/lib/Target/DirectX/DXContainerGlobals.cpp
@@ -187,7 +187,7 @@ void DXContainerGlobals::addResourcesForPSV(Module &M, PSVRuntimeInfo &PSV) {
       getAnalysis<DXILResourceTypeWrapperPass>().getResourceTypeMap();
 
   auto MakeBinding =
-      [](const dxil::ResourceBindingInfo::ResourceBinding &Binding,
+      [](const dxil::ResourceInfo::ResourceBinding &Binding,
          const dxbc::PSV::ResourceType Type, const dxil::ResourceKind Kind,
          const dxbc::PSV::ResourceFlags Flags = dxbc::PSV::ResourceFlags()) {
         dxbc::PSV::v2::ResourceBindInfo BindInfo;
@@ -200,24 +200,21 @@ void DXContainerGlobals::addResourcesForPSV(Module &M, PSVRuntimeInfo &PSV) {
         return BindInfo;
       };
 
-  for (const dxil::ResourceBindingInfo &RBI : DBM.cbuffers()) {
-    const dxil::ResourceBindingInfo::ResourceBinding &Binding =
-        RBI.getBinding();
+  for (const dxil::ResourceInfo &RI : DBM.cbuffers()) {
+    const dxil::ResourceInfo::ResourceBinding &Binding = RI.getBinding();
     PSV.Resources.push_back(MakeBinding(Binding, dxbc::PSV::ResourceType::CBV,
                                         dxil::ResourceKind::CBuffer));
   }
-  for (const dxil::ResourceBindingInfo &RBI : DBM.samplers()) {
-    const dxil::ResourceBindingInfo::ResourceBinding &Binding =
-        RBI.getBinding();
+  for (const dxil::ResourceInfo &RI : DBM.samplers()) {
+    const dxil::ResourceInfo::ResourceBinding &Binding = RI.getBinding();
     PSV.Resources.push_back(MakeBinding(Binding,
                                         dxbc::PSV::ResourceType::Sampler,
                                         dxil::ResourceKind::Sampler));
   }
-  for (const dxil::ResourceBindingInfo &RBI : DBM.srvs()) {
-    const dxil::ResourceBindingInfo::ResourceBinding &Binding =
-        RBI.getBinding();
+  for (const dxil::ResourceInfo &RI : DBM.srvs()) {
+    const dxil::ResourceInfo::ResourceBinding &Binding = RI.getBinding();
 
-    dxil::ResourceTypeInfo &TypeInfo = DRTM[RBI.getHandleTy()];
+    dxil::ResourceTypeInfo &TypeInfo = DRTM[RI.getHandleTy()];
     dxbc::PSV::ResourceType ResType;
     if (TypeInfo.isStruct())
       ResType = dxbc::PSV::ResourceType::SRVStructured;
@@ -229,11 +226,10 @@ void DXContainerGlobals::addResourcesForPSV(Module &M, PSVRuntimeInfo &PSV) {
     PSV.Resources.push_back(
         MakeBinding(Binding, ResType, TypeInfo.getResourceKind()));
   }
-  for (const dxil::ResourceBindingInfo &RBI : DBM.uavs()) {
-    const dxil::ResourceBindingInfo::ResourceBinding &Binding =
-        RBI.getBinding();
+  for (const dxil::ResourceInfo &RI : DBM.uavs()) {
+    const dxil::ResourceInfo::ResourceBinding &Binding = RI.getBinding();
 
-    dxil::ResourceTypeInfo &TypeInfo = DRTM[RBI.getHandleTy()];
+    dxil::ResourceTypeInfo &TypeInfo = DRTM[RI.getHandleTy()];
     dxbc::PSV::ResourceType ResType;
     if (TypeInfo.getUAV().HasCounter)
       ResType = dxbc::PSV::ResourceType::UAVStructuredWithCounter;
diff --git a/llvm/lib/Target/DirectX/DXILOpLowering.cpp b/llvm/lib/Target/DirectX/DXILOpLowering.cpp
index dff9f3e03079e..096157e6b90e9 100644
--- a/llvm/lib/Target/DirectX/DXILOpLowering.cpp
+++ b/llvm/lib/Target/DirectX/DXILOpLowering.cpp
@@ -268,7 +268,7 @@ class OpLowerer {
 
       auto *It = DBM.find(CI);
       assert(It != DBM.end() && "Resource not in map?");
-      dxil::ResourceBindingInfo &RI = *It;
+      dxil::ResourceInfo &RI = *It;
 
       const auto &Binding = RI.getBinding();
       dxil::ResourceClass RC = DRTM[RI.getHandleTy()].getResourceClass();
@@ -306,7 +306,7 @@ class OpLowerer {
 
       auto *It = DBM.find(CI);
       assert(It != DBM.end() && "Resource not in map?");
-      dxil::ResourceBindingInfo &RI = *It;
+      dxil::ResourceInfo &RI = *It;
 
       const auto &Binding = RI.getBinding();
       dxil::ResourceTypeInfo &RTI = DRTM[RI.getHandleTy()];
@@ -355,7 +355,7 @@ class OpLowerer {
 
   /// Lower `dx.resource.handlefrombinding` intrinsics depending on the shader
   /// model and taking into account binding information from
-  /// DXILResourceBindingAnalysis.
+  /// DXILResourceAnalysis.
   bool lowerHandleFromBinding(Function &F) {
     const Triple &TT = M.getTargetTriple();
     if (TT.getDXILVersion() < VersionTuple(1, 6))
@@ -856,14 +856,14 @@ class OpLowerer {
 } // namespace
 
 PreservedAnalyses DXILOpLowering::run(Module &M, ModuleAnalysisManager &MAM) {
-  DXILBindingMap &DBM = MAM.getResult<DXILResourceBindingAnalysis>(M);
+  DXILBindingMap &DBM = MAM.getResult<DXILResourceAnalysis>(M);
   DXILResourceTypeMap &DRTM = MAM.getResult<DXILResourceTypeAnalysis>(M);
 
   bool MadeChanges = OpLowerer(M, DBM, DRTM).lowerIntrinsics();
   if (!MadeChanges)
     return PreservedAnalyses::all();
   PreservedAnalyses PA;
-  PA.preserve<DXILResourceBindingAnalysis>();
+  PA.preserve<DXILResourceAnalysis>();
   PA.preserve<DXILMetadataAnalysis>();
   PA.preserve<ShaderFlagsAnalysis>();
   return PA;
diff --git a/llvm/lib/Target/DirectX/DXILPrettyPrinter.cpp b/llvm/lib/Target/DirectX/DXILPrettyPrinter.cpp
index 4d1832f44bb63..2c0c2d4ae39f9 100644
--- a/llvm/lib/Target/DirectX/DXILPrettyPrinter.cpp
+++ b/llvm/lib/Target/DirectX/DXILPrettyPrinter.cpp
@@ -174,12 +174,12 @@ struct FormatResourceDimension
 };
 
 struct FormatBindingID
-    : public llvm::FormatAdapter<const dxil::ResourceBindingInfo &> {
+    : public llvm::FormatAdapter<const dxil::ResourceInfo &> {
   dxil::ResourceClass RC;
 
-  explicit FormatBindingID(const dxil::ResourceBindingInfo &RBI,
+  explicit FormatBindingID(const dxil::ResourceInfo &RI,
                            const dxil::ResourceTypeInfo &RTI)
-      : llvm::FormatAdapter<const dxil::ResourceBindingInfo &>(RBI),
+      : llvm::FormatAdapter<const dxil::ResourceInfo &>(RI),
         RC(RTI.getResourceClass()) {}
 
   void format(llvm::raw_ostream &OS, StringRef Style) override {
@@ -188,12 +188,12 @@ struct FormatBindingID
 };
 
 struct FormatBindingLocation
-    : public llvm::FormatAdapter<const dxil::ResourceBindingInfo &> {
+    : public llvm::FormatAdapter<const dxil::ResourceInfo &> {
   dxil::ResourceClass RC;
 
-  explicit FormatBindingLocation(const dxil::ResourceBindingInfo &RBI,
+  explicit...
[truncated]

@@ -22,7 +22,7 @@ MODULE_ANALYSIS("callgraph", CallGraphAnalysis())
MODULE_ANALYSIS("collector-metadata", CollectorMetadataAnalysis())
MODULE_ANALYSIS("ctx-prof-analysis", CtxProfAnalysis())
MODULE_ANALYSIS("dxil-metadata", DXILMetadataAnalysis())
MODULE_ANALYSIS("dxil-resource-binding", DXILResourceBindingAnalysis())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure that it matters but it could be argued that this change invalidates the NFC status of this PR.

It technically changes the CLI API for the shader compiler but only for explicitly listing the pass names.

Copy link
Member

@hekota hekota left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! The only nit I have it whether the pass name dxil-resource should be dxil-resources. I'll leave that up to you.

Copy link
Contributor

@Icohedron Icohedron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me.

@V-FEXrt V-FEXrt merged commit e3369a8 into llvm:main Apr 4, 2025
12 checks passed
@V-FEXrt V-FEXrt deleted the resource-rename branch April 4, 2025 22:51
@damyanp damyanp moved this to Closed in HLSL Support Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

4 participants