Re: [perl #36013] [PATCH]Modified Strength Reduction Optimization (add/sub)

1 view
Skip to first unread message

Leopold Toetsch

unread,
May 28, 2005, 5:21:48 AM5/28/05
to perl6-i...@perl.org
Curtis Rawls <parrotbug...@parrotcode.org> 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 all
Reply to author
Forward
0 new messages