This is an archive of the discontinued LLVM Phabricator instance.

Add python bindings for Type and IntegerType.
ClosedPublic

Authored by stellaraccident on Aug 18 2020, 5:27 PM.

Details

Summary
  • 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.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptAug 18 2020, 5:27 PM
stellaraccident requested review of this revision.Aug 18 2020, 5:27 PM
ftynse accepted this revision.Aug 19 2020, 6:57 AM
ftynse added inline comments.
mlir/lib/Bindings/Python/IRModules.cpp
15

We usually avoid this in MLIR code. Many useful containers are re-exported in the mlir namespace.

100

Could we also document bindDerived ?

This revision is now accepted and ready to land.Aug 19 2020, 6:57 AM
stellaraccident marked 2 inline comments as done.Aug 19 2020, 9:21 AM

Address comments.

This revision was landed with ongoing or failed builds.Aug 19 2020, 9:24 AM
This revision was automatically updated to reflect the committed changes.