Curtis Rawls <[EMAIL PROTECTED]> wrote:

> The first patch (optimizer.patch) implement the add and subtract
> identity rules to the strength reduction optimization in
> imcc/optimizer.c .

Thanks, applied - r8194.

> The following rules are implemented:
>  add Ix, Iy, 0 => set Ix, Iy

[ ... ]

> This code is a modified version of the existing mul/div identity rules.

NB: when I wrote the mul & div code, there was no simple way to compare
the actual opcode and all the compares make the code hard to read. It
would be great if it could be a bit reworked, e.g.:

#include "parrot/oplib/ops.h"
...

  if ( (ins->opnum == PARROT_OP_add_i_i_ic &&
             IMCC_int_from_reg(interpreter, ins->r[2]) == 0)
     || (ins->opnum == PARROT_OP_add_n_n_nc &&
             atof(ins->r[2]) == 0.0) ) {
     ...

See also IMCC_int_from_reg().

Thanks,
leo

Reply via email to