[llvm] [HLSL] Add support to lookup a ResourceBindingInfo from its use (PR #126556)

Ashley Coleman via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 18 11:08:38 PST 2025


================
@@ -770,6 +770,50 @@ void DXILBindingMap::print(raw_ostream &OS, DXILResourceTypeMap &DRTM,
   }
 }
 
+SmallVector<dxil::ResourceBindingInfo>
+DXILBindingMap::findByUse(const Value *Key) const {
----------------
V-FEXrt wrote:

I'm working on a small change to make it a little less restricted, but maybe the name could be improved.

The core idea is given an `llvm::Value*` walk the tree backwards until a `create` call is found. The code that actually needs this API happens to know that `Key` is always a function use somewhere else which means the consumer is influencing the API name :(

I'm more drawn to a name like `findIndirect` or `findCreation` since `findByFunctionUse` doesn't actually mean much different than the original name

https://github.com/llvm/llvm-project/pull/126556


More information about the llvm-commits mailing list