[mlir] Remove unneeded OpBuilder params. NFC.

These are now automatically prepended.
This commit is contained in:
Jacques Pienaar 2020-09-23 08:10:16 -07:00
parent 80deb1e106
commit 501d7e07e3
15 changed files with 133 additions and 168 deletions

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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());
}]>,
];

View File

@ -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);
}]>,
];

View File

@ -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);}]
>
];
}

View File

@ -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;

View File

@ -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.

View File

@ -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 = [{

View File

@ -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)";

View File

@ -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);
}]>
];
}

View File

@ -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}]>
];