+2013-04-30 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.
+
2013-04-29 Mike Frysinger <vapier@gentoo.org>
* config/arm/bpabi.h (EABI_LINK_SPEC): Define.
key.index1 = loop->num;
entry = loop_copy.find (&key);
if (entry)
- return get_loop (entry->index2);
+ return get_loop (cfun, entry->index2);
else
return NULL;
}
if (!current_loops || ! file)
return;
- fprintf (file, ";; %d loops found\n", number_of_loops ());
+ fprintf (file, ";; %d loops found\n", number_of_loops (cfun));
FOR_EACH_LOOP (li, loop, LI_INCLUDE_ROOT)
{
loops_state_set (LOOPS_HAVE_RECORDED_EXITS);
gcc_assert (current_loops->exits == NULL);
- current_loops->exits = htab_create_ggc (2 * number_of_loops (),
+ current_loops->exits = htab_create_ggc (2 * number_of_loops (cfun),
loop_exit_hash, loop_exit_eq,
loop_exit_free);
struct loop *loop;
int err = 0;
edge e;
- unsigned num = number_of_loops ();
+ unsigned num = number_of_loops (cfun);
loop_iterator li;
struct loop_exit *exit, *mexit;
bool dom_available = dom_info_available_p (CDI_DOMINATORS);
/* 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 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);
/* Accessors for the loop structures. */
-/* Returns the loop with index NUM from current_loops. */
+/* Returns the loop with index NUM from FNs loop tree. */
static inline struct loop *
-get_loop (unsigned num)
+get_loop (struct function *fn, unsigned num)
{
- return (*current_loops->larray)[num];
+ return (*loops_for_fn (fn)->larray)[num];
}
/* Returns the number of superloops of LOOP. */
return loop->exits->next->e != NULL;
}
-/* Returns the list of loops in current_loops. */
+/* Returns the list of loops in FN. */
-static inline vec<loop_p, va_gc> *
-get_loops (void)
+inline vec<loop_p, va_gc> *
+get_loops (struct function *fn)
{
- if (!current_loops)
+ struct loops *loops = loops_for_fn (fn);
+ if (!loops)
return NULL;
- return current_loops->larray;
+ return loops->larray;
}
-/* Returns the number of loops in current_loops (including the removed
+/* 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 (void)
+number_of_loops (struct function *fn)
{
- if (!current_loops)
+ struct loops *loops = loops_for_fn (fn);
+ if (!fn)
return 0;
- return vec_safe_length (current_loops->larray);
+ return vec_safe_length (loops->larray);
}
/* Returns true if state of the loops satisfies all properties
while (li->to_visit.iterate (li->idx, &anum))
{
li->idx++;
- *loop = get_loop (anum);
+ *loop = get_loop (cfun, anum);
if (*loop)
return;
}
return;
}
- li->to_visit.create (number_of_loops ());
+ li->to_visit.create (number_of_loops (cfun));
mn = (flags & LI_INCLUDE_ROOT) ? 0 : 1;
if (flags & LI_ONLY_INNERMOST)
int src, dest;
unsigned depth;
struct graph *g;
- int num = number_of_loops ();
+ int num = number_of_loops (cfun);
struct loop *cloop;
bool irred_loop_found = false;
int i;
if (optimize && (flag_ira_region == IRA_REGION_ALL
|| flag_ira_region == IRA_REGION_MIXED)
- && number_of_loops () <= (unsigned) IRA_MAX_LOOPS_NUM)
+ && 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
basic_block bb;
edge e;
- if (number_of_loops () <= 1)
+ if (number_of_loops (cfun) <= 1)
return;
FOR_EACH_BB (bb)
return true;
}
-/* Creates place for a new LOOP in loops structure. */
+/* Creates place for a new LOOP in loops structure of FN. */
void
-place_new_loop (struct loop *loop)
+place_new_loop (struct function *fn, struct loop *loop)
{
- loop->num = number_of_loops ();
- vec_safe_push (current_loops->larray, 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
edge_iterator ei;
/* Add it to loop structure. */
- place_new_loop (loop);
+ place_new_loop (cfun, loop);
flow_loop_tree_node_add (outer, loop);
/* Find its nodes. */
{
struct loop *cloop;
cloop = alloc_loop ();
- place_new_loop (cloop);
+ place_new_loop (cfun, cloop);
copy_loop_info (loop, cloop);
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)
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);
+ 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);
}
if (GBB_BB (gbb) == ENTRY_BLOCK_PTR)
return next_e;
- nb_loops = number_of_loops ();
+ nb_loops = number_of_loops (cfun);
iv_map.create (nb_loops);
for (i = 0; i < nb_loops; i++)
iv_map.quick_push (NULL_TREE);
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());
+ 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
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;
+ 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);
sese region = SCOP_REGION (scop);
int i;
poly_bb_p pbb;
- int nb_loops = number_of_loops ();
+ 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)
static bool
graphite_initialize (isl_ctx *ctx)
{
- if (number_of_loops () <= 1
+ 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))
init_loop_tree_node (ira_loop_nodes, 0);
return;
}
- ira_loop_nodes_count = number_of_loops ();
+ 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 (), i, loop)
+ FOR_EACH_VEC_SAFE_ELT (get_loops (cfun), i, loop)
{
if (loop_outer (loop) != NULL)
{
loop_p loop;
if (current_loops != NULL)
- FOR_EACH_VEC_SAFE_ELT (get_loops (), i, loop)
+ 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;
ira_assert (current_loops != NULL);
max_regno = max_reg_num ();
- FOR_EACH_VEC_SAFE_ELT (get_loops (), l, loop)
+ 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);
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++)
+ * 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)
loop_p loop;
ira_assert (current_loops != NULL);
- FOR_EACH_VEC_SAFE_ELT (get_loops (), i, loop)
+ 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)
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 ());
+ 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)
}
}
fprintf (ira_dump_file, " regions=%d, blocks=%d, points=%d\n",
- current_loops == NULL ? 1 : number_of_loops (),
+ 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",
loop_p loop;
ira_assert (current_loops != NULL);
- FOR_EACH_VEC_SAFE_ELT (get_loops (), i, loop)
+ 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]);
/* Remember the number of loops so we can return how many new loops
flow_loops_find discovered. */
- old_nloops = number_of_loops ();
+ old_nloops = number_of_loops (cfun);
/* Re-compute loop structure in-place. */
flow_loops_find (current_loops);
}
/* Finally free deleted loops. */
- FOR_EACH_VEC_ELT (*get_loops (), i, loop)
+ FOR_EACH_VEC_ELT (*get_loops (cfun), i, loop)
if (loop && loop->header == NULL)
{
- (*get_loops ())[i] = NULL;
+ (*get_loops (cfun))[i] = NULL;
flow_loop_free (loop);
}
timevar_pop (TV_LOOP_INIT);
- return number_of_loops () - old_nloops;
+ return number_of_loops (cfun) - old_nloops;
}
\f
/* Gate for the RTL loop superpass. The actual passes are subpasses.
static unsigned int
rtl_move_loop_invariants (void)
{
- if (number_of_loops () > 1)
+ if (number_of_loops (cfun) > 1)
move_loop_invariants ();
return 0;
}
static unsigned int
rtl_unswitch (void)
{
- if (number_of_loops () > 1)
+ if (number_of_loops (cfun) > 1)
unswitch_loops ();
return 0;
}
static unsigned int
rtl_unroll_and_peel_loops (void)
{
- if (number_of_loops () > 1)
+ if (number_of_loops (cfun) > 1)
{
int flags = 0;
if (dump_file)
rtl_doloop (void)
{
#ifdef HAVE_doloop_end
- if (number_of_loops () > 1)
+ if (number_of_loops (cfun) > 1)
doloop_optimize_loops ();
#endif
return 0;
struct loops *loops = ggc_alloc_cleared_loops ();
init_loops_structure (fn, loops, n_loops);
+ set_loops_for_fn (fn, loops);
/* Input each loop and associate it with its loop header so
flow_loops_find can rebuild the loop tree. */
}
struct loop *loop = alloc_loop ();
- loop->num = loops->larray->length ();
loop->header = BASIC_BLOCK_FOR_FUNCTION (fn, header_index);
loop->header->loop_father = loop;
loop->nb_iterations_estimate.high = streamer_read_hwi (ib);
}
- loops->larray->quick_push (loop);
+ 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. */
}
/* Rebuild the loop tree. */
- fn->x_current_loops = flow_loops_find (loops);
+ flow_loops_find (loops);
}
gcc_assert (cfun == fn);
/* Output the number of loops. */
- streamer_write_uhwi (ob, 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 (); ++i)
+ for (unsigned i = 1; i < number_of_loops (fn); ++i)
{
- struct loop *loop = get_loop (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
loop_optimizer_init (LOOPS_HAVE_PREHEADERS
| LOOPS_HAVE_RECORDED_EXITS);
- if (number_of_loops () <= 1)
+ if (number_of_loops (cfun) <= 1)
{
loop_optimizer_finalize ();
return; /* There are no loops to schedule. */
/* 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 ());
+ g_arr = XCNEWVEC (ddg_ptr, number_of_loops (cfun));
if (dump_file)
{
tree_bb_level_predictions ();
record_loop_exits ();
- if (number_of_loops () > 1)
+ if (number_of_loops (cfun) > 1)
predict_loops ();
FOR_EACH_BB (bb)
mark_irreducible_loops ();
- nb_loops = number_of_loops ();
+ nb_loops = number_of_loops (cfun);
if (nb_loops > 1)
scev_initialize ();
basic_block bb;
/* Start by estimating the frequencies in the loops. */
- if (number_of_loops () > 1)
+ if (number_of_loops (cfun) > 1)
estimate_loops_at_level (current_loops->tree_root->inner);
/* Now propagate the frequencies through all the blocks. */
struct loop *loop)
{
/* Discard it from the old loop array. */
- (*fn1->x_current_loops->larray)[loop->num] = NULL;
+ (*get_loops (fn1))[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);
+ 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)
}
/* 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;
+ 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)
{
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);
+ 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 (saved_cfun->x_current_loops->exits)
+ if (loops_for_fn (saved_cfun)->exits)
FOR_EACH_EDGE (e, ei, bb->succs)
{
void **slot = htab_find_slot_with_hash
- (saved_cfun->x_current_loops->exits, e,
+ (loops_for_fn (saved_cfun)->exits, e,
htab_hash_pointer (e), NO_INSERT);
if (slot)
- htab_clear_slot (saved_cfun->x_current_loops->exits, slot);
+ htab_clear_slot (loops_for_fn (saved_cfun)->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;
+ 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_FUNCTION void
debug_loop_num (unsigned num, int verbosity)
{
- debug_loop (get_loop (num), verbosity);
+ debug_loop (get_loop (cfun, num), verbosity);
}
/* Return true if BB ends with a call, possibly followed by some
{
tree arg0, arg1, binomial_n_k;
tree type = TREE_TYPE (chrec);
- struct loop *var_loop = get_loop (var);
+ struct loop *var_loop = get_loop (cfun, var);
while (TREE_CODE (chrec) == POLYNOMIAL_CHREC
&& flow_loop_nested_p (var_loop, get_chrec_loop (chrec)))
hide_evolution_in_other_loops_than_loop (tree chrec,
unsigned loop_num)
{
- struct loop *loop = get_loop (loop_num), *chloop;
+ struct loop *loop = get_loop (cfun, loop_num), *chloop;
if (automatically_generated_chrec_p (chrec))
return chrec;
bool right)
{
tree component;
- struct loop *loop = get_loop (loop_num), *chloop;
+ struct loop *loop = get_loop (cfun, loop_num), *chloop;
if (automatically_generated_chrec_p (chrec))
return chrec;
tree chrec,
tree new_evol)
{
- struct loop *loop = get_loop (loop_num);
+ struct loop *loop = get_loop (cfun, loop_num);
if (POINTER_TYPE_P (chrec_type (chrec)))
gcc_assert (ptrofftype_p (chrec_type (new_evol)));
if (TREE_CODE (chrec) == SSA_NAME
&& (loopnum == 0
- || expr_invariant_in_loop_p (get_loop (loopnum), chrec)))
+ || 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 (loopnum),
- get_loop (CHREC_VARIABLE (chrec)))
+ || 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),
bool changed = false;
unsigned todo = 0;
- if (number_of_loops () <= 1)
+ if (number_of_loops (cfun) <= 1)
return 0;
FOR_EACH_LOOP (li, loop, 0)
copy_loop_info (src_loop, dest_loop);
/* Finally place it into the loop array and the loop tree. */
- place_new_loop (dest_loop);
+ place_new_loop (cfun, dest_loop);
flow_loop_tree_node_add (dest_parent, dest_loop);
/* Recurse. */
}
/* Duplicate the loop tree, if available and wanted. */
- if (id->src_cfun->x_current_loops != NULL
+ if (loops_for_fn (src_cfun) != NULL
&& current_loops != NULL)
{
copy_loops (blocks_to_copy, entry_block_map->loop_father,
- id->src_cfun->x_current_loops->tree_root);
+ get_loop (src_cfun, 0));
/* Defer to cfgcleanup to update loop-father fields of basic-blocks. */
loops_state_set (LOOPS_NEED_FIXUP);
}
}
/* Set up the destination functions loop tree. */
- if (DECL_STRUCT_FUNCTION (old_decl)->x_current_loops)
+ if (loops_for_fn (DECL_STRUCT_FUNCTION (old_decl)) != NULL)
{
cfun->curr_properties &= ~PROP_loops;
loop_optimizer_init (AVOID_CFG_MODIFICATIONS);
conds.create (3);
EXECUTE_IF_SET_IN_BITMAP (loops, 0, i, bi)
- collect_condition_stmts (get_loop (i), &conds);
+ collect_condition_stmts (get_loop (cfun, i), &conds);
while (!conds.is_empty ())
{
EXECUTE_IF_SET_IN_BITMAP (new_loops, 0, i, bi)
if (bitmap_set_bit (loops, i))
- collect_condition_stmts (get_loop (i), &conds);
+ collect_condition_stmts (get_loop (cfun, i), &conds);
BITMAP_FREE (new_loops);
}
def = SSA_NAME_DEF_STMT (chrec);
def_loop = loop_containing_stmt (def);
- loop = get_loop (loop_nb);
+ loop = get_loop (cfun, loop_nb);
if (def_loop == NULL)
return false;
gimple at_stmt)
{
tree type, left, right;
- struct loop *loop = get_loop (loop_nb), *chloop;
+ struct loop *loop = get_loop (cfun, loop_nb), *chloop;
switch (TREE_CODE (chrec_before))
{
loop_iterator li;
gimple_stmt_iterator psi;
- if (number_of_loops () <= 1)
+ if (number_of_loops (cfun) <= 1)
return 0;
FOR_EACH_BB (bb)
static inline struct loop *
get_chrec_loop (const_tree chrec)
{
- return get_loop (CHREC_VARIABLE (chrec));
+ return get_loop (cfun, CHREC_VARIABLE (chrec));
}
#endif /* GCC_TREE_SCALAR_EVOLUTION_H */
loop_optimizer_init (LOOPS_HAVE_PREHEADERS
| LOOPS_HAVE_SIMPLE_LATCHES);
- if (number_of_loops () <= 1)
+ if (number_of_loops (cfun) <= 1)
{
loop_optimizer_finalize ();
return 0;
/* Initialize bb_loop_postorder with a mapping from loop->num to
its postorder index. */
i = 0;
- bb_loop_postorder = XNEWVEC (unsigned, number_of_loops ());
+ 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
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 ());
+ 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 (); i++)
+ for (i = 0; i < number_of_loops (cfun); i++)
{
bitmap_initialize (&memory_accesses.refs_in_loop[i],
&lim_bitmap_obstack);
bitmap names_to_rename;
loops_state_set (LOOP_CLOSED_SSA);
- if (number_of_loops () <= 1)
+ if (number_of_loops (cfun) <= 1)
return;
/* If the pass has caused the SSA form to be out-of-date, update it
{
/* 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 ());
+ 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
edge e;
edge_iterator ei;
- if (number_of_loops () <= 1)
+ if (number_of_loops (cfun) <= 1)
return;
if (verify_ssa_p)
regions into reducible. */
scev_initialize ();
- if (number_of_loops () <= 1)
+ if (number_of_loops (cfun) <= 1)
return 0;
return 0;
static unsigned int
tree_ssa_loop_im (void)
{
- if (number_of_loops () <= 1)
+ if (number_of_loops (cfun) <= 1)
return 0;
return tree_ssa_lim ();
static unsigned int
tree_ssa_loop_unswitch (void)
{
- if (number_of_loops () <= 1)
+ if (number_of_loops (cfun) <= 1)
return 0;
return tree_ssa_unswitch_loops ();
static unsigned int
tree_vectorize (void)
{
- if (number_of_loops () <= 1)
+ if (number_of_loops (cfun) <= 1)
return 0;
return vectorize_loops ();
static unsigned int
check_data_deps (void)
{
- if (number_of_loops () <= 1)
+ if (number_of_loops (cfun) <= 1)
return 0;
tree_check_data_deps ();
static unsigned int
tree_ssa_loop_ivcanon (void)
{
- if (number_of_loops () <= 1)
+ if (number_of_loops (cfun) <= 1)
return 0;
return canonicalize_induction_variables ();
static unsigned int
tree_ssa_loop_bounds (void)
{
- if (number_of_loops () <= 1)
+ if (number_of_loops (cfun) <= 1)
return 0;
estimate_numbers_of_iterations ();
static unsigned int
tree_complete_unroll (void)
{
- if (number_of_loops () <= 1)
+ if (number_of_loops (cfun) <= 1)
return 0;
return tree_unroll_loops_completely (flag_unroll_loops
loop_optimizer_init (LOOPS_NORMAL
| LOOPS_HAVE_RECORDED_EXITS);
- if (number_of_loops () > 1)
+ if (number_of_loops (cfun) > 1)
{
scev_initialize ();
ret = tree_unroll_loops_completely (optimize >= 3, false);
static unsigned
tree_parallelize_loops (void)
{
- if (number_of_loops () <= 1)
+ if (number_of_loops (cfun) <= 1)
return 0;
if (parallelize_loops ())
static unsigned int
tree_ssa_loop_prefetch (void)
{
- if (number_of_loops () <= 1)
+ if (number_of_loops (cfun) <= 1)
return 0;
return tree_ssa_prefetch_arrays ();
static unsigned int
tree_ssa_loop_ivopts (void)
{
- if (number_of_loops () <= 1)
+ if (number_of_loops (cfun) <= 1)
return 0;
tree_ssa_iv_optimize ();
}
/* Update SSA form here, we are called as non-pass as well. */
- if (number_of_loops () > 1 && loops_state_satisfies_p (LOOP_CLOSED_SSA))
+ 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);
loop_iterator li;
struct loop *loop;
- vect_loops_num = number_of_loops ();
+ vect_loops_num = number_of_loops (cfun);
/* Bail out if there are no loops. */
if (vect_loops_num <= 1)
{
loop_vec_info loop_vinfo;
- loop = get_loop (i);
+ loop = get_loop (cfun, i);
if (!loop)
continue;
loop_vinfo = (loop_vec_info) loop->aux;