Migrates a bit more from the old/to be deprecated form.
let skipDefaultBuilders = 1;
let builders = [
- OpBuilder<"mlir::OpBuilder &builder, OperationState &result,"
- "Value operand, ArrayRef<NamedAttribute> attrs = {}">,
+ OpBuilder<"Value operand, ArrayRef<NamedAttribute> attrs = {}">,
];
let extraClassDeclaration = [{
by an invocation of the `gpu.func`.
}];
- let builders = [OpBuilder<"OpBuilder &builder, OperationState &result", " // empty">];
+ let builders = [OpBuilder<"", " // empty">];
let parser = [{ return parseReturnOp(parser, result); }];
let printer = [{ p << getOperationName(); }];
````
}];
let builders = [OpBuilder<
- "OpBuilder &builder, OperationState &result, Value min, Value max, "
- "Value step",
+ "Value min, Value max, Value step",
[{
- auto rangeType = RangeType::get(builder.getContext());
- build(builder, result, rangeType, min, max, step);
+ auto rangeType = RangeType::get($_builder.getContext());
+ build($_builder, $_state, rangeType, min, max, step);
}]>];
// Fully specified by traits.
let builders = [
// Builders for a contracting reshape whose result type is computed from
// `src` and `reassociation`.
- OpBuilder<"OpBuilder &b, OperationState &result, Value src, "
+ OpBuilder<"Value src, "
"ArrayRef<ReassociationExprs> reassociation, "
"ArrayRef<NamedAttribute> attrs = {}">,
- OpBuilder<"OpBuilder &b, OperationState &result, Value src, "
+ OpBuilder<"Value src, "
"ArrayRef<ReassociationIndices> reassociation, "
"ArrayRef<NamedAttribute> attrs = {}", [{
auto reassociationMaps =
- convertReassociationIndicesToMaps(b, reassociation);
- build(b, result, src, reassociationMaps, attrs);
+ convertReassociationIndicesToMaps($_builder, reassociation);
+ build($_builder, $_state, src, reassociationMaps, attrs);
}]>,
// Builders for a reshape whose result type is passed explicitly. This may
// be either a contracting or expanding reshape.
- OpBuilder<"OpBuilder &b, OperationState &result, Type resultType, "
- "Value src, ArrayRef<ReassociationExprs> reassociation, "
+ OpBuilder<"Type resultType, Value src, "
+ "ArrayRef<ReassociationExprs> reassociation, "
"ArrayRef<NamedAttribute> attrs = {}">,
- OpBuilder<"OpBuilder &b, OperationState &result, Type resultType, "
- "Value src, ArrayRef<ReassociationIndices> reassociation, "
+ OpBuilder<"Type resultType, Value src, "
+ "ArrayRef<ReassociationIndices> reassociation, "
"ArrayRef<NamedAttribute> attrs = {}", [{
auto reassociationMaps =
- convertReassociationIndicesToMaps(b, reassociation);
- build(b, result, src, reassociationMaps, attrs);
+ convertReassociationIndicesToMaps($_builder, reassociation);
+ build($_builder, $_state, src, reassociationMaps, attrs);
}]>
];
```
}];
- let builders = [OpBuilder<
- "OpBuilder &b, OperationState &result, Value base, "
- "ValueRange indexings">];
+ let builders = [OpBuilder<"Value base, ValueRange indexings">];
let extraClassDeclaration = [{
enum { FirstIndexingOperand = 1 };
// TODO: this should go away once the usage of OptionalAttr triggers emission
// of builders with default arguments left unspecified.
let builders = [OpBuilder<
- "OpBuilder &builder, OperationState &result, Value input, Value output", [{
+ "Value input, Value output", [{
return build(
- builder, result, input, output, AffineMapAttr(), AffineMapAttr());
+ $_builder, $_state, input, output, AffineMapAttr(), AffineMapAttr());
}]>];
let extraClassDeclaration = libraryCallName # [{
let builders = [
OpBuilder<
- "OpBuilder &builder, OperationState &result, TypeRange resultTensorTypes,"
+ "TypeRange resultTensorTypes,"
"ValueRange inputs, ValueRange outputBuffers, ValueRange initTensors, "
"ArrayRef<AffineMap> indexingMaps, ArrayRef<StringRef> iteratorTypes, "
"StringRef doc, StringRef libraryCall, IntegerAttr symbolSource, "
"function_ref<void(OpBuilder &, Location, ValueRange)> = nullptr">,
OpBuilder<
- "OpBuilder &builder, OperationState &result, "
"ValueRange inputs, ValueRange outputBuffers, "
"ArrayRef<AffineMap> indexingMaps, ArrayRef<StringRef> iteratorTypes, "
"StringRef doc, StringRef libraryCall, IntegerAttr symbolSource, "
"function_ref<void(OpBuilder &, Location, ValueRange)> = nullptr">,
OpBuilder<
- "OpBuilder &builder, OperationState &result, TypeRange resultTensorTypes,"
+ "TypeRange resultTensorTypes,"
"ValueRange inputs, ValueRange outputBuffers, ValueRange initTensors, "
"ArrayRef<AffineMap> indexingMaps, ArrayRef<StringRef> iteratorTypes, "
"function_ref<void(OpBuilder &, Location, ValueRange)> = nullptr">,
OpBuilder<
- "OpBuilder &builder, OperationState &result, ValueRange inputs, "
+ "ValueRange inputs, "
"ValueRange outputBuffers, ArrayRef<AffineMap> indexingMaps, "
"ArrayRef<StringRef> iteratorTypes, "
"function_ref<void(OpBuilder &, Location, ValueRange)> = nullptr">
let builders = [
OpBuilder<
- "OpBuilder &builder, OperationState &result, TypeRange resultTensorTypes,"
+ "TypeRange resultTensorTypes,"
"ValueRange inputs, ValueRange outputBuffers, ValueRange initTensors, "
"ArrayRef<AffineMap> indexingMaps, ArrayRef<StringRef> iteratorTypes, "
"StringRef doc, StringRef libraryCall, IntegerAttr symbolSource, "
"function_ref<void(OpBuilder &, Location, ValueRange, ValueRange)> = nullptr">,
OpBuilder<
- "OpBuilder &builder, OperationState &result, "
"ValueRange inputs, ValueRange outputBuffers, "
"ArrayRef<AffineMap> indexingMaps, ArrayRef<StringRef> iteratorTypes, "
"StringRef doc, StringRef libraryCall, IntegerAttr symbolSource, "
"function_ref<void(OpBuilder &, Location, ValueRange, ValueRange)> = nullptr">,
OpBuilder<
- "OpBuilder &builder, OperationState &result, TypeRange resultTensorTypes,"
+ "TypeRange resultTensorTypes,"
"ValueRange inputs, ValueRange outputBuffers, ValueRange initTensors, "
"ArrayRef<AffineMap> indexingMaps, ArrayRef<StringRef> iteratorTypes, "
"function_ref<void(OpBuilder &, Location, ValueRange, ValueRange)> = nullptr">,
OpBuilder<
- "OpBuilder &builder, OperationState &result, ValueRange inputs, "
+ "ValueRange inputs, "
"ValueRange outputBuffers, ArrayRef<AffineMap> indexingMaps, "
"ArrayRef<StringRef> iteratorTypes, "
"function_ref<void(OpBuilder &, Location, ValueRange, ValueRange)> = nullptr">
let arguments = (ins Variadic<AnyType>:$operands);
let builders = [
- OpBuilder<"OpBuilder &builder, OperationState &result",
- [{ /* nothing to do */ }]>
+ OpBuilder<"", [{ /* nothing to do */ }]>
];
let verifier = ?;
OpBuilder<"Value cond, bool withElseRegion">,
OpBuilder<"TypeRange resultTypes, Value cond, bool withElseRegion">,
OpBuilder<
- "OpBuilder &builder, OperationState &result, TypeRange resultTypes, "
- "Value cond, "
+ "TypeRange resultTypes, Value cond, "
"function_ref<void(OpBuilder &, Location)> thenBuilder "
" = buildTerminatedBody, "
"function_ref<void(OpBuilder &, Location)> elseBuilder = nullptr">,
OpBuilder<
- "OpBuilder &builder, OperationState &result, Value cond, "
+ "Value cond, "
"function_ref<void(OpBuilder &, Location)> thenBuilder "
" = buildTerminatedBody, "
"function_ref<void(OpBuilder &, Location)> elseBuilder = nullptr">
let arguments = (ins Variadic<AnyType>:$results);
let builders = [
- OpBuilder<"OpBuilder &builder, OperationState &result",
- [{ /* nothing to do */ }]>
+ OpBuilder<"", [{ /* nothing to do */ }]>
];
// Override default verifier (defined in SCF_Op), no custom verification
// needed.
);
let builders = [
- OpBuilder<[{OpBuilder &builder, OperationState &state, Value object,
- Value composite, ArrayRef<int32_t> indices}]>
+ OpBuilder<[{Value object, Value composite, ArrayRef<int32_t> indices}]>
];
}
let arguments = (ins Variadic<AnyType>:$operands);
- let builders = [OpBuilder<
- "OpBuilder &b, OperationState &result", [{ build(b, result, llvm::None); }]
- >];
+ let builders = [
+ OpBuilder<"", [{ build($_builder, $_state, llvm::None); }]>
+ ];
let verifier = [{ return ::verify(*this); }];
let assemblyFormat = "attr-dict ($operands^ `:` type($operands))?";
let arguments = (ins Variadic<AnyType>:$operands);
let builders = [
- OpBuilder<"OpBuilder &builder, OperationState &result",
- [{ /* nothing to do */ }]>
+ OpBuilder<"", [{ /* nothing to do */ }]>
];
let assemblyFormat = "attr-dict ($operands^ `:` type($operands))?";
"ArrayRef<NamedAttribute> attrs = {}">,
// Build a SubViewOp with all dynamic entries.
OpBuilder<
- "OpBuilder &b, OperationState &result, Value source, "
- "ValueRange offsets, ValueRange sizes, ValueRange strides, "
+ "Value source, ValueRange offsets, ValueRange sizes, ValueRange strides, "
"ArrayRef<NamedAttribute> attrs = {}">,
// Build a SubViewOp with mixed static and dynamic entries
// and custom result type.
OpBuilder<
- "OpBuilder &b, OperationState &result, MemRefType resultType, "
- "Value source, ArrayRef<int64_t> staticOffsets, "
+ "MemRefType resultType, Value source, ArrayRef<int64_t> staticOffsets, "
"ArrayRef<int64_t> staticSizes, ArrayRef<int64_t> staticStrides, "
"ValueRange offsets, ValueRange sizes, "
"ValueRange strides, ArrayRef<NamedAttribute> attrs = {}">,
// Build a SubViewOp with all dynamic entries and custom result type.
OpBuilder<
- "OpBuilder &b, OperationState &result, MemRefType resultType, "
- "Value source, ValueRange offsets, ValueRange sizes, ValueRange strides, "
+ "MemRefType resultType, Value source, ValueRange offsets, "
+ "ValueRange sizes, ValueRange strides, "
"ArrayRef<NamedAttribute> attrs = {}">
];
}];
let builders = [OpBuilder<
- "OpBuilder &b, OperationState &result, Value in, "
- "AffineMapAttr permutation, ArrayRef<NamedAttribute> attrs = {}">];
+ "Value in, AffineMapAttr permutation, "
+ "ArrayRef<NamedAttribute> attrs = {}">];
let extraClassDeclaration = [{
static StringRef getPermutationAttrName() { return "permutation"; }
```
}];
let builders = [OpBuilder<
- "OpBuilder &builder, OperationState &result, " #
"Value vector, Value id, int64_t multiplicity">];
let extraClassDeclaration = [{
VectorType getSourceVectorType() {
```
}];
let builders = [OpBuilder<
- "OpBuilder &builder, OperationState &result, " #
"Value vector, Value id, int64_t multiplicity">];
let extraClassDeclaration = [{
VectorType getSourceVectorType() {
// }
// ```
//
-// To define a custom builder, the parameter list (*including* the `Builder
+// To define a custom builder, the parameter list (*excluding* the `Builder
// *builder, OperationState &state` part) and body should be passed in
// as separate template arguments to this class. This is because we generate
// op declaration and definition into separate files. If an empty string is
let skipDefaultBuilders = 1;
let builders = [ OpBuilder<
- "OpBuilder &b, OperationState &result, "
"ValueRange inputs, ValueRange outputBuffers",
[{{
- result.addOperands(inputs);
- result.addOperands(outputBuffers);
- result.addAttribute(
+ $_state.addOperands(inputs);
+ $_state.addOperands(outputBuffers);
+ $_state.addAttribute(
"operand_segment_sizes",
- b.getI32VectorAttr({{static_cast<int32_t>(inputs.size()),
- static_cast<int32_t>(outputBuffers.size()),
- static_cast<int32_t>(0)}));
+ $_builder.getI32VectorAttr({{
+ static_cast<int32_t>(inputs.size()),
+ static_cast<int32_t>(outputBuffers.size()),
+ static_cast<int32_t>(0)}));
buildNamedStructuredOpRegionAndAttributes<{0}>(
- b,
- result,
+ $_builder,
+ $_state,
TypeRange(inputs),
TypeRange(outputBuffers),
TypeRange(),
TypeRange());
}]>, OpBuilder<
- "OpBuilder &b, OperationState &result, TypeRange resultTensorTypes,"
- "ValueRange inputs, ValueRange outputBuffers, ValueRange initTensors",
+ "TypeRange resultTensorTypes, ValueRange inputs, "
+ "ValueRange outputBuffers, ValueRange initTensors",
[{{
- result.addOperands(inputs);
- result.addOperands(outputBuffers);
- result.addOperands(initTensors);
- result.addTypes(resultTensorTypes);
- result.addAttribute(
+ $_state.addOperands(inputs);
+ $_state.addOperands(outputBuffers);
+ $_state.addOperands(initTensors);
+ $_state.addTypes(resultTensorTypes);
+ $_state.addAttribute(
"operand_segment_sizes",
- b.getI32VectorAttr({{static_cast<int32_t>(inputs.size()),
- static_cast<int32_t>(outputBuffers.size()),
- static_cast<int32_t>(initTensors.size())}));
+ $_builder.getI32VectorAttr({{
+ static_cast<int32_t>(inputs.size()),
+ static_cast<int32_t>(outputBuffers.size()),
+ static_cast<int32_t>(initTensors.size())}));
buildNamedStructuredOpRegionAndAttributes<{0}>(
- b,
- result,
+ $_builder,
+ $_state,
TypeRange(inputs),
TypeRange(outputBuffers),
TypeRange(initTensors),
resultTensorTypes);
}]>, OpBuilder<
- "OpBuilder &b, OperationState &result, TypeRange resultTensorTypes,"
- "ValueRange operands, ArrayRef<NamedAttribute> attributes = {{}",
+ "TypeRange resultTensorTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes = {{}",
[{{
- result.addOperands(operands);
- result.addAttributes(attributes);
- result.addTypes(resultTensorTypes);
- (void)result.addRegion();
+ $_state.addOperands(operands);
+ $_state.addAttributes(attributes);
+ $_state.addTypes(resultTensorTypes);
+ (void)$_state.addRegion();
}]>
];
let printer = [{{ return ::printNamedStructuredOp(p, *this); }];