[mlir][ods] Rename Confined and AllAttrConstraintsOf

Confined -> ConfinedAttr
AllAttrConstraintsOf -> AllOfAttr

To be in line with ConfinedType and AllOfType.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D131822
This commit is contained in:
Jeff Niu 2022-08-12 21:22:26 -04:00
parent 5c4674d67b
commit e35ca70eb3
16 changed files with 92 additions and 92 deletions

View File

@ -117,8 +117,8 @@ window in `value`.
let arguments = (ins let arguments = (ins
TF_FpTensor:$value, TF_FpTensor:$value,
Confined<I64ArrayAttr, [ArrayMinCount<4>]>:$ksize, ConfinedAttr<I64ArrayAttr, [ArrayMinCount<4>]>:$ksize,
Confined<I64ArrayAttr, [ArrayMinCount<4>]>:$strides, ConfinedAttr<I64ArrayAttr, [ArrayMinCount<4>]>:$strides,
TF_AnyStrAttrOf<["SAME", "VALID"]>:$padding, TF_AnyStrAttrOf<["SAME", "VALID"]>:$padding,
DefaultValuedAttr<TF_ConvertDataFormatAttr, "NHWC">:$data_format DefaultValuedAttr<TF_ConvertDataFormatAttr, "NHWC">:$data_format
); );
@ -275,11 +275,11 @@ like `"0.5f"`, and an integer array default value should be specified as like
#### Confining attributes #### Confining attributes
`Confined` is provided as a general mechanism to help modelling further `ConfinedAttr` is provided as a general mechanism to help modelling further
constraints on attributes beyond the ones brought by value types. You can use constraints on attributes beyond the ones brought by value types. You can use
`Confined` to compose complex constraints out of more primitive ones. For `ConfinedAttr` to compose complex constraints out of more primitive ones. For
example, a 32-bit integer attribute whose minimum value must be 10 can be example, a 32-bit integer attribute whose minimum value must be 10 can be
expressed as `Confined<I32Attr, [IntMinValue<10>]>`. expressed as `ConfinedAttr<I32Attr, [IntMinValue<10>]>`.
Right now, the following primitive constraints are supported: Right now, the following primitive constraints are supported:
@ -1287,7 +1287,7 @@ optionality, default values, etc.:
* `DefaultValuedAttr`: specifies the * `DefaultValuedAttr`: specifies the
[default value](#attributes-with-default-values) for an attribute. [default value](#attributes-with-default-values) for an attribute.
* `OptionalAttr`: specifies an attribute as [optional](#optional-attributes). * `OptionalAttr`: specifies an attribute as [optional](#optional-attributes).
* `Confined`: adapts an attribute with * `ConfinedAttr`: adapts an attribute with
[further constraints](#confining-attributes). [further constraints](#confining-attributes).
### Enum attributes ### Enum attributes

View File

@ -779,7 +779,7 @@ def AffinePrefetchOp : Affine_Op<"prefetch",
let arguments = (ins AnyMemRef:$memref, Variadic<Index>:$indices, let arguments = (ins AnyMemRef:$memref, Variadic<Index>:$indices,
BoolAttr:$isWrite, BoolAttr:$isWrite,
Confined<I32Attr, [IntMinValue<0>, ConfinedAttr<I32Attr, [IntMinValue<0>,
IntMaxValue<3>]>:$localityHint, IntMaxValue<3>]>:$localityHint,
BoolAttr:$isDataCache); BoolAttr:$isDataCache);

View File

@ -505,7 +505,7 @@ def Async_RuntimeAddRefOp : Async_Op<"runtime.add_ref"> {
}]; }];
let arguments = (ins Async_AnyAsyncType:$operand, let arguments = (ins Async_AnyAsyncType:$operand,
Confined<I64Attr, [IntPositive]>:$count); ConfinedAttr<I64Attr, [IntPositive]>:$count);
let assemblyFormat = [{ let assemblyFormat = [{
$operand attr-dict `:` type($operand) $operand attr-dict `:` type($operand)
@ -520,7 +520,7 @@ def Async_RuntimeDropRefOp : Async_Op<"runtime.drop_ref"> {
}]; }];
let arguments = (ins Async_AnyAsyncType:$operand, let arguments = (ins Async_AnyAsyncType:$operand,
Confined<I64Attr, [IntPositive]>:$count); ConfinedAttr<I64Attr, [IntPositive]>:$count);
let assemblyFormat = [{ let assemblyFormat = [{
$operand attr-dict `:` type($operand) $operand attr-dict `:` type($operand)

View File

@ -1201,7 +1201,7 @@ def LLVM_GlobalOp : LLVM_Op<"mlir.global",
UnitAttr:$thread_local_, UnitAttr:$thread_local_,
OptionalAttr<AnyAttr>:$value, OptionalAttr<AnyAttr>:$value,
OptionalAttr<I64Attr>:$alignment, OptionalAttr<I64Attr>:$alignment,
DefaultValuedAttr<Confined<I32Attr, [IntNonNegative]>, "0">:$addr_space, DefaultValuedAttr<ConfinedAttr<I32Attr, [IntNonNegative]>, "0">:$addr_space,
OptionalAttr<UnnamedAddr>:$unnamed_addr, OptionalAttr<UnnamedAddr>:$unnamed_addr,
OptionalAttr<StrAttr>:$section OptionalAttr<StrAttr>:$section
); );

View File

@ -148,7 +148,7 @@ def Linalg_YieldOp : Linalg_Op<"yield", [NoSideEffect, ReturnLike, Terminator]>,
} }
def Linalg_IndexOp : Linalg_Op<"index", [NoSideEffect]>, def Linalg_IndexOp : Linalg_Op<"index", [NoSideEffect]>,
Arguments<(ins Confined<I64Attr, [IntMinValue<0>]>:$dim)>, Arguments<(ins ConfinedAttr<I64Attr, [IntMinValue<0>]>:$dim)>,
Results<(outs Index:$result)> { Results<(outs Index:$result)> {
let summary = "linalg index operation"; let summary = "linalg index operation";
let description = [{ let description = [{

View File

@ -66,7 +66,7 @@ class AllocLikeOp<string mnemonic,
// The symbolic operands (the ones in square brackets) // The symbolic operands (the ones in square brackets)
// bind to the symbols of the memref's layout map. // bind to the symbols of the memref's layout map.
Variadic<Index>:$symbolOperands, Variadic<Index>:$symbolOperands,
Confined<OptionalAttr<I64Attr>, ConfinedAttr<OptionalAttr<I64Attr>,
[IntMinValue<0>]>:$alignment); [IntMinValue<0>]>:$alignment);
let results = (outs Res<AnyMemRef, "", [MemAlloc<resource>]>:$memref); let results = (outs Res<AnyMemRef, "", [MemAlloc<resource>]>:$memref);
@ -123,7 +123,7 @@ def AssumeAlignmentOp : MemRef_Op<"assume_alignment"> {
optimization only, and the optimization is best-effort. optimization only, and the optimization is best-effort.
}]; }];
let arguments = (ins AnyMemRef:$memref, let arguments = (ins AnyMemRef:$memref,
Confined<I32Attr, [IntPositive]>:$alignment); ConfinedAttr<I32Attr, [IntPositive]>:$alignment);
let results = (outs); let results = (outs);
let assemblyFormat = "$memref `,` $alignment attr-dict `:` type($memref)"; let assemblyFormat = "$memref `,` $alignment attr-dict `:` type($memref)";
@ -965,7 +965,7 @@ def MemRef_PrefetchOp : MemRef_Op<"prefetch"> {
let arguments = (ins AnyMemRef:$memref, Variadic<Index>:$indices, let arguments = (ins AnyMemRef:$memref, Variadic<Index>:$indices,
BoolAttr:$isWrite, BoolAttr:$isWrite,
Confined<I32Attr, [IntMinValue<0>, ConfinedAttr<I32Attr, [IntMinValue<0>,
IntMaxValue<3>]>:$localityHint, IntMaxValue<3>]>:$localityHint,
BoolAttr:$isDataCache); BoolAttr:$isDataCache);

View File

@ -345,7 +345,7 @@ def WsLoopOp : OpenMP_Op<"wsloop", [AttrSizedOperandSegments,
OptionalAttr<ScheduleModifierAttr>:$schedule_modifier, OptionalAttr<ScheduleModifierAttr>:$schedule_modifier,
UnitAttr:$simd_modifier, UnitAttr:$simd_modifier,
UnitAttr:$nowait, UnitAttr:$nowait,
Confined<OptionalAttr<I64Attr>, [IntMinValue<0>]>:$ordered_val, ConfinedAttr<OptionalAttr<I64Attr>, [IntMinValue<0>]>:$ordered_val,
OptionalAttr<OrderKindAttr>:$order_val, OptionalAttr<OrderKindAttr>:$order_val,
UnitAttr:$inclusive); UnitAttr:$inclusive);
@ -432,7 +432,7 @@ def SimdLoopOp : OpenMP_Op<"simdloop", [AttrSizedOperandSegments,
Variadic<IntLikeType>:$upperBound, Variadic<IntLikeType>:$upperBound,
Variadic<IntLikeType>:$step, Variadic<IntLikeType>:$step,
Optional<I1>:$if_expr, Optional<I1>:$if_expr,
Confined<OptionalAttr<I64Attr>, [IntPositive]>:$simdlen, ConfinedAttr<OptionalAttr<I64Attr>, [IntPositive]>:$simdlen,
UnitAttr:$inclusive UnitAttr:$inclusive
); );
@ -967,7 +967,7 @@ def OrderedOp : OpenMP_Op<"ordered"> {
}]; }];
let arguments = (ins OptionalAttr<ClauseDependAttr>:$depend_type_val, let arguments = (ins OptionalAttr<ClauseDependAttr>:$depend_type_val,
Confined<OptionalAttr<I64Attr>, [IntMinValue<0>]>:$num_loops_val, ConfinedAttr<OptionalAttr<I64Attr>, [IntMinValue<0>]>:$num_loops_val,
Variadic<AnyType>:$depend_vec_vars); Variadic<AnyType>:$depend_vec_vars);
let assemblyFormat = [{ let assemblyFormat = [{

View File

@ -411,7 +411,7 @@ def PDL_PatternOp : PDL_Op<"pattern", [
``` ```
}]; }];
let arguments = (ins Confined<I16Attr, [IntNonNegative]>:$benefit, let arguments = (ins ConfinedAttr<I16Attr, [IntNonNegative]>:$benefit,
OptionalAttr<SymbolNameAttr>:$sym_name); OptionalAttr<SymbolNameAttr>:$sym_name);
let regions = (region SizedRegion<1>:$body); let regions = (region SizedRegion<1>:$body);
let assemblyFormat = [{ let assemblyFormat = [{

View File

@ -236,7 +236,7 @@ def PDLInterp_CheckOperandCountOp
}]; }];
let arguments = (ins PDL_Operation:$inputOp, let arguments = (ins PDL_Operation:$inputOp,
Confined<I32Attr, [IntNonNegative]>:$count, ConfinedAttr<I32Attr, [IntNonNegative]>:$count,
UnitAttr:$compareAtLeast); UnitAttr:$compareAtLeast);
let assemblyFormat = [{ let assemblyFormat = [{
`of` $inputOp `is` (`at_least` $compareAtLeast^)? $count attr-dict `of` $inputOp `is` (`at_least` $compareAtLeast^)? $count attr-dict
@ -293,7 +293,7 @@ def PDLInterp_CheckResultCountOp
}]; }];
let arguments = (ins PDL_Operation:$inputOp, let arguments = (ins PDL_Operation:$inputOp,
Confined<I32Attr, [IntNonNegative]>:$count, ConfinedAttr<I32Attr, [IntNonNegative]>:$count,
UnitAttr:$compareAtLeast); UnitAttr:$compareAtLeast);
let assemblyFormat = [{ let assemblyFormat = [{
`of` $inputOp `is` (`at_least` $compareAtLeast^)? $count attr-dict `of` $inputOp `is` (`at_least` $compareAtLeast^)? $count attr-dict
@ -552,7 +552,7 @@ def PDLInterp_ExtractOp
}]; }];
let arguments = (ins PDL_RangeOf<PDL_AnyType>:$range, let arguments = (ins PDL_RangeOf<PDL_AnyType>:$range,
Confined<I32Attr, [IntNonNegative]>:$index); ConfinedAttr<I32Attr, [IntNonNegative]>:$index);
let results = (outs PDL_AnyType:$result); let results = (outs PDL_AnyType:$result);
let assemblyFormat = "$index `of` $range `:` type($result) attr-dict"; let assemblyFormat = "$index `of` $range `:` type($result) attr-dict";
@ -774,7 +774,7 @@ def PDLInterp_GetOperandOp : PDLInterp_Op<"get_operand", [NoSideEffect]> {
}]; }];
let arguments = (ins PDL_Operation:$inputOp, let arguments = (ins PDL_Operation:$inputOp,
Confined<I32Attr, [IntNonNegative]>:$index); ConfinedAttr<I32Attr, [IntNonNegative]>:$index);
let results = (outs PDL_Value:$value); let results = (outs PDL_Value:$value);
let assemblyFormat = "$index `of` $inputOp attr-dict"; let assemblyFormat = "$index `of` $inputOp attr-dict";
} }
@ -809,7 +809,7 @@ def PDLInterp_GetOperandsOp : PDLInterp_Op<"get_operands", [NoSideEffect]> {
let arguments = (ins let arguments = (ins
PDL_Operation:$inputOp, PDL_Operation:$inputOp,
OptionalAttr<Confined<I32Attr, [IntNonNegative]>>:$index OptionalAttr<ConfinedAttr<I32Attr, [IntNonNegative]>>:$index
); );
let results = (outs PDL_InstOrRangeOf<PDL_Value>:$value); let results = (outs PDL_InstOrRangeOf<PDL_Value>:$value);
let assemblyFormat = "($index^)? `of` $inputOp `:` type($value) attr-dict"; let assemblyFormat = "($index^)? `of` $inputOp `:` type($value) attr-dict";
@ -841,7 +841,7 @@ def PDLInterp_GetResultOp : PDLInterp_Op<"get_result", [NoSideEffect]> {
}]; }];
let arguments = (ins PDL_Operation:$inputOp, let arguments = (ins PDL_Operation:$inputOp,
Confined<I32Attr, [IntNonNegative]>:$index); ConfinedAttr<I32Attr, [IntNonNegative]>:$index);
let results = (outs PDL_Value:$value); let results = (outs PDL_Value:$value);
let assemblyFormat = "$index `of` $inputOp attr-dict"; let assemblyFormat = "$index `of` $inputOp attr-dict";
} }
@ -876,7 +876,7 @@ def PDLInterp_GetResultsOp : PDLInterp_Op<"get_results", [NoSideEffect]> {
let arguments = (ins let arguments = (ins
PDL_Operation:$inputOp, PDL_Operation:$inputOp,
OptionalAttr<Confined<I32Attr, [IntNonNegative]>>:$index OptionalAttr<ConfinedAttr<I32Attr, [IntNonNegative]>>:$index
); );
let results = (outs PDL_InstOrRangeOf<PDL_Value>:$value); let results = (outs PDL_InstOrRangeOf<PDL_Value>:$value);
let assemblyFormat = "($index^)? `of` $inputOp `:` type($value) attr-dict"; let assemblyFormat = "($index^)? `of` $inputOp `:` type($value) attr-dict";
@ -1019,7 +1019,7 @@ def PDLInterp_RecordMatchOp
SymbolRefAttr:$rewriter, SymbolRefAttr:$rewriter,
OptionalAttr<StrAttr>:$rootKind, OptionalAttr<StrAttr>:$rootKind,
OptionalAttr<StrArrayAttr>:$generatedOps, OptionalAttr<StrArrayAttr>:$generatedOps,
Confined<I16Attr, [IntNonNegative]>:$benefit); ConfinedAttr<I16Attr, [IntNonNegative]>:$benefit);
let successors = (successor AnySuccessor:$dest); let successors = (successor AnySuccessor:$dest);
let assemblyFormat = [{ let assemblyFormat = [{
$rewriter (`(` $inputs^ `:` type($inputs) `)`)? `:` $rewriter (`(` $inputs^ `:` type($inputs) `)`)? `:`

View File

@ -31,7 +31,7 @@ def GetParentForOp : Op<Transform_Dialect, "loop.get_parent_for",
let arguments = let arguments =
(ins PDL_Operation:$target, (ins PDL_Operation:$target,
DefaultValuedAttr<Confined<I64Attr, [IntPositive]>, DefaultValuedAttr<ConfinedAttr<I64Attr, [IntPositive]>,
"1">:$num_loops); "1">:$num_loops);
let results = (outs PDL_Operation:$parent); let results = (outs PDL_Operation:$parent);
@ -166,7 +166,7 @@ def LoopUnrollOp : Op<Transform_Dialect, "loop.unroll",
}]; }];
let arguments = (ins PDL_Operation:$target, let arguments = (ins PDL_Operation:$target,
Confined<I64Attr, [IntPositive]>:$factor); ConfinedAttr<I64Attr, [IntPositive]>:$factor);
let assemblyFormat = "$target attr-dict"; let assemblyFormat = "$target attr-dict";

