[Mlir-commits] [mlir] [MLIR][Python] Impl XOpInterface(s) from Python, with X=Transform and X=MemoryEffects (PR #176920)

Rolf Morel llvmlistbot at llvm.org
Mon Feb 2 07:41:16 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:

> How about OpOperandNumberList or OpOperandIndexList?
Both seem to emphasize indexing, right?

In terms of prior art, I will just point to the 52 occurrences of `op->getOpOperands()` in the codebase. Also to the brilliantly named `OperandRangeRange` (which is indeed a range of `OperandRange`s, though interestingly `OperandRange`s only range over the contained `Value`s), as an example of repeating yourself to describe appropriately describe a type.

TBF, I would not object to introducing something named `OpOpOpOperand` in the Python codebase if this mirrored an `OpOpOperand` in the C++ codebase. That might just be me though.

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


More information about the Mlir-commits mailing list