[Mlir-commits] [mlir] [MLIR][Python] Add python bindings for IRDL dialect (PR #158488)

Rolf Morel llvmlistbot at llvm.org
Wed Sep 17 04:16:36 PDT 2025


================
@@ -0,0 +1,74 @@
+#  Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+#  See https://llvm.org/LICENSE.txt for license information.
+#  SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+from ._irdl_ops_gen import *
+from ._irdl_ops_gen import _Dialect
+from ._irdl_enum_gen import *
+from .._mlir_libs._mlirDialectsIRDL import *
+from ..ir import register_attribute_builder
+from ._ods_common import (
+    get_op_result_or_value as _get_value,
+    get_op_results_or_values as _get_values,
+    _cext as _ods_cext,
+)
+from ..extras.meta import region_op
+
+
+ at _ods_cext.register_operation(_Dialect, replace=True)
+class DialectOp(DialectOp):
+    """Specialization for the dialect op class."""
+
+    def __init__(self, sym_name, *, loc=None, ip=None):
+        super().__init__(sym_name, loc=loc, ip=ip)
+        self.regions[0].blocks.append()
+
+    @property
+    def body(self):
----------------
rolfmorel wrote:

Nit: we could add the return type on the method, i.e. `-> Block`. Don't think we do this generally on these helper methods, but would be good to work towards that.

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


More information about the Mlir-commits mailing list