Commit 17a0a76d by Richard Kenner

(find_reg): When looking for locally-allocated hard regs to reclaim,

use REG_ALLOC_ORDER to find least used.

From-SVN: r7210
parent 76182796
...@@ -1079,32 +1079,41 @@ find_reg (allocno, losers, alt_regs_p, accept_call_clobbered, retrying) ...@@ -1079,32 +1079,41 @@ find_reg (allocno, losers, alt_regs_p, accept_call_clobbered, retrying)
{ {
/* Count from the end, to find the least-used ones first. */ /* Count from the end, to find the least-used ones first. */
for (i = FIRST_PSEUDO_REGISTER - 1; i >= 0; i--) for (i = FIRST_PSEUDO_REGISTER - 1; i >= 0; i--)
if (local_reg_n_refs[i] != 0 {
#ifdef REG_ALLOC_ORDER
int regno = reg_alloc_order[i];
#else
int regno = i;
#endif
if (local_reg_n_refs[regno] != 0
/* Don't use a reg no good for this pseudo. */ /* Don't use a reg no good for this pseudo. */
&& ! TEST_HARD_REG_BIT (used2, i) && ! TEST_HARD_REG_BIT (used2, regno)
&& HARD_REGNO_MODE_OK (i, mode) && HARD_REGNO_MODE_OK (regno, mode)
&& ((double) local_reg_n_refs[i] / local_reg_live_length[i] && (((double) local_reg_n_refs[regno]
/ local_reg_live_length[regno])
< ((double) allocno_n_refs[allocno] < ((double) allocno_n_refs[allocno]
/ allocno_live_length[allocno]))) / allocno_live_length[allocno])))
{ {
/* Hard reg I was used less in total by local regs /* Hard reg REGNO was used less in total by local regs
than it would be used by this one allocno! */ than it would be used by this one allocno! */
int k; int k;
for (k = 0; k < max_regno; k++) for (k = 0; k < max_regno; k++)
if (reg_renumber[k] >= 0) if (reg_renumber[k] >= 0)
{ {
int regno = reg_renumber[k]; int r = reg_renumber[k];
int endregno int endregno
= regno + HARD_REGNO_NREGS (regno, PSEUDO_REGNO_MODE (k)); = r + HARD_REGNO_NREGS (r, PSEUDO_REGNO_MODE (k));
if (i >= regno && i < endregno) if (regno >= r && regno < endregno)
reg_renumber[k] = -1; reg_renumber[k] = -1;
} }
best_reg = i; best_reg = regno;
break; break;
} }
} }
}
/* Did we find a register? */ /* Did we find a register? */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment