From 9e3536f4f240488c76048b53b25f9343e46d9bf5 Mon Sep 17 00:00:00 2001 From: rakdver Date: Fri, 11 May 2007 15:52:01 +0000 Subject: * tree-loop-linear.c (gather_interchange_stats, try_interchange_loops): Use loop_depth and loop_outer accessor functions. * tree-ssa-loop-im.c (outermost_invariant_loop, set_level, determine_invariantness_stmt, move_computations_stmt): Ditto. * cfgloopmanip.c (fix_bb_placement, fix_loop_placement, remove_path, add_loop, loopify, unloop, fix_loop_structure): Ditto. * tree-ssa-loop-manip.c (find_uses_to_rename_use): Ditto. * tree-scalar-evolution.c (interpret_loop_phi, compute_scalar_evolution_in_loop, analyze_scalar_evolution_in_loop, instantiate_parameters_1, scev_const_prop): Ditto. * cfghooks.c (make_forwarder_block): Ditto. * cfgloopanal.c (mark_irreducible_loops, mark_loop_exit_edges): Ditto. * modulo-sched.c (loop_canon_p): Ditto. * tree-vectorizer.c (slpeel_tree_duplicate_loop_to_edge_cfg, slpeel_can_duplicate_loop_p): Ditto. * lambda-code.c (invariant_in_loop_and_outer_loops): Ditto. * tree-cfg.c (tree_duplicate_sese_region): Ditto. * cfgloop.c (flow_loop_dump, flow_loop_nodes_find, rescan_loop_exit, cancel_loop, verify_loop_structure): Ditto. (flow_loop_nested_p, superloop_at_depth, flow_loop_free, add_bb_to_loop, remove_bb_from_loops, find_common_loop): Use the superloops vector instead of "pred" array. (establish_preds): Take father loop as an argument. Initialize the superloops vector. (flow_loop_tree_node_add): Pass father loop to establish_preds. Do not initialize loop->outer. (flow_loop_tree_node_remove): Truncate the superloops vector. * cfgloop.h (struct loop): Removed field "outer", fields "depth" and "pred" merged to "superloops" vector. (loop_depth, loop_outer): New. (fel_init): Use loop_outer. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124619 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cfgloop.h | 46 +++++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 15 deletions(-) (limited to 'gcc/cfgloop.h') diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h index ef70a71c981..4c33c9cc056 100644 --- a/gcc/cfgloop.h +++ b/gcc/cfgloop.h @@ -85,6 +85,10 @@ struct loop_exit struct loop_exit *next_e; }; +typedef struct loop *loop_p; +DEF_VEC_P (loop_p); +DEF_VEC_ALLOC_P (loop_p, heap); + /* Structure to hold information for each natural loop. */ struct loop { @@ -109,14 +113,8 @@ struct loop /* Number of blocks contained within the loop. */ unsigned num_nodes; - /* The loop nesting depth. */ - int depth; - - /* Superloops of the loop. */ - struct loop **pred; - - /* The outer (parent) loop or NULL if outermost loop. */ - struct loop *outer; + /* Superloops of the loop, starting with the outermost loop. */ + VEC (loop_p, heap) *superloops; /* The first inner (child) loop or NULL if innermost loop. */ struct loop *inner; @@ -178,10 +176,6 @@ enum | LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS) #define AVOID_CFG_MODIFICATIONS (LOOPS_MAY_HAVE_MULTIPLE_LATCHES) -typedef struct loop *loop_p; -DEF_VEC_P (loop_p); -DEF_VEC_ALLOC_P (loop_p, heap); - /* Structure to hold CFG information about natural loops within a function. */ struct loops { @@ -410,6 +404,28 @@ get_loop (unsigned num) return VEC_index (loop_p, current_loops->larray, num); } +/* Returns the number of superloops of LOOP. */ + +static inline unsigned +loop_depth (const struct loop *loop) +{ + return VEC_length (loop_p, loop->superloops); +} + +/* Returns the immediate superloop of LOOP, or NULL if LOOP is the outermost + loop. */ + +static inline struct loop * +loop_outer (const struct loop *loop) +{ + unsigned n = VEC_length (loop_p, loop->superloops); + + if (n == 0) + return NULL; + + return VEC_index (loop_p, loop->superloops, n - 1); +} + /* Returns the list of loops in current_loops. */ static inline VEC (loop_p, heap) * @@ -519,10 +535,10 @@ fel_init (loop_iterator *li, loop_p *loop, unsigned flags) aloop = aloop->inner) continue; } - else if (!aloop->outer) + else if (!loop_outer (aloop)) break; else - aloop = aloop->outer; + aloop = loop_outer (aloop); } } else @@ -539,7 +555,7 @@ fel_init (loop_iterator *li, loop_p *loop, unsigned flags) else { while (aloop != NULL && aloop->next == NULL) - aloop = aloop->outer; + aloop = loop_outer (aloop); if (aloop == NULL) break; aloop = aloop->next; -- cgit v1.2.1