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. */
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
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);
while (new_stuff)
{
num_iterations++;
- new_stuff = false;
new_stuff = insert_aux (ENTRY_BLOCK_PTR);
}
statistics_histogram_event (cfun, "insert iterations", num_iterations);
if (TREE_CODE (t) == PHI_NODE)
{
- remove_phi_node (t, NULL, true);
+ remove_phi_node (t, NULL_TREE, true);
}
else
{
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;
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);
}
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);
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 ();
}