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

Markus Böck via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Dec 17 04:08:34 PST 2024


================
@@ -342,14 +399,37 @@ class _makePropStorage<Property prop, string name> {
         true : "") # ";";
 }
 
+/// Construct a `Pred`icate `ret` that wraps the predicate of the underlying
+/// property `childProp` with:
+///
+///   [](childProp.storageType& s) {
+///     return [](childProp.interfaceType i) {
+///       return leafSubst(childProp.predicate, "$_self" to "i");
+///     }(childProp.convertFromStorage(s))
+///   }
+///
+/// and then appends `prefix` and `suffix`.
+class _makeChildWrapperPred<string prefix, Property wrappedProp, string suffix> {
----------------
zero9178 wrote:

```suggestion
class _makeStorageWrapperPred<string prefix, Property wrappedProp, string suffix> {
```
Not 100% sure about the current name or the suggested name, but feel this explains the implementation a bit more precisely (effectively allowing us to use this predicate with the storage type instead)

Are `prefix` and `suffix` also strictly needed or could they be added by caller code using `Conat`? I feel this might make the code slightly easier to digest

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


More information about the llvm-branch-commits mailing list