This is an archive of the discontinued LLVM Phabricator instance.

[mlir] python enum bindings generator
ClosedPublic

Authored by ftynse on Jul 28 2023, 9:07 AM.

Details

Summary

Add an ODS (tablegen) backend to generate Python enum classes and
attribute builders for enum attributes defined in ODS. This will allow
us to keep the enum attribute definitions in sync between C++ and
Python, as opposed to handwritten enum classes in Python that may end up
using mismatching values. This also makes autogenerated bindings more
convenient even in absence of mixins.

Use this backend for the transform dialect failure propagation mode enum
attribute as demonstration.

Diff Detail

Event Timeline

ftynse created this revision.Jul 28 2023, 9:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 28 2023, 9:07 AM
ftynse requested review of this revision.Jul 28 2023, 9:07 AM
ingomueller-net accepted this revision.Jul 31 2023, 2:59 AM

Oh, soo good! I should learn the tblgen internals more to be able to add these things ;) LGTM!

This revision is now accepted and ready to land.Jul 31 2023, 2:59 AM
This revision was automatically updated to reflect the committed changes.