From: John Demme Date: Thu, 19 Aug 2021 07:02:09 +0000 (-0700) Subject: [MLIR] [Python] Add `owner` to `mlir.ir.Block` X-Git-Tag: upstream/15.0.7~33539 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=96fbd5cd5e442bd01172d0d4491a2ef19876621f;p=platform%2Fupstream%2Fllvm.git [MLIR] [Python] Add `owner` to `mlir.ir.Block` Provides a way for python users to access the owning Operation from a Block. --- diff --git a/mlir/lib/Bindings/Python/IRCore.cpp b/mlir/lib/Bindings/Python/IRCore.cpp index 3e927ce..d6305e7 100644 --- a/mlir/lib/Bindings/Python/IRCore.cpp +++ b/mlir/lib/Bindings/Python/IRCore.cpp @@ -2201,6 +2201,12 @@ void mlir::python::populateIRCore(py::module &m) { //---------------------------------------------------------------------------- py::class_(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) { return PyBlockArgumentList(self.getParentOperation(), self.get());