Add basic Python bindings for the PassManager and bind libTransforms
authorMehdi Amini <joker.eph@gmail.com>
Tue, 10 Nov 2020 18:39:12 +0000 (18:39 +0000)
committerMehdi Amini <joker.eph@gmail.com>
Tue, 10 Nov 2020 19:55:21 +0000 (19:55 +0000)
commitdc43f78565491471604103715cc4329abfca0f6d
treea4719a706ad0dcddabe977f575a9e479b4d8a65c
parent3073cbd2d4c26f8c17c827524c9b7b73fcb2dce7
Add basic Python bindings for the PassManager and bind libTransforms

This only exposes the ability to round-trip a textual pipeline at the
moment.
To exercise it, we also bind the libTransforms in a new Python extension. This
does not include any interesting bindings, but it includes all the
mechanism to add separate native extensions and load them dynamically.
As such passes in libTransforms are only registered after `import
mlir.transforms`.
To support this global registration, the TableGen backend is also
extended to bind to the C API the group registration for passes.

Reviewed By: stellaraccident

Differential Revision: https://reviews.llvm.org/D90819
12 files changed:
mlir/lib/Bindings/Python/CMakeLists.txt
mlir/lib/Bindings/Python/MainModule.cpp
mlir/lib/Bindings/Python/Pass.cpp [new file with mode: 0644]
mlir/lib/Bindings/Python/Pass.h [new file with mode: 0644]
mlir/lib/Bindings/Python/Transforms/CMakeLists.txt [new file with mode: 0644]
mlir/lib/Bindings/Python/Transforms/Transforms.cpp [new file with mode: 0644]
mlir/lib/Bindings/Python/mlir/__init__.py
mlir/lib/Bindings/Python/mlir/passmanager.py [new file with mode: 0644]
mlir/lib/Bindings/Python/mlir/transforms/__init__.py [new file with mode: 0644]
mlir/test/Bindings/Python/pass_manager.py [new file with mode: 0644]
mlir/test/CMakeLists.txt
mlir/tools/mlir-tblgen/PassCAPIGen.cpp