View File

@ -167,21 +167,21 @@ class ArrayMaxCt<int n> : AttrConstraint<
CPred<"$_self.cast<::mlir::ArrayAttr>().size() <= " # n>, CPred<"$_self.cast<::mlir::ArrayAttr>().size() <= " # n>,
"with at least " # n # " elements">; "with at least " # n # " elements">;
def Tosa_Fp32ArrayAttr2 : Confined<F32ArrayAttr, [ArrayCount<2>]>; def Tosa_Fp32ArrayAttr2 : ConfinedAttr<F32ArrayAttr, [ArrayCount<2>]>;
def Tosa_Fp32ArrayAttr3 : Confined<F32ArrayAttr, [ArrayCount<3>]>; def Tosa_Fp32ArrayAttr3 : ConfinedAttr<F32ArrayAttr, [ArrayCount<3>]>;
def Tosa_Fp32ArrayAttr4 : Confined<F32ArrayAttr, [ArrayCount<4>]>; def Tosa_Fp32ArrayAttr4 : ConfinedAttr<F32ArrayAttr, [ArrayCount<4>]>;
def Tosa_Fp32ArrayAttr5 : Confined<F32ArrayAttr, [ArrayCount<5>]>; def Tosa_Fp32ArrayAttr5 : ConfinedAttr<F32ArrayAttr, [ArrayCount<5>]>;
def Tosa_Fp32ArrayAttr6 : Confined<F32ArrayAttr, [ArrayCount<6>]>; def Tosa_Fp32ArrayAttr6 : ConfinedAttr<F32ArrayAttr, [ArrayCount<6>]>;
def Tosa_IntArrayAttr2 : Confined<I64ArrayAttr, [ArrayCount<2>]>; def Tosa_IntArrayAttr2 : ConfinedAttr<I64ArrayAttr, [ArrayCount<2>]>;
def Tosa_IntArrayAttr3 : Confined<I64ArrayAttr, [ArrayCount<3>]>; def Tosa_IntArrayAttr3 : ConfinedAttr<I64ArrayAttr, [ArrayCount<3>]>;
def Tosa_IntArrayAttr4 : Confined<I64ArrayAttr, [ArrayCount<4>]>; def Tosa_IntArrayAttr4 : ConfinedAttr<I64ArrayAttr, [ArrayCount<4>]>;
def Tosa_IntArrayAttr5 : Confined<I64ArrayAttr, [ArrayCount<5>]>; def Tosa_IntArrayAttr5 : ConfinedAttr<I64ArrayAttr, [ArrayCount<5>]>;
def Tosa_IntArrayAttr6 : Confined<I64ArrayAttr, [ArrayCount<6>]>; def Tosa_IntArrayAttr6 : ConfinedAttr<I64ArrayAttr, [ArrayCount<6>]>;
def Tosa_IntArrayAttrUpto2 : Confined<I64ArrayAttr, [ArrayMaxCt<2>]>; def Tosa_IntArrayAttrUpto2 : ConfinedAttr<I64ArrayAttr, [ArrayMaxCt<2>]>;
def Tosa_IntArrayAttrUpto4 : Confined<I64ArrayAttr, [ArrayMaxCt<4>]>; def Tosa_IntArrayAttrUpto4 : ConfinedAttr<I64ArrayAttr, [ArrayMaxCt<4>]>;
def Tosa_IntArrayAttrUpto5 : Confined<I64ArrayAttr, [ArrayMaxCt<5>]>; def Tosa_IntArrayAttrUpto5 : ConfinedAttr<I64ArrayAttr, [ArrayMaxCt<5>]>;
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// Iterable attributes. // Iterable attributes.

