1414#define PROPERTIES
1515
1616include "mlir/IR/Constraints.td"
17+ include "mlir/IR/Utils.td"
1718
1819// Base class for defining properties.
1920class Property<string storageTypeParam = "", string desc = ""> {
@@ -211,7 +212,7 @@ defvar writeMlirBytecodeWithConvertToAttribute = [{
211212// Primitive property kinds
212213
213214// Any kind of integer stored as properties.
214- class IntProperty <string storageTypeParam, string desc = ""> :
215+ class IntProp <string storageTypeParam, string desc = ""> :
215216 Property<storageTypeParam, desc> {
216217 let summary = !if(!empty(desc), storageTypeParam, desc);
217218 let optionalParser = [{
@@ -228,10 +229,16 @@ class IntProperty<string storageTypeParam, string desc = ""> :
228229 }];
229230}
230231
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 ">;
233234
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 = ""> :
235242 Property<storageTypeParam, desc> {
236243 // TODO: implement predicate for enum validity.
237244 let writeToMlirBytecode = [{
@@ -246,7 +253,12 @@ class EnumProperty<string storageTypeParam, string desc = "", string default = "
246253 let defaultValue = default;
247254}
248255
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"> {
250262 let interfaceType = "::llvm::StringRef";
251263 let convertFromStorage = "::llvm::StringRef{$_storage}";
252264 let assignToStorage = "$_storage = $_value.str()";
@@ -265,8 +277,11 @@ def StringProperty : Property<"std::string", "string"> {
265277 $_writer.writeOwnedString($_storage);
266278 }];
267279}
280+ def StringProp : _cls_StringProp;
281+ def StringProperty : _cls_StringProp, Deprecated<"moved to shorter name StringProp">;
268282
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"> {
270285 let printer = [{ $_printer << ($_storage ? "true" : "false") }];
271286 let readFromMlirBytecode = [{
272287 return $_reader.readBool($_storage);
@@ -275,8 +290,11 @@ def BoolProperty : IntProperty<"bool", "boolean"> {
275290 $_writer.writeOwnedBool($_storage);
276291 }];
277292}
293+ def BoolProp : _cls_BoolProp;
294+ def BoolProperty : _cls_BoolProp, Deprecated<"moved to shorter name BoolProp">;
278295
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"> {
280298 let summary = "unit property";
281299 let description = [{
282300 A property whose presence or abscence is used as a flag.
@@ -337,14 +355,16 @@ def UnitProperty : Property<"bool", "unit property"> {
337355 return ::mlir::failure();
338356 }];
339357}
358+ def UnitProp : _cls_UnitProp;
359+ def UnitProperty : _cls_UnitProp, Deprecated<"moved to shorter name UnitProp">;
340360
341361//===----------------------------------------------------------------------===//
342362// Property field overwrites
343363
344364/// Class for giving a property a default value.
345365/// This doesn't change anything about the property other than giving it a default
346366/// 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> {
348368 let defaultValue = default;
349369 let storageTypeValueOverride = storageDefault;
350370 let baseProperty = p;
@@ -365,11 +385,13 @@ class DefaultValuedProperty<Property p, string default = "", string storageDefau
365385 let readFromMlirBytecode = p.readFromMlirBytecode;
366386 let writeToMlirBytecode = p.writeToMlirBytecode;
367387}
388+ class DefaultValuedProperty<Property p, string default = "", string storageDefault = "">
389+ : DefaultValuedProp<p, default, storageDefault>, Deprecated<"moved to shorter name DefaultValuedProp">;
368390
369391/// Apply the predicate `pred` to the property `p`, ANDing it with any
370392/// predicates it may already have. If `newSummary` is provided, replace the
371393/// summary of `p` with `newSummary`.
372- class ConfinedProperty <Property p, Pred pred, string newSummary = "">
394+ class ConfinedProp <Property p, Pred pred, string newSummary = "">
373395 : Property<p.storageType, !if(!empty(newSummary), p.summary, newSummary)> {
374396 let predicate = !if(!ne(p.predicate, TruePred), And<[p.predicate, pred]>, pred);
375397 let baseProperty = p;
@@ -391,6 +413,10 @@ class ConfinedProperty<Property p, Pred pred, string newSummary = "">
391413 let storageTypeValueOverride = p.storageTypeValueOverride;
392414}
393415
416+ class ConfinedProperty<Property p, Pred pred, string newSummary = "">
417+ : ConfinedProp<p, pred, newSummary>,
418+ Deprecated<"moved to shorter name ConfinedProp">;
419+
394420//===----------------------------------------------------------------------===//
395421// Primitive property combinators
396422
@@ -428,8 +454,8 @@ class _makeStorageWrapperPred<Property wrappedProp> {
428454/// `SmallVector` of that property. This uses an `ArrayAttr` as its attribute form
429455/// though subclasses can override this, as is the case with IntArrayAttr below.
430456/// 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 = ""> :
433459 Property<"::llvm::SmallVector<" # elem.storageType # ">",
434460 !if(!empty(newSummary), "array of " # elem.summary, newSummary)> {
435461 let interfaceType = "::llvm::ArrayRef<" # elem.storageType # ">";
@@ -548,9 +574,11 @@ class ArrayProperty<Property elem = Property<>, string newSummary = ""> :
548574 }()
549575 }]);
550576}
577+ class ArrayProperty<Property elem = Property<>, string newSummary = "">
578+ : ArrayProp<elem, newSummary>, Deprecated<"moved to shorter name ArrayProp">;
551579
552- class IntArrayProperty <Property elem, string newSummary=""> :
553- ArrayProperty <elem, newSummary> {
580+ class IntArrayProp <Property elem, string newSummary=""> :
581+ ArrayProp <elem, newSummary> {
554582 // Bring back the trivial conversions we don't get in the general case.
555583 let convertFromAttribute = [{
556584 return convertFromAttribute($_storage, $_attr, $_diag);
@@ -559,6 +587,8 @@ class IntArrayProperty<Property elem, string newSummary=""> :
559587 return convertToAttribute($_ctxt, $_storage);
560588 }];
561589}
590+ class IntArrayProperty<Property elem, string newSummary="">
591+ : IntArrayProp<elem, newSummary>, Deprecated<"moved to shorter name IntArrayProp">;
562592
563593/// An optional property, stored as an std::optional<p.storageType>
564594/// interfaced with as an std::optional<p.interfaceType>..
@@ -570,7 +600,7 @@ class IntArrayProperty<Property elem, string newSummary=""> :
570600/// bracketing and delegate to the optional parser. In that case, the syntax is the
571601/// syntax of the underlying property, or the keyword `none` in the rare cases that
572602/// 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>
574604 : Property<"std::optional<" # p.storageType # ">", "optional " # p.summary> {
575605
576606 // 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>
754784 "For delegated parsing to be used, the default value must be nullopt. " #
755785 "To use a non-trivial default, set the canDelegateParsing argument to 0";
756786}
787+ class OptionalProperty<Property p, bit canDelegateParsing = 1>
788+ : OptionalProp<p, canDelegateParsing>,
789+ Deprecated<"moved to shorter name OptionalProp">;
757790#endif // PROPERTIES
0 commit comments