// using `builder.create<ConstantOp>(...)`.
let builders = [
// Build a constant with a given constant tensor value.
- OpBuilder<"DenseElementsAttr value", [{
+ OpBuilderDAG<(ins "DenseElementsAttr":$value), [{
// Call into an autogenerated `build` method.
build(builder, result, value.getType(), value);
}]>,
// Build a constant with a given constant floating-point value. This builder
// creates a declaration for `ConstantOp::build` with the given parameters.
- OpBuilder<"double value">
+ OpBuilderDAG<(ins "double":$value)>
];
}
```
// using `builder.create<ConstantOp>(...)`.
let builders = [
// Build a constant with a given constant tensor value.
- OpBuilder<"DenseElementsAttr value", [{
+ OpBuilderDAG<(ins "DenseElementsAttr":$value), [{
build($_builder, $_state, value.getType(), value);
}]>,
// Build a constant with a given constant floating-point value.
- OpBuilder<"double value">
+ OpBuilderDAG<(ins "double":$value)>
];
// Invoke a static verify method to verify this constant operation.
// Allow building an AddOp with from the two input operands.
let builders = [
- OpBuilder<"Value lhs, Value rhs">
+ OpBuilderDAG<(ins "Value":$lhs, "Value":$rhs)>
];
}
// Add custom build methods for the generic call operation.
let builders = [
- OpBuilder<"StringRef callee, ArrayRef<Value> arguments">
+ OpBuilderDAG<(ins "StringRef":$callee, "ArrayRef<Value>":$arguments)>
];
}
// Allow building a MulOp with from the two input operands.
let builders = [
- OpBuilder<"Value lhs, Value rhs">
+ OpBuilderDAG<(ins "Value":$lhs, "Value":$rhs)>
];
}
// Allow building a ReturnOp with no return operand.
let builders = [
- OpBuilder<"", [{ build($_builder, $_state, llvm::None); }]>
+ OpBuilderDAG<(ins), [{ build($_builder, $_state, llvm::None); }]>
];
// Provide extra utility definitions on the c++ operation class definition.
// Allow building a TransposeOp with from the input operand.
let builders = [
- OpBuilder<"Value input">
+ OpBuilderDAG<(ins "Value":$input)>
];
// Invoke a static verify method to verify this transpose operation.
// using `builder.create<ConstantOp>(...)`.
let builders = [
// Build a constant with a given constant tensor value.
- OpBuilder<"DenseElementsAttr value", [{
+ OpBuilderDAG<(ins "DenseElementsAttr":$value), [{
build($_builder, $_state, value.getType(), value);
}]>,
// Build a constant with a given constant floating-point value.
- OpBuilder<"double value">
+ OpBuilderDAG<(ins "double":$value)>
];
// Invoke a static verify method to verify this constant operation.
// Allow building an AddOp with from the two input operands.
let builders = [
- OpBuilder<"Value lhs, Value rhs">
+ OpBuilderDAG<(ins "Value":$lhs, "Value":$rhs)>
];
}
// Add custom build methods for the generic call operation.
let builders = [
- OpBuilder<"StringRef callee, ArrayRef<Value> arguments">
+ OpBuilderDAG<(ins "StringRef":$callee, "ArrayRef<Value>":$arguments)>
];
}
// Allow building a MulOp with from the two input operands.
let builders = [
- OpBuilder<"Value lhs, Value rhs">
+ OpBuilderDAG<(ins "Value":$lhs, "Value":$rhs)>
];
}
// Allow building a ReturnOp with no return operand.
let builders = [
- OpBuilder<"", [{ build($_builder, $_state, llvm::None); }]>
+ OpBuilderDAG<(ins), [{ build($_builder, $_state, llvm::None); }]>
];
// Provide extra utility definitions on the c++ operation class definition.
// Allow building a TransposeOp with from the input operand.
let builders = [
- OpBuilder<"Value input">
+ OpBuilderDAG<(ins "Value":$input)>
];
// Invoke a static verify method to verify this transpose operation.
// using `builder.create<ConstantOp>(...)`.
let builders = [
// Build a constant with a given constant tensor value.
- OpBuilder<"DenseElementsAttr value", [{
+ OpBuilderDAG<(ins "DenseElementsAttr":$value), [{
build($_builder, $_state, value.getType(), value);
}]>,
// Build a constant with a given constant floating-point value.
- OpBuilder<"double value">
+ OpBuilderDAG<(ins "double":$value)>
];
// Invoke a static verify method to verify this constant operation.
// Allow building an AddOp with from the two input operands.
let builders = [
- OpBuilder<"Value lhs, Value rhs">
+ OpBuilderDAG<(ins "Value":$lhs, "Value":$rhs)>
];
}
// Add custom build methods for the generic call operation.
let builders = [
- OpBuilder<"StringRef callee, ArrayRef<Value> arguments">
+ OpBuilderDAG<(ins "StringRef":$callee, "ArrayRef<Value>":$arguments)>
];
}
// Allow building a MulOp with from the two input operands.
let builders = [
- OpBuilder<"Value lhs, Value rhs">
+ OpBuilderDAG<(ins "Value":$lhs, "Value":$rhs)>
];
}
// Allow building a ReturnOp with no return operand.
let builders = [
- OpBuilder<"", [{ build($_builder, $_state, llvm::None); }]>
+ OpBuilderDAG<(ins), [{ build($_builder, $_state, llvm::None); }]>
];
// Provide extra utility definitions on the c++ operation class definition.
// Allow building a TransposeOp with from the input operand.
let builders = [
- OpBuilder<"Value input">
+ OpBuilderDAG<(ins "Value":$input)>
];
// Invoke a static verify method to verify this transpose operation.
// using `builder.create<ConstantOp>(...)`.
let builders = [
// Build a constant with a given constant tensor value.
- OpBuilder<"DenseElementsAttr value", [{
+ OpBuilderDAG<(ins "DenseElementsAttr":$value), [{
build($_builder, $_state, value.getType(), value);
}]>,
// Build a constant with a given constant floating-point value.
- OpBuilder<"double value">
+ OpBuilderDAG<(ins "double":$value)>
];
// Invoke a static verify method to verify this constant operation.
// Allow building an AddOp with from the two input operands.
let builders = [
- OpBuilder<"Value lhs, Value rhs">
+ OpBuilderDAG<(ins "Value":$lhs, "Value":$rhs)>
];
}
// Add custom build methods for the generic call operation.
let builders = [
- OpBuilder<"StringRef callee, ArrayRef<Value> arguments">
+ OpBuilderDAG<(ins "StringRef":$callee, "ArrayRef<Value>":$arguments)>
];
}
// Allow building a MulOp with from the two input operands.
let builders = [
- OpBuilder<"Value lhs, Value rhs">
+ OpBuilderDAG<(ins "Value":$lhs, "Value":$rhs)>
];
}
// Allow building a ReturnOp with no return operand.
let builders = [
- OpBuilder<"", [{ build($_builder, $_state, llvm::None); }]>
+ OpBuilderDAG<(ins), [{ build($_builder, $_state, llvm::None); }]>
];
// Provide extra utility definitions on the c++ operation class definition.
// Allow building a TransposeOp with from the input operand.
let builders = [
- OpBuilder<"Value input">
+ OpBuilderDAG<(ins "Value":$input)>
];
// Invoke a static verify method to verify this transpose operation.
// using `builder.create<ConstantOp>(...)`.
let builders = [
// Build a constant with a given constant tensor value.
- OpBuilder<"DenseElementsAttr value", [{
+ OpBuilderDAG<(ins "DenseElementsAttr":$value), [{
build($_builder, $_state, value.getType(), value);
}]>,
// Build a constant with a given constant floating-point value.
- OpBuilder<"double value">
+ OpBuilderDAG<(ins "double":$value)>
];
// Invoke a static verify method to verify this constant operation.
// Allow building an AddOp with from the two input operands.
let builders = [
- OpBuilder<"Value lhs, Value rhs">
+ OpBuilderDAG<(ins "Value":$lhs, "Value":$rhs)>
];
}
// Add custom build methods for the generic call operation.
let builders = [
- OpBuilder<"StringRef callee, ArrayRef<Value> arguments">
+ OpBuilderDAG<(ins "StringRef":$callee, "ArrayRef<Value>":$arguments)>
];
}
// Allow building a MulOp with from the two input operands.
let builders = [
- OpBuilder<"Value lhs, Value rhs">
+ OpBuilderDAG<(ins "Value":$lhs, "Value":$rhs)>
];
}
// Allow building a ReturnOp with no return operand.
let builders = [
- OpBuilder<"", [{ build($_builder, $_state, llvm::None); }]>
+ OpBuilderDAG<(ins), [{ build($_builder, $_state, llvm::None); }]>
];
// Provide extra utility definitions on the c++ operation class definition.
// Allow building a TransposeOp with from the input operand.
let builders = [
- OpBuilder<"Value input">
+ OpBuilderDAG<(ins "Value":$input)>
];
// Invoke a static verify method to verify this transpose operation.
// using `builder.create<ConstantOp>(...)`.
let builders = [
// Build a constant with a given constant tensor value.
- OpBuilder<"DenseElementsAttr value", [{
+ OpBuilderDAG<(ins "DenseElementsAttr":$value), [{
build($_builder, $_state, value.getType(), value);
}]>,
// Build a constant with a given constant floating-point value.
- OpBuilder<"double value">
+ OpBuilderDAG<(ins "double":$value)>
];
// Invoke a static verify method to verify this constant operation.
// Allow building an AddOp with from the two input operands.
let builders = [
- OpBuilder<"Value lhs, Value rhs">
+ OpBuilderDAG<(ins "Value":$lhs, "Value":$rhs)>
];
}
// Add custom build methods for the generic call operation.
let builders = [
- OpBuilder<"StringRef callee, ArrayRef<Value> arguments">
+ OpBuilderDAG<(ins "StringRef":$callee, "ArrayRef<Value>":$arguments)>
];
}
// Allow building a MulOp with from the two input operands.
let builders = [
- OpBuilder<"Value lhs, Value rhs">
+ OpBuilderDAG<(ins "Value":$lhs, "Value":$rhs)>
];
}
// Allow building a ReturnOp with no return operand.
let builders = [
- OpBuilder<"", [{ build($_builder, $_state, llvm::None); }]>
+ OpBuilderDAG<(ins), [{ build($_builder, $_state, llvm::None); }]>
];
// Provide extra utility definitions on the c++ operation class definition.
// Allow building a StructAccessOp with just a struct value and an index.
let builders = [
- OpBuilder<"Value input, size_t index">
+ OpBuilderDAG<(ins "Value":$input, "size_t":$index)>
];
let verifier = [{ return ::verify(*this); }];
// Allow building a TransposeOp with from the input operand.
let builders = [
- OpBuilder<"Value input">
+ OpBuilderDAG<(ins "Value":$input)>
];
// Invoke a static verify method to verify this transpose operation.
// has a constant builder. That way we wouldn't need to explicitly specify the
// result types here.
let builders = [
- OpBuilder<"AffineMap map, ValueRange mapOperands", [{
+ OpBuilderDAG<(ins "AffineMap":$map, "ValueRange":$mapOperands),
+ [{
build($_builder, $_state, $_builder.getIndexType(), map, mapOperands);
}]>
];
let skipDefaultBuilders = 1;
let builders = [
- OpBuilder<"int64_t lowerBound, int64_t upperBound, int64_t step = 1, "
- "ValueRange iterArgs = llvm::None, function_ref<void(OpBuilder "
- "&, Location, Value, ValueRange)> bodyBuilder = nullptr">,
- OpBuilder<"ValueRange lbOperands, AffineMap lbMap, "
- "ValueRange ubOperands, AffineMap ubMap, "
- "int64_t step = 1, ValueRange iterArgs = llvm::None, "
- "function_ref<void(OpBuilder &, Location, Value, ValueRange)> "
- "bodyBuilder = nullptr">
+ OpBuilderDAG<(ins "int64_t":$lowerBound, "int64_t":$upperBound,
+ CArg<"int64_t", "1">:$step, CArg<"ValueRange", "llvm::None">:$iterArgs,
+ CArg<"function_ref<void(OpBuilder &, Location, Value, ValueRange)>",
+ "nullptr">:$bodyBuilder)>,
+ OpBuilderDAG<(ins "ValueRange":$lbOperands, "AffineMap":$lbMap,
+ "ValueRange":$ubOperands, "AffineMap":$ubMap, CArg<"int64_t", "1">:$step,
+ CArg<"ValueRange", "llvm::None">:$iterArgs,
+ CArg<"function_ref<void(OpBuilder &, Location, Value, ValueRange)>",
+ "nullptr">:$bodyBuilder)>
];
let extraClassDeclaration = [{
let skipDefaultBuilders = 1;
let builders = [
- OpBuilder<"IntegerSet set, ValueRange args, bool withElseRegion">,
- OpBuilder<"TypeRange resultTypes, IntegerSet set, ValueRange args,"
- "bool withElseRegion">,
+ OpBuilderDAG<(ins "IntegerSet":$set, "ValueRange":$args,
+ "bool":$withElseRegion)>,
+ OpBuilderDAG<(ins "TypeRange":$resultTypes, "IntegerSet":$set,
+ "ValueRange":$args, "bool":$withElseRegion)>,
];
let extraClassDeclaration = [{
let builders = [
/// Builds an affine load op with the specified map and operands.
- OpBuilder<"AffineMap map, ValueRange operands">,
+ OpBuilderDAG<(ins "AffineMap":$map, "ValueRange":$operands)>,
/// Builds an affine load op with an identity map and operands.
- OpBuilder<"Value memref, ValueRange indices = {}">,
+ OpBuilderDAG<(ins "Value":$memref, CArg<"ValueRange", "{}">:$indices)>,
/// Builds an affine load op with the specified map and its operands.
- OpBuilder<"Value memref, AffineMap map, ValueRange mapOperands">
+ OpBuilderDAG<(ins "Value":$memref, "AffineMap":$map,
+ "ValueRange":$mapOperands)>
];
let extraClassDeclaration = extraClassDeclarationBase;
let results = (outs Index);
let builders = [
- OpBuilder<"AffineMap affineMap, ValueRange mapOperands",
+ OpBuilderDAG<(ins "AffineMap":$affineMap, "ValueRange":$mapOperands),
[{
build($_builder, $_state, $_builder.getIndexType(), affineMap, mapOperands);
}]>
let regions = (region SizedRegion<1>:$region);
let builders = [
- OpBuilder<"TypeRange resultTypes, "
- "ArrayRef<AtomicRMWKind> reductions, "
- "ArrayRef<int64_t> ranges">,
- OpBuilder<"TypeRange resultTypes, "
- "ArrayRef<AtomicRMWKind> reductions, "
- "AffineMap lbMap, ValueRange lbArgs, "
- "AffineMap ubMap, ValueRange ubArgs">,
- OpBuilder<"TypeRange resultTypes, "
- "ArrayRef<AtomicRMWKind> reductions, "
- "AffineMap lbMap, ValueRange lbArgs, "
- "AffineMap ubMap, ValueRange ubArgs, "
- "ArrayRef<int64_t> steps">
+ OpBuilderDAG<(ins "TypeRange":$resultTypes,
+ "ArrayRef<AtomicRMWKind>":$reductions, "ArrayRef<int64_t>":$ranges)>,
+ OpBuilderDAG<(ins "TypeRange":$resultTypes,
+ "ArrayRef<AtomicRMWKind>":$reductions, "AffineMap":$lbMap,
+ "ValueRange":$lbArgs, "AffineMap":$ubMap, "ValueRange":$ubArgs)>,
+ OpBuilderDAG<(ins "TypeRange":$resultTypes,
+ "ArrayRef<AtomicRMWKind>":$reductions, "AffineMap":$lbMap,
+ "ValueRange":$lbArgs, "AffineMap":$ubMap, "ValueRange":$ubArgs,
+ "ArrayRef<int64_t>":$steps)>
];
let extraClassDeclaration = [{
IntMaxValue<3>]>:$localityHint,
BoolAttr:$isDataCache);
- let builders = [OpBuilder<
- "Value memref, AffineMap map, ArrayRef<Value> mapOperands, bool isWrite,"
- "unsigned localityHint, bool isDataCache",
+ let builders = [
+ OpBuilderDAG<(ins "Value":$memref, "AffineMap":$map,
+ "ArrayRef<Value>":$mapOperands, "bool":$isWrite, "unsigned":$localityHint,
+ "bool":$isDataCache),
[{
assert(map.getNumInputs() == mapOperands.size()
&& "inconsistent index info");
let skipDefaultBuilders = 1;
let builders = [
- OpBuilder<"Value valueToStore, Value memref, ValueRange indices">,
- OpBuilder<"Value valueToStore, Value memref, AffineMap map, "
- "ValueRange mapOperands">
+ OpBuilderDAG<(ins "Value":$valueToStore, "Value":$memref,
+ "ValueRange":$indices)>,
+ OpBuilderDAG<(ins "Value":$valueToStore, "Value":$memref, "AffineMap":$map,
+ "ValueRange":$mapOperands)>
];
let extraClassDeclaration = extraClassDeclarationBase;
let arguments = (ins Variadic<AnyType>:$operands);
let builders = [
- OpBuilder<"", [{ build($_builder, $_state, llvm::None); }]>
+ OpBuilderDAG<(ins), [{ build($_builder, $_state, llvm::None); }]>
];
let assemblyFormat = "attr-dict ($operands^ `:` type($operands))?";
let skipDefaultBuilders = 1;
let builders = [
- OpBuilder<"Value operand, ArrayRef<NamedAttribute> attrs = {}">,
+ OpBuilderDAG<(ins "Value":$operand,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs)>,
];
let extraClassDeclaration = [{
let skipDefaultBuilders = 1;
let builders = [
- OpBuilder<"StringRef name, "
- "FunctionType type, TypeRange workgroupAttributions = {}, "
- "TypeRange privateAttributions = {}, "
- "ArrayRef<NamedAttribute> attrs = {}">
+ OpBuilderDAG<(ins "StringRef":$name, "FunctionType":$type,
+ CArg<"TypeRange", "{}">:$workgroupAttributions,
+ CArg<"TypeRange", "{}">:$privateAttributions,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs)>
];
let extraClassDeclaration = [{
let skipDefaultBuilders = 1;
let builders = [
- OpBuilder<"GPUFuncOp kernelFunc, "
- "KernelDim3 gridSize, KernelDim3 blockSize, "
- "ValueRange kernelOperands">
+ OpBuilderDAG<(ins "GPUFuncOp":$kernelFunc, "KernelDim3":$gridSize,
+ "KernelDim3":$blockSize, "ValueRange":$kernelOperands)>
];
let extraClassDeclaration = [{
let skipDefaultBuilders = 1;
let builders = [
- OpBuilder<"Value gridSizeX,"
- "Value gridSizeY, Value gridSizeZ, Value blockSizeX,"
- "Value blockSizeY, Value blockSizeZ">
+ OpBuilderDAG<(ins "Value":$gridSizeX, "Value":$gridSizeY,
+ "Value":$gridSizeZ, "Value":$blockSizeX, "Value":$blockSizeY,
+ "Value":$blockSizeZ)>
];
let extraClassDeclaration = [{
by an invocation of the `gpu.func`.
}];
- let builders = [OpBuilder<"", " // empty">];
+ let builders = [OpBuilderDAG<(ins), [{ // empty}]>];
let parser = [{ return parseReturnOp(parser, result); }];
let printer = [{ p << getOperationName(); }];
```
}];
- let builders = [OpBuilder<"StringRef name">];
+ let builders = [OpBuilderDAG<(ins "StringRef":$name)>];
let parser = [{ return ::parseGPUModuleOp(parser, result); }];
let printer = [{ return ::print(p, *this); }];
let regions = (region SizedRegion<1>:$body);
string llvmBuilder = builder;
}
-def LLVM_OneResultOpBuilder : OpBuilder<
- "Type resultType, ValueRange operands, "
- "ArrayRef<NamedAttribute> attributes = {}",
+def LLVM_OneResultOpBuilder :
+ OpBuilderDAG<(ins "Type":$resultType, "ValueRange":$operands,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attributes),
[{
if (resultType) $_state.addTypes(resultType);
$_state.addOperands(operands);
}
}]>;
-def LLVM_ZeroResultOpBuilder : OpBuilder<
- "ValueRange operands, ArrayRef<NamedAttribute> attributes = {}",
+def LLVM_ZeroResultOpBuilder :
+ OpBuilderDAG<(ins "ValueRange":$operands,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attributes),
[{
$_state.addOperands(operands);
for (auto namedAttr : attributes) {
}
}]>;
-class LLVM_TwoBuilders<OpBuilder b1, OpBuilder b2> {
- list<OpBuilder> builders = [b1, b2];
+class LLVM_TwoBuilders<OpBuilderDAG b1, OpBuilderDAG b2> {
+ list<OpBuilderDAG> builders = [b1, b2];
}
// Base class for LLVM operations with one result.
// Compatibility builder that takes an instance of wrapped llvm::VoidType
// to indicate no result.
-def LLVM_VoidResultTypeOpBuilder : OpBuilder<
- "Type resultType, ValueRange operands, ArrayRef<NamedAttribute> attributes = {}",
+def LLVM_VoidResultTypeOpBuilder :
+ OpBuilderDAG<(ins "Type":$resultType, "ValueRange":$operands,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attributes),
[{
auto llvmType = resultType.dyn_cast<LLVMType>(); (void)llvmType;
assert(llvmType && "result must be an LLVM type");
LLVM_TwoBuilders<LLVM_VoidResultTypeOpBuilder, LLVM_ZeroResultOpBuilder>;
// Opaque builder used for terminator operations that contain successors.
-def LLVM_TerminatorPassthroughOpBuilder : OpBuilder<
- "ValueRange operands, SuccessorRange destinations, "
- "ArrayRef<NamedAttribute> attributes = {}",
+def LLVM_TerminatorPassthroughOpBuilder :
+ OpBuilderDAG<(ins "ValueRange":$operands, "SuccessorRange":$destinations,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attributes),
[{
$_state.addOperands(operands);
$_state.addSuccessors(destinations);
let llvmBuilder = [{
$res = builder.CreateICmp(getLLVMCmpPredicate($predicate), $lhs, $rhs);
}];
- let builders = [OpBuilder<
- "ICmpPredicate predicate, Value lhs, Value rhs", [{
+ let builders = [
+ OpBuilderDAG<(ins "ICmpPredicate":$predicate, "Value":$lhs, "Value":$rhs),
+ [{
build($_builder, $_state, LLVMType::getInt1Ty(lhs.getType().getContext()),
$_builder.getI64IntegerAttr(static_cast<int64_t>(predicate)), lhs, rhs);
}]>];
let llvmBuilder = [{
$res = builder.CreateFCmp(getLLVMCmpPredicate($predicate), $lhs, $rhs);
}];
- let builders = [OpBuilder<
- "FCmpPredicate predicate, Value lhs, Value rhs", [{
+ let builders = [
+ OpBuilderDAG<(ins "FCmpPredicate":$predicate, "Value":$lhs, "Value":$rhs),
+ [{
build($_builder, $_state, LLVMType::getInt1Ty(lhs.getType().getContext()),
$_builder.getI64IntegerAttr(static_cast<int64_t>(predicate)), lhs, rhs);
}]>];
}] # setAlignmentCode # [{
$res = inst;
}];
- let builders = [OpBuilder<
- "Type resultType, Value arraySize, unsigned alignment",
+ let builders = [
+ OpBuilderDAG<(ins "Type":$resultType, "Value":$arraySize,
+ "unsigned":$alignment),
[{
if (alignment == 0)
return build($_builder, $_state, resultType, arraySize, IntegerAttr());
}] # setAlignmentCode # setNonTemporalMetadataCode # [{
$res = inst;
}];
- let builders = [OpBuilder<
- "Value addr, unsigned alignment = 0, bool isVolatile = false, "
- "bool isNonTemporal = false",
+ let builders = [
+ OpBuilderDAG<(ins "Value":$addr, CArg<"unsigned", "0">:$alignment,
+ CArg<"bool", "false">:$isVolatile, CArg<"bool", "false">:$isNonTemporal),
[{
auto type = addr.getType().cast<LLVMType>().getPointerElementTy();
build($_builder, $_state, type, addr, alignment, isVolatile, isNonTemporal);
}]>,
- OpBuilder<
- "Type t, Value addr, unsigned alignment = 0, bool isVolatile = false, "
- "bool isNonTemporal = false">];
+ OpBuilderDAG<(ins "Type":$t, "Value":$addr,
+ CArg<"unsigned", "0">:$alignment, CArg<"bool", "false">:$isVolatile,
+ CArg<"bool", "false">:$isNonTemporal)>];
let parser = [{ return parseLoadOp(parser, result); }];
let printer = [{ printLoadOp(p, *this); }];
}
string llvmBuilder = [{
auto *inst = builder.CreateStore($value, $addr, $volatile_);
}] # setAlignmentCode # setNonTemporalMetadataCode;
- let builders = [OpBuilder<
- "Value value, Value addr, unsigned alignment = 0, bool isVolatile = false, "
- "bool isNonTemporal = false">
+ let builders = [
+ OpBuilderDAG<(ins "Value":$value, "Value":$addr,
+ CArg<"unsigned", "0">:$alignment, CArg<"bool", "false">:$isVolatile,
+ CArg<"bool", "false">:$isNonTemporal)>
];
let parser = [{ return parseStoreOp(parser, result); }];
let printer = [{ printStoreOp(p, *this); }];
let successors = (successor AnySuccessor:$normalDest,
AnySuccessor:$unwindDest);
- let builders = [OpBuilder<
- "TypeRange tys, FlatSymbolRefAttr callee, ValueRange ops, Block* normal, "
- "ValueRange normalOps, Block* unwind, ValueRange unwindOps",
+ let builders = [
+ OpBuilderDAG<(ins "TypeRange":$tys, "FlatSymbolRefAttr":$callee,
+ "ValueRange":$ops, "Block*":$normal, "ValueRange":$normalOps,
+ "Block*":$unwind, "ValueRange":$unwindOps),
[{
$_state.addAttribute("callee", callee);
build($_builder, $_state, tys, ops, normal, normalOps, unwind, unwindOps);
}]>,
- OpBuilder<
- "TypeRange tys, ValueRange ops, Block* normal, "
- "ValueRange normalOps, Block* unwind, ValueRange unwindOps",
+ OpBuilderDAG<(ins "TypeRange":$tys, "ValueRange":$ops, "Block*":$normal,
+ "ValueRange":$normalOps, "Block*":$unwind, "ValueRange":$unwindOps),
[{
build($_builder, $_state, tys, /*callee=*/FlatSymbolRefAttr(), ops, normalOps,
unwindOps, normal, unwind);
Results<(outs Variadic<LLVM_Type>)> {
let arguments = (ins OptionalAttr<FlatSymbolRefAttr>:$callee,
Variadic<LLVM_Type>);
- let builders = [OpBuilder<
- "LLVMFuncOp func, ValueRange operands, "
- "ArrayRef<NamedAttribute> attributes = {}",
+ let builders = [
+ OpBuilderDAG<(ins "LLVMFuncOp":$func, "ValueRange":$operands,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attributes),
[{
LLVMType resultType = func.getType().getFunctionResultType();
if (!resultType.isVoidTy())
string llvmBuilder = [{
$res = builder.CreateExtractElement($vector, $position);
}];
- let builders = [OpBuilder<
- "Value vector, Value position, ArrayRef<NamedAttribute> attrs = {}">];
+ let builders = [
+ OpBuilderDAG<(ins "Value":$vector, "Value":$position,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs)>];
let parser = [{ return parseExtractElementOp(parser, result); }];
let printer = [{ printExtractElementOp(p, *this); }];
}
$res = builder.CreateInsertValue($container, $value,
extractPosition($position));
}];
- let builders = [OpBuilder<
- "Value container, Value value, ArrayAttr position",
+ let builders = [
+ OpBuilderDAG<(ins "Value":$container, "Value":$value, "ArrayAttr":$position),
[{
build($_builder, $_state, container.getType(), container, value, position);
}]>];
SmallVector<int, 4> mask(position.begin(), position.end());
$res = builder.CreateShuffleVector($v1, $v2, mask);
}];
- let builders = [OpBuilder<
- "Value v1, Value v2, ArrayAttr mask, ArrayRef<NamedAttribute> attrs = {}">];
+ let builders = [
+ OpBuilderDAG<(ins "Value":$v1, "Value":$v2, "ArrayAttr":$mask,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs)>];
let verifier = [{
auto wrappedVectorType1 = v1().getType().cast<LLVMType>();
auto wrappedVectorType2 = v2().getType().cast<LLVMType>();
"$res = builder.CreateSelect($condition, $trueValue, $falseValue);"> {
let arguments = (ins LLVM_ScalarOrVectorOf<LLVM_i1>:$condition,
LLVM_Type:$trueValue, LLVM_Type:$falseValue);
- let builders = [OpBuilder<
- "Value condition, Value lhs, Value rhs", [{
+ let builders = [
+ OpBuilderDAG<(ins "Value":$condition, "Value":$lhs, "Value":$rhs),
+ [{
build($_builder, $_state, lhs.getType(), condition, lhs, rhs);
}]>];
let assemblyFormat = "operands attr-dict `:` type($condition) `,` type($res)";
attr-dict
}];
- let builders = [OpBuilder<
- "Value condition, Block *trueDest, ValueRange trueOperands,"
- "Block *falseDest, ValueRange falseOperands,"
- "Optional<std::pair<uint32_t, uint32_t>> weights = {}", [{
+ let builders = [
+ OpBuilderDAG<(ins "Value":$condition, "Block *":$trueDest,
+ "ValueRange":$trueOperands, "Block *":$falseDest,
+ "ValueRange":$falseOperands,
+ CArg<"Optional<std::pair<uint32_t, uint32_t>>", "{}">:$weights),
+ [{
ElementsAttr weightsAttr;
if (weights) {
weightsAttr =
}
build($_builder, $_state, condition, trueOperands, falseOperands, weightsAttr,
trueDest, falseDest);
- }]>, OpBuilder<
- "Value condition, Block *trueDest, Block *falseDest, "
- "ValueRange falseOperands = {}", [{
+ }]>,
+ OpBuilderDAG<(ins "Value":$condition, "Block *":$trueDest,
+ "Block *":$falseDest, CArg<"ValueRange", "{}">:$falseOperands),
+ [{
build($_builder, $_state, condition, trueDest, ValueRange(), falseDest,
falseOperands);
}]>, LLVM_TerminatorPassthroughOpBuilder];
let summary = "Creates a pointer pointing to a global or a function";
let builders = [
- OpBuilder<"LLVMType resType, "
- "StringRef name, ArrayRef<NamedAttribute> attrs = {}", [{
+ OpBuilderDAG<(ins "LLVMType":$resType, "StringRef":$name,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs),
+ [{
$_state.addAttribute("global_name",$_builder.getSymbolRefAttr(name));
$_state.addAttributes(attrs);
$_state.addTypes(resType);}]>,
-
- OpBuilder<"GlobalOp global, "
- "ArrayRef<NamedAttribute> attrs = {}", [{
+ OpBuilderDAG<(ins "GlobalOp":$global,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs),
+ [{
build($_builder, $_state,
global.getType().getPointerTo(global.addr_space()),
global.sym_name(), attrs);}]>,
-
- OpBuilder<"LLVMFuncOp func, "
- "ArrayRef<NamedAttribute> attrs = {}", [{
+ OpBuilderDAG<(ins "LLVMFuncOp":$func,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs),
+ [{
build($_builder, $_state,
func.getType().getPointerTo(), func.getName(), attrs);}]>
];
let regions = (region AnyRegion:$initializer);
let builders = [
- OpBuilder<"LLVMType type, "
- "bool isConstant, Linkage linkage, StringRef name, "
- "Attribute value, unsigned addrSpace = 0, "
- "ArrayRef<NamedAttribute> attrs = {}">
+ OpBuilderDAG<(ins "LLVMType":$type, "bool":$isConstant, "Linkage":$linkage,
+ "StringRef":$name, "Attribute":$value, CArg<"unsigned", "0">:$addrSpace,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs)>
];
let extraClassDeclaration = [{
let skipDefaultBuilders = 1;
let builders = [
- OpBuilder<"StringRef name, "
- "LLVMType type, Linkage linkage = Linkage::External, "
- "ArrayRef<NamedAttribute> attrs = {}, "
- "ArrayRef<MutableDictionaryAttr> argAttrs = {}">
+ OpBuilderDAG<(ins "StringRef":$name, "LLVMType":$type,
+ CArg<"Linkage", "Linkage::External">:$linkage,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs,
+ CArg<"ArrayRef<MutableDictionaryAttr>", "{}">:$argAttrs)>
];
let extraClassDeclaration = [{
%3 = linalg.range %0:%1:%2 : !linalg.range
````
}];
- let builders = [OpBuilder<
- "Value min, Value max, Value step",
+ let builders = [
+ OpBuilderDAG<(ins "Value":$min, "Value":$max, "Value":$step),
[{
auto rangeType = RangeType::get($_builder.getContext());
build($_builder, $_state, rangeType, min, max, step);
let builders = [
// Builders for a contracting reshape whose result type is computed from
// `src` and `reassociation`.
- OpBuilder<"Value src, "
- "ArrayRef<ReassociationExprs> reassociation, "
- "ArrayRef<NamedAttribute> attrs = {}">,
- OpBuilder<"Value src, "
- "ArrayRef<ReassociationIndices> reassociation, "
- "ArrayRef<NamedAttribute> attrs = {}", [{
+ OpBuilderDAG<(ins "Value":$src,
+ "ArrayRef<ReassociationExprs>":$reassociation,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs)>,
+ OpBuilderDAG<(ins "Value":$src,
+ "ArrayRef<ReassociationIndices>":$reassociation,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs),
+ [{
auto reassociationMaps =
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<"Type resultType, Value src, "
- "ArrayRef<ReassociationExprs> reassociation, "
- "ArrayRef<NamedAttribute> attrs = {}">,
- OpBuilder<"Type resultType, Value src, "
- "ArrayRef<ReassociationIndices> reassociation, "
- "ArrayRef<NamedAttribute> attrs = {}", [{
+ OpBuilderDAG<(ins "Type":$resultType, "Value":$src,
+ "ArrayRef<ReassociationExprs>":$reassociation,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs)>,
+ OpBuilderDAG<(ins "Type":$resultType, "Value":$src,
+ "ArrayRef<ReassociationIndices>":$reassociation,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs),
+ [{
auto reassociationMaps =
convertReassociationIndicesToMaps($_builder, reassociation);
build($_builder, $_state, resultType, src, reassociationMaps, attrs);
```
}];
- let builders = [OpBuilder<"Value base, ValueRange indexings">];
+ let builders = [OpBuilderDAG<(ins "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<
- "Value input, Value output", [{
- return build(
- $_builder, $_state, input, output, AffineMapAttr(), AffineMapAttr());
- }]>];
+ let builders = [OpBuilderDAG<(ins "Value":$input, "Value":$output),
+ [{
+ return build(
+ $_builder, $_state, input, output, AffineMapAttr(), AffineMapAttr());
+ }]>];
let extraClassDeclaration = libraryCallName # [{
// Rank-polymorphic.
}];
let builders = [
- OpBuilder<
- "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<
- "ValueRange inputs, ValueRange outputBuffers, "
- "ArrayRef<AffineMap> indexingMaps, ArrayRef<StringRef> iteratorTypes, "
- "StringRef doc, StringRef libraryCall, IntegerAttr symbolSource, "
- "function_ref<void(OpBuilder &, Location, ValueRange)> = nullptr">,
- OpBuilder<
- "TypeRange resultTensorTypes,"
- "ValueRange inputs, ValueRange outputBuffers, ValueRange initTensors, "
- "ArrayRef<AffineMap> indexingMaps, ArrayRef<StringRef> iteratorTypes, "
- "function_ref<void(OpBuilder &, Location, ValueRange)> = nullptr">,
- OpBuilder<
- "ValueRange inputs, "
- "ValueRange outputBuffers, ArrayRef<AffineMap> indexingMaps, "
- "ArrayRef<StringRef> iteratorTypes, "
- "function_ref<void(OpBuilder &, Location, ValueRange)> = nullptr">
+ OpBuilderDAG<(ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs,
+ "ValueRange":$outputBuffers, "ValueRange":$initTensors,
+ "ArrayRef<AffineMap>":$indexingMaps, "ArrayRef<StringRef>":$iteratorTypes,
+ "StringRef":$doc, "StringRef":$libraryCall, "IntegerAttr":$symbolSource,
+ CArg<"function_ref<void(OpBuilder &, Location, ValueRange)>", "nullptr">)>,
+ OpBuilderDAG<(ins "ValueRange":$inputs, "ValueRange":$outputBuffers,
+ "ArrayRef<AffineMap>":$indexingMaps, "ArrayRef<StringRef>":$iteratorTypes,
+ "StringRef":$doc, "StringRef":$libraryCall, "IntegerAttr":$symbolSource,
+ CArg<"function_ref<void(OpBuilder &, Location, ValueRange)>", "nullptr">)>,
+ OpBuilderDAG<(ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs,
+ "ValueRange":$outputBuffers, "ValueRange":$initTensors,
+ "ArrayRef<AffineMap>":$indexingMaps, "ArrayRef<StringRef>":$iteratorTypes,
+ CArg<"function_ref<void(OpBuilder &, Location, ValueRange)>", "nullptr">)>,
+ OpBuilderDAG<(ins "ValueRange":$inputs, "ValueRange":$outputBuffers,
+ "ArrayRef<AffineMap>":$indexingMaps, "ArrayRef<StringRef>":$iteratorTypes,
+ CArg<"function_ref<void(OpBuilder &, Location, ValueRange)>", "nullptr">)>
];
let verifier = [{ return ::verify(*this); }];
}];
let builders = [
- OpBuilder<
- "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<
- "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<
- "TypeRange resultTensorTypes,"
- "ValueRange inputs, ValueRange outputBuffers, ValueRange initTensors, "
- "ArrayRef<AffineMap> indexingMaps, ArrayRef<StringRef> iteratorTypes, "
- "function_ref<void(OpBuilder &, Location, ValueRange, ValueRange)> = nullptr">,
- OpBuilder<
- "ValueRange inputs, "
- "ValueRange outputBuffers, ArrayRef<AffineMap> indexingMaps, "
- "ArrayRef<StringRef> iteratorTypes, "
- "function_ref<void(OpBuilder &, Location, ValueRange, ValueRange)> = nullptr">
+ OpBuilderDAG<(ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs,
+ "ValueRange":$outputBuffers, "ValueRange":$initTensors,
+ "ArrayRef<AffineMap>":$indexingMaps, "ArrayRef<StringRef>":$iteratorTypes,
+ "StringRef":$doc, "StringRef":$libraryCall, "IntegerAttr":$symbolSource,
+ CArg<"function_ref<void(OpBuilder &, Location, ValueRange, ValueRange)>",
+ "nullptr">)>,
+ OpBuilderDAG<(ins "ValueRange":$inputs, "ValueRange":$outputBuffers,
+ "ArrayRef<AffineMap>":$indexingMaps, "ArrayRef<StringRef>":$iteratorTypes,
+ "StringRef":$doc, "StringRef":$libraryCall, "IntegerAttr":$symbolSource,
+ CArg<"function_ref<void(OpBuilder &, Location, ValueRange, ValueRange)>",
+ "nullptr">)>,
+ OpBuilderDAG<(ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs,
+ "ValueRange":$outputBuffers, "ValueRange":$initTensors,
+ "ArrayRef<AffineMap>":$indexingMaps, "ArrayRef<StringRef>":$iteratorTypes,
+ CArg<"function_ref<void(OpBuilder &, Location, ValueRange, ValueRange)>",
+ "nullptr">)>,
+ OpBuilderDAG<(ins "ValueRange":$inputs, "ValueRange":$outputBuffers,
+ "ArrayRef<AffineMap>":$indexingMaps, "ArrayRef<StringRef>":$iteratorTypes,
+ CArg<"function_ref<void(OpBuilder &, Location, ValueRange, ValueRange)>",
+ "nullptr">)>
];
let verifier = [{ return ::verify(*this); }];
let arguments = (ins Variadic<AnyType>:$operands);
- let builders = [
- OpBuilder<"", [{ /* nothing to do */ }]>
- ];
+ let builders = [OpBuilderDAG<(ins), [{ /* nothing to do */ }]>];
let verifier = ?;
}];
let builders = [
- OpBuilder<"StringRef name, "
- "ValueRange args = {}, ArrayRef<Attribute> params = {}", [{
+ OpBuilderDAG<(ins "StringRef":$name, CArg<"ValueRange", "{}">:$args,
+ CArg<"ArrayRef<Attribute>", "{}">:$params), [{
build($_builder, $_state, $_builder.getStringAttr(name), args,
params.empty() ? ArrayAttr() : $_builder.getArrayAttr(params));
}]>,
let assemblyFormat = "attr-dict (`:` $type^)? ($value^)?";
let builders = [
- OpBuilder<"Value type = Value()", [{
+ OpBuilderDAG<(ins CArg<"Value", "Value()">:$type), [{
build($_builder, $_state, $_builder.getType<AttributeType>(), type,
Attribute());
}]>,
- OpBuilder<"Attribute attr", [{
+ OpBuilderDAG<(ins "Attribute":$attr), [{
build($_builder, $_state, $_builder.getType<AttributeType>(), Value(), attr);
}]>,
];
let assemblyFormat = "(`:` $type^)? attr-dict";
let builders = [
- OpBuilder<"", [{
+ OpBuilderDAG<(ins), [{
build($_builder, $_state, $_builder.getType<ValueType>(), Value());
}]>,
];
let results = (outs PDL_Operation:$op,
Variadic<PDL_Value>:$results);
let builders = [
- OpBuilder<"Optional<StringRef> name = llvm::None, "
- "ValueRange operandValues = llvm::None, "
- "ArrayRef<StringRef> attrNames = llvm::None, "
- "ValueRange attrValues = llvm::None, "
- "ValueRange resultTypes = llvm::None", [{
+ OpBuilderDAG<(ins CArg<"Optional<StringRef>", "llvm::None">:$name,
+ CArg<"ValueRange", "llvm::None">:$operandValues,
+ CArg<"ArrayRef<StringRef>", "llvm::None">:$attrNames,
+ CArg<"ValueRange", "llvm::None">:$attrValues,
+ CArg<"ValueRange", "llvm::None">:$resultTypes), [{
auto nameAttr = name ? StringAttr() : $_builder.getStringAttr(*name);
build($_builder, $_state, $_builder.getType<OperationType>(), {}, nameAttr,
operandValues, attrValues, $_builder.getStrArrayAttr(attrNames),
}];
let builders = [
- OpBuilder<"Optional<StringRef> rootKind = llvm::None, "
- "Optional<uint16_t> benefit = 1, "
- "Optional<StringRef> name = llvm::None">,
+ OpBuilderDAG<(ins CArg<"Optional<StringRef>", "llvm::None">:$rootKind,
+ CArg<"Optional<uint16_t>", "1">:$benefit,
+ CArg<"Optional<StringRef>", "llvm::None">:$name)>,
];
let extraClassDeclaration = [{
//===------------------------------------------------------------------===//
let assemblyFormat = "attr-dict (`:` $type^)?";
let builders = [
- OpBuilder<"Type ty = Type()", [{
+ OpBuilderDAG<(ins CArg<"Type", "Type()">:$ty), [{
build($_builder, $_state, $_builder.getType<AttributeType>(),
ty ? TypeAttr::get(ty) : TypeAttr());
}]>,
let assemblyFormat = "$value attr-dict";
let builders = [
- OpBuilder<"Attribute value", [{
- build($_builder, $_state, $_builder.getType<pdl::AttributeType>(), value);
- }]>];
+ OpBuilderDAG<(ins "Attribute":$value), [{
+ build($_builder, $_state, $_builder.getType<pdl::AttributeType>(), value);
+ }]>];
}
//===----------------------------------------------------------------------===//
let results = (outs PDL_Operation:$operation);
let builders = [
- OpBuilder<"StringRef name, ValueRange types, ValueRange operands, "
- "ValueRange attributes, ArrayAttr attributeNames", [{
- build($_builder, $_state, $_builder.getType<pdl::OperationType>(), name,
- operands, attributes, attributeNames, types);
- }]>];
+ OpBuilderDAG<(ins "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); }];
let printer = [{ ::print(p, *this); }];
}
let assemblyFormat = "$value attr-dict";
let builders = [
- OpBuilder<"TypeAttr type", [{
+ OpBuilderDAG<(ins "TypeAttr":$type), [{
build($_builder, $_state, $_builder.getType<pdl::TypeType>(), type);
}]>
];
let assemblyFormat = "`of` $value attr-dict";
let builders = [
- OpBuilder<"Value value", [{
+ OpBuilderDAG<(ins "Value":$value), [{
build($_builder, $_state, $_builder.getType<pdl::TypeType>(), value);
}]>
];
let assemblyFormat = "`of` $value attr-dict";
let builders = [
- OpBuilder<"Value value", [{
+ OpBuilderDAG<(ins "Value":$value), [{
build($_builder, $_state, $_builder.getType<pdl::TypeType>(), value);
}]>
];
let assemblyFormat = "attr-dict";
let builders = [
- OpBuilder<"", [{
+ OpBuilderDAG<(ins), [{
build($_builder, $_state, $_builder.getType<pdl::TypeType>());
}]>,
];
}];
let builders = [
- OpBuilder<"Value attribute, ArrayRef<Attribute> caseValues,"
- "Block *defaultDest, BlockRange dests", [{
+ OpBuilderDAG<(ins "Value":$attribute, "ArrayRef<Attribute>":$caseValues,
+ "Block *":$defaultDest, "BlockRange":$dests), [{
build($_builder, $_state, attribute, $_builder.getArrayAttr(caseValues),
defaultDest, dests);
}]>];
}];
let builders = [
- OpBuilder<"Value operation, ArrayRef<int32_t> counts, "
- "Block *defaultDest, BlockRange dests", [{
+ OpBuilderDAG<(ins "Value":$operation, "ArrayRef<int32_t>":$counts,
+ "Block *":$defaultDest, "BlockRange":$dests), [{
build($_builder, $_state, operation, $_builder.getI32VectorAttr(counts),
defaultDest, dests);
}]>];
}];
let builders = [
- OpBuilder<"Value operation, ArrayRef<OperationName> names, "
- "Block *defaultDest, BlockRange dests", [{
+ OpBuilderDAG<(ins "Value":$operation, "ArrayRef<OperationName>":$names,
+ "Block *":$defaultDest, "BlockRange":$dests), [{
auto stringNames = llvm::to_vector<8>(llvm::map_range(names,
[](OperationName name) { return name.getStringRef(); }));
build($_builder, $_state, operation, $_builder.getStrArrayAttr(stringNames),
}];
let builders = [
- OpBuilder<"Value operation, ArrayRef<int32_t> counts, Block *defaultDest, "
- "BlockRange dests", [{
+ OpBuilderDAG<(ins "Value":$operation, "ArrayRef<int32_t>":$counts,
+ "Block *":$defaultDest, "BlockRange":$dests), [{
build($_builder, $_state, operation, $_builder.getI32VectorAttr(counts),
defaultDest, dests);
}]>];
}];
let builders = [
- OpBuilder<"Value edge, TypeRange types, Block *defaultDest, "
- "BlockRange dests", [{
+ OpBuilderDAG<(ins "Value":$edge, "TypeRange":$types, "Block *":$defaultDest,
+ "BlockRange":$dests), [{
build($_builder, $_state, edge, $_builder.getTypeArrayAttr(types),
defaultDest, dests);
}]>,
let skipDefaultBuilders = 1;
let builders = [
- OpBuilder<"Value lowerBound, Value upperBound, Value step, "
- "ValueRange iterArgs = llvm::None, "
- "function_ref<void(OpBuilder &, Location, Value, ValueRange)>"
- " = nullptr">
+ OpBuilderDAG<(ins "Value":$lowerBound, "Value":$upperBound, "Value":$step,
+ CArg<"ValueRange", "llvm::None">:$iterArgs,
+ CArg<"function_ref<void(OpBuilder &, Location, Value, ValueRange)>",
+ "nullptr">)>
];
let extraClassDeclaration = [{
let skipDefaultBuilders = 1;
let builders = [
- OpBuilder<"Value cond, bool withElseRegion">,
- OpBuilder<"TypeRange resultTypes, Value cond, bool withElseRegion">,
- OpBuilder<
- "TypeRange resultTypes, Value cond, "
- "function_ref<void(OpBuilder &, Location)> thenBuilder "
- " = buildTerminatedBody, "
- "function_ref<void(OpBuilder &, Location)> elseBuilder = nullptr">,
- OpBuilder<
- "Value cond, "
- "function_ref<void(OpBuilder &, Location)> thenBuilder "
- " = buildTerminatedBody, "
- "function_ref<void(OpBuilder &, Location)> elseBuilder = nullptr">
+ OpBuilderDAG<(ins "Value":$cond, "bool":$withElseRegion)>,
+ OpBuilderDAG<(ins "TypeRange":$resultTypes, "Value":$cond,
+ "bool":$withElseRegion)>,
+ OpBuilderDAG<(ins "TypeRange":$resultTypes, "Value":$cond,
+ CArg<"function_ref<void(OpBuilder &, Location)>",
+ "buildTerminatedBody">:$thenBuilder,
+ CArg<"function_ref<void(OpBuilder &, Location)>",
+ "nullptr">:$elseBuilder)>,
+ OpBuilderDAG<(ins "Value":$cond,
+ CArg<"function_ref<void(OpBuilder &, Location)>",
+ "buildTerminatedBody">:$thenBuilder,
+ CArg<"function_ref<void(OpBuilder &, Location)>",
+ "nullptr">:$elseBuilder)>
];
let extraClassDeclaration = [{
let skipDefaultBuilders = 1;
let builders = [
- OpBuilder<"ValueRange lowerBounds, ValueRange upperBounds, "
- "ValueRange steps, ValueRange initVals, "
- "function_ref<void (OpBuilder &, Location, "
- "ValueRange, ValueRange)>"
- " bodyBuilderFn = nullptr">,
- OpBuilder<"ValueRange lowerBounds, ValueRange upperBounds, "
- "ValueRange steps, "
- "function_ref<void (OpBuilder &, Location, ValueRange)>"
- " bodyBuilderFn = nullptr">,
+ OpBuilderDAG<(ins "ValueRange":$lowerBounds, "ValueRange":$upperBounds,
+ "ValueRange":$steps, "ValueRange":$initVals,
+ CArg<"function_ref<void (OpBuilder &, Location, ValueRange, ValueRange)>",
+ "nullptr">:$bodyBuilderFn)>,
+ OpBuilderDAG<(ins "ValueRange":$lowerBounds, "ValueRange":$upperBounds,
+ "ValueRange":$steps,
+ CArg<"function_ref<void (OpBuilder &, Location, ValueRange)>",
+ "nullptr">:$bodyBuilderFn)>,
];
let extraClassDeclaration = [{
let skipDefaultBuilders = 1;
let builders = [
- OpBuilder<"Value operand, "
- "function_ref<void (OpBuilder &, Location, Value, Value)>"
- " bodyBuilderFn = nullptr">
+ OpBuilderDAG<(ins "Value":$operand,
+ CArg<"function_ref<void (OpBuilder &, Location, Value, Value)>",
+ "nullptr">:$bodyBuilderFn)>
];
let arguments = (ins AnyType:$operand);
}];
let arguments = (ins Variadic<AnyType>:$results);
- let builders = [
- OpBuilder<"", [{ /* nothing to do */ }]>
- ];
+ let builders = [OpBuilderDAG<(ins), [{ /* nothing to do */ }]>];
// Override default verifier (defined in SCF_Op), no custom verification
// needed.
let verifier = ?;
);
let builders = [
- OpBuilder<
- [{Value pointer, ::mlir::spirv::Scope scope,
- ::mlir::spirv::MemorySemantics memory, Value value}],
- [{build($_builder, $_state, value.getType(), pointer, scope, memory, value);}]
- >
+ OpBuilderDAG<(ins "Value":$pointer, "::mlir::spirv::Scope":$scope,
+ "::mlir::spirv::MemorySemantics":$memory, "Value":$value),
+ [{build($_builder, $_state, value.getType(), pointer, scope, memory, value);}]>
];
}
);
let builders = [
- OpBuilder<[{Value composite, ArrayRef<int32_t> indices}]>
+ OpBuilderDAG<(ins "Value":$composite, "ArrayRef<int32_t>":$indices)>
];
let hasFolder = 1;
);
let builders = [
- OpBuilder<[{Value object, Value composite, ArrayRef<int32_t> indices}]>
+ OpBuilderDAG<(ins "Value":$object, "Value":$composite,
+ "ArrayRef<int32_t>":$indices)>
];
}
let verifier = [{ return success(); }];
let builders = [
- OpBuilder<
- "Block *successor, ValueRange arguments = {}", [{
- $_state.addSuccessors(successor);
- $_state.addOperands(arguments);
- }]
- >
+ OpBuilderDAG<(ins "Block *":$successor, CArg<"ValueRange", "{}">:$arguments),
+ [{
+ $_state.addSuccessors(successor);
+ $_state.addOperands(arguments);
+ }]>
];
let skipDefaultBuilders = 1;
AnySuccessor:$falseTarget);
let builders = [
- OpBuilder<
- "Value condition, "
- "Block *trueBlock, ValueRange trueArguments, "
- "Block *falseBlock, ValueRange falseArguments, "
- "Optional<std::pair<uint32_t, uint32_t>> weights = {}",
- [{
- ArrayAttr weightsAttr;
- if (weights) {
- weightsAttr =
- $_builder.getI32ArrayAttr({static_cast<int32_t>(weights->first),
- static_cast<int32_t>(weights->second)});
- }
- build($_builder, $_state, condition, trueArguments, falseArguments,
- weightsAttr, trueBlock, falseBlock);
- }]
- >
+ OpBuilderDAG<(ins "Value":$condition, "Block *":$trueBlock,
+ "ValueRange":$trueArguments, "Block *":$falseBlock,
+ "ValueRange":$falseArguments,
+ CArg<"Optional<std::pair<uint32_t, uint32_t>>", "{}">:$weights),
+ [{
+ ArrayAttr weightsAttr;
+ if (weights) {
+ weightsAttr =
+ $_builder.getI32ArrayAttr({static_cast<int32_t>(weights->first),
+ static_cast<int32_t>(weights->second)});
+ }
+ build($_builder, $_state, condition, trueArguments, falseArguments,
+ weightsAttr, trueBlock, falseBlock);
+ }]>
];
let autogenSerialization = 0;
let regions = (region AnyRegion:$body);
- let builders = [OpBuilder<"">];
+ let builders = [OpBuilderDAG<(ins)>];
let extraClassDeclaration = [{
// Returns the entry block.
let printer = [{ return ::printLogicalOp(getOperation(), p); }];
let builders = [
- OpBuilder<
- "Value lhs, Value rhs",
- "::buildLogicalBinaryOp($_builder, $_state, lhs, rhs);">
+ OpBuilderDAG<(ins "Value":$lhs, "Value":$rhs),
+ [{::buildLogicalBinaryOp($_builder, $_state, lhs, rhs);}]>
];
}
SPV_SelectType:$result
);
- let builders = [OpBuilder<[{Value cond, Value trueValue,
- Value falseValue}]>];
+ let builders = [
+ OpBuilderDAG<(ins "Value":$cond, "Value":$trueValue, "Value":$falseValue)>];
let assemblyFormat = [{
operands attr-dict `:` type($condition) `,` type($result)
SPV_Bool:$result
);
- let builders = [
- OpBuilder<[{spirv::Scope}]>
- ];
+ let builders = [OpBuilderDAG<(ins "spirv::Scope")>];
let assemblyFormat = "$execution_scope attr-dict `:` type($result)";
}
SPV_AnyPtr:$component_ptr
);
- let builders = [OpBuilder<[{Value basePtr, ValueRange indices}]>];
+ let builders = [OpBuilderDAG<(ins "Value":$basePtr, "ValueRange":$indices)>];
let hasCanonicalizer = 1;
}
let autogenSerialization = 0;
- let builders = [OpBuilder<[{spirv::FuncOp function,
- spirv::ExecutionMode executionMode,
- ArrayRef<int32_t> params}]>];
+ let builders = [
+ OpBuilderDAG<(ins "spirv::FuncOp":$function,
+ "spirv::ExecutionMode":$executionMode, "ArrayRef<int32_t>":$params)>];
}
// -----
);
let builders = [
- OpBuilder<[{
- Value basePtr, IntegerAttr memory_access = {},
- IntegerAttr alignment = {}
- }]>
+ OpBuilderDAG<(ins "Value":$basePtr,
+ CArg<"IntegerAttr", "{}">:$memory_access,
+ CArg<"IntegerAttr", "{}">:$alignment)>
];
}
let results = (outs);
let builders = [
- OpBuilder<
- "Value ptr, Value value, ArrayRef<NamedAttribute> namedAttrs = {}", [{
+ OpBuilderDAG<(ins "Value":$ptr, "Value":$value,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$namedAttrs),
+ [{
$_state.addOperands(ptr);
$_state.addOperands(value);
$_state.addAttributes(namedAttrs);
let autogenSerialization = 0;
- let builders = [OpBuilder<[{spirv::GlobalVariableOp var}]>];
+ let builders = [OpBuilderDAG<(ins "spirv::GlobalVariableOp":$var)>];
let assemblyFormat = "$variable attr-dict `:` type($pointer)";
}
let autogenSerialization = 0;
- let builders = [OpBuilder<[{spirv::ExecutionModel executionModel,
- spirv::FuncOp function,
- ArrayRef<Attribute> interfaceVars}]>];
+ let builders = [
+ OpBuilderDAG<(ins "spirv::ExecutionModel":$executionModel,
+ "spirv::FuncOp":$function, "ArrayRef<Attribute>":$interfaceVars)>];
}
// -----
let verifier = [{ return success(); }];
- let builders = [OpBuilder<[{
- StringRef name, FunctionType type,
- spirv::FunctionControl control = spirv::FunctionControl::None,
- ArrayRef<NamedAttribute> attrs = {}
- }]>];
+ let builders = [
+ OpBuilderDAG<(ins "StringRef":$name, "FunctionType":$type,
+ CArg<"spirv::FunctionControl", "spirv::FunctionControl::None">:$control,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs)>];
let hasOpcode = 0;
let results = (outs);
let builders = [
- OpBuilder<
- "TypeAttr type, ArrayRef<NamedAttribute> namedAttrs", [{
+ OpBuilderDAG<(ins "TypeAttr":$type, "ArrayRef<NamedAttribute>":$namedAttrs),
+ [{
$_state.addAttribute("type", type);
$_state.addAttributes(namedAttrs);
}]>,
- OpBuilder<[{Type type, StringRef name, unsigned descriptorSet,
- unsigned binding}]>,
- OpBuilder<[{Type type, StringRef name, spirv::BuiltIn builtin}]>
+ OpBuilderDAG<(ins "Type":$type, "StringRef":$name,
+ "unsigned":$descriptorSet, "unsigned":$binding)>,
+ OpBuilderDAG<(ins "Type":$type, "StringRef":$name,
+ "spirv::BuiltIn":$builtin)>
];
let hasOpcode = 0;
let regions = (region SizedRegion<1>:$body);
let builders = [
- OpBuilder<[{Optional<StringRef> name = llvm::None}]>,
- OpBuilder<[{spirv::AddressingModel addressing_model,
- spirv::MemoryModel memory_model,
- Optional<StringRef> name = llvm::None}]>
+ OpBuilderDAG<(ins CArg<"Optional<StringRef>", "llvm::None">:$name)>,
+ OpBuilderDAG<(ins "spirv::AddressingModel":$addressing_model,
+ "spirv::MemoryModel":$memory_model,
+ CArg<"Optional<StringRef>", "llvm::None">:$name)>
];
// We need to ensure the block inside the region is properly terminated;
let arguments = (ins IndexAttr:$value);
let results = (outs Shape_SizeType:$result);
- let builders = [
- OpBuilder<"int64_t value">
- ];
+ let builders = [OpBuilderDAG<(ins "int64_t":$value)>];
let assemblyFormat = "$value attr-dict";
let hasFolder = 1;
let builders = [
// Builder that allows passing a constant dimension as a simple integer.
- OpBuilder<"Value shape, "
- "int64_t dim">
+ OpBuilderDAG<(ins "Value":$shape, "int64_t":$dim)>
];
let extraClassDeclaration = [{
let arguments = (ins Shape_ShapeOrExtentTensorType:$shape);
let results = (outs Shape_SizeOrIndexType:$result);
- let builders = [
- OpBuilder<"Value shape">,
- ];
+ let builders = [OpBuilderDAG<(ins "Value":$shape)>];
let assemblyFormat = "$shape `:` type($shape) `->` type($result) attr-dict";
let results = (outs Variadic<AnyType>:$result);
let regions = (region SizedRegion<1>:$region);
- let builders = [
- OpBuilder<"Value shape, ValueRange initVals">,
- ];
+ let builders = [OpBuilderDAG<(ins "Value":$shape, "ValueRange":$initVals)>];
let verifier = [{ return ::verify(*this); }];
let printer = [{ return ::print(p, *this); }];
let assemblyFormat = "$arg `:` type($arg) `->` type($result) attr-dict";
- let builders = [
- OpBuilder<"Value arg">
- ];
+ let builders = [OpBuilderDAG<(ins "Value":$arg)>];
let verifier = [{ return ::verifyShapeOrExtentTensorOp(*this); }];
let hasCanonicalizer = 1;
let arguments = (ins Variadic<AnyType>:$operands);
- let builders = [
- OpBuilder<"", [{ build($_builder, $_state, llvm::None); }]>
+ let builders = [OpBuilderDAG<(ins),
+ [{ build($_builder, $_state, llvm::None); }]>
];
let verifier = [{ return ::verify(*this); }];
let arguments = (ins Variadic<AnyType>:$operands);
- let builders = [
- OpBuilder<"", [{ /* nothing to do */ }]>
- ];
+ let builders = [OpBuilderDAG<(ins), [{ /* nothing to do */ }]>];
let assemblyFormat = "attr-dict ($operands^ `:` type($operands))?";
}
let results = (outs AnyType);
- let builders = [OpBuilder<
- "Value source, Type destType", [{
+ let builders = [
+ OpBuilderDAG<(ins "Value":$source, "Type":$destType), [{
impl::buildCastOp($_builder, $_state, source, destType);
- }]>];
+ }]>
+ ];
let parser = [{
return impl::parseCastOp(parser, result);
Confined<OptionalAttr<I64Attr>, [IntMinValue<0>]>:$alignment);
let results = (outs Res<AnyMemRef, "", [MemAlloc<resource>]>);
- let builders = [OpBuilder<
- "MemRefType memrefType", [{
- $_state.types.push_back(memrefType);
- }]>,
- OpBuilder<
- "MemRefType memrefType, ValueRange operands, "
- "IntegerAttr alignment = IntegerAttr()", [{
- $_state.addOperands(operands);
- $_state.types.push_back(memrefType);
- if (alignment)
- $_state.addAttribute(getAlignmentAttrName(), alignment);
- }]>];
+ let builders = [
+ OpBuilderDAG<(ins "MemRefType":$memrefType), [{
+ $_state.types.push_back(memrefType);
+ }]>,
+ OpBuilderDAG<(ins "MemRefType":$memrefType, "ValueRange":$operands,
+ CArg<"IntegerAttr", "IntegerAttr()">:$alignment), [{
+ $_state.addOperands(operands);
+ $_state.types.push_back(memrefType);
+ if (alignment)
+ $_state.addAttribute(getAlignmentAttrName(), alignment);
+ }]>];
let extraClassDeclaration = [{
static StringRef getAlignmentAttrName() { return "alignment"; }
let regions = (region AnyRegion:$body);
let skipDefaultBuilders = 1;
- let builders = [
- OpBuilder<"Value memref, ValueRange ivs">
- ];
+ let builders = [OpBuilderDAG<(ins "Value":$memref, "ValueRange":$ivs)>];
let extraClassDeclaration = [{
// The value stored in memref[ivs].
let arguments = (ins Variadic<AnyType>:$destOperands);
let successors = (successor AnySuccessor:$dest);
- let builders = [OpBuilder<"Block *dest, ValueRange destOperands = {}", [{
- $_state.addSuccessors(dest);
- $_state.addOperands(destOperands);
- }]>];
+ let builders = [
+ OpBuilderDAG<(ins "Block *":$dest,
+ CArg<"ValueRange", "{}">:$destOperands), [{
+ $_state.addSuccessors(dest);
+ $_state.addOperands(destOperands);
+ }]>];
// BranchOp is fully verified by traits.
let verifier = ?;
let arguments = (ins FlatSymbolRefAttr:$callee, Variadic<AnyType>:$operands);
let results = (outs Variadic<AnyType>);
- let builders = [OpBuilder<
- "FuncOp callee, ValueRange operands = {}", [{
+ let builders = [
+ OpBuilderDAG<(ins "FuncOp":$callee, CArg<"ValueRange", "{}">:$operands), [{
$_state.addOperands(operands);
$_state.addAttribute("callee",$_builder.getSymbolRefAttr(callee));
$_state.addTypes(callee.getType().getResults());
- }]>, OpBuilder<
- "SymbolRefAttr callee, TypeRange results, ValueRange operands = {}", [{
+ }]>,
+ OpBuilderDAG<(ins "SymbolRefAttr":$callee, "TypeRange":$results,
+ CArg<"ValueRange", "{}">:$operands), [{
$_state.addOperands(operands);
$_state.addAttribute("callee", callee);
$_state.addTypes(results);
- }]>, OpBuilder<
- "StringRef callee, TypeRange results, ValueRange operands = {}", [{
+ }]>,
+ OpBuilderDAG<(ins "StringRef":$callee, "TypeRange":$results,
+ CArg<"ValueRange", "{}">:$operands), [{
build($_builder, $_state, $_builder.getSymbolRefAttr(callee), results,
operands);
- }]>];
+ }]>];
let extraClassDeclaration = [{
StringRef getCallee() { return callee(); }
let arguments = (ins FunctionType:$callee, Variadic<AnyType>:$operands);
let results = (outs Variadic<AnyType>:$results);
- let builders = [OpBuilder<
- "Value callee, ValueRange operands = {}", [{
+ let builders = [
+ OpBuilderDAG<(ins "Value":$callee, CArg<"ValueRange", "{}">:$operands), [{
$_state.operands.push_back(callee);
$_state.addOperands(operands);
$_state.addTypes(callee.getType().cast<FunctionType>().getResults());
- }]>];
+ }]>];
let extraClassDeclaration = [{
Value getCallee() { return getOperand(0); }
);
let results = (outs BoolLike:$result);
- let builders = [OpBuilder<
- "CmpFPredicate predicate, Value lhs, Value rhs", [{
+ let builders = [
+ OpBuilderDAG<(ins "CmpFPredicate":$predicate, "Value":$lhs,
+ "Value":$rhs), [{
::buildCmpFOp($_builder, $_state, predicate, lhs, rhs);
- }]>];
+ }]>];
let extraClassDeclaration = [{
static StringRef getPredicateAttrName() { return "predicate"; }
);
let results = (outs BoolLike:$result);
- let builders = [OpBuilder<
- "CmpIPredicate predicate, Value lhs, Value rhs", [{
+ let builders = [
+ OpBuilderDAG<(ins "CmpIPredicate":$predicate, "Value":$lhs,
+ "Value":$rhs), [{
::buildCmpIOp($_builder, $_state, predicate, lhs, rhs);
- }]>];
+ }]>];
let extraClassDeclaration = [{
static StringRef getPredicateAttrName() { return "predicate"; }
Variadic<AnyType>:$falseDestOperands);
let successors = (successor AnySuccessor:$trueDest, AnySuccessor:$falseDest);
- let builders = [OpBuilder<
- "Value condition, Block *trueDest, ValueRange trueOperands,"
- "Block *falseDest, ValueRange falseOperands", [{
+ let builders = [
+ OpBuilderDAG<(ins "Value":$condition, "Block *":$trueDest,
+ "ValueRange":$trueOperands, "Block *":$falseDest,
+ "ValueRange":$falseOperands), [{
build($_builder, $_state, condition, trueOperands, falseOperands, trueDest,
falseDest);
- }]>, OpBuilder<
- "Value condition, Block *trueDest, Block *falseDest, "
- "ValueRange falseOperands = {}", [{
+ }]>,
+ OpBuilderDAG<(ins "Value":$condition, "Block *":$trueDest,
+ "Block *":$falseDest, CArg<"ValueRange", "{}">:$falseOperands), [{
build($_builder, $_state, condition, trueDest, ValueRange(), falseDest,
falseOperands);
- }]>];
+ }]>];
// CondBranchOp is fully verified by traits.
let verifier = ?;
let arguments = (ins AnyAttr:$value);
let results = (outs AnyType);
- let builders = [OpBuilder<"Attribute value",
+ let builders = [
+ OpBuilderDAG<(ins "Attribute":$value),
[{ build($_builder, $_state, value.getType(), value); }]>];
let extraClassDeclaration = [{
}];
let builders = [
- OpBuilder<"Value memrefOrTensor, int64_t index">,
- OpBuilder<"Value memrefOrTensor, Value index">
+ OpBuilderDAG<(ins "Value":$memrefOrTensor, "int64_t":$index)>,
+ OpBuilderDAG<(ins "Value":$memrefOrTensor, "Value":$index)>
];
let extraClassDeclaration = [{
let builders = [
// Build op and populate its body per callback function.
- OpBuilder<"Type resultTy, ValueRange dynamicExtents, "
- "function_ref<void(OpBuilder &, Location, ValueRange)>">,
+ OpBuilderDAG<(ins "Type":$resultTy, "ValueRange":$dynamicExtents,
+ "function_ref<void(OpBuilder &, Location, ValueRange)>")>,
];
let hasCanonicalizer = 1;
Variadic<Index>:$indices);
let results = (outs AnyType:$result);
- let builders = [OpBuilder<
- "Value aggregate, ValueRange indices = {}", [{
+ let builders = [
+ OpBuilderDAG<(ins "Value":$aggregate, CArg<"ValueRange", "{}">:$indices), [{
auto resType = aggregate.getType().cast<ShapedType>()
.getElementType();
build($_builder, $_state, resType, aggregate, indices);
let skipDefaultBuilders = 1;
let builders = [
- OpBuilder<"Type elementType, ValueRange elements">,
+ OpBuilderDAG<(ins "Type":$elementType, "ValueRange":$elements)>,
// Special case builder for when `elements` has size >=1.
- OpBuilder<"ValueRange elements">
+ OpBuilderDAG<(ins "ValueRange":$elements)>
];
let hasCanonicalizer = 1;
Variadic<Index>:$indices);
let results = (outs AnyType:$result);
- let builders = [OpBuilder<
- "Value memref, ValueRange indices = {}", [{
+ let builders = [
+ OpBuilderDAG<(ins "Value":$memref, CArg<"ValueRange", "{}">:$indices), [{
auto memrefType = memref.getType().cast<MemRefType>();
$_state.addOperands(memref);
$_state.addOperands(indices);
$_state.types.push_back(memrefType.getElementType());
- }]>];
+ }]>];
let extraClassDeclaration = [{
Value getMemRef() { return getOperand(0); }
);
let results = (outs AnyRankedOrUnrankedMemRef:$result);
- let builders = [OpBuilder<
- "MemRefType resultType, Value operand, Value shape", [{
+ let builders = [OpBuilderDAG<
+ (ins "MemRefType":$resultType, "Value":$operand, "Value":$shape), [{
$_state.addOperands(operand);
$_state.addOperands(shape);
$_state.addTypes(resultType);
let results = (outs Index);
let verifier = ?;
- let builders = [OpBuilder<
- "Value tensor", [{
+ let builders = [
+ OpBuilderDAG<(ins "Value":$tensor), [{
auto indexType = $_builder.getIndexType();
build($_builder, $_state, indexType, tensor);
}]>];
let arguments = (ins Variadic<AnyType>:$operands);
- let builders = [OpBuilder<"", [{ build($_builder, $_state, llvm::None); }]>];
+ let builders = [
+ OpBuilderDAG<(ins),
+ [{ build($_builder, $_state, llvm::None); }]>];
let assemblyFormat = "attr-dict ($operands^ `:` type($operands))?";
}
AnyType:$false_value);
let results = (outs AnyType:$result);
- let builders = [OpBuilder<
- "Value condition, Value trueValue, Value falseValue", [{
+ let builders = [
+ OpBuilderDAG<(ins "Value":$condition, "Value":$trueValue,
+ "Value":$falseValue), [{
$_state.addOperands({condition, trueValue, falseValue});
$_state.addTypes(trueValue.getType());
- }]>];
+ }]>];
let extraClassDeclaration = [{
Value getCondition() { return condition(); }
let arguments = (ins SignlessIntegerLike:$value);
let results = (outs SignlessIntegerLike);
- let builders = [OpBuilder<"Value value, Type destType", [{
+ let builders = [
+ OpBuilderDAG<(ins "Value":$value, "Type":$destType), [{
$_state.addOperands(value);
$_state.addTypes(destType);
- }]>];
+ }]>];
let parser = [{
return impl::parseCastOp(parser, result);
"integer or float type">:$input);
let results = (outs AnyTypeOf<[AnyVector, AnyStaticShapeTensor]>:$aggregate);
- let builders =
- [OpBuilder<"Value element, Type aggregateType",
- [{ build($_builder, $_state, aggregateType, element); }]>];
+ let builders = [
+ OpBuilderDAG<(ins "Value":$element, "Type":$aggregateType),
+ [{ build($_builder, $_state, aggregateType, element); }]>];
let hasFolder = 1;
[MemWrite]>:$memref,
Variadic<Index>:$indices);
- let builders = [OpBuilder<
- "Value valueToStore, Value memref", [{
+ let builders = [
+ OpBuilderDAG<(ins "Value":$valueToStore, "Value":$memref), [{
$_state.addOperands(valueToStore);
$_state.addOperands(memref);
- }]>];
+ }]>];
let extraClassDeclaration = [{
Value getValueToStore() { return getOperand(0); }
let builders = [
// Build a SubViewOp with mixed static and dynamic entries.
- OpBuilder<
- "Value source, ArrayRef<int64_t> staticOffsets, "
- "ArrayRef<int64_t> staticSizes, ArrayRef<int64_t> staticStrides, "
- "ValueRange offsets, ValueRange sizes, ValueRange strides, "
- "ArrayRef<NamedAttribute> attrs = {}">,
+ OpBuilderDAG<(ins "Value":$source, "ArrayRef<int64_t>":$staticOffsets,
+ "ArrayRef<int64_t>":$staticSizes, "ArrayRef<int64_t>":$staticStrides,
+ "ValueRange":$offsets, "ValueRange":$sizes, "ValueRange":$strides,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs)>,
// Build a SubViewOp with all dynamic entries.
- OpBuilder<
- "Value source, ValueRange offsets, ValueRange sizes, ValueRange strides, "
- "ArrayRef<NamedAttribute> attrs = {}">,
+ OpBuilderDAG<(ins "Value":$source, "ValueRange":$offsets,
+ "ValueRange":$sizes, "ValueRange":$strides,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs)>,
// Build a SubViewOp with mixed static and dynamic entries
// and custom result type.
- OpBuilder<
- "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 = {}">,
+ OpBuilderDAG<(ins "MemRefType":$resultType, "Value":$source,
+ "ArrayRef<int64_t>":$staticOffsets, "ArrayRef<int64_t>":$staticSizes,
+ "ArrayRef<int64_t>":$staticStrides, "ValueRange":$offsets,
+ "ValueRange":$sizes, "ValueRange":$strides,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs)>,
// Build a SubViewOp with all dynamic entries and custom result type.
- OpBuilder<
- "MemRefType resultType, Value source, ValueRange offsets, "
- "ValueRange sizes, ValueRange strides, "
- "ArrayRef<NamedAttribute> attrs = {}">
+ OpBuilderDAG<(ins "MemRefType":$resultType, "Value":$source,
+ "ValueRange":$offsets, "ValueRange":$sizes, "ValueRange":$strides,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs)>
];
let extraClassDeclaration = extraBaseClassDeclaration # [{
let builders = [
// Build a SubViewOp with mixed static and dynamic entries.
- OpBuilder<
- "Value source, ArrayRef<int64_t> staticOffsets, "
- "ArrayRef<int64_t> staticSizes, ArrayRef<int64_t> staticStrides, "
- "ValueRange offsets, ValueRange sizes, ValueRange strides, "
- "ArrayRef<NamedAttribute> attrs = {}">,
+ OpBuilderDAG<(ins "Value":$source, "ArrayRef<int64_t>":$staticOffsets,
+ "ArrayRef<int64_t>":$staticSizes, "ArrayRef<int64_t>":$staticStrides,
+ "ValueRange":$offsets, "ValueRange":$sizes, "ValueRange":$strides,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs)>,
// Build a SubViewOp with all dynamic entries.
- OpBuilder<
- "Value source, ValueRange offsets, ValueRange sizes, ValueRange strides, "
- "ArrayRef<NamedAttribute> attrs = {}">
+ OpBuilderDAG<(ins "Value":$source, "ValueRange":$offsets,
+ "ValueRange":$sizes, "ValueRange":$strides,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs)>
];
let extraClassDeclaration = extraBaseClassDeclaration # [{
let builders = [
// Build a SubViewOp with mixed static and dynamic entries.
- OpBuilder<
- "Value source, Value dest, ArrayRef<int64_t> staticOffsets, "
- "ArrayRef<int64_t> staticSizes, ArrayRef<int64_t> staticStrides, "
- "ValueRange offsets, ValueRange sizes, ValueRange strides, "
- "ArrayRef<NamedAttribute> attrs = {}">,
+ OpBuilderDAG<(ins "Value":$source, "Value":$dest,
+ "ArrayRef<int64_t>":$staticOffsets, "ArrayRef<int64_t>":$staticSizes,
+ "ArrayRef<int64_t>":$staticStrides, "ValueRange":$offsets,
+ "ValueRange":$sizes, "ValueRange":$strides,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs)>,
// Build a SubViewOp with all dynamic entries.
- OpBuilder<
- "Value source, Value dest, ValueRange offsets, ValueRange sizes, "
- "ValueRange strides, ArrayRef<NamedAttribute> attrs = {}">
+ OpBuilderDAG<(ins "Value":$source, "Value":$dest, "ValueRange":$offsets,
+ "ValueRange":$sizes, "ValueRange":$strides,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs)>
];
let extraClassDeclaration = extraBaseClassDeclaration # [{
// TensorLoadOp is fully verified by traits.
let verifier = ?;
- let builders = [OpBuilder<
- "Value memref", [{
+ let builders = [
+ OpBuilderDAG<(ins "Value":$memref), [{
$_state.addOperands(memref);
$_state.addTypes(getTensorTypeFromMemRefType(memref.getType()));
- }]>];
+ }]>];
let extraClassDeclaration = [{
/// The result of a tensor_load is always a tensor.
```
}];
- let builders = [OpBuilder<
- "Value in, AffineMapAttr permutation, "
- "ArrayRef<NamedAttribute> attrs = {}">];
+ let builders = [
+ OpBuilderDAG<(ins "Value":$in, "AffineMapAttr":$permutation,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs)>];
let extraClassDeclaration = [{
static StringRef getPermutationAttrName() { return "permutation"; }
let arguments = (ins SignlessIntegerLike:$value);
let results = (outs SignlessIntegerLike);
- let builders = [OpBuilder<
- "Value value, Type destType", [{
+ let builders = [
+ OpBuilderDAG<(ins "Value":$value, "Type":$destType), [{
$_state.addOperands(value);
$_state.addTypes(destType);
- }]>];
+ }]>];
let parser = [{
return impl::parseCastOp(parser, result);
let arguments = (ins SignlessIntegerLike:$value);
let results = (outs SignlessIntegerLike);
- let builders = [OpBuilder<
- "Value value, Type destType", [{
+ let builders = [
+ OpBuilderDAG<(ins "Value":$value, "Type":$destType), [{
$_state.addOperands(value);
$_state.addTypes(destType);
- }]>];
+ }]>];
let parser = [{
return impl::parseCastOp(parser, result);
```
}];
let builders = [
- OpBuilder<"Value lhs, Value rhs, Value acc, ArrayAttr indexingMaps, "
- "ArrayAttr iteratorTypes">,
- OpBuilder<"Value lhs, Value rhs, Value acc, "
- "ArrayRef<ArrayRef<AffineExpr>> indexingExprs, "
- "ArrayRef<StringRef> iteratorTypes">
+ OpBuilderDAG<(ins "Value":$lhs, "Value":$rhs, "Value":$acc,
+ "ArrayAttr":$indexingMaps, "ArrayAttr":$iteratorTypes)>,
+ OpBuilderDAG<(ins "Value":$lhs, "Value":$rhs, "Value":$acc,
+ "ArrayRef<ArrayRef<AffineExpr>>":$indexingExprs,
+ "ArrayRef<StringRef>":$iteratorTypes)>
];
let extraClassDeclaration = [{
VectorType getLhsType() {
```
}];
let builders = [
- OpBuilder<"Value v1, Value v2, ArrayRef<int64_t>">
+ OpBuilderDAG<(ins "Value":$v1, "Value":$v2, "ArrayRef<int64_t>")>
];
let extraClassDeclaration = [{
static StringRef getMaskAttrName() { return "mask"; }
}];
let builders = [
- OpBuilder<"Value source, int64_t position">,
- OpBuilder<"Value source, Value position">
+ OpBuilderDAG<(ins "Value":$source, "int64_t":$position)>,
+ OpBuilderDAG<(ins "Value":$source, "Value":$position)>
];
let extraClassDeclaration = [{
VectorType getVectorType() {
```
}];
let builders = [
- OpBuilder<"Value source, ArrayRef<int64_t> position">,
+ OpBuilderDAG<(ins "Value":$source, "ArrayRef<int64_t>":$position)>,
// Convenience builder which assumes the values in `position` are defined by
// ConstantIndexOp.
- OpBuilder<"Value source, ValueRange position">
+ OpBuilderDAG<(ins "Value":$source, "ValueRange":$position)>
];
let extraClassDeclaration = [{
static StringRef getPositionAttrName() { return "position"; }
```
}];
let builders = [
- OpBuilder<"TupleType tupleType, Value vector, ArrayRef<int64_t> sizes, "
- "ArrayRef<int64_t> strides">
+ OpBuilderDAG<(ins "TupleType":$tupleType, "Value":$vector,
+ "ArrayRef<int64_t>":$sizes, "ArrayRef<int64_t>":$strides)>
];
let extraClassDeclaration = [{
VectorType getSourceVectorType() {
%ev = vector.extract_map %v[%id] : vector<32xf32> to vector<1xf32>
```
}];
- let builders = [OpBuilder<
- "Value vector, Value id, int64_t multiplicity">];
+ let builders = [
+ OpBuilderDAG<(ins "Value":$vector, "Value":$id, "int64_t":$multiplicity)>];
let extraClassDeclaration = [{
VectorType getSourceVectorType() {
return vector().getType().cast<VectorType>();
let verifier = ?;
let assemblyFormat = "$lhs `,` $rhs `,` $acc attr-dict `:` type($lhs)";
let builders = [
- OpBuilder<"Value lhs, Value rhs, Value acc",
- "build($_builder, $_state, lhs.getType(), lhs, rhs, acc);">
+ OpBuilderDAG<(ins "Value":$lhs, "Value":$rhs, "Value":$acc),
+ [{build($_builder, $_state, lhs.getType(), lhs, rhs, acc);}]>
];
let extraClassDeclaration = [{
VectorType getVectorType() { return lhs().getType().cast<VectorType>(); }
}];
let builders = [
- OpBuilder<"Value source, Value dest, int64_t position">,
- OpBuilder<"Value source, Value dest, Value position">
+ OpBuilderDAG<(ins "Value":$source, "Value":$dest, "int64_t":$position)>,
+ OpBuilderDAG<(ins "Value":$source, "Value":$dest, "Value":$position)>
];
let extraClassDeclaration = [{
Type getSourceType() { return source().getType(); }
}];
let builders = [
- OpBuilder<"Value source, Value dest, ArrayRef<int64_t> position">,
+ OpBuilderDAG<(ins "Value":$source, "Value":$dest,
+ "ArrayRef<int64_t>":$position)>,
// Convenience builder which assumes all values are constant indices.
- OpBuilder<"Value source, Value dest, ValueRange position">
+ OpBuilderDAG<(ins "Value":$source, "Value":$dest, "ValueRange":$position)>
];
let extraClassDeclaration = [{
static StringRef getPositionAttrName() { return "position"; }
%v = vector.insert_map %ev %v[%id] : vector<1xf32> into vector<32xf32>
```
}];
- let builders = [OpBuilder<
- "Value vector, Value dest, Value id, int64_t multiplicity">];
+ let builders = [OpBuilderDAG<(ins "Value":$vector, "Value":$dest,
+ "Value":$id, "int64_t":$multiplicity)>];
let extraClassDeclaration = [{
VectorType getSourceVectorType() {
return vector().getType().cast<VectorType>();
}];
let builders = [
- OpBuilder<"Value source, Value dest, ArrayRef<int64_t> offsets, "
- "ArrayRef<int64_t> strides">
+ OpBuilderDAG<(ins "Value":$source, "Value":$dest,
+ "ArrayRef<int64_t>":$offsets, "ArrayRef<int64_t>":$strides)>
];
let extraClassDeclaration = [{
static StringRef getOffsetsAttrName() { return "offsets"; }
}];
let builders = [
// Build an op without mask, use the type of `acc` as the return type.
- OpBuilder<"Value lhs, Value rhs, Value acc">
+ OpBuilderDAG<(ins "Value":$lhs, "Value":$rhs, "Value":$acc)>
];
let extraClassDeclaration = [{
VectorType getOperandVectorTypeLHS() {
```
}];
let builders = [
- OpBuilder<"Value source, ArrayRef<int64_t> offsets, "
- "ArrayRef<int64_t> sizes, ArrayRef<int64_t> strides">
+ OpBuilderDAG<(ins "Value":$source, "ArrayRef<int64_t>":$offsets,
+ "ArrayRef<int64_t>":$sizes, "ArrayRef<int64_t>":$strides)>
];
let extraClassDeclaration = [{
static StringRef getOffsetsAttrName() { return "offsets"; }
let builders = [
// Builder that sets padding to zero.
- OpBuilder<"VectorType vector, Value memref, ValueRange indices, "
- "AffineMap permutationMap, ArrayRef<bool> maybeMasked = {}">,
+ OpBuilderDAG<(ins "VectorType":$vector, "Value":$memref,
+ "ValueRange":$indices, "AffineMap":$permutationMap,
+ CArg<"ArrayRef<bool>", "{}">:$maybeMasked)>,
// Builder that sets permutation map (resp. padding) to
// 'getMinorIdentityMap' (resp. zero).
- OpBuilder<"VectorType vector, Value memref, ValueRange indices, "
- "ArrayRef<bool> maybeMasked = {}">
+ OpBuilderDAG<(ins "VectorType":$vector, "Value":$memref,
+ "ValueRange":$indices, CArg<"ArrayRef<bool>", "{}">:$maybeMasked)>
];
let hasFolder = 1;
let builders = [
// Builder that sets permutation map to 'getMinorIdentityMap'.
- OpBuilder<"Value vector, Value memref, ValueRange indices, "
- "ArrayRef<bool> maybeMasked = {}">,
- OpBuilder<"Value vector, Value memref, ValueRange indices, "
- "AffineMap permutationMap">,
+ OpBuilderDAG<(ins "Value":$vector, "Value":$memref, "ValueRange":$indices,
+ CArg<"ArrayRef<bool>", "{}">:$maybeMasked)>,
+ OpBuilderDAG<(ins "Value":$vector, "Value":$memref, "ValueRange":$indices,
+ "AffineMap":$permutationMap)>,
];
let hasFolder = 1;
/// Build the canonical memRefType with a single vector.
/// E.g. memref<4 x 5 x vector<6 x f32>> -> memref<vector<4 x 5 x 6 x f32>>.
- let builders = [
- OpBuilder<"Value source">
- ];
+ let builders = [OpBuilderDAG<(ins "Value":$source)>];
let extraClassDeclaration = [{
MemRefType getMemRefType() {
```
}];
let builders = [
- OpBuilder<"Value vector, ArrayRef<int64_t> transp">
+ OpBuilderDAG<(ins "Value":$vector, "ArrayRef<int64_t>":$transp)>
];
let extraClassDeclaration = [{
VectorType getVectorType() {
```
}];
let builders = [
- OpBuilder<"Value lhs, Value rhs, unsigned lhsRows, unsigned lhsColumns, "
- "unsigned rhsColumns",
+ OpBuilderDAG<(ins "Value":$lhs, "Value":$rhs, "unsigned":$lhsRows,
+ "unsigned":$lhsColumns, "unsigned":$rhsColumns),
[{
$_state.addOperands({lhs, rhs});
$_state.addAttribute("lhs_rows",$_builder.getI32IntegerAttr(lhsRows));
let description = [{
The "test.op_funcref" is a test op with a reference to a function symbol.
}];
- let builders = [OpBuilder<[{FuncOp function}]>];
+ let builders = [OpBuilderDAG<(ins "FuncOp":$function)>];
}
// Pattern add the argument plus a increasing static number hidden in
// We will use this op in a nested result pattern, where we cannot deduce the
// result type. So need to provide a builder not requiring result types.
let builders = [
- OpBuilder<
- "IntegerAttr count",
- [{
- auto i32Type = $_builder.getIntegerType(32);
- $_state.addTypes(i32Type); // $output1
- SmallVector<Type, 4> types(count.getInt(), i32Type);
- $_state.addTypes(types); // $output2
- $_state.addTypes(types); // $output3
- $_state.addAttribute("count", count);
- }]>
+ OpBuilderDAG<(ins "IntegerAttr":$count),
+ [{
+ auto i32Type = $_builder.getIntegerType(32);
+ $_state.addTypes(i32Type); // $output1
+ SmallVector<Type, 4> types(count.getInt(), i32Type);
+ $_state.addTypes(types); // $output2
+ $_state.addTypes(types); // $output3
+ $_state.addAttribute("count", count);
+ }]>
];
}
def IllegalOpTerminator : TEST_Op<"illegal_op_terminator", [Terminator]>;
def IllegalOpWithRegion : TEST_Op<"illegal_op_with_region"> {
let skipDefaultBuilders = 1;
- let builders = [OpBuilder<"",
- [{ Region *bodyRegion = $_state.addRegion();
- OpBuilder::InsertionGuard g($_builder);
- Block *body = $_builder.createBlock(bodyRegion);
- $_builder.setInsertionPointToEnd(body);
- $_builder.create<IllegalOpTerminator>($_state.location);
- }]>];
+ let builders = [OpBuilderDAG<(ins),
+ [{
+ Region *bodyRegion = $_state.addRegion();
+ OpBuilder::InsertionGuard g($_builder);
+ Block *body = $_builder.createBlock(bodyRegion);
+ $_builder.setInsertionPointToEnd(body);
+ $_builder.create<IllegalOpTerminator>($_state.location);
+ }]>];
}
def IllegalOpWithRegionAnchor : TEST_Op<"illegal_op_with_region_anchor">;
def TestRegionBuilderOp : TEST_Op<"region_builder">;
def TestReturnOp : TEST_Op<"return", [ReturnLike, Terminator]> {
let arguments = (ins Variadic<AnyType>);
- let builders = [
- OpBuilder<"", [{ build($_builder, $_state, {}); }]>
+ let builders = [OpBuilderDAG<(ins),
+ [{ build($_builder, $_state, {}); }]>
];
}
def TestCastOp : TEST_Op<"cast">,
let regions = (region AnyRegion:$region);
let skipDefaultBuilders = 1;
- let builders = [ OpBuilder<
- "ValueRange inputs, ValueRange outputBuffers",
+ let builders = [ OpBuilderDAG<
+ (ins "ValueRange":$inputs, "ValueRange":$outputBuffers),
[{{
$_state.addOperands(inputs);
$_state.addOperands(outputBuffers);
TypeRange(outputBuffers),
TypeRange(),
TypeRange());
- }]>, OpBuilder<
- "TypeRange resultTensorTypes, ValueRange inputs, "
- "ValueRange outputBuffers, ValueRange initTensors",
+ }]>, OpBuilderDAG<
+ (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs,
+ "ValueRange":$outputBuffers, "ValueRange":$initTensors),
[{{
$_state.addOperands(inputs);
$_state.addOperands(outputBuffers);
TypeRange(outputBuffers),
TypeRange(initTensors),
resultTensorTypes);
- }]>, OpBuilder<
- "TypeRange resultTensorTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes = {{}",
+ }]>, OpBuilderDAG<
+ (ins "TypeRange":$resultTensorTypes, "ValueRange":$operands,
+ CArg<"ArrayRef<NamedAttribute>", "{{}">:$attributes),
[{{
$_state.addOperands(operands);
$_state.addAttributes(attributes);
llvm::Optional<StringRef> params =
builderDef->getValueAsOptionalString("params");
FmtContext fctx;
+ if (params.hasValue()) {
+ PrintWarning(op.getLoc(),
+ "Op uses a deprecated, string-based OpBuilder format; "
+ "use OpBuilderDAG with '(ins <...>)' instead");
+ }
std::string paramStr =
params.hasValue() ? builderSignatureFromString(params->trim(), fctx)
: builderSignatureFromDAG(