OSDN Git Service

2008-07-06 Andreas Tobler <a.tobler@schweiz.org>
[pf3gnuchains/gcc-fork.git] / gcc / regstat.c
index 86afc38..2ec8c5b 100644 (file)
@@ -60,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++)
     {
@@ -180,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)++;
              
@@ -343,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)
     {
@@ -395,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.
@@ -445,7 +446,10 @@ 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
@@ -484,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)
     {