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

Sandeep Dasgupta llvmlistbot at llvm.org
Wed Jun 5 11:23:35 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.")
+      .def(
+          "erase_arguments",
+          [](PyBlock &self, unsigned start, unsigned num) {
+            return mlirBlockEraseArguments(self.get(), start, num);
+          },
+          "Erases 'num' arguments from the index 'start'.")
----------------
sdasgup3 wrote:

makes sense to me. I added that just for covering  all the arg erase APIs. I agree that let keep the minimal set for now. 

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


More information about the Mlir-commits mailing list