[mlir][python] Extend C/Python API to be usable for CFG construction.
authorStella Laurenzo <stellaraccident@gmail.com>
Sun, 29 Aug 2021 03:15:51 +0000 (20:15 -0700)
committerStella Laurenzo <stellaraccident@gmail.com>
Mon, 30 Aug 2021 15:28:00 +0000 (08:28 -0700)
commit8e6c55c92c807ad77106298d9b7eaf453407d009
tree1b341f0e7a4150da7ec3a0035647276f1eafb2b3
parent57b46056b9435b52028fd96bed43f562be1705fd
[mlir][python] Extend C/Python API to be usable for CFG construction.

* It is pretty clear that no one has tried this yet since it was both incomplete and broken.
* Fixes a symbol hiding issues keeping even the generic builder from constructing an operation with successors.
* Adds ODS support for successors.
* Adds CAPI `mlirBlockGetParentRegion`, `mlirRegionEqual` + tests (and missing test for `mlirBlockGetParentOperation`).
* Adds Python property: `Block.region`.
* Adds Python methods: `Block.create_before` and `Block.create_after`.
* Adds Python property: `InsertionPoint.block`.
* Adds new blocks.py test to verify a plausible CFG construction case.

Differential Revision: https://reviews.llvm.org/D108898
mlir/include/mlir-c/IR.h
mlir/lib/Bindings/Python/IRCore.cpp
mlir/lib/CAPI/IR/IR.cpp
mlir/test/CAPI/ir.c
mlir/test/mlir-tblgen/op-python-bindings.td
mlir/test/python/ir/blocks.py [new file with mode: 0644]
mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp