[PATCH] D73579: [mlir] Add elementAttr to TypedArrayAttrBase.

Abdurrahman Akkas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 14:06:22 PST 2020


abeakkas created this revision.
Herald added subscribers: llvm-commits, liufengdb, lucyrfox, mgester, arpith-jacob, antiagainst, shauheen, burmako, jpienaar, rriddle, mehdi_amini.
Herald added a reviewer: nicolasvasilache.
Herald added a reviewer: rriddle.
Herald added a project: LLVM.

In code generators, one can automate the translation of typed ArrayAttrs if element attribute translators are already implemented. However, the type of the element attribute is lost at the construction of TypedArrayAttrBase. With this change one can inspect the element type and generate the translation logic automatically, which will reduce the code repetition.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73579

Files:
  mlir/include/mlir/IR/OpBase.td


Index: mlir/include/mlir/IR/OpBase.td
===================================================================
--- mlir/include/mlir/IR/OpBase.td
+++ mlir/include/mlir/IR/OpBase.td
@@ -1091,6 +1091,8 @@
                           "; })">]>,
     description> {
   let constBuilderCall = "$_builder.getArrayAttr($0)";
+
+  Attr elementAttr = element;
 }
 
 def I32ArrayAttr : TypedArrayAttrBase<I32Attr,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73579.240990.patch
Type: text/x-patch
Size: 398 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200128/4390576e/attachment.bin>


More information about the llvm-commits mailing list