Skip to content
This repository was archived by the owner on Oct 11, 2025. It is now read-only.

Commit 7a6977a

Browse files
authored
[mlir][python]Python Bindings for select edit operations on Block arguments (#94305)
The PR implements MLIR Python Bindings for a few simple edit operations on Block arguments, namely, `add_argument`, `erase_argument`, and `erase_arguments`.
1 parent ed07158 commit 7a6977a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

IRCore.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3238,6 +3238,19 @@ void mlir::python::populateIRCore(py::module &m) {
32383238
return PyBlockArgumentList(self.getParentOperation(), self.get());
32393239
},
32403240
"Returns a list of block arguments.")
3241+
.def(
3242+
"add_argument",
3243+
[](PyBlock &self, const PyType &type, const PyLocation &loc) {
3244+
return mlirBlockAddArgument(self.get(), type, loc);
3245+
},
3246+
"Append an argument of the specified type to the block and returns "
3247+
"the newly added argument.")
3248+
.def(
3249+
"erase_argument",
3250+
[](PyBlock &self, unsigned index) {
3251+
return mlirBlockEraseArgument(self.get(), index);
3252+
},
3253+
"Erase the argument at 'index' and remove it from the argument list.")
32413254
.def_property_readonly(
32423255
"operations",
32433256
[](PyBlock &self) {

0 commit comments

Comments
 (0)