[mlir][CAPI] Add a simple MlirOpOperand API for MlirValue uses.
This allows basic IR traversal via the C API, which is useful for analyses in languages other than C++. This starts by defining an MlirOpOperand struct to encapsulate a pair of an owner operation and an operand number. A new API is added for MlirValue, to return the first use of the Value as an MlirOpOperand, or a "null" MlirOpOperand if there are no uses. A couple APIs are added for MlirOpOperand. The first checks if an MlirOpOperand is "null", by checking if its owner's pointer is null. The second supports iteration along the use-def lists by accepting an MlirOpOperand and returning the next use of the Value as another MlirOpOperand, or a "null" MlirOpOperand if there are no more uses. Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D139596
Loading
Please sign in to comment