CAPI and Python Bindings Support for Value uses

I’d like to write a Python utility that traverses def-use chains. Looking at the CAPI and Python bindings, it appears that there are no CAPI methods to traverse uses of a Value. Is there any concern with adding this, or is it just a case of no one asked for it so no one implemented it?

I can’t guarantee a timeline, but this is something I’d be happy to add. I imagine at the CAPI level, I could add a wrapper like MlirOpOperand, and the basic APIs like getting a list of these from an MlirValue, querying operand index, etc. Then in Python bindings, I’d add a PyOpOperand class that uses the new CAPIs.

I don’t think there was any reason to omit this – it just wasn’t done. Contributions welcome.

1 Like