This is a similar builder to the one for SCF::IfOp which allows users to pass region builders to it. Refer to the builders for IfOp.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/include/mlir/Dialect/SCF/IR/SCFOps.td | ||
---|---|---|
988 | ForOp uses a BodyBuilderFn to represent this type. Let's use that here also, and move the definition of BodyBuilderFn inside of a let extraClassDeclaration = ... inside of the SCF_Dialect definition. | |
mlir/lib/Dialect/SCF/IR/SCF.cpp | ||
2692 | Here and below, I don't actually know the signature of this method, so can you modify them to beforeRegion, /*parameterNameHere=*/{}, resultTypes? |
mlir/include/mlir/Dialect/SCF/IR/SCFOps.td | ||
---|---|---|
988 | Can you use BodyBuilderFn here now? |
It looks like you will also need to run clang-format on this. I use git clang-format --style=LLVM HEAD to format my patches before landing (then you can use arc diff to upload the final patch this time and I can submit it on your behalf).
mlir/include/mlir/Dialect/SCF/IR/SCFOps.td | ||
---|---|---|
988 | I tried this before and it fails in SCFOps.h.inc saying "unknown type name 'BodyBuilderFn'". I checked ForOp and it also does it the way I am currently doing. My guess is the extra declarations reflect in the .cpp file which are not visible to the header file. What do you think? |
mlir/include/mlir/Dialect/SCF/IR/SCFOps.td | ||
---|---|---|
988 | Right, it looks like extraClassDeclarations come after the generated methods. I think it would be more ideal for extraClassDeclarations to come before, but that would only work if extraClassDeclarations didn't have definitions also, which it often does, I believe, so let's leave this as it is. We could also get around this by putting this in the extraClassDeclarations of the SCF dialect, I believe, but that is not necesarilly a good choice, as there's no guarantee that all SCF ops have the same body builder function. |
ForOp uses a BodyBuilderFn to represent this type. Let's use that here also, and move the definition of BodyBuilderFn inside of a let extraClassDeclaration = ... inside of the SCF_Dialect definition.