This is my td file contents:
def xxxOp : xxxOp<"xxx", [RecursiveMemoryEffects,
SingleBlockImplicitTerminator<"YieldOp">,
ParentOneOf<["func::FuncOp", "AffineForOp"]>]> {
...
let results = (outs Variadic<AnyType>:$results);
let regions = (region SizedRegion<1>:$body);
let assemblyFormat = "attr-dict-with-keyword ( `:` type($results)^ )? $body";
let hasVerifier = 1;
let hasCanonicalizer = 1;
let extraClassDeclaration = [{
/// Get the terminator yield op.
YieldOp getYieldOp();
}];
}
My LLVM is 17.0.0. I have some problems with builder or rewiter. Here’s how I use them.
auto new =
rewriter.create<xxOp>(op.getLoc(), ValueRange());
auto new = builder.create<xxOp>(loc, returnValues);
I get an error when compiling:
error: no matching function for call to ‘mlir::xxx::Op::build(mlir::OpBuilder&, mlir::OperationState&, mlir::ValueRange)’
489 | OpTy::build(*this, state, std::forward<Args>(args)...);
If I modify it to the following:
auto new = builder.create<xxOp>(loc, returnType, returnValues);
I don’t have problems when compiling, but I get these problems with mlir-opt :
:build(mlir::OpBuilder&, mlir::OperationState&, mlir::TypeRange, mlir::ValueRange, llvm::ArrayRef<mlir::NamedAttribute>): Assertion `operands.size() == 0u && "mismatched number of parameters"' failed.
I’m not sure what’s wrong and I’m looking for suggestions.