[Mlir-commits] [mlir] 501d7e0 - [mlir] Remove unneeded OpBuilder params. NFC.

Jacques Pienaar llvmlistbot at llvm.org
Wed Sep 23 08:11:48 PDT 2020


Author: Jacques Pienaar
Date: 2020-09-23T08:11:13-07:00
New Revision: 501d7e07e31d8f79160324e683e4931403f469d5

URL: https://github.com/llvm/llvm-project/commit/501d7e07e31d8f79160324e683e4931403f469d5
DIFF: https://github.com/llvm/llvm-project/commit/501d7e07e31d8f79160324e683e4931403f469d5.diff

LOG: [mlir] Remove unneeded OpBuilder params. NFC.

These are now automatically prepended.

Added: 
    

Modified: 
    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/PDL/IR/PDLOps.td
    mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td
    mlir/include/mlir/Dialect/SPIRV/SPIRVAtomicOps.td
    mlir/include/mlir/Dialect/SPIRV/SPIRVCompositeOps.td
    mlir/include/mlir/Dialect/SPIRV/SPIRVControlFlowOps.td
    mlir/include/mlir/Dialect/SPIRV/SPIRVLogicalOps.td
    mlir/include/mlir/Dialect/SPIRV/SPIRVNonUniformOps.td
    mlir/include/mlir/Dialect/SPIRV/SPIRVOps.td
    mlir/include/mlir/Dialect/SPIRV/SPIRVStructureOps.td

Removed: 
    


################################################################################
diff  --git a/mlir/examples/toy/Ch2/include/toy/Ops.td b/mlir/examples/toy/Ch2/include/toy/Ops.td
index db01e226384b..aa344f520233 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<ConstantOp>(...)`.
   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<Value> arguments">
+    OpBuilder<"StringRef callee, ArrayRef<Value> 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 d889b81bef0a..4f09d8af6bce 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<ConstantOp>(...)`.
   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<Value> arguments">
+    OpBuilder<"StringRef callee, ArrayRef<Value> 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 2ce4692e63f2..460dc0cf646e 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<ConstantOp>(...)`.
   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<Value> arguments">
+    OpBuilder<"StringRef callee, ArrayRef<Value> 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 2a746bb2d800..9f889eeb27b3 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<ConstantOp>(...)`.
   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<Value> arguments">
+    OpBuilder<"StringRef callee, ArrayRef<Value> 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 d9a612d00fe9..99c8026ea692 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<ConstantOp>(...)`.
   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<Value> arguments">
+    OpBuilder<"StringRef callee, ArrayRef<Value> 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 dc9472c569a9..53d47f5364f1 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<ConstantOp>(...)`.
   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<Value> arguments">
+    OpBuilder<"StringRef callee, ArrayRef<Value> 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 224c270afb88..02ccf8b8638d 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<Attribute> 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<AttributeType>(), type,
+    OpBuilder<"Value type = Value()", [{
+      build($_builder, $_state, $_builder.getType<AttributeType>(), type,
             Attribute());
     }]>,
