[Mlir-commits] [mlir] 697a503 - Remove OpTrait, AttrTrait and TypeTrait
Sanjoy Das
llvmlistbot at llvm.org
Mon Jan 31 11:04:34 PST 2022
Author: Sanjoy Das
Date: 2022-01-31T11:04:00-08:00
New Revision: 697a5036cd9bdf9d12978e082e38ac75f0eb108e
URL: https://github.com/llvm/llvm-project/commit/697a5036cd9bdf9d12978e082e38ac75f0eb108e
DIFF: https://github.com/llvm/llvm-project/commit/697a5036cd9bdf9d12978e082e38ac75f0eb108e.diff
LOG: Remove OpTrait, AttrTrait and TypeTrait
- Remove the `{Op,Attr,Type}Trait` TableGen classes and replace with `Trait`
- Rename `OpTraitList` to `TraitList` and use it in a few places
The bulk of this change is a mechanical s/OpTrait/Trait/ throughout the codebase.
Reviewed By: rriddle, jpienaar, herhut
Differential Revision: https://reviews.llvm.org/D118543
Added:
Modified:
flang/include/flang/Optimizer/CodeGen/CGOps.td
flang/include/flang/Optimizer/Dialect/FIROps.td
mlir/docs/Tutorials/Toy/Ch-2.md
mlir/examples/standalone/include/Standalone/StandaloneDialect.td
mlir/examples/toy/Ch2/include/toy/Ops.td
mlir/examples/toy/Ch3/include/toy/Ops.td
mlir/examples/toy/Ch4/include/toy/Ops.td
mlir/examples/toy/Ch5/include/toy/Ops.td
mlir/examples/toy/Ch6/include/toy/Ops.td
mlir/examples/toy/Ch7/include/toy/Ops.td
mlir/include/mlir/Dialect/AMX/AMX.td
mlir/include/mlir/Dialect/Affine/IR/AffineOps.td
mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.td
mlir/include/mlir/Dialect/ArmNeon/ArmNeon.td
mlir/include/mlir/Dialect/ArmSVE/ArmSVE.td
mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td
mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td
mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
mlir/include/mlir/Dialect/GPU/GPUOps.td
mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td
mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td
mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
mlir/include/mlir/Dialect/Math/IR/MathOps.td
mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td
mlir/include/mlir/Dialect/Quant/QuantOps.td
mlir/include/mlir/Dialect/SCF/SCFOps.td
mlir/include/mlir/Dialect/SPIRV/IR/SPIRVArithmeticOps.td
mlir/include/mlir/Dialect/SPIRV/IR/SPIRVAtomicOps.td
mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td
mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBitOps.td
mlir/include/mlir/Dialect/SPIRV/IR/SPIRVCastOps.td
mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGLSLOps.td
mlir/include/mlir/Dialect/SPIRV/IR/SPIRVLogicalOps.td
mlir/include/mlir/Dialect/SPIRV/IR/SPIRVNonUniformOps.td
mlir/include/mlir/Dialect/SPIRV/IR/SPIRVOCLOps.td
mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td
mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td
mlir/include/mlir/Dialect/Tosa/IR/TosaOpBase.td
mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
mlir/include/mlir/Dialect/X86Vector/X86Vector.td
mlir/include/mlir/IR/BuiltinOps.td
mlir/include/mlir/IR/OpBase.td
mlir/include/mlir/IR/RegionKindInterface.td
mlir/include/mlir/Interfaces/InferTypeOpInterface.td
mlir/lib/TableGen/Operator.cpp
mlir/test/lib/Dialect/Test/TestOps.td
mlir/test/mlir-tblgen/constraint-unique.td
mlir/test/mlir-tblgen/op-attribute.td
mlir/test/mlir-tblgen/op-decl-and-defs.td
mlir/test/mlir-tblgen/op-format-spec.td
mlir/test/mlir-tblgen/op-operand.td
mlir/test/mlir-tblgen/op-python-bindings.td
mlir/test/mlir-tblgen/op-result.td
mlir/test/mlir-tblgen/op-side-effects.td
mlir/test/mlir-tblgen/predicate.td
mlir/test/mlir-tblgen/rewriter-errors.td
mlir/test/mlir-tblgen/rewriter-indexing.td
mlir/test/mlir-tblgen/rewriter-static-matcher.td
mlir/test/python/python_test_ops.td
Removed:
################################################################################
diff --git a/flang/include/flang/Optimizer/CodeGen/CGOps.td b/flang/include/flang/Optimizer/CodeGen/CGOps.td
index 2d184b6a13faa..52966dce963a1 100644
--- a/flang/include/flang/Optimizer/CodeGen/CGOps.td
+++ b/flang/include/flang/Optimizer/CodeGen/CGOps.td
@@ -24,7 +24,7 @@ def fircg_Dialect : Dialect {
// Base class for FIR CG operations.
// All operations automatically get a prefix of "fircg.".
-class fircg_Op<string mnemonic, list<OpTrait> traits>
+class fircg_Op<string mnemonic, list<Trait> traits>
: Op<fircg_Dialect, mnemonic, traits>;
// Extended embox operation.
diff --git a/flang/include/flang/Optimizer/Dialect/FIROps.td b/flang/include/flang/Optimizer/Dialect/FIROps.td
index a484d60fa3b95..9ab516ac199cf 100644
--- a/flang/include/flang/Optimizer/Dialect/FIROps.td
+++ b/flang/include/flang/Optimizer/Dialect/FIROps.td
@@ -19,11 +19,11 @@ include "flang/Optimizer/Dialect/FIRTypes.td"
// Base class for FIR operations.
// All operations automatically get a prefix of "fir.".
-class fir_Op<string mnemonic, list<OpTrait> traits>
+class fir_Op<string mnemonic, list<Trait> traits>
: Op<fir_Dialect, mnemonic, traits>;
// Base class for FIR operations that take a single argument
-class fir_SimpleOp<string mnemonic, list<OpTrait> traits>
+class fir_SimpleOp<string mnemonic, list<Trait> traits>
: fir_Op<mnemonic, traits> {
let assemblyFormat = [{
@@ -43,13 +43,13 @@ def fir_OneResultOpBuilder : OpBuilder<(ins
}]>;
// Base class of FIR operations that return 1 result
-class fir_OneResultOp<string mnemonic, list<OpTrait> traits = []> :
+class fir_OneResultOp<string mnemonic, list<Trait> traits = []> :
fir_Op<mnemonic, traits>, Results<(outs fir_Type:$res)> {
let builders = [fir_OneResultOpBuilder];
}
// Base class of FIR operations that have 1 argument and return 1 result
-class fir_SimpleOneResultOp<string mnemonic, list<OpTrait> traits = []> :
+class fir_SimpleOneResultOp<string mnemonic, list<Trait> traits = []> :
fir_SimpleOp<mnemonic, traits> {
let builders = [fir_OneResultOpBuilder];
}
@@ -457,7 +457,7 @@ def fir_ZeroOp : fir_OneResultOp<"zero_bits", [NoSideEffect]> {
// Terminator operations
//===----------------------------------------------------------------------===//
-class fir_SwitchTerminatorOp<string mnemonic, list<OpTrait> traits = []> :
+class fir_SwitchTerminatorOp<string mnemonic, list<Trait> traits = []> :
fir_Op<mnemonic, !listconcat(traits, [AttrSizedOperandSegments,
DeclareOpInterfaceMethods<BranchOpInterface>, Terminator])> {
@@ -523,7 +523,7 @@ class fir_SwitchTerminatorOp<string mnemonic, list<OpTrait> traits = []> :
}
class fir_IntegralSwitchTerminatorOp<string mnemonic,
- list<OpTrait> traits = []> : fir_SwitchTerminatorOp<mnemonic, traits> {
+ list<Trait> traits = []> : fir_SwitchTerminatorOp<mnemonic, traits> {
let skipDefaultBuilders = 1;
let builders = [OpBuilder<(ins "mlir::Value":$selector,
@@ -2029,7 +2029,7 @@ def fir_ResultOp : fir_Op<"result",
def FirRegionTerminator : SingleBlockImplicitTerminator<"ResultOp">;
-class region_Op<string mnemonic, list<OpTrait> traits = []> :
+class region_Op<string mnemonic, list<Trait> traits = []> :
fir_Op<mnemonic,
!listconcat(traits, [FirRegionTerminator, RecursiveSideEffects])> {
let printer = "return ::print(p, *this);";
@@ -2435,7 +2435,7 @@ def fir_StringLitOp : fir_Op<"string_lit", [NoSideEffect]> {
// Complex operations
-class fir_ArithmeticOp<string mnemonic, list<OpTrait> traits = []> :
+class fir_ArithmeticOp<string mnemonic, list<Trait> traits = []> :
fir_Op<mnemonic,
!listconcat(traits, [NoSideEffect, SameOperandsAndResultType])>,
Results<(outs AnyType)> {
@@ -2444,7 +2444,7 @@ class fir_ArithmeticOp<string mnemonic, list<OpTrait> traits = []> :
let printer = "return printBinaryOp(this->getOperation(), p);";
}
-class fir_UnaryArithmeticOp<string mnemonic, list<OpTrait> traits = []> :
+class fir_UnaryArithmeticOp<string mnemonic, list<Trait> traits = []> :
fir_Op<mnemonic,
!listconcat(traits, [NoSideEffect, SameOperandsAndResultType])>,
Results<(outs AnyType)> {
@@ -2479,13 +2479,13 @@ def fir_ConstcOp : fir_Op<"constc", [NoSideEffect]> {
}];
}
-class ComplexUnaryArithmeticOp<string mnemonic, list<OpTrait> traits = []> :
+class ComplexUnaryArithmeticOp<string mnemonic, list<Trait> traits = []> :
fir_UnaryArithmeticOp<mnemonic, traits>,
Arguments<(ins fir_ComplexType:$operand)>;
def fir_NegcOp : ComplexUnaryArithmeticOp<"negc">;
-class ComplexArithmeticOp<string mnemonic, list<OpTrait> traits = []> :
+class ComplexArithmeticOp<string mnemonic, list<Trait> traits = []> :
fir_ArithmeticOp<mnemonic, traits>,
Arguments<(ins fir_ComplexType:$lhs, fir_ComplexType:$rhs)>;
diff --git a/mlir/docs/Tutorials/Toy/Ch-2.md b/mlir/docs/Tutorials/Toy/Ch-2.md
index 2c0389e09d7e0..88fd604e28d4a 100644
--- a/mlir/docs/Tutorials/Toy/Ch-2.md
+++ b/mlir/docs/Tutorials/Toy/Ch-2.md
@@ -369,7 +369,7 @@ dialect.
// * The parent dialect of the operation.
// * The mnemonic for the operation, or the name without the dialect prefix.
// * A list of traits for the operation.
-class Toy_Op<string mnemonic, list<OpTrait> traits = []> :
+class Toy_Op<string mnemonic, list<Trait> traits = []> :
Op<Toy_Dialect, mnemonic, traits>;
```
diff --git a/mlir/examples/standalone/include/Standalone/StandaloneDialect.td b/mlir/examples/standalone/include/Standalone/StandaloneDialect.td
index a7fd789376e22..158860134ea47 100644
--- a/mlir/examples/standalone/include/Standalone/StandaloneDialect.td
+++ b/mlir/examples/standalone/include/Standalone/StandaloneDialect.td
@@ -30,7 +30,7 @@ def Standalone_Dialect : Dialect {
// Base standalone operation definition.
//===----------------------------------------------------------------------===//
-class Standalone_Op<string mnemonic, list<OpTrait> traits = []> :
+class Standalone_Op<string mnemonic, list<Trait> traits = []> :
Op<Standalone_Dialect, mnemonic, traits>;
#endif // STANDALONE_DIALECT
diff --git a/mlir/examples/toy/Ch2/include/toy/Ops.td b/mlir/examples/toy/Ch2/include/toy/Ops.td
index c68ca5bc33d43..eaec24c3ae5bb 100644
--- a/mlir/examples/toy/Ch2/include/toy/Ops.td
+++ b/mlir/examples/toy/Ch2/include/toy/Ops.td
@@ -28,7 +28,7 @@ def Toy_Dialect : Dialect {
// * The parent dialect of the operation.
// * The mnemonic for the operation, or the name without the dialect prefix.
// * A list of traits for the operation.
-class Toy_Op<string mnemonic, list<OpTrait> traits = []> :
+class Toy_Op<string mnemonic, list<Trait> traits = []> :
Op<Toy_Dialect, mnemonic, traits>;
//===----------------------------------------------------------------------===//
diff --git a/mlir/examples/toy/Ch3/include/toy/Ops.td b/mlir/examples/toy/Ch3/include/toy/Ops.td
index cdbef4cb4d8b2..e1b957d4b7d9c 100644
--- a/mlir/examples/toy/Ch3/include/toy/Ops.td
+++ b/mlir/examples/toy/Ch3/include/toy/Ops.td
@@ -27,7 +27,7 @@ def Toy_Dialect : Dialect {
// * The parent dialect of the operation.
// * The mnemonic for the operation, or the name without the dialect prefix.
// * A list of traits for the operation.
-class Toy_Op<string mnemonic, list<OpTrait> traits = []> :
+class Toy_Op<string mnemonic, list<Trait> traits = []> :
Op<Toy_Dialect, mnemonic, traits>;
//===----------------------------------------------------------------------===//
diff --git a/mlir/examples/toy/Ch4/include/toy/Ops.td b/mlir/examples/toy/Ch4/include/toy/Ops.td
index 7f9662cf99293..98ad8786fbb3b 100644
--- a/mlir/examples/toy/Ch4/include/toy/Ops.td
+++ b/mlir/examples/toy/Ch4/include/toy/Ops.td
@@ -30,7 +30,7 @@ def Toy_Dialect : Dialect {
// * The parent dialect of the operation.
// * The mnemonic for the operation, or the name without the dialect prefix.
// * A list of traits for the operation.
-class Toy_Op<string mnemonic, list<OpTrait> traits = []> :
+class Toy_Op<string mnemonic, list<Trait> traits = []> :
Op<Toy_Dialect, mnemonic, traits>;
//===----------------------------------------------------------------------===//
diff --git a/mlir/examples/toy/Ch5/include/toy/Ops.td b/mlir/examples/toy/Ch5/include/toy/Ops.td
index db8181426079f..ea7689cf8acc1 100644
--- a/mlir/examples/toy/Ch5/include/toy/Ops.td
+++ b/mlir/examples/toy/Ch5/include/toy/Ops.td
@@ -30,7 +30,7 @@ def Toy_Dialect : Dialect {
// * The parent dialect of the operation.
// * The mnemonic for the operation, or the name without the dialect prefix.
// * A list of traits for the operation.
-class Toy_Op<string mnemonic, list<OpTrait> traits = []> :
+class Toy_Op<string mnemonic, list<Trait> traits = []> :
Op<Toy_Dialect, mnemonic, traits>;
//===----------------------------------------------------------------------===//
diff --git a/mlir/examples/toy/Ch6/include/toy/Ops.td b/mlir/examples/toy/Ch6/include/toy/Ops.td
index 3af018a50b554..9d4c512036ae0 100644
--- a/mlir/examples/toy/Ch6/include/toy/Ops.td
+++ b/mlir/examples/toy/Ch6/include/toy/Ops.td
@@ -30,7 +30,7 @@ def Toy_Dialect : Dialect {
// * The parent dialect of the operation.
// * The mnemonic for the operation, or the name without the dialect prefix.
// * A list of traits for the operation.
-class Toy_Op<string mnemonic, list<OpTrait> traits = []> :
+class Toy_Op<string mnemonic, list<Trait> traits = []> :
Op<Toy_Dialect, mnemonic, traits>;
//===----------------------------------------------------------------------===//
diff --git a/mlir/examples/toy/Ch7/include/toy/Ops.td b/mlir/examples/toy/Ch7/include/toy/Ops.td
index 77371496e47bb..4f89ed0742e8f 100644
--- a/mlir/examples/toy/Ch7/include/toy/Ops.td
+++ b/mlir/examples/toy/Ch7/include/toy/Ops.td
@@ -34,7 +34,7 @@ def Toy_Dialect : Dialect {
// * The parent dialect of the operation.
// * The mnemonic for the operation, or the name without the dialect prefix.
// * A list of traits for the operation.
-class Toy_Op<string mnemonic, list<OpTrait> traits = []> :
+class Toy_Op<string mnemonic, list<Trait> traits = []> :
Op<Toy_Dialect, mnemonic, traits>;
// Provide a definition for the Toy StructType for use in ODS. This allows for
diff --git a/mlir/include/mlir/Dialect/AMX/AMX.td b/mlir/include/mlir/Dialect/AMX/AMX.td
index 7dbbc888dad08..0d23cde90949f 100644
--- a/mlir/include/mlir/Dialect/AMX/AMX.td
+++ b/mlir/include/mlir/Dialect/AMX/AMX.td
@@ -61,11 +61,11 @@ def AMX_Dialect : Dialect {
// AMX Op and IntrOp definitions.
//===----------------------------------------------------------------------===//
-class AMX_Op<string mnemonic, list<OpTrait> traits = []> :
+class AMX_Op<string mnemonic, list<Trait> traits = []> :
Op<AMX_Dialect, mnemonic, traits> {}
// The "internal" intrinsics are meant for compiler usage.
-class AMX_IntrOp<string mnemonic, int numResults, list<OpTrait> traits = []> :
+class AMX_IntrOp<string mnemonic, int numResults, list<Trait> traits = []> :
LLVM_IntrOpBase<AMX_Dialect, mnemonic,
"x86_" # !subst(".", "_", mnemonic) # "_internal",
[], [], traits, numResults>;
diff --git a/mlir/include/mlir/Dialect/Affine/IR/AffineOps.td b/mlir/include/mlir/Dialect/Affine/IR/AffineOps.td
index 53b58fa23d342..6ef2d1c63ebba 100644
--- a/mlir/include/mlir/Dialect/Affine/IR/AffineOps.td
+++ b/mlir/include/mlir/Dialect/Affine/IR/AffineOps.td
@@ -27,7 +27,7 @@ def Affine_Dialect : Dialect {
}
// Base class for Affine dialect ops.
-class Affine_Op<string mnemonic, list<OpTrait> traits = []> :
+class Affine_Op<string mnemonic, list<Trait> traits = []> :
Op<Affine_Dialect, mnemonic, traits> {
// For every affine op, there needs to be a:
// * void print(OpAsmPrinter &p, ${C++ class of Op} op)
@@ -475,7 +475,7 @@ def AffineIfOp : Affine_Op<"if",
let hasFolder = 1;
}
-class AffineLoadOpBase<string mnemonic, list<OpTrait> traits = []> :
+class AffineLoadOpBase<string mnemonic, list<Trait> traits = []> :
Affine_Op<mnemonic, !listconcat(traits,
[DeclareOpInterfaceMethods<AffineReadOpInterface>,
DeclareOpInterfaceMethods<AffineMapAccessInterface>,
@@ -540,7 +540,7 @@ def AffineLoadOp : AffineLoadOpBase<"load"> {
let hasFolder = 1;
}
-class AffineMinMaxOpBase<string mnemonic, list<OpTrait> traits = []> :
+class AffineMinMaxOpBase<string mnemonic, list<Trait> traits = []> :
Op<Affine_Dialect, mnemonic, traits> {
let arguments = (ins AffineMapAttr:$map, Variadic<Index>:$operands);
let results = (outs Index);
@@ -834,7 +834,7 @@ def AffinePrefetchOp : Affine_Op<"prefetch",
let hasFolder = 1;
}
-class AffineStoreOpBase<string mnemonic, list<OpTrait> traits = []> :
+class AffineStoreOpBase<string mnemonic, list<Trait> traits = []> :
Affine_Op<mnemonic, !listconcat(traits,
[DeclareOpInterfaceMethods<AffineWriteOpInterface>,
DeclareOpInterfaceMethods<AffineMapAccessInterface>,
diff --git a/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.td b/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.td
index b7eb2730136ef..496c92db50813 100644
--- a/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.td
+++ b/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.td
@@ -18,7 +18,7 @@ include "mlir/IR/OpAsmInterface.td"
// Base class for Arithmetic dialect ops. Ops in this dialect have no side
// effects and can be applied element-wise to vectors and tensors.
-class Arith_Op<string mnemonic, list<OpTrait> traits = []> :
+class Arith_Op<string mnemonic, list<Trait> traits = []> :
Op<Arithmetic_Dialect, mnemonic, traits # [NoSideEffect,
DeclareOpInterfaceMethods<VectorUnrollOpInterface>] #
ElementwiseMappable.traits>;
@@ -26,41 +26,41 @@ class Arith_Op<string mnemonic, list<OpTrait> traits = []> :
// Base class for integer and floating point arithmetic ops. All ops have one
// result, require operands and results to be of the same type, and can accept
// tensors or vectors of integers or floats.
-class Arith_ArithmeticOp<string mnemonic, list<OpTrait> traits = []> :
+class Arith_ArithmeticOp<string mnemonic, list<Trait> traits = []> :
Arith_Op<mnemonic, traits # [SameOperandsAndResultType]>;
// Base class for unary arithmetic operations.
-class Arith_UnaryOp<string mnemonic, list<OpTrait> traits = []> :
+class Arith_UnaryOp<string mnemonic, list<Trait> traits = []> :
Arith_ArithmeticOp<mnemonic, traits> {
let assemblyFormat = "$operand attr-dict `:` type($result)";
}
// Base class for binary arithmetic operations.
-class Arith_BinaryOp<string mnemonic, list<OpTrait> traits = []> :
+class Arith_BinaryOp<string mnemonic, list<Trait> traits = []> :
Arith_ArithmeticOp<mnemonic, traits> {
let assemblyFormat = "$lhs `,` $rhs attr-dict `:` type($result)";
}
// Base class for ternary arithmetic operations.
-class Arith_TernaryOp<string mnemonic, list<OpTrait> traits = []> :
+class Arith_TernaryOp<string mnemonic, list<Trait> traits = []> :
Arith_ArithmeticOp<mnemonic, traits> {
let assemblyFormat = "$a `,` $b `,` $c attr-dict `:` type($result)";
}
// Base class for integer binary operations.
-class Arith_IntBinaryOp<string mnemonic, list<OpTrait> traits = []> :
+class Arith_IntBinaryOp<string mnemonic, list<Trait> traits = []> :
Arith_BinaryOp<mnemonic, traits>,
Arguments<(ins SignlessIntegerLike:$lhs, SignlessIntegerLike:$rhs)>,
Results<(outs SignlessIntegerLike:$result)>;
// Base class for floating point unary operations.
-class Arith_FloatUnaryOp<string mnemonic, list<OpTrait> traits = []> :
+class Arith_FloatUnaryOp<string mnemonic, list<Trait> traits = []> :
Arith_UnaryOp<mnemonic, traits>,
Arguments<(ins FloatLike:$operand)>,
Results<(outs FloatLike:$result)>;
// Base class for floating point binary operations.
-class Arith_FloatBinaryOp<string mnemonic, list<OpTrait> traits = []> :
+class Arith_FloatBinaryOp<string mnemonic, list<Trait> traits = []> :
Arith_BinaryOp<mnemonic, traits>,
Arguments<(ins FloatLike:$lhs, FloatLike:$rhs)>,
Results<(outs FloatLike:$result)>;
@@ -68,7 +68,7 @@ class Arith_FloatBinaryOp<string mnemonic, list<OpTrait> traits = []> :
// Base class for arithmetic cast operations. Requires a single operand and
// result. If either is a shaped type, then the other must be of the same shape.
class Arith_CastOp<string mnemonic, TypeConstraint From, TypeConstraint To,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
Arith_Op<mnemonic, traits # [SameOperandsAndResultShape,
DeclareOpInterfaceMethods<CastOpInterface>]>,
Arguments<(ins From:$in)>,
@@ -91,23 +91,23 @@ def SignlessFixedWidthIntegerLike : TypeConstraint<Or<[
"signless-fixed-width-integer-like">;
// Cast from an integer type to another integer type.
-class Arith_IToICastOp<string mnemonic, list<OpTrait> traits = []> :
+class Arith_IToICastOp<string mnemonic, list<Trait> traits = []> :
Arith_CastOp<mnemonic, SignlessFixedWidthIntegerLike,
SignlessFixedWidthIntegerLike, traits>;
// Cast from an integer type to a floating point type.
-class Arith_IToFCastOp<string mnemonic, list<OpTrait> traits = []> :
+class Arith_IToFCastOp<string mnemonic, list<Trait> traits = []> :
Arith_CastOp<mnemonic, SignlessFixedWidthIntegerLike, FloatLike, traits>;
// Cast from a floating point type to an integer type.
-class Arith_FToICastOp<string mnemonic, list<OpTrait> traits = []> :
+class Arith_FToICastOp<string mnemonic, list<Trait> traits = []> :
Arith_CastOp<mnemonic, FloatLike, SignlessFixedWidthIntegerLike, traits>;
// Cast from a floating point type to another floating point type.
-class Arith_FToFCastOp<string mnemonic, list<OpTrait> traits = []> :
+class Arith_FToFCastOp<string mnemonic, list<Trait> traits = []> :
Arith_CastOp<mnemonic, FloatLike, FloatLike, traits>;
// Base class for compare operations. Requires two operands of the same type
// and returns a single `BoolLike` result. If the operand type is a vector or
// tensor, then the result will be one of `i1` of the same shape.
-class Arith_CompareOp<string mnemonic, list<OpTrait> traits = []> :
+class Arith_CompareOp<string mnemonic, list<Trait> traits = []> :
Arith_Op<mnemonic, traits # [SameTypeOperands, TypesMatchWith<
"result type has i1 element type and same shape as operands",
"lhs", "result", "::getI1SameShape($_self)">]> {
@@ -118,7 +118,7 @@ class Arith_CompareOp<string mnemonic, list<OpTrait> traits = []> :
// Just like `Arith_CompareOp` but also admits 0-D vectors. Introduced
// temporarily to allow gradual transition to 0-D vectors.
-class Arith_CompareOpOfAnyRank<string mnemonic, list<OpTrait> traits = []> :
+class Arith_CompareOpOfAnyRank<string mnemonic, list<Trait> traits = []> :
Arith_CompareOp<mnemonic, traits> {
let results = (outs BoolLikeOfAnyRank:$result);
}
diff --git a/mlir/include/mlir/Dialect/ArmNeon/ArmNeon.td b/mlir/include/mlir/Dialect/ArmNeon/ArmNeon.td
index 98168d75779e4..e15cc6309c883 100644
--- a/mlir/include/mlir/Dialect/ArmNeon/ArmNeon.td
+++ b/mlir/include/mlir/Dialect/ArmNeon/ArmNeon.td
@@ -38,7 +38,7 @@ def ArmNeon_Dialect : Dialect {
// intrinsic.
class ArmNeon_IntrOp<string mnemonic, list<int> overloadedResults,
list<int> overloadedOperands, int numResults,
- list<OpTrait> traits = [], bit requiresAccessGroup = 0,
+ list<Trait> traits = [], bit requiresAccessGroup = 0,
bit requiresAliasScope = 0>
: LLVM_IntrOpBase</*dialect=*/ArmNeon_Dialect,
/*opName=*/"intr." # mnemonic,
@@ -53,14 +53,14 @@ class ArmNeon_IntrOp<string mnemonic, list<int> overloadedResults,
// ArmNeon dialect op that corresponds to an LLVM IR intrinsic with one
// overloaded result.
class ArmNeon_OverloadedOneResultIntrOp<string mnemonic,
- list<OpTrait> traits = []>
+ list<Trait> traits = []>
: ArmNeon_IntrOp<mnemonic, [0], [], 1, traits>;
// ArmNeon dialect op that corresponds to an LLVM IR intrinsic with one
// overloaded result and overloaded operands list.
class ArmNeon_OverloadedOperandsWithOneResultIntrOp<string mnemonic,
list<int> overloadedOperands,
- list<OpTrait> traits = []>
+ list<Trait> traits = []>
: ArmNeon_IntrOp<mnemonic, [0], overloadedOperands, 1, traits>;
def SMullOp : ArmNeon_OverloadedOneResultIntrOp<"smull", [
@@ -120,7 +120,7 @@ def SdotOp : ArmNeon_OverloadedOperandsWithOneResultIntrOp<"sdot",[1], [
"$a `,` $b `,` $c attr-dict `:` type($b) `,` type($c) `to` type($res)";
}
-class ArmNeon_2dOp<string mnemonic, list<OpTrait> traits = []>
+class ArmNeon_2dOp<string mnemonic, list<Trait> traits = []>
: Op</*dialect=*/ArmNeon_Dialect,
/*opName=*/"2d." # mnemonic,
/*traits=*/traits>;
diff --git a/mlir/include/mlir/Dialect/ArmSVE/ArmSVE.td b/mlir/include/mlir/Dialect/ArmSVE/ArmSVE.td
index 19dcfabe972ba..d3ff0584f4b19 100644
--- a/mlir/include/mlir/Dialect/ArmSVE/ArmSVE.td
+++ b/mlir/include/mlir/Dialect/ArmSVE/ArmSVE.td
@@ -34,21 +34,21 @@ def ArmSVE_Dialect : Dialect {
// ArmSVE op definitions
//===----------------------------------------------------------------------===//
-class ArmSVE_Op<string mnemonic, list<OpTrait> traits = []> :
+class ArmSVE_Op<string mnemonic, list<Trait> traits = []> :
Op<ArmSVE_Dialect, mnemonic, traits> {}
class ArmSVE_IntrBinaryOverloadedOp<string mnemonic,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
LLVM_IntrOpBase</*Dialect dialect=*/ArmSVE_Dialect,
/*string opName=*/"intr." # mnemonic,
/*string enumName=*/"aarch64_sve_" # !subst(".", "_", mnemonic),
/*list<int> overloadedResults=*/[0],
/*list<int> overloadedOperands=*/[], // defined by result overload
- /*list<OpTrait> traits=*/traits,
+ /*list<Trait> traits=*/traits,
/*int numResults=*/1>;
class ScalableMaskedFOp<string mnemonic, string op_description,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
ArmSVE_Op<mnemonic, !listconcat(traits,
[AllTypesMatch<["src1", "src2", "res"]>,
TypesMatchWith<
@@ -71,7 +71,7 @@ class ScalableMaskedFOp<string mnemonic, string op_description,
}
class ScalableMaskedIOp<string mnemonic, string op_description,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
ArmSVE_Op<mnemonic, !listconcat(traits,
[AllTypesMatch<["src1", "src2", "res"]>,
TypesMatchWith<
diff --git a/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td b/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
index 8f132043f3bb4..eef3b6178abd2 100644
--- a/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
+++ b/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
@@ -23,7 +23,7 @@ include "mlir/Interfaces/SideEffectInterfaces.td"
//===----------------------------------------------------------------------===//
// Base class for the operation in this dialect
-class Async_Op<string mnemonic, list<OpTrait> traits = []> :
+class Async_Op<string mnemonic, list<Trait> traits = []> :
Op<AsyncDialect, mnemonic, traits>;
def Async_ExecuteOp :
diff --git a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td
index 1a76f8b3eea00..7e52273ea4695 100644
--- a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td
+++ b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td
@@ -15,7 +15,7 @@ include "mlir/Dialect/Bufferization/IR/BufferizationBase.td"
include "mlir/Interfaces/SideEffectInterfaces.td"
include "mlir/Interfaces/CopyOpInterface.td"
-class Bufferization_Op<string mnemonic, list<OpTrait> traits = []>
+class Bufferization_Op<string mnemonic, list<Trait> traits = []>
: Op<Bufferization_Dialect, mnemonic, traits>;
//===----------------------------------------------------------------------===//
diff --git a/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td b/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td
index a79d7ac8a2157..cda6dc6936cd7 100644
--- a/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td
+++ b/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td
@@ -14,13 +14,13 @@ include "mlir/IR/OpAsmInterface.td"
include "mlir/Interfaces/InferTypeOpInterface.td"
include "mlir/Interfaces/SideEffectInterfaces.td"
-class Complex_Op<string mnemonic, list<OpTrait> traits = []>
+class Complex_Op<string mnemonic, list<Trait> traits = []>
: Op<Complex_Dialect, mnemonic, traits>;
// Base class for standard arithmetic operations on complex numbers with a
// floating-point element type. These operations take two operands and return
// one result, all of which must be complex numbers of the same type.
-class ComplexArithmeticOp<string mnemonic, list<OpTrait> traits = []> :
+class ComplexArithmeticOp<string mnemonic, list<Trait> traits = []> :
Complex_Op<mnemonic, traits # [NoSideEffect, SameOperandsAndResultType,
Elementwise]> {
let arguments = (ins Complex<AnyFloat>:$lhs, Complex<AnyFloat>:$rhs);
@@ -32,7 +32,7 @@ class ComplexArithmeticOp<string mnemonic, list<OpTrait> traits = []> :
// Base class for standard unary operations on complex numbers with a
// floating-point element type. These operations take one operand and return
// one result; the operand must be a complex number.
-class ComplexUnaryOp<string mnemonic, list<OpTrait> traits = []> :
+class ComplexUnaryOp<string mnemonic, list<Trait> traits = []> :
Complex_Op<mnemonic, traits # [NoSideEffect, Elementwise]> {
let arguments = (ins Complex<AnyFloat>:$complex);
let assemblyFormat = "$complex attr-dict `:` type($complex)";
diff --git a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
index 93e67f34547bf..6829bfde8fb2c 100644
--- a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
+++ b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
@@ -23,7 +23,7 @@ include "mlir/Interfaces/SideEffectInterfaces.td"
//===----------------------------------------------------------------------===//
// Base class for EmitC dialect ops.
-class EmitC_Op<string mnemonic, list<OpTrait> traits = []>
+class EmitC_Op<string mnemonic, list<Trait> traits = []>
: Op<EmitC_Dialect, mnemonic, traits> {
let verifier = "return ::verify(*this);";
}
diff --git a/mlir/include/mlir/Dialect/GPU/GPUOps.td b/mlir/include/mlir/Dialect/GPU/GPUOps.td
index c76772b4470d3..e59646b1975a7 100644
--- a/mlir/include/mlir/Dialect/GPU/GPUOps.td
+++ b/mlir/include/mlir/Dialect/GPU/GPUOps.td
@@ -26,7 +26,7 @@ include "mlir/Interfaces/SideEffectInterfaces.td"
// GPU Dialect operations.
//===----------------------------------------------------------------------===//
-class GPU_Op<string mnemonic, list<OpTrait> traits = []> :
+class GPU_Op<string mnemonic, list<Trait> traits = []> :
Op<GPU_Dialect, mnemonic, traits>;
def GPU_Dimension : I32EnumAttr<"Dimension",
@@ -41,7 +41,7 @@ def GPU_Dimension : I32EnumAttr<"Dimension",
}
def GPU_DimensionAttr : EnumAttr<GPU_Dialect, GPU_Dimension, "dim">;
-class GPU_IndexOp<string mnemonic, list<OpTrait> traits = []> :
+class GPU_IndexOp<string mnemonic, list<Trait> traits = []> :
GPU_Op<mnemonic, !listconcat(traits, [NoSideEffect])>,
Arguments<(ins GPU_DimensionAttr:$dimension)>, Results<(outs Index)> {
let assemblyFormat = "$dimension attr-dict";
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
index 386bd76bf1d59..a2d541a66d45c 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
@@ -158,7 +158,7 @@ class LLVM_ScalarOrVectorOf<Type element> :
// Base class for LLVM operations. Defines the interface to the llvm::IRBuilder
// used to translate to LLVM IR proper.
-class LLVM_OpBase<Dialect dialect, string mnemonic, list<OpTrait> traits = []> :
+class LLVM_OpBase<Dialect dialect, string mnemonic, list<Trait> traits = []> :
Op<dialect, mnemonic, traits> {
// A pattern for constructing the LLVM IR Instruction (or other Value) that
// corresponds to this op. This pattern can use `builder` to refer to an
@@ -182,7 +182,7 @@ class LLVM_OpBase<Dialect dialect, string mnemonic, list<OpTrait> traits = []> :
// their name automatically. LLVM operations have either zero or one result,
// this class is specialized below for both cases and should not be used
// directly.
-class LLVM_Op<string mnemonic, list<OpTrait> traits = []> :
+class LLVM_Op<string mnemonic, list<Trait> traits = []> :
LLVM_OpBase<LLVM_Dialect, mnemonic, traits>;
// Case of the LLVM enum attribute backed by I64Attr with customized string
@@ -256,7 +256,7 @@ def LLVM_IntrPatterns {
// `llvm::Intrinsic` enum; one usually wants these to be related.
class LLVM_IntrOpBase<Dialect dialect, string opName, string enumName,
list<int> overloadedResults, list<int> overloadedOperands,
- list<OpTrait> traits, int numResults,
+ list<Trait> traits, int numResults,
bit requiresAccessGroup = 0, bit requiresAliasScope = 0>
: LLVM_OpBase<dialect, opName, traits>,
Results<!if(!gt(numResults, 0), (outs LLVM_Type:$res), (outs))> {
@@ -287,7 +287,7 @@ class LLVM_IntrOpBase<Dialect dialect, string opName, string enumName,
// Base class for LLVM intrinsic operations, should not be used directly. Places
// the intrinsic into the LLVM dialect and prefixes its name with "intr.".
class LLVM_IntrOp<string mnem, list<int> overloadedResults,
- list<int> overloadedOperands, list<OpTrait> traits,
+ list<int> overloadedOperands, list<Trait> traits,
int numResults, bit requiresAccessGroup = 0,
bit requiresAliasScope = 0>
: LLVM_IntrOpBase<LLVM_Dialect, "intr." # mnem, !subst(".", "_", mnem),
@@ -309,7 +309,7 @@ class LLVM_IntrOp<string mnem, list<int> overloadedResults,
// one (as indicated by `[0]`) is necessary to resolve the overloaded intrinsic.
// The Op has no results.
class LLVM_ZeroResultIntrOp<string mnem, list<int> overloadedOperands = [],
- list<OpTrait> traits = []>
+ list<Trait> traits = []>
: LLVM_IntrOp<mnem, [], overloadedOperands, traits, 0>;
// Base class for LLVM intrinsic operations returning one result. Places the
@@ -320,7 +320,7 @@ class LLVM_ZeroResultIntrOp<string mnem, list<int> overloadedOperands = [],
// empty otherwise.
class LLVM_OneResultIntrOp<string mnem, list<int> overloadedResults = [],
list<int> overloadedOperands = [],
- list<OpTrait> traits = []>
+ list<Trait> traits = []>
: LLVM_IntrOp<mnem, overloadedResults, overloadedOperands, traits, 1>;
// LLVM vector reduction over a single vector.
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
index 5bd438f1c0f02..1d21d5f8ebbd2 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
@@ -112,12 +112,12 @@ def LLVM_TerminatorPassthroughOpBuilder :
// Base class for LLVM terminator operations. All terminator operations have
// zero results and an optional list of successors.
-class LLVM_TerminatorOp<string mnemonic, list<OpTrait> traits = []> :
+class LLVM_TerminatorOp<string mnemonic, list<Trait> traits = []> :
LLVM_Op<mnemonic, !listconcat(traits, [Terminator])>;
// Class for arithmetic binary operations.
class LLVM_ArithmeticOpBase<Type type, string mnemonic,
- string builderFunc, list<OpTrait> traits = []> :
+ string builderFunc, list<Trait> traits = []> :
LLVM_Op<mnemonic,
!listconcat([NoSideEffect, SameOperandsAndResultType], traits)>,
LLVM_Builder<"$res = builder." # builderFunc # "($lhs, $rhs);"> {
@@ -128,12 +128,12 @@ class LLVM_ArithmeticOpBase<Type type, string mnemonic,
let assemblyFormat = "$lhs `,` $rhs custom<LLVMOpAttrs>(attr-dict) `:` type($res)";
}
class LLVM_IntArithmeticOp<string mnemonic, string builderFunc,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
LLVM_ArithmeticOpBase<AnyInteger, mnemonic, builderFunc, traits> {
let arguments = commonArgs;
}
class LLVM_FloatArithmeticOp<string mnemonic, string builderFunc,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
LLVM_ArithmeticOpBase<LLVM_AnyFloat, mnemonic, builderFunc,
!listconcat([DeclareOpInterfaceMethods<FastmathFlagsInterface>], traits)> {
dag fmfArg = (ins DefaultValuedAttr<LLVM_FMFAttr, "{}">:$fastmathFlags);
@@ -142,7 +142,7 @@ class LLVM_FloatArithmeticOp<string mnemonic, string builderFunc,
// Class for arithmetic unary operations.
class LLVM_UnaryFloatArithmeticOp<Type type, string mnemonic,
- string builderFunc, list<OpTrait> traits = []> :
+ string builderFunc, list<Trait> traits = []> :
LLVM_Op<mnemonic,
!listconcat([NoSideEffect, SameOperandsAndResultType, DeclareOpInterfaceMethods<FastmathFlagsInterface>], traits)>,
LLVM_Builder<"$res = builder." # builderFunc # "($operand);"> {
@@ -415,7 +415,7 @@ def LLVM_StoreOp : LLVM_Op<"store">, MemoryOpWithAlignmentAndAttributes {
// Casts.
class LLVM_CastOp<string mnemonic, string builderFunc, Type type,
- Type resultType, list<OpTrait> traits = []> :
+ Type resultType, list<Trait> traits = []> :
LLVM_Op<mnemonic, !listconcat([NoSideEffect], traits)>,
LLVM_Builder<"$res = builder." # builderFunc # "($arg, $_resultType);"> {
let arguments = (ins type:$arg);
@@ -1411,31 +1411,31 @@ def LLVM_ConstantOp
// operations and intrinsics. However, we systematically prefix them with
// "intr." to avoid potential name clashes.
-class LLVM_UnaryIntrinsicOp<string func, list<OpTrait> traits = []> :
+class LLVM_UnaryIntrinsicOp<string func, list<Trait> traits = []> :
LLVM_OneResultIntrOp<func, [], [0],
!listconcat([NoSideEffect, SameOperandsAndResultType], traits)> {
let arguments = (ins LLVM_Type:$in);
}
-class LLVM_BinarySameArgsIntrinsicOp<string func, list<OpTrait> traits = []> :
+class LLVM_BinarySameArgsIntrinsicOp<string func, list<Trait> traits = []> :
LLVM_OneResultIntrOp<func, [], [0],
!listconcat([NoSideEffect, SameOperandsAndResultType], traits)> {
let arguments = (ins LLVM_Type:$a, LLVM_Type:$b);
}
-class LLVM_BinaryIntrinsicOp<string func, list<OpTrait> traits = []> :
+class LLVM_BinaryIntrinsicOp<string func, list<Trait> traits = []> :
LLVM_OneResultIntrOp<func, [], [0,1],
!listconcat([NoSideEffect], traits)> {
let arguments = (ins LLVM_Type:$a, LLVM_Type:$b);
}
-class LLVM_TernarySameArgsIntrinsicOp<string func, list<OpTrait> traits = []> :
+class LLVM_TernarySameArgsIntrinsicOp<string func, list<Trait> traits = []> :
LLVM_OneResultIntrOp<func, [], [0],
!listconcat([NoSideEffect, SameOperandsAndResultType], traits)> {
let arguments = (ins LLVM_Type:$a, LLVM_Type:$b, LLVM_Type:$c);
}
-class LLVM_CountZerosIntrinsicOp<string func, list<OpTrait> traits = []> :
+class LLVM_CountZerosIntrinsicOp<string func, list<Trait> traits = []> :
LLVM_OneResultIntrOp<func, [], [0],
!listconcat([NoSideEffect], traits)> {
let arguments = (ins LLVM_Type:$in, I<1>:$zero_undefined);
diff --git a/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td
index 6111ec0383793..d26a0b2c6f30b 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td
@@ -43,7 +43,7 @@ def NVVM_Dialect : Dialect {
// NVVM op definitions
//===----------------------------------------------------------------------===//
-class NVVM_Op<string mnemonic, list<OpTrait> traits = []> :
+class NVVM_Op<string mnemonic, list<Trait> traits = []> :
LLVM_OpBase<NVVM_Dialect, mnemonic, traits> {
}
@@ -52,7 +52,7 @@ class NVVM_Op<string mnemonic, list<OpTrait> traits = []> :
//===----------------------------------------------------------------------===//
class NVVM_IntrOp<string mnem, list<int> overloadedResults,
- list<int> overloadedOperands, list<OpTrait> traits,
+ list<int> overloadedOperands, list<Trait> traits,
int numResults>
: LLVM_IntrOpBase<NVVM_Dialect, mnem, "nvvm_" # !subst(".", "_", mnem),
overloadedResults, overloadedOperands, traits, numResults>;
@@ -63,7 +63,7 @@ class NVVM_IntrOp<string mnem, list<int> overloadedResults,
//===----------------------------------------------------------------------===//
class NVVM_SpecialRegisterOp<string mnemonic,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
NVVM_IntrOp<mnemonic, [], [], !listconcat(traits, [NoSideEffect]), 1>,
Arguments<(ins)> {
let assemblyFormat = "attr-dict `:` type($res)";
diff --git a/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td b/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td
index c594d3f2f8c36..45642da7426ae 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td
@@ -37,7 +37,7 @@ def ROCDL_Dialect : Dialect {
// ROCDL op definitions
//===----------------------------------------------------------------------===//
-class ROCDL_Op<string mnemonic, list<OpTrait> traits = []> :
+class ROCDL_Op<string mnemonic, list<Trait> traits = []> :
LLVM_OpBase<ROCDL_Dialect, mnemonic, traits> {
}
@@ -46,7 +46,7 @@ class ROCDL_Op<string mnemonic, list<OpTrait> traits = []> :
//===----------------------------------------------------------------------===//
class ROCDL_SpecialRegisterOp<string mnemonic,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
ROCDL_Op<mnemonic, !listconcat(traits, [NoSideEffect])>,
Results<(outs LLVM_Type:$res)>, Arguments<(ins)> {
string llvmBuilder = "$res = createIntrinsicCall(builder,"
@@ -55,7 +55,7 @@ class ROCDL_SpecialRegisterOp<string mnemonic,
}
class ROCDL_DeviceFunctionOp<string mnemonic, string device_function,
- int parameter, list<OpTrait> traits = []> :
+ int parameter, list<Trait> traits = []> :
ROCDL_Op<mnemonic, !listconcat(traits, [NoSideEffect])>,
Results<(outs LLVM_Type:$res)>, Arguments<(ins)> {
string llvmBuilder = "$res = createDeviceFunctionCall(builder, \""
@@ -113,7 +113,7 @@ def ROCDL_BarrierOp : ROCDL_Op<"barrier"> {
//===---------------------------------------------------------------------===//
// Xdlops intrinsics
-class ROCDL_Mfma_IntrOp<string mnemonic, list<OpTrait> traits = []> :
+class ROCDL_Mfma_IntrOp<string mnemonic, list<Trait> traits = []> :
LLVM_IntrOpBase<ROCDL_Dialect, mnemonic,
"amdgcn_" # !subst(".","_", mnemonic),
[], [], traits, 1>,
diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
index 4150dee567fc7..525d0d637c341 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
@@ -21,7 +21,7 @@ include "mlir/Interfaces/SideEffectInterfaces.td"
include "mlir/Interfaces/ViewLikeInterface.td"
// Base class for Linalg dialect ops that do not correspond to library calls.
-class Linalg_Op<string mnemonic, list<OpTrait> traits = []> :
+class Linalg_Op<string mnemonic, list<Trait> traits = []> :
Op<Linalg_Dialect, mnemonic, traits> {
// For every linalg op, there needs to be a:
// * void print(OpAsmPrinter &p, ${C++ class of Op} op)
diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
index 9ea1a0bd3805b..f8a771f9e7c48 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
@@ -24,7 +24,7 @@ include "mlir/Interfaces/SideEffectInterfaces.td"
// Linalg ops that correspond to library calls operate on ShapedType as their
// first operands. These may be optionally followed by non-view operands
// depending on the specific Linalg op.
-class LinalgStructuredBase_Op<string mnemonic, list<OpTrait> props>
+class LinalgStructuredBase_Op<string mnemonic, list<Trait> props>
: Op<Linalg_Dialect, mnemonic, !listconcat([
SingleBlockImplicitTerminator<"YieldOp">,
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>,
@@ -44,7 +44,7 @@ class LinalgStructuredBase_Op<string mnemonic, list<OpTrait> props>
}];
}
-class LinalgStructured_Op<string mnemonic, list<OpTrait> props>
+class LinalgStructured_Op<string mnemonic, list<Trait> props>
: LinalgStructuredBase_Op<mnemonic, !listconcat(props, [])> {
code structuredOpsDecls = structuredOpsBaseDecls # [{
std::string getLibraryCallName() {
diff --git a/mlir/include/mlir/Dialect/Math/IR/MathOps.td b/mlir/include/mlir/Dialect/Math/IR/MathOps.td
index b0f5d97457ecb..d0bfdf4544782 100644
--- a/mlir/include/mlir/Dialect/Math/IR/MathOps.td
+++ b/mlir/include/mlir/Dialect/Math/IR/MathOps.td
@@ -16,7 +16,7 @@ include "mlir/Interfaces/SideEffectInterfaces.td"
// Base class for math dialect ops. Ops in this dialect have no side effects and
// can be applied element-wise to vectors and tensors.
-class Math_Op<string mnemonic, list<OpTrait> traits = []> :
+class Math_Op<string mnemonic, list<Trait> traits = []> :
Op<Math_Dialect, mnemonic, traits # [NoSideEffect,
DeclareOpInterfaceMethods<VectorUnrollOpInterface>] #
ElementwiseMappable.traits>;
@@ -24,7 +24,7 @@ class Math_Op<string mnemonic, list<OpTrait> traits = []> :
// Base class for unary math operations on integer types. Require a operand and
// result of the same type. This type can be an integer type, or vector or tensor
// thereof.
-class Math_IntegerUnaryOp<string mnemonic, list<OpTrait> traits = []> :
+class Math_IntegerUnaryOp<string mnemonic, list<Trait> traits = []> :
Math_Op<mnemonic, traits # [SameOperandsAndResultType]> {
let arguments = (ins SignlessIntegerLike:$operand);
let results = (outs SignlessIntegerLike:$result);
@@ -35,7 +35,7 @@ class Math_IntegerUnaryOp<string mnemonic, list<OpTrait> traits = []> :
// Base class for unary math operations on floating point types. Require a
// operand and result of the same type. This type can be a floating point type,
// or vector or tensor thereof.
-class Math_FloatUnaryOp<string mnemonic, list<OpTrait> traits = []> :
+class Math_FloatUnaryOp<string mnemonic, list<Trait> traits = []> :
Math_Op<mnemonic, traits # [SameOperandsAndResultType]> {
let arguments = (ins FloatLike:$operand);
let results = (outs FloatLike:$result);
@@ -46,7 +46,7 @@ class Math_FloatUnaryOp<string mnemonic, list<OpTrait> traits = []> :
// Base class for binary math operations on floating point types. Require two
// operands and one result of the same type. This type can be a floating point
// type, or a vector or tensor thereof.
-class Math_FloatBinaryOp<string mnemonic, list<OpTrait> traits = []> :
+class Math_FloatBinaryOp<string mnemonic, list<Trait> traits = []> :
Math_Op<mnemonic, traits # [SameOperandsAndResultType]> {
let arguments = (ins FloatLike:$lhs, FloatLike:$rhs);
let results = (outs FloatLike:$result);
@@ -57,7 +57,7 @@ class Math_FloatBinaryOp<string mnemonic, list<OpTrait> traits = []> :
// Base class for floating point ternary operations. Require three operands and
// one result of the same type. This type can be a floating point type, or a
// vector or tensor thereof.
-class Math_FloatTernaryOp<string mnemonic, list<OpTrait> traits = []> :
+class Math_FloatTernaryOp<string mnemonic, list<Trait> traits = []> :
Math_Op<mnemonic, traits # [SameOperandsAndResultType]> {
let arguments = (ins FloatLike:$a, FloatLike:$b, FloatLike:$c);
let results = (outs FloatLike:$result);
diff --git a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
index b4a7002726ce6..6bcefdcc6ca3e 100644
--- a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
+++ b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
@@ -25,7 +25,7 @@ def MemRefTypeAttr
let constBuilderCall = "::mlir::TypeAttr::get($0)";
}
-class MemRef_Op<string mnemonic, list<OpTrait> traits = []>
+class MemRef_Op<string mnemonic, list<Trait> traits = []>
: Op<MemRef_Dialect, mnemonic, traits> {
let printer = [{ return ::print(p, *this); }];
let verifier = [{ return ::verify(*this); }];
@@ -42,7 +42,7 @@ class MemRef_Op<string mnemonic, list<OpTrait> traits = []>
//
class AllocLikeOp<string mnemonic,
Resource resource,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
MemRef_Op<mnemonic,
!listconcat([
AttrSizedOperandSegments
@@ -1166,7 +1166,7 @@ def MemRef_ReshapeOp: MemRef_Op<"reshape", [
// ExpandShapeOp / CollapseShapeOp
//===----------------------------------------------------------------------===//
-class MemRef_ReassociativeReshapeOp<string mnemonic, list<OpTrait> traits = []> :
+class MemRef_ReassociativeReshapeOp<string mnemonic, list<Trait> traits = []> :
MemRef_Op<mnemonic, !listconcat(traits,
[NoSideEffect, ViewLikeOpInterface])>,
Arguments<(ins AnyStridedMemRef:$src, IndexListArrayAttr:$reassociation)>,
diff --git a/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td b/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
index 3983b0e4be0af..beefcffdc40ec 100644
--- a/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
+++ b/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
@@ -33,7 +33,7 @@ def OpenACC_Dialect : Dialect {
include "mlir/Dialect/OpenACC/AccCommon.td"
// Base class for OpenACC dialect ops.
-class OpenACC_Op<string mnemonic, list<OpTrait> traits = []> :
+class OpenACC_Op<string mnemonic, list<Trait> traits = []> :
Op<OpenACC_Dialect, mnemonic, traits> {
let printer = [{ return ::print(p, *this); }];
diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
index d628027698d33..505e9cb22a0a4 100644
--- a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
+++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
@@ -32,7 +32,7 @@ def OpenMP_Dialect : Dialect {
// OmpCommon requires definition of OpenACC_Dialect.
include "mlir/Dialect/OpenMP/OmpCommon.td"
-class OpenMP_Op<string mnemonic, list<OpTrait> traits = []> :
+class OpenMP_Op<string mnemonic, list<Trait> traits = []> :
Op<OpenMP_Dialect, mnemonic, traits>;
// Type which can be constraint accepting standard integers and indices.
diff --git a/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td b/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
index a094381e81632..fe2ad1f2f16d7 100644
--- a/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
+++ b/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
@@ -22,7 +22,7 @@ include "mlir/IR/SymbolInterfaces.td"
// PDL Ops
//===----------------------------------------------------------------------===//
-class PDL_Op<string mnemonic, list<OpTrait> traits = []>
+class PDL_Op<string mnemonic, list<Trait> traits = []>
: Op<PDL_Dialect, mnemonic, traits> {
let printer = [{ ::print(p, *this); }];
let parser = [{ return ::parse$cppClass(parser, result); }];
diff --git a/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td b/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td
index 931d12a6687a3..9196ae62afd24 100644
--- a/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td
+++ b/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td
@@ -53,7 +53,7 @@ def PDLInterp_Dialect : Dialect {
//===----------------------------------------------------------------------===//
// Generic interpreter operation.
-class PDLInterp_Op<string mnemonic, list<OpTrait> traits = []> :
+class PDLInterp_Op<string mnemonic, list<Trait> traits = []> :
Op<PDLInterp_Dialect, mnemonic, traits>;
//===----------------------------------------------------------------------===//
@@ -61,7 +61,7 @@ class PDLInterp_Op<string mnemonic, list<OpTrait> traits = []> :
// Check operations evaluate a predicate on a positional value and then
// conditionally branch on the result.
-class PDLInterp_PredicateOp<string mnemonic, list<OpTrait> traits = []> :
+class PDLInterp_PredicateOp<string mnemonic, list<Trait> traits = []> :
PDLInterp_Op<mnemonic, !listconcat([Terminator], traits)> {
let successors = (successor AnySuccessor:$trueDest, AnySuccessor:$falseDest);
}
@@ -71,7 +71,7 @@ class PDLInterp_PredicateOp<string mnemonic, list<OpTrait> traits = []> :
// Switch operations evaluate a predicate on a positional value and then
// conditionally branch on the result.
-class PDLInterp_SwitchOp<string mnemonic, list<OpTrait> traits = []> :
+class PDLInterp_SwitchOp<string mnemonic, list<Trait> traits = []> :
PDLInterp_Op<mnemonic, !listconcat([Terminator], traits)> {
let successors = (successor AnySuccessor:$defaultDest,
VariadicSuccessor<AnySuccessor>:$cases);
diff --git a/mlir/include/mlir/Dialect/Quant/QuantOps.td b/mlir/include/mlir/Dialect/Quant/QuantOps.td
index 080d6de43ff86..765aff6f65c2f 100644
--- a/mlir/include/mlir/Dialect/Quant/QuantOps.td
+++ b/mlir/include/mlir/Dialect/Quant/QuantOps.td
@@ -21,7 +21,7 @@ include "mlir/Interfaces/SideEffectInterfaces.td"
// Base classes
//===----------------------------------------------------------------------===//
-class quant_Op<string mnemonic, list<OpTrait> traits> :
+class quant_Op<string mnemonic, list<Trait> traits> :
Op<Quantization_Dialect, mnemonic, traits>;
//===----------------------------------------------------------------------===//
diff --git a/mlir/include/mlir/Dialect/SCF/SCFOps.td b/mlir/include/mlir/Dialect/SCF/SCFOps.td
index 423fcbd19e0b4..78cbbce96ff93 100644
--- a/mlir/include/mlir/Dialect/SCF/SCFOps.td
+++ b/mlir/include/mlir/Dialect/SCF/SCFOps.td
@@ -25,7 +25,7 @@ def SCF_Dialect : Dialect {
}
// Base class for SCF dialect ops.
-class SCF_Op<string mnemonic, list<OpTrait> traits = []> :
+class SCF_Op<string mnemonic, list<Trait> traits = []> :
Op<SCF_Dialect, mnemonic, traits> {
// For every standard op, there needs to be a:
// * void print(OpAsmPrinter &p, ${C++ class of Op} op)
diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVArithmeticOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVArithmeticOps.td
index 660379844a454..ec9116c5d803f 100644
--- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVArithmeticOps.td
+++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVArithmeticOps.td
@@ -19,7 +19,7 @@ include "mlir/Interfaces/InferTypeOpInterface.td"
include "mlir/Interfaces/SideEffectInterfaces.td"
class SPV_ArithmeticBinaryOp<string mnemonic, Type type,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
// Operands type same as result type.
SPV_BinaryOp<mnemonic, type, type,
!listconcat(traits,
@@ -37,7 +37,7 @@ class SPV_ArithmeticBinaryOp<string mnemonic, Type type,
}
class SPV_ArithmeticUnaryOp<string mnemonic, Type type,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
// Operand type same as result type.
SPV_UnaryOp<mnemonic, type, type,
!listconcat(traits,
diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVAtomicOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVAtomicOps.td
index 71ccee5bfea19..a1ab7834b7ed2 100644
--- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVAtomicOps.td
+++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVAtomicOps.td
@@ -14,7 +14,7 @@
#ifndef MLIR_DIALECT_SPIRV_IR_ATOMIC_OPS
#define MLIR_DIALECT_SPIRV_IR_ATOMIC_OPS
-class SPV_AtomicUpdateOp<string mnemonic, list<OpTrait> traits = []> :
+class SPV_AtomicUpdateOp<string mnemonic, list<Trait> traits = []> :
SPV_Op<mnemonic, traits> {
let parser = [{ return ::parseAtomicUpdateOp(parser, result, false); }];
let printer = [{ return ::printAtomicUpdateOp(getOperation(), p); }];
@@ -31,7 +31,7 @@ class SPV_AtomicUpdateOp<string mnemonic, list<OpTrait> traits = []> :
);
}
-class SPV_AtomicUpdateWithValueOp<string mnemonic, list<OpTrait> traits = []> :
+class SPV_AtomicUpdateWithValueOp<string mnemonic, list<Trait> traits = []> :
SPV_Op<mnemonic, traits> {
let parser = [{ return ::parseAtomicUpdateOp(parser, result, true); }];
let printer = [{ return ::printAtomicUpdateOp(getOperation(), p); }];
diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td
index 577d4fca9f352..ca4a605f96d26 100644
--- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td
+++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td
@@ -4248,7 +4248,7 @@ def SPV_OpcodeAttr :
//===----------------------------------------------------------------------===//
// Base class for all SPIR-V ops.
-class SPV_Op<string mnemonic, list<OpTrait> traits = []> :
+class SPV_Op<string mnemonic, list<Trait> traits = []> :
Op<SPIRV_Dialect, mnemonic, !listconcat(traits, [
// TODO: We don't need all of the following traits for every op; only
// the suitable ones should be added automatically after ODS supports
@@ -4310,7 +4310,7 @@ class SPV_Op<string mnemonic, list<OpTrait> traits = []> :
}
class SPV_UnaryOp<string mnemonic, Type resultType, Type operandType,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
SPV_Op<mnemonic, traits> {
let arguments = (ins
SPV_ScalarOrVectorOf<operandType>:$operand
@@ -4327,7 +4327,7 @@ class SPV_UnaryOp<string mnemonic, Type resultType, Type operandType,
}
class SPV_BinaryOp<string mnemonic, Type resultType, Type operandsType,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
SPV_Op<mnemonic, traits> {
let arguments = (ins
SPV_ScalarOrVectorOf<operandsType>:$operand1,
@@ -4345,7 +4345,7 @@ class SPV_BinaryOp<string mnemonic, Type resultType, Type operandsType,
}
class SPV_ExtInstOp<string mnemonic, string setPrefix, string setName,
- int opcode, list<OpTrait> traits = []> :
+ int opcode, list<Trait> traits = []> :
SPV_Op<setPrefix # "." # mnemonic, traits> {
// Extended instruction sets have no direct opcode (they share the
diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBitOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBitOps.td
index c495650c77f10..6dbff43368810 100644
--- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBitOps.td
+++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBitOps.td
@@ -17,13 +17,13 @@
include "mlir/Dialect/SPIRV/IR/SPIRVBase.td"
include "mlir/Interfaces/SideEffectInterfaces.td"
-class SPV_BitBinaryOp<string mnemonic, list<OpTrait> traits = []> :
+class SPV_BitBinaryOp<string mnemonic, list<Trait> traits = []> :
// All the operands type used in bit instructions are SPV_Integer.
SPV_BinaryOp<mnemonic, SPV_Integer, SPV_Integer,
!listconcat(traits,
[NoSideEffect, SameOperandsAndResultType])>;
-class SPV_BitFieldExtractOp<string mnemonic, list<OpTrait> traits = []> :
+class SPV_BitFieldExtractOp<string mnemonic, list<Trait> traits = []> :
SPV_Op<mnemonic, !listconcat(traits,
[NoSideEffect, AllTypesMatch<["base", "result"]>])> {
let arguments = (ins
@@ -43,12 +43,12 @@ class SPV_BitFieldExtractOp<string mnemonic, list<OpTrait> traits = []> :
}];
}
-class SPV_BitUnaryOp<string mnemonic, list<OpTrait> traits = []> :
+class SPV_BitUnaryOp<string mnemonic, list<Trait> traits = []> :
SPV_UnaryOp<mnemonic, SPV_Integer, SPV_Integer,
!listconcat(traits,
[NoSideEffect, SameOperandsAndResultType])>;
-class SPV_ShiftOp<string mnemonic, list<OpTrait> traits = []> :
+class SPV_ShiftOp<string mnemonic, list<Trait> traits = []> :
SPV_BinaryOp<mnemonic, SPV_Integer, SPV_Integer,
!listconcat(traits,
[NoSideEffect, SameOperandsAndResultShape])> {
diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVCastOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVCastOps.td
index e887292cc1fc7..dc3c1189b3fde 100644
--- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVCastOps.td
+++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVCastOps.td
@@ -18,7 +18,7 @@ include "mlir/Dialect/SPIRV/IR/SPIRVBase.td"
include "mlir/Interfaces/SideEffectInterfaces.td"
class SPV_CastOp<string mnemonic, Type resultType, Type operandType,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
SPV_Op<mnemonic,
!listconcat(traits,
[NoSideEffect, SameOperandsAndResultShape])> {
diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGLSLOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGLSLOps.td
index 437805b508ecf..e3535e48c1728 100644
--- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGLSLOps.td
+++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGLSLOps.td
@@ -21,7 +21,7 @@ include "mlir/Interfaces/SideEffectInterfaces.td"
//===----------------------------------------------------------------------===//
// Base class for all GLSL ops.
-class SPV_GLSLOp<string mnemonic, int opcode, list<OpTrait> traits = []> :
+class SPV_GLSLOp<string mnemonic, int opcode, list<Trait> traits = []> :
SPV_ExtInstOp<mnemonic, "GLSL", "GLSL.std.450", opcode, traits> {
let availability = [
@@ -34,7 +34,7 @@ class SPV_GLSLOp<string mnemonic, int opcode, list<OpTrait> traits = []> :
// Base class for GLSL unary ops.
class SPV_GLSLUnaryOp<string mnemonic, int opcode, Type resultType,
- Type operandType, list<OpTrait> traits = []> :
+ Type operandType, list<Trait> traits = []> :
SPV_GLSLOp<mnemonic, opcode, !listconcat([NoSideEffect], traits)> {
let arguments = (ins
@@ -55,12 +55,12 @@ class SPV_GLSLUnaryOp<string mnemonic, int opcode, Type resultType,
// Base class for GLSL Unary arithmetic ops where return type matches
// the operand type.
class SPV_GLSLUnaryArithmeticOp<string mnemonic, int opcode, Type type,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
SPV_GLSLUnaryOp<mnemonic, opcode, type, type, traits>;
// Base class for GLSL binary ops.
class SPV_GLSLBinaryOp<string mnemonic, int opcode, Type resultType,
- Type operandType, list<OpTrait> traits = []> :
+ Type operandType, list<Trait> traits = []> :
SPV_GLSLOp<mnemonic, opcode, !listconcat([NoSideEffect], traits)> {
let arguments = (ins
@@ -82,12 +82,12 @@ class SPV_GLSLBinaryOp<string mnemonic, int opcode, Type resultType,
// Base class for GLSL Binary arithmetic ops where operand types and
// return type matches.
class SPV_GLSLBinaryArithmeticOp<string mnemonic, int opcode, Type type,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
SPV_GLSLBinaryOp<mnemonic, opcode, type, type, traits>;
// Base class for GLSL ternary ops.
class SPV_GLSLTernaryArithmeticOp<string mnemonic, int opcode, Type type,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
SPV_GLSLOp<mnemonic, opcode, !listconcat([NoSideEffect], traits)> {
let arguments = (ins
diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVLogicalOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVLogicalOps.td
index a06a2dd8ac068..9c490830547d5 100644
--- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVLogicalOps.td
+++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVLogicalOps.td
@@ -18,7 +18,7 @@ include "mlir/Dialect/SPIRV/IR/SPIRVBase.td"
include "mlir/Interfaces/SideEffectInterfaces.td"
class SPV_LogicalBinaryOp<string mnemonic, Type operandsType,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
// Result type is SPV_Bool.
SPV_BinaryOp<mnemonic, SPV_Bool, operandsType,
!listconcat(traits,
@@ -34,7 +34,7 @@ class SPV_LogicalBinaryOp<string mnemonic, Type operandsType,
}
class SPV_LogicalUnaryOp<string mnemonic, Type operandType,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
// Result type is SPV_Bool.
SPV_UnaryOp<mnemonic, SPV_Bool, operandType,
!listconcat(traits, [NoSideEffect, SameTypeOperands,
diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVNonUniformOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVNonUniformOps.td
index f411838159ddf..68d0be3f2e391 100644
--- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVNonUniformOps.td
+++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVNonUniformOps.td
@@ -15,7 +15,7 @@
#define MLIR_DIALECT_SPIRV_IR_NON_UNIFORM_OPS
class SPV_GroupNonUniformArithmeticOp<string mnemonic, Type type,
- list<OpTrait> traits = []> : SPV_Op<mnemonic, traits> {
+ list<Trait> traits = []> : SPV_Op<mnemonic, traits> {
let arguments = (ins
SPV_ScopeAttr:$execution_scope,
diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVOCLOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVOCLOps.td
index 330a1b99b7ef4..20598f2be62fd 100644
--- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVOCLOps.td
+++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVOCLOps.td
@@ -20,7 +20,7 @@ include "mlir/Dialect/SPIRV/IR/SPIRVBase.td"
//===----------------------------------------------------------------------===//
// Base class for all OpenCL ops.
-class SPV_OCLOp<string mnemonic, int opcode, list<OpTrait> traits = []> :
+class SPV_OCLOp<string mnemonic, int opcode, list<Trait> traits = []> :
SPV_ExtInstOp<mnemonic, "OCL", "OpenCL.std", opcode, traits> {
let availability = [
@@ -33,7 +33,7 @@ class SPV_OCLOp<string mnemonic, int opcode, list<OpTrait> traits = []> :
// Base class for OpenCL unary ops.
class SPV_OCLUnaryOp<string mnemonic, int opcode, Type resultType,
- Type operandType, list<OpTrait> traits = []> :
+ Type operandType, list<Trait> traits = []> :
SPV_OCLOp<mnemonic, opcode, !listconcat([NoSideEffect], traits)> {
let arguments = (ins
@@ -54,12 +54,12 @@ class SPV_OCLUnaryOp<string mnemonic, int opcode, Type resultType,
// Base class for OpenCL Unary arithmetic ops where return type matches
// the operand type.
class SPV_OCLUnaryArithmeticOp<string mnemonic, int opcode, Type type,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
SPV_OCLUnaryOp<mnemonic, opcode, type, type, traits>;
// Base class for OpenCL binary ops.
class SPV_OCLBinaryOp<string mnemonic, int opcode, Type resultType,
- Type operandType, list<OpTrait> traits = []> :
+ Type operandType, list<Trait> traits = []> :
SPV_OCLOp<mnemonic, opcode, !listconcat([NoSideEffect], traits)> {
let arguments = (ins
@@ -81,7 +81,7 @@ class SPV_OCLBinaryOp<string mnemonic, int opcode, Type resultType,
// Base class for OpenCL Binary arithmetic ops where operand types and
// return type matches.
class SPV_OCLBinaryArithmeticOp<string mnemonic, int opcode, Type type,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
SPV_OCLBinaryOp<mnemonic, opcode, type, type, traits>;
// -----
diff --git a/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td b/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
index d2ef51acbfe07..3397e6363bc99 100644
--- a/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
+++ b/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
@@ -25,7 +25,7 @@ include "mlir/IR/SymbolInterfaces.td"
//===----------------------------------------------------------------------===//
// Base class for the operation in this dialect
-class Shape_Op<string mnemonic, list<OpTrait> traits = []> :
+class Shape_Op<string mnemonic, list<Trait> traits = []> :
Op<ShapeDialect, mnemonic, traits>;
def Shape_AddOp : Shape_Op<"add",
diff --git a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td
index 1209a70a72c22..c87ee778665b5 100644
--- a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td
+++ b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td
@@ -18,7 +18,7 @@ include "mlir/Interfaces/SideEffectInterfaces.td"
// Base class.
//===----------------------------------------------------------------------===//
-class SparseTensor_Op<string mnemonic, list<OpTrait> traits = []>
+class SparseTensor_Op<string mnemonic, list<Trait> traits = []>
: Op<SparseTensor_Dialect, mnemonic, traits> {
let printer = [{ return ::print(p, *this); }];
let verifier = [{ return ::verify(*this); }];
diff --git a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
index deedafb66118f..0ca4d8b75e648 100644
--- a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
+++ b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
@@ -31,7 +31,7 @@ def StandardOps_Dialect : Dialect {
}
// Base class for Standard dialect ops.
-class Std_Op<string mnemonic, list<OpTrait> traits = []> :
+class Std_Op<string mnemonic, list<Trait> traits = []> :
Op<StandardOps_Dialect, mnemonic, traits> {
// For every standard op, there needs to be a:
// * void print(OpAsmPrinter &p, ${C++ class of Op} op)
@@ -46,7 +46,7 @@ class Std_Op<string mnemonic, list<OpTrait> traits = []> :
// Base class for unary ops. Requires single operand and result. Individual
// classes will have `operand` accessor.
-class UnaryOp<string mnemonic, list<OpTrait> traits = []> :
+class UnaryOp<string mnemonic, list<Trait> traits = []> :
Op<StandardOps_Dialect, mnemonic, !listconcat(traits, [NoSideEffect])> {
let results = (outs AnyType);
let printer = [{
@@ -55,14 +55,14 @@ class UnaryOp<string mnemonic, list<OpTrait> traits = []> :
}
class UnaryOpSameOperandAndResultType<string mnemonic,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
UnaryOp<mnemonic, !listconcat(traits, [SameOperandsAndResultType])> {
let parser = [{
return impl::parseOneResultSameOperandTypeOp(parser, result);
}];
}
-class FloatUnaryOp<string mnemonic, list<OpTrait> traits = []> :
+class FloatUnaryOp<string mnemonic, list<Trait> traits = []> :
UnaryOpSameOperandAndResultType<mnemonic, traits # [
DeclareOpInterfaceMethods<VectorUnrollOpInterface>] #
ElementwiseMappable.traits>, Arguments<(ins FloatLike:$operand)>;
@@ -70,7 +70,7 @@ class FloatUnaryOp<string mnemonic, list<OpTrait> traits = []> :
// Base class for standard arithmetic operations. Requires operands and
// results to be of the same type, but does not constrain them to specific
// types.
-class ArithmeticOp<string mnemonic, list<OpTrait> traits = []> :
+class ArithmeticOp<string mnemonic, list<Trait> traits = []> :
Op<StandardOps_Dialect, mnemonic, traits # [NoSideEffect,
SameOperandsAndResultType,
DeclareOpInterfaceMethods<VectorUnrollOpInterface>] #
@@ -84,7 +84,7 @@ class ArithmeticOp<string mnemonic, list<OpTrait> traits = []> :
}
// Base class for standard binary arithmetic operations.
-class ArithmeticBinaryOp<string mnemonic, list<OpTrait> traits = []> :
+class ArithmeticBinaryOp<string mnemonic, list<Trait> traits = []> :
ArithmeticOp<mnemonic, traits> {
let parser = [{
@@ -93,7 +93,7 @@ class ArithmeticBinaryOp<string mnemonic, list<OpTrait> traits = []> :
}
// Base class for standard ternary arithmetic operations.
-class ArithmeticTernaryOp<string mnemonic, list<OpTrait> traits = []> :
+class ArithmeticTernaryOp<string mnemonic, list<Trait> traits = []> :
ArithmeticOp<mnemonic, traits> {
let parser = [{
@@ -113,7 +113,7 @@ class ArithmeticTernaryOp<string mnemonic, list<OpTrait> traits = []> :
//
// <op>i %0, %1 : i32
//
-class IntBinaryOp<string mnemonic, list<OpTrait> traits = []> :
+class IntBinaryOp<string mnemonic, list<Trait> traits = []> :
ArithmeticBinaryOp<mnemonic,
!listconcat(traits,
[DeclareOpInterfaceMethods<VectorUnrollOpInterface>])>,
@@ -128,7 +128,7 @@ class IntBinaryOp<string mnemonic, list<OpTrait> traits = []> :
//
// <op>f %0, %1 : f32
//
-class FloatBinaryOp<string mnemonic, list<OpTrait> traits = []> :
+class FloatBinaryOp<string mnemonic, list<Trait> traits = []> :
ArithmeticBinaryOp<mnemonic,
!listconcat(traits,
[DeclareOpInterfaceMethods<VectorUnrollOpInterface>])>,
@@ -143,7 +143,7 @@ class FloatBinaryOp<string mnemonic, list<OpTrait> traits = []> :
//
// <op> %0, %1, %2 : f32
//
-class FloatTernaryOp<string mnemonic, list<OpTrait> traits = []> :
+class FloatTernaryOp<string mnemonic, list<Trait> traits = []> :
ArithmeticTernaryOp<mnemonic,
!listconcat(traits,
[DeclareOpInterfaceMethods<VectorUnrollOpInterface>])>,
diff --git a/mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td b/mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td
index 882ea33b9c03b..54af06b425052 100644
--- a/mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td
+++ b/mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td
@@ -17,7 +17,7 @@ include "mlir/Interfaces/SideEffectInterfaces.td"
include "mlir/Interfaces/TilingInterface.td"
include "mlir/Interfaces/ViewLikeInterface.td"
-class Tensor_Op<string mnemonic, list<OpTrait> traits = []>
+class Tensor_Op<string mnemonic, list<Trait> traits = []>
: Op<Tensor_Dialect, mnemonic, traits> {
let printer = [{ return ::print(p, *this); }];
let verifier = [{ return ::verify(*this); }];
@@ -656,7 +656,7 @@ def Tensor_ReshapeOp: Tensor_Op<"reshape", [NoSideEffect]> {
// ExpandShapeOp / CollapseShapeOp
//===----------------------------------------------------------------------===//
-class Tensor_ReassociativeReshapeOp<string mnemonic, list<OpTrait> traits = []> :
+class Tensor_ReassociativeReshapeOp<string mnemonic, list<Trait> traits = []> :
Tensor_Op<mnemonic, !listconcat(traits, [NoSideEffect])>,
Arguments<(ins AnyTensor:$src, IndexListArrayAttr:$reassociation)>,
Results<(outs AnyTensor:$result)> {
diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaOpBase.td b/mlir/include/mlir/Dialect/Tosa/IR/TosaOpBase.td
index 6b35941ba5fbe..4d12abfd307a7 100644
--- a/mlir/include/mlir/Dialect/Tosa/IR/TosaOpBase.td
+++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaOpBase.td
@@ -196,7 +196,7 @@ def Tosa_ExplicitValuePadOpQuantInfoBuilder : OpBuilder<
// TOSA Operator.
//===----------------------------------------------------------------------===//
-class Tosa_Op<string mnemonic, list<OpTrait> traits = []> :
+class Tosa_Op<string mnemonic, list<Trait> traits = []> :
Op<Tosa_Dialect, mnemonic, !listconcat(traits, [TosaOpInterface])> {
}
diff --git a/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td b/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
index 6a5e0d961b1dc..ce3fe69c613b5 100644
--- a/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
+++ b/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
@@ -25,7 +25,7 @@ def Vector_Dialect : Dialect {
}
// Base class for Vector dialect ops.
-class Vector_Op<string mnemonic, list<OpTrait> traits = []> :
+class Vector_Op<string mnemonic, list<Trait> traits = []> :
Op<Vector_Dialect, mnemonic, traits> {
// For every vector op, there needs to be a:
// * void print(OpAsmPrinter &p, ${C++ class of Op} op)
diff --git a/mlir/include/mlir/Dialect/X86Vector/X86Vector.td b/mlir/include/mlir/Dialect/X86Vector/X86Vector.td
index 6c93e714194fe..bda3440aa9740 100644
--- a/mlir/include/mlir/Dialect/X86Vector/X86Vector.td
+++ b/mlir/include/mlir/Dialect/X86Vector/X86Vector.td
@@ -31,11 +31,11 @@ def X86Vector_Dialect : Dialect {
//===----------------------------------------------------------------------===//
// Operation that is part of the input dialect.
-class AVX512_Op<string mnemonic, list<OpTrait> traits = []> :
+class AVX512_Op<string mnemonic, list<Trait> traits = []> :
Op<X86Vector_Dialect, "avx512." # mnemonic, traits> {}
// Intrinsic operation used during lowering to LLVM IR.
-class AVX512_IntrOp<string mnemonic, int numResults, list<OpTrait> traits = []> :
+class AVX512_IntrOp<string mnemonic, int numResults, list<Trait> traits = []> :
LLVM_IntrOpBase<X86Vector_Dialect, "avx512.intr." # mnemonic,
"x86_avx512_" # !subst(".", "_", mnemonic),
[], [], traits, numResults>;
@@ -43,7 +43,7 @@ class AVX512_IntrOp<string mnemonic, int numResults, list<OpTrait> traits = []>
// Defined by first result overload. May have to be extended for other
// instructions in the future.
class AVX512_IntrOverloadedOp<string mnemonic,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
LLVM_IntrOpBase<X86Vector_Dialect, "avx512.intr." # mnemonic,
"x86_avx512_" # !subst(".", "_", mnemonic),
/*list<int> overloadedResults=*/[0],
@@ -276,17 +276,17 @@ def Vp2IntersectQIntrOp : AVX512_IntrOp<"vp2intersect.q.512", 2, [
//===----------------------------------------------------------------------===//
// Operation that is part of the input dialect.
-class AVX_Op<string mnemonic, list<OpTrait> traits = []> :
+class AVX_Op<string mnemonic, list<Trait> traits = []> :
Op<X86Vector_Dialect, "avx." # mnemonic, traits> {}
// Operation that may be part of the input dialect, but whose
// form is somewhere between the user view of the operation
// and the actual lower level intrinsic in LLVM IR.
-class AVX_LowOp<string mnemonic, list<OpTrait> traits = []> :
+class AVX_LowOp<string mnemonic, list<Trait> traits = []> :
Op<X86Vector_Dialect, "avx.intr." # mnemonic, traits> {}
// Intrinsic operation used during lowering to LLVM IR.
-class AVX_IntrOp<string mnemonic, int numResults, list<OpTrait> traits = []> :
+class AVX_IntrOp<string mnemonic, int numResults, list<Trait> traits = []> :
LLVM_IntrOpBase<X86Vector_Dialect, "avx.intr." # mnemonic,
"x86_avx_" # !subst(".", "_", mnemonic),
[], [], traits, numResults>;
diff --git a/mlir/include/mlir/IR/BuiltinOps.td b/mlir/include/mlir/IR/BuiltinOps.td
index 972be8f420847..3f7dd1f1f0b78 100644
--- a/mlir/include/mlir/IR/BuiltinOps.td
+++ b/mlir/include/mlir/IR/BuiltinOps.td
@@ -25,7 +25,7 @@ include "mlir/Interfaces/DataLayoutInterfaces.td"
include "mlir/Interfaces/SideEffectInterfaces.td"
// Base class for Builtin dialect ops.
-class Builtin_Op<string mnemonic, list<OpTrait> traits = []> :
+class Builtin_Op<string mnemonic, list<Trait> traits = []> :
Op<Builtin_Dialect, mnemonic, traits>;
//===----------------------------------------------------------------------===//
diff --git a/mlir/include/mlir/IR/OpBase.td b/mlir/include/mlir/IR/OpBase.td
index 179d618409292..f931c0b139b44 100644
--- a/mlir/include/mlir/IR/OpBase.td
+++ b/mlir/include/mlir/IR/OpBase.td
@@ -1961,6 +1961,13 @@ class VariadicSuccessor<Successor successor>
// Trait represents a trait regarding an attribute, operation, or type.
class Trait;
+// Define a Trait corresponding to a list of Traits, this allows for specifying
+// a list of traits as trait. Avoids needing to do `[Traits, ...] # ListOfTraits
+// # [Others, ...]` while still allowing providing convenient groupings.
+class TraitList<list<Trait> props> : Trait {
+ list<Trait> traits = props;
+}
+
// NativeTrait corresponds to the MLIR C++ trait mechanism. The purpose to wrap
// around C++ symbol string with this class is to make traits specified for
// entities in TableGen less alien and more integrated.
@@ -1994,58 +2001,34 @@ class PredTrait<string descr, Pred pred> : Trait {
// TypeTrait definitions
//===----------------------------------------------------------------------===//
-// TypeTrait represents a trait regarding a type.
-// TODO: Remove this class in favor of using Trait.
-class TypeTrait;
-
// These classes are used to define type specific traits.
-class NativeTypeTrait<string name> : NativeTrait<name, "Type">, TypeTrait;
+class NativeTypeTrait<string name> : NativeTrait<name, "Type">;
class ParamNativeTypeTrait<string prop, string params>
- : ParamNativeTrait<prop, params, "Type">, TypeTrait;
-class GenInternalTypeTrait<string prop>
- : GenInternalTrait<prop, "Type">, TypeTrait;
-class PredTypeTrait<string descr, Pred pred>
- : PredTrait<descr, pred>, TypeTrait;
+ : ParamNativeTrait<prop, params, "Type">;
+class GenInternalTypeTrait<string prop> : GenInternalTrait<prop, "Type">;
+class PredTypeTrait<string descr, Pred pred> : PredTrait<descr, pred>;
//===----------------------------------------------------------------------===//
// AttrTrait definitions
//===----------------------------------------------------------------------===//
-// AttrTrait represents a trait regarding an attribute.
-// TODO: Remove this class in favor of using Trait.
-class AttrTrait;
-
// These classes are used to define attribute specific traits.
-class NativeAttrTrait<string name> : NativeTrait<name, "Attribute">, AttrTrait;
+class NativeAttrTrait<string name> : NativeTrait<name, "Attribute">;
class ParamNativeAttrTrait<string prop, string params>
- : ParamNativeTrait<prop, params, "Attribute">, AttrTrait;
-class GenInternalAttrTrait<string prop>
- : GenInternalTrait<prop, "Attribute">, AttrTrait;
-class PredAttrTrait<string descr, Pred pred>
- : PredTrait<descr, pred>, AttrTrait;
+ : ParamNativeTrait<prop, params, "Attribute">;
+class GenInternalAttrTrait<string prop> : GenInternalTrait<prop, "Attribute">;
+class PredAttrTrait<string descr, Pred pred> : PredTrait<descr, pred>;
//===----------------------------------------------------------------------===//
// OpTrait definitions
//===----------------------------------------------------------------------===//
-// OpTrait represents a trait regarding an operation.
-// TODO: Remove this class in favor of using Trait.
-class OpTrait;
-
-// Define a OpTrait corresponding to a list of OpTraits, this allows for
-// specifying a list of traits as trait. Avoids needing to do
-// `[Traits, ...] # ListOfTraits # [Others, ...]` while still allowing providing
-// convenient groupings.
-class OpTraitList<list<OpTrait> props> : OpTrait {
- list<OpTrait> traits = props;
-}
-
// These classes are used to define operation specific traits.
-class NativeOpTrait<string name> : NativeTrait<name, "Op">, OpTrait;
+class NativeOpTrait<string name> : NativeTrait<name, "Op">;
class ParamNativeOpTrait<string prop, string params>
- : ParamNativeTrait<prop, params, "Op">, OpTrait;
-class GenInternalOpTrait<string prop> : GenInternalTrait<prop, "Op">, OpTrait;
-class PredOpTrait<string descr, Pred pred> : PredTrait<descr, pred>, OpTrait;
+ : ParamNativeTrait<prop, params, "Op">;
+class GenInternalOpTrait<string prop> : GenInternalTrait<prop, "Op">;
+class PredOpTrait<string descr, Pred pred> : PredTrait<descr, pred>;
// Op defines an affine scope.
def AffineScope : NativeOpTrait<"AffineScope">;
@@ -2093,14 +2076,12 @@ def Tensorizable : NativeOpTrait<"Tensorizable">;
// Group together `Elementwise`, `Scalarizable`, `Vectorizable`, and
// `Tensorizable` for convenience.
-def ElementwiseMappable {
- list<OpTrait> traits = [
+def ElementwiseMappable : TraitList<[
Elementwise,
Scalarizable,
Vectorizable,
Tensorizable,
- ];
-}
+]>;
// Op's regions have a single block.
def SingleBlock : NativeOpTrait<"SingleBlock">;
@@ -2184,7 +2165,7 @@ class InterfaceTrait<string name> : NativeTrait<"", ""> {
// C++. The purpose to wrap around C++ symbol string with this class is to make
// interfaces specified for ops in TableGen less alien and more integrated.
class OpInterfaceTrait<string name, code verifyBody = [{}]>
- : InterfaceTrait<name>, OpTrait {
+ : InterfaceTrait<name> {
// Specify the body of the verification function. `$_op` will be replaced with
// the operation being verified.
code verify = verifyBody;
@@ -2376,7 +2357,7 @@ class Res<Constraint constraint, string desc = "",
: OpVariable<constraint, desc, decorators>;
// Base class for all ops.
-class Op<Dialect dialect, string mnemonic, list<OpTrait> props = []> {
+class Op<Dialect dialect, string mnemonic, list<Trait> props = []> {
// The dialect of the op.
Dialect opDialect = dialect;
@@ -2460,7 +2441,7 @@ class Op<Dialect dialect, string mnemonic, list<OpTrait> props = []> {
// Op traits.
// Note: The list of traits will be uniqued by ODS.
- list<OpTrait> traits = props;
+ list<Trait> traits = props;
// Additional code that will be added to the public part of the generated
// C++ code of the op declaration.
@@ -2475,7 +2456,7 @@ class Op<Dialect dialect, string mnemonic, list<OpTrait> props = []> {
// Base class for ops with static/dynamic offset, sizes and strides
// attributes/arguments.
class BaseOpWithOffsetSizesAndStrides<Dialect dialect, string mnemonic,
- list<OpTrait> traits = []> :
+ list<Trait> traits = []> :
Op<dialect, mnemonic, traits> {
// For every such op, there needs to be a:
diff --git a/mlir/include/mlir/IR/RegionKindInterface.td b/mlir/include/mlir/IR/RegionKindInterface.td
index 90c96ac21b43e..607001a89250e 100644
--- a/mlir/include/mlir/IR/RegionKindInterface.td
+++ b/mlir/include/mlir/IR/RegionKindInterface.td
@@ -54,13 +54,11 @@ def HasOnlyGraphRegion : NativeOpTrait<"HasOnlyGraphRegion">;
// Op's regions that don't need a terminator: requires some other traits
// so it defines a list that must be concatenated.
-def GraphRegionNoTerminator {
- list<OpTrait> traits = [
+def GraphRegionNoTerminator : TraitList<[
NoTerminator,
SingleBlock,
RegionKindInterface,
HasOnlyGraphRegion
- ];
-}
+ ]>;
#endif // MLIR_IR_REGIONKINDINTERFACE
diff --git a/mlir/include/mlir/Interfaces/InferTypeOpInterface.td b/mlir/include/mlir/Interfaces/InferTypeOpInterface.td
index 2a39ce8d44cee..fcf3d22d4ff61 100644
--- a/mlir/include/mlir/Interfaces/InferTypeOpInterface.td
+++ b/mlir/include/mlir/Interfaces/InferTypeOpInterface.td
@@ -133,7 +133,7 @@ def InferShapedTypeOpInterface : OpInterface<"InferShapedTypeOpInterface"> {
// Convenience class grouping together type and shaped type op interfaces for
// ops that have tensor return types.
-class InferTensorType<list<string> overridenMethods = []> : OpTraitList<
+class InferTensorType<list<string> overridenMethods = []> : TraitList<
[
// Op implements infer type op interface.
InferTypeOpInterface,
@@ -144,7 +144,7 @@ class InferTensorType<list<string> overridenMethods = []> : OpTraitList<
// along with knowledge that it is producing Tensors to infer the type.
NativeOpTrait<"InferTensorType">
]>;
-def InferTensorTypeWithReify: OpTraitList<InferTensorType<[
+def InferTensorTypeWithReify: TraitList<InferTensorType<[
"inferReturnTypeComponents", "reifyReturnTypeShapes"]>.traits>;
diff --git a/mlir/lib/TableGen/Operator.cpp b/mlir/lib/TableGen/Operator.cpp
index a77d17c56df71..298f16f569e74 100644
--- a/mlir/lib/TableGen/Operator.cpp
+++ b/mlir/lib/TableGen/Operator.cpp
@@ -552,7 +552,7 @@ void Operator::populateOpStructure() {
insert = [&](llvm::ListInit *traitList) {
for (auto *traitInit : *traitList) {
auto *def = cast<DefInit>(traitInit)->getDef();
- if (def->isSubClassOf("OpTraitList")) {
+ if (def->isSubClassOf("TraitList")) {
insert(def->getValueAsListInit("traits"));
continue;
}
diff --git a/mlir/test/lib/Dialect/Test/TestOps.td b/mlir/test/lib/Dialect/Test/TestOps.td
index f171e19270069..c37007f9ab0e6 100644
--- a/mlir/test/lib/Dialect/Test/TestOps.td
+++ b/mlir/test/lib/Dialect/Test/TestOps.td
@@ -32,7 +32,7 @@ include "TestAttrDefs.td"
include "TestTypeDefs.td"
-class TEST_Op<string mnemonic, list<OpTrait> traits = []> :
+class TEST_Op<string mnemonic, list<Trait> traits = []> :
Op<Test_Dialect, mnemonic, traits>;
//===----------------------------------------------------------------------===//
@@ -2160,7 +2160,7 @@ def FormatInferType2Op : TEST_Op<"format_infer_type2", [DeclareOpInterfaceMethod
// Base class for testing mixing allOperandTypes, allOperands, and
// inferResultTypes.
-class FormatInferAllTypesBaseOp<string mnemonic, list<OpTrait> traits = []>
+class FormatInferAllTypesBaseOp<string mnemonic, list<Trait> traits = []>
: TEST_Op<mnemonic, [InferTypeOpInterface] # traits> {
let arguments = (ins Variadic<AnyType>:$args);
let results = (outs Variadic<AnyType>:$outs);
@@ -2292,7 +2292,7 @@ def RegionYieldOp : TEST_Op<"region_yield",
];
}
-class BufferBasedOpBase<string mnemonic, list<OpTrait> traits>
+class BufferBasedOpBase<string mnemonic, list<Trait> traits>
: TEST_Op<mnemonic, traits> {
let description = [{
A buffer based operation, that uses memRefs as input and output.
@@ -2424,7 +2424,7 @@ def TableGenBuildOp4 : TEST_Op<"tblgen_build_4", [SameOperandsAndResultType]> {
// Base class for testing `build` methods for ops with
// InferReturnTypeOpInterface.
class TableGenBuildInferReturnTypeBaseOp<string mnemonic,
- list<OpTrait> traits = []>
+ list<Trait> traits = []>
: TEST_Op<mnemonic, [InferTypeOpInterface] # traits> {
let arguments = (ins Variadic<AnyType>:$inputs);
let results = (outs AnyType:$result);
diff --git a/mlir/test/mlir-tblgen/constraint-unique.td b/mlir/test/mlir-tblgen/constraint-unique.td
index a2ee633f5c010..9fc60ebb6a4bf 100644
--- a/mlir/test/mlir-tblgen/constraint-unique.td
+++ b/mlir/test/mlir-tblgen/constraint-unique.td
@@ -6,7 +6,7 @@ def Test_Dialect : Dialect {
let name = "test";
}
-class NS_Op<string mnemonic, list<OpTrait> traits = []> :
+class NS_Op<string mnemonic, list<Trait> traits = []> :
Op<Test_Dialect, mnemonic, traits>;
/// Test unique'ing of type, attribute, successor, and region constraints.
diff --git a/mlir/test/mlir-tblgen/op-attribute.td b/mlir/test/mlir-tblgen/op-attribute.td
index 823c55fc8cd17..f4d32aeb4c65b 100644
--- a/mlir/test/mlir-tblgen/op-attribute.td
+++ b/mlir/test/mlir-tblgen/op-attribute.td
@@ -8,7 +8,7 @@ def Test_Dialect : Dialect {
let name = "test";
let cppNamespace = "foobar";
}
-class NS_Op<string mnemonic, list<OpTrait> traits> :
+class NS_Op<string mnemonic, list<Trait> traits> :
Op<Test_Dialect, mnemonic, traits>;
def SomeAttr : Attr<CPred<"some-condition">, "some attribute kind"> {
diff --git a/mlir/test/mlir-tblgen/op-decl-and-defs.td b/mlir/test/mlir-tblgen/op-decl-and-defs.td
index 3b74275e85a9a..aace7cb14a4f6 100644
--- a/mlir/test/mlir-tblgen/op-decl-and-defs.td
+++ b/mlir/test/mlir-tblgen/op-decl-and-defs.td
@@ -13,7 +13,7 @@ def Test_Dialect : Dialect {
let cppNamespace = "NS";
let emitAccessorPrefix = kEmitAccessorPrefix_Prefixed;
}
-class NS_Op<string mnemonic, list<OpTrait> traits> :
+class NS_Op<string mnemonic, list<Trait> traits> :
Op<Test_Dialect, mnemonic, traits>;
// IsolatedFromAbove trait is included twice to ensure it gets uniqued during
@@ -264,9 +264,9 @@ def NS_JOp : NS_Op<"op_with_InferTypeOpInterface_interface", [DeclareOpInterface
// CHECK: static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
-// Test usage of OpTraitList getting flattened during emission.
+// Test usage of TraitList getting flattened during emission.
def NS_KOp : NS_Op<"k_op", [IsolatedFromAbove,
- OpTraitList<[DeclareOpInterfaceMethods<InferTypeOpInterface>]>]> {
+ TraitList<[DeclareOpInterfaceMethods<InferTypeOpInterface>]>]> {
let arguments = (ins AnyType:$a, AnyType:$b);
}
diff --git a/mlir/test/mlir-tblgen/op-format-spec.td b/mlir/test/mlir-tblgen/op-format-spec.td
index 5b79efc704ec5..6f539f599ff72 100644
--- a/mlir/test/mlir-tblgen/op-format-spec.td
+++ b/mlir/test/mlir-tblgen/op-format-spec.td
@@ -8,7 +8,7 @@ include "mlir/Interfaces/InferTypeOpInterface.td"
def TestDialect : Dialect {
let name = "test";
}
-class TestFormat_Op<string fmt, list<OpTrait> traits = []>
+class TestFormat_Op<string fmt, list<Trait> traits = []>
: Op<TestDialect, "format_op", traits> {
let assemblyFormat = fmt;
}
diff --git a/mlir/test/mlir-tblgen/op-operand.td b/mlir/test/mlir-tblgen/op-operand.td
index abeb67f2dbae1..ff98146755af6 100644
--- a/mlir/test/mlir-tblgen/op-operand.td
+++ b/mlir/test/mlir-tblgen/op-operand.td
@@ -5,7 +5,7 @@ include "mlir/IR/OpBase.td"
def Test_Dialect : Dialect {
let name = "test";
}
-class NS_Op<string mnemonic, list<OpTrait> traits> :
+class NS_Op<string mnemonic, list<Trait> traits> :
Op<Test_Dialect, mnemonic, traits>;
def OpA : NS_Op<"one_normal_operand_op", []> {
diff --git a/mlir/test/mlir-tblgen/op-python-bindings.td b/mlir/test/mlir-tblgen/op-python-bindings.td
index aa9977e047f15..59b5dec83c030 100644
--- a/mlir/test/mlir-tblgen/op-python-bindings.td
+++ b/mlir/test/mlir-tblgen/op-python-bindings.td
@@ -12,7 +12,7 @@ def Test_Dialect : Dialect {
let name = "test";
let cppNamespace = "Test";
}
-class TestOp<string mnemonic, list<OpTrait> traits = []> :
+class TestOp<string mnemonic, list<Trait> traits = []> :
Op<Test_Dialect, mnemonic, traits>;
// CHECK: @_ods_cext.register_operation(_Dialect)
diff --git a/mlir/test/mlir-tblgen/op-result.td b/mlir/test/mlir-tblgen/op-result.td
index 29a2b0729f36a..a190a47a9eea1 100644
--- a/mlir/test/mlir-tblgen/op-result.td
+++ b/mlir/test/mlir-tblgen/op-result.td
@@ -6,7 +6,7 @@ include "mlir/Interfaces/InferTypeOpInterface.td"
def Test_Dialect : Dialect {
let name = "test";
}
-class NS_Op<string mnemonic, list<OpTrait> traits> :
+class NS_Op<string mnemonic, list<Trait> traits> :
Op<Test_Dialect, mnemonic, traits>;
def OpA : NS_Op<"one_normal_result_op", []> {
diff --git a/mlir/test/mlir-tblgen/op-side-effects.td b/mlir/test/mlir-tblgen/op-side-effects.td
index ea1f00ff29794..fd354e22284db 100644
--- a/mlir/test/mlir-tblgen/op-side-effects.td
+++ b/mlir/test/mlir-tblgen/op-side-effects.td
@@ -5,7 +5,7 @@ include "mlir/Interfaces/SideEffectInterfaces.td"
def TEST_Dialect : Dialect {
let name = "test";
}
-class TEST_Op<string mnemonic, list<OpTrait> traits = []> :
+class TEST_Op<string mnemonic, list<Trait> traits = []> :
Op<TEST_Dialect, mnemonic, traits>;
def CustomResource : Resource<"CustomResource">;
diff --git a/mlir/test/mlir-tblgen/predicate.td b/mlir/test/mlir-tblgen/predicate.td
index ad41866e8c0b8..0bc21ec99033a 100644
--- a/mlir/test/mlir-tblgen/predicate.td
+++ b/mlir/test/mlir-tblgen/predicate.td
@@ -5,7 +5,7 @@ include "mlir/IR/OpBase.td"
def Test_Dialect : Dialect {
let name = "test";
}
-class NS_Op<string mnemonic, list<OpTrait> traits> :
+class NS_Op<string mnemonic, list<Trait> traits> :
Op<Test_Dialect, mnemonic, traits>;
def I32OrF32 : Type<CPred<"$_self.isInteger(32) || $_self.isF32()">,
diff --git a/mlir/test/mlir-tblgen/rewriter-errors.td b/mlir/test/mlir-tblgen/rewriter-errors.td
index 3cebe2dfd34f0..597c6205b3d85 100644
--- a/mlir/test/mlir-tblgen/rewriter-errors.td
+++ b/mlir/test/mlir-tblgen/rewriter-errors.td
@@ -11,7 +11,7 @@ def A_Dialect : Dialect {
let name = "a";
}
-class A_Op<string mnemonic, list<OpTrait> traits = []> :
+class A_Op<string mnemonic, list<Trait> traits = []> :
Op<A_Dialect, mnemonic, traits>;
def OpA : A_Op<"op_a">, Arguments<(ins AnyInteger, AnyInteger)>, Results<(outs AnyInteger)>;
diff --git a/mlir/test/mlir-tblgen/rewriter-indexing.td b/mlir/test/mlir-tblgen/rewriter-indexing.td
index e31d78c2481e5..93bd1def2edde 100644
--- a/mlir/test/mlir-tblgen/rewriter-indexing.td
+++ b/mlir/test/mlir-tblgen/rewriter-indexing.td
@@ -5,7 +5,7 @@ include "mlir/IR/OpBase.td"
def Test_Dialect : Dialect {
let name = "test";
}
-class NS_Op<string mnemonic, list<OpTrait> traits> :
+class NS_Op<string mnemonic, list<Trait> traits> :
Op<Test_Dialect, mnemonic, traits>;
def AOp : NS_Op<"a_op", []> {
diff --git a/mlir/test/mlir-tblgen/rewriter-static-matcher.td b/mlir/test/mlir-tblgen/rewriter-static-matcher.td
index b343f90c928a9..d77ac5af816c5 100644
--- a/mlir/test/mlir-tblgen/rewriter-static-matcher.td
+++ b/mlir/test/mlir-tblgen/rewriter-static-matcher.td
@@ -5,7 +5,7 @@ include "mlir/IR/OpBase.td"
def Test_Dialect : Dialect {
let name = "test";
}
-class NS_Op<string mnemonic, list<OpTrait> traits> :
+class NS_Op<string mnemonic, list<Trait> traits> :
Op<Test_Dialect, mnemonic, traits>;
def AOp : NS_Op<"a_op", []> {
diff --git a/mlir/test/python/python_test_ops.td b/mlir/test/python/python_test_ops.td
index a274ffae69831..67a0b95b05b68 100644
--- a/mlir/test/python/python_test_ops.td
+++ b/mlir/test/python/python_test_ops.td
@@ -28,7 +28,7 @@ class TestAttr<string name, string attrMnemonic>
let mnemonic = attrMnemonic;
}
-class TestOp<string mnemonic, list<OpTrait> traits = []>
+class TestOp<string mnemonic, list<Trait> traits = []>
: Op<Python_Test_Dialect, mnemonic, traits>;
//===----------------------------------------------------------------------===//
More information about the Mlir-commits
mailing list