[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:31 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.")
----------------
sdasgup3 wrote:
I can see you point and agree. I actually I borrowed the comment from the corresponding cpp APIs (https://github.com/llvm/llvm-project/blob/539b72f2e15f0d8a74a6c05c7085035040a3a831/mlir/include/mlir/IR/Block.h#L116). I believe the word erase is used there to mean `arguments.erase(index)`, which also looks good to me.
Not sure if we update both and leave them as is.
wdyt?
https://github.com/llvm/llvm-project/pull/94305
More information about the Mlir-commits
mailing list