From d37fc3aa4aae5adf437a4d0b6370dc24759e5689 Mon Sep 17 00:00:00 2001 From: Aditya Kumar Date: Wed, 21 Oct 2015 18:53:17 +0000 Subject: Refactoring sese.h and graphite-poly.h Rename scop->region to scop->scop_info Removed conversion constructors for sese_l and dr_info. Removed macros. No functional changed intended. Passes regtest and bootstrap. gcc/ChangeLog: 2015-19-10 Aditya Kumar * 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. From-SVN: r229135 --- gcc/ChangeLog | 46 ++++++++++++++++++++++++++++++++++++++++ gcc/graphite-isl-ast-to-gimple.c | 8 +++---- gcc/graphite-poly.c | 8 +++---- gcc/graphite-poly.h | 14 ++---------- gcc/graphite-scop-detection.c | 34 ++++++++++++++--------------- gcc/graphite-sese-to-poly.c | 42 ++++++++++++++++++------------------ gcc/graphite.c | 10 ++++----- gcc/sese.h | 3 --- 8 files changed, 99 insertions(+), 66 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2663102..cfd6a13 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,49 @@ +2015-10-21 Aditya Kumar + + * 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 PR middle-end/67966 diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c index 2f2e2ba..7f99bce 100644 --- a/gcc/graphite-isl-ast-to-gimple.c +++ b/gcc/graphite-isl-ast-to-gimple.c @@ -786,10 +786,10 @@ translate_isl_ast_node_user (__isl_keep isl_ast_node *node, 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 (); @@ -909,7 +909,7 @@ print_isl_ast_node (FILE *file, __isl_keep isl_ast_node *node, 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; @@ -1144,7 +1144,7 @@ bool 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; diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c index 0d1dc63..eb76f05 100644 --- a/gcc/graphite-poly.c +++ b/gcc/graphite-poly.c @@ -306,7 +306,7 @@ new_scop (edge entry, edge exit) 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; @@ -321,7 +321,7 @@ free_scop (scop_p 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); @@ -475,13 +475,13 @@ print_pbb (FILE *file, poly_bb_p 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, ", "); diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h index 63fdb3b..721e914 100644 --- a/gcc/graphite-poly.h +++ b/gcc/graphite-poly.h @@ -387,12 +387,6 @@ struct dr_info 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) @@ -409,7 +403,7 @@ struct dr_info 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; @@ -453,10 +447,6 @@ struct scop 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); @@ -471,7 +461,7 @@ extern bool apply_poly_transforms (scop_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. */ diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c index 6c0987d..3ce4ff1 100644 --- a/gcc/graphite-scop-detection.c +++ b/gcc/graphite-scop-detection.c @@ -491,7 +491,7 @@ private: vec scops; }; -sese_l scop_detection::invalid_sese (0); +sese_l scop_detection::invalid_sese (NULL, NULL); /* Return an sese_l around the LOOP. */ @@ -888,13 +888,13 @@ void 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); } } @@ -923,13 +923,13 @@ void 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); } @@ -1273,7 +1273,7 @@ dot_all_scops_1 (FILE *file, vec scops) /* 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)) { @@ -1482,7 +1482,7 @@ scop_detection::nb_pbbs_in_loops (scop_p scop) 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; @@ -1623,7 +1623,7 @@ static void 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. */ @@ -1655,7 +1655,7 @@ try_generate_gimple_bb (scop_p scop, basic_block bb) { vec 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; @@ -1700,7 +1700,7 @@ gather_bbs::gather_bbs (cdi_direction direction, scop_p scop) 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); @@ -1717,7 +1717,7 @@ gather_bbs::before_dom_children (basic_block 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 (); @@ -1733,7 +1733,7 @@ gather_bbs::before_dom_children (basic_block bb) 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)) @@ -1760,10 +1760,10 @@ build_scops (vec *scops) /* Now create scops from the lightweight SESEs. */ vec 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); @@ -1777,7 +1777,7 @@ build_scops (vec *scops) 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); diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index 261e67d..d75e6a2 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -335,7 +335,7 @@ build_scop_scattering (scop_p scop) 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; @@ -357,7 +357,7 @@ extract_affine_chrec (scop_p s, tree e, __isl_take isl_space *space) 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); @@ -539,8 +539,8 @@ extract_affine (scop_p s, tree e, __isl_take isl_space *space) 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; @@ -571,7 +571,7 @@ extract_affine (scop_p s, tree e, __isl_take isl_space *space) 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); @@ -594,7 +594,7 @@ build_loop_iteration_domains (scop_p scop, struct loop *loop, { 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); @@ -704,7 +704,7 @@ create_pw_aff_from_tree (poly_bb_p pbb, tree t) { 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)); @@ -818,7 +818,7 @@ add_conditions_to_constraints (scop_p scop) 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; @@ -892,7 +892,7 @@ build_scop_context (scop_p scop) 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); @@ -1103,13 +1103,13 @@ build_alias_set (scop_p scop) { 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); @@ -1155,9 +1155,9 @@ build_scop_drs (scop_p scop) 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 @@ -1166,7 +1166,7 @@ build_scop_drs (scop_p scop) static void analyze_drs_in_stmts (scop_p scop, basic_block bb, vec stmts) { - sese_l region = scop->region->region; + sese_l region = scop->scop_info->region; if (!bb_in_sese_p (bb, region)) return; @@ -1283,7 +1283,7 @@ insert_out_of_ssa_copy_on_edge (scop_p scop, edge e, tree res, tree expr) 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)) @@ -1365,7 +1365,7 @@ propagate_expr_outside_region (tree def, tree expr, sese_l ®ion) 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); @@ -1498,7 +1498,7 @@ static void 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)) @@ -1563,7 +1563,7 @@ handle_scalar_deps_crossing_scop_limits (scop_p scop, tree def, gimple *stmt) 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; @@ -1601,7 +1601,7 @@ handle_scalar_deps_crossing_scop_limits (scop_p scop, tree def, gimple *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; @@ -1686,7 +1686,7 @@ rewrite_cross_bb_scalar_deps_out_of_ssa (scop_p scop) { 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. */ @@ -1729,6 +1729,6 @@ build_poly_scop (scop_p scop) /* This SCoP has been translated to the polyhedral representation. */ - POLY_SCOP_P (scop) = true; + scop->poly_scop_p = true; } #endif /* HAVE_isl */ diff --git a/gcc/graphite.c b/gcc/graphite.c index 230b42e..808665f 100644 --- a/gcc/graphite.c +++ b/gcc/graphite.c @@ -144,7 +144,7 @@ print_graphite_scop_statistics (FILE* file, scop_p scop) 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++; @@ -162,7 +162,7 @@ print_graphite_scop_statistics (FILE* file, scop_p scop) 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; @@ -171,8 +171,8 @@ print_graphite_scop_statistics (FILE* file, scop_p scop) 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); @@ -334,7 +334,7 @@ graphite_transform_loops (void) 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; diff --git a/gcc/sese.h b/gcc/sese.h index d429d58..f2dd55e 100644 --- a/gcc/sese.h +++ b/gcc/sese.h @@ -30,9 +30,6 @@ struct sese_l { 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 & -- cgit v1.1