diff options
author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-04-21 09:18:28 +0000 |
---|---|---|
committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-04-21 09:18:28 +0000 |
commit | 046bfc77364f8647fa26398c54a063d9d7f93022 (patch) | |
tree | 8e91b85f58e03d07731dc2f61c43d3032ebb939b /gcc/tree-into-ssa.c | |
parent | a89ef955863b1fcc19f862bf6c15b02650040f67 (diff) | |
download | gcc-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-into-ssa.c')
-rw-r--r-- | gcc/tree-into-ssa.c | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index a836aa2cab8..58f5f4cdabf 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -98,10 +98,13 @@ static htab_t def_blocks; - A NULL node at the top entry 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; -/* Basic block vectors used in this file ought to be allocated in the heap. */ -DEF_VEC_MALLOC_P(int); +/* Basic block vectors used in this file ought to be allocated in the + heap. We use pointer vector, because ints can be easily passed by + value. */ +DEF_VEC_P(int); +DEF_VEC_ALLOC_P(int,heap); /* Set of existing SSA names being replaced by update_ssa. */ static sbitmap old_ssa_names; @@ -683,10 +686,10 @@ find_idf (bitmap def_blocks, bitmap *dfs) { bitmap_iterator bi; unsigned bb_index; - VEC(int) *work_stack; + VEC(int,heap) *work_stack; bitmap phi_insertion_points; - work_stack = VEC_alloc (int, n_basic_blocks); + work_stack = VEC_alloc (int, heap, n_basic_blocks); phi_insertion_points = BITMAP_ALLOC (NULL); /* Seed the work list with all the blocks in DEF_BLOCKS. */ @@ -719,12 +722,12 @@ find_idf (bitmap def_blocks, bitmap *dfs) /* Use a safe push because if there is a definition of VAR in every basic block, then WORK_STACK may eventually have more than N_BASIC_BLOCK entries. */ - VEC_safe_push (int, work_stack, bb_index); + VEC_safe_push (int, heap, work_stack, bb_index); bitmap_set_bit (phi_insertion_points, bb_index); } } - VEC_free (int, work_stack); + VEC_free (int, heap, work_stack); return phi_insertion_points; } @@ -892,7 +895,7 @@ insert_phi_nodes (bitmap *dfs, bitmap names_to_rename) into the stack pointed by BLOCK_DEFS_P. */ void -register_new_def (tree def, VEC (tree_on_heap) **block_defs_p) +register_new_def (tree def, VEC(tree,heap) **block_defs_p) { tree var = SSA_NAME_VAR (def); tree currdef; @@ -918,7 +921,7 @@ register_new_def (tree def, VEC (tree_on_heap) **block_defs_p) definitions for all the variables defined in the block after a recursive visit to all its immediately dominated blocks. If there is no current reaching definition, then just record the underlying _DECL node. */ - VEC_safe_push (tree_on_heap, *block_defs_p, currdef ? currdef : var); + VEC_safe_push (tree, heap, *block_defs_p, currdef ? currdef : var); /* Set the current reaching definition for VAR to be DEF. */ set_current_def (var, def); @@ -963,7 +966,7 @@ rewrite_initialize_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED, fprintf (dump_file, "\n\nRenaming block #%d\n\n", bb->index); /* Mark the unwind point for this block. */ - VEC_safe_push (tree_on_heap, block_defs_stack, NULL_TREE); + VEC_safe_push (tree, heap, block_defs_stack, NULL_TREE); /* Step 1. Register new definitions for every PHI node in the block. Conceptually, all the PHI nodes are executed in parallel and each PHI @@ -1089,9 +1092,9 @@ rewrite_finalize_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED, basic_block bb ATTRIBUTE_UNUSED) { /* 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) @@ -1249,8 +1252,9 @@ register_new_update_single (tree new_name, tree old_name) restore the reaching definitions for all the variables defined in the block after a recursive visit to all its immediately dominated blocks. */ - VEC_safe_push (tree_on_heap, block_defs_stack, currdef); - VEC_safe_push (tree_on_heap, block_defs_stack, old_name); + VEC_reserve (tree, heap, block_defs_stack, 2); + VEC_quick_push (tree, block_defs_stack, currdef); + VEC_quick_push (tree, block_defs_stack, old_name); /* Set the current reaching definition for OLD_NAME to be NEW_NAME. */ @@ -1292,7 +1296,7 @@ rewrite_update_init_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED, bb->index); /* Mark the unwind point for this block. */ - VEC_safe_push (tree_on_heap, block_defs_stack, NULL_TREE); + VEC_safe_push (tree, heap, block_defs_stack, NULL_TREE); /* Mark the LHS if any of the arguments flows through an abnormal edge. */ @@ -1362,9 +1366,9 @@ static void rewrite_update_fini_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED, basic_block bb ATTRIBUTE_UNUSED) { - while (VEC_length (tree_on_heap, block_defs_stack) > 0) + while (VEC_length (tree, block_defs_stack) > 0) { - tree var = VEC_pop (tree_on_heap, block_defs_stack); + tree var = VEC_pop (tree, block_defs_stack); tree saved_def; /* NULL indicates the unwind stop point for this block (see @@ -1372,7 +1376,7 @@ rewrite_update_fini_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED, if (var == NULL) return; - saved_def = VEC_pop (tree_on_heap, block_defs_stack); + saved_def = VEC_pop (tree, block_defs_stack); set_current_def (var, saved_def); } } @@ -1603,7 +1607,7 @@ rewrite_blocks (basic_block entry, enum rewrite_mode what, sbitmap blocks) else gcc_unreachable (); - block_defs_stack = VEC_alloc (tree_on_heap, 10); + block_defs_stack = VEC_alloc (tree, heap, 10); /* Initialize the dominator walker. */ init_walk_dominator_tree (&walk_data); @@ -1629,8 +1633,7 @@ rewrite_blocks (basic_block entry, enum rewrite_mode what, sbitmap blocks) def_blocks = NULL; } - VEC_free (tree_on_heap, block_defs_stack); - block_defs_stack = NULL; + VEC_free (tree, heap, block_defs_stack); timevar_pop (TV_TREE_SSA_REWRITE_BLOCKS); } @@ -2855,15 +2858,15 @@ ssa_rewrite_finalize_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED, /* Step 5. Restore the current reaching definition for each variable referenced in the block (in reverse order). */ - while (VEC_length (tree_on_heap, block_defs_stack) > 0) + while (VEC_length (tree, block_defs_stack) > 0) { - tree var = VEC_pop (tree_on_heap, block_defs_stack); + tree var = VEC_pop (tree, block_defs_stack); tree saved_def; if (var == NULL) break; - saved_def = VEC_pop (tree_on_heap, block_defs_stack); + saved_def = VEC_pop (tree, block_defs_stack); set_current_def (var, saved_def); } } @@ -2894,8 +2897,9 @@ ssa_register_new_def (tree var, tree def) later used by the dominator tree callbacks to restore the reaching definitions for all the variables defined in the block after a recursive visit to all its immediately dominated blocks. */ - VEC_safe_push (tree_on_heap, block_defs_stack, currdef); - VEC_safe_push (tree_on_heap, block_defs_stack, var); + VEC_reserve (tree, heap, block_defs_stack, 2); + VEC_quick_push (tree, block_defs_stack, currdef); + VEC_quick_push (tree, block_defs_stack, var); /* Set the current reaching definition for VAR to be DEF. */ set_current_def (var, def); @@ -2999,7 +3003,7 @@ ssa_rewrite_initialize_block (struct dom_walk_data *walk_data, basic_block bb) fprintf (dump_file, "\n\nRenaming block #%d\n\n", bb->index); /* Mark the unwind point for this block. */ - VEC_safe_push (tree_on_heap, block_defs_stack, NULL_TREE); + VEC_safe_push (tree, heap, block_defs_stack, NULL_TREE); FOR_EACH_EDGE (e, ei, bb->preds) if (e->flags & EDGE_ABNORMAL) @@ -3194,7 +3198,7 @@ rewrite_ssa_into_ssa (void) mark_def_sites_global_data.names_to_rename = snames_to_rename; walk_data.global_data = &mark_def_sites_global_data; - block_defs_stack = VEC_alloc (tree_on_heap, 10); + block_defs_stack = VEC_alloc (tree, heap, 10); /* We do not have any local data. */ walk_data.block_local_data_size = 0; @@ -3284,7 +3288,6 @@ rewrite_ssa_into_ssa (void) BITMAP_FREE (to_rename); - VEC_free (tree_on_heap, block_defs_stack); - block_defs_stack = NULL; + VEC_free (tree, heap, block_defs_stack); timevar_pop (TV_TREE_SSA_OTHER); } |