You pretty much self-answerd that:
But certainly it would be very similar. I don’t think the IRTools representation lets you insert arbitrary values in all places, though, like Expr
does – which would be needed to embed variable names and tildes. On the other hand, you’re of course right in that a lot of the static analysis facilities would have to be duplicated in an “extended rewrite”.
I imagine using this kind of system in a way that the PPL IR would then be lowered very easily to IRTools IR or CodeInfo, but with the variable names removed and the tildes converted to assignments plus a couple of calls. The other direction of conversion I guess would only be necessary to insert SSA statements, and that should be doable.