View File

@ -693,7 +693,7 @@ class UnrankedTensorOf<list<Type> allowedTypes>
// list, and which additionally satisfies an optional list of predicates. // list, and which additionally satisfies an optional list of predicates.
// //
// TODO: use `Constraint` instead of `Pred`, so we can generate a better // TODO: use `Constraint` instead of `Pred`, so we can generate a better
// default summary (a la `Confined`). // default summary (a la `ConfinedAttr`).
class TensorOf< class TensorOf<
list<Type> allowedTypes, list<Type> allowedTypes,
list<Pred> preds = [], list<Pred> preds = [],
@ -1585,7 +1585,7 @@ class ConstantStrAttr<Attr attribute, string val>
// A general mechanism to further confine the given `attr` with all the // A general mechanism to further confine the given `attr` with all the
// `constraints`. This allows to compose complex constraints out of a series // `constraints`. This allows to compose complex constraints out of a series
// of more primitive ones. // of more primitive ones.
class Confined<Attr attr, list<AttrConstraint> constraints> : Attr< class ConfinedAttr<Attr attr, list<AttrConstraint> constraints> : Attr<
And<!listconcat([attr.predicate], And<!listconcat([attr.predicate],
!foreach(pred, constraints, pred.predicate))>, !foreach(pred, constraints, pred.predicate))>,
!foldl(/*init*/attr.summary, /*list*/constraints, !foldl(/*init*/attr.summary, /*list*/constraints,
@ -1603,7 +1603,7 @@ class Confined<Attr attr, list<AttrConstraint> constraints> : Attr<
// An AttrConstraint that holds if all attr constraints specified in // An AttrConstraint that holds if all attr constraints specified in
// 'constraints' hold. // 'constraints' hold.
class AllAttrConstraintsOf<list<AttrConstraint> constraints> : AttrConstraint< class AllAttrOf<list<AttrConstraint> constraints> : AttrConstraint<
And<!listconcat([!head(constraints).predicate], And<!listconcat([!head(constraints).predicate],
!foreach(pred, !tail(constraints), pred.predicate))>, !foreach(pred, !tail(constraints), pred.predicate))>,
!interleave(!foreach(con, constraints, con.summary), " and ")> { !interleave(!foreach(con, constraints, con.summary), " and ")> {

View File

@ -2100,7 +2100,7 @@ void InsertStridedSliceOp::build(OpBuilder &builder, OperationState &result,
result.addAttribute(getStridesAttrStrName(), stridesAttr); result.addAttribute(getStridesAttrStrName(), stridesAttr);
} }
// TODO: Should be moved to Tablegen Confined attributes. // TODO: Should be moved to Tablegen ConfinedAttr attributes.
template <typename OpType> template <typename OpType>
static LogicalResult isIntegerArrayAttrSmallerThanShape(OpType op, static LogicalResult isIntegerArrayAttrSmallerThanShape(OpType op,
ArrayAttr arrayAttr, ArrayAttr arrayAttr,

View File

@ -170,15 +170,15 @@ def AnyAttrOfOp : TEST_Op<"any_attr_of_i32_str"> {
def NonNegIntAttrOp : TEST_Op<"non_negative_int_attr"> { def NonNegIntAttrOp : TEST_Op<"non_negative_int_attr"> {
let arguments = (ins let arguments = (ins
Confined<I32Attr, [IntNonNegative]>:$i32attr, ConfinedAttr<I32Attr, [IntNonNegative]>:$i32attr,
Confined<I64Attr, [IntNonNegative]>:$i64attr ConfinedAttr<I64Attr, [IntNonNegative]>:$i64attr
); );
} }
def PositiveIntAttrOp : TEST_Op<"positive_int_attr"> { def PositiveIntAttrOp : TEST_Op<"positive_int_attr"> {
let arguments = (ins let arguments = (ins
Confined<I32Attr, [IntPositive]>:$i32attr, ConfinedAttr<I32Attr, [IntPositive]>:$i32attr,
Confined<I64Attr, [IntPositive]>:$i64attr ConfinedAttr<I64Attr, [IntPositive]>:$i64attr
); );
} }
@ -377,7 +377,7 @@ def OpWithBitEnumVerticalBar : TEST_Op<"op_with_bit_enum_vbar"> {
def SymbolRefOp : TEST_Op<"symbol_ref_attr"> { def SymbolRefOp : TEST_Op<"symbol_ref_attr"> {
let arguments = (ins let arguments = (ins
Confined<FlatSymbolRefAttr, [ReferToOp<"func::FuncOp">]>:$symbol ConfinedAttr<FlatSymbolRefAttr, [ReferToOp<"func::FuncOp">]>:$symbol
); );
} }
@ -1127,7 +1127,7 @@ def : Pattern<(OpNativeCodeCall6 $arg1, $arg2),
[(OpNativeCodeCall7 (BindMultipleNativeCodeCallResult:$native__0 $arg1, $arg2)), [(OpNativeCodeCall7 (BindMultipleNativeCodeCallResult:$native__0 $arg1, $arg2)),
(OpNativeCodeCall7 $native__1)]>; (OpNativeCodeCall7 $native__1)]>;
// Test AllAttrConstraintsOf. // Test AllAttrOf.
def OpAllAttrConstraint1 : TEST_Op<"all_attr_constraint_of1"> { def OpAllAttrConstraint1 : TEST_Op<"all_attr_constraint_of1"> {
let arguments = (ins I64ArrayAttr:$attr); let arguments = (ins I64ArrayAttr:$attr);
let results = (outs I32); let results = (outs I32);
@ -1144,7 +1144,7 @@ def Constraint1 : AttrConstraint<
CPred<"$_self.cast<ArrayAttr>()[1].cast<::mlir::IntegerAttr>().getInt() == 1">, CPred<"$_self.cast<ArrayAttr>()[1].cast<::mlir::IntegerAttr>().getInt() == 1">,
"[1] == 1">; "[1] == 1">;
def : Pat<(OpAllAttrConstraint1 def : Pat<(OpAllAttrConstraint1
AllAttrConstraintsOf<[Constraint0, Constraint1]>:$attr), AllAttrOf<[Constraint0, Constraint1]>:$attr),
(OpAllAttrConstraint2 $attr)>; (OpAllAttrConstraint2 $attr)>;
// Op for testing RewritePattern removing op with inner ops. // Op for testing RewritePattern removing op with inner ops.

View File

@ -10,7 +10,7 @@ def OpAllSingle : Op<Test_Dialect, "all_single"> {
let arguments = (ins let arguments = (ins
I64:$operand, I64:$operand,
I64Attr:$attr, I64Attr:$attr,
Confined<I64Attr, [IntNonNegative]>:$nonNegativeAttr ConfinedAttr<I64Attr, [IntNonNegative]>:$nonNegativeAttr
); );
let results = (outs I64:$result); let results = (outs I64:$result);
} }

View File

@ -50,7 +50,7 @@ def OpB : NS_Op<"op_for_And_PredOpTrait", [
// CHECK: if (!(((first)) && ((second)))) // CHECK: if (!(((first)) && ((second))))
def OpF : NS_Op<"op_for_int_min_val", []> { def OpF : NS_Op<"op_for_int_min_val", []> {
let arguments = (ins Confined<I32Attr, [IntMinValue<10>]>:$attr); let arguments = (ins ConfinedAttr<I32Attr, [IntMinValue<10>]>:$attr);
} }
// CHECK-LABEL: OpFAdaptor::verify // CHECK-LABEL: OpFAdaptor::verify
@ -58,7 +58,7 @@ def OpF : NS_Op<"op_for_int_min_val", []> {
// CHECK-NEXT: "attribute 'attr' failed to satisfy constraint: 32-bit signless integer attribute whose minimum value is 10" // CHECK-NEXT: "attribute 'attr' failed to satisfy constraint: 32-bit signless integer attribute whose minimum value is 10"
def OpFX : NS_Op<"op_for_int_max_val", []> { def OpFX : NS_Op<"op_for_int_max_val", []> {
let arguments = (ins Confined<I32Attr, [IntMaxValue<10>]>:$attr); let arguments = (ins ConfinedAttr<I32Attr, [IntMaxValue<10>]>:$attr);
} }
// CHECK-LABEL: OpFXAdaptor::verify // CHECK-LABEL: OpFXAdaptor::verify
@ -66,7 +66,7 @@ def OpFX : NS_Op<"op_for_int_max_val", []> {
// CHECK-NEXT: "attribute 'attr' failed to satisfy constraint: 32-bit signless integer attribute whose maximum value is 10" // CHECK-NEXT: "attribute 'attr' failed to satisfy constraint: 32-bit signless integer attribute whose maximum value is 10"
def OpG : NS_Op<"op_for_arr_min_count", []> { def OpG : NS_Op<"op_for_arr_min_count", []> {
let arguments = (ins Confined<ArrayAttr, [ArrayMinCount<8>]>:$attr); let arguments = (ins ConfinedAttr<ArrayAttr, [ArrayMinCount<8>]>:$attr);
} }
// CHECK-LABEL: OpGAdaptor::verify // CHECK-LABEL: OpGAdaptor::verify
@ -74,7 +74,7 @@ def OpG : NS_Op<"op_for_arr_min_count", []> {
// CHECK-NEXT: "attribute 'attr' failed to satisfy constraint: array attribute with at least 8 elements" // CHECK-NEXT: "attribute 'attr' failed to satisfy constraint: array attribute with at least 8 elements"
def OpH : NS_Op<"op_for_arr_value_at_index", []> { def OpH : NS_Op<"op_for_arr_value_at_index", []> {
let arguments = (ins Confined<ArrayAttr, [IntArrayNthElemEq<0, 8>]>:$attr); let arguments = (ins ConfinedAttr<ArrayAttr, [IntArrayNthElemEq<0, 8>]>:$attr);
} }
// CHECK-LABEL: OpHAdaptor::verify // CHECK-LABEL: OpHAdaptor::verify
@ -82,7 +82,7 @@ def OpH : NS_Op<"op_for_arr_value_at_index", []> {
// CHECK-NEXT: "attribute 'attr' failed to satisfy constraint: array attribute whose 0-th element must be 8" // CHECK-NEXT: "attribute 'attr' failed to satisfy constraint: array attribute whose 0-th element must be 8"
def OpI: NS_Op<"op_for_arr_min_value_at_index", []> { def OpI: NS_Op<"op_for_arr_min_value_at_index", []> {
let arguments = (ins Confined<ArrayAttr, [IntArrayNthElemMinValue<0, 8>]>:$attr); let arguments = (ins ConfinedAttr<ArrayAttr, [IntArrayNthElemMinValue<0, 8>]>:$attr);
} }
// CHECK-LABEL: OpIAdaptor::verify // CHECK-LABEL: OpIAdaptor::verify