[mlir] Support slicing for operands in results in Python bindings
authorAlex Zinenko <zinenko@google.com>
Fri, 6 Nov 2020 14:09:54 +0000 (15:09 +0100)
committerAlex Zinenko <zinenko@google.com>
Tue, 10 Nov 2020 09:46:21 +0000 (10:46 +0100)
commit6c7e6b2c9abddf8b657997053d140ca4554cafbb
tree0e2f2af07eb53e7d01010bee71b97f9efe9762dd
parent71064b02701dd65065dd412fb01afe81ff83f746
[mlir] Support slicing for operands in results in Python bindings

Slicing, that is element access with `[being:end:step]` structure, is
a common Python idiom for sequence-like containers. It is also necessary
to support custom accessor for operations with variadic operands and
results (an operation an return a slice of its operands that correspond
to the given variadic group).

Add generic utility to support slicing in Python bindings and use it
for operation operands and results.

Depends On D90923

Reviewed By: stellaraccident, mehdi_amini

Differential Revision: https://reviews.llvm.org/D90936
mlir/include/mlir-c/IR.h
mlir/lib/Bindings/Python/IRModules.cpp
mlir/lib/Bindings/Python/PybindUtils.h
mlir/lib/CAPI/IR/IR.cpp
mlir/test/Bindings/Python/ir_operation.py