This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Avoid fn->x_current_loops references
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 29 Apr 2013 15:12:28 +0200 (CEST)
- Subject: [PATCH] Avoid fn->x_current_loops references
This avoids references to fn->x_current_loops by adding
loops_for_fn () and fn parameters to the toplevel cfgloop.h API.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
Richard.
2013-04-29 Richard Biener <rguenther@suse.de>
* function.h (loops_for_fn): New inline function.
(set_loops_for_fn): Likewise.
* cfgloop.h (place_new_loop): Add struct function parameter.
(get_loop): Likewise.
(get_loops): Likewise.
(number_of_loops): Likewise.
(fel_next): Adjust.
(fel_init): Likewise.
* cfg.c (get_loop_copy): Adjust.
* cfgloop.c (flow_loops_dump): Likewise.
(record_loop_exits): Likewise.
(verify_loop_structure): Likewise.
* cfgloopanal.c (mark_irreducible_loops): Likewise.
(estimate_reg_pressure_cost): Likewise.
(mark_loop_exit_edges): Likewise.
* cfgloopmanip.c (place_new_loop): Likewise.
(add_loop): Likewise.
(duplicate_loop): Likewise.
* graph.c (draw_cfg_nodes): Likewise.
* graphite-clast-to-gimple.c (translate_clast_user): Likewise.
* graphite-sese-to-poly.c (build_scop_scattering): Likewise.
(extract_affine_chrec): Likewise.
(build_scop_iteration_domain): Likewise.
* graphite.c (graphite_initialize): Likewise.
* ira-build.c (create_loop_tree_nodes): Likewise.
(more_one_region_p): Likewise.
(rebuild_regno_allocno_maps): Likewise.
(mark_loops_for_removal): Likewise.
(mark_all_loops_for_removal): Likewise.
(remove_unnecessary_regions): Likewise.
(ira_build): Likewise.
* ira-emit.c (setup_entered_from_non_parent_p): Likewise.
* loop-init.c (fix_loop_structure): Likewise.
(gate_rtl_move_loop_invariants): Likewise.
(gate_rtl_unswitch): Likewise.
(gate_rtl_unroll_and_peel_loops): Likewise.
(rtl_doloop): Likewise.
* lto-streamer-in.c (input_cfg): Likewise.
* lto-streamer-out.c (output_cfg): Likewise.
* modulo-sched.c (sms_schedule): Likewise.
* predict.c (tree_estimate_probability): Likewise.
(tree_estimate_probability_driver): Likewise.
(estimate_loops): Likewise.
* tree-cfg.c (fixup_loop_arrays_after_move): Likewise.
(move_sese_region_to_fn): Likewise.
(debug_loop_num): Likewise.
* tree-chrec.c (chrec_evaluate): Likewise.
(hide_evolution_in_other_loops_than_loop): Likewise.
(chrec_component_in_loop_num): Likewise.
(reset_evolution_in_loop): Likewise.
(evolution_function_is_invariant_rec_p): Likewise.
* tree-if-conv.c (main_tree_if_conversion): Likewise.
* tree-inline.c (copy_loops): Likewise.
(copy_cfg_body): Likewise.
(tree_function_versioning): Likewise.
* tree-loop-distribution.c (rdg_flag_loop_exits): Likewise.
* tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop):
Likewise.
(add_to_evolution_1): Likewise.
(scev_const_prop): Likewise.
* tree-scalar-evolution.h (get_chrec_loop): Likewise.
* tree-ssa-loop-ch.c (copy_loop_headers): Likewise.
* tree-ssa-loop-im.c (analyze_memory_references): Likewise.
(tree_ssa_lim_initialize): Likewise.
* tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa): Likewise.
(verify_loop_closed_ssa): Likewise.
* tree-ssa-loop.c (tree_ssa_loop_init): Likewise.
(tree_ssa_loop_im): Likewise.
(tree_ssa_loop_unswitch): Likewise.
(tree_vectorize): Likewise.
(check_data_deps): Likewise.
(tree_ssa_loop_ivcanon): Likewise.
(tree_ssa_loop_bounds): Likewise.
(tree_complete_unroll): Likewise.
(tree_complete_unroll_inner): Likewise.
(tree_parallelize_loops): Likewise.
(tree_ssa_loop_prefetch): Likewise.
(tree_ssa_loop_ivopts): Likewise.
* tree-ssa.c (execute_update_addresses_taken): Liekwise.
* tree-vectorizer.c (vectorize_loops): Likewise.
Index: trunk/gcc/cfg.c
===================================================================
*** trunk.orig/gcc/cfg.c 2013-04-09 10:27:24.000000000 +0200
--- trunk/gcc/cfg.c 2013-04-29 12:40:26.147618014 +0200
*************** get_loop_copy (struct loop *loop)
*** 1180,1186 ****
key.index1 = loop->num;
entry = loop_copy.find (&key);
if (entry)
! return get_loop (entry->index2);
else
return NULL;
}
--- 1180,1186 ----
key.index1 = loop->num;
entry = loop_copy.find (&key);
if (entry)
! return get_loop (cfun, entry->index2);
else
return NULL;
}
Index: trunk/gcc/cfgloop.c
===================================================================
*** trunk.orig/gcc/cfgloop.c 2013-04-26 13:13:49.000000000 +0200
--- trunk/gcc/cfgloop.c 2013-04-29 12:27:50.494130367 +0200
*************** flow_loops_dump (FILE *file, void (*loop
*** 160,166 ****
if (!current_loops || ! file)
return;
! fprintf (file, ";; %d loops found\n", number_of_loops ());
FOR_EACH_LOOP (li, loop, LI_INCLUDE_ROOT)
{
--- 160,166 ----
if (!current_loops || ! file)
return;
! fprintf (file, ";; %d loops found\n", number_of_loops (cfun));
FOR_EACH_LOOP (li, loop, LI_INCLUDE_ROOT)
{
*************** record_loop_exits (void)
*** 1077,1083 ****
loops_state_set (LOOPS_HAVE_RECORDED_EXITS);
gcc_assert (current_loops->exits == NULL);
! current_loops->exits = htab_create_ggc (2 * number_of_loops (),
loop_exit_hash, loop_exit_eq,
loop_exit_free);
--- 1077,1083 ----
loops_state_set (LOOPS_HAVE_RECORDED_EXITS);
gcc_assert (current_loops->exits == NULL);
! current_loops->exits = htab_create_ggc (2 * number_of_loops (cfun),
loop_exit_hash, loop_exit_eq,
loop_exit_free);
*************** verify_loop_structure (void)
*** 1324,1330 ****
struct loop *loop;
int err = 0;
edge e;
! unsigned num = number_of_loops ();
loop_iterator li;
struct loop_exit *exit, *mexit;
bool dom_available = dom_info_available_p (CDI_DOMINATORS);
--- 1324,1330 ----
struct loop *loop;
int err = 0;
edge e;
! unsigned num = number_of_loops (cfun);
loop_iterator li;
struct loop_exit *exit, *mexit;
bool dom_available = dom_info_available_p (CDI_DOMINATORS);
Index: trunk/gcc/cfgloop.h
===================================================================
*** trunk.orig/gcc/cfgloop.h 2013-04-26 13:13:49.000000000 +0200
--- trunk/gcc/cfgloop.h 2013-04-29 12:40:05.113381876 +0200
*************** void rescan_loop_exit (edge, bool, bool)
*** 234,240 ****
/* Loop data structure manipulation/querying. */
extern void flow_loop_tree_node_add (struct loop *, struct loop *);
extern void flow_loop_tree_node_remove (struct loop *);
! extern void place_new_loop (struct loop *);
extern void add_loop (struct loop *, struct loop *);
extern bool flow_loop_nested_p (const struct loop *, const struct loop *);
extern bool flow_bb_inside_loop_p (const struct loop *, const_basic_block);
--- 234,240 ----
/* Loop data structure manipulation/querying. */
extern void flow_loop_tree_node_add (struct loop *, struct loop *);
extern void flow_loop_tree_node_remove (struct loop *);
! extern void place_new_loop (struct function *, struct loop *);
extern void add_loop (struct loop *, struct loop *);
extern bool flow_loop_nested_p (const struct loop *, const struct loop *);
extern bool flow_bb_inside_loop_p (const struct loop *, const_basic_block);
*************** simple_loop_desc (struct loop *loop)
*** 436,447 ****
/* Accessors for the loop structures. */
! /* Returns the loop with index NUM from current_loops. */
static inline struct loop *
! get_loop (unsigned num)
{
! return (*current_loops->larray)[num];
}
/* Returns the number of superloops of LOOP. */
--- 436,447 ----
/* Accessors for the loop structures. */
! /* Returns the loop with index NUM from FNs loop tree. */
static inline struct loop *
! get_loop (struct function *fn, unsigned num)
{
! return (*loops_for_fn (fn)->larray)[num];
}
/* Returns the number of superloops of LOOP. */
*************** loop_has_exit_edges (const struct loop *
*** 482,508 ****
return loop->exits->next->e != NULL;
}
! /* Returns the list of loops in current_loops. */
! static inline vec<loop_p, va_gc> *
! get_loops (void)
{
! if (!current_loops)
return NULL;
! return current_loops->larray;
}
! /* Returns the number of loops in current_loops (including the removed
ones and the fake loop that forms the root of the loop tree). */
static inline unsigned
! number_of_loops (void)
{
! if (!current_loops)
return 0;
! return vec_safe_length (current_loops->larray);
}
/* Returns true if state of the loops satisfies all properties
--- 482,510 ----
return loop->exits->next->e != NULL;
}
! /* Returns the list of loops in FN. */
! inline vec<loop_p, va_gc> *
! get_loops (struct function *fn)
{
! struct loops *loops = loops_for_fn (fn);
! if (!loops)
return NULL;
! return loops->larray;
}
! /* Returns the number of loops in FN (including the removed
ones and the fake loop that forms the root of the loop tree). */
static inline unsigned
! number_of_loops (struct function *fn)
{
! struct loops *loops = loops_for_fn (fn);
! if (!fn)
return 0;
! return vec_safe_length (loops->larray);
}
/* Returns true if state of the loops satisfies all properties
*************** fel_next (loop_iterator *li, loop_p *loo
*** 563,569 ****
while (li->to_visit.iterate (li->idx, &anum))
{
li->idx++;
! *loop = get_loop (anum);
if (*loop)
return;
}
--- 565,571 ----
while (li->to_visit.iterate (li->idx, &anum))
{
li->idx++;
! *loop = get_loop (cfun, anum);
if (*loop)
return;
}
*************** fel_init (loop_iterator *li, loop_p *loo
*** 587,593 ****
return;
}
! li->to_visit.create (number_of_loops ());
mn = (flags & LI_INCLUDE_ROOT) ? 0 : 1;
if (flags & LI_ONLY_INNERMOST)
--- 589,595 ----
return;
}
! li->to_visit.create (number_of_loops (cfun));
mn = (flags & LI_INCLUDE_ROOT) ? 0 : 1;
if (flags & LI_ONLY_INNERMOST)
Index: trunk/gcc/cfgloopanal.c
===================================================================
*** trunk.orig/gcc/cfgloopanal.c 2013-01-11 10:54:30.000000000 +0100
--- trunk/gcc/cfgloopanal.c 2013-04-29 12:27:20.081788566 +0200
*************** mark_irreducible_loops (void)
*** 77,83 ****
int src, dest;
unsigned depth;
struct graph *g;
! int num = number_of_loops ();
struct loop *cloop;
bool irred_loop_found = false;
int i;
--- 77,83 ----
int src, dest;
unsigned depth;
struct graph *g;
! int num = number_of_loops (cfun);
struct loop *cloop;
bool irred_loop_found = false;
int i;
*************** estimate_reg_pressure_cost (unsigned n_n
*** 409,415 ****
if (optimize && (flag_ira_region == IRA_REGION_ALL
|| flag_ira_region == IRA_REGION_MIXED)
! && number_of_loops () <= (unsigned) IRA_MAX_LOOPS_NUM)
/* IRA regional allocation deals with high register pressure
better. So decrease the cost (to do more accurate the cost
calculation for IRA, we need to know how many registers lives
--- 409,415 ----
if (optimize && (flag_ira_region == IRA_REGION_ALL
|| flag_ira_region == IRA_REGION_MIXED)
! && number_of_loops (cfun) <= (unsigned) IRA_MAX_LOOPS_NUM)
/* IRA regional allocation deals with high register pressure
better. So decrease the cost (to do more accurate the cost
calculation for IRA, we need to know how many registers lives
*************** mark_loop_exit_edges (void)
*** 427,433 ****
basic_block bb;
edge e;
! if (number_of_loops () <= 1)
return;
FOR_EACH_BB (bb)
--- 427,433 ----
basic_block bb;
edge e;
! if (number_of_loops (cfun) <= 1)
return;
FOR_EACH_BB (bb)
Index: trunk/gcc/cfgloopmanip.c
===================================================================
*** trunk.orig/gcc/cfgloopmanip.c 2013-04-26 10:01:44.000000000 +0200
--- trunk/gcc/cfgloopmanip.c 2013-04-29 12:34:40.112732441 +0200
*************** remove_path (edge e)
*** 408,420 ****
return true;
}
! /* Creates place for a new LOOP in loops structure. */
void
! place_new_loop (struct loop *loop)
{
! loop->num = number_of_loops ();
! vec_safe_push (current_loops->larray, loop);
}
/* Given LOOP structure with filled header and latch, find the body of the
--- 408,420 ----
return true;
}
! /* Creates place for a new LOOP in loops structure of FN. */
void
! place_new_loop (struct function *fn, struct loop *loop)
{
! loop->num = number_of_loops (fn);
! vec_safe_push (loops_for_fn (fn)->larray, loop);
}
/* Given LOOP structure with filled header and latch, find the body of the
*************** add_loop (struct loop *loop, struct loop
*** 431,437 ****
edge_iterator ei;
/* Add it to loop structure. */
! place_new_loop (loop);
flow_loop_tree_node_add (outer, loop);
/* Find its nodes. */
--- 431,437 ----
edge_iterator ei;
/* Add it to loop structure. */
! place_new_loop (cfun, loop);
flow_loop_tree_node_add (outer, loop);
/* Find its nodes. */
*************** duplicate_loop (struct loop *loop, struc
*** 1010,1016 ****
{
struct loop *cloop;
cloop = alloc_loop ();
! place_new_loop (cloop);
copy_loop_info (loop, cloop);
--- 1010,1016 ----
{
struct loop *cloop;
cloop = alloc_loop ();
! place_new_loop (cfun, cloop);
copy_loop_info (loop, cloop);
Index: trunk/gcc/function.h
===================================================================
*** trunk.orig/gcc/function.h 2013-03-11 11:00:39.000000000 +0100
--- trunk/gcc/function.h 2013-04-29 12:16:13.688303471 +0200
*************** extern void push_cfun (struct function *
*** 700,705 ****
--- 700,722 ----
extern void pop_cfun (void);
extern void instantiate_decl_rtl (rtx x);
+ /* Return the loop tree of FN. */
+
+ inline struct loops *
+ loops_for_fn (struct function *fn)
+ {
+ return fn->x_current_loops;
+ }
+
+ /* Set the loop tree of FN to LOOPS. */
+
+ inline void
+ set_loops_for_fn (struct function *fn, struct loops *loops)
+ {
+ gcc_checking_assert (fn->x_current_loops == NULL || loops == NULL);
+ fn->x_current_loops = loops;
+ }
+
/* For backward compatibility... eventually these should all go away. */
#define current_function_funcdef_no (cfun->funcdef_no)
Index: trunk/gcc/graph.c
===================================================================
*** trunk.orig/gcc/graph.c 2013-04-23 10:20:02.000000000 +0200
--- trunk/gcc/graph.c 2013-04-29 12:51:11.804863331 +0200
*************** draw_cfg_nodes_for_loop (pretty_printer
*** 258,267 ****
static void
draw_cfg_nodes (pretty_printer *pp, struct function *fun)
{
! /* ??? This x_current_loops should be enapsulated. */
! if (fun->x_current_loops)
! draw_cfg_nodes_for_loop (pp, fun->funcdef_no,
! fun->x_current_loops->tree_root);
else
draw_cfg_nodes_no_loops (pp, fun);
}
--- 258,265 ----
static void
draw_cfg_nodes (pretty_printer *pp, struct function *fun)
{
! if (loops_for_fn (fun))
! draw_cfg_nodes_for_loop (pp, fun->funcdef_no, get_loop (fun, 0));
else
draw_cfg_nodes_no_loops (pp, fun);
}
Index: trunk/gcc/graphite-clast-to-gimple.c
===================================================================
*** trunk.orig/gcc/graphite-clast-to-gimple.c 2013-04-26 09:55:32.000000000 +0200
--- trunk/gcc/graphite-clast-to-gimple.c 2013-04-29 12:35:26.424252576 +0200
*************** translate_clast_user (struct clast_user_
*** 1094,1100 ****
if (GBB_BB (gbb) == ENTRY_BLOCK_PTR)
return next_e;
! nb_loops = number_of_loops ();
iv_map.create (nb_loops);
for (i = 0; i < nb_loops; i++)
iv_map.quick_push (NULL_TREE);
--- 1094,1100 ----
if (GBB_BB (gbb) == ENTRY_BLOCK_PTR)
return next_e;
! nb_loops = number_of_loops (cfun);
iv_map.create (nb_loops);
for (i = 0; i < nb_loops; i++)
iv_map.quick_push (NULL_TREE);
Index: trunk/gcc/graphite-sese-to-poly.c
===================================================================
*** trunk.orig/gcc/graphite-sese-to-poly.c 2013-01-14 12:25:59.000000000 +0100
--- trunk/gcc/graphite-sese-to-poly.c 2013-04-29 12:41:52.221584243 +0200
*************** build_scop_scattering (scop_p scop)
*** 550,556 ****
isl_space *dc = isl_set_get_space (scop->context);
isl_aff *static_sched;
! dc = isl_space_add_dims (dc, isl_dim_set, number_of_loops());
static_sched = isl_aff_zero_on_domain (isl_local_space_from_space (dc));
/* We have to start schedules at 0 on the first component and
--- 550,556 ----
isl_space *dc = isl_set_get_space (scop->context);
isl_aff *static_sched;
! dc = isl_space_add_dims (dc, isl_dim_set, number_of_loops (cfun));
static_sched = isl_aff_zero_on_domain (isl_local_space_from_space (dc));
/* We have to start schedules at 0 on the first component and
*************** extract_affine_chrec (scop_p s, tree e,
*** 590,597 ****
isl_pw_aff *lhs = extract_affine (s, CHREC_LEFT (e), isl_space_copy (space));
isl_pw_aff *rhs = extract_affine (s, CHREC_RIGHT (e), isl_space_copy (space));
isl_local_space *ls = isl_local_space_from_space (space);
! unsigned pos = sese_loop_depth ((sese) s->region,
! get_loop (CHREC_VARIABLE (e))) - 1;
isl_aff *loop = isl_aff_set_coefficient_si
(isl_aff_zero_on_domain (ls), isl_dim_in, pos, 1);
isl_pw_aff *l = isl_pw_aff_from_aff (loop);
--- 590,596 ----
isl_pw_aff *lhs = extract_affine (s, CHREC_LEFT (e), isl_space_copy (space));
isl_pw_aff *rhs = extract_affine (s, CHREC_RIGHT (e), isl_space_copy (space));
isl_local_space *ls = isl_local_space_from_space (space);
! unsigned pos = sese_loop_depth ((sese) s->region, get_chrec_loop (e)) - 1;
isl_aff *loop = isl_aff_set_coefficient_si
(isl_aff_zero_on_domain (ls), isl_dim_in, pos, 1);
isl_pw_aff *l = isl_pw_aff_from_aff (loop);
*************** build_scop_iteration_domain (scop_p scop
*** 1404,1410 ****
sese region = SCOP_REGION (scop);
int i;
poly_bb_p pbb;
! int nb_loops = number_of_loops ();
isl_set **doms = XCNEWVEC (isl_set *, nb_loops);
FOR_EACH_VEC_ELT (SESE_LOOP_NEST (region), i, loop)
--- 1403,1409 ----
sese region = SCOP_REGION (scop);
int i;
poly_bb_p pbb;
! int nb_loops = number_of_loops (cfun);
isl_set **doms = XCNEWVEC (isl_set *, nb_loops);
FOR_EACH_VEC_ELT (SESE_LOOP_NEST (region), i, loop)
Index: trunk/gcc/graphite.c
===================================================================
*** trunk.orig/gcc/graphite.c 2013-04-26 09:55:32.000000000 +0200
--- trunk/gcc/graphite.c 2013-04-29 12:35:06.208025526 +0200
*************** print_graphite_statistics (FILE* file, v
*** 198,204 ****
static bool
graphite_initialize (isl_ctx *ctx)
{
! if (number_of_loops () <= 1
/* FIXME: This limit on the number of basic blocks of a function
should be removed when the SCOP detection is faster. */
|| n_basic_blocks > PARAM_VALUE (PARAM_GRAPHITE_MAX_BBS_PER_FUNCTION))
--- 198,204 ----
static bool
graphite_initialize (isl_ctx *ctx)
{
! if (number_of_loops (cfun) <= 1
/* FIXME: This limit on the number of basic blocks of a function
should be removed when the SCOP detection is faster. */
|| n_basic_blocks > PARAM_VALUE (PARAM_GRAPHITE_MAX_BBS_PER_FUNCTION))
Index: trunk/gcc/ira-build.c
===================================================================
*** trunk.orig/gcc/ira-build.c 2013-04-25 16:11:44.000000000 +0200
--- trunk/gcc/ira-build.c 2013-04-29 12:36:43.479117918 +0200
*************** create_loop_tree_nodes (void)
*** 151,161 ****
init_loop_tree_node (ira_loop_nodes, 0);
return;
}
! ira_loop_nodes_count = number_of_loops ();
ira_loop_nodes = ((struct ira_loop_tree_node *)
ira_allocate (sizeof (struct ira_loop_tree_node)
* ira_loop_nodes_count));
! FOR_EACH_VEC_SAFE_ELT (get_loops (), i, loop)
{
if (loop_outer (loop) != NULL)
{
--- 151,161 ----
init_loop_tree_node (ira_loop_nodes, 0);
return;
}
! ira_loop_nodes_count = number_of_loops (cfun);
ira_loop_nodes = ((struct ira_loop_tree_node *)
ira_allocate (sizeof (struct ira_loop_tree_node)
* ira_loop_nodes_count));
! FOR_EACH_VEC_SAFE_ELT (get_loops (cfun), i, loop)
{
if (loop_outer (loop) != NULL)
{
*************** more_one_region_p (void)
*** 194,200 ****
loop_p loop;
if (current_loops != NULL)
! FOR_EACH_VEC_SAFE_ELT (get_loops (), i, loop)
if (ira_loop_nodes[i].regno_allocno_map != NULL
&& ira_loop_tree_root != &ira_loop_nodes[i])
return true;
--- 194,200 ----
loop_p loop;
if (current_loops != NULL)
! FOR_EACH_VEC_SAFE_ELT (get_loops (cfun), i, loop)
if (ira_loop_nodes[i].regno_allocno_map != NULL
&& ira_loop_tree_root != &ira_loop_nodes[i])
return true;
*************** rebuild_regno_allocno_maps (void)
*** 379,385 ****
ira_assert (current_loops != NULL);
max_regno = max_reg_num ();
! FOR_EACH_VEC_SAFE_ELT (get_loops (), l, loop)
if (ira_loop_nodes[l].regno_allocno_map != NULL)
{
ira_free (ira_loop_nodes[l].regno_allocno_map);
--- 379,385 ----
ira_assert (current_loops != NULL);
max_regno = max_reg_num ();
! FOR_EACH_VEC_SAFE_ELT (get_loops (cfun), l, loop)
if (ira_loop_nodes[l].regno_allocno_map != NULL)
{
ira_free (ira_loop_nodes[l].regno_allocno_map);
*************** mark_loops_for_removal (void)
*** 2053,2060 ****
ira_assert (current_loops != NULL);
sorted_loops
= (ira_loop_tree_node_t *) ira_allocate (sizeof (ira_loop_tree_node_t)
! * number_of_loops ());
! for (n = i = 0; vec_safe_iterate (get_loops (), i, &loop); i++)
if (ira_loop_nodes[i].regno_allocno_map != NULL)
{
if (ira_loop_nodes[i].parent == NULL)
--- 2053,2060 ----
ira_assert (current_loops != NULL);
sorted_loops
= (ira_loop_tree_node_t *) ira_allocate (sizeof (ira_loop_tree_node_t)
! * number_of_loops (cfun));
! for (n = i = 0; vec_safe_iterate (get_loops (cfun), i, &loop); i++)
if (ira_loop_nodes[i].regno_allocno_map != NULL)
{
if (ira_loop_nodes[i].parent == NULL)
*************** mark_all_loops_for_removal (void)
*** 2098,2104 ****
loop_p loop;
ira_assert (current_loops != NULL);
! FOR_EACH_VEC_SAFE_ELT (get_loops (), i, loop)
if (ira_loop_nodes[i].regno_allocno_map != NULL)
{
if (ira_loop_nodes[i].parent == NULL)
--- 2098,2104 ----
loop_p loop;
ira_assert (current_loops != NULL);
! FOR_EACH_VEC_SAFE_ELT (get_loops (cfun), i, loop)
if (ira_loop_nodes[i].regno_allocno_map != NULL)
{
if (ira_loop_nodes[i].parent == NULL)
*************** remove_unnecessary_regions (bool all_p)
*** 2408,2415 ****
mark_all_loops_for_removal ();
else
mark_loops_for_removal ();
! children_vec.create(last_basic_block + number_of_loops ());
! removed_loop_vec.create(last_basic_block + number_of_loops ());
remove_uneccesary_loop_nodes_from_loop_tree (ira_loop_tree_root);
children_vec.release ();
if (all_p)
--- 2408,2415 ----
mark_all_loops_for_removal ();
else
mark_loops_for_removal ();
! children_vec.create(last_basic_block + number_of_loops (cfun));
! removed_loop_vec.create(last_basic_block + number_of_loops (cfun));
remove_uneccesary_loop_nodes_from_loop_tree (ira_loop_tree_root);
children_vec.release ();
if (all_p)
*************** ira_build (void)
*** 3290,3296 ****
}
}
fprintf (ira_dump_file, " regions=%d, blocks=%d, points=%d\n",
! current_loops == NULL ? 1 : number_of_loops (),
n_basic_blocks, ira_max_point);
fprintf (ira_dump_file,
" allocnos=%d (big %d), copies=%d, conflicts=%d, ranges=%d\n",
--- 3290,3296 ----
}
}
fprintf (ira_dump_file, " regions=%d, blocks=%d, points=%d\n",
! current_loops == NULL ? 1 : number_of_loops (cfun),
n_basic_blocks, ira_max_point);
fprintf (ira_dump_file,
" allocnos=%d (big %d), copies=%d, conflicts=%d, ranges=%d\n",
Index: trunk/gcc/ira-emit.c
===================================================================
*** trunk.orig/gcc/ira-emit.c 2013-02-08 10:09:57.000000000 +0100
--- trunk/gcc/ira-emit.c 2013-04-29 12:36:57.325273404 +0200
*************** setup_entered_from_non_parent_p (void)
*** 434,440 ****
loop_p loop;
ira_assert (current_loops != NULL);
! FOR_EACH_VEC_SAFE_ELT (get_loops (), i, loop)
if (ira_loop_nodes[i].regno_allocno_map != NULL)
ira_loop_nodes[i].entered_from_non_parent_p
= entered_from_non_parent_p (&ira_loop_nodes[i]);
--- 434,440 ----
loop_p loop;
ira_assert (current_loops != NULL);
! FOR_EACH_VEC_SAFE_ELT (get_loops (cfun), i, loop)
if (ira_loop_nodes[i].regno_allocno_map != NULL)
ira_loop_nodes[i].entered_from_non_parent_p
= entered_from_non_parent_p (&ira_loop_nodes[i]);
Index: trunk/gcc/loop-init.c
===================================================================
*** trunk.orig/gcc/loop-init.c 2013-04-26 14:04:57.000000000 +0200
--- trunk/gcc/loop-init.c 2013-04-29 12:38:12.788120761 +0200
*************** fix_loop_structure (bitmap changed_bbs)
*** 248,254 ****
/* Remember the number of loops so we can return how many new loops
flow_loops_find discovered. */
! old_nloops = number_of_loops ();
/* Re-compute loop structure in-place. */
flow_loops_find (current_loops);
--- 248,254 ----
/* Remember the number of loops so we can return how many new loops
flow_loops_find discovered. */
! old_nloops = number_of_loops (cfun);
/* Re-compute loop structure in-place. */
flow_loops_find (current_loops);
*************** fix_loop_structure (bitmap changed_bbs)
*** 266,275 ****
}
/* Finally free deleted loops. */
! FOR_EACH_VEC_ELT (*get_loops (), i, loop)
if (loop && loop->header == NULL)
{
! (*get_loops ())[i] = NULL;
flow_loop_free (loop);
}
--- 266,275 ----
}
/* Finally free deleted loops. */
! FOR_EACH_VEC_ELT (*get_loops (cfun), i, loop)
if (loop && loop->header == NULL)
{
! (*get_loops (cfun))[i] = NULL;
flow_loop_free (loop);
}
*************** fix_loop_structure (bitmap changed_bbs)
*** 284,290 ****
timevar_pop (TV_LOOP_INIT);
! return number_of_loops () - old_nloops;
}
/* Gate for the RTL loop superpass. The actual passes are subpasses.
--- 284,290 ----
timevar_pop (TV_LOOP_INIT);
! return number_of_loops (cfun) - old_nloops;
}
/* Gate for the RTL loop superpass. The actual passes are subpasses.
*************** gate_rtl_move_loop_invariants (void)
*** 423,429 ****
static unsigned int
rtl_move_loop_invariants (void)
{
! if (number_of_loops () > 1)
move_loop_invariants ();
return 0;
}
--- 423,429 ----
static unsigned int
rtl_move_loop_invariants (void)
{
! if (number_of_loops (cfun) > 1)
move_loop_invariants ();
return 0;
}
*************** gate_rtl_unswitch (void)
*** 460,466 ****
static unsigned int
rtl_unswitch (void)
{
! if (number_of_loops () > 1)
unswitch_loops ();
return 0;
}
--- 460,466 ----
static unsigned int
rtl_unswitch (void)
{
! if (number_of_loops (cfun) > 1)
unswitch_loops ();
return 0;
}
*************** gate_rtl_unroll_and_peel_loops (void)
*** 496,502 ****
static unsigned int
rtl_unroll_and_peel_loops (void)
{
! if (number_of_loops () > 1)
{
int flags = 0;
if (dump_file)
--- 496,502 ----
static unsigned int
rtl_unroll_and_peel_loops (void)
{
! if (number_of_loops (cfun) > 1)
{
int flags = 0;
if (dump_file)
*************** static unsigned int
*** 550,556 ****
rtl_doloop (void)
{
#ifdef HAVE_doloop_end
! if (number_of_loops () > 1)
doloop_optimize_loops ();
#endif
return 0;
--- 550,556 ----
rtl_doloop (void)
{
#ifdef HAVE_doloop_end
! if (number_of_loops (cfun) > 1)
doloop_optimize_loops ();
#endif
return 0;
Index: trunk/gcc/lto-streamer-in.c
===================================================================
*** trunk.orig/gcc/lto-streamer-in.c 2013-04-26 13:13:49.000000000 +0200
--- trunk/gcc/lto-streamer-in.c 2013-04-29 12:32:24.833212887 +0200
*************** input_cfg (struct lto_input_block *ib, s
*** 686,692 ****
}
struct loop *loop = alloc_loop ();
- loop->num = loops->larray->length ();
loop->header = BASIC_BLOCK_FOR_FUNCTION (fn, header_index);
loop->header->loop_father = loop;
--- 686,691 ----
*************** input_cfg (struct lto_input_block *ib, s
*** 705,711 ****
loop->nb_iterations_estimate.high = streamer_read_hwi (ib);
}
! loops->larray->quick_push (loop);
/* flow_loops_find doesn't like loops not in the tree, hook them
all as siblings of the tree root temporarily. */
--- 704,710 ----
loop->nb_iterations_estimate.high = streamer_read_hwi (ib);
}
! place_new_loop (fn, loop);
/* flow_loops_find doesn't like loops not in the tree, hook them
all as siblings of the tree root temporarily. */
*************** input_cfg (struct lto_input_block *ib, s
*** 713,719 ****
}
/* Rebuild the loop tree. */
! fn->x_current_loops = flow_loops_find (loops);
}
--- 712,718 ----
}
/* Rebuild the loop tree. */
! set_loops_for_fn (fn, flow_loops_find (loops));
}
Index: trunk/gcc/lto-streamer-out.c
===================================================================
*** trunk.orig/gcc/lto-streamer-out.c 2013-04-26 13:13:49.000000000 +0200
--- trunk/gcc/lto-streamer-out.c 2013-04-29 12:39:19.027864481 +0200
*************** output_cfg (struct output_block *ob, str
*** 664,675 ****
gcc_assert (cfun == fn);
/* Output the number of loops. */
! streamer_write_uhwi (ob, number_of_loops ());
/* Output each loop, skipping the tree root which has number zero. */
! for (unsigned i = 1; i < number_of_loops (); ++i)
{
! struct loop *loop = get_loop (i);
/* Write the index of the loop header. That's enough to rebuild
the loop tree on the reader side. Stream -1 for an unused
--- 664,675 ----
gcc_assert (cfun == fn);
/* Output the number of loops. */
! streamer_write_uhwi (ob, number_of_loops (fn));
/* Output each loop, skipping the tree root which has number zero. */
! for (unsigned i = 1; i < number_of_loops (fn); ++i)
{
! struct loop *loop = get_loop (fn, i);
/* Write the index of the loop header. That's enough to rebuild
the loop tree on the reader side. Stream -1 for an unused
Index: trunk/gcc/modulo-sched.c
===================================================================
*** trunk.orig/gcc/modulo-sched.c 2013-04-10 13:36:55.000000000 +0200
--- trunk/gcc/modulo-sched.c 2013-04-29 12:42:08.673768914 +0200
*************** sms_schedule (void)
*** 1360,1366 ****
loop_optimizer_init (LOOPS_HAVE_PREHEADERS
| LOOPS_HAVE_RECORDED_EXITS);
! if (number_of_loops () <= 1)
{
loop_optimizer_finalize ();
return; /* There are no loops to schedule. */
--- 1360,1366 ----
loop_optimizer_init (LOOPS_HAVE_PREHEADERS
| LOOPS_HAVE_RECORDED_EXITS);
! if (number_of_loops (cfun) <= 1)
{
loop_optimizer_finalize ();
return; /* There are no loops to schedule. */
*************** sms_schedule (void)
*** 1384,1390 ****
/* Allocate memory to hold the DDG array one entry for each loop.
We use loop->num as index into this array. */
! g_arr = XCNEWVEC (ddg_ptr, number_of_loops ());
if (dump_file)
{
--- 1384,1390 ----
/* Allocate memory to hold the DDG array one entry for each loop.
We use loop->num as index into this array. */
! g_arr = XCNEWVEC (ddg_ptr, number_of_loops (cfun));
if (dump_file)
{
Index: trunk/gcc/predict.c
===================================================================
*** trunk.orig/gcc/predict.c 2013-04-10 13:36:55.000000000 +0200
--- trunk/gcc/predict.c 2013-04-29 12:42:29.633004172 +0200
*************** tree_estimate_probability (void)
*** 2338,2344 ****
tree_bb_level_predictions ();
record_loop_exits ();
! if (number_of_loops () > 1)
predict_loops ();
FOR_EACH_BB (bb)
--- 2338,2344 ----
tree_bb_level_predictions ();
record_loop_exits ();
! if (number_of_loops (cfun) > 1)
predict_loops ();
FOR_EACH_BB (bb)
*************** tree_estimate_probability_driver (void)
*** 2372,2378 ****
mark_irreducible_loops ();
! nb_loops = number_of_loops ();
if (nb_loops > 1)
scev_initialize ();
--- 2372,2378 ----
mark_irreducible_loops ();
! nb_loops = number_of_loops (cfun);
if (nb_loops > 1)
scev_initialize ();
*************** estimate_loops (void)
*** 2694,2700 ****
basic_block bb;
/* Start by estimating the frequencies in the loops. */
! if (number_of_loops () > 1)
estimate_loops_at_level (current_loops->tree_root->inner);
/* Now propagate the frequencies through all the blocks. */
--- 2694,2700 ----
basic_block bb;
/* Start by estimating the frequencies in the loops. */
! if (number_of_loops (cfun) > 1)
estimate_loops_at_level (current_loops->tree_root->inner);
/* Now propagate the frequencies through all the blocks. */
Index: trunk/gcc/tree-cfg.c
===================================================================
*** trunk.orig/gcc/tree-cfg.c 2013-04-26 14:56:48.000000000 +0200
--- trunk/gcc/tree-cfg.c 2013-04-29 12:44:45.374527653 +0200
*************** fixup_loop_arrays_after_move (struct fun
*** 6613,6623 ****
struct loop *loop)
{
/* Discard it from the old loop array. */
! (*fn1->x_current_loops->larray)[loop->num] = NULL;
/* Place it in the new loop array, assigning it a new number. */
! loop->num = vec_safe_length (fn2->x_current_loops->larray);
! vec_safe_push (fn2->x_current_loops->larray, loop);
/* Recurse to children. */
for (loop = loop->inner; loop; loop = loop->next)
--- 6613,6623 ----
struct loop *loop)
{
/* Discard it from the old loop array. */
! (*get_loops (fn1))[loop->num] = NULL;
/* Place it in the new loop array, assigning it a new number. */
! loop->num = number_of_loops (fn2);
! vec_safe_push (loops_for_fn (fn2)->larray, loop);
/* Recurse to children. */
for (loop = loop->inner; loop; loop = loop->next)
*************** move_sese_region_to_fn (struct function
*** 6744,6752 ****
}
/* Initialize an empty loop tree. */
! dest_cfun->x_current_loops = ggc_alloc_cleared_loops ();
! init_loops_structure (dest_cfun, dest_cfun->x_current_loops, 1);
! dest_cfun->x_current_loops->state = LOOPS_MAY_HAVE_MULTIPLE_LATCHES;
/* Move the outlined loop tree part. */
FOR_EACH_VEC_ELT (bbs, i, bb)
--- 6744,6753 ----
}
/* Initialize an empty loop tree. */
! struct loops *loops = ggc_alloc_cleared_loops ();
! init_loops_structure (dest_cfun, loops, 1);
! loops->state = LOOPS_MAY_HAVE_MULTIPLE_LATCHES;
! set_loops_for_fn (dest_cfun, loops);
/* Move the outlined loop tree part. */
FOR_EACH_VEC_ELT (bbs, i, bb)
*************** move_sese_region_to_fn (struct function
*** 6756,6780 ****
{
struct loop *loop = bb->loop_father;
flow_loop_tree_node_remove (bb->loop_father);
! flow_loop_tree_node_add (dest_cfun->x_current_loops->tree_root, loop);
fixup_loop_arrays_after_move (saved_cfun, cfun, loop);
}
/* Remove loop exits from the outlined region. */
! if (saved_cfun->x_current_loops->exits)
FOR_EACH_EDGE (e, ei, bb->succs)
{
void **slot = htab_find_slot_with_hash
! (saved_cfun->x_current_loops->exits, e,
htab_hash_pointer (e), NO_INSERT);
if (slot)
! htab_clear_slot (saved_cfun->x_current_loops->exits, slot);
}
}
/* Adjust the number of blocks in the tree root of the outlined part. */
! dest_cfun->x_current_loops->tree_root->num_nodes = bbs.length () + 2;
/* Setup a mapping to be used by move_block_to_fn. */
loop->aux = current_loops->tree_root;
--- 6757,6781 ----
{
struct loop *loop = bb->loop_father;
flow_loop_tree_node_remove (bb->loop_father);
! flow_loop_tree_node_add (get_loop (dest_cfun, 0), loop);
fixup_loop_arrays_after_move (saved_cfun, cfun, loop);
}
/* Remove loop exits from the outlined region. */
! if (loops_for_fn (saved_cfun)->exits)
FOR_EACH_EDGE (e, ei, bb->succs)
{
void **slot = htab_find_slot_with_hash
! (loops_for_fn (saved_cfun)->exits, e,
htab_hash_pointer (e), NO_INSERT);
if (slot)
! htab_clear_slot (loops_for_fn (saved_cfun)->exits, slot);
}
}
/* Adjust the number of blocks in the tree root of the outlined part. */
! get_loop (dest_cfun, 0)->num_nodes = bbs.length () + 2;
/* Setup a mapping to be used by move_block_to_fn. */
loop->aux = current_loops->tree_root;
*************** debug_loop (struct loop *loop, int verbo
*** 7253,7259 ****
DEBUG_FUNCTION void
debug_loop_num (unsigned num, int verbosity)
{
! debug_loop (get_loop (num), verbosity);
}
/* Return true if BB ends with a call, possibly followed by some
--- 7254,7260 ----
DEBUG_FUNCTION void
debug_loop_num (unsigned num, int verbosity)
{
! debug_loop (get_loop (cfun, num), verbosity);
}
/* Return true if BB ends with a call, possibly followed by some
Index: trunk/gcc/tree-chrec.c
===================================================================
*** trunk.orig/gcc/tree-chrec.c 2013-01-11 10:54:31.000000000 +0100
--- trunk/gcc/tree-chrec.c 2013-04-29 12:43:45.203852366 +0200
*************** chrec_evaluate (unsigned var, tree chrec
*** 517,523 ****
{
tree arg0, arg1, binomial_n_k;
tree type = TREE_TYPE (chrec);
! struct loop *var_loop = get_loop (var);
while (TREE_CODE (chrec) == POLYNOMIAL_CHREC
&& flow_loop_nested_p (var_loop, get_chrec_loop (chrec)))
--- 517,523 ----
{
tree arg0, arg1, binomial_n_k;
tree type = TREE_TYPE (chrec);
! struct loop *var_loop = get_loop (cfun, var);
while (TREE_CODE (chrec) == POLYNOMIAL_CHREC
&& flow_loop_nested_p (var_loop, get_chrec_loop (chrec)))
*************** tree
*** 690,696 ****
hide_evolution_in_other_loops_than_loop (tree chrec,
unsigned loop_num)
{
! struct loop *loop = get_loop (loop_num), *chloop;
if (automatically_generated_chrec_p (chrec))
return chrec;
--- 690,696 ----
hide_evolution_in_other_loops_than_loop (tree chrec,
unsigned loop_num)
{
! struct loop *loop = get_loop (cfun, loop_num), *chloop;
if (automatically_generated_chrec_p (chrec))
return chrec;
*************** chrec_component_in_loop_num (tree chrec,
*** 731,737 ****
bool right)
{
tree component;
! struct loop *loop = get_loop (loop_num), *chloop;
if (automatically_generated_chrec_p (chrec))
return chrec;
--- 731,737 ----
bool right)
{
tree component;
! struct loop *loop = get_loop (cfun, loop_num), *chloop;
if (automatically_generated_chrec_p (chrec))
return chrec;
*************** reset_evolution_in_loop (unsigned loop_n
*** 813,819 ****
tree chrec,
tree new_evol)
{
! struct loop *loop = get_loop (loop_num);
if (POINTER_TYPE_P (chrec_type (chrec)))
gcc_assert (ptrofftype_p (chrec_type (new_evol)));
--- 813,819 ----
tree chrec,
tree new_evol)
{
! struct loop *loop = get_loop (cfun, loop_num);
if (POINTER_TYPE_P (chrec_type (chrec)))
gcc_assert (ptrofftype_p (chrec_type (new_evol)));
*************** evolution_function_is_invariant_rec_p (t
*** 986,999 ****
if (TREE_CODE (chrec) == SSA_NAME
&& (loopnum == 0
! || expr_invariant_in_loop_p (get_loop (loopnum), chrec)))
return true;
if (TREE_CODE (chrec) == POLYNOMIAL_CHREC)
{
if (CHREC_VARIABLE (chrec) == (unsigned) loopnum
! || flow_loop_nested_p (get_loop (loopnum),
! get_loop (CHREC_VARIABLE (chrec)))
|| !evolution_function_is_invariant_rec_p (CHREC_RIGHT (chrec),
loopnum)
|| !evolution_function_is_invariant_rec_p (CHREC_LEFT (chrec),
--- 986,999 ----
if (TREE_CODE (chrec) == SSA_NAME
&& (loopnum == 0
! || expr_invariant_in_loop_p (get_loop (cfun, loopnum), chrec)))
return true;
if (TREE_CODE (chrec) == POLYNOMIAL_CHREC)
{
if (CHREC_VARIABLE (chrec) == (unsigned) loopnum
! || flow_loop_nested_p (get_loop (cfun, loopnum),
! get_chrec_loop (chrec))
|| !evolution_function_is_invariant_rec_p (CHREC_RIGHT (chrec),
loopnum)
|| !evolution_function_is_invariant_rec_p (CHREC_LEFT (chrec),
Index: trunk/gcc/tree-if-conv.c
===================================================================
*** trunk.orig/gcc/tree-if-conv.c 2013-01-11 10:54:52.000000000 +0100
--- trunk/gcc/tree-if-conv.c 2013-04-29 12:44:58.745677710 +0200
*************** main_tree_if_conversion (void)
*** 1818,1824 ****
bool changed = false;
unsigned todo = 0;
! if (number_of_loops () <= 1)
return 0;
FOR_EACH_LOOP (li, loop, 0)
--- 1818,1824 ----
bool changed = false;
unsigned todo = 0;
! if (number_of_loops (cfun) <= 1)
return 0;
FOR_EACH_LOOP (li, loop, 0)
Index: trunk/gcc/tree-inline.c
===================================================================
*** trunk.orig/gcc/tree-inline.c 2013-04-26 10:01:45.000000000 +0200
--- trunk/gcc/tree-inline.c 2013-04-29 12:52:58.598061188 +0200
*************** copy_loops (bitmap blocks_to_copy,
*** 2227,2233 ****
copy_loop_info (src_loop, dest_loop);
/* Finally place it into the loop array and the loop tree. */
! place_new_loop (dest_loop);
flow_loop_tree_node_add (dest_parent, dest_loop);
/* Recurse. */
--- 2227,2233 ----
copy_loop_info (src_loop, dest_loop);
/* Finally place it into the loop array and the loop tree. */
! place_new_loop (cfun, dest_loop);
flow_loop_tree_node_add (dest_parent, dest_loop);
/* Recurse. */
*************** copy_cfg_body (copy_body_data * id, gcov
*** 2336,2346 ****
}
/* Duplicate the loop tree, if available and wanted. */
! if (id->src_cfun->x_current_loops != NULL
&& current_loops != NULL)
{
copy_loops (blocks_to_copy, entry_block_map->loop_father,
! id->src_cfun->x_current_loops->tree_root);
/* Defer to cfgcleanup to update loop-father fields of basic-blocks. */
loops_state_set (LOOPS_NEED_FIXUP);
}
--- 2336,2346 ----
}
/* Duplicate the loop tree, if available and wanted. */
! if (loops_for_fn (src_cfun) != NULL
&& current_loops != NULL)
{
copy_loops (blocks_to_copy, entry_block_map->loop_father,
! get_loop (src_cfun, 0));
/* Defer to cfgcleanup to update loop-father fields of basic-blocks. */
loops_state_set (LOOPS_NEED_FIXUP);
}
*************** tree_function_versioning (tree old_decl,
*** 5203,5209 ****
}
/* Set up the destination functions loop tree. */
! if (DECL_STRUCT_FUNCTION (old_decl)->x_current_loops)
{
cfun->curr_properties &= ~PROP_loops;
loop_optimizer_init (AVOID_CFG_MODIFICATIONS);
--- 5203,5209 ----
}
/* Set up the destination functions loop tree. */
! if (loops_for_fn (DECL_STRUCT_FUNCTION (old_decl)) != NULL)
{
cfun->curr_properties &= ~PROP_loops;
loop_optimizer_init (AVOID_CFG_MODIFICATIONS);
Index: trunk/gcc/tree-loop-distribution.c
===================================================================
*** trunk.orig/gcc/tree-loop-distribution.c 2013-04-10 13:36:53.000000000 +0200
--- trunk/gcc/tree-loop-distribution.c 2013-04-29 12:45:26.871993345 +0200
*************** rdg_flag_loop_exits (struct graph *rdg,
*** 774,780 ****
conds.create (3);
EXECUTE_IF_SET_IN_BITMAP (loops, 0, i, bi)
! collect_condition_stmts (get_loop (i), &conds);
while (!conds.is_empty ())
{
--- 774,780 ----
conds.create (3);
EXECUTE_IF_SET_IN_BITMAP (loops, 0, i, bi)
! collect_condition_stmts (get_loop (cfun, i), &conds);
while (!conds.is_empty ())
{
*************** rdg_flag_loop_exits (struct graph *rdg,
*** 787,793 ****
EXECUTE_IF_SET_IN_BITMAP (new_loops, 0, i, bi)
if (bitmap_set_bit (loops, i))
! collect_condition_stmts (get_loop (i), &conds);
BITMAP_FREE (new_loops);
}
--- 787,793 ----
EXECUTE_IF_SET_IN_BITMAP (new_loops, 0, i, bi)
if (bitmap_set_bit (loops, i))
! collect_condition_stmts (get_loop (cfun, i), &conds);
BITMAP_FREE (new_loops);
}
Index: trunk/gcc/tree-scalar-evolution.c
===================================================================
*** trunk.orig/gcc/tree-scalar-evolution.c 2013-04-26 09:55:29.000000000 +0200
--- trunk/gcc/tree-scalar-evolution.c 2013-04-29 12:46:14.478527562 +0200
*************** chrec_contains_symbols_defined_in_loop (
*** 422,428 ****
def = SSA_NAME_DEF_STMT (chrec);
def_loop = loop_containing_stmt (def);
! loop = get_loop (loop_nb);
if (def_loop == NULL)
return false;
--- 422,428 ----
def = SSA_NAME_DEF_STMT (chrec);
def_loop = loop_containing_stmt (def);
! loop = get_loop (cfun, loop_nb);
if (def_loop == NULL)
return false;
*************** add_to_evolution_1 (unsigned loop_nb, tr
*** 629,635 ****
gimple at_stmt)
{
tree type, left, right;
! struct loop *loop = get_loop (loop_nb), *chloop;
switch (TREE_CODE (chrec_before))
{
--- 629,635 ----
gimple at_stmt)
{
tree type, left, right;
! struct loop *loop = get_loop (cfun, loop_nb), *chloop;
switch (TREE_CODE (chrec_before))
{
*************** scev_const_prop (void)
*** 3258,3264 ****
loop_iterator li;
gimple_stmt_iterator psi;
! if (number_of_loops () <= 1)
return 0;
FOR_EACH_BB (bb)
--- 3258,3264 ----
loop_iterator li;
gimple_stmt_iterator psi;
! if (number_of_loops (cfun) <= 1)
return 0;
FOR_EACH_BB (bb)
Index: trunk/gcc/tree-scalar-evolution.h
===================================================================
*** trunk.orig/gcc/tree-scalar-evolution.h 2013-04-25 10:20:00.000000000 +0200
--- trunk/gcc/tree-scalar-evolution.h 2013-04-29 12:40:58.561981896 +0200
*************** instantiate_parameters (struct loop *loo
*** 64,70 ****
static inline struct loop *
get_chrec_loop (const_tree chrec)
{
! return get_loop (CHREC_VARIABLE (chrec));
}
#endif /* GCC_TREE_SCALAR_EVOLUTION_H */
--- 64,70 ----
static inline struct loop *
get_chrec_loop (const_tree chrec)
{
! return get_loop (cfun, CHREC_VARIABLE (chrec));
}
#endif /* GCC_TREE_SCALAR_EVOLUTION_H */
Index: trunk/gcc/tree-ssa-loop-ch.c
===================================================================
*** trunk.orig/gcc/tree-ssa-loop-ch.c 2013-01-11 10:54:28.000000000 +0100
--- trunk/gcc/tree-ssa-loop-ch.c 2013-04-29 12:46:34.801755612 +0200
*************** copy_loop_headers (void)
*** 136,142 ****
loop_optimizer_init (LOOPS_HAVE_PREHEADERS
| LOOPS_HAVE_SIMPLE_LATCHES);
! if (number_of_loops () <= 1)
{
loop_optimizer_finalize ();
return 0;
--- 136,142 ----
loop_optimizer_init (LOOPS_HAVE_PREHEADERS
| LOOPS_HAVE_SIMPLE_LATCHES);
! if (number_of_loops (cfun) <= 1)
{
loop_optimizer_finalize ();
return 0;
Index: trunk/gcc/tree-ssa-loop-im.c
===================================================================
*** trunk.orig/gcc/tree-ssa-loop-im.c 2013-04-24 10:09:07.000000000 +0200
--- trunk/gcc/tree-ssa-loop-im.c 2013-04-29 12:46:56.541999553 +0200
*************** analyze_memory_references (void)
*** 1593,1599 ****
/* Initialize bb_loop_postorder with a mapping from loop->num to
its postorder index. */
i = 0;
! bb_loop_postorder = XNEWVEC (unsigned, number_of_loops ());
FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
bb_loop_postorder[loop->num] = i++;
/* Collect all basic-blocks in loops and sort them after their
--- 1593,1599 ----
/* Initialize bb_loop_postorder with a mapping from loop->num to
its postorder index. */
i = 0;
! bb_loop_postorder = XNEWVEC (unsigned, number_of_loops (cfun));
FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
bb_loop_postorder[loop->num] = i++;
/* Collect all basic-blocks in loops and sort them after their
*************** tree_ssa_lim_initialize (void)
*** 2563,2576 ****
memory_accesses.refs_list.quick_push
(mem_ref_alloc (error_mark_node, 0, UNANALYZABLE_MEM_ID));
! memory_accesses.refs_in_loop.create (number_of_loops ());
! memory_accesses.refs_in_loop.quick_grow (number_of_loops ());
! memory_accesses.refs_stored_in_loop.create (number_of_loops ());
! memory_accesses.refs_stored_in_loop.quick_grow (number_of_loops ());
! memory_accesses.all_refs_stored_in_loop.create (number_of_loops ());
! memory_accesses.all_refs_stored_in_loop.quick_grow (number_of_loops ());
! for (i = 0; i < number_of_loops (); i++)
{
bitmap_initialize (&memory_accesses.refs_in_loop[i],
&lim_bitmap_obstack);
--- 2563,2576 ----
memory_accesses.refs_list.quick_push
(mem_ref_alloc (error_mark_node, 0, UNANALYZABLE_MEM_ID));
! memory_accesses.refs_in_loop.create (number_of_loops (cfun));
! memory_accesses.refs_in_loop.quick_grow (number_of_loops (cfun));
! memory_accesses.refs_stored_in_loop.create (number_of_loops (cfun));
! memory_accesses.refs_stored_in_loop.quick_grow (number_of_loops (cfun));
! memory_accesses.all_refs_stored_in_loop.create (number_of_loops (cfun));
! memory_accesses.all_refs_stored_in_loop.quick_grow (number_of_loops (cfun));
! for (i = 0; i < number_of_loops (cfun); i++)
{
bitmap_initialize (&memory_accesses.refs_in_loop[i],
&lim_bitmap_obstack);
Index: trunk/gcc/tree-ssa-loop-manip.c
===================================================================
*** trunk.orig/gcc/tree-ssa-loop-manip.c 2013-03-19 14:09:01.000000000 +0100
--- trunk/gcc/tree-ssa-loop-manip.c 2013-04-29 12:47:20.036263170 +0200
*************** rewrite_into_loop_closed_ssa (bitmap cha
*** 493,499 ****
bitmap names_to_rename;
loops_state_set (LOOP_CLOSED_SSA);
! if (number_of_loops () <= 1)
return;
/* If the pass has caused the SSA form to be out-of-date, update it
--- 493,499 ----
bitmap names_to_rename;
loops_state_set (LOOP_CLOSED_SSA);
! if (number_of_loops (cfun) <= 1)
return;
/* If the pass has caused the SSA form to be out-of-date, update it
*************** rewrite_into_loop_closed_ssa (bitmap cha
*** 516,522 ****
{
/* An array of bitmaps where LOOP_EXITS[I] is the set of basic blocks
that are the destination of an edge exiting loop number I. */
! bitmap *loop_exits = XNEWVEC (bitmap, number_of_loops ());
get_loops_exits (loop_exits);
/* Add the PHI nodes on exits of the loops for the names we need to
--- 516,522 ----
{
/* An array of bitmaps where LOOP_EXITS[I] is the set of basic blocks
that are the destination of an edge exiting loop number I. */
! bitmap *loop_exits = XNEWVEC (bitmap, number_of_loops (cfun));
get_loops_exits (loop_exits);
/* Add the PHI nodes on exits of the loops for the names we need to
*************** verify_loop_closed_ssa (bool verify_ssa_
*** 578,584 ****
edge e;
edge_iterator ei;
! if (number_of_loops () <= 1)
return;
if (verify_ssa_p)
--- 578,584 ----
edge e;
edge_iterator ei;
! if (number_of_loops (cfun) <= 1)
return;
if (verify_ssa_p)
Index: trunk/gcc/tree-ssa-loop.c
===================================================================
*** trunk.orig/gcc/tree-ssa-loop.c 2013-04-26 10:01:45.000000000 +0200
--- trunk/gcc/tree-ssa-loop.c 2013-04-29 12:47:57.984688955 +0200
*************** tree_ssa_loop_init (void)
*** 74,80 ****
regions into reducible. */
scev_initialize ();
! if (number_of_loops () <= 1)
return 0;
return 0;
--- 74,80 ----
regions into reducible. */
scev_initialize ();
! if (number_of_loops (cfun) <= 1)
return 0;
return 0;
*************** struct gimple_opt_pass pass_tree_loop_in
*** 105,111 ****
static unsigned int
tree_ssa_loop_im (void)
{
! if (number_of_loops () <= 1)
return 0;
return tree_ssa_lim ();
--- 105,111 ----
static unsigned int
tree_ssa_loop_im (void)
{
! if (number_of_loops (cfun) <= 1)
return 0;
return tree_ssa_lim ();
*************** struct gimple_opt_pass pass_lim =
*** 142,148 ****
static unsigned int
tree_ssa_loop_unswitch (void)
{
! if (number_of_loops () <= 1)
return 0;
return tree_ssa_unswitch_loops ();
--- 142,148 ----
static unsigned int
tree_ssa_loop_unswitch (void)
{
! if (number_of_loops (cfun) <= 1)
return 0;
return tree_ssa_unswitch_loops ();
*************** struct gimple_opt_pass pass_predcom =
*** 216,222 ****
static unsigned int
tree_vectorize (void)
{
! if (number_of_loops () <= 1)
return 0;
return vectorize_loops ();
--- 216,222 ----
static unsigned int
tree_vectorize (void)
{
! if (number_of_loops (cfun) <= 1)
return 0;
return vectorize_loops ();
*************** struct gimple_opt_pass pass_graphite_tra
*** 323,329 ****
static unsigned int
check_data_deps (void)
{
! if (number_of_loops () <= 1)
return 0;
tree_check_data_deps ();
--- 323,329 ----
static unsigned int
check_data_deps (void)
{
! if (number_of_loops (cfun) <= 1)
return 0;
tree_check_data_deps ();
*************** struct gimple_opt_pass pass_check_data_d
*** 361,367 ****
static unsigned int
tree_ssa_loop_ivcanon (void)
{
! if (number_of_loops () <= 1)
return 0;
return canonicalize_induction_variables ();
--- 361,367 ----
static unsigned int
tree_ssa_loop_ivcanon (void)
{
! if (number_of_loops (cfun) <= 1)
return 0;
return canonicalize_induction_variables ();
*************** struct gimple_opt_pass pass_scev_cprop =
*** 428,434 ****
static unsigned int
tree_ssa_loop_bounds (void)
{
! if (number_of_loops () <= 1)
return 0;
estimate_numbers_of_iterations ();
--- 428,434 ----
static unsigned int
tree_ssa_loop_bounds (void)
{
! if (number_of_loops (cfun) <= 1)
return 0;
estimate_numbers_of_iterations ();
*************** struct gimple_opt_pass pass_record_bound
*** 461,467 ****
static unsigned int
tree_complete_unroll (void)
{
! if (number_of_loops () <= 1)
return 0;
return tree_unroll_loops_completely (flag_unroll_loops
--- 461,467 ----
static unsigned int
tree_complete_unroll (void)
{
! if (number_of_loops (cfun) <= 1)
return 0;
return tree_unroll_loops_completely (flag_unroll_loops
*************** tree_complete_unroll_inner (void)
*** 504,510 ****
loop_optimizer_init (LOOPS_NORMAL
| LOOPS_HAVE_RECORDED_EXITS);
! if (number_of_loops () > 1)
{
scev_initialize ();
ret = tree_unroll_loops_completely (optimize >= 3, false);
--- 504,510 ----
loop_optimizer_init (LOOPS_NORMAL
| LOOPS_HAVE_RECORDED_EXITS);
! if (number_of_loops (cfun) > 1)
{
scev_initialize ();
ret = tree_unroll_loops_completely (optimize >= 3, false);
*************** gate_tree_parallelize_loops (void)
*** 553,559 ****
static unsigned
tree_parallelize_loops (void)
{
! if (number_of_loops () <= 1)
return 0;
if (parallelize_loops ())
--- 553,559 ----
static unsigned
tree_parallelize_loops (void)
{
! if (number_of_loops (cfun) <= 1)
return 0;
if (parallelize_loops ())
*************** struct gimple_opt_pass pass_parallelize_
*** 586,592 ****
static unsigned int
tree_ssa_loop_prefetch (void)
{
! if (number_of_loops () <= 1)
return 0;
return tree_ssa_prefetch_arrays ();
--- 586,592 ----
static unsigned int
tree_ssa_loop_prefetch (void)
{
! if (number_of_loops (cfun) <= 1)
return 0;
return tree_ssa_prefetch_arrays ();
*************** struct gimple_opt_pass pass_loop_prefetc
*** 623,629 ****
static unsigned int
tree_ssa_loop_ivopts (void)
{
! if (number_of_loops () <= 1)
return 0;
tree_ssa_iv_optimize ();
--- 623,629 ----
static unsigned int
tree_ssa_loop_ivopts (void)
{
! if (number_of_loops (cfun) <= 1)
return 0;
tree_ssa_iv_optimize ();
Index: trunk/gcc/tree-ssa.c
===================================================================
*** trunk.orig/gcc/tree-ssa.c 2013-04-26 09:55:32.000000000 +0200
--- trunk/gcc/tree-ssa.c 2013-04-29 12:48:17.186904396 +0200
*************** execute_update_addresses_taken (void)
*** 2117,2123 ****
}
/* Update SSA form here, we are called as non-pass as well. */
! if (number_of_loops () > 1 && loops_state_satisfies_p (LOOP_CLOSED_SSA))
rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
else
update_ssa (TODO_update_ssa);
--- 2117,2124 ----
}
/* Update SSA form here, we are called as non-pass as well. */
! if (number_of_loops (cfun) > 1
! && loops_state_satisfies_p (LOOP_CLOSED_SSA))
rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
else
update_ssa (TODO_update_ssa);
Index: trunk/gcc/tree-vectorizer.c
===================================================================
*** trunk.orig/gcc/tree-vectorizer.c 2013-04-10 13:36:55.000000000 +0200
--- trunk/gcc/tree-vectorizer.c 2013-04-29 12:49:01.762404501 +0200
*************** vectorize_loops (void)
*** 87,93 ****
loop_iterator li;
struct loop *loop;
! vect_loops_num = number_of_loops ();
/* Bail out if there are no loops. */
if (vect_loops_num <= 1)
--- 87,93 ----
loop_iterator li;
struct loop *loop;
! vect_loops_num = number_of_loops (cfun);
/* Bail out if there are no loops. */
if (vect_loops_num <= 1)
*************** vectorize_loops (void)
*** 139,145 ****
{
loop_vec_info loop_vinfo;
! loop = get_loop (i);
if (!loop)
continue;
loop_vinfo = (loop_vec_info) loop->aux;
--- 139,145 ----
{
loop_vec_info loop_vinfo;
! loop = get_loop (cfun, i);
if (!loop)
continue;
loop_vinfo = (loop_vec_info) loop->aux;