[MLIR] [Python] Add owner to mlir.ir.Block

Provides a way for python users to access the owning Operation from a Block.
This commit is contained in:
John Demme
2021-08-19 00:02:09 -07:00
parent 234c4d2362
commit 96fbd5cd5e

View File

@@ -2200,6 +2200,12 @@ void mlir::python::populateIRCore(py::module &m) {
// Mapping of PyBlock.
//----------------------------------------------------------------------------
py::class_<PyBlock>(m, "Block")
.def_property_readonly(
"owner",
[](PyBlock &self) {
return self.getParentOperation()->createOpView();
},
"Returns the owning operation of this block.")
.def_property_readonly(
"arguments",
[](PyBlock &self) {