From: Aditya Kumar Date: Tue, 6 Oct 2015 20:50:35 +0000 (+0000) Subject: move dr->alias_set to a helper structure X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=09fefdad6abc23aa62964bfba2a6fef12c00176b;p=gcc.git move dr->alias_set to a helper structure 2015-10-06 Aditya Kumar Sebastian Pop * graphite-poly.c (new_scop): Initialize drs. * graphite-poly.h (struct dr_info): New. (struct scop): Add drs. * graphite-sese-to-poly.c (pdr_add_alias_set): Use dr_info. (pdr_add_memory_accesses): Same. (build_poly_dr): Same. (build_alias_set): Same. (build_scop_drs): Same. (build_pbb_drs): Remove. * tree-data-ref.c (create_data_ref): Do not initialize alias_set. * tree-data-ref.h (data_reference): Remove alias_set. Co-Authored-By: Sebastian Pop From-SVN: r228545 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eac96441fe9..1b76230e430 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2015-10-06 Aditya Kumar + Sebastian Pop + + * graphite-poly.c (new_scop): Initialize drs. + * graphite-poly.h (struct dr_info): New. + (struct scop): Add drs. + * graphite-sese-to-poly.c (pdr_add_alias_set): Use dr_info. + (pdr_add_memory_accesses): Same. + (build_poly_dr): Same. + (build_alias_set): Same. + (build_scop_drs): Same. + (build_pbb_drs): Remove. + * tree-data-ref.c (create_data_ref): Do not initialize alias_set. + * tree-data-ref.h (data_reference): Remove alias_set. + 2015-10-06 Aditya Kumar Sebastian Pop diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c index 52d07650d98..ab28b7a3d69 100644 --- a/gcc/graphite-poly.c +++ b/gcc/graphite-poly.c @@ -322,6 +322,7 @@ new_scop (edge entry, edge exit) scop_set_region (scop, region); SCOP_BBS (scop).create (3); POLY_SCOP_P (scop) = false; + scop->drs.create (3); return scop; } diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h index 418af6ecc35..37a1755dc40 100644 --- a/gcc/graphite-poly.h +++ b/gcc/graphite-poly.h @@ -366,6 +366,42 @@ pbb_set_black_box (poly_bb_p pbb, gimple_poly_bb_p black_box) pbb->black_box = black_box; } +/* A helper structure to keep track of data references, polyhedral BBs, and + alias sets. */ + +struct dr_info +{ + /* The data reference. */ + data_reference_p dr; + + /* ALIAS_SET is the SCC number assigned by a graph_dfs of the alias graph. -1 + is an invalid alias set. */ + int alias_set; + + /* The polyhedral BB containing this DR. */ + poly_bb_p pbb; + + /* Construct a DR_INFO from a data reference DR, an ALIAS_SET, and a PBB. */ + 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) + { + dr = p.dr; + alias_set = p.alias_set; + pbb = p.pbb; + return *this; + } +}; + /* A SCOP is a Static Control Part of the program, simple enough to be represented in polyhedral form. */ struct scop @@ -381,6 +417,9 @@ struct scop representation. */ vec bbs; + /* All the data references in this scop. */ + vec drs; + /* The context describes known restrictions concerning the parameters and relations in between the parameters. diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index 40b598d0edf..e61e0bf1b8c 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -930,11 +930,11 @@ build_scop_iteration_domain (scop_p scop) domain. */ static isl_map * -pdr_add_alias_set (isl_map *acc, data_reference_p dr) +pdr_add_alias_set (isl_map *acc, dr_info &dri) { isl_constraint *c = isl_equality_alloc (isl_local_space_from_space (isl_map_get_space (acc))); - c = isl_constraint_set_constant_si (c, -dr->alias_set); + c = isl_constraint_set_constant_si (c, -dri.alias_set); c = isl_constraint_set_coefficient_si (c, isl_dim_out, 0, 1); return isl_map_add_constraint (acc, c); @@ -968,8 +968,10 @@ set_index (isl_map *map, int pos, isl_pw_aff *index) PBB is the poly_bb_p that contains the data reference DR. */ static isl_map * -pdr_add_memory_accesses (isl_map *acc, data_reference_p dr, poly_bb_p pbb) +pdr_add_memory_accesses (isl_map *acc, dr_info &dri) { + data_reference_p dr = dri.dr; + poly_bb_p pbb = dri.pbb; int i, nb_subscripts = DR_NUM_DIMENSIONS (dr); scop_p scop = PBB_SCOP (pbb); @@ -1056,10 +1058,12 @@ pdr_add_data_dimensions (isl_set *subscript_sizes, scop_p scop, /* Build data accesses for DR in PBB. */ static void -build_poly_dr (data_reference_p dr, poly_bb_p pbb) +build_poly_dr (dr_info &dri) { isl_map *acc; isl_set *subscript_sizes; + poly_bb_p pbb = dri.pbb; + data_reference_p dr = dri.dr; scop_p scop = PBB_SCOP (pbb); { @@ -1072,19 +1076,18 @@ build_poly_dr (data_reference_p dr, poly_bb_p pbb) acc = isl_map_set_tuple_id (acc, isl_dim_out, isl_id_for_dr (scop, dr)); } - acc = pdr_add_alias_set (acc, dr); - acc = pdr_add_memory_accesses (acc, dr, pbb); + acc = pdr_add_alias_set (acc, dri); + acc = pdr_add_memory_accesses (acc, dri); { isl_id *id = isl_id_for_dr (scop, dr); int nb = 1 + DR_NUM_DIMENSIONS (dr); isl_space *space = isl_space_set_alloc (scop->isl_context, 0, nb); - int alias_set_num = dr->alias_set; space = isl_space_set_tuple_id (space, isl_dim_set, id); subscript_sizes = isl_set_nat_universe (space); subscript_sizes = isl_set_fix_si (subscript_sizes, isl_dim_set, 0, - alias_set_num); + dri.alias_set); subscript_sizes = pdr_add_data_dimensions (subscript_sizes, scop, dr); } @@ -1096,17 +1099,17 @@ build_poly_dr (data_reference_p dr, poly_bb_p pbb) /* Compute alias-sets for all data references in DRS. */ static void -build_alias_set (vec drs) +build_alias_set (scop_p scop) { - int num_vertices = drs.length (); + int num_vertices = scop->drs.length (); struct graph *g = new_graph (num_vertices); - data_reference_p dr1, dr2; + dr_info dr1 (0), dr2 (0); int i, j; int *all_vertices; - FOR_EACH_VEC_ELT (drs, i, dr1) - for (j = i+1; drs.iterate (j, &dr2); j++) - if (dr_may_alias_p (dr1, dr2, true)) + 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)) { add_edge (g, i, j); add_edge (g, j, i); @@ -1120,30 +1123,17 @@ build_alias_set (vec drs) free (all_vertices); for (i = 0; i < g->n_vertices; i++) - drs[i]->alias_set = g->vertices[i].component + 1; + scop->drs[i].alias_set = g->vertices[i].component + 1; free_graph (g); } -/* Build the data references for PBB. */ - -static void -build_pbb_drs (poly_bb_p pbb) -{ - int j; - data_reference_p dr; - vec gbb_drs = GBB_DATA_REFS (PBB_BLACK_BOX (pbb)); - - FOR_EACH_VEC_ELT (gbb_drs, j, dr) - build_poly_dr (dr, pbb); -} - /* Build data references in SCOP. */ static void build_scop_drs (scop_p scop) { - int i; + int i, j; poly_bb_p pbb; /* Remove all the PBBs that do not have data references: these basic @@ -1157,16 +1147,17 @@ build_scop_drs (scop_p scop) i--; } - auto_vec drs; + data_reference_p dr; FOR_EACH_VEC_ELT (SCOP_BBS (scop), i, pbb) - drs.safe_splice (GBB_DATA_REFS (PBB_BLACK_BOX (pbb))); - - build_alias_set (drs); + if (pbb) + FOR_EACH_VEC_ELT (GBB_DATA_REFS (PBB_BLACK_BOX (pbb)), j, dr) + scop->drs.safe_push (dr_info (dr, -1, pbb)); - FOR_EACH_VEC_ELT (SCOP_BBS (scop), i, pbb) - build_pbb_drs (pbb); + build_alias_set (scop); - drs.release (); + dr_info dri (0); + FOR_EACH_VEC_ELT (scop->drs, i, dri) + build_poly_dr (dri); } /* Analyze all the data references of STMTS and add them to the diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 0ffa1db5d87..e7087d7ebec 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -1080,7 +1080,6 @@ create_data_ref (loop_p nest, loop_p loop, tree memref, gimple *stmt, DR_STMT (dr) = stmt; DR_REF (dr) = memref; DR_IS_READ (dr) = is_read; - dr->alias_set = 0; dr_analyze_innermost (dr, nest); dr_analyze_indices (dr, nest, loop); diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h index e6f82ff86be..4c9e3574d1d 100644 --- a/gcc/tree-data-ref.h +++ b/gcc/tree-data-ref.h @@ -127,9 +127,6 @@ struct data_reference /* Alias information for the data reference. */ struct dr_alias alias; - - /* The alias set for this data reference. */ - int alias_set; }; #define DR_STMT(DR) (DR)->stmt