OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / regstat.c
index 0a028ae..d6e3989 100644 (file)
@@ -7,7 +7,7 @@ This file is part of GCC.
 
 GCC is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
+Software Foundation; either version 3, or (at your option) any later
 version.
 
 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
@@ -16,10 +16,8 @@ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 for more details.
 
 You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING.  If not, write to the Free
-Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA.
-*/
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
 
 
 #include "config.h"
@@ -62,7 +60,7 @@ regstat_init_n_sets_and_refs (void)
   df_grow_reg_info ();
   gcc_assert (!regstat_n_sets_and_refs);
 
-  regstat_n_sets_and_refs = xmalloc (max_regno * sizeof (struct regstat_n_sets_and_refs_t));
+  regstat_n_sets_and_refs = XNEWVEC (struct regstat_n_sets_and_refs_t, max_regno);
 
   for (i = 0; i < max_regno; i++)
     {
@@ -110,8 +108,8 @@ regstat_bb_compute_ri (unsigned int bb_index,
 {
   basic_block bb = BASIC_BLOCK (bb_index);
   rtx insn;
-  struct df_ref **def_rec;
-  struct df_ref **use_rec;
+  df_ref *def_rec;
+  df_ref *use_rec;
   int luid = 0;
   bitmap_iterator bi;
   unsigned int regno;
@@ -128,14 +126,14 @@ regstat_bb_compute_ri (unsigned int bb_index,
      to begin processing.  */
   for (def_rec = df_get_artificial_defs (bb_index); *def_rec; def_rec++)
     {
-      struct df_ref *def = *def_rec;
+      df_ref def = *def_rec;
       if ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0)
        bitmap_clear_bit (live, DF_REF_REGNO (def));
     }
 
   for (use_rec = df_get_artificial_uses (bb_index); *use_rec; use_rec++)
     {
-      struct df_ref *use = *use_rec;
+      df_ref use = *use_rec;
       if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0)
        {
          regno = DF_REF_REGNO (use);
@@ -182,6 +180,7 @@ regstat_bb_compute_ri (unsigned int bb_index,
          EXECUTE_IF_SET_IN_BITMAP (live, 0, regno, bi)
            {
              REG_N_CALLS_CROSSED (regno)++;
+             REG_FREQ_CALLS_CROSSED (regno) += REG_FREQ_FROM_BB (bb);
              if (can_throw)
                REG_N_THROWING_CALLS_CROSSED (regno)++;
              
@@ -206,7 +205,7 @@ regstat_bb_compute_ri (unsigned int bb_index,
       for (mws_rec = DF_INSN_UID_MWS (uid); *mws_rec; mws_rec++)
        {
          struct df_mw_hardreg *mws = *mws_rec; 
-         if (mws->type == DF_REF_REG_DEF
+         if (DF_MWS_REG_DEF_P (mws)
            {
              bool all_dead = true;
              unsigned int r;
@@ -233,7 +232,7 @@ regstat_bb_compute_ri (unsigned int bb_index,
         clobber.  This code is for the return.  */
       for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
        {
-         struct df_ref *def = *def_rec;
+         df_ref def = *def_rec;
          if ((!CALL_P (insn))
              || (!(DF_REF_FLAGS (def) & (DF_REF_MUST_CLOBBER | DF_REF_MAY_CLOBBER))))
            {
@@ -282,7 +281,7 @@ regstat_bb_compute_ri (unsigned int bb_index,
       
       for (use_rec = DF_INSN_UID_USES (uid); *use_rec; use_rec++)
        {
-         struct df_ref *use = *use_rec;
+         df_ref use = *use_rec;
          unsigned int uregno = DF_REF_REGNO (use);
 
          if (uregno >= FIRST_PSEUDO_REGISTER)
@@ -345,7 +344,7 @@ regstat_compute_ri (void)
   setjmp_crosses = BITMAP_ALLOC (&df_bitmap_obstack);
   max_regno = max_reg_num ();
   reg_info_p_size = max_regno;
-  reg_info_p = xcalloc (max_regno, sizeof (struct reg_info_t));
+  reg_info_p = XCNEWVEC (struct reg_info_t, max_regno);
 
   FOR_EACH_BB (bb)
     {
@@ -397,7 +396,7 @@ regstat_get_setjmp_crosses (void)
    Process REG_N_CALLS_CROSSED.  
 
    This is used by sched_deps.  A good implementation of sched-deps
-   would really process the blocks directly rather than going thur
+   would really process the blocks directly rather than going through
    lists of insns.  If it did this, it could use the exact regs that
    cross an individual call rather than using this info that merges
    the info for all calls.
@@ -413,8 +412,8 @@ regstat_bb_compute_calls_crossed (unsigned int bb_index, bitmap live)
 {
   basic_block bb = BASIC_BLOCK (bb_index);
   rtx insn;
-  struct df_ref **def_rec;
-  struct df_ref **use_rec;
+  df_ref *def_rec;
+  df_ref *use_rec;
 
   bitmap_copy (live, df_get_live_out (bb));
 
@@ -422,14 +421,14 @@ regstat_bb_compute_calls_crossed (unsigned int bb_index, bitmap live)
      to begin processing.  */
   for (def_rec = df_get_artificial_defs (bb_index); *def_rec; def_rec++)
     {
-      struct df_ref *def = *def_rec;
+      df_ref def = *def_rec;
       if ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0)
        bitmap_clear_bit (live, DF_REF_REGNO (def));
     }
 
   for (use_rec = df_get_artificial_uses (bb_index); *use_rec; use_rec++)
     {
-      struct df_ref *use = *use_rec;
+      df_ref use = *use_rec;
       if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0)
        bitmap_set_bit (live, DF_REF_REGNO (use));
     }
@@ -447,14 +446,17 @@ regstat_bb_compute_calls_crossed (unsigned int bb_index, bitmap live)
        {
          bitmap_iterator bi;
          EXECUTE_IF_SET_IN_BITMAP (live, 0, regno, bi)
-           REG_N_CALLS_CROSSED (regno)++;
+           {
+             REG_N_CALLS_CROSSED (regno)++;
+             REG_FREQ_CALLS_CROSSED (regno) += REG_FREQ_FROM_BB (bb);
+           }
        }
          
       /* All of the defs except the return value are some sort of
         clobber.  This code is for the return.  */
       for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
        {
-         struct df_ref *def = *def_rec;
+         df_ref def = *def_rec;
          if ((!CALL_P (insn))
              || (!(DF_REF_FLAGS (def) & (DF_REF_MUST_CLOBBER | DF_REF_MAY_CLOBBER))))
            {
@@ -466,7 +468,7 @@ regstat_bb_compute_calls_crossed (unsigned int bb_index, bitmap live)
       
       for (use_rec = DF_INSN_UID_USES (uid); *use_rec; use_rec++)
        {
-         struct df_ref *use = *use_rec;
+         df_ref use = *use_rec;
          bitmap_set_bit (live, DF_REF_REGNO (use));
        }
     }
@@ -486,7 +488,7 @@ regstat_compute_calls_crossed (void)
   timevar_push (TV_REG_STATS);
   max_regno = max_reg_num ();
   reg_info_p_size = max_regno;
-  reg_info_p = xcalloc (max_regno, sizeof (struct reg_info_t));
+  reg_info_p = XCNEWVEC (struct reg_info_t, max_regno);
 
   FOR_EACH_BB (bb)
     {