@@ -450,12 +450,7 @@ void ResourceTypeInfo::print(raw_ostream &OS, const DataLayout &DL) const {
450450}
451451
452452MDTuple *ResourceBindingInfo::getAsMetadata (Module &M,
453- DXILResourceTypeMap &DRTM) const {
454- return getAsMetadata (M, DRTM[getHandleTy ()]);
455- }
456-
457- MDTuple *ResourceBindingInfo::getAsMetadata (Module &M,
458- dxil::ResourceTypeInfo RTI) const {
453+ dxil::ResourceTypeInfo &RTI) const {
459454 LLVMContext &Ctx = M.getContext ();
460455 const DataLayout &DL = M.getDataLayout ();
461456
@@ -529,13 +524,7 @@ MDTuple *ResourceBindingInfo::getAsMetadata(Module &M,
529524
530525std::pair<uint32_t , uint32_t >
531526ResourceBindingInfo::getAnnotateProps (Module &M,
532- DXILResourceTypeMap &DRTM) const {
533- return getAnnotateProps (M, DRTM[getHandleTy ()]);
534- }
535-
536- std::pair<uint32_t , uint32_t >
537- ResourceBindingInfo::getAnnotateProps (Module &M,
538- dxil::ResourceTypeInfo RTI) const {
527+ dxil::ResourceTypeInfo &RTI) const {
539528 const DataLayout &DL = M.getDataLayout ();
540529
541530 uint32_t ResourceKind = llvm::to_underlying (RTI.getResourceKind ());
@@ -582,12 +571,7 @@ ResourceBindingInfo::getAnnotateProps(Module &M,
582571 return {Word0, Word1};
583572}
584573
585- void ResourceBindingInfo::print (raw_ostream &OS, DXILResourceTypeMap &DRTM,
586- const DataLayout &DL) const {
587- print (OS, DRTM[getHandleTy ()], DL);
588- }
589-
590- void ResourceBindingInfo::print (raw_ostream &OS, dxil::ResourceTypeInfo RTI,
574+ void ResourceBindingInfo::print (raw_ostream &OS, dxil::ResourceTypeInfo &RTI,
591575 const DataLayout &DL) const {
592576 OS << " Binding:\n "
593577 << " Record ID: " << Binding.RecordID << " \n "
@@ -623,7 +607,7 @@ void DXILBindingMap::populate(Module &M, DXILResourceTypeMap &DRTM) {
623607 continue ;
624608 case Intrinsic::dx_handle_fromBinding: {
625609 auto *HandleTy = cast<TargetExtType>(F.getReturnType ());
626- ResourceTypeInfo RTI = DRTM[HandleTy];
610+ ResourceTypeInfo & RTI = DRTM[HandleTy];
627611
628612 for (User *U : F.users ())
629613 if (CallInst *CI = dyn_cast<CallInst>(U)) {
@@ -667,7 +651,7 @@ void DXILBindingMap::populate(Module &M, DXILResourceTypeMap &DRTM) {
667651 uint32_t NextID = 0 ;
668652 for (unsigned I = 0 , E = Size; I != E; ++I) {
669653 ResourceBindingInfo &RBI = Infos[I];
670- ResourceTypeInfo RTI = DRTM[RBI.getHandleTy ()];
654+ ResourceTypeInfo & RTI = DRTM[RBI.getHandleTy ()];
671655 if (RTI.isUAV () && FirstUAV == Size) {
672656 FirstUAV = I;
673657 NextID = 0 ;
@@ -688,7 +672,8 @@ void DXILBindingMap::print(raw_ostream &OS, DXILResourceTypeMap &DRTM,
688672 const DataLayout &DL) const {
689673 for (unsigned I = 0 , E = Infos.size (); I != E; ++I) {
690674 OS << " Binding " << I << " :\n " ;
691- Infos[I].print (OS, DRTM, DL);
675+ const dxil::ResourceBindingInfo &RBI = Infos[I];
676+ RBI.print (OS, DRTM[RBI.getHandleTy ()], DL);
692677 OS << " \n " ;
693678 }
694679
0 commit comments