[llvm-branch-commits] [mlir] [mlir] Add predicates to tablegen-defined properties (PR #120176)

Krzysztof Drewniak via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Dec 17 09:11:49 PST 2024


================
@@ -63,6 +65,12 @@ class Property<string storageTypeParam = "", string desc = ""> {
     return convertFromAttribute($_storage, $_attr, $_diag);
   }];
 
+  // The verification predicate for this property. Defaults to And<[]>,
+  // which is trivially true, since properties are always their expected type.
+  // Within the predicate, `$_self` is an instance of the **interface**
+  // type of the property.
+  Pred predicate = ?;
----------------
krzysz00 wrote:

The trouble with `And<[]>` is that it's hard to detect and I'd like to say "if X doesn't have a predicate, then OptionalProperty<X> doesn't either"

I was considering going an adding explicit True and False cases to the predicate combiner kind but that sameed invasive

... Also, I don't think the And<[]> detector works 

https://github.com/llvm/llvm-project/pull/120176


More information about the llvm-branch-commits mailing list