14
14
#define PROPERTIES
15
15
16
16
include "mlir/IR/Constraints.td"
17
+ include "mlir/IR/Utils.td"
17
18
18
19
// Base class for defining properties.
19
20
class Property<string storageTypeParam = "", string desc = ""> {
@@ -211,7 +212,7 @@ defvar writeMlirBytecodeWithConvertToAttribute = [{
211
212
// Primitive property kinds
212
213
213
214
// Any kind of integer stored as properties.
214
- class IntProperty <string storageTypeParam, string desc = ""> :
215
+ class IntProp <string storageTypeParam, string desc = ""> :
215
216
Property<storageTypeParam, desc> {
216
217
let summary = !if(!empty(desc), storageTypeParam, desc);
217
218
let optionalParser = [{
@@ -228,10 +229,16 @@ class IntProperty<string storageTypeParam, string desc = ""> :
228
229
}];
229
230
}
230
231
231
- def I32Property : IntProperty<"int32_t">;
232
- def I64Property : IntProperty<"int64_t ">;
232
+ class IntProperty<string storageTypeParam, string desc = "">
233
+ : IntProp<storageTypeParam, desc>, Deprecated<"moved to the shorter name IntProp ">;
233
234
234
- class EnumProperty<string storageTypeParam, string desc = "", string default = ""> :
235
+ def I32Prop : IntProp<"int32_t">;
236
+ def I64Prop : IntProp<"int64_t">;
237
+
238
+ def I32Property : IntProp<"int32_t">, Deprecated<"moved to shorter name I32Prop">;
239
+ def I64Property : IntProp<"int64_t">, Deprecated<"moved to shorter name I64Prop">;
240
+
241
+ class EnumProp<string storageTypeParam, string desc = "", string default = ""> :
235
242
Property<storageTypeParam, desc> {
236
243
// TODO: implement predicate for enum validity.
237
244
let writeToMlirBytecode = [{
@@ -246,7 +253,12 @@ class EnumProperty<string storageTypeParam, string desc = "", string default = "
246
253
let defaultValue = default;
247
254
}
248
255
249
- def StringProperty : Property<"std::string", "string"> {
256
+ class EnumProperty<string storageTypeParam, string desc = "", string default = ""> :
257
+ EnumProp<storageTypeParam, desc, default>,
258
+ Deprecated<"moved to shorter name EnumProp">;
259
+
260
+ // Note: only a class so we can deprecate the old name
261
+ class _cls_StringProp : Property<"std::string", "string"> {
250
262
let interfaceType = "::llvm::StringRef";
251
263
let convertFromStorage = "::llvm::StringRef{$_storage}";
252
264
let assignToStorage = "$_storage = $_value.str()";
@@ -265,8 +277,11 @@ def StringProperty : Property<"std::string", "string"> {
265
277
$_writer.writeOwnedString($_storage);
266
278
}];
267
279
}
280
+ def StringProp : _cls_StringProp;
281
+ def StringProperty : _cls_StringProp, Deprecated<"moved to shorter name StringProp">;
268
282
269
- def BoolProperty : IntProperty<"bool", "boolean"> {
283
+ // Note: only a class so we can deprecate the old name
284
+ class _cls_BoolProp : IntProp<"bool", "boolean"> {
270
285
let printer = [{ $_printer << ($_storage ? "true" : "false") }];
271
286
let readFromMlirBytecode = [{
272
287
return $_reader.readBool($_storage);
@@ -275,8 +290,11 @@ def BoolProperty : IntProperty<"bool", "boolean"> {
275
290
$_writer.writeOwnedBool($_storage);
276
291
}];
277
292
}
293
+ def BoolProp : _cls_BoolProp;
294
+ def BoolProperty : _cls_BoolProp, Deprecated<"moved to shorter name BoolProp">;
278
295
279
- def UnitProperty : Property<"bool", "unit property"> {
296
+ // Note: only a class so we can deprecate the old name
297
+ class _cls_UnitProp : Property<"bool", "unit property"> {
280
298
let summary = "unit property";
281
299
let description = [{
282
300
A property whose presence or abscence is used as a flag.
@@ -337,14 +355,16 @@ def UnitProperty : Property<"bool", "unit property"> {
337
355
return ::mlir::failure();
338
356
}];
339
357
}
358
+ def UnitProp : _cls_UnitProp;
359
+ def UnitProperty : _cls_UnitProp, Deprecated<"moved to shorter name UnitProp">;
340
360
341
361
//===----------------------------------------------------------------------===//
342
362
// Property field overwrites
343
363
344
364
/// Class for giving a property a default value.
345
365
/// This doesn't change anything about the property other than giving it a default
346
366
/// which can be used by ODS to elide printing.
347
- class DefaultValuedProperty <Property p, string default = "", string storageDefault = ""> : Property<p.storageType, p.summary> {
367
+ class DefaultValuedProp <Property p, string default = "", string storageDefault = ""> : Property<p.storageType, p.summary> {
348
368
let defaultValue = default;
349
369
let storageTypeValueOverride = storageDefault;
350
370
let baseProperty = p;
@@ -365,11 +385,13 @@ class DefaultValuedProperty<Property p, string default = "", string storageDefau
365
385
let readFromMlirBytecode = p.readFromMlirBytecode;
366
386
let writeToMlirBytecode = p.writeToMlirBytecode;
367
387
}
388
+ class DefaultValuedProperty<Property p, string default = "", string storageDefault = "">
389
+ : DefaultValuedProp<p, default, storageDefault>, Deprecated<"moved to shorter name DefaultValuedProp">;
368
390
369
391
/// Apply the predicate `pred` to the property `p`, ANDing it with any
370
392
/// predicates it may already have. If `newSummary` is provided, replace the
371
393
/// summary of `p` with `newSummary`.
372
- class ConfinedProperty <Property p, Pred pred, string newSummary = "">
394
+ class ConfinedProp <Property p, Pred pred, string newSummary = "">
373
395
: Property<p.storageType, !if(!empty(newSummary), p.summary, newSummary)> {
374
396
let predicate = !if(!ne(p.predicate, TruePred), And<[p.predicate, pred]>, pred);
375
397
let baseProperty = p;
@@ -391,6 +413,10 @@ class ConfinedProperty<Property p, Pred pred, string newSummary = "">
391
413
let storageTypeValueOverride = p.storageTypeValueOverride;
392
414
}
393
415
416
+ class ConfinedProperty<Property p, Pred pred, string newSummary = "">
417
+ : ConfinedProp<p, pred, newSummary>,
418
+ Deprecated<"moved to shorter name ConfinedProp">;
419
+
394
420
//===----------------------------------------------------------------------===//
395
421
// Primitive property combinators
396
422
@@ -428,8 +454,8 @@ class _makeStorageWrapperPred<Property wrappedProp> {
428
454
/// `SmallVector` of that property. This uses an `ArrayAttr` as its attribute form
429
455
/// though subclasses can override this, as is the case with IntArrayAttr below.
430
456
/// Those wishing to use a non-default number of SmallVector elements should
431
- /// subclass `ArrayProperty `.
432
- class ArrayProperty <Property elem = Property<>, string newSummary = ""> :
457
+ /// subclass `ArrayProp `.
458
+ class ArrayProp <Property elem = Property<>, string newSummary = ""> :
433
459
Property<"::llvm::SmallVector<" # elem.storageType # ">",
434
460
!if(!empty(newSummary), "array of " # elem.summary, newSummary)> {
435
461
let interfaceType = "::llvm::ArrayRef<" # elem.storageType # ">";
@@ -548,9 +574,11 @@ class ArrayProperty<Property elem = Property<>, string newSummary = ""> :
548
574
}()
549
575
}]);
550
576
}
577
+ class ArrayProperty<Property elem = Property<>, string newSummary = "">
578
+ : ArrayProp<elem, newSummary>, Deprecated<"moved to shorter name ArrayProp">;
551
579
552
- class IntArrayProperty <Property elem, string newSummary=""> :
553
- ArrayProperty <elem, newSummary> {
580
+ class IntArrayProp <Property elem, string newSummary=""> :
581
+ ArrayProp <elem, newSummary> {
554
582
// Bring back the trivial conversions we don't get in the general case.
555
583
let convertFromAttribute = [{
556
584
return convertFromAttribute($_storage, $_attr, $_diag);
@@ -559,6 +587,8 @@ class IntArrayProperty<Property elem, string newSummary=""> :
559
587
return convertToAttribute($_ctxt, $_storage);
560
588
}];
561
589
}
590
+ class IntArrayProperty<Property elem, string newSummary="">
591
+ : IntArrayProp<elem, newSummary>, Deprecated<"moved to shorter name IntArrayProp">;
562
592
563
593
/// An optional property, stored as an std::optional<p.storageType>
564
594
/// interfaced with as an std::optional<p.interfaceType>..
@@ -570,7 +600,7 @@ class IntArrayProperty<Property elem, string newSummary=""> :
570
600
/// bracketing and delegate to the optional parser. In that case, the syntax is the
571
601
/// syntax of the underlying property, or the keyword `none` in the rare cases that
572
602
/// it is needed. This behavior can be disabled by setting `canDelegateParsing` to 0.
573
- class OptionalProperty <Property p, bit canDelegateParsing = 1>
603
+ class OptionalProp <Property p, bit canDelegateParsing = 1>
574
604
: Property<"std::optional<" # p.storageType # ">", "optional " # p.summary> {
575
605
576
606
// In the cases where the underlying attribute is plain old data that's passed by
@@ -754,4 +784,7 @@ class OptionalProperty<Property p, bit canDelegateParsing = 1>
754
784
"For delegated parsing to be used, the default value must be nullopt. " #
755
785
"To use a non-trivial default, set the canDelegateParsing argument to 0";
756
786
}
787
+ class OptionalProperty<Property p, bit canDelegateParsing = 1>
788
+ : OptionalProp<p, canDelegateParsing>,
789
+ Deprecated<"moved to shorter name OptionalProp">;
757
790
#endif // PROPERTIES
0 commit comments