[Mlir-commits] [mlir] [MLIR][Python] Impl XOpInterface(s) from Python, with X=Transform and X=MemoryEffects (PR #176920)
Rolf Morel
llvmlistbot at llvm.org
Wed Jan 28 05:24:56 PST 2026
================
@@ -2306,6 +2298,44 @@ PyOpOperandList PyOpOperandList::slice(intptr_t startIndex, intptr_t length,
return PyOpOperandList(operation, startIndex, length, step);
}
+/// A list of OpOperands. Internally, these are stored as consecutive elements,
+/// random access is cheap. The (returned) OpOperand list is associated with the
+/// operation whose operands these are, and thus extends the lifetime of this
+/// operation.
+class PyOpOpOperandList : public Sliceable<PyOpOpOperandList, PyOpOperand> {
+public:
+ static constexpr const char *pyClassName = "OpOpOperandList";
----------------
rolfmorel wrote:
Another solution is to make `op.operands` return an iterator of `OpOperand`s (rather than `Value`s). That is a breaking change though. The only way to not make it cause breakage is to make the Python version of `OpOperand` forward all method calls to its contained `Value` (through subclassing or `__getattr__` magic). I don't think we want to go there.
https://github.com/llvm/llvm-project/pull/176920
More information about the Mlir-commits
mailing list