Browse Source

Improve register allocation for loops with variable shifts.

Mike Pall 14 years ago
parent
commit
6082f93919
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/lj_asm.c

+ 4 - 1
src/lj_asm.c

@@ -3801,8 +3801,11 @@ static void asm_setup_regsp(ASMState *as, GCtrace *T)
       break;
       break;
     /* Non-constant shift counts need to be in RID_ECX. */
     /* Non-constant shift counts need to be in RID_ECX. */
     case IR_BSHL: case IR_BSHR: case IR_BSAR: case IR_BROL: case IR_BROR:
     case IR_BSHL: case IR_BSHR: case IR_BSAR: case IR_BROL: case IR_BROR:
-      if (!irref_isk(ir->op2) && !ra_hashint(IR(ir->op2)->r))
+      if (!irref_isk(ir->op2) && !ra_hashint(IR(ir->op2)->r)) {
 	IR(ir->op2)->r = REGSP_HINT(RID_ECX);
 	IR(ir->op2)->r = REGSP_HINT(RID_ECX);
+	if (inloop)
+	  rset_set(as->modset, RID_ECX);
+      }
       break;
       break;
     /* Do not propagate hints across type conversions. */
     /* Do not propagate hints across type conversions. */
     case IR_TONUM: case IR_TOINT: case IR_TOBIT:
     case IR_TONUM: case IR_TOINT: case IR_TOBIT: