[Mlir-commits] [mlir] [mlir][c] Expose AsmState. (PR #66693)

Jacques Pienaar llvmlistbot at llvm.org
Mon Sep 18 17:47:54 PDT 2023


================
@@ -819,6 +837,11 @@ MLIR_CAPI_EXPORTED void mlirValuePrintAsOperand(MlirValue value,
                                                 MlirStringCallback callback,
                                                 void *userData);
 
+/// Prints a value as an operand (i.e., the ValueID) using prepopulated state.
+MLIR_CAPI_EXPORTED void
----------------
jpienaar wrote:

I went the other way: I made this the call signature and made it easier to construct the original using building blocks.

AsmState usage here subsumes OpPrintingFlags one and allows for much more efficient printing (avoiding the quadratic behavior if one walks & prints and ends up recreating the state over and over). Also makes it much clearer that there is a cost rather then hiding it. I had to add one helper to do so and changed the corresponding Python interface. I think probably all of the other print ones should be similarly changed, but wanted to check this change first.

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


More information about the Mlir-commits mailing list