Add python bindings for Type and IntegerType.
authorStella Laurenzo <stellaraccident@gmail.com>
Wed, 19 Aug 2020 00:23:46 +0000 (17:23 -0700)
committerStella Laurenzo <stellaraccident@gmail.com>
Wed, 19 Aug 2020 16:23:44 +0000 (09:23 -0700)
commitd29d1e2ffd61f450b4392d2dab8060e54d040fcf
treedb03edd77eb7c907d87131ba137bea26f6f9b225
parent5e31dd2650ebb39c206780c900035e4eb64b6957
Add python bindings for Type and IntegerType.

* The binding for Type is trivial and should be non-controversial.
* The way that I define the IntegerType should serve as a pattern for what I want to do next.
* I propose defining the rest of the standard types in this fashion and then generalizing for dialect types as necessary.
* Essentially, creating/accessing a concrete Type (vs interacting with the string form) is done by "casting" to the concrete type (i.e. IntegerType can be constructed with a Type and will throw if the cast is illegal).
* This deviates from some of our previous discussions about global objects but I think produces a usable API and we should go this way.

Differential Revision: https://reviews.llvm.org/D86179
mlir/include/mlir-c/IR.h
mlir/lib/Bindings/Python/IRModules.cpp
mlir/lib/Bindings/Python/IRModules.h
mlir/test/Bindings/Python/ir_module.py [moved from mlir/test/Bindings/Python/ir_module_test.py with 79% similarity]
mlir/test/Bindings/Python/ir_types.py [new file with mode: 0644]