@@ -531,17 +531,17 @@ void ResourceTypeInfo::print(raw_ostream &OS, const DataLayout &DL) const {
531531 }
532532}
533533
534- GlobalVariable *ResourceBindingInfo ::createSymbol (Module &M, StructType *Ty,
535- StringRef Name) {
534+ GlobalVariable *ResourceInfo ::createSymbol (Module &M, StructType *Ty,
535+ StringRef Name) {
536536 assert (!Symbol && " Symbol has already been created" );
537537 Symbol = new GlobalVariable (M, Ty, /* isConstant=*/ true ,
538538 GlobalValue::ExternalLinkage,
539539 /* Initializer=*/ nullptr , Name);
540540 return Symbol;
541541}
542542
543- MDTuple *ResourceBindingInfo ::getAsMetadata (Module &M,
544- dxil::ResourceTypeInfo &RTI) const {
543+ MDTuple *ResourceInfo ::getAsMetadata (Module &M,
544+ dxil::ResourceTypeInfo &RTI) const {
545545 LLVMContext &Ctx = M.getContext ();
546546 const DataLayout &DL = M.getDataLayout ();
547547
@@ -610,8 +610,7 @@ MDTuple *ResourceBindingInfo::getAsMetadata(Module &M,
610610}
611611
612612std::pair<uint32_t , uint32_t >
613- ResourceBindingInfo::getAnnotateProps (Module &M,
614- dxil::ResourceTypeInfo &RTI) const {
613+ ResourceInfo::getAnnotateProps (Module &M, dxil::ResourceTypeInfo &RTI) const {
615614 const DataLayout &DL = M.getDataLayout ();
616615
617616 uint32_t ResourceKind = llvm::to_underlying (RTI.getResourceKind ());
@@ -658,8 +657,8 @@ ResourceBindingInfo::getAnnotateProps(Module &M,
658657 return {Word0, Word1};
659658}
660659
661- void ResourceBindingInfo ::print (raw_ostream &OS, dxil::ResourceTypeInfo &RTI,
662- const DataLayout &DL) const {
660+ void ResourceInfo ::print (raw_ostream &OS, dxil::ResourceTypeInfo &RTI,
661+ const DataLayout &DL) const {
663662 if (Symbol) {
664663 OS << " Symbol: " ;
665664 Symbol->printAsOperand (OS);
@@ -687,8 +686,7 @@ bool DXILResourceTypeMap::invalidate(Module &M, const PreservedAnalyses &PA,
687686// ===----------------------------------------------------------------------===//
688687
689688void DXILBindingMap::populate (Module &M, DXILResourceTypeMap &DRTM) {
690- SmallVector<std::tuple<CallInst *, ResourceBindingInfo, ResourceTypeInfo>>
691- CIToInfos;
689+ SmallVector<std::tuple<CallInst *, ResourceInfo, ResourceTypeInfo>> CIToInfos;
692690
693691 for (Function &F : M.functions ()) {
694692 if (!F.isDeclaration ())
@@ -711,10 +709,10 @@ void DXILBindingMap::populate(Module &M, DXILResourceTypeMap &DRTM) {
711709 cast<ConstantInt>(CI->getArgOperand (1 ))->getZExtValue ();
712710 uint32_t Size =
713711 cast<ConstantInt>(CI->getArgOperand (2 ))->getZExtValue ();
714- ResourceBindingInfo RBI = ResourceBindingInfo{
715- /* RecordID=*/ 0 , Space, LowerBound, Size, HandleTy};
712+ ResourceInfo RI =
713+ ResourceInfo{ /* RecordID=*/ 0 , Space, LowerBound, Size, HandleTy};
716714
717- CIToInfos.emplace_back (CI, RBI , RTI);
715+ CIToInfos.emplace_back (CI, RI , RTI);
718716 }
719717
720718 break ;
@@ -723,18 +721,18 @@ void DXILBindingMap::populate(Module &M, DXILResourceTypeMap &DRTM) {
723721 }
724722
725723 llvm::stable_sort (CIToInfos, [](auto &LHS, auto &RHS) {
726- const auto &[LCI, LRBI , LRTI] = LHS;
727- const auto &[RCI, RRBI , RRTI] = RHS;
724+ const auto &[LCI, LRI , LRTI] = LHS;
725+ const auto &[RCI, RRI , RRTI] = RHS;
728726 // Sort by resource class first for grouping purposes, and then by the
729727 // binding and type so we can remove duplicates.
730728 ResourceClass LRC = LRTI.getResourceClass ();
731729 ResourceClass RRC = RRTI.getResourceClass ();
732730
733- return std::tie (LRC, LRBI , LRTI) < std::tie (RRC, RRBI , RRTI);
731+ return std::tie (LRC, LRI , LRTI) < std::tie (RRC, RRI , RRTI);
734732 });
735- for (auto [CI, RBI , RTI] : CIToInfos) {
736- if (Infos.empty () || RBI != Infos.back ())
737- Infos.push_back (RBI );
733+ for (auto [CI, RI , RTI] : CIToInfos) {
734+ if (Infos.empty () || RI != Infos.back ())
735+ Infos.push_back (RI );
738736 CallMap[CI] = Infos.size () - 1 ;
739737 }
740738
@@ -743,8 +741,8 @@ void DXILBindingMap::populate(Module &M, DXILResourceTypeMap &DRTM) {
743741 FirstUAV = FirstCBuffer = FirstSampler = Size;
744742 uint32_t NextID = 0 ;
745743 for (unsigned I = 0 , E = Size; I != E; ++I) {
746- ResourceBindingInfo &RBI = Infos[I];
747- ResourceTypeInfo &RTI = DRTM[RBI .getHandleTy ()];
744+ ResourceInfo &RI = Infos[I];
745+ ResourceTypeInfo &RTI = DRTM[RI .getHandleTy ()];
748746 if (RTI.isUAV () && FirstUAV == Size) {
749747 FirstUAV = I;
750748 NextID = 0 ;
@@ -762,16 +760,16 @@ void DXILBindingMap::populate(Module &M, DXILResourceTypeMap &DRTM) {
762760 FirstUAV = std::min ({FirstUAV, FirstCBuffer});
763761
764762 // Adjust the resource binding to use the next ID.
765- RBI .setBindingID (NextID++);
763+ RI .setBindingID (NextID++);
766764 }
767765}
768766
769767void DXILBindingMap::print (raw_ostream &OS, DXILResourceTypeMap &DRTM,
770768 const DataLayout &DL) const {
771769 for (unsigned I = 0 , E = Infos.size (); I != E; ++I) {
772770 OS << " Binding " << I << " :\n " ;
773- const dxil::ResourceBindingInfo &RBI = Infos[I];
774- RBI .print (OS, DRTM[RBI .getHandleTy ()], DL);
771+ const dxil::ResourceInfo &RI = Infos[I];
772+ RI .print (OS, DRTM[RI .getHandleTy ()], DL);
775773 OS << " \n " ;
776774 }
777775
@@ -782,10 +780,10 @@ void DXILBindingMap::print(raw_ostream &OS, DXILResourceTypeMap &DRTM,
782780 }
783781}
784782
785- SmallVector<dxil::ResourceBindingInfo >
783+ SmallVector<dxil::ResourceInfo >
786784DXILBindingMap::findByUse (const Value *Key) const {
787785 if (const PHINode *Phi = dyn_cast<PHINode>(Key)) {
788- SmallVector<dxil::ResourceBindingInfo > Children;
786+ SmallVector<dxil::ResourceInfo > Children;
789787 for (const Value *V : Phi->operands ()) {
790788 Children.append (findByUse (V));
791789 }
@@ -810,7 +808,7 @@ DXILBindingMap::findByUse(const Value *Key) const {
810808 // Check if any of the parameters are the resource we are following. If so
811809 // keep searching. If none of them are return an empty list
812810 const Type *UseType = CI->getType ();
813- SmallVector<dxil::ResourceBindingInfo > Children;
811+ SmallVector<dxil::ResourceInfo > Children;
814812 for (const Value *V : CI->args ()) {
815813 if (V->getType () != UseType)
816814 continue ;
@@ -824,19 +822,18 @@ DXILBindingMap::findByUse(const Value *Key) const {
824822// ===----------------------------------------------------------------------===//
825823
826824AnalysisKey DXILResourceTypeAnalysis::Key;
827- AnalysisKey DXILResourceBindingAnalysis ::Key;
825+ AnalysisKey DXILResourceAnalysis ::Key;
828826
829- DXILBindingMap DXILResourceBindingAnalysis::run (Module &M,
830- ModuleAnalysisManager &AM) {
827+ DXILBindingMap DXILResourceAnalysis::run (Module &M, ModuleAnalysisManager &AM) {
831828 DXILBindingMap Data;
832829 DXILResourceTypeMap &DRTM = AM.getResult <DXILResourceTypeAnalysis>(M);
833830 Data.populate (M, DRTM);
834831 return Data;
835832}
836833
837- PreservedAnalyses
838- DXILResourceBindingPrinterPass::run (Module &M, ModuleAnalysisManager &AM) {
839- DXILBindingMap &DBM = AM.getResult <DXILResourceBindingAnalysis >(M);
834+ PreservedAnalyses DXILResourcePrinterPass::run (Module &M,
835+ ModuleAnalysisManager &AM) {
836+ DXILBindingMap &DBM = AM.getResult <DXILResourceAnalysis >(M);
840837 DXILResourceTypeMap &DRTM = AM.getResult <DXILResourceTypeAnalysis>(M);
841838
842839 DBM.print (OS, DRTM, M.getDataLayout ());
@@ -895,7 +892,7 @@ LLVM_DUMP_METHOD
895892void DXILResourceBindingWrapperPass::dump () const { print (dbgs (), nullptr ); }
896893#endif
897894
898- INITIALIZE_PASS (DXILResourceBindingWrapperPass, " dxil-resource-binding " ,
895+ INITIALIZE_PASS (DXILResourceBindingWrapperPass, " dxil-resource" ,
899896 " DXIL Resource Binding Analysis" , false , true )
900897char DXILResourceBindingWrapperPass::ID = 0;
901898
0 commit comments