This is an archive of the discontinued LLVM Phabricator instance.

[mlir][DeclarativeParser] Add support for the TypesMatchWith trait.
ClosedPublic

Authored by rriddle on Feb 14 2020, 1:48 PM.

Details

Summary

This allows for injecting type constraints that are not direct 1-1 mappings, for example when one type is equal to the element type of another. This allows for moving over several more parsers to the declarative form.

Depends On D74647

Diff Detail

Event Timeline

rriddle created this revision.Feb 14 2020, 1:48 PM
rriddle updated this revision to Diff 244852.Feb 15 2020, 11:19 PM

Simplify type operand printing

flaub added a subscriber: flaub.Feb 20 2020, 10:51 AM
antiagainst accepted this revision.Feb 21 2020, 12:01 PM

Nice! Can we also update the doc regarding which traits are supported? Otherwise it's quite obscure for somebody to figure out what works and what not.

mlir/tools/mlir-tblgen/OpFormatGen.cpp
1009

This pair is not trivial and it appears at lots of places. Might be worth it to define a struct to improve readability? Meta-programming is always difficult to understand; string concatenation to generate code too. :)

This revision is now accepted and ready to land.Feb 21 2020, 12:01 PM
rriddle marked an inline comment as done.Feb 21 2020, 12:41 PM

Nice! Can we also update the doc regarding which traits are supported? Otherwise it's quite obscure for somebody to figure out what works and what not.

Yep completely agree, will add all of the currently supported traits in a followup.

rriddle updated this revision to Diff 245970.Feb 21 2020, 1:10 PM

Resolve comments

This revision was automatically updated to reflect the committed changes.