Closed Naville closed 5 years ago
I've tried using the DDR framework for matching and lowering, with a pattern like the following:
def XXXX: Pat<(SOURCEOP:$op.....),
(IndexCastOp (TARGETOP))>;
where target op is defined as the following:
def XXX_YYYYOp:XXXXOp<"XXXX",[NoSideEffect]>{
let arguments = (ins);
let results = (outs
AnyTypeOf<[I16,I32]>:$value
);
}
However as far as I can tell DDR doesn't allow passing the result of matched Op around, as such I can't ::build
YYYYOp due to the last argument, Type is missing. Adding a new builder with types hard-coded in only serves as a workaround though:
let builders = [OpBuilder<
"Builder *builder, OperationState &result", [{
result.addTypes(builder->getIntegerType(32));
}]>];
tldr: I need to replace the old matched Op with two chaining ops, the first op's return type should be the same as the return type of the old Op
Hi: In our Dialect we need to lower a Op into multiple target specific Ops. Below is related code:
The input is the following:
I expect the following MLIR to be generated:
Instead I got: