From a7849637b61378d568b5ab225daafb458df492bc Mon Sep 17 00:00:00 2001 From: Bernhard Fischer Date: Fri, 20 Jun 2008 10:30:26 +0200 Subject: [PATCH] tree-ssa-pre.c: Fix typo in comment. 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. From-SVN: r136984 --- gcc/ChangeLog | 12 +++- gcc/tree-ssa-pre.c | 135 +++++++++++++++++++++++++++------------------ 2 files changed, 93 insertions(+), 54 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f36890c7895..908ccc1e71b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +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. + 2008-06-19 Kaveh R. Ghazi * collect2.c (main, add_to_list): Fix for -Wc++-compat. @@ -14,7 +24,7 @@ 2008-06-19 Kenneth Zadeck * doc/rtl.texi: Updated subreg section. - + 2008-06-19 Jakub Jelinek PR c++/36523 diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index e52b02ab026..5e3cfd679ff 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -132,7 +132,7 @@ along with GCC; see the file COPYING3. If not see 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 block, 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 block, tree expr, tree stmts, 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 (); } -- 2.30.2