[Mlir-commits] [mlir] a2f71d2 - [MLIR] Add LocationAttr declarations to ODS

Andrew Young llvmlistbot at llvm.org
Mon Jan 23 21:08:15 PST 2023


Author: Andrew Young
Date: 2023-01-23T20:42:14-08:00
New Revision: a2f71d2732d3fa2700ae2f899fef112955b07af9

URL: https://github.com/llvm/llvm-project/commit/a2f71d2732d3fa2700ae2f899fef112955b07af9
DIFF: https://github.com/llvm/llvm-project/commit/a2f71d2732d3fa2700ae2f899fef112955b07af9.diff

LOG: [MLIR] Add LocationAttr declarations to ODS

This commit adds location attributes and arrays of locations to OpBase.td.
Using LocationAttrs directly in an operation is useful when the 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.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D142148

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/OpBase.td b/mlir/include/mlir/IR/OpBase.td
index e859e40dc1b00..7fb583febfba6 100644
--- a/mlir/include/mlir/IR/OpBase.td
+++ b/mlir/include/mlir/IR/OpBase.td
@@ -1078,6 +1078,9 @@ class AnyAttrOf<list<Attr> allowedAttrs, string summary = "",
     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 }];
@@ -1477,6 +1480,9 @@ class TypedArrayAttrBase<Attr element, string summary>: ArrayAttrBase<
   Attr elementAttr = element;
 }
 
+def LocationArrayAttr : TypedArrayAttrBase<LocationAttr,
+                                           "location array attribute">;
+
 def AffineMapArrayAttr : TypedArrayAttrBase<AffineMapAttr,
                                       "AffineMap array attribute"> {
   let constBuilderCall = "$_builder.getAffineMapArrayAttr($0)";


        


More information about the Mlir-commits mailing list