Commit d5e0243a by David Edelsohn Committed by David Edelsohn

loop.c (scan_loop, [...]): Do not overlook hard registers when computing statistics.

        * loop.c (scan_loop, move_movables, count_one_set): Do not
        overlook hard registers when computing statistics.

From-SVN: r48280
parent 53d4257f
2001-12-22 David Edelsohn <edelsohn@gnu.org>
* loop.c (scan_loop, move_movables, count_one_set): Do not
overlook hard registers when computing statistics.
Sun Dec 23 00:49:37 CET 2001 Jan Hubicka <jh@suse.cz> Sun Dec 23 00:49:37 CET 2001 Jan Hubicka <jh@suse.cz>
* calls.c (ECF_LIBCALL_BLOCK): New constant. * calls.c (ECF_LIBCALL_BLOCK): New constant.
......
...@@ -145,6 +145,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -145,6 +145,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
((REGNO_LAST_LUID (REGNO) > INSN_LUID ((LOOP)->end) \ ((REGNO_LAST_LUID (REGNO) > INSN_LUID ((LOOP)->end) \
|| REGNO_FIRST_LUID (REGNO) < INSN_LUID ((LOOP)->start))) || REGNO_FIRST_LUID (REGNO) < INSN_LUID ((LOOP)->start)))
#define LOOP_REGNO_NREGS(REGNO, SET_DEST) \
((REGNO) < FIRST_PSEUDO_REGISTER \
? HARD_REGNO_NREGS ((REGNO), GET_MODE (SET_DEST)) : 1)
/* Vector mapping INSN_UIDs to luids. /* Vector mapping INSN_UIDs to luids.
The luids are like uids but increase monotonically always. The luids are like uids but increase monotonically always.
...@@ -893,7 +897,8 @@ scan_loop (loop, flags) ...@@ -893,7 +897,8 @@ scan_loop (loop, flags)
SET_DEST (set), copy_rtx (SET_SRC (set))); SET_DEST (set), copy_rtx (SET_SRC (set)));
delete_insn (p); delete_insn (p);
regs->array[regno].set_in_loop = 0; for (i = 0; i < LOOP_REGNO_NREGS (regno, SET_DEST (set)); i++)
regs->array[regno+i].set_in_loop = 0;
continue; continue;
} }
...@@ -923,7 +928,8 @@ scan_loop (loop, flags) ...@@ -923,7 +928,8 @@ scan_loop (loop, flags)
m->savings = regs->array[regno].n_times_set; m->savings = regs->array[regno].n_times_set;
if (find_reg_note (p, REG_RETVAL, NULL_RTX)) if (find_reg_note (p, REG_RETVAL, NULL_RTX))
m->savings += libcall_benefit (p); m->savings += libcall_benefit (p);
regs->array[regno].set_in_loop = move_insn ? -2 : -1; for (i = 0; i < LOOP_REGNO_NREGS (regno, SET_DEST (set)); i++)
regs->array[regno+i].set_in_loop = move_insn ? -2 : -1;
/* Add M to the end of the chain MOVABLES. */ /* Add M to the end of the chain MOVABLES. */
loop_movables_add (movables, m); loop_movables_add (movables, m);
...@@ -1024,7 +1030,8 @@ scan_loop (loop, flags) ...@@ -1024,7 +1030,8 @@ scan_loop (loop, flags)
m->match = 0; m->match = 0;
m->lifetime = LOOP_REG_LIFETIME (loop, regno); m->lifetime = LOOP_REG_LIFETIME (loop, regno);
m->savings = 1; m->savings = 1;
regs->array[regno].set_in_loop = -1; for (i = 0; i < LOOP_REGNO_NREGS (regno, SET_DEST (set)); i++)
regs->array[regno+i].set_in_loop = -1;
/* Add M to the end of the chain MOVABLES. */ /* Add M to the end of the chain MOVABLES. */
loop_movables_add (movables, m); loop_movables_add (movables, m);
} }
...@@ -2145,7 +2152,11 @@ move_movables (loop, movables, threshold, insn_count) ...@@ -2145,7 +2152,11 @@ move_movables (loop, movables, threshold, insn_count)
/* The reg set here is now invariant. */ /* The reg set here is now invariant. */
if (! m->partial) if (! m->partial)
regs->array[regno].set_in_loop = 0; {
int i;
for (i = 0; i < LOOP_REGNO_NREGS (regno, m->set_dest); i++)
regs->array[regno+i].set_in_loop = 0;
}
m->done = 1; m->done = 1;
...@@ -2205,7 +2216,13 @@ move_movables (loop, movables, threshold, insn_count) ...@@ -2205,7 +2216,13 @@ move_movables (loop, movables, threshold, insn_count)
/* The reg merged here is now invariant, /* The reg merged here is now invariant,
if the reg it matches is invariant. */ if the reg it matches is invariant. */
if (! m->partial) if (! m->partial)
regs->array[m1->regno].set_in_loop = 0; {
int i;
for (i = 0;
i < LOOP_REGNO_NREGS (regno, m1->set_dest);
i++)
regs->array[m1->regno+i].set_in_loop = 0;
}
} }
} }
else if (loop_dump_stream) else if (loop_dump_stream)
...@@ -3445,23 +3462,27 @@ count_one_set (regs, insn, x, last_set) ...@@ -3445,23 +3462,27 @@ count_one_set (regs, insn, x, last_set)
dest = XEXP (dest, 0); dest = XEXP (dest, 0);
if (GET_CODE (dest) == REG) if (GET_CODE (dest) == REG)
{ {
int i;
int regno = REGNO (dest); int regno = REGNO (dest);
/* If this is the first setting of this reg for (i = 0; i < LOOP_REGNO_NREGS (regno, dest); i++)
in current basic block, and it was set before, {
it must be set in two basic blocks, so it cannot /* If this is the first setting of this reg
be moved out of the loop. */ in current basic block, and it was set before,
if (regs->array[regno].set_in_loop > 0 it must be set in two basic blocks, so it cannot
&& last_set == 0) be moved out of the loop. */
regs->array[regno].may_not_optimize = 1; if (regs->array[regno].set_in_loop > 0
/* If this is not first setting in current basic block, && last_set == 0)
see if reg was used in between previous one and this. regs->array[regno+i].may_not_optimize = 1;
If so, neither one can be moved. */ /* If this is not first setting in current basic block,
if (last_set[regno] != 0 see if reg was used in between previous one and this.
&& reg_used_between_p (dest, last_set[regno], insn)) If so, neither one can be moved. */
regs->array[regno].may_not_optimize = 1; if (last_set[regno] != 0
if (regs->array[regno].set_in_loop < 127) && reg_used_between_p (dest, last_set[regno], insn))
++regs->array[regno].set_in_loop; regs->array[regno+i].may_not_optimize = 1;
last_set[regno] = insn; if (regs->array[regno+i].set_in_loop < 127)
++regs->array[regno+i].set_in_loop;
last_set[regno+i] = insn;
}
} }
} }
} }
......
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