Expand Up
@@ -48,6 +48,7 @@ def PDLInterp_Dialect : Dialect {
/// to rewrite the IR after a successful match.
static StringRef getRewriterModuleName() { return "rewriters"; }
}];
let emitAccessorPrefix = kEmitAccessorPrefix_Prefixed;
}
//===----------------------------------------------------------------------===//
Expand Down
Expand Up
@@ -246,11 +247,11 @@ def PDLInterp_CheckOperandCountOp
```
}];
let arguments = (ins PDL_Operation:$operation ,
let arguments = (ins PDL_Operation:$inputOp ,
Confined<I32Attr, [IntNonNegative]>:$count,
UnitAttr:$compareAtLeast);
let assemblyFormat = [{
`of` $operation `is` (`at_least` $compareAtLeast^)? $count attr-dict
`of` $inputOp `is` (`at_least` $compareAtLeast^)? $count attr-dict
`->` successors
}];
}
Expand All
@@ -274,8 +275,8 @@ def PDLInterp_CheckOperationNameOp
```
}];
let arguments = (ins PDL_Operation:$operation , StrAttr:$name);
let assemblyFormat = "`of` $operation `is` $name attr-dict `->` successors";
let arguments = (ins PDL_Operation:$inputOp , StrAttr:$name);
let assemblyFormat = "`of` $inputOp `is` $name attr-dict `->` successors";
}
//===----------------------------------------------------------------------===//
Expand Down
Expand Up
@@ -303,11 +304,11 @@ def PDLInterp_CheckResultCountOp
```
}];
let arguments = (ins PDL_Operation:$operation ,
let arguments = (ins PDL_Operation:$inputOp ,
Confined<I32Attr, [IntNonNegative]>:$count,
UnitAttr:$compareAtLeast);
let assemblyFormat = [{
`of` $operation `is` (`at_least` $compareAtLeast^)? $count attr-dict
`of` $inputOp `is` (`at_least` $compareAtLeast^)? $count attr-dict
`->` successors
}];
}
Expand Down
Expand Up
@@ -432,11 +433,11 @@ def PDLInterp_CreateOperationOp
}];
let arguments = (ins StrAttr:$name,
Variadic<PDL_InstOrRangeOf<PDL_Value>>:$operands ,
Variadic<PDL_Attribute>:$attributes ,
StrArrayAttr:$attributeNames ,
Variadic<PDL_InstOrRangeOf<PDL_Type>>:$types );
let results = (outs PDL_Operation:$operation );
Variadic<PDL_InstOrRangeOf<PDL_Value>>:$inputOperands ,
Variadic<PDL_Attribute>:$inputAttributes ,
StrArrayAttr:$inputAttributeNames ,
Variadic<PDL_InstOrRangeOf<PDL_Type>>:$inputResultTypes );
let results = (outs PDL_Operation:$resultOp );
let builders = [
OpBuilder<(ins "StringRef":$name, "ValueRange":$types,
Expand All
@@ -447,9 +448,9 @@ def PDLInterp_CreateOperationOp
}]>
];
let assemblyFormat = [{
$name (`(` $operands ^ `:` type($operands ) `)`)?
custom<CreateOperationOpAttributes>($attributes , $attributeNames )
(`->` `(` $types ^ `:` type($types ) `)`)? attr-dict
$name (`(` $inputOperands ^ `:` type($inputOperands ) `)`)?
custom<CreateOperationOpAttributes>($inputAttributes , $inputAttributeNames )
(`->` `(` $inputResultTypes ^ `:` type($inputResultTypes ) `)`)? attr-dict
}];
}
Expand Down
Expand Up
@@ -528,8 +529,8 @@ def PDLInterp_EraseOp : PDLInterp_Op<"erase"> {
```
}];
let arguments = (ins PDL_Operation:$operation );
let assemblyFormat = "$operation attr-dict";
let arguments = (ins PDL_Operation:$inputOp );
let assemblyFormat = "$inputOp attr-dict";
}
//===----------------------------------------------------------------------===//
Expand Down
Expand Up
@@ -623,7 +624,7 @@ def PDLInterp_ForEachOp
let extraClassDeclaration = [{
/// Returns the loop variable.
BlockArgument getLoopVariable() { return region ().getArgument(0); }
BlockArgument getLoopVariable() { return getRegion ().getArgument(0); }
}];
let hasCustomAssemblyFormat = 1;
let hasVerifier = 1;
Expand Down
Expand Up
@@ -667,21 +668,15 @@ def PDLInterp_FuncOp : PDLInterp_Op<"func", [
CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs)
>];
let extraClassDeclaration = [{
/// Returns the type of this function.
/// FIXME: We should drive this via the ODS `type` param.
FunctionType getType() {
return getTypeAttr().getValue().cast<FunctionType>();
}
//===------------------------------------------------------------------===//
// FunctionOpInterface Methods
//===------------------------------------------------------------------===//
/// Returns the argument types of this function.
ArrayRef<Type> getArgumentTypes() { return type ().getInputs(); }
ArrayRef<Type> getArgumentTypes() { return getType ().getInputs(); }
/// Returns the result types of this function.
ArrayRef<Type> getResultTypes() { return type ().getResults(); }
ArrayRef<Type> getResultTypes() { return getType ().getResults(); }
}];
let hasCustomAssemblyFormat = 1;
let skipDefaultBuilders = 1;
Expand All
@@ -705,10 +700,9 @@ def PDLInterp_GetAttributeOp : PDLInterp_Op<"get_attribute", [NoSideEffect]> {
```
}];
let arguments = (ins PDL_Operation:$operation,
StrAttr:$name);
let arguments = (ins PDL_Operation:$inputOp, StrAttr:$name);
let results = (outs PDL_Attribute:$attribute);
let assemblyFormat = "$name `of` $operation attr-dict";
let assemblyFormat = "$name `of` $inputOp attr-dict";
}
//===----------------------------------------------------------------------===//
Expand Down
Expand Up
@@ -761,7 +755,7 @@ def PDLInterp_GetDefiningOpOp
}];
let arguments = (ins PDL_InstOrRangeOf<PDL_Value>:$value);
let results = (outs PDL_Operation:$operation );
let results = (outs PDL_Operation:$inputOp );
let assemblyFormat = "`of` $value `:` type($value) attr-dict";
}
Expand All
@@ -783,10 +777,10 @@ def PDLInterp_GetOperandOp : PDLInterp_Op<"get_operand", [NoSideEffect]> {
```
}];
let arguments = (ins PDL_Operation:$operation ,
let arguments = (ins PDL_Operation:$inputOp ,
Confined<I32Attr, [IntNonNegative]>:$index);
let results = (outs PDL_Value:$value);
let assemblyFormat = "$index `of` $operation attr-dict";
let assemblyFormat = "$index `of` $inputOp attr-dict";
}
//===----------------------------------------------------------------------===//
Expand Down
Expand Up
@@ -818,15 +812,15 @@ def PDLInterp_GetOperandsOp : PDLInterp_Op<"get_operands", [NoSideEffect]> {
}];
let arguments = (ins
PDL_Operation:$operation ,
PDL_Operation:$inputOp ,
OptionalAttr<Confined<I32Attr, [IntNonNegative]>>:$index
);
let results = (outs PDL_InstOrRangeOf<PDL_Value>:$value);
let assemblyFormat = "($index^)? `of` $operation `:` type($value) attr-dict";
let assemblyFormat = "($index^)? `of` $inputOp `:` type($value) attr-dict";
let builders = [
OpBuilder<(ins "Type":$resultType, "Value":$operation ,
OpBuilder<(ins "Type":$resultType, "Value":$inputOp ,
"Optional<unsigned>":$index), [{
build($_builder, $_state, resultType, operation ,
build($_builder, $_state, resultType, inputOp ,
index ? $_builder.getI32IntegerAttr(*index) : IntegerAttr());
}]>,
];
Expand All
@@ -850,10 +844,10 @@ def PDLInterp_GetResultOp : PDLInterp_Op<"get_result", [NoSideEffect]> {
```
}];
let arguments = (ins PDL_Operation:$operation ,
let arguments = (ins PDL_Operation:$inputOp ,
Confined<I32Attr, [IntNonNegative]>:$index);
let results = (outs PDL_Value:$value);
let assemblyFormat = "$index `of` $operation attr-dict";
let assemblyFormat = "$index `of` $inputOp attr-dict";
}
//===----------------------------------------------------------------------===//
Expand Down
Expand Up
@@ -885,20 +879,20 @@ def PDLInterp_GetResultsOp : PDLInterp_Op<"get_results", [NoSideEffect]> {
}];
let arguments = (ins
PDL_Operation:$operation ,
PDL_Operation:$inputOp ,
OptionalAttr<Confined<I32Attr, [IntNonNegative]>>:$index
);
let results = (outs PDL_InstOrRangeOf<PDL_Value>:$value);
let assemblyFormat = "($index^)? `of` $operation `:` type($value) attr-dict";
let assemblyFormat = "($index^)? `of` $inputOp `:` type($value) attr-dict";
let builders = [
OpBuilder<(ins "Type":$resultType, "Value":$operation ,
OpBuilder<(ins "Type":$resultType, "Value":$inputOp ,
"Optional<unsigned>":$index), [{
build($_builder, $_state, resultType, operation ,
build($_builder, $_state, resultType, inputOp ,
index ? $_builder.getI32IntegerAttr(*index) : IntegerAttr());
}]>,
OpBuilder<(ins "Value":$operation ), [{
OpBuilder<(ins "Value":$inputOp ), [{
build($_builder, $_state,
pdl::RangeType::get($_builder.getType<pdl::ValueType>()), operation ,
pdl::RangeType::get($_builder.getType<pdl::ValueType>()), inputOp ,
IntegerAttr());
}]>,
];
Expand Down
Expand Up
@@ -996,7 +990,7 @@ def PDLInterp_InferredTypesOp : PDLInterp_Op<"inferred_types"> {
%types = pdl_interp.inferred_types
```
}];
let results = (outs PDL_RangeOf<PDL_Type>:$type );
let results = (outs PDL_RangeOf<PDL_Type>:$result );
let assemblyFormat = "attr-dict";
let builders = [
OpBuilder<(ins), [{
Expand Down
Expand Up
@@ -1086,10 +1080,10 @@ def PDLInterp_ReplaceOp : PDLInterp_Op<"replace"> {
pdl_interp.replace %root with (%val0, %val1 : !pdl.type, !pdl.type)
```
}];
let arguments = (ins PDL_Operation:$operation ,
let arguments = (ins PDL_Operation:$inputOp ,
Variadic<PDL_InstOrRangeOf<PDL_Value>>:$replValues);
let assemblyFormat = [{
$operation `with` ` ` `(` ($replValues^ `:` type($replValues))? `)`
$inputOp `with` ` ` `(` ($replValues^ `:` type($replValues))? `)`
attr-dict
}];
}
Expand Down
Expand Up
@@ -1147,15 +1141,15 @@ def PDLInterp_SwitchOperandCountOp
```
}];
let arguments = (ins PDL_Operation:$operation , I32ElementsAttr:$caseValues);
let arguments = (ins PDL_Operation:$inputOp , I32ElementsAttr:$caseValues);
let assemblyFormat = [{
`of` $operation `to` $caseValues `(` $cases `)` attr-dict `->` $defaultDest
`of` $inputOp `to` $caseValues `(` $cases `)` attr-dict `->` $defaultDest
}];
let builders = [
OpBuilder<(ins "Value":$operation , "ArrayRef<int32_t>":$counts,
OpBuilder<(ins "Value":$inputOp , "ArrayRef<int32_t>":$counts,
"Block *":$defaultDest, "BlockRange":$dests), [{
build($_builder, $_state, operation , $_builder.getI32VectorAttr(counts),
build($_builder, $_state, inputOp , $_builder.getI32VectorAttr(counts),
defaultDest, dests);
}]>];
let hasVerifier = 1;
Expand All
@@ -1181,18 +1175,18 @@ def PDLInterp_SwitchOperationNameOp
```
}];
let arguments = (ins PDL_Operation:$operation ,
let arguments = (ins PDL_Operation:$inputOp ,
StrArrayAttr:$caseValues);
let assemblyFormat = [{
`of` $operation `to` $caseValues `(` $cases `)` attr-dict `->` $defaultDest
`of` $inputOp `to` $caseValues `(` $cases `)` attr-dict `->` $defaultDest
}];
let builders = [
OpBuilder<(ins "Value":$operation , "ArrayRef<OperationName>":$names,
OpBuilder<(ins "Value":$inputOp , "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),
build($_builder, $_state, inputOp , $_builder.getStrArrayAttr(stringNames),
defaultDest, dests);
}]>,
];
Expand All
@@ -1219,15 +1213,15 @@ def PDLInterp_SwitchResultCountOp
```
}];
let arguments = (ins PDL_Operation:$operation , I32ElementsAttr:$caseValues);
let arguments = (ins PDL_Operation:$inputOp , I32ElementsAttr:$caseValues);
let assemblyFormat = [{
`of` $operation `to` $caseValues `(` $cases `)` attr-dict `->` $defaultDest
`of` $inputOp `to` $caseValues `(` $cases `)` attr-dict `->` $defaultDest
}];
let builders = [
OpBuilder<(ins "Value":$operation , "ArrayRef<int32_t>":$counts,
OpBuilder<(ins "Value":$inputOp , "ArrayRef<int32_t>":$counts,
"Block *":$defaultDest, "BlockRange":$dests), [{
build($_builder, $_state, operation , $_builder.getI32VectorAttr(counts),
build($_builder, $_state, inputOp , $_builder.getI32VectorAttr(counts),
defaultDest, dests);
}]>];
let hasVerifier = 1;
Expand Down
Expand Up
@@ -1266,7 +1260,7 @@ def PDLInterp_SwitchTypeOp : PDLInterp_SwitchOp<"switch_type", [NoSideEffect]> {
];
let extraClassDeclaration = [{
auto getCaseTypes() { return caseValues ().getAsValueRange<TypeAttr>(); }
auto getCaseTypes() { return getCaseValues ().getAsValueRange<TypeAttr>(); }
}];
let hasVerifier = 1;
}
Expand Down
Expand Up
@@ -1308,7 +1302,7 @@ def PDLInterp_SwitchTypesOp : PDLInterp_SwitchOp<"switch_types",
];
let extraClassDeclaration = [{
auto getCaseTypes() { return caseValues ().getAsRange<ArrayAttr>(); }
auto getCaseTypes() { return getCaseValues ().getAsRange<ArrayAttr>(); }
}];
let hasVerifier = 1;
}
Expand Down