Author: leo
Date: Sun Feb 19 12:25:13 2006
New Revision: 11670
Modified:
trunk/compilers/imcc/parser_util.c
Log:
imcc codegen - reuse temp register
* a user opcode <op> Nx, Iy, Iy created two temps for the I registers
now reuse the temporary Nz (1 less ins and 1 less temp)
Modified: trunk/compilers/imcc/parser_util.c
==============================================================================
--- trunk/compilers/imcc/parser_util.c (original)
+++ trunk/compilers/imcc/parser_util.c Sun Feb 19 12:25:13 2006
@@ -872,7 +872,12 @@ try_find_op(Parrot_Interp interpreter, I
}
if (n == 3 && r[0]->set == 'N') {
if (r[1]->set == 'I') {
+ SymReg *r1 = r[1];
changed |= change_op(interpreter, unit, r, 1, emit);
+ /* op Nx, Iy, Iy: reuse generated temp Nz */
+ if (r[2]->set == 'I' && r[2]->type != VTADDRESS &&
+ r[2] == r1)
+ r[2] = r[1];
}
if (r[2]->set == 'I' && r[2]->type != VTADDRESS) {
changed |= change_op(interpreter, unit, r, 2, emit);