-    OpBuilder<"OpBuilder &builder, OperationState &state, Attribute attr", [{
-      build(builder, state, builder.getType<AttributeType>(), Value(), attr);
+    OpBuilder<"Attribute attr", [{
+      build($_builder, $_state, $_builder.getType<AttributeType>(), 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<ValueType>(), Value());
+    OpBuilder<"", [{
+      build($_builder, $_state, $_builder.getType<ValueType>(), Value());
     }]>,
   ];
 }
@@ -254,17 +253,16 @@ def PDL_OperationOp
   let results = (outs PDL_Operation:$op,
                       Variadic<PDL_Value>:$results);
   let builders = [
-    OpBuilder<"OpBuilder &builder, OperationState &state, "
-              "Optional<StringRef> name  = llvm::None, "
+    OpBuilder<"Optional<StringRef> name  = llvm::None, "
               "ValueRange operandValues = llvm::None, "
               "ArrayRef<StringRef> attrNames = llvm::None, "
               "ValueRange attrValues  = llvm::None, "
               "ValueRange resultTypes = llvm::None", [{
-      auto nameAttr = name ? StringAttr() : builder.getStringAttr(*name);
-      build(builder, state, builder.getType<OperationType>(), {}, nameAttr,
-            operandValues, attrValues, builder.getStrArrayAttr(attrNames),
+      auto nameAttr = name ? StringAttr() : $_builder.getStringAttr(*name);
+      build($_builder, $_state, $_builder.getType<OperationType>(), {}, nameAttr,
+            operandValues, attrValues, $_builder.getStrArrayAttr(attrNames),
             resultTypes);
-      state.types.append(resultTypes.size(), builder.getType<ValueType>());
+      $_state.types.append(resultTypes.size(), $_builder.getType<ValueType>());
     }]>,
   ];
   let extraClassDeclaration = [{
@@ -313,8 +311,7 @@ def PDL_PatternOp : PDL_Op<"pattern", [IsolatedFromAbove, Symbol]> {
   }];
 
   let builders = [
-    OpBuilder<"OpBuilder &builder, OperationState &state, "
-              "Optional<StringRef> rootKind = llvm::None, "
+    OpBuilder<"Optional<StringRef> rootKind = llvm::None, "
               "Optional<uint16_t> benefit = 1, "
               "Optional<StringRef> 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<AttributeType>(),
+    OpBuilder<"Type ty = Type()", [{
+      build($_builder, $_state, $_builder.getType<AttributeType>(),
             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 e95162bb6580..514ecf943d9c 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<pdl::AttributeType>(), value);
+    OpBuilder<"Attribute value", [{
+    build($_builder, $_state, $_builder.getType<pdl::AttributeType>(), 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<pdl::OperationType>(), name,
+    OpBuilder<"StringRef name, ValueRange types, ValueRange operands, "
+              "ValueRange attributes, ArrayAttr attributeNames", [{
+    build($_builder, $_state, $_builder.getType<pdl::OperationType>(), 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<pdl::TypeType>(), type);
+    OpBuilder<"TypeAttr type", [{
+      build($_builder, $_state, $_builder.getType<pdl::TypeType>(), 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<pdl::TypeType>(), value);
+    OpBuilder<"Value value", [{
+      build($_builder, $_state, $_builder.getType<pdl::TypeType>(), 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<pdl::TypeType>(), value);
+    OpBuilder<"Value value", [{
+      build($_builder, $_state, $_builder.getType<pdl::TypeType>(), 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<pdl::TypeType>());
+    OpBuilder<"", [{
+      build($_builder, $_state, $_builder.getType<pdl::TypeType>());
     }]>,
   ];
 }
@@ -772,10 +770,9 @@ def PDLInterp_SwitchAttributeOp
   }];
 
   let builders = [
-    OpBuilder<"OpBuilder &builder, OperationState &state, Value attribute,"
-              "ArrayRef<Attribute> caseValues,"
+    OpBuilder<"Value attribute, ArrayRef<Attribute> caseValues,"
               "Block *defaultDest, ArrayRef<Block *> 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<int32_t> counts, Block *defaultDest, "
-              "ArrayRef<Block *> dests", [{
-    build(builder, state, operation, builder.getI32VectorAttr(counts),
+    OpBuilder<"Value operation, ArrayRef<int32_t> counts, "
+              "Block *defaultDest, ArrayRef<Block *> 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<OperationName> names, "
+    OpBuilder<"Value operation, ArrayRef<OperationName> names, "
               "Block *defaultDest, ArrayRef<Block *> 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<int32_t> counts, Block *defaultDest, "
+    OpBuilder<"Value operation, ArrayRef<int32_t> counts, Block *defaultDest, "
               "ArrayRef<Block *> 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<Block *> dests", [{
-      build(builder, state, edge, builder.getTypeArrayAttr(types), defaultDest,
-            dests);
+    OpBuilder<"Value edge, TypeRange types, Block *defaultDest, "
+              "ArrayRef<Block *> 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 12fae9972592..6b82a8d79a7c 100644
--- a/mlir/include/mlir/Dialect/SPIRV/SPIRVAtomicOps.td
+++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVAtomicOps.td
@@ -50,10 +50,9 @@ class SPV_AtomicUpdateWithValueOp<string mnemonic, list<OpTrait> 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 e537a6f90435..d6e66a6ee1a7 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<int32_t> indices}]>
+    OpBuilder<[{Value composite, ArrayRef<int32_t> indices}]>
   ];
 
   let hasFolder = 1;

diff  --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVControlFlowOps.td b/mlir/include/mlir/Dialect/SPIRV/SPIRVControlFlowOps.td
index 8fa5f4f884a1..0f1a282ec942 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<std::pair<uint32_t, uint32_t>> weights = {}",
@@ -145,10 +144,10 @@ def SPV_BranchConditionalOp : SPV_Op<"BranchConditional", [
         ArrayAttr weightsAttr;
         if (weights) {
           weightsAttr =
-              builder.getI32ArrayAttr({static_cast<int32_t>(weights->first),
+              $_builder.getI32ArrayAttr({static_cast<int32_t>(weights->first),
                                        static_cast<int32_t>(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 9789122809ec..1df6f82ada55 100644
--- a/mlir/include/mlir/Dialect/SPIRV/SPIRVLogicalOps.td
+++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVLogicalOps.td
@@ -29,8 +29,8 @@ class SPV_LogicalBinaryOp<string mnemonic, Type operandsType,
 
   let builders = [
     OpBuilder<
-      "OpBuilder &builder, OperationState &state, Value lhs, Value rhs",
-      "::buildLogicalBinaryOp(builder, state, lhs, rhs);">
+      "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 da3da3050efc..d7168d3a292b 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 04ebdcb24435..abc8e5d85552 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<int32_t> 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<NamedAttribute> 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 84e59b6be8bc..2ac28ef87ba9 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<Attribute> 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<NamedAttribute> 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<NamedAttribute> 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<StringRef> name = llvm::None}]>,
-    OpBuilder<[{OpBuilder &, OperationState &state,
-                spirv::AddressingModel addressing_model,
+    OpBuilder<[{Optional<StringRef> name = llvm::None}]>,
+    OpBuilder<[{spirv::AddressingModel addressing_model,
                 spirv::MemoryModel memory_model,
                 Optional<StringRef> name = llvm::None}]>
   ];


        


More information about the Mlir-commits mailing list