<div dir="ltr"><div>I'm trying to write a tablegen pattern to that matches a sequence of SDNodes and emits again an SDNode and another instruction.</div><div>The pattern I've written looks like the folowing:</div><div><br></div><div>def : Pat<(foo (bar GPR:$rs1), simm12:$imm1), </div><div>          (bar (BAZ GPR:$rs1, simm12:$imm1))>;</div><div><br></div><div>foo and bar are SDNodes, BAZ is an instruction. In particular, bar is defined as follows:</div><div><br></div><div>def bar : SDNode<"ISD::BAR", SDTIntUnaryOp>;</div><div><br></div><div>The basic idea of this pattern is to propagate bar over certain instructions until they reach a sink pattern, which only emits an instruction.</div><div>However, it seems that SDNodes in output patterns are not supported, because when building LLVM, I get the following error message:</div><div><br></div><div>error: In anonymous_826: Cannot use 'bar' in an output pattern!</div><div><br></div><div>What are the limits of tablegen here?</div><div>What are alternatives to propagate the bar node over instructions to reach the same behavior is the pattern-based approach?</div><div><br></div><div>Thank you in advance!</div><div>Cheers,</div><div>Max</div></div>