This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Add support for generating Attribute classes for ODS
ClosedPublic

Authored by rriddle on Feb 26 2021, 3:16 PM.

Details

Summary

The support for attributes closely maps that of Types (basically 1-1) given that Attributes are defined in exactly the same way as Types. All of the current ODS TypeDef classes get an Attr equivalent. The generation of the attribute classes themselves share the same generator as types.

Diff Detail

Event Timeline

rriddle created this revision.Feb 26 2021, 3:16 PM
rriddle requested review of this revision.Feb 26 2021, 3:16 PM
jpienaar added inline comments.Feb 26 2021, 4:16 PM
mlir/include/mlir/IR/OpBase.td
2680

Why not use TypeParameter alias from above?

rriddle added inline comments.Mar 2 2021, 2:02 PM
mlir/include/mlir/IR/OpBase.td
2680

All of these parameter types apply equally to both AttrDef and TypeDef instances, so I didn't want to give an impression that they were specific to one of them and not the other.

mehdi_amini accepted this revision.Mar 3 2021, 1:55 PM
mehdi_amini added inline comments.
mlir/test/mlir-tblgen/attrdefs.td
45

attribute?

46

attribute?

This revision is now accepted and ready to land.Mar 3 2021, 1:55 PM
This revision was landed with ongoing or failed builds.Mar 3 2021, 4:48 PM
This revision was automatically updated to reflect the committed changes.
rriddle marked 3 inline comments as done.
mlir/tools/mlir-tblgen/OpDocGen.cpp