[Mlir-commits] [mlir] [mlir][python]Python Bindings for select edit operations on Block arguments (PR #94305)

Maksim Levental llvmlistbot at llvm.org
Tue Jun 4 16:37:10 PDT 2024


================
@@ -3238,6 +3238,25 @@ void mlir::python::populateIRCore(py::module &m) {
             return PyBlockArgumentList(self.getParentOperation(), self.get());
           },
           "Returns a list of block arguments.")
+      .def(
+          "add_argument",
+          [](PyBlock &self, const PyType &type, const PyLocation &loc) {
+            return mlirBlockAddArgument(self.get(), type, loc);
+          },
+          "Append an argument of the specified type to the block and returns "
+          "the newly added argument.")
+      .def(
+          "erase_argument",
+          [](PyBlock &self, unsigned index) {
+            return mlirBlockEraseArgument(self.get(), index);
+          },
+          "Erase the argument at 'index' and remove it from the argument list.")
----------------
makslevental wrote:

nit: This sounds like it actually erases the value but it doesn't right? It just removes from the argument list? If so, can you actually change the comment to say "but does not erase the value" or something like that.

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


More information about the Mlir-commits mailing list