[PATCH] D142148: [MLIR] Add LocationAttr declarations to ODS

Andrew Young via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 19 11:10:11 PST 2023


youngar created this revision.
Herald added subscribers: Moerafaat, zero9178, bzcheeseman, sdasgup3, wenzhicui, wrengr, cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, mgester, arpith-jacob, antiagainst, shauheen, rriddle, mehdi_amini.
Herald added a project: All.
youngar requested review of this revision.
Herald added subscribers: llvm-commits, stephenneuendorffer, nicolasvasilache.
Herald added a project: LLVM.

This commit adds location attributes and arrays of locations to OpBase.td.  Using LocationAttrs directly in an operation is useful when then location does not correspond 1-1 to an operation or value in the IR.  We use this in CIRCT to store the declaration location of result ports of HWModule operations.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142148

Files:
  include/mlir/IR/OpBase.td


Index: include/mlir/IR/OpBase.td
===================================================================
--- include/mlir/IR/OpBase.td
+++ include/mlir/IR/OpBase.td
@@ -1084,6 +1084,9 @@
     let convertFromStorage = fromStorage;
 }
 
+def LocationAttr : Attr<CPred<"$_self.isa<::mlir::LocationAttr>()">,
+                        "location attribute">;
+
 def BoolAttr : Attr<CPred<"$_self.isa<::mlir::BoolAttr>()">, "bool attribute"> {
   let storageType = [{ ::mlir::BoolAttr }];
   let returnType = [{ bool }];
@@ -1483,6 +1486,9 @@
   Attr elementAttr = element;
 }
 
+def LocationArrayAttr : TypedArrayAttrBase<LocationAttr,
+                                           "location array attribute">;
+
 def AffineMapArrayAttr : TypedArrayAttrBase<AffineMapAttr,
                                       "AffineMap array attribute"> {
   let constBuilderCall = "$_builder.getAffineMapArrayAttr($0)";


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142148.490600.patch
Type: text/x-patch
Size: 896 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230119/dfe3109c/attachment.bin>


More information about the llvm-commits mailing list