This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Allows to query traits from types and attributes
ClosedPublic

Authored by math-fehr on Jun 30 2021, 9:12 AM.

Details

Summary

Types and attributes now have a hasTrait function that allow users to check
if a type defines a trait.
Also, AbstractType and AbstractAttribute has now a hasTraitFn field to carry
the implementation of the hasTrait function of the concrete type or attribute.
This patch also adds the remaining functions to access type and attribute traits
in TableGen.

Diff Detail

Event Timeline

math-fehr created this revision.Jun 30 2021, 9:12 AM
math-fehr requested review of this revision.Jun 30 2021, 9:12 AM
rriddle accepted this revision.Jun 30 2021, 1:27 PM

Looks great, thanks!

(Could I shamelessly ask you to do the same for attributes?)

This revision is now accepted and ready to land.Jun 30 2021, 1:27 PM
rriddle added inline comments.Jun 30 2021, 1:28 PM
mlir/test/lib/Dialect/Test/TestTraits.h
2

The filename here is off.

mlir/test/lib/Dialect/Test/TestTypes.h
43

This include should be at the top of the file.

math-fehr updated this revision to Diff 356498.Jul 5 2021, 6:54 AM

Address comments, and add support for traits in attributes

math-fehr marked 2 inline comments as done.Jul 5 2021, 6:54 AM
math-fehr retitled this revision from [mlir] Allows to query traits from types to [mlir] Allows to query traits from types and attributes.
math-fehr edited the summary of this revision. (Show Details)

Hey @rriddle, gentle ping on this!

ftynse added a subscriber: ftynse.Sep 12 2021, 12:04 AM

Hi Matthieu,
River is out of office. This patch is approved, do you need help landing it?

Hi Alex!
Yes, would it be possible to land it for me?
Thanks!

This revision was landed with ongoing or failed builds.Sep 12 2021, 11:29 PM
This revision was automatically updated to reflect the committed changes.