diff options
author | Zdenek Dvorak <dvorakz@suse.cz> | 2006-12-10 23:17:15 +0100 |
---|---|---|
committer | Zdenek Dvorak <rakdver@gcc.gnu.org> | 2006-12-10 22:17:15 +0000 |
commit | 42fd6772c6c7b06d6c94854d0bf0a9360c8d261c (patch) | |
tree | 879533af06a5f9434bb047870e2878e104446c23 /gcc/cfgloopmanip.c | |
parent | 7290d709efbec4d872160fa274bf2128b55432eb (diff) | |
download | gcc-42fd6772c6c7b06d6c94854d0bf0a9360c8d261c.zip gcc-42fd6772c6c7b06d6c94854d0bf0a9360c8d261c.tar.gz gcc-42fd6772c6c7b06d6c94854d0bf0a9360c8d261c.tar.bz2 |
tree-vrp.c (adjust_range_with_scev): Use get_chrec_loop.
* 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.
From-SVN: r119713
Diffstat (limited to 'gcc/cfgloopmanip.c')
-rw-r--r-- | gcc/cfgloopmanip.c | 58 |
1 files changed, 15 insertions, 43 deletions
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c index 180a475..83d4e4c 100644 --- a/gcc/cfgloopmanip.c +++ b/gcc/cfgloopmanip.c @@ -552,9 +552,7 @@ unloop (struct loop *loop, bool *irred_invalidated) } /* Remove the loop and free its data. */ - flow_loop_tree_node_remove (loop); - current_loops->parray[loop->num] = NULL; - flow_loop_free (loop); + delete_loop (loop); remove_edge (single_succ_edge (latch)); @@ -634,11 +632,8 @@ fix_loop_placements (struct loop *loop, bool *irred_invalidated) static void place_new_loop (struct loop *loop) { - current_loops->parray = - xrealloc (current_loops->parray, (current_loops->num + 1) * sizeof (struct loop *)); - current_loops->parray[current_loops->num] = loop; - - loop->num = current_loops->num++; + loop->num = number_of_loops (); + VEC_safe_push (loop_p, heap, current_loops->larray, loop); } /* Copies copy of LOOP as subloop of TARGET loop, placing newly @@ -1195,9 +1190,11 @@ create_preheader (struct loop *loop, int flags) void create_preheaders (int flags) { - unsigned i; - for (i = 1; i < current_loops->num; i++) - create_preheader (current_loops->parray[i], flags); + loop_iterator li; + struct loop *loop; + + FOR_EACH_LOOP (li, loop, 0) + create_preheader (loop, flags); current_loops->state |= LOOPS_HAVE_PREHEADERS; } @@ -1206,13 +1203,12 @@ create_preheaders (int flags) void force_single_succ_latches (void) { - unsigned i; + loop_iterator li; struct loop *loop; edge e; - for (i = 1; i < current_loops->num; i++) + FOR_EACH_LOOP (li, loop, 0) { - loop = current_loops->parray[i]; if (loop->latch != loop->header && single_succ_p (loop->latch)) continue; @@ -1392,7 +1388,7 @@ fix_loop_structure (bitmap changed_bbs) { basic_block bb; struct loop *loop, *ploop; - unsigned i; + loop_iterator li; /* Remove the old bb -> loop mapping. */ FOR_EACH_BB (bb) @@ -1403,12 +1399,8 @@ fix_loop_structure (bitmap changed_bbs) /* Remove the dead loops from structures. */ current_loops->tree_root->num_nodes = n_basic_blocks; - for (i = 1; i < current_loops->num; i++) + FOR_EACH_LOOP (li, loop, 0) { - loop = current_loops->parray[i]; - if (!loop) - continue; - loop->num_nodes = 0; if (loop->header) continue; @@ -1421,38 +1413,18 @@ fix_loop_structure (bitmap changed_bbs) } /* Remove the loop and free its data. */ - flow_loop_tree_node_remove (loop); - current_loops->parray[loop->num] = NULL; - flow_loop_free (loop); + delete_loop (loop); } /* Rescan the bodies of loops, starting from the outermost. */ - loop = current_loops->tree_root; - while (1) + FOR_EACH_LOOP (li, loop, 0) { - if (loop->inner) - loop = loop->inner; - else - { - while (!loop->next - && loop != current_loops->tree_root) - loop = loop->outer; - if (loop == current_loops->tree_root) - break; - - loop = loop->next; - } - loop->num_nodes = flow_loop_nodes_find (loop->header, loop); } /* Now fix the loop nesting. */ - for (i = 1; i < current_loops->num; i++) + FOR_EACH_LOOP (li, loop, 0) { - loop = current_loops->parray[i]; - if (!loop) - continue; - bb = loop_preheader_edge (loop)->src; if (bb->loop_father != loop->outer) { |