[Mlir-commits] [mlir] [mlir] Add property combinators, initial ODS support (PR #94732)
Christian Ulmann
llvmlistbot at llvm.org
Mon Jun 17 22:43:34 PDT 2024
================
@@ -88,13 +138,31 @@ class Property<string storageTypeParam = "", string desc = ""> {
// - `$_storage` is the storage type value.
// - `$_reader` is a `DialectBytecodeReader`.
// - `$_ctxt` is a `MLIRContext *`.
+ //
+ // This will become the body of a function returning LogicalResult.
+ // There is an implicit `return success()` at the end of this function.
+ //
+ // When this code executes, `$_storage` will be initialized to the property's
+ // default value (if any, accounting for the storage type override).
code readFromMlirBytecode = [{
if (::mlir::failed(readFromMlirBytecode($_reader, $_storage)))
return ::mlir::failure();
}];
- // Default value for the property.
- string defaultValue = ?;
+ // Base definition for the property. (Will be) used for `OptionalProperty` and
+ // such cases, analogously to `baseAttr`.
+ Property baseProperty = ?;
+
+ // Default value for the property within its storage. This should be an expression
+ // of type `interfaceType` and should be comparable with other types of that
+ // interface typ with `==`. The empty string means there is no default value.
+ string defaultValue = "";
+
+ // If set, the default value the storage of the property should be initilized to.
+ // This is only needed when the storage and interface types of the property
+ // are distinct (ex. SmallVector for storage vs. ArrayRef for interfacing), as it
+ // will fall back to defaultValue when unspecified.
----------------
Dinistro wrote:
```suggestion
// will fall back to `defaultValue` when unspecified.
```
https://github.com/llvm/llvm-project/pull/94732
More information about the Mlir-commits
mailing list