+2015-10-21 Aditya Kumar <aditya.k7@samsung.com>
+
+ * graphite-poly.h (struct dr_info): Removed conversion constructor.
+ (struct scop): Renamed scop::region to scop::scop_info
+ (scop_set_region): Same.
+ (SCOP_REGION): Removed
+ (SCOP_CONTEXT): Removed.
+ (POLY_SCOP_P): Removed.
+ * graphite-isl-ast-to-gimple.c (translate_isl_ast_node_user):
+ Rename scop->region to scop->scop_info.
+ (add_parameters_to_ivs_params): Same.
+ (graphite_regenerate_ast_isl): Same.
+ * graphite-poly.c (new_scop): Same.
+ (free_scop): Same.
+ (print_scop_params): Same.
+ * graphite-scop-detection.c (scop_detection::remove_subscops): Same.
+ (scop_detection::remove_intersecting_scops): Use pointer to sese_l.
+ (dot_all_scops_1): Rename scop->region to scop->scop_info.
+ (scop_detection::nb_pbbs_in_loops): Same.
+ (find_scop_parameters): Same.
+ (try_generate_gimple_bb): Same.
+ (gather_bbs::before_dom_children): Same.
+ (gather_bbs::after_dom_children): Same.
+ (build_scops): Same.
+ * graphite-sese-to-poly.c (build_scop_scattering): Same.
+ (extract_affine_chrec): Same.
+ (extract_affine): Same.
+ (set_scop_parameter_dim): Same.
+ (build_loop_iteration_domains): Same.
+ (create_pw_aff_from_tree): Same.
+ (add_param_constraints): Same.
+ (build_scop_iteration_domain): Same.
+ (build_scop_drs): Same.
+ (analyze_drs_in_stmts): Same.
+ (insert_out_of_ssa_copy_on_edge): Same.
+ (rewrite_close_phi_out_of_ssa):Same.
+ (rewrite_reductions_out_of_ssa):Same.
+ (handle_scalar_deps_crossing_scop_limits):Same.
+ (rewrite_cross_bb_scalar_deps):Same.
+ (rewrite_cross_bb_scalar_deps_out_of_ssa):Same.
+ (build_poly_scop):Same.
+ (build_alias_set): Use pointer to dr_info.
+ * graphite.c (print_graphite_scop_statistics):
+ (graphite_transform_loops):
+ * sese.h (struct sese_l): Remove conversion constructor.
+
2015-10-11 Jan Hubicka <hubicka@ucw.cz>
PR middle-end/67966
iv_map.create (nb_loops);
iv_map.safe_grow_cleared (nb_loops);
- build_iv_mapping (iv_map, gbb, user_expr, ip, pbb->scop->region->region);
+ build_iv_mapping (iv_map, gbb, user_expr, ip, pbb->scop->scop_info->region);
isl_ast_expr_free (user_expr);
next_e = copy_bb_and_scalar_dependences (GBB_BB (gbb),
- pbb->scop->region, next_e,
+ pbb->scop->scop_info, next_e,
iv_map,
&graphite_regenerate_error);
iv_map.release ();
static void
add_parameters_to_ivs_params (scop_p scop, ivs_params &ip)
{
- sese_info_p region = scop->region;
+ sese_info_p region = scop->scop_info;
unsigned nb_parameters = isl_set_dim (scop->param_context, isl_dim_param);
gcc_assert (nb_parameters == SESE_PARAMS (region).length ());
unsigned i;
graphite_regenerate_ast_isl (scop_p scop)
{
loop_p context_loop;
- sese_info_p region = scop->region;
+ sese_info_p region = scop->scop_info;
ifsese if_region = NULL;
isl_ast_node *root_node;
ivs_params ip;
scop->may_waw_no_source = NULL;
scop_set_region (scop, region);
scop->pbbs.create (3);
- POLY_SCOP_P (scop) = false;
+ scop->poly_scop_p = false;
scop->drs.create (3);
return scop;
poly_bb_p pbb;
remove_gbbs_in_scop (scop);
- free_sese_info (SCOP_REGION (scop));
+ free_sese_info (scop->scop_info);
FOR_EACH_VEC_ELT (scop->pbbs, i, pbb)
free_poly_bb (pbb);
void
print_scop_params (FILE *file, scop_p scop)
{
- if (SESE_PARAMS (SCOP_REGION (scop)).is_empty ())
+ if (SESE_PARAMS (scop->scop_info).is_empty ())
return;
int i;
tree t;
fprintf (file, "parameters (");
- FOR_EACH_VEC_ELT (SESE_PARAMS (SCOP_REGION (scop)), i, t)
+ FOR_EACH_VEC_ELT (SESE_PARAMS (scop->scop_info), i, t)
{
print_generic_expr (file, t, 0);
fprintf (file, ", ");
dr_info (data_reference_p dr, int alias_set, poly_bb_p pbb)
: dr (dr), alias_set (alias_set), pbb (pbb) {}
- /* A simpler constructor to be able to push these objects in a vec. */
- dr_info (int i) : dr (NULL), alias_set (-1), pbb (NULL)
- {
- gcc_assert (i == 0);
- }
-
/* Assignment operator, to be able to iterate over a vec of these objects. */
const dr_info &
operator= (const dr_info &p)
struct scop
{
/* A SCOP is defined as a SESE region. */
- sese_info_p region;
+ sese_info_p scop_info;
/* Number of parameters in SCoP. */
graphite_dim_t nb_params;
bool poly_scop_p;
};
-#define SCOP_REGION(S) (S->region)
-#define SCOP_CONTEXT(S) (NULL)
-#define POLY_SCOP_P(S) (S->poly_scop_p)
-
extern scop_p new_scop (edge, edge);
extern void free_scop (scop_p);
extern gimple_poly_bb_p new_gimple_poly_bb (basic_block, vec<data_reference_p>);
static inline void
scop_set_region (scop_p scop, sese_info_p region)
{
- scop->region = region;
+ scop->scop_info = region;
}
/* Returns the number of parameters for SCOP. */
vec<sese_l> scops;
};
-sese_l scop_detection::invalid_sese (0);
+sese_l scop_detection::invalid_sese (NULL, NULL);
/* Return an sese_l around the LOOP. */
scop_detection::remove_subscops (sese_l s1)
{
int j;
- sese_l s2 (0);
+ sese_l *s2;
FOR_EACH_VEC_ELT_REVERSE (scops, j, s2)
{
- if (subsumes (s1, s2))
+ if (subsumes (s1, *s2))
{
DEBUG_PRINT (dp << "\nRemoving sub-SCoP";
- print_sese (dump_file, s2));
+ print_sese (dump_file, *s2));
scops.unordered_remove (j);
}
}
scop_detection::remove_intersecting_scops (sese_l s1)
{
int j;
- sese_l s2 (0);
+ sese_l *s2;
FOR_EACH_VEC_ELT_REVERSE (scops, j, s2)
{
- if (intersects (s1, s2))
+ if (intersects (s1, *s2))
{
DEBUG_PRINT (dp << "\nRemoving intersecting SCoP";
- print_sese (dump_file, s2); dp << "Intersects with:";
+ print_sese (dump_file, *s2); dp << "Intersects with:";
print_sese (dump_file, s1));
scops.unordered_remove (j);
}
/* Select color for SCoP. */
FOR_EACH_VEC_ELT (scops, i, scop)
{
- sese_l region = scop->region->region;
+ sese_l region = scop->scop_info->region;
if (bb_in_sese_p (bb, region) || (region.exit->dest == bb)
|| (region.entry->dest == bb))
{
int res = 0;
FOR_EACH_VEC_ELT (scop->pbbs, i, pbb)
- if (loop_in_sese_p (gbb_loop (PBB_BLACK_BOX (pbb)), scop->region->region))
+ if (loop_in_sese_p (gbb_loop (PBB_BLACK_BOX (pbb)), scop->scop_info->region))
res++;
return res;
find_scop_parameters (scop_p scop)
{
unsigned i;
- sese_info_p region = scop->region;
+ sese_info_p region = scop->scop_info;
struct loop *loop;
/* Find the parameters used in the loop bounds. */
{
vec<data_reference_p> drs;
drs.create (5);
- sese_l region = scop->region->region;
+ sese_l region = scop->scop_info->region;
loop_p nest = outermost_loop_in_sese (region, bb);
loop_p loop = bb->loop_father;
void
gather_bbs::before_dom_children (basic_block bb)
{
- if (!bb_in_sese_p (bb, scop->region->region))
+ if (!bb_in_sese_p (bb, scop->scop_info->region))
return;
gcond *stmt = single_pred_cond_non_loop_exit (bb);
cases.safe_push (NULL);
}
- scop->region->bbs.safe_push (bb);
+ scop->scop_info->bbs.safe_push (bb);
gimple_poly_bb_p gbb = try_generate_gimple_bb (scop, bb);
GBB_CONDITIONS (gbb) = conditions.copy ();
void
gather_bbs::after_dom_children (basic_block bb)
{
- if (!bb_in_sese_p (bb, scop->region->region))
+ if (!bb_in_sese_p (bb, scop->scop_info->region))
return;
if (single_pred_cond_non_loop_exit (bb))
/* Now create scops from the lightweight SESEs. */
vec<sese_l> scops_l = sb.get_scops ();
int i;
- sese_l s (0);
+ sese_l *s;
FOR_EACH_VEC_ELT (scops_l, i, s)
{
- scop_p scop = new_scop (s.entry, s.exit);
+ scop_p scop = new_scop (s->entry, s->exit);
/* Record all basic blocks and their conditions in REGION. */
gather_bbs (CDI_DOMINATORS, scop).walk (cfun->cfg->x_entry_block_ptr);
continue;
}
- build_sese_loop_nests (scop->region);
+ build_sese_loop_nests (scop->scop_info);
find_scop_parameters (scop);
graphite_dim_t max_dim = PARAM_VALUE (PARAM_GRAPHITE_MAX_NB_SCOP_PARAMS);
int prefix = 0;
if (previous_gbb)
- prefix = nb_common_loops (scop->region->region, previous_gbb, gbb);
+ prefix = nb_common_loops (scop->scop_info->region, previous_gbb, gbb);
previous_gbb = gbb;
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 (s->region->region, get_chrec_loop (e)) - 1;
+ unsigned pos = sese_loop_depth (s->scop_info->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);
break;
case SSA_NAME:
- gcc_assert (-1 != parameter_index_in_region_1 (e, s->region)
- || !invariant_in_sese_p_rec (e, s->region->region));
+ gcc_assert (-1 != parameter_index_in_region_1 (e, s->scop_info)
+ || !invariant_in_sese_p_rec (e, s->scop_info->region));
res = extract_affine_name (s, e, space);
break;
static void
set_scop_parameter_dim (scop_p scop)
{
- sese_info_p region = scop->region;
+ sese_info_p region = scop->scop_info;
unsigned nbp = sese_nb_params (region);
isl_space *space = isl_space_set_alloc (scop->isl_context, nbp, 0);
{
tree nb_iters = number_of_latch_executions (loop);
- sese_l region = scop->region->region;
+ sese_l region = scop->scop_info->region;
gcc_assert (loop_in_sese_p (loop, region));
isl_set *inner = isl_set_copy (outer);
{
scop_p scop = PBB_SCOP (pbb);
- t = scalar_evolution_in_region (scop->region->region, pbb_loop (pbb), t);
+ t = scalar_evolution_in_region (scop->scop_info->region, pbb_loop (pbb), t);
gcc_assert (!automatically_generated_chrec_p (t));
return extract_affine (scop, t, isl_set_get_space (pbb->domain));
static void
add_param_constraints (scop_p scop, graphite_dim_t p)
{
- tree parameter = SESE_PARAMS (scop->region)[p];
+ tree parameter = SESE_PARAMS (scop->scop_info)[p];
tree type = TREE_TYPE (parameter);
tree lb = NULL_TREE;
tree ub = NULL_TREE;
static void
build_scop_iteration_domain (scop_p scop)
{
- sese_info_p region = scop->region;
+ sese_info_p region = scop->scop_info;
int nb_loops = number_of_loops (cfun);
isl_set **doms = XCNEWVEC (isl_set *, nb_loops);
{
int num_vertices = scop->drs.length ();
struct graph *g = new_graph (num_vertices);
- dr_info dr1 (0), dr2 (0);
+ dr_info *dr1, *dr2;
int i, j;
int *all_vertices;
FOR_EACH_VEC_ELT (scop->drs, i, dr1)
for (j = i+1; scop->drs.iterate (j, &dr2); j++)
- if (dr_may_alias_p (dr1.dr, dr2.dr, true))
+ if (dr_may_alias_p (dr1->dr, dr2->dr, true))
{
add_edge (g, i, j);
add_edge (g, j, i);
build_alias_set (scop);
- dr_info dri (0);
+ dr_info *dri;
FOR_EACH_VEC_ELT (scop->drs, i, dri)
- build_poly_dr (dri);
+ build_poly_dr (*dri);
}
/* Analyze all the data references of STMTS and add them to the
static void
analyze_drs_in_stmts (scop_p scop, basic_block bb, vec<gimple *> stmts)
{
- sese_l region = scop->region->region;
+ sese_l region = scop->scop_info->region;
if (!bb_in_sese_p (bb, region))
return;
gsi_commit_edge_inserts ();
basic_block bb = gimple_bb (stmt);
- if (!bb_in_sese_p (bb, scop->region->region))
+ if (!bb_in_sese_p (bb, scop->scop_info->region))
return;
if (!gbb_from_bb (bb))
static void
rewrite_close_phi_out_of_ssa (scop_p scop, gimple_stmt_iterator *psi)
{
- sese_l region = scop->region->region;
+ sese_l region = scop->scop_info->region;
gimple *phi = gsi_stmt (*psi);
tree res = gimple_phi_result (phi);
basic_block bb = gimple_bb (phi);
rewrite_reductions_out_of_ssa (scop_p scop)
{
basic_block bb;
- sese_l region = scop->region->region;
+ sese_l region = scop->scop_info->region;
FOR_EACH_BB_FN (bb, cfun)
if (bb_in_sese_p (bb, region))
tree var = create_tmp_reg (TREE_TYPE (def));
tree new_name = make_ssa_name (var, stmt);
bool needs_copy = false;
- sese_l region = scop->region->region;
+ sese_l region = scop->scop_info->region;
imm_use_iterator imm_iter;
gimple *use_stmt;
static bool
rewrite_cross_bb_scalar_deps (scop_p scop, gimple_stmt_iterator *gsi)
{
- sese_l region = scop->region->region;
+ sese_l region = scop->scop_info->region;
gimple *stmt = gsi_stmt (*gsi);
imm_use_iterator imm_iter;
tree def;
{
basic_block bb;
gimple_stmt_iterator psi;
- sese_l region = scop->region->region;
+ sese_l region = scop->scop_info->region;
bool changed = false;
/* Create an extra empty BB after the scop. */
/* This SCoP has been translated to the polyhedral
representation. */
- POLY_SCOP_P (scop) = true;
+ scop->poly_scop_p = true;
}
#endif /* HAVE_isl */
gimple_stmt_iterator psi;
loop_p loop = bb->loop_father;
- if (!bb_in_sese_p (bb, scop->region->region))
+ if (!bb_in_sese_p (bb, scop->scop_info->region))
continue;
n_bbs++;
n_p_stmts += bb->count;
}
- if (loop->header == bb && loop_in_sese_p (loop, scop->region->region))
+ if (loop->header == bb && loop_in_sese_p (loop, scop->scop_info->region))
{
n_loops++;
n_p_loops += bb->count;
fprintf (file, "\nFunction Name: %s\n", current_function_name ());
- edge scop_begin = scop->region->region.entry;
- edge scop_end = scop->region->region.exit;
+ edge scop_begin = scop->scop_info->region.entry;
+ edge scop_end = scop->scop_info->region.exit;
fprintf (file, "\nSCoP (entry_edge (bb_%d, bb_%d), ",
scop_begin->src->index, scop_begin->dest->index);
if (dump_file && dump_flags)
print_scop (dump_file, scop);
- if (POLY_SCOP_P (scop)
+ if (scop->poly_scop_p
&& apply_poly_transforms (scop)
&& graphite_regenerate_ast_isl (scop))
need_cfg_cleanup_p = true;
{
sese_l (edge e, edge x) : entry (e), exit (x) {}
- /* This is to push objects of sese_l in a vec. */
- sese_l (int i) : entry (NULL), exit (NULL) { gcc_assert (i == 0); }
-
operator bool () const { return entry && exit; }
const sese_l &