summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-pre.c
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-21 09:18:28 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-21 09:18:28 +0000
commit046bfc77364f8647fa26398c54a063d9d7f93022 (patch)
tree8e91b85f58e03d07731dc2f61c43d3032ebb939b /gcc/tree-ssa-pre.c
parenta89ef955863b1fcc19f862bf6c15b02650040f67 (diff)
downloadgcc-046bfc77364f8647fa26398c54a063d9d7f93022.tar.gz
* vec.h: Update API to separate allocation mechanism from type.
(VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98498 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-pre.c')
-rw-r--r--gcc/tree-ssa-pre.c61
1 files changed, 37 insertions, 24 deletions
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 9029dbe3de3..0e705c301df 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -1112,7 +1112,8 @@ clean (value_set_t set)
}
}
-DEF_VEC_MALLOC_P (basic_block);
+DEF_VEC_P (basic_block);
+DEF_VEC_ALLOC_P (basic_block, heap);
static sbitmap has_abnormal_preds;
/* Compute the ANTIC set for BLOCK.
@@ -1162,15 +1163,15 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge)
them. */
else
{
- VEC (basic_block) * worklist;
+ VEC(basic_block, heap) * worklist;
edge e;
size_t i;
basic_block bprime, first;
edge_iterator ei;
- worklist = VEC_alloc (basic_block, 2);
+ worklist = VEC_alloc (basic_block, heap, EDGE_COUNT (block->succs));
FOR_EACH_EDGE (e, ei, block->succs)
- VEC_safe_push (basic_block, worklist, e->dest);
+ VEC_quick_push (basic_block, worklist, e->dest);
first = VEC_index (basic_block, worklist, 0);
set_copy (ANTIC_OUT, ANTIC_IN (first));
@@ -1187,7 +1188,7 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge)
node = next;
}
}
- VEC_free (basic_block, worklist);
+ VEC_free (basic_block, heap, worklist);
}
/* Generate ANTIC_OUT - TMP_GEN. */
@@ -1271,7 +1272,7 @@ compute_antic (void)
fprintf (dump_file, "compute_antic required %d iterations\n", num_iterations);
}
-static VEC(tree_on_heap) *inserted_exprs;
+static VEC(tree,heap) *inserted_exprs;
/* Find a leader for an expression, or generate one using
create_expression_by_pieces if it's ANTIC but
complex.
@@ -1367,7 +1368,7 @@ create_expression_by_pieces (basic_block block, tree expr, tree stmts)
TREE_OPERAND (newexpr, 0) = name;
tsi = tsi_last (stmts);
tsi_link_after (&tsi, newexpr, TSI_CONTINUE_LINKING);
- VEC_safe_push (tree_on_heap, inserted_exprs, newexpr);
+ VEC_safe_push (tree, heap, inserted_exprs, newexpr);
pre_stats.insertions++;
break;
}
@@ -1415,7 +1416,7 @@ create_expression_by_pieces (basic_block block, tree expr, tree stmts)
NECESSARY (newexpr) = 0;
tsi = tsi_last (stmts);
tsi_link_after (&tsi, newexpr, TSI_CONTINUE_LINKING);
- VEC_safe_push (tree_on_heap, inserted_exprs, newexpr);
+ VEC_safe_push (tree, heap, inserted_exprs, newexpr);
pre_stats.insertions++;
break;
@@ -1533,7 +1534,7 @@ insert_into_preds_of_block (basic_block block, value_set_node_t node,
add_referenced_tmp_var (temp);
temp = create_phi_node (temp, block);
NECESSARY (temp) = 0;
- VEC_safe_push (tree_on_heap, inserted_exprs, temp);
+ VEC_safe_push (tree, heap, inserted_exprs, temp);
FOR_EACH_EDGE (pred, ei, block->preds)
add_phi_arg (temp, avail[pred->src->index], pred);
@@ -2111,10 +2112,11 @@ eliminate (void)
this may be a bit faster, and we may want critical edges kept split. */
/* If OP's defining statement has not already been determined to be necessary,
- mark that statement necessary. and place it on the WORKLIST. */
+ mark that statement necessary. Return the stmt, if it is newly
+ necessary. */
-static inline void
-mark_operand_necessary (tree op, VEC(tree_on_heap) **worklist)
+static inline tree
+mark_operand_necessary (tree op)
{
tree stmt;
@@ -2125,10 +2127,10 @@ mark_operand_necessary (tree op, VEC(tree_on_heap) **worklist)
if (NECESSARY (stmt)
|| IS_EMPTY_STMT (stmt))
- return;
+ return NULL;
NECESSARY (stmt) = 1;
- VEC_safe_push (tree_on_heap, *worklist, stmt);
+ return stmt;
}
/* Because we don't follow exactly the standard PRE algorithm, and decide not
@@ -2139,18 +2141,19 @@ mark_operand_necessary (tree op, VEC(tree_on_heap) **worklist)
static void
remove_dead_inserted_code (void)
{
- VEC (tree_on_heap) *worklist = NULL;
+ VEC(tree,heap) *worklist = NULL;
int i;
tree t;
- for (i = 0; VEC_iterate (tree_on_heap, inserted_exprs, i, t); i++)
+ worklist = VEC_alloc (tree, heap, VEC_length (tree, inserted_exprs));
+ for (i = 0; VEC_iterate (tree, inserted_exprs, i, t); i++)
{
if (NECESSARY (t))
- VEC_safe_push (tree_on_heap, worklist, t);
+ VEC_quick_push (tree, worklist, t);
}
- while (VEC_length (tree_on_heap, worklist) > 0)
+ while (VEC_length (tree, worklist) > 0)
{
- t = VEC_pop (tree_on_heap, worklist);
+ t = VEC_pop (tree, worklist);
if (TREE_CODE (t) == PHI_NODE)
{
/* PHI nodes are somewhat special in that each PHI alternative has
@@ -2160,11 +2163,17 @@ remove_dead_inserted_code (void)
predecessor block associated with each PHI alternative as
necessary. */
int k;
+
+ VEC_reserve (tree, heap, worklist, PHI_NUM_ARGS (t));
for (k = 0; k < PHI_NUM_ARGS (t); k++)
{
tree arg = PHI_ARG_DEF (t, k);
if (TREE_CODE (arg) == SSA_NAME)
- mark_operand_necessary (arg, &worklist);
+ {
+ arg = mark_operand_necessary (arg);
+ if (arg)
+ VEC_quick_push (tree, worklist, arg);
+ }
}
}
else
@@ -2181,10 +2190,14 @@ remove_dead_inserted_code (void)
links). */
FOR_EACH_SSA_TREE_OPERAND (use, t, iter, SSA_OP_ALL_USES)
- mark_operand_necessary (use, &worklist);
+ {
+ tree n = mark_operand_necessary (use);
+ if (n)
+ VEC_safe_push (tree, heap, worklist, n);
+ }
}
}
- for (i = 0; VEC_iterate (tree_on_heap, inserted_exprs, i, t); i++)
+ for (i = 0; VEC_iterate (tree, inserted_exprs, i, t); i++)
{
if (!NECESSARY (t))
{
@@ -2205,7 +2218,7 @@ remove_dead_inserted_code (void)
}
}
}
- VEC_free (tree_on_heap, worklist);
+ VEC_free (tree, heap, worklist);
}
/* Initialize data structures used by PRE. */
@@ -2272,7 +2285,7 @@ fini_pre (bool do_fre)
basic_block bb;
unsigned int i;
- VEC_free (tree_on_heap, inserted_exprs);
+ VEC_free (tree, heap, inserted_exprs);
bitmap_obstack_release (&grand_bitmap_obstack);
free_alloc_pool (value_set_pool);
free_alloc_pool (bitmap_set_pool);