diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2005-04-21 09:18:28 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2005-04-21 09:18:28 +0000 |
commit | d4e6fecb8fa3f91bf3dfd1a117e0f8e837943853 (patch) | |
tree | 8e91b85f58e03d07731dc2f61c43d3032ebb939b /gcc/lambda-code.c | |
parent | 2412d35ca6436f9c36251b46e765759d36f908ab (diff) | |
download | gcc-d4e6fecb8fa3f91bf3dfd1a117e0f8e837943853.zip gcc-d4e6fecb8fa3f91bf3dfd1a117e0f8e837943853.tar.gz gcc-d4e6fecb8fa3f91bf3dfd1a117e0f8e837943853.tar.bz2 |
vec.h: Update API to separate allocation mechanism from type.
* 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.
From-SVN: r98498
Diffstat (limited to 'gcc/lambda-code.c')
-rw-r--r-- | gcc/lambda-code.c | 89 |
1 files changed, 48 insertions, 41 deletions
diff --git a/gcc/lambda-code.c b/gcc/lambda-code.c index 50815f9..da24e95 100644 --- a/gcc/lambda-code.c +++ b/gcc/lambda-code.c @@ -115,12 +115,16 @@ Fourier-Motzkin elimination is used to compute the bounds of the base space of the lattice. */ +/* FIXME: I'm sure the vectors used here could be heap allocated. + There certainly should be explicit VEC_frees, either way. (nathan + 2005/04/14) */ -DEF_VEC_GC_P(int); +DEF_VEC_P(int); +DEF_VEC_ALLOC_P(int,gc); static bool perfect_nestify (struct loops *, - struct loop *, VEC (tree) *, - VEC (tree) *, VEC (int) *, VEC (tree) *); + struct loop *, VEC(tree,gc) *, + VEC(tree,gc) *, VEC(int,gc) *, VEC(tree,gc) *); /* Lattice stuff that is internal to the code generation algorithm. */ typedef struct @@ -1152,8 +1156,8 @@ lambda_loopnest_transform (lambda_loopnest nest, lambda_trans_matrix trans) static lambda_linear_expression gcc_tree_to_linear_expression (int depth, tree expr, - VEC(tree) *outerinductionvars, - VEC(tree) *invariants, int extra) + VEC(tree,gc) *outerinductionvars, + VEC(tree,gc) *invariants, int extra) { lambda_linear_expression lle = NULL; switch (TREE_CODE (expr)) @@ -1248,12 +1252,12 @@ invariant_in_loop_and_outer_loops (struct loop *loop, tree op) static lambda_loop gcc_loop_to_lambda_loop (struct loop *loop, int depth, - VEC (tree) ** invariants, + VEC(tree,gc) ** invariants, tree * ourinductionvar, - VEC (tree) * outerinductionvars, - VEC (tree) ** lboundvars, - VEC (tree) ** uboundvars, - VEC (int) ** steps) + VEC(tree,gc) * outerinductionvars, + VEC(tree,gc) ** lboundvars, + VEC(tree,gc) ** uboundvars, + VEC(int,gc) ** steps) { tree phi; tree exit_cond; @@ -1403,10 +1407,10 @@ gcc_loop_to_lambda_loop (struct loop *loop, int depth, /* One part of the test may be a loop invariant tree. */ if (TREE_CODE (TREE_OPERAND (test, 1)) == SSA_NAME && invariant_in_loop_and_outer_loops (loop, TREE_OPERAND (test, 1))) - VEC_safe_push (tree, *invariants, TREE_OPERAND (test, 1)); + VEC_safe_push (tree, gc, *invariants, TREE_OPERAND (test, 1)); else if (TREE_CODE (TREE_OPERAND (test, 0)) == SSA_NAME && invariant_in_loop_and_outer_loops (loop, TREE_OPERAND (test, 0))) - VEC_safe_push (tree, *invariants, TREE_OPERAND (test, 0)); + VEC_safe_push (tree, gc, *invariants, TREE_OPERAND (test, 0)); /* The non-induction variable part of the test is the upper bound variable. */ @@ -1438,9 +1442,9 @@ gcc_loop_to_lambda_loop (struct loop *loop, int depth, *invariants, extra); uboundresult = build (PLUS_EXPR, TREE_TYPE (uboundvar), uboundvar, build_int_cst (TREE_TYPE (uboundvar), extra)); - VEC_safe_push (tree, *uboundvars, uboundresult); - VEC_safe_push (tree, *lboundvars, lboundvar); - VEC_safe_push (int, *steps, stepint); + VEC_safe_push (tree, gc, *uboundvars, uboundresult); + VEC_safe_push (tree, gc, *lboundvars, lboundvar); + VEC_safe_push (int, gc, *steps, stepint); if (!ubound) { if (dump_file && (dump_flags & TDF_DETAILS)) @@ -1488,7 +1492,9 @@ find_induction_var_from_exit_cond (struct loop *loop) return ivarop; } -DEF_VEC_GC_P(lambda_loop); +DEF_VEC_P(lambda_loop); +DEF_VEC_ALLOC_P(lambda_loop,gc); + /* Generate a lambda loopnest from a gcc loopnest LOOP_NEST. Return the new loop nest. INDUCTIONVARS is a pointer to an array of induction variables for the @@ -1499,18 +1505,18 @@ DEF_VEC_GC_P(lambda_loop); lambda_loopnest gcc_loopnest_to_lambda_loopnest (struct loops *currloops, struct loop * loop_nest, - VEC (tree) **inductionvars, - VEC (tree) **invariants, + VEC(tree,gc) **inductionvars, + VEC(tree,gc) **invariants, bool need_perfect_nest) { lambda_loopnest ret; struct loop *temp; int depth = 0; size_t i; - VEC (lambda_loop) *loops = NULL; - VEC (tree) *uboundvars = NULL; - VEC (tree) *lboundvars = NULL; - VEC (int) *steps = NULL; + VEC(lambda_loop,gc) *loops = NULL; + VEC(tree,gc) *uboundvars = NULL; + VEC(tree,gc) *lboundvars = NULL; + VEC(int,gc) *steps = NULL; lambda_loop newloop; tree inductionvar = NULL; @@ -1524,8 +1530,8 @@ gcc_loopnest_to_lambda_loopnest (struct loops *currloops, &steps); if (!newloop) return NULL; - VEC_safe_push (tree, *inductionvars, inductionvar); - VEC_safe_push (lambda_loop, loops, newloop); + VEC_safe_push (tree, gc, *inductionvars, inductionvar); + VEC_safe_push (lambda_loop, gc, loops, newloop); temp = temp->inner; } if (need_perfect_nest) @@ -1559,7 +1565,7 @@ gcc_loopnest_to_lambda_loopnest (struct loops *currloops, static tree lbv_to_gcc_expression (lambda_body_vector lbv, - tree type, VEC (tree) *induction_vars, + tree type, VEC(tree,gc) *induction_vars, tree * stmts_to_insert) { tree stmts, stmt, resvar, name; @@ -1642,15 +1648,15 @@ static tree lle_to_gcc_expression (lambda_linear_expression lle, lambda_linear_expression offset, tree type, - VEC(tree) *induction_vars, - VEC(tree) *invariants, + VEC(tree,gc) *induction_vars, + VEC(tree,gc) *invariants, enum tree_code wrap, tree * stmts_to_insert) { tree stmts, stmt, resvar, name; size_t i; tree_stmt_iterator tsi; tree iv, invar; - VEC(tree) *results = NULL; + VEC(tree,gc) *results = NULL; name = NULL_TREE; /* Create a statement list and a linear expression temporary. */ @@ -1801,7 +1807,7 @@ lle_to_gcc_expression (lambda_linear_expression lle, tsi = tsi_last (stmts); tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING); } - VEC_safe_push (tree, results, name); + VEC_safe_push (tree, gc, results, name); } /* Again, out of laziness, we don't handle this case yet. It's not @@ -1839,8 +1845,8 @@ lle_to_gcc_expression (lambda_linear_expression lle, void lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest, - VEC(tree) *old_ivs, - VEC(tree) *invariants, + VEC(tree,gc) *old_ivs, + VEC(tree,gc) *invariants, lambda_loopnest new_loopnest, lambda_trans_matrix transform) { @@ -1848,7 +1854,7 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest, struct loop *temp; size_t i = 0; size_t depth = 0; - VEC(tree) *new_ivs = NULL; + VEC(tree,gc) *new_ivs = NULL; tree oldiv; block_stmt_iterator bsi; @@ -1883,7 +1889,7 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest, ivvar = create_tmp_var (type, "lnivtmp"); add_referenced_tmp_var (ivvar); - VEC_safe_push (tree, new_ivs, ivvar); + VEC_safe_push (tree, gc, new_ivs, ivvar); newloop = LN_LOOPS (new_loopnest)[i]; @@ -2207,7 +2213,7 @@ stmt_uses_op (tree stmt, tree op) static bool can_convert_to_perfect_nest (struct loop *loop, - VEC (tree) *loopivs) + VEC(tree,gc) *loopivs) { basic_block *bbs; tree exit_condition, phi; @@ -2307,10 +2313,10 @@ can_convert_to_perfect_nest (struct loop *loop, static bool perfect_nestify (struct loops *loops, struct loop *loop, - VEC (tree) *lbounds, - VEC (tree) *ubounds, - VEC (int) *steps, - VEC (tree) *loopivs) + VEC(tree,gc) *lbounds, + VEC(tree,gc) *ubounds, + VEC(int,gc) *steps, + VEC(tree,gc) *loopivs) { basic_block *bbs; tree exit_condition; @@ -2325,7 +2331,7 @@ perfect_nestify (struct loops *loops, tree uboundvar; tree stmt; tree oldivvar, ivvar, ivvarinced; - VEC (tree) *phis = NULL; + VEC(tree,gc) *phis = NULL; if (!can_convert_to_perfect_nest (loop, loopivs)) return false; @@ -2339,8 +2345,9 @@ perfect_nestify (struct loops *loops, /* Push the exit phi nodes that we are moving. */ for (phi = phi_nodes (olddest); phi; phi = PHI_CHAIN (phi)) { - VEC_safe_push (tree, phis, PHI_RESULT (phi)); - VEC_safe_push (tree, phis, PHI_ARG_DEF (phi, 0)); + VEC_reserve (tree, gc, phis, 2); + VEC_quick_push (tree, phis, PHI_RESULT (phi)); + VEC_quick_push (tree, phis, PHI_ARG_DEF (phi, 0)); } e = redirect_edge_and_branch (single_succ_edge (preheaderbb), headerbb); |