This is an archive of the discontinued LLVM Phabricator instance.

[mlir][DeclarativeParser] Add support for attributes with buildable types.
ClosedPublic

Authored by rriddle on Feb 7 2020, 10:38 PM.

Details

Summary

This revision adds support in the declarative assembly form for printing attributes with buildable types without the type.

Diff Detail

Event Timeline

rriddle created this revision.Feb 7 2020, 10:38 PM
rriddle updated this revision to Diff 243348.Feb 7 2020, 10:51 PM

Update handling of elements attrs.

antiagainst requested changes to this revision.Feb 8 2020, 7:05 AM

It seems the parsers/printers modified in this patch does not use the attribute-type-ellison feature introduced in this patch? Can we touch parsers/printers really uses this feature? Also should we document this? Otherwise it's subtle behavior users might find very confusing. (The modifications to parsers/printers in this patch can be split out.)

mlir/include/mlir/IR/OpBase.td
632

Let's put some comments here as for what this field mean and what it's used for. We already have storageType, returnType. It can be quite confusing for somebody reading the code later. ;)

690

We removed the BuildType requirement but mentioned it in the comment?

1237

Should we also pass this through other attribute "decorators" like OptionalAttr and defaultValuedAttr?

mlir/lib/IR/AsmPrinter.cpp
863

Nit: double space before parser. ;)

This revision now requires changes to proceed.Feb 8 2020, 7:05 AM
rriddle updated this revision to Diff 243381.Feb 8 2020, 10:01 AM
rriddle marked 5 inline comments as done.

Resolve comments

It seems the parsers/printers modified in this patch does not use the attribute-type-ellison feature introduced in this patch? Can we touch parsers/printers really uses this feature?

Oops, got carried away late at night and forgot to split. Thanks for the catch!

mlir/include/mlir/IR/OpBase.td
690

An early revision reworked buildable types to be usable/settable outside of the BuildableType class. Changing BuildableType -> Type just allows for more buildable types to be used.

rriddle edited the summary of this revision. (Show Details)Feb 8 2020, 10:33 AM
antiagainst accepted this revision.Feb 8 2020, 3:11 PM
This revision is now accepted and ready to land.Feb 8 2020, 3:11 PM
This revision was automatically updated to reflect the committed changes.

Nice, thanks