Page MenuHomePhabricator

[mlir] Add new SubElementAttr/SubElementType Interfaces

Authored by rriddle on May 21 2021, 2:19 PM.



These interfaces allow for a composite attribute or type to opaquely provide access to any held attributes or types. There are several intended use cases for this interface. The first of which is to allow the printer to create aliases for non-builtin dialect attributes and types. In the future, this interface will also be extended to allow for SymbolRefAttr to be placed on other entities aside from just DictionaryAttr and ArrayAttr.

To limit potential test breakages, this revision only adds the new interfaces to the builtin attributes/types that are currently hardcoded during AsmPrinter alias generation. In a followup the remaining builtin attributes/types, and non-builtin attributes/types can be extended to support it.

Diff Detail

Event Timeline

rriddle created this revision.May 21 2021, 2:19 PM
rriddle requested review of this revision.May 21 2021, 2:19 PM

Could you add a C++ unit test for this?


Why the Impl suffix?

rriddle updated this revision to Diff 349707.Jun 3 2021, 3:21 PM
rriddle marked an inline comment as done.


Could you add a C++ unit test for this?



I wouldn't see this as something generally called by users, given that it only walks one level. Renamed to the more appropriate: walkImmediateSubElements.

jpienaar accepted this revision.Jun 10 2021, 3:59 PM
jpienaar added inline comments.

immediate ?

This revision is now accepted and ready to land.Jun 10 2021, 3:59 PM
This revision was landed with ongoing or failed builds.Jun 10 2021, 5:28 PM
This revision was automatically updated to reflect the committed changes.
rriddle marked an inline comment as done.