[mlir][CAPI][Python] Plumb OpPrintingFlags to C and Python APIs.
authorStella Laurenzo <stellaraccident@gmail.com>
Wed, 21 Oct 2020 06:20:04 +0000 (23:20 -0700)
committerStella Laurenzo <stellaraccident@gmail.com>
Wed, 21 Oct 2020 19:14:06 +0000 (12:14 -0700)
commit74a58ec9c27f48eb26094667156934c6ca9d0012
tree289f62e6e08c9aa2d441d889b67fbc04b6e64da0
parent57b338c08a4942bda6e58c77870c657c53b6fb5b
[mlir][CAPI][Python] Plumb OpPrintingFlags to C and Python APIs.

* Adds a new MlirOpPrintingFlags type and supporting accessors.
* Adds a new mlirOperationPrintWithFlags function.
* Adds a full featured python Operation.print method with all options and the ability to print directly to files/stdout in text or binary.
* Adds an Operation.get_asm which delegates to print and returns a str or bytes.
* Reworks Operation.__str__ to be based on get_asm.

Differential Revision: https://reviews.llvm.org/D89848
mlir/include/mlir-c/IR.h
mlir/include/mlir/CAPI/IR.h
mlir/include/mlir/IR/OperationSupport.h
mlir/lib/Bindings/Python/IRModules.cpp
mlir/lib/Bindings/Python/IRModules.h
mlir/lib/CAPI/IR/IR.cpp
mlir/test/Bindings/Python/ir_operation.py
mlir/test/CAPI/ir.c