From 17519ba0dc05161d1dd4fba308eee373e9a9841b Mon Sep 17 00:00:00 2001 From: rakdver Date: Sun, 10 Dec 2006 22:17:15 +0000 Subject: * tree-vrp.c (adjust_range_with_scev): Use get_chrec_loop. * loop-unswitch.c (unswitch_loops): Use FOR_EACH_LOOP. * tree-loop-linear.c (linear_transform_loops): Ditto. * tree-ssa-loop-im.c (determine_lsm): Ditto. * tree-ssa-loop-niter.c (estimate_numbers_of_iterations, free_numbers_of_iterations_estimates): Ditto. * tree_ssa_unswitch_loops (tree_ssa_unswitch_loops): Ditto. * tree-ssa-loop-ch.c (copy_loop_headers): Ditto. * tree-ssa-loop-ivopts.c (tree_ssa_iv_optimize): Ditto. * modulo-sched.c (sms_schedule): Ditto. * tree-ssa-loop-ivcanon.c (canonicalize_induction_variables, tree_unroll_loops_completely): Ditto. * predict.c (predict_loops): Ditto. * tree-if-conv.c (main_tree_if_conversion): Ditto. * loop-unroll.c (unroll_and_peel_loops, peel_loops_completely, decide_unrolling_and_peeling): Ditto. * cfgloopmanip.c (unloop): Use delete_loop. (place_new_loop): Access larray vector instead of parray. (create_preheaders, force_single_succ_latches, fix_loop_structure): Use FOR_EACH_LOOP and delete_loop.. * loop-doloop.c (doloop_optimize_loops): Ditto. * loop-invariant.c (move_loop_invariants): Ditto. * tree-cfg.c (replace_uses_by): Ditto. * tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Ditto. * tree-chrec.h (CHREC_VAR, CHREC_LEFT, CHREC_RIGHT, CHREC_VARIABLE): Moved to ... * tree.h (CHREC_VAR, CHREC_LEFT, CHREC_RIGHT, CHREC_VARIABLE): ... here. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop, compute_overall_effect_of_inner_loop, chrec_is_positive): Use get_loop and get_chrec_loop. (number_of_iterations_for_all_loops): Use number_of_loops. (scev_initialize, scev_reset, scev_const_prop): Use FOR_EACH_LOOP. * tree-scalar-evolution.h (get_chrec_loop): New inline function. * cfgloopanal.c (mark_irreducible_loops): Use number_of_loops, and FOR_EACH_LOOP. * tree-chrec.c (evolution_function_is_invariant_rec_p, chrec_convert_1): Use get_loop and get_chrec_loop. * loop-init.c (loop_optimizer_init): Use number_of_loops. (loop_optimizer_init): Use FOR_EACH_LOOP. * tree-vectorizer.c (vect_loops_num): Removed. (vectorize_loops): Store number of loops locally. Use FOR_EACH_LOOP and get_loop. * tree-vectorizer.h (vect_loops_num): Removed. * tree-data-ref.c (get_number_of_iters_for_loop): Use get_loop. (find_data_references_in_loop): Do not set parallel_p. * tree-data-ref.h: Do not declare VEC(loop_p). * cfgloop.c (flow_loops_dump, mark_single_exit_loops, verify_loop_structure): Use FOR_EACH_LOOP. (flow_loops_free): Use FOR_EACH_LOOP, free larray vector. (initialize_loops_parallel_p): Removed. (flow_loops_find): Push the loops into a vector. (delete_loop): New function. (cancel_loop): Use delete_loop. * cfgloop.h: Declare VEC(loop_p). (struct loop): Remove parallel_p field. (struct loops): Replace num and parray field by larray vector. Remove shared_headers field. (delete_loop): Declare. (get_loop, get_loops, number_of_loops, fel_next, fel_init, FOR_EACH_LOOP): New. * doc/loop.tex: Document new accessor functions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119713 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-scalar-evolution.c | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) (limited to 'gcc/tree-scalar-evolution.c') diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index b882d458b88..c668bf22ddf 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -375,7 +375,7 @@ chrec_contains_symbols_defined_in_loop (tree chrec, unsigned loop_nb) { tree def = SSA_NAME_DEF_STMT (chrec); struct loop *def_loop = loop_containing_stmt (def); - struct loop *loop = current_loops->parray[loop_nb]; + struct loop *loop = get_loop (loop_nb); if (def_loop == NULL) return false; @@ -467,8 +467,7 @@ compute_overall_effect_of_inner_loop (struct loop *loop, tree evolution_fn) { if (CHREC_VARIABLE (evolution_fn) >= (unsigned) loop->num) { - struct loop *inner_loop = - current_loops->parray[CHREC_VARIABLE (evolution_fn)]; + struct loop *inner_loop = get_chrec_loop (evolution_fn); tree nb_iter = number_of_iterations_in_loop (inner_loop); if (nb_iter == chrec_dont_know) @@ -534,9 +533,7 @@ chrec_is_positive (tree chrec, bool *value) if (!evolution_function_is_affine_p (chrec)) return false; - nb_iter = number_of_iterations_in_loop - (current_loops->parray[CHREC_VARIABLE (chrec)]); - + nb_iter = number_of_iterations_in_loop (get_chrec_loop (chrec)); if (chrec_contains_undetermined (nb_iter)) return false; @@ -2530,7 +2527,7 @@ number_of_iterations_for_all_loops (VEC(tree,heap) **exit_conditions) fprintf (dump_file, "-----------------------------------------\n"); fprintf (dump_file, "%d\tnb_chrec_dont_know_loops\n", nb_chrec_dont_know_loops); fprintf (dump_file, "%d\tnb_static_loops\n", nb_static_loops); - fprintf (dump_file, "%d\tnb_total_loops\n", current_loops->num); + fprintf (dump_file, "%d\tnb_total_loops\n", number_of_loops ()); fprintf (dump_file, "-----------------------------------------\n"); fprintf (dump_file, ")\n\n"); @@ -2747,7 +2744,8 @@ initialize_scalar_evolutions_analyzer (void) void scev_initialize (void) { - unsigned i; + loop_iterator li; + struct loop *loop; scalar_evolution_info = htab_create (100, hash_scev_info, eq_scev_info, del_scev_info); @@ -2755,9 +2753,10 @@ scev_initialize (void) initialize_scalar_evolutions_analyzer (); - for (i = 1; i < current_loops->num; i++) - if (current_loops->parray[i]) - current_loops->parray[i]->nb_iterations = NULL_TREE; + FOR_EACH_LOOP (li, loop, 0) + { + loop->nb_iterations = NULL_TREE; + } } /* Cleans up the information cached by the scalar evolutions analysis. */ @@ -2765,18 +2764,16 @@ scev_initialize (void) void scev_reset (void) { - unsigned i; + loop_iterator li; struct loop *loop; if (!scalar_evolution_info || !current_loops) return; htab_empty (scalar_evolution_info); - for (i = 1; i < current_loops->num; i++) + FOR_EACH_LOOP (li, loop, 0) { - loop = current_loops->parray[i]; - if (loop) - loop->nb_iterations = NULL_TREE; + loop->nb_iterations = NULL_TREE; } } @@ -2890,6 +2887,7 @@ scev_const_prop (void) struct loop *loop, *ex_loop; bitmap ssa_names_to_remove = NULL; unsigned i; + loop_iterator li; if (!current_loops) return 0; @@ -2931,7 +2929,6 @@ scev_const_prop (void) if (ssa_names_to_remove) { bitmap_iterator bi; - unsigned i; EXECUTE_IF_SET_IN_BITMAP (ssa_names_to_remove, 0, i, bi) { @@ -2947,16 +2944,12 @@ scev_const_prop (void) } /* Now the regular final value replacement. */ - for (i = current_loops->num - 1; i > 0; i--) + FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST) { edge exit; tree def, rslt, ass, niter; block_stmt_iterator bsi; - loop = current_loops->parray[i]; - if (!loop) - continue; - /* If we do not know exact number of iterations of the loop, we cannot replace the final value. */ exit = single_exit (loop); -- cgit v1.2.1