summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dom.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-dom.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-dom.c')
-rw-r--r--gcc/tree-ssa-dom.c97
1 files changed, 49 insertions, 48 deletions
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 1d4f9b0b1c2..429ba768f5d 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -94,7 +94,7 @@ static htab_t avail_exprs;
(null). When we finish processing the block, we pop off entries and
remove the expressions from the global hash table until we hit the
marker. */
-static VEC(tree_on_heap) *avail_exprs_stack;
+static VEC(tree,heap) *avail_exprs_stack;
/* Stack of trees used to restore the global currdefs to its original
state after completing optimization of a block and its dominator children.
@@ -107,7 +107,7 @@ static VEC(tree_on_heap) *avail_exprs_stack;
A NULL node is used to mark the last node associated with the
current block. */
-static VEC(tree_on_heap) *block_defs_stack;
+static VEC(tree,heap) *block_defs_stack;
/* Stack of statements we need to rescan during finalization for newly
exposed variables.
@@ -116,7 +116,7 @@ static VEC(tree_on_heap) *block_defs_stack;
expressions are removed from AVAIL_EXPRS. Else we may change the
hash code for an expression and be unable to find/remove it from
AVAIL_EXPRS. */
-static VEC(tree_on_heap) *stmts_to_rescan;
+static VEC(tree,heap) *stmts_to_rescan;
/* Structure for entries in the expression hash table.
@@ -148,7 +148,7 @@ struct expr_hash_elt
A NULL entry is used to mark the end of pairs which need to be
restored during finalization of this block. */
-static VEC(tree_on_heap) *const_and_copies_stack;
+static VEC(tree,heap) *const_and_copies_stack;
/* Bitmap of SSA_NAMEs known to have a nonzero value, even if we do not
know their exact value. */
@@ -159,7 +159,7 @@ static bitmap nonzero_vars;
A NULL entry is used to mark the end of names needing their
entry in NONZERO_VARS cleared during finalization of this block. */
-static VEC(tree_on_heap) *nonzero_vars_stack;
+static VEC(tree,heap) *nonzero_vars_stack;
/* Track whether or not we have changed the control flow graph. */
static bool cfg_altered;
@@ -254,7 +254,7 @@ struct vrp_hash_elt
list to determine which variables need their VRP data updated.
A NULL entry marks the end of the SSA_NAMEs associated with this block. */
-static VEC(tree_on_heap) *vrp_variables_stack;
+static VEC(tree,heap) *vrp_variables_stack;
struct eq_expr_value
{
@@ -382,12 +382,12 @@ tree_ssa_dominator_optimize (void)
/* Create our hash tables. */
avail_exprs = htab_create (1024, real_avail_expr_hash, avail_expr_eq, free);
vrp_data = htab_create (ceil_log2 (num_ssa_names), vrp_hash, vrp_eq, free);
- avail_exprs_stack = VEC_alloc (tree_on_heap, 20);
- block_defs_stack = VEC_alloc (tree_on_heap, 20);
- const_and_copies_stack = VEC_alloc (tree_on_heap, 20);
- nonzero_vars_stack = VEC_alloc (tree_on_heap, 20);
- vrp_variables_stack = VEC_alloc (tree_on_heap, 20);
- stmts_to_rescan = VEC_alloc (tree_on_heap, 20);
+ avail_exprs_stack = VEC_alloc (tree, heap, 20);
+ block_defs_stack = VEC_alloc (tree, heap, 20);
+ const_and_copies_stack = VEC_alloc (tree, heap, 20);
+ nonzero_vars_stack = VEC_alloc (tree, heap, 20);
+ vrp_variables_stack = VEC_alloc (tree, heap, 20);
+ stmts_to_rescan = VEC_alloc (tree, heap, 20);
nonzero_vars = BITMAP_ALLOC (NULL);
need_eh_cleanup = BITMAP_ALLOC (NULL);
@@ -545,12 +545,12 @@ tree_ssa_dominator_optimize (void)
BITMAP_FREE (nonzero_vars);
BITMAP_FREE (need_eh_cleanup);
- VEC_free (tree_on_heap, block_defs_stack);
- VEC_free (tree_on_heap, avail_exprs_stack);
- VEC_free (tree_on_heap, const_and_copies_stack);
- VEC_free (tree_on_heap, nonzero_vars_stack);
- VEC_free (tree_on_heap, vrp_variables_stack);
- VEC_free (tree_on_heap, stmts_to_rescan);
+ VEC_free (tree, heap, block_defs_stack);
+ VEC_free (tree, heap, avail_exprs_stack);
+ VEC_free (tree, heap, const_and_copies_stack);
+ VEC_free (tree, heap, nonzero_vars_stack);
+ VEC_free (tree, heap, vrp_variables_stack);
+ VEC_free (tree, heap, stmts_to_rescan);
}
static bool
@@ -850,11 +850,11 @@ dom_opt_initialize_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
/* Push a marker on the stacks of local information so that we know how
far to unwind when we finalize this block. */
- VEC_safe_push (tree_on_heap, avail_exprs_stack, NULL_TREE);
- VEC_safe_push (tree_on_heap, block_defs_stack, NULL_TREE);
- VEC_safe_push (tree_on_heap, const_and_copies_stack, NULL_TREE);
- VEC_safe_push (tree_on_heap, nonzero_vars_stack, NULL_TREE);
- VEC_safe_push (tree_on_heap, vrp_variables_stack, NULL_TREE);
+ VEC_safe_push (tree, heap, avail_exprs_stack, NULL_TREE);
+ VEC_safe_push (tree, heap, block_defs_stack, NULL_TREE);
+ VEC_safe_push (tree, heap, const_and_copies_stack, NULL_TREE);
+ VEC_safe_push (tree, heap, nonzero_vars_stack, NULL_TREE);
+ VEC_safe_push (tree, heap, vrp_variables_stack, NULL_TREE);
record_equivalences_from_incoming_edge (bb);
@@ -910,10 +910,10 @@ static void
remove_local_expressions_from_table (void)
{
/* Remove all the expressions made available in this block. */
- while (VEC_length (tree_on_heap, avail_exprs_stack) > 0)
+ while (VEC_length (tree, avail_exprs_stack) > 0)
{
struct expr_hash_elt element;
- tree expr = VEC_pop (tree_on_heap, avail_exprs_stack);
+ tree expr = VEC_pop (tree, avail_exprs_stack);
if (expr == NULL_TREE)
break;
@@ -929,9 +929,9 @@ remove_local_expressions_from_table (void)
static void
restore_nonzero_vars_to_original_value (void)
{
- while (VEC_length (tree_on_heap, nonzero_vars_stack) > 0)
+ while (VEC_length (tree, nonzero_vars_stack) > 0)
{
- tree name = VEC_pop (tree_on_heap, nonzero_vars_stack);
+ tree name = VEC_pop (tree, nonzero_vars_stack);
if (name == NULL)
break;
@@ -947,16 +947,16 @@ restore_nonzero_vars_to_original_value (void)
static void
restore_vars_to_original_value (void)
{
- while (VEC_length (tree_on_heap, const_and_copies_stack) > 0)
+ while (VEC_length (tree, const_and_copies_stack) > 0)
{
tree prev_value, dest;
- dest = VEC_pop (tree_on_heap, const_and_copies_stack);
+ dest = VEC_pop (tree, const_and_copies_stack);
if (dest == NULL)
break;
- prev_value = VEC_pop (tree_on_heap, const_and_copies_stack);
+ prev_value = VEC_pop (tree, const_and_copies_stack);
SSA_NAME_VALUE (dest) = prev_value;
}
}
@@ -967,9 +967,9 @@ static void
restore_currdefs_to_original_value (void)
{
/* Restore CURRDEFS to its original state. */
- while (VEC_length (tree_on_heap, block_defs_stack) > 0)
+ while (VEC_length (tree, block_defs_stack) > 0)
{
- tree tmp = VEC_pop (tree_on_heap, block_defs_stack);
+ tree tmp = VEC_pop (tree, block_defs_stack);
tree saved_def, var;
if (tmp == NULL_TREE)
@@ -1050,9 +1050,9 @@ dom_opt_finalize_block (struct dom_walk_data *walk_data, basic_block bb)
/* Push a marker onto the available expression stack so that we
unwind any expressions related to the TRUE arm before processing
the false arm below. */
- VEC_safe_push (tree_on_heap, avail_exprs_stack, NULL_TREE);
- VEC_safe_push (tree_on_heap, block_defs_stack, NULL_TREE);
- VEC_safe_push (tree_on_heap, const_and_copies_stack, NULL_TREE);
+ VEC_safe_push (tree, heap, avail_exprs_stack, NULL_TREE);
+ VEC_safe_push (tree, heap, block_defs_stack, NULL_TREE);
+ VEC_safe_push (tree, heap, const_and_copies_stack, NULL_TREE);
edge_info = true_edge->aux;
@@ -1154,9 +1154,9 @@ dom_opt_finalize_block (struct dom_walk_data *walk_data, basic_block bb)
To be efficient, we note which variables have had their values
constrained in this block. So walk over each variable in the
VRP_VARIABLEs array. */
- while (VEC_length (tree_on_heap, vrp_variables_stack) > 0)
+ while (VEC_length (tree, vrp_variables_stack) > 0)
{
- tree var = VEC_pop (tree_on_heap, vrp_variables_stack);
+ tree var = VEC_pop (tree, vrp_variables_stack);
struct vrp_hash_elt vrp_hash_elt, *vrp_hash_elt_p;
void **slot;
@@ -1192,15 +1192,15 @@ dom_opt_finalize_block (struct dom_walk_data *walk_data, basic_block bb)
/* If we queued any statements to rescan in this block, then
go ahead and rescan them now. */
- while (VEC_length (tree_on_heap, stmts_to_rescan) > 0)
+ while (VEC_length (tree, stmts_to_rescan) > 0)
{
- tree stmt = VEC_last (tree_on_heap, stmts_to_rescan);
+ tree stmt = VEC_last (tree, stmts_to_rescan);
basic_block stmt_bb = bb_for_stmt (stmt);
if (stmt_bb != bb)
break;
- VEC_pop (tree_on_heap, stmts_to_rescan);
+ VEC_pop (tree, stmts_to_rescan);
mark_new_vars_to_rename (stmt);
}
}
@@ -1436,7 +1436,7 @@ record_var_is_nonzero (tree var)
/* Record this SSA_NAME so that we can reset the global table
when we leave this block. */
- VEC_safe_push (tree_on_heap, nonzero_vars_stack, var);
+ VEC_safe_push (tree, heap, nonzero_vars_stack, var);
}
/* Enter a statement into the true/false expression hash table indicating
@@ -1455,7 +1455,7 @@ record_cond (tree cond, tree value)
if (*slot == NULL)
{
*slot = (void *) element;
- VEC_safe_push (tree_on_heap, avail_exprs_stack, cond);
+ VEC_safe_push (tree, heap, avail_exprs_stack, cond);
}
else
free (element);
@@ -1594,8 +1594,9 @@ record_const_or_copy_1 (tree x, tree y, tree prev_x)
{
SSA_NAME_VALUE (x) = y;
- VEC_safe_push (tree_on_heap, const_and_copies_stack, prev_x);
- VEC_safe_push (tree_on_heap, const_and_copies_stack, x);
+ VEC_reserve (tree, heap, const_and_copies_stack, 2);
+ VEC_quick_push (tree, const_and_copies_stack, prev_x);
+ VEC_quick_push (tree, const_and_copies_stack, x);
}
@@ -3125,7 +3126,7 @@ optimize_stmt (struct dom_walk_data *walk_data, basic_block bb,
}
if (may_have_exposed_new_symbols)
- VEC_safe_push (tree_on_heap, stmts_to_rescan, bsi_stmt (si));
+ VEC_safe_push (tree, heap, stmts_to_rescan, bsi_stmt (si));
}
/* Replace the RHS of STMT with NEW_RHS. If RHS can be found in the
@@ -3177,7 +3178,7 @@ update_rhs_and_lookup_avail_expr (tree stmt, tree new_rhs, bool insert)
we found a copy of this statement in the second hash table lookup
we want _no_ copies of this statement in BLOCK_AVAIL_EXPRs. */
if (insert)
- VEC_pop (tree_on_heap, avail_exprs_stack);
+ VEC_pop (tree, avail_exprs_stack);
/* And make sure we record the fact that we modified this
statement. */
@@ -3253,7 +3254,7 @@ lookup_avail_expr (tree stmt, bool insert)
if (*slot == NULL)
{
*slot = (void *) element;
- VEC_safe_push (tree_on_heap, avail_exprs_stack,
+ VEC_safe_push (tree, heap, avail_exprs_stack,
stmt ? stmt : element->rhs);
return NULL_TREE;
}
@@ -3393,7 +3394,7 @@ record_range (tree cond, basic_block bb)
VARRAY_GENERIC_PTR_INIT (*vrp_records_p, 2, "vrp records");
VARRAY_PUSH_GENERIC_PTR (*vrp_records_p, element);
- VEC_safe_push (tree_on_heap, vrp_variables_stack, TREE_OPERAND (cond, 0));
+ VEC_safe_push (tree, heap, vrp_variables_stack, TREE_OPERAND (cond, 0));
}
}