OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / gcse.c
index d390db3..e732008 100644 (file)
@@ -658,7 +658,7 @@ static int handle_avail_expr        PARAMS ((rtx, struct expr *));
 static int classic_gcse                PARAMS ((void));
 static int one_classic_gcse_pass PARAMS ((int));
 static void invalidate_nonnull_info PARAMS ((rtx, rtx, void *));
-static void delete_null_pointer_checks_1 PARAMS ((unsigned int *,
+static int delete_null_pointer_checks_1 PARAMS ((unsigned int *,
                                                  sbitmap *, sbitmap *,
                                                  struct null_pointer_info *));
 static rtx process_insert_insn PARAMS ((struct expr *));
@@ -5473,7 +5473,7 @@ invalidate_nonnull_info (x, setter, data)
    NPI.  NONNULL_AVIN and NONNULL_AVOUT are pre-allocated sbitmaps;
    they are not our responsibility to free.  */
 
-static void
+static int
 delete_null_pointer_checks_1 (block_reg, nonnull_avin,
                              nonnull_avout, npi)
      unsigned int *block_reg;
@@ -5484,6 +5484,7 @@ delete_null_pointer_checks_1 (block_reg, nonnull_avin,
   basic_block bb, current_block;
   sbitmap *nonnull_local = npi->nonnull_local;
   sbitmap *nonnull_killed = npi->nonnull_killed;
+  int something_changed = 0;
 
   /* Compute local properties, nonnull and killed.  A register will have
      the nonnull property if at the end of the current block its value is
@@ -5605,6 +5606,7 @@ delete_null_pointer_checks_1 (block_reg, nonnull_avin,
          emit_barrier_after (new_jump);
        }
 
+      something_changed = 1;
       delete_insn (last_insn);
       if (compare_and_branch == 2)
        delete_insn (earliest);
@@ -5615,6 +5617,8 @@ delete_null_pointer_checks_1 (block_reg, nonnull_avin,
         block.)  */
       block_reg[bb->index] = 0;
     }
+
+  return something_changed;
 }
 
 /* Find EQ/NE comparisons against zero which can be (indirectly) evaluated
@@ -5641,7 +5645,7 @@ delete_null_pointer_checks_1 (block_reg, nonnull_avin,
 
    This could probably be integrated with global cprop with a little work.  */
 
-void
+int
 delete_null_pointer_checks (f)
      rtx f ATTRIBUTE_UNUSED;
 {
@@ -5652,10 +5656,11 @@ delete_null_pointer_checks (f)
   int regs_per_pass;
   int max_reg;
   struct null_pointer_info npi;
+  int something_changed = 0;
 
   /* If we have only a single block, then there's nothing to do.  */
   if (n_basic_blocks <= 1)
-    return;
+    return 0;
 
   /* Trying to perform global optimizations on flow graphs which have
      a high connectivity will take a long time and is unlikely to be
@@ -5666,7 +5671,7 @@ delete_null_pointer_checks (f)
      a couple switch statements.  So we require a relatively large number
      of basic blocks and the ratio of edges to blocks to be high.  */
   if (n_basic_blocks > 1000 && n_edges / n_basic_blocks >= 20)
-    return;
+    return 0;
 
   /* We need four bitmaps, each with a bit for each register in each
      basic block.  */
@@ -5719,8 +5724,10 @@ delete_null_pointer_checks (f)
     {
       npi.min_reg = reg;
       npi.max_reg = MIN (reg + regs_per_pass, max_reg);
-      delete_null_pointer_checks_1 (block_reg, nonnull_avin,
-                                   nonnull_avout, &npi);
+      something_changed |= delete_null_pointer_checks_1 (block_reg,
+                                                        nonnull_avin,
+                                                        nonnull_avout,
+                                                        &npi);
     }
 
   /* Free the table of registers compared at the end of every block.  */
@@ -5731,6 +5738,8 @@ delete_null_pointer_checks (f)
   sbitmap_vector_free (npi.nonnull_killed);
   sbitmap_vector_free (nonnull_avin);
   sbitmap_vector_free (nonnull_avout);
+
+  return something_changed;
 }
 
 /* Code Hoisting variables and subroutines.  */
@@ -5743,7 +5752,7 @@ static sbitmap *hoist_vbeout;
 static sbitmap *hoist_exprs;
 
 /* Dominator bitmaps.  */
-static sbitmap *dominators;
+dominance_info dominators;
 
 /* ??? We could compute post dominators and run this algorithm in
    reverse to to perform tail merging, doing so would probably be
@@ -5766,8 +5775,6 @@ alloc_code_hoist_mem (n_blocks, n_exprs)
   hoist_vbeout = sbitmap_vector_alloc (n_blocks, n_exprs);
   hoist_exprs = sbitmap_vector_alloc (n_blocks, n_exprs);
   transpout = sbitmap_vector_alloc (n_blocks, n_exprs);
-
-  dominators = sbitmap_vector_alloc (n_blocks, n_blocks);
 }
 
 /* Free vars used for code hoisting analysis.  */
@@ -5784,7 +5791,7 @@ free_code_hoist_mem ()
   sbitmap_vector_free (hoist_exprs);
   sbitmap_vector_free (transpout);
 
-  sbitmap_vector_free (dominators);
+  free_dominance_info (dominators);
 }
 
 /* Compute the very busy expressions at entry/exit from each block.
@@ -5833,7 +5840,7 @@ compute_code_hoist_data ()
   compute_local_properties (transp, comp, antloc, 0);
   compute_transpout ();
   compute_code_hoist_vbeinout ();
-  calculate_dominance_info (NULL, dominators, CDI_DOMINATORS);
+  dominators = calculate_dominance_info (CDI_DOMINATORS);
   if (gcse_file)
     fprintf (gcse_file, "\n");
 }
@@ -5940,7 +5947,7 @@ hoist_code ()
                {
                  /* Ignore self dominance.  */
                  if (bb == dominated
-                     || ! TEST_BIT (dominators[dominated->index], bb->index))
+                     || dominated_by_p (dominators, dominated, bb))
                    continue;
 
                  /* We've found a dominated block, now see if it computes
@@ -5997,7 +6004,7 @@ hoist_code ()
                {
                  /* Ignore self dominance.  */
                  if (bb == dominated
-                     || ! TEST_BIT (dominators[dominated->index], bb->index))
+                     || ! dominated_by_p (dominators, dominated, bb))
                    continue;
 
                  /* We've found a dominated block, now see if it computes