This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] factor out generic (de)initialization of ANTIC and AVAIL in PRE


On Wed, Jun 18, 2008 at 04:07:07PM -0400, Daniel Berlin wrote:
>On Wed, Jun 18, 2008 at 3:57 PM, Bernhard Fischer <rep.dot.nop@gmail.com> wrote:
>> On Wed, Jun 18, 2008 at 03:30:27PM -0400, Daniel Berlin wrote:
>>>On Wed, Jun 18, 2008 at 3:18 PM, Bernhard Fischer <rep.dot.nop@gmail.com> wrote:
>>>> Hi,
>>>>
>>>> The attached patch factors the (de)initialization of ANTIC and AVAIL
>>>> sets used by PRE into init_antic() and fini_antic().
>>>>
>>>> The patch was bootstrapped and regtested with languages=c,fortran on
>>>> i686 with no regressions.
>>>> OK for trunk?

>The rest looks okay to me ;)

Thanks.
I've thus installed the attached patch on trunk as revision 136984 after
re-verifying a bootstrap with c,c++,fortran and regression-testing on
i686-linux-gnu without regressions.

2008-06-20  Bernhard Fischer  <>

        * tree-ssa-pre.c: Fix typo in comment.
        (init_antic, fini_antic): Add explicit funtions for
        initializing and deinitializing ANTIC and AVAIL sets.
        (create_expression_by_pieces): Fix typo in comment.
        Remove redundant set of new_stuff and use NULL_TREE instead of
        NULL.
        (execute_pre): Eventually dump details about ANTIC_IN.

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 136983)
+++ ChangeLog	(working copy)
@@ -1,3 +1,13 @@
+2008-06-20  Bernhard Fischer  <aldot@gcc.gnu.org>
+
+        * tree-ssa-pre.c: Fix typo in comment.
+        (init_antic, fini_antic): Add explicit funtions for
+        initializing and deinitializing ANTIC and AVAIL sets.
+        (create_expression_by_pieces): Fix typo in comment.
+        Remove redundant set of new_stuff and use NULL_TREE instead of
+        NULL.
+        (execute_pre): Eventually dump details about ANTIC_IN.
+
 2008-06-19  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
 	* collect2.c (main, add_to_list): Fix for -Wc++-compat.
@@ -14,7 +24,7 @@
 2008-06-19  Kenneth Zadeck <zadeck@naturalbridge.com>
 
 	* doc/rtl.texi: Updated subreg section.
-	
+
 2008-06-19  Jakub Jelinek  <jakub@redhat.com>
 
 	PR c++/36523
Index: tree-ssa-pre.c
===================================================================
--- tree-ssa-pre.c	(revision 136983)
+++ tree-ssa-pre.c	(working copy)
@@ -132,7 +132,7 @@ along with GCC; see the file COPYING3.  
 
    Expression nodes have value handles associated with them as a
    cache.  Otherwise, we'd have to look them up again in the hash
-   table This makes significant difference (factor of two or more) on
+   table.  This makes significant difference (factor of two or more) on
    some test cases.  They can be thrown away after the pass is
    finished.  */
 
@@ -1967,6 +1967,73 @@ compute_partial_antic_aux (basic_block b
   return changed;
 }
 
+/* Initialize data structures used for ANTIC and AVAIL.  */
+
+static void
+init_antic (void)
+{
+  basic_block bb;
+
+  next_expression_id = 0;
+  expressions = NULL;
+  expression_vuses = NULL;
+
+  postorder = XNEWVEC (int, n_basic_blocks - NUM_FIXED_BLOCKS);
+  post_order_compute (postorder, false, false);
+
+  bitmap_obstack_initialize (&grand_bitmap_obstack);
+  obstack_init (&temp_call_expr_obstack);
+  seen_during_translate = BITMAP_ALLOC (&grand_bitmap_obstack);
+
+  bitmap_set_pool = create_alloc_pool ("Bitmap sets",
+					sizeof (struct bitmap_set), 30);
+  binary_node_pool = create_alloc_pool ("Binary tree nodes",
+					tree_code_size (PLUS_EXPR), 30);
+  unary_node_pool = create_alloc_pool ("Unary tree nodes",
+				       tree_code_size (NEGATE_EXPR), 30);
+  reference_node_pool = create_alloc_pool ("Reference tree nodes",
+					   tree_code_size (ARRAY_REF), 30);
+  comparison_node_pool = create_alloc_pool ("Comparison tree nodes",
+					    tree_code_size (EQ_EXPR), 30);
+
+  phi_translate_table = htab_create (5110, expr_pred_trans_hash,
+				     expr_pred_trans_eq, free);
+  maximal_set = in_fre ? NULL : bitmap_set_new ();
+
+  FOR_ALL_BB (bb)
+    {
+      bb->aux = xcalloc (1, sizeof (struct bb_bitmap_sets));
+      EXP_GEN (bb) = bitmap_set_new ();
+      PHI_GEN (bb) = bitmap_set_new ();
+      TMP_GEN (bb) = bitmap_set_new ();
+      AVAIL_OUT (bb) = bitmap_set_new ();
+    }
+}
+
+/* Deinitialize data structures used for ANTIC and AVAIL.  */
+
+static void
+fini_antic (void)
+{
+  basic_block bb;
+
+  free (postorder);
+  bitmap_obstack_release (&grand_bitmap_obstack);
+  free_alloc_pool (bitmap_set_pool);
+  free_alloc_pool (binary_node_pool);
+  free_alloc_pool (reference_node_pool);
+  free_alloc_pool (unary_node_pool);
+  free_alloc_pool (comparison_node_pool);
+
+  if (maximal_set)
+    bitmap_set_free (maximal_set);
+  FOR_ALL_BB (bb)
+    {
+      free (bb->aux);
+      bb->aux = NULL;
+    }
+}
+
 /* Compute ANTIC and partial ANTIC sets.  */
 
 static void
