@@ -18,6 +18,7 @@ def Nbdl_Dialect : Dialect {
1818 let useDefaultTypePrinterParser = 1;
1919}
2020
21+ // FIXME Maybe we should just use MLIR's NoneType for this.
2122def Nbdl_Empty : TypeDef<Nbdl_Dialect, "Empty", []> {
2223 let mnemonic = "empty";
2324 let description = [{
@@ -52,7 +53,21 @@ class Nbdl_TypeBase<string name, string type_mnemonic,
5253def Nbdl_Opaque : TypeDef<Nbdl_Dialect, "Opaque", []> {
5354 let mnemonic = "opaque";
5455 let description = [{
55- Represent an unknown C++ type.
56+ Represent an placeholder C++ type (typically `auto&&`).
57+ Values of this type imply an immediate construction.
58+ That is, it represents a run-time value in the context
59+ where it appears (e.g. an argument to a function).
60+ }];
61+ }
62+
63+ def Nbdl_Store : TypeDef<Nbdl_Dialect, "Store", []> {
64+ let mnemonic = "store";
65+ let description = [{
66+ An Object of store type represents a member of our state graph.
67+ Since a store object can exist as an inactive alternative
68+ of a variant, it is not necessarily have an immediate
69+ construction. Hence, we require it to be semiregular.
70+ (FIXME or just default constructible?)
5671 }];
5772}
5873
@@ -64,7 +79,6 @@ def Nbdl_Struct : Nbdl_TypeBase<"Struct", "struct"> {
6479 are accessed by their name.
6580 }];
6681}
67- */
6882
6983def Nbdl_State : TypeDef<Nbdl_Dialect, "State", []> {
7084 let mnemonic = "state";
@@ -73,19 +87,13 @@ def Nbdl_State : TypeDef<Nbdl_Dialect, "State", []> {
7387 }];
7488}
7589
76- def Nbdl_Store : TypeDef<Nbdl_Dialect, "Store", []> {
77- let mnemonic = "store";
78- let description = [{
79- A type satisfying the nbdl::Store concept
80- }];
81- }
82-
8390def Nbdl_Variant : TypeDef<Nbdl_Dialect, "Variant", []> {
8491 let mnemonic = "variant";
8592 let description = [{
8693 A type satisfying the nbdl::Variant concept
8794 }];
8895}
96+ */
8997
9098def Nbdl_Tag : TypeDef<Nbdl_Dialect, "Tag", []> {
9199 let mnemonic = "tag";
@@ -95,12 +103,11 @@ def Nbdl_Tag : TypeDef<Nbdl_Dialect, "Tag", []> {
95103 }];
96104}
97105
98- def Nbdl_Symbol : Nbdl_TypeBase<"Symbol", "symbol"> {
106+ def Nbdl_Symbol : TypeDef<Nbdl_Dialect, "Symbol"> {
107+ let mnemonic = "symbol";
99108 let description = [{
100109 Represent a string that is a valid C++ identifier.
101110 The intended primary use case is to specify a member of a Struct.
102-
103- FIXME using this?
104111 }];
105112}
106113
@@ -110,7 +117,7 @@ def Nbdl_KeyType : AnyTypeOf<[Nbdl_Opaque, Nbdl_Tag,
110117 Nbdl_Symbol, NoneType]>;
111118
112119def Nbdl_Type : AnyTypeOf<[Nbdl_Void, Nbdl_Empty, Nbdl_Opaque,
113- Nbdl_Store, Nbdl_State, Nbdl_Tag]>;
120+ Nbdl_Store, Nbdl_Tag]>;
114121
115122class Nbdl_Op<string mnemonic, list<Trait> traits = []> :
116123 Op<Nbdl_Dialect, mnemonic, traits>;
@@ -209,6 +216,15 @@ def Nbdl_ConstexprOp : Nbdl_Op<"constexpr", []> {
209216 let results = (outs Nbdl_Type:$result);
210217}
211218
219+ def Nbdl_MemberNameOp : Nbdl_Op<"member_name", []> {
220+ let description = [{
221+ Denote a member name as a value.
222+ }];
223+
224+ let arguments = (ins StrAttr:$name);
225+ let results = (outs Nbdl_Symbol:$result);
226+ }
227+
212228def Nbdl_StoreComposeOp : Nbdl_Op<"store_compose", []> {
213229 let description = [{
214230 Add a store $lhs as a member to another store $rhs using a key $key
@@ -231,7 +247,7 @@ def Nbdl_VariantOp : Nbdl_Op<"variant", []> {
231247 Create a sum type.
232248 }];
233249 let arguments = (ins Variadic<Nbdl_Type>:$args);
234- let results = (outs Nbdl_Variant :$result);
250+ let results = (outs Nbdl_Type :$result);
235251}
236252
237253def Nbdl_CreateStoreOp : Nbdl_Op<"create_store", [Symbol, IsolatedFromAbove]> {
0 commit comments