Commit 89098dc1 by Jeff Law

regmove.c (optimize_reg_copy_1): Undo Aug 18 change.

        * regmove.c (optimize_reg_copy_1): Undo Aug 18 change.  Update
        REG_N_CALLS_CROSSED and REG_LIVE_LENGH if and only if we change
        where a register is live.

From-SVN: r24718
parent 20f7cbac
Sun Jan 17 19:23:20 1999 Jeffrey A Law (law@cygnus.com)
* regmove.c (optimize_reg_copy_1): Undo Aug 18 change. Update
REG_N_CALLS_CROSSED and REG_LIVE_LENGH if and only if we change
where a register is live.
Sun Jan 17 03:20:47 1999 H.J. Lu (hjl@gnu.org)
* reg-stack.c (subst_stack_regs_pat): Abort if the destination
of a FP conditional move is not on the FP register stack.
Sun Jan 17 01:15:04 PST 1999 Jeff Law (law@cygnus.com) Sun Jan 17 01:15:04 PST 1999 Jeff Law (law@cygnus.com)
* version.c: Bump for snapshot. * version.c: Bump for snapshot.
......
...@@ -253,10 +253,10 @@ optimize_reg_copy_1 (insn, dest, src) ...@@ -253,10 +253,10 @@ optimize_reg_copy_1 (insn, dest, src)
&& GET_MODE (XEXP (note, 0)) == GET_MODE (src)) && GET_MODE (XEXP (note, 0)) == GET_MODE (src))
{ {
int failed = 0; int failed = 0;
int length = 0;
int d_length = 0; int d_length = 0;
int n_calls = 0; int s_length = 0;
int d_n_calls = 0; int d_n_calls = 0;
int s_n_calls = 0;
/* We can do the optimization. Scan forward from INSN again, /* We can do the optimization. Scan forward from INSN again,
replacing regs as we go. Set FAILED if a replacement can't replacing regs as we go. Set FAILED if a replacement can't
...@@ -290,42 +290,14 @@ optimize_reg_copy_1 (insn, dest, src) ...@@ -290,42 +290,14 @@ optimize_reg_copy_1 (insn, dest, src)
insn in the REG_N_REFS updates below. If this is not insn in the REG_N_REFS updates below. If this is not
correct, no great harm is done. correct, no great harm is done.
Since we do not know if we will change the lifetime of
We do not undo this substitution if something later SREGNO or DREGNO, we must not update REG_LIVE_LENGTH
fails. Therefore, we must update the other REG_N_* or REG_N_CALLS_CROSSED at this time. */
counters now to keep them accurate. */
if (sregno >= FIRST_PSEUDO_REGISTER) if (sregno >= FIRST_PSEUDO_REGISTER)
{ REG_N_REFS (sregno) -= loop_depth;
REG_N_REFS (sregno) -= loop_depth;
if (REG_LIVE_LENGTH (sregno) >= 0)
{
REG_LIVE_LENGTH (sregno) -= length;
/* REG_LIVE_LENGTH is only an approximation after
combine if sched is not run, so make sure that
we still have a reasonable value. */
if (REG_LIVE_LENGTH (sregno) < 2)
REG_LIVE_LENGTH (sregno) = 2;
}
REG_N_CALLS_CROSSED (sregno) -= n_calls;
}
if (dregno >= FIRST_PSEUDO_REGISTER) if (dregno >= FIRST_PSEUDO_REGISTER)
{ REG_N_REFS (dregno) += loop_depth;
REG_N_REFS (dregno) += loop_depth;
if (REG_LIVE_LENGTH (dregno) >= 0)
REG_LIVE_LENGTH (dregno) += d_length;
REG_N_CALLS_CROSSED (dregno) += d_n_calls;
}
/* We've done a substitution, clear the counters. */
length = 0;
d_length = 0;
n_calls = 0;
d_n_calls = 0;
} }
else else
{ {
...@@ -334,9 +306,10 @@ optimize_reg_copy_1 (insn, dest, src) ...@@ -334,9 +306,10 @@ optimize_reg_copy_1 (insn, dest, src)
} }
} }
/* Count the insns and CALL_INSNs passed. If we passed the /* For SREGNO, count the total number of insns scanned.
death note of DEST, show increased live length. */ For DREGNO, count the total number of insns scanned after
length++; passing the death note for DREGNO. */
s_length++;
if (dest_death) if (dest_death)
d_length++; d_length++;
...@@ -344,7 +317,9 @@ optimize_reg_copy_1 (insn, dest, src) ...@@ -344,7 +317,9 @@ optimize_reg_copy_1 (insn, dest, src)
as a call that has been crossed. Otherwise, count it. */ as a call that has been crossed. Otherwise, count it. */
if (q != p && GET_CODE (q) == CALL_INSN) if (q != p && GET_CODE (q) == CALL_INSN)
{ {
n_calls++; /* Similarly, total calls for SREGNO, total calls beyond
the death note for DREGNO. */
s_n_calls++;
if (dest_death) if (dest_death)
d_n_calls++; d_n_calls++;
} }
...@@ -364,11 +339,13 @@ optimize_reg_copy_1 (insn, dest, src) ...@@ -364,11 +339,13 @@ optimize_reg_copy_1 (insn, dest, src)
if (! failed) if (! failed)
{ {
/* These counters need to be updated if and only if we are
going to move the REG_DEAD note. */
if (sregno >= FIRST_PSEUDO_REGISTER) if (sregno >= FIRST_PSEUDO_REGISTER)
{ {
if (REG_LIVE_LENGTH (sregno) >= 0) if (REG_LIVE_LENGTH (sregno) >= 0)
{ {
REG_LIVE_LENGTH (sregno) -= length; REG_LIVE_LENGTH (sregno) -= s_length;
/* REG_LIVE_LENGTH is only an approximation after /* REG_LIVE_LENGTH is only an approximation after
combine if sched is not run, so make sure that we combine if sched is not run, so make sure that we
still have a reasonable value. */ still have a reasonable value. */
...@@ -376,15 +353,7 @@ optimize_reg_copy_1 (insn, dest, src) ...@@ -376,15 +353,7 @@ optimize_reg_copy_1 (insn, dest, src)
REG_LIVE_LENGTH (sregno) = 2; REG_LIVE_LENGTH (sregno) = 2;
} }
REG_N_CALLS_CROSSED (sregno) -= n_calls; REG_N_CALLS_CROSSED (sregno) -= s_n_calls;
}
if (dregno >= FIRST_PSEUDO_REGISTER)
{
if (REG_LIVE_LENGTH (dregno) >= 0)
REG_LIVE_LENGTH (dregno) += d_length;
REG_N_CALLS_CROSSED (dregno) += d_n_calls;
} }
/* Move death note of SRC from P to INSN. */ /* Move death note of SRC from P to INSN. */
...@@ -398,6 +367,15 @@ optimize_reg_copy_1 (insn, dest, src) ...@@ -398,6 +367,15 @@ optimize_reg_copy_1 (insn, dest, src)
{ {
XEXP (dest_death, 1) = REG_NOTES (p); XEXP (dest_death, 1) = REG_NOTES (p);
REG_NOTES (p) = dest_death; REG_NOTES (p) = dest_death;
if (dregno >= FIRST_PSEUDO_REGISTER)
{
/* If and only if we are moving the death note for DREGNO,
then we need to update its counters. */
if (REG_LIVE_LENGTH (dregno) >= 0)
REG_LIVE_LENGTH (dregno) += d_length;
REG_N_CALLS_CROSSED (dregno) += d_n_calls;
}
} }
return ! failed; return ! failed;
......
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