pub fn overflows(func: &mut Func)Expand description
Rewrites every overflow checked instruction into the arithmetic and the test that is one.
Six instructions and no rules, which is tamnd/rucc#309. The trade is the one expand::bytes and
expand::counts above make, with one thing on top of it: these are the only instructions in the
IR whose result is two things, a value and a bit, and the rule language has no way to write a
term that produces two. So even on a machine whose add sets a carry flag, a rule for one of
these could not name both halves of what it answers, and the rewrite would have to happen
somewhere. Here is that somewhere.
Because the instruction goes away rather than becoming another one, the values the rest of the
function read have to be pointed at what replaced them. That is what substitute below does,
once, after every instruction has been rewritten.