diff options
author | aldot <aldot@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-06-20 08:30:26 +0000 |
---|---|---|
committer | aldot <aldot@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-06-20 08:30:26 +0000 |
commit | 08b9f3f210cb6782ad908b5bf63dd12882020a5d (patch) | |
tree | 5daa9e57b80706495de3926d03f89389ef66ac28 /gcc/tree-ssa-pre.c | |
parent | 48d8ad5ac7dd9ea0f2a9a3646f3bc84f94941254 (diff) | |
download | gcc-08b9f3f210cb6782ad908b5bf63dd12882020a5d.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@136984 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-pre.c')
-rw-r--r-- | gcc/tree-ssa-pre.c | 135 |
1 files changed, 82 insertions, 53 deletions
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 (); } |