From 501d7e07e31d8f79160324e683e4931403f469d5 Mon Sep 17 00:00:00 2001 From: Jacques Pienaar Date: Wed, 23 Sep 2020 08:10:16 -0700 Subject: [PATCH] [mlir] Remove unneeded OpBuilder params. NFC. These are now automatically prepended. --- mlir/examples/toy/Ch2/include/toy/Ops.td | 22 ++++---- mlir/examples/toy/Ch3/include/toy/Ops.td | 22 ++++---- mlir/examples/toy/Ch4/include/toy/Ops.td | 22 ++++---- mlir/examples/toy/Ch5/include/toy/Ops.td | 22 ++++---- mlir/examples/toy/Ch6/include/toy/Ops.td | 22 ++++---- mlir/examples/toy/Ch7/include/toy/Ops.td | 24 ++++----- mlir/include/mlir/Dialect/PDL/IR/PDLOps.td | 37 +++++++------- .../mlir/Dialect/PDLInterp/IR/PDLInterpOps.td | 58 ++++++++++------------ mlir/include/mlir/Dialect/SPIRV/SPIRVAtomicOps.td | 7 ++- .../mlir/Dialect/SPIRV/SPIRVCompositeOps.td | 3 +- .../mlir/Dialect/SPIRV/SPIRVControlFlowOps.td | 13 +++-- mlir/include/mlir/Dialect/SPIRV/SPIRVLogicalOps.td | 7 ++- .../mlir/Dialect/SPIRV/SPIRVNonUniformOps.td | 2 +- mlir/include/mlir/Dialect/SPIRV/SPIRVOps.td | 15 +++--- .../mlir/Dialect/SPIRV/SPIRVStructureOps.td | 25 ++++------ 15 files changed, 133 insertions(+), 168 deletions(-) diff --git a/mlir/examples/toy/Ch2/include/toy/Ops.td b/mlir/examples/toy/Ch2/include/toy/Ops.td index db01e22..aa344f5 100644 --- a/mlir/examples/toy/Ch2/include/toy/Ops.td +++ b/mlir/examples/toy/Ch2/include/toy/Ops.td @@ -68,13 +68,12 @@ def ConstantOp : Toy_Op<"constant", [NoSideEffect]> { // using `builder.create(...)`. let builders = [ // Build a constant with a given constant tensor value. - OpBuilder<"OpBuilder &builder, OperationState &state, " - "DenseElementsAttr value", [{ - build(builder, state, value.getType(), value); + OpBuilder<"DenseElementsAttr value", [{ + build($_builder, $_state, value.getType(), value); }]>, // Build a constant with a given constant floating-point value. - OpBuilder<"OpBuilder &builder, OperationState &state, double value"> + OpBuilder<"double value"> ]; // Invoke a static verify method to verify this constant operation. @@ -97,7 +96,7 @@ def AddOp : Toy_Op<"add"> { // Allow building an AddOp with from the two input operands. let builders = [ - OpBuilder<"OpBuilder &b, OperationState &state, Value lhs, Value rhs"> + OpBuilder<"Value lhs, Value rhs"> ]; } @@ -132,8 +131,7 @@ def GenericCallOp : Toy_Op<"generic_call"> { // Add custom build methods for the generic call operation. let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state, " - "StringRef callee, ArrayRef arguments"> + OpBuilder<"StringRef callee, ArrayRef arguments"> ]; } @@ -153,7 +151,7 @@ def MulOp : Toy_Op<"mul"> { // Allow building a MulOp with from the two input operands. let builders = [ - OpBuilder<"OpBuilder &b, OperationState &state, Value lhs, Value rhs"> + OpBuilder<"Value lhs, Value rhs"> ]; } @@ -216,9 +214,9 @@ def ReturnOp : Toy_Op<"return", [NoSideEffect, HasParent<"FuncOp">, let assemblyFormat = "($input^ `:` type($input))? attr-dict "; // Allow building a ReturnOp with no return operand. - let builders = [OpBuilder< - "OpBuilder &b, OperationState &state", [{ build(b, state, llvm::None); }] - >]; + let builders = [ + OpBuilder<"", [{ build($_builder, $_state, llvm::None); }]> + ]; // Provide extra utility definitions on the c++ operation class definition. let extraClassDeclaration = [{ @@ -241,7 +239,7 @@ def TransposeOp : Toy_Op<"transpose"> { // Allow building a TransposeOp with from the input operand. let builders = [ - OpBuilder<"OpBuilder &b, OperationState &state, Value input"> + OpBuilder<"Value input"> ]; // Invoke a static verify method to verify this transpose operation. diff --git a/mlir/examples/toy/Ch3/include/toy/Ops.td b/mlir/examples/toy/Ch3/include/toy/Ops.td index d889b81..4f09d8a 100644 --- a/mlir/examples/toy/Ch3/include/toy/Ops.td +++ b/mlir/examples/toy/Ch3/include/toy/Ops.td @@ -67,13 +67,12 @@ def ConstantOp : Toy_Op<"constant", [NoSideEffect]> { // using `builder.create(...)`. let builders = [ // Build a constant with a given constant tensor value. - OpBuilder<"OpBuilder &builder, OperationState &state, " - "DenseElementsAttr value", [{ - build(builder, state, value.getType(), value); + OpBuilder<"DenseElementsAttr value", [{ + build($_builder, $_state, value.getType(), value); }]>, // Build a constant with a given constant floating-point value. - OpBuilder<"OpBuilder &builder, OperationState &state, double value"> + OpBuilder<"double value"> ]; // Invoke a static verify method to verify this constant operation. @@ -96,7 +95,7 @@ def AddOp : Toy_Op<"add", [NoSideEffect]> { // Allow building an AddOp with from the two input operands. let builders = [ - OpBuilder<"OpBuilder &b, OperationState &state, Value lhs, Value rhs"> + OpBuilder<"Value lhs, Value rhs"> ]; } @@ -131,8 +130,7 @@ def GenericCallOp : Toy_Op<"generic_call"> { // Add custom build methods for the generic call operation. let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state, " - "StringRef callee, ArrayRef arguments"> + OpBuilder<"StringRef callee, ArrayRef arguments"> ]; } @@ -152,7 +150,7 @@ def MulOp : Toy_Op<"mul", [NoSideEffect]> { // Allow building a MulOp with from the two input operands. let builders = [ - OpBuilder<"OpBuilder &b, OperationState &state, Value lhs, Value rhs"> + OpBuilder<"Value lhs, Value rhs"> ]; } @@ -218,9 +216,9 @@ def ReturnOp : Toy_Op<"return", [NoSideEffect, HasParent<"FuncOp">, let assemblyFormat = "($input^ `:` type($input))? attr-dict "; // Allow building a ReturnOp with no return operand. - let builders = [OpBuilder< - "OpBuilder &b, OperationState &state", [{ build(b, state, llvm::None); }] - >]; + let builders = [ + OpBuilder<"", [{ build($_builder, $_state, llvm::None); }]> + ]; // Provide extra utility definitions on the c++ operation class definition. let extraClassDeclaration = [{ @@ -246,7 +244,7 @@ def TransposeOp : Toy_Op<"transpose", [NoSideEffect]> { // Allow building a TransposeOp with from the input operand. let builders = [ - OpBuilder<"OpBuilder &b, OperationState &state, Value input"> + OpBuilder<"Value input"> ]; // Invoke a static verify method to verify this transpose operation. diff --git a/mlir/examples/toy/Ch4/include/toy/Ops.td b/mlir/examples/toy/Ch4/include/toy/Ops.td index 2ce4692..460dc0c 100644 --- a/mlir/examples/toy/Ch4/include/toy/Ops.td +++ b/mlir/examples/toy/Ch4/include/toy/Ops.td @@ -69,13 +69,12 @@ def ConstantOp : Toy_Op<"constant", [NoSideEffect]> { // using `builder.create(...)`. let builders = [ // Build a constant with a given constant tensor value. - OpBuilder<"OpBuilder &builder, OperationState &state, " - "DenseElementsAttr value", [{ - build(builder, state, value.getType(), value); + OpBuilder<"DenseElementsAttr value", [{ + build($_builder, $_state, value.getType(), value); }]>, // Build a constant with a given constant floating-point value. - OpBuilder<"OpBuilder &builder, OperationState &state, double value"> + OpBuilder<"double value"> ]; // Invoke a static verify method to verify this constant operation. @@ -99,7 +98,7 @@ def AddOp : Toy_Op<"add", // Allow building an AddOp with from the two input operands. let builders = [ - OpBuilder<"OpBuilder &b, OperationState &state, Value lhs, Value rhs"> + OpBuilder<"Value lhs, Value rhs"> ]; } @@ -156,8 +155,7 @@ def GenericCallOp : Toy_Op<"generic_call", // Add custom build methods for the generic call operation. let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state, " - "StringRef callee, ArrayRef arguments"> + OpBuilder<"StringRef callee, ArrayRef arguments"> ]; } @@ -178,7 +176,7 @@ def MulOp : Toy_Op<"mul", // Allow building a MulOp with from the two input operands. let builders = [ - OpBuilder<"OpBuilder &b, OperationState &state, Value lhs, Value rhs"> + OpBuilder<"Value lhs, Value rhs"> ]; } @@ -244,9 +242,9 @@ def ReturnOp : Toy_Op<"return", [NoSideEffect, HasParent<"FuncOp">, let assemblyFormat = "($input^ `:` type($input))? attr-dict "; // Allow building a ReturnOp with no return operand. - let builders = [OpBuilder< - "OpBuilder &b, OperationState &state", [{ build(b, state, llvm::None); }] - >]; + let builders = [ + OpBuilder<"", [{ build($_builder, $_state, llvm::None); }]> + ]; // Provide extra utility definitions on the c++ operation class definition. let extraClassDeclaration = [{ @@ -273,7 +271,7 @@ def TransposeOp : Toy_Op<"transpose", // Allow building a TransposeOp with from the input operand. let builders = [ - OpBuilder<"OpBuilder &b, OperationState &state, Value input"> + OpBuilder<"Value input"> ]; // Invoke a static verify method to verify this transpose operation. diff --git a/mlir/examples/toy/Ch5/include/toy/Ops.td b/mlir/examples/toy/Ch5/include/toy/Ops.td index 2a746bb..9f889ee 100644 --- a/mlir/examples/toy/Ch5/include/toy/Ops.td +++ b/mlir/examples/toy/Ch5/include/toy/Ops.td @@ -69,13 +69,12 @@ def ConstantOp : Toy_Op<"constant", [NoSideEffect]> { // using `builder.create(...)`. let builders = [ // Build a constant with a given constant tensor value. - OpBuilder<"OpBuilder &builder, OperationState &state, " - "DenseElementsAttr value", [{ - build(builder, state, value.getType(), value); + OpBuilder<"DenseElementsAttr value", [{ + build($_builder, $_state, value.getType(), value); }]>, // Build a constant with a given constant floating-point value. - OpBuilder<"OpBuilder &builder, OperationState &state, double value"> + OpBuilder<"double value"> ]; // Invoke a static verify method to verify this constant operation. @@ -99,7 +98,7 @@ def AddOp : Toy_Op<"add", // Allow building an AddOp with from the two input operands. let builders = [ - OpBuilder<"OpBuilder &b, OperationState &state, Value lhs, Value rhs"> + OpBuilder<"Value lhs, Value rhs"> ]; } @@ -156,8 +155,7 @@ def GenericCallOp : Toy_Op<"generic_call", // Add custom build methods for the generic call operation. let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state, " - "StringRef callee, ArrayRef arguments"> + OpBuilder<"StringRef callee, ArrayRef arguments"> ]; } @@ -178,7 +176,7 @@ def MulOp : Toy_Op<"mul", // Allow building a MulOp with from the two input operands. let builders = [ - OpBuilder<"OpBuilder &b, OperationState &state, Value lhs, Value rhs"> + OpBuilder<"Value lhs, Value rhs"> ]; } @@ -245,9 +243,9 @@ def ReturnOp : Toy_Op<"return", [NoSideEffect, HasParent<"FuncOp">, let assemblyFormat = "($input^ `:` type($input))? attr-dict "; // Allow building a ReturnOp with no return operand. - let builders = [OpBuilder< - "OpBuilder &b, OperationState &state", [{ build(b, state, llvm::None); }] - >]; + let builders = [ + OpBuilder<"", [{ build($_builder, $_state, llvm::None); }]> + ]; // Provide extra utility definitions on the c++ operation class definition. let extraClassDeclaration = [{ @@ -274,7 +272,7 @@ def TransposeOp : Toy_Op<"transpose", // Allow building a TransposeOp with from the input operand. let builders = [ - OpBuilder<"OpBuilder &b, OperationState &state, Value input"> + OpBuilder<"Value input"> ]; // Invoke a static verify method to verify this transpose operation. diff --git a/mlir/examples/toy/Ch6/include/toy/Ops.td b/mlir/examples/toy/Ch6/include/toy/Ops.td index d9a612d..99c8026 100644 --- a/mlir/examples/toy/Ch6/include/toy/Ops.td +++ b/mlir/examples/toy/Ch6/include/toy/Ops.td @@ -69,13 +69,12 @@ def ConstantOp : Toy_Op<"constant", [NoSideEffect]> { // using `builder.create(...)`. let builders = [ // Build a constant with a given constant tensor value. - OpBuilder<"OpBuilder &builder, OperationState &state, " - "DenseElementsAttr value", [{ - build(builder, state, value.getType(), value); + OpBuilder<"DenseElementsAttr value", [{ + build($_builder, $_state, value.getType(), value); }]>, // Build a constant with a given constant floating-point value. - OpBuilder<"OpBuilder &builder, OperationState &state, double value"> + OpBuilder<"double value"> ]; // Invoke a static verify method to verify this constant operation. @@ -99,7 +98,7 @@ def AddOp : Toy_Op<"add", // Allow building an AddOp with from the two input operands. let builders = [ - OpBuilder<"OpBuilder &b, OperationState &state, Value lhs, Value rhs"> + OpBuilder<"Value lhs, Value rhs"> ]; } @@ -156,8 +155,7 @@ def GenericCallOp : Toy_Op<"generic_call", // Add custom build methods for the generic call operation. let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state, " - "StringRef callee, ArrayRef arguments"> + OpBuilder<"StringRef callee, ArrayRef arguments"> ]; } @@ -178,7 +176,7 @@ def MulOp : Toy_Op<"mul", // Allow building a MulOp with from the two input operands. let builders = [ - OpBuilder<"OpBuilder &b, OperationState &state, Value lhs, Value rhs"> + OpBuilder<"Value lhs, Value rhs"> ]; } @@ -245,9 +243,9 @@ def ReturnOp : Toy_Op<"return", [NoSideEffect, HasParent<"FuncOp">, let assemblyFormat = "($input^ `:` type($input))? attr-dict "; // Allow building a ReturnOp with no return operand. - let builders = [OpBuilder< - "OpBuilder &b, OperationState &state", [{ build(b, state, llvm::None); }] - >]; + let builders = [ + OpBuilder<"", [{ build($_builder, $_state, llvm::None); }]> + ]; // Provide extra utility definitions on the c++ operation class definition. let extraClassDeclaration = [{ @@ -274,7 +272,7 @@ def TransposeOp : Toy_Op<"transpose", // Allow building a TransposeOp with from the input operand. let builders = [ - OpBuilder<"OpBuilder &b, OperationState &state, Value input"> + OpBuilder<"Value input"> ]; // Invoke a static verify method to verify this transpose operation. diff --git a/mlir/examples/toy/Ch7/include/toy/Ops.td b/mlir/examples/toy/Ch7/include/toy/Ops.td index dc9472c..53d47f5 100644 --- a/mlir/examples/toy/Ch7/include/toy/Ops.td +++ b/mlir/examples/toy/Ch7/include/toy/Ops.td @@ -79,13 +79,12 @@ def ConstantOp : Toy_Op<"constant", // using `builder.create(...)`. let builders = [ // Build a constant with a given constant tensor value. - OpBuilder<"OpBuilder &builder, OperationState &state, " - "DenseElementsAttr value", [{ - build(builder, state, value.getType(), value); + OpBuilder<"DenseElementsAttr value", [{ + build($_builder, $_state, value.getType(), value); }]>, // Build a constant with a given constant floating-point value. - OpBuilder<"OpBuilder &builder, OperationState &state, double value"> + OpBuilder<"double value"> ]; // Invoke a static verify method to verify this constant operation. @@ -112,7 +111,7 @@ def AddOp : Toy_Op<"add", // Allow building an AddOp with from the two input operands. let builders = [ - OpBuilder<"OpBuilder &b, OperationState &state, Value lhs, Value rhs"> + OpBuilder<"Value lhs, Value rhs"> ]; } @@ -170,8 +169,7 @@ def GenericCallOp : Toy_Op<"generic_call", // Add custom build methods for the generic call operation. let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state, " - "StringRef callee, ArrayRef arguments"> + OpBuilder<"StringRef callee, ArrayRef arguments"> ]; } @@ -192,7 +190,7 @@ def MulOp : Toy_Op<"mul", // Allow building a MulOp with from the two input operands. let builders = [ - OpBuilder<"OpBuilder &b, OperationState &state, Value lhs, Value rhs"> + OpBuilder<"Value lhs, Value rhs"> ]; } @@ -259,9 +257,9 @@ def ReturnOp : Toy_Op<"return", [NoSideEffect, HasParent<"FuncOp">, let assemblyFormat = "($input^ `:` type($input))? attr-dict "; // Allow building a ReturnOp with no return operand. - let builders = [OpBuilder< - "OpBuilder &b, OperationState &state", [{ build(b, state, llvm::None); }] - >]; + let builders = [ + OpBuilder<"", [{ build($_builder, $_state, llvm::None); }]> + ]; // Provide extra utility definitions on the c++ operation class definition. let extraClassDeclaration = [{ @@ -287,7 +285,7 @@ def StructAccessOp : Toy_Op<"struct_access", [NoSideEffect]> { // Allow building a StructAccessOp with just a struct value and an index. let builders = [ - OpBuilder<"OpBuilder &b, OperationState &state, Value input, size_t index"> + OpBuilder<"Value input, size_t index"> ]; let verifier = [{ return ::verify(*this); }]; @@ -335,7 +333,7 @@ def TransposeOp : Toy_Op<"transpose", // Allow building a TransposeOp with from the input operand. let builders = [ - OpBuilder<"OpBuilder &b, OperationState &state, Value input"> + OpBuilder<"Value input"> ]; // Invoke a static verify method to verify this transpose operation. diff --git a/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td b/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td index 224c270..02ccf8b 100644 --- a/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td +++ b/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td @@ -59,10 +59,10 @@ def PDL_ApplyConstraintOp }]; let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state, StringRef name, " + OpBuilder<"StringRef name, " "ValueRange args = {}, ArrayRef params = {}", [{ - build(builder, state, builder.getStringAttr(name), args, - params.empty() ? ArrayAttr() : builder.getArrayAttr(params)); + build($_builder, $_state, $_builder.getStringAttr(name), args, + params.empty() ? ArrayAttr() : $_builder.getArrayAttr(params)); }]>, ]; } @@ -103,13 +103,12 @@ def PDL_AttributeOp : PDL_Op<"attribute"> { let assemblyFormat = "attr-dict (`:` $type^)? ($value^)?"; let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state, " - "Value type = Value()", [{ - build(builder, state, builder.getType(), type, + OpBuilder<"Value type = Value()", [{ + build($_builder, $_state, $_builder.getType(), type, Attribute()); }]>, - OpBuilder<"OpBuilder &builder, OperationState &state, Attribute attr", [{ - build(builder, state, builder.getType(), Value(), attr); + OpBuilder<"Attribute attr", [{ + build($_builder, $_state, $_builder.getType(), Value(), attr); }]>, ]; } @@ -200,8 +199,8 @@ def PDL_InputOp : PDL_Op<"input", [HasParent<"pdl::PatternOp">]> { let assemblyFormat = "(`:` $type^)? attr-dict"; let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state", [{ - build(builder, state, builder.getType(), Value()); + OpBuilder<"", [{ + build($_builder, $_state, $_builder.getType(), Value()); }]>, ]; } @@ -254,17 +253,16 @@ def PDL_OperationOp let results = (outs PDL_Operation:$op, Variadic:$results); let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state, " - "Optional name = llvm::None, " + OpBuilder<"Optional name = llvm::None, " "ValueRange operandValues = llvm::None, " "ArrayRef attrNames = llvm::None, " "ValueRange attrValues = llvm::None, " "ValueRange resultTypes = llvm::None", [{ - auto nameAttr = name ? StringAttr() : builder.getStringAttr(*name); - build(builder, state, builder.getType(), {}, nameAttr, - operandValues, attrValues, builder.getStrArrayAttr(attrNames), + auto nameAttr = name ? StringAttr() : $_builder.getStringAttr(*name); + build($_builder, $_state, $_builder.getType(), {}, nameAttr, + operandValues, attrValues, $_builder.getStrArrayAttr(attrNames), resultTypes); - state.types.append(resultTypes.size(), builder.getType()); + $_state.types.append(resultTypes.size(), $_builder.getType()); }]>, ]; let extraClassDeclaration = [{ @@ -313,8 +311,7 @@ def PDL_PatternOp : PDL_Op<"pattern", [IsolatedFromAbove, Symbol]> { }]; let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state, " - "Optional rootKind = llvm::None, " + OpBuilder<"Optional rootKind = llvm::None, " "Optional benefit = 1, " "Optional name = llvm::None">, ]; @@ -455,8 +452,8 @@ def PDL_TypeOp : PDL_Op<"type"> { let assemblyFormat = "attr-dict (`:` $type^)?"; let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state, Type ty = Type()", [{ - build(builder, state, builder.getType(), + OpBuilder<"Type ty = Type()", [{ + build($_builder, $_state, $_builder.getType(), ty ? TypeAttr::get(ty) : TypeAttr()); }]>, ]; diff --git a/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td b/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td index e95162bb..514ecf9 100644 --- a/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td +++ b/mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td @@ -337,9 +337,8 @@ def PDLInterp_CreateAttributeOp let assemblyFormat = "$value attr-dict"; let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state, " - "Attribute value", [{ - build(builder, state, builder.getType(), value); + OpBuilder<"Attribute value", [{ + build($_builder, $_state, $_builder.getType(), value); }]>]; } @@ -402,10 +401,9 @@ def PDLInterp_CreateOperationOp let results = (outs PDL_Operation:$operation); let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state, StringRef name, " - "ValueRange types, ValueRange operands, ValueRange attributes, " - "ArrayAttr attributeNames", [{ - build(builder, state, builder.getType(), name, + OpBuilder<"StringRef name, ValueRange types, ValueRange operands, " + "ValueRange attributes, ArrayAttr attributeNames", [{ + build($_builder, $_state, $_builder.getType(), name, operands, attributes, attributeNames, types); }]>]; let parser = [{ return ::parseCreateOperationOp(parser, result); }]; @@ -434,8 +432,8 @@ def PDLInterp_CreateTypeOp : PDLInterp_Op<"create_type", [NoSideEffect]> { let assemblyFormat = "$value attr-dict"; let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state, TypeAttr type", [{ - build(builder, state, builder.getType(), type); + OpBuilder<"TypeAttr type", [{ + build($_builder, $_state, $_builder.getType(), type); }]> ]; } @@ -529,8 +527,8 @@ def PDLInterp_GetAttributeTypeOp let assemblyFormat = "`of` $value attr-dict"; let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state, Value value", [{ - build(builder, state, builder.getType(), value); + OpBuilder<"Value value", [{ + build($_builder, $_state, $_builder.getType(), value); }]> ]; } @@ -630,8 +628,8 @@ def PDLInterp_GetValueTypeOp : PDLInterp_Op<"get_value_type", [NoSideEffect]> { let assemblyFormat = "`of` $value attr-dict"; let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state, Value value", [{ - build(builder, state, builder.getType(), value); + OpBuilder<"Value value", [{ + build($_builder, $_state, $_builder.getType(), value); }]> ]; } @@ -657,8 +655,8 @@ def PDLInterp_InferredTypeOp : PDLInterp_Op<"inferred_type"> { let assemblyFormat = "attr-dict"; let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state", [{ - build(builder, state, builder.getType()); + OpBuilder<"", [{ + build($_builder, $_state, $_builder.getType()); }]>, ]; } @@ -772,10 +770,9 @@ def PDLInterp_SwitchAttributeOp }]; let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state, Value attribute," - "ArrayRef caseValues," + OpBuilder<"Value attribute, ArrayRef caseValues," "Block *defaultDest, ArrayRef dests", [{ - build(builder, state, attribute, builder.getArrayAttr(caseValues), + build($_builder, $_state, attribute, $_builder.getArrayAttr(caseValues), defaultDest, dests); }]>]; } @@ -806,10 +803,9 @@ def PDLInterp_SwitchOperandCountOp }]; let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state, Value operation, " - "ArrayRef counts, Block *defaultDest, " - "ArrayRef dests", [{ - build(builder, state, operation, builder.getI32VectorAttr(counts), + OpBuilder<"Value operation, ArrayRef counts, " + "Block *defaultDest, ArrayRef dests", [{ + build($_builder, $_state, operation, $_builder.getI32VectorAttr(counts), defaultDest, dests); }]>]; } @@ -841,12 +837,11 @@ def PDLInterp_SwitchOperationNameOp }]; let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state, Value operation, " - "ArrayRef names, " + OpBuilder<"Value operation, ArrayRef names, " "Block *defaultDest, ArrayRef dests", [{ auto stringNames = llvm::to_vector<8>(llvm::map_range(names, [](OperationName name) { return name.getStringRef(); })); - build(builder, state, operation, builder.getStrArrayAttr(stringNames), + build($_builder, $_state, operation, $_builder.getStrArrayAttr(stringNames), defaultDest, dests); }]>, ]; @@ -878,10 +873,9 @@ def PDLInterp_SwitchResultCountOp }]; let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state, Value operation, " - "ArrayRef counts, Block *defaultDest, " + OpBuilder<"Value operation, ArrayRef counts, Block *defaultDest, " "ArrayRef dests", [{ - build(builder, state, operation, builder.getI32VectorAttr(counts), + build($_builder, $_state, operation, $_builder.getI32VectorAttr(counts), defaultDest, dests); }]>]; } @@ -911,10 +905,10 @@ def PDLInterp_SwitchTypeOp : PDLInterp_SwitchOp<"switch_type", [NoSideEffect]> { }]; let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state, Value edge, " - "TypeRange types, Block *defaultDest, ArrayRef dests", [{ - build(builder, state, edge, builder.getTypeArrayAttr(types), defaultDest, - dests); + OpBuilder<"Value edge, TypeRange types, Block *defaultDest, " + "ArrayRef dests", [{ + build($_builder, $_state, edge, $_builder.getTypeArrayAttr(types), + defaultDest, dests); }]>, ]; diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVAtomicOps.td b/mlir/include/mlir/Dialect/SPIRV/SPIRVAtomicOps.td index 12fae99..6b82a8d 100644 --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVAtomicOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVAtomicOps.td @@ -50,10 +50,9 @@ class SPV_AtomicUpdateWithValueOp traits = []> : let builders = [ OpBuilder< - [{OpBuilder &builder, OperationState &state, Value pointer, - ::mlir::spirv::Scope scope, ::mlir::spirv::MemorySemantics memory, - Value value}], - [{build(builder, state, value.getType(), pointer, scope, memory, value);}] + [{Value pointer, ::mlir::spirv::Scope scope, + ::mlir::spirv::MemorySemantics memory, Value value}], + [{build($_builder, $_state, value.getType(), pointer, scope, memory, value);}] > ]; } diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVCompositeOps.td b/mlir/include/mlir/Dialect/SPIRV/SPIRVCompositeOps.td index e537a6f..d6e66a6 100644 --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVCompositeOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVCompositeOps.td @@ -111,8 +111,7 @@ def SPV_CompositeExtractOp : SPV_Op<"CompositeExtract", [NoSideEffect]> { ); let builders = [ - OpBuilder<[{OpBuilder &builder, OperationState &state, - Value composite, ArrayRef indices}]> + OpBuilder<[{Value composite, ArrayRef indices}]> ]; let hasFolder = 1; diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVControlFlowOps.td b/mlir/include/mlir/Dialect/SPIRV/SPIRVControlFlowOps.td index 8fa5f4f..0f1a282 100644 --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVControlFlowOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVControlFlowOps.td @@ -55,10 +55,9 @@ def SPV_BranchOp : SPV_Op<"Branch", [ let builders = [ OpBuilder< - "OpBuilder &, OperationState &state, " "Block *successor, ValueRange arguments = {}", [{ - state.addSuccessors(successor); - state.addOperands(arguments); + $_state.addSuccessors(successor); + $_state.addOperands(arguments); }] > ]; @@ -137,7 +136,7 @@ def SPV_BranchConditionalOp : SPV_Op<"BranchConditional", [ let builders = [ OpBuilder< - "OpBuilder &builder, OperationState &state, Value condition, " + "Value condition, " "Block *trueBlock, ValueRange trueArguments, " "Block *falseBlock, ValueRange falseArguments, " "Optional> weights = {}", @@ -145,10 +144,10 @@ def SPV_BranchConditionalOp : SPV_Op<"BranchConditional", [ ArrayAttr weightsAttr; if (weights) { weightsAttr = - builder.getI32ArrayAttr({static_cast(weights->first), + $_builder.getI32ArrayAttr({static_cast(weights->first), static_cast(weights->second)}); } - build(builder, state, condition, trueArguments, falseArguments, + build($_builder, $_state, condition, trueArguments, falseArguments, weightsAttr, trueBlock, falseBlock); }] > @@ -290,7 +289,7 @@ def SPV_LoopOp : SPV_Op<"loop", [InFunctionScope]> { let regions = (region AnyRegion:$body); - let builders = [OpBuilder<"OpBuilder &builder, OperationState &state">]; + let builders = [OpBuilder<"">]; let extraClassDeclaration = [{ // Returns the entry block. diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVLogicalOps.td b/mlir/include/mlir/Dialect/SPIRV/SPIRVLogicalOps.td index 9789122..1df6f82 100644 --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVLogicalOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVLogicalOps.td @@ -29,8 +29,8 @@ class SPV_LogicalBinaryOp + "Value lhs, Value rhs", + "::buildLogicalBinaryOp($_builder, $_state, lhs, rhs);"> ]; } @@ -860,8 +860,7 @@ def SPV_SelectOp : SPV_Op<"Select", SPV_SelectType:$result ); - let builders = [OpBuilder<[{OpBuilder &builder, OperationState &state, - Value cond, Value trueValue, + let builders = [OpBuilder<[{Value cond, Value trueValue, Value falseValue}]>]; let assemblyFormat = [{ diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVNonUniformOps.td b/mlir/include/mlir/Dialect/SPIRV/SPIRVNonUniformOps.td index da3da30..d7168d3 100644 --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVNonUniformOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVNonUniformOps.td @@ -218,7 +218,7 @@ def SPV_GroupNonUniformElectOp : SPV_Op<"GroupNonUniformElect", []> { ); let builders = [ - OpBuilder<[{OpBuilder &builder, OperationState &state, spirv::Scope}]> + OpBuilder<[{spirv::Scope}]> ]; let assemblyFormat = "$execution_scope attr-dict `:` type($result)"; diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVOps.td b/mlir/include/mlir/Dialect/SPIRV/SPIRVOps.td index 04ebdcb..abc8e5d 100644 --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVOps.td @@ -95,8 +95,7 @@ def SPV_AccessChainOp : SPV_Op<"AccessChain", [NoSideEffect]> { SPV_AnyPtr:$component_ptr ); - let builders = [OpBuilder<[{OpBuilder &builder, OperationState &state, - Value basePtr, ValueRange indices}]>]; + let builders = [OpBuilder<[{Value basePtr, ValueRange indices}]>]; let hasCanonicalizer = 1; } @@ -272,8 +271,7 @@ def SPV_ExecutionModeOp : SPV_Op<"ExecutionMode", [InModuleScope]> { let autogenSerialization = 0; - let builders = [OpBuilder<[{OpBuilder &builder, OperationState &state, - spirv::FuncOp function, + let builders = [OpBuilder<[{spirv::FuncOp function, spirv::ExecutionMode executionMode, ArrayRef params}]>]; } @@ -327,7 +325,6 @@ def SPV_LoadOp : SPV_Op<"Load", []> { let builders = [ OpBuilder<[{ - OpBuilder &builder, OperationState &state, Value basePtr, IntegerAttr memory_access = {}, IntegerAttr alignment = {} }]> @@ -429,11 +426,11 @@ def SPV_StoreOp : SPV_Op<"Store", []> { let results = (outs); let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state, " + OpBuilder< "Value ptr, Value value, ArrayRef namedAttrs = {}", [{ - state.addOperands(ptr); - state.addOperands(value); - state.addAttributes(namedAttrs); + $_state.addOperands(ptr); + $_state.addOperands(value); + $_state.addAttributes(namedAttrs); }]> ]; } diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVStructureOps.td b/mlir/include/mlir/Dialect/SPIRV/SPIRVStructureOps.td index 84e59b6..2ac28ef 100644 --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVStructureOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVStructureOps.td @@ -60,8 +60,7 @@ def SPV_AddressOfOp : SPV_Op<"_address_of", [InFunctionScope, NoSideEffect]> { let autogenSerialization = 0; - let builders = [OpBuilder<[{OpBuilder &builder, OperationState &state, - spirv::GlobalVariableOp var}]>]; + let builders = [OpBuilder<[{spirv::GlobalVariableOp var}]>]; let assemblyFormat = "$variable attr-dict `:` type($pointer)"; } @@ -189,8 +188,7 @@ def SPV_EntryPointOp : SPV_Op<"EntryPoint", [InModuleScope]> { let autogenSerialization = 0; - let builders = [OpBuilder<[{OpBuilder &builder, OperationState &state, - spirv::ExecutionModel executionModel, + let builders = [OpBuilder<[{spirv::ExecutionModel executionModel, spirv::FuncOp function, ArrayRef interfaceVars}]>]; } @@ -244,7 +242,6 @@ def SPV_FuncOp : SPV_Op<"func", [ let verifier = [{ return success(); }]; let builders = [OpBuilder<[{ - OpBuilder &, OperationState &state, StringRef name, FunctionType type, spirv::FunctionControl control = spirv::FunctionControl::None, ArrayRef attrs = {} @@ -333,16 +330,14 @@ def SPV_GlobalVariableOp : SPV_Op<"globalVariable", [InModuleScope, Symbol]> { let results = (outs); let builders = [ - OpBuilder<"OpBuilder &builder, OperationState &state, " + OpBuilder< "TypeAttr type, ArrayRef namedAttrs", [{ - state.addAttribute("type", type); - state.addAttributes(namedAttrs); + $_state.addAttribute("type", type); + $_state.addAttributes(namedAttrs); }]>, - OpBuilder<[{OpBuilder &builder, OperationState &state, - Type type, StringRef name, unsigned descriptorSet, + OpBuilder<[{Type type, StringRef name, unsigned descriptorSet, unsigned binding}]>, - OpBuilder<[{OpBuilder &builder, OperationState &state, - Type type, StringRef name, spirv::BuiltIn builtin}]> + OpBuilder<[{Type type, StringRef name, spirv::BuiltIn builtin}]> ]; let hasOpcode = 0; @@ -418,10 +413,8 @@ def SPV_ModuleOp : SPV_Op<"module", let regions = (region SizedRegion<1>:$body); let builders = [ - OpBuilder<[{OpBuilder &, OperationState &state, - Optional name = llvm::None}]>, - OpBuilder<[{OpBuilder &, OperationState &state, - spirv::AddressingModel addressing_model, + OpBuilder<[{Optional name = llvm::None}]>, + OpBuilder<[{spirv::AddressingModel addressing_model, spirv::MemoryModel memory_model, Optional name = llvm::None}]> ]; -- 2.7.4