Hi,
I am currently trying to write a conversion pass for functions. During conversion, specific properties are computed that I would like to pass on to other passes that rewrite the function’s body - depending on said properties. So, to visualize it:
LogicalResult FunctionLowering::matchAndRewrite(Function op, ArrayRef<Value> operands, ConversionPatternRewriter& rewriter) const {
// Compute the property.
Property property = ...
// Set up nested patterns.
OwningRewritePatternList patterns;
populateNestedPatterns(patterns, property);
FrozenRewritePatternList frozenPatterns(std::move(patterns));
// Match and rewrite.
for(auto& bodyOp : op.getBody()) {
applyOpPatternsAndFold(bodyOp, frozenPatterns);
}
// Do other stuff
// ...
return success();
}
Is this the correct way to set up “nested” patterns? Or is there a better way of doing so? I was unsure if it maybe somehow interferes with MLIR’s parallelism.
Thank you in advance!