[mlir][python] Support more types in IntegerAttr.value
authorrkayaith <rkayaith@gmail.com>
Thu, 24 Feb 2022 09:21:40 +0000 (10:21 +0100)
committerAlex Zinenko <zinenko@google.com>
Thu, 24 Feb 2022 09:26:31 +0000 (10:26 +0100)
commite9db306dcd53f33b982d772793ffe7326d40c018
treec921ddd2021b15882834970239c9f50b968ad7a1
parentbfb4afee74c8d6e3b1d020564bfe163073f07a04
[mlir][python] Support more types in IntegerAttr.value

Previously only accessing values for `index` and signless int types
would work; signed and unsigned ints would hit an assert in
`IntegerAttr::getInt`. This exposes `IntegerAttr::get{S,U}Int` to the C
API and calls the appropriate function from the python bindings.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D120194
mlir/include/mlir-c/BuiltinAttributes.h
mlir/lib/Bindings/Python/IRAttributes.cpp
mlir/lib/CAPI/IR/BuiltinAttributes.cpp
mlir/test/CAPI/ir.c
mlir/test/python/ir/attributes.py