@@ -2414,7 +2481,7 @@ create_expression_by_pieces (basic_block
 				  false, NULL);
 
   /* If we have any intermediate expressions to the value sets, add them
-     to the value sets and chain them on in the instruction stream.  */
+     to the value sets and chain them in the instruction stream.  */
   if (forced_stmts)
     {
       tsi = tsi_start (forced_stmts);
@@ -2931,7 +2998,6 @@ insert (void)
   while (new_stuff)
     {
       num_iterations++;
-      new_stuff = false;
       new_stuff = insert_aux (ENTRY_BLOCK_PTR);
     }
   statistics_histogram_event (cfun, "insert iterations", num_iterations);
@@ -3833,7 +3899,7 @@ remove_dead_inserted_code (void)
 
 	  if (TREE_CODE (t) == PHI_NODE)
 	    {
-	      remove_phi_node (t, NULL, true);
+	      remove_phi_node (t, NULL_TREE, true);
 	    }
 	  else
 	    {
@@ -3851,11 +3917,6 @@ remove_dead_inserted_code (void)
 static void
 init_pre (bool do_fre)
 {
-  basic_block bb;
-
-  next_expression_id = 0;
-  expressions = NULL;
-  expression_vuses = NULL;
   in_fre = do_fre;
 
   inserted_exprs = NULL;
@@ -3870,40 +3931,10 @@ init_pre (bool do_fre)
   connect_infinite_loops_to_exit ();
   memset (&pre_stats, 0, sizeof (pre_stats));
 
-
-  postorder = XNEWVEC (int, n_basic_blocks - NUM_FIXED_BLOCKS);
-  post_order_compute (postorder, false, false);
-
-  FOR_ALL_BB (bb)
-    bb->aux = xcalloc (1, sizeof (struct bb_bitmap_sets));
-
   calculate_dominance_info (CDI_POST_DOMINATORS);
   calculate_dominance_info (CDI_DOMINATORS);
 
-  bitmap_obstack_initialize (&grand_bitmap_obstack);
-  phi_translate_table = htab_create (5110, expr_pred_trans_hash,
-				     expr_pred_trans_eq, free);
-  seen_during_translate = BITMAP_ALLOC (&grand_bitmap_obstack);
-  bitmap_set_pool = create_alloc_pool ("Bitmap sets",
-				       sizeof (struct bitmap_set), 30);
-  binary_node_pool = create_alloc_pool ("Binary tree nodes",
-					tree_code_size (PLUS_EXPR), 30);
-  unary_node_pool = create_alloc_pool ("Unary tree nodes",
-				       tree_code_size (NEGATE_EXPR), 30);
-  reference_node_pool = create_alloc_pool ("Reference tree nodes",
-					   tree_code_size (ARRAY_REF), 30);
-  comparison_node_pool = create_alloc_pool ("Comparison tree nodes",
-					    tree_code_size (EQ_EXPR), 30);
-  obstack_init (&temp_call_expr_obstack);
-
-  FOR_ALL_BB (bb)
-    {
-      EXP_GEN (bb) = bitmap_set_new ();
-      PHI_GEN (bb) = bitmap_set_new ();
-      TMP_GEN (bb) = bitmap_set_new ();
-      AVAIL_OUT (bb) = bitmap_set_new ();
-    }
-  maximal_set = in_fre ? NULL : bitmap_set_new ();
+  init_antic ();
 
   need_eh_cleanup = BITMAP_ALLOC (NULL);
 }
@@ -3914,26 +3945,14 @@ init_pre (bool do_fre)
 static void
 fini_pre (void)
 {
-  basic_block bb;
   unsigned int i;
 
-  free (postorder);
   VEC_free (tree, heap, inserted_exprs);
   VEC_free (tree, heap, need_creation);
-  bitmap_obstack_release (&grand_bitmap_obstack);
-  free_alloc_pool (bitmap_set_pool);
-  free_alloc_pool (binary_node_pool);
-  free_alloc_pool (reference_node_pool);
-  free_alloc_pool (unary_node_pool);
-  free_alloc_pool (comparison_node_pool);
   htab_delete (phi_translate_table);
   remove_fake_exit_edges ();
 
-  FOR_ALL_BB (bb)
-    {
-      free (bb->aux);
-      bb->aux = NULL;
-    }
+  fini_antic ();
 
   free_dominance_info (CDI_POST_DOMINATORS);
 
@@ -4009,6 +4028,16 @@ execute_pre (bool do_fre)
   if (!do_fre && n_basic_blocks < 4000)
     {
       compute_antic ();
+  if (dump_file && (dump_flags & TDF_DETAILS))
+    {
+      basic_block bb;
+
+      FOR_ALL_BB (bb)
+	{
+	  print_bitmap_set (dump_file, ANTIC_IN (bb), "antic_in", bb->index);
+	}
+    }
+
       insert ();
     }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]