]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
regmove.c (optimize_reg_copy_1): Update REG_N_CALLS_CROSSED and REG_LIVE_LENGTH as...
authorJeffrey A Law <law@cygnus.com>
Tue, 18 Aug 1998 09:33:54 +0000 (09:33 +0000)
committerJeff Law <law@gcc.gnu.org>
Tue, 18 Aug 1998 09:33:54 +0000 (03:33 -0600)
        * regmove.c (optimize_reg_copy_1): Update REG_N_CALLS_CROSSED
        and REG_LIVE_LENGTH as successful substitutions are made.

From-SVN: r21818

gcc/ChangeLog
gcc/regmove.c

index 47e99627e1cc9ba5c09cb4d8746402c394e7282a..dc5d66596d35372b1365bd7809b5aea485e9ef1a 100644 (file)
@@ -1,3 +1,8 @@
+Tue Aug 18 10:32:11 1998  Jeffrey A Law  (law@cygnus.com)
+
+       * regmove.c (optimize_reg_copy_1): Update REG_N_CALLS_CROSSED
+       and REG_LIVE_LENGTH as successful substitutions are made.
+
 Mon Aug 17 21:07:19 1998  Jeffrey A Law  (law@cygnus.com)
 
        * From Graham
index def8c14d5c9e0ee0a23185c45a26972df8424536..878655322482f1fbceda497834122d66752fe263 100644 (file)
@@ -288,12 +288,45 @@ optimize_reg_copy_1 (insn, dest, src)
                                                             PATTERN (q))))
                    {
                      /* We assume that a register is used exactly once per
-                        insn in the updates below.  If this is not correct,
-                        no great harm is done.  */
+                        insn in the REG_N_REFS updates below.  If this is not
+                        correct, no great harm is done.
+
+
+                        We do not undo this substitution if something later
+                        fails.  Therefore, we must update the other REG_N_*
+                        counters now to keep them accurate.  */
                      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)
-                       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
                    {