Commit 8e4dc590 by Aditya Kumar Committed by Sebastian Pop

Move declarations, assign types, renaming.

1. Move declarations near the assignment/usage.
2. Assign type to members which were void*.
3. Rename scop->context to scop::param_context, and scop::ctx to
scop::isl_context

No functional changes intended. Passes regtest and bootstrap.

gcc/ChangeLog:

2015-10-05  Aditya Kumar  <aditya.k7@samsung.com>

        * graphite-dependences.c (scop_get_reads): Renamed scop->context to scop->param_context.
        (scop_get_must_writes): Same.
        (scop_get_may_writes): Same.
        (scop_get_original_schedule): Same.
        (scop_get_transformed_schedule): Same.
        (subtract_commutative_associative_deps): Same.
        * graphite-isl-ast-to-gimple.c (add_parameters_to_ivs_params): Same.
        (generate_isl_context): Same.
        (generate_isl_schedule): Same.
        (scop_to_isl_ast): Same.
        (graphite_regenerate_ast_isl): Same.
        * graphite-optimize-isl.c (scop_get_domains): Same.
        (optimize_isl): Renamed scop->context to scop->param_context.
        * graphite-poly.c (new_poly_bb): Change the type of argument to gimple_poly_bb_p.
        (new_scop): Renamed scop->context to scop->param_context.
        (free_scop): Same.
        (print_scop_context): Same.
        * graphite-poly.h (new_poly_dr): Change the type of argument from void* to data_reference_p.
        (struct poly_bb): Change the type of black_box to gimple_poly_bb_p.
        (new_poly_bb): Change the type of argument from void* to gimple_poly_bb_p.
        (pbb_set_black_box): Same.
        (struct scop): Rename context to param_context, ctx to isl_context.
        * graphite-scop-detection.c (scop_detection::build_scop_bbs_1): Move declarations closer to assignment.
        (find_params_in_bb): Same.
        (find_scop_parameters): Same.
        * graphite-sese-to-poly.c (unsigned ssa_name_version_typesize): Global to be used for statement IDs.
        (isl_id_for_pbb): Use ssa_name_version_typesize.
        (simple_copy_phi_p): Move declarations closer to assignment.
        (build_pbb_scattering_polyhedrons): Same.
        (build_scop_scattering): Same.
        (isl_id_for_ssa_name): Same.
        (extract_affine_name): Same.
        (extract_affine_int): Same.
        (extract_affine): Same.
        (set_scop_parameter_dim): Use renamed member.
        (build_loop_iteration_domains): Same.
        (add_param_constraints): Same.
        (build_scop_iteration_domain): Same.
        (pdr_add_data_dimensions): Same.
        (build_poly_dr): Same.
        (build_scop_drs): Move declarations closer to assignment.
        (analyze_drs_in_stmts): Same.
        (insert_out_of_ssa_copy): Same.
        (insert_out_of_ssa_copy_on_edge): Same.
        (propagate_expr_outside_region): Same.
        (rewrite_phi_out_of_ssa): Same.
        (rewrite_degenerate_phi): Same.
        (rewrite_reductions_out_of_ssa): Same.
        (rewrite_cross_bb_scalar_dependence): Same.
        (handle_scalar_deps_crossing_scop_limits): Same.
        (rewrite_cross_bb_scalar_deps): Same.
        * graphite.c (graphite_transform_loops): Use renamed member.

From-SVN: r228528
parent 07119921
2015-10-05 Aditya Kumar <aditya.k7@samsung.com>
* graphite-dependences.c (scop_get_reads): Renamed scop->context
to scop->param_context.
(scop_get_must_writes): Same.
(scop_get_may_writes): Same.
(scop_get_original_schedule): Same.
(scop_get_transformed_schedule): Same.
(subtract_commutative_associative_deps): Same.
* graphite-isl-ast-to-gimple.c (add_parameters_to_ivs_params): Same.
(generate_isl_context): Same.
(generate_isl_schedule): Same.
(scop_to_isl_ast): Same.
(graphite_regenerate_ast_isl): Same.
* graphite-optimize-isl.c (scop_get_domains): Same.
(optimize_isl): Renamed scop->context to scop->param_context.
* graphite-poly.c (new_poly_bb): Change the type of argument to
gimple_poly_bb_p.
(new_scop): Renamed scop->context to scop->param_context.
(free_scop): Same.
(print_scop_context): Same.
* graphite-poly.h (new_poly_dr): Change the type of argument from
void* to data_reference_p.
(struct poly_bb): Change the type of black_box to gimple_poly_bb_p.
(new_poly_bb): Change the type of argument from void* to
gimple_poly_bb_p.
(pbb_set_black_box): Same.
(struct scop): Rename context to param_context, ctx to isl_context.
* graphite-scop-detection.c (scop_detection::build_scop_bbs_1):
Move declarations closer to assignment.
(find_params_in_bb): Same.
(find_scop_parameters): Same.
* graphite-sese-to-poly.c (unsigned ssa_name_version_typesize):
Global to be used for statement IDs.
(isl_id_for_pbb): Use ssa_name_version_typesize.
(simple_copy_phi_p): Move declarations closer to assignment.
(build_pbb_scattering_polyhedrons): Same.
(build_scop_scattering): Same.
(isl_id_for_ssa_name): Same.
(extract_affine_name): Same.
(extract_affine_int): Same.
(extract_affine): Same.
(set_scop_parameter_dim): Use renamed member.
(build_loop_iteration_domains): Same.
(add_param_constraints): Same.
(build_scop_iteration_domain): Same.
(pdr_add_data_dimensions): Same.
(build_poly_dr): Same.
(build_scop_drs): Move declarations closer to assignment.
(analyze_drs_in_stmts): Same.
(insert_out_of_ssa_copy): Same.
(insert_out_of_ssa_copy_on_edge): Same.
(propagate_expr_outside_region): Same.
(rewrite_phi_out_of_ssa): Same.
(rewrite_degenerate_phi): Same.
(rewrite_reductions_out_of_ssa): Same.
(rewrite_cross_bb_scalar_dependence): Same.
(handle_scalar_deps_crossing_scop_limits): Same.
(rewrite_cross_bb_scalar_deps): Same.
* graphite.c (graphite_transform_loops): Use renamed member.
2015-10-06 Uros Bizjak <ubizjak@gmail.com>
PR c/65345
......@@ -79,7 +79,7 @@ scop_get_reads (scop_p scop, vec<poly_bb_p> pbbs)
int i, j;
poly_bb_p pbb;
poly_dr_p pdr;
isl_space *space = isl_set_get_space (scop->context);
isl_space *space = isl_set_get_space (scop->param_context);
isl_union_map *res = isl_union_map_empty (space);
FOR_EACH_VEC_ELT (pbbs, i, pbb)
......@@ -100,7 +100,7 @@ scop_get_must_writes (scop_p scop, vec<poly_bb_p> pbbs)
int i, j;
poly_bb_p pbb;
poly_dr_p pdr;
isl_space *space = isl_set_get_space (scop->context);
isl_space *space = isl_set_get_space (scop->param_context);
isl_union_map *res = isl_union_map_empty (space);
FOR_EACH_VEC_ELT (pbbs, i, pbb)
......@@ -121,7 +121,7 @@ scop_get_may_writes (scop_p scop, vec<poly_bb_p> pbbs)
int i, j;
poly_bb_p pbb;
poly_dr_p pdr;
isl_space *space = isl_set_get_space (scop->context);
isl_space *space = isl_set_get_space (scop->param_context);
isl_union_map *res = isl_union_map_empty (space);
FOR_EACH_VEC_ELT (pbbs, i, pbb)
......@@ -141,7 +141,7 @@ scop_get_original_schedule (scop_p scop, vec<poly_bb_p> pbbs)
{
int i;
poly_bb_p pbb;
isl_space *space = isl_set_get_space (scop->context);
isl_space *space = isl_set_get_space (scop->param_context);
isl_union_map *res = isl_union_map_empty (space);
FOR_EACH_VEC_ELT (pbbs, i, pbb)
......@@ -161,7 +161,7 @@ scop_get_transformed_schedule (scop_p scop, vec<poly_bb_p> pbbs)
{
int i;
poly_bb_p pbb;
isl_space *space = isl_set_get_space (scop->context);
isl_space *space = isl_set_get_space (scop->param_context);
isl_union_map *res = isl_union_map_empty (space);
FOR_EACH_VEC_ELT (pbbs, i, pbb)
......@@ -356,7 +356,7 @@ subtract_commutative_associative_deps (scop_p scop,
int i, j;
poly_bb_p pbb;
poly_dr_p pdr;
isl_space *space = isl_set_get_space (scop->context);
isl_space *space = isl_set_get_space (scop->param_context);
FOR_EACH_VEC_ELT (pbbs, i, pbb)
if (PBB_IS_REDUCTION (pbb))
......
......@@ -911,12 +911,13 @@ static void
add_parameters_to_ivs_params (scop_p scop, ivs_params &ip)
{
sese region = SCOP_REGION (scop);
unsigned nb_parameters = isl_set_dim (scop->context, isl_dim_param);
unsigned nb_parameters = isl_set_dim (scop->param_context, isl_dim_param);
gcc_assert (nb_parameters == SESE_PARAMS (region).length ());
unsigned i;
for (i = 0; i < nb_parameters; i++)
{
isl_id *tmp_id = isl_set_get_dim_id (scop->context, isl_dim_param, i);
isl_id *tmp_id = isl_set_get_dim_id (scop->param_context,
isl_dim_param, i);
ip[tmp_id] = SESE_PARAMS (region)[i];
}
}
......@@ -927,7 +928,7 @@ add_parameters_to_ivs_params (scop_p scop, ivs_params &ip)
static __isl_give isl_ast_build *
generate_isl_context (scop_p scop)
{
isl_set *context_isl = isl_set_params (isl_set_copy (scop->context));
isl_set *context_isl = isl_set_params (isl_set_copy (scop->param_context));
return isl_ast_build_from_context (context_isl);
}
......@@ -985,7 +986,7 @@ generate_isl_schedule (scop_p scop)
int i;
poly_bb_p pbb;
isl_union_map *schedule_isl =
isl_union_map_empty (isl_set_get_space (scop->context));
isl_union_map_empty (isl_set_get_space (scop->param_context));
FOR_EACH_VEC_ELT (SCOP_BBS (scop), i, pbb)
{
......@@ -1048,7 +1049,7 @@ scop_to_isl_ast (scop_p scop, ivs_params &ip)
an operator (< or <=) and an expression not involving the iterator.
If this option is not set, then the current loop iterator may appear several
times in the upper bound. See the isl manual for more details. */
isl_options_set_ast_build_atomic_upper_bound (scop->ctx, true);
isl_options_set_ast_build_atomic_upper_bound (scop->isl_context, true);
add_parameters_to_ivs_params (scop, ip);
isl_union_map *schedule_isl = generate_isl_schedule (scop);
......@@ -1155,7 +1156,7 @@ graphite_regenerate_ast_isl (scop_p scop)
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "\nISL AST generated by ISL: \n");
print_isl_ast_node (dump_file, root_node, scop->ctx);
print_isl_ast_node (dump_file, root_node, scop->isl_context);
fprintf (dump_file, "\n");
}
......
......@@ -55,7 +55,7 @@ scop_get_domains (scop_p scop ATTRIBUTE_UNUSED)
{
int i;
poly_bb_p pbb;
isl_space *space = isl_set_get_space (scop->context);
isl_space *space = isl_set_get_space (scop->param_context);
isl_union_set *res = isl_union_set_empty (space);
FOR_EACH_VEC_ELT (scop->bbs, i, pbb)
......@@ -294,12 +294,12 @@ bool
optimize_isl (scop_p scop)
{
#ifdef HAVE_ISL_CTX_MAX_OPERATIONS
int old_max_operations = isl_ctx_get_max_operations (scop->ctx);
int old_max_operations = isl_ctx_get_max_operations (scop->isl_context);
int max_operations = PARAM_VALUE (PARAM_MAX_ISL_OPERATIONS);
if (max_operations)
isl_ctx_set_max_operations (scop->ctx, max_operations);
isl_ctx_set_max_operations (scop->isl_context, max_operations);
#endif
isl_options_set_on_error (scop->ctx, ISL_ON_ERROR_CONTINUE);
isl_options_set_on_error (scop->isl_context, ISL_ON_ERROR_CONTINUE);
isl_union_set *domain = scop_get_domains (scop);
isl_union_map *dependences = scop_get_dependences (scop);
......@@ -324,11 +324,11 @@ optimize_isl (scop_p scop)
validity);
#endif
isl_options_set_schedule_max_constant_term (scop->ctx, CONSTANT_BOUND);
isl_options_set_schedule_maximize_band_depth (scop->ctx, 1);
isl_options_set_schedule_max_constant_term (scop->isl_context, CONSTANT_BOUND);
isl_options_set_schedule_maximize_band_depth (scop->isl_context, 1);
#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
/* ISL-0.15 or later. */
isl_options_set_schedule_serialize_sccs (scop->ctx, 1);
isl_options_set_schedule_serialize_sccs (scop->isl_context, 1);
#else
isl_options_set_schedule_fuse (scop->ctx, ISL_SCHEDULE_FUSE_MIN);
#endif
......@@ -341,12 +341,12 @@ optimize_isl (scop_p scop)
= isl_union_set_compute_schedule (domain, validity, proximity);
#endif
isl_options_set_on_error (scop->ctx, ISL_ON_ERROR_ABORT);
isl_options_set_on_error (scop->isl_context, ISL_ON_ERROR_ABORT);
#ifdef HAVE_ISL_CTX_MAX_OPERATIONS
isl_ctx_reset_operations (scop->ctx);
isl_ctx_set_max_operations (scop->ctx, old_max_operations);
if (!schedule || isl_ctx_last_error (scop->ctx) == isl_error_quota)
isl_ctx_reset_operations (scop->isl_context);
isl_ctx_set_max_operations (scop->isl_context, old_max_operations);
if (!schedule || isl_ctx_last_error (scop->isl_context) == isl_error_quota)
{
if (dump_file && dump_flags)
fprintf (dump_file, "ISL timed out at %d operations\n",
......
......@@ -137,7 +137,7 @@ apply_poly_transforms (scop_p scop)
void
new_poly_dr (poly_bb_p pbb, int dr_base_object_set,
enum poly_dr_type type, void *cdr, graphite_dim_t nb_subscripts,
enum poly_dr_type type, data_reference_p cdr, graphite_dim_t nb_subscripts,
isl_map *acc, isl_set *subscript_sizes)
{
static int id = 0;
......@@ -168,7 +168,7 @@ free_poly_dr (poly_dr_p pdr)
/* Create a new polyhedral black box. */
poly_bb_p
new_poly_bb (scop_p scop, void *black_box)
new_poly_bb (scop_p scop, gimple_poly_bb_p black_box)
{
poly_bb_p pbb = XNEW (struct poly_bb);
......@@ -325,7 +325,7 @@ new_scop (edge entry, edge exit)
sese region = new_sese (entry, exit);
scop_p scop = XNEW (struct scop);
scop->context = NULL;
scop->param_context = NULL;
scop->must_raw = NULL;
scop->may_raw = NULL;
scop->must_raw_no_source = NULL;
......@@ -361,7 +361,7 @@ free_scop (scop_p scop)
SCOP_BBS (scop).release ();
isl_set_free (scop->context);
isl_set_free (scop->param_context);
isl_union_map_free (scop->must_raw);
isl_union_map_free (scop->may_raw);
isl_union_map_free (scop->must_raw_no_source);
......@@ -620,8 +620,8 @@ print_scop_context (FILE *file, scop_p scop, int verbosity)
if (verbosity > 0)
fprintf (file, "# Context (\n");
if (scop->context)
print_isl_set (file, scop->context);
if (scop->param_context)
print_isl_set (file, scop->param_context);
if (verbosity > 0)
fprintf (file, "# )\n");
......
......@@ -59,7 +59,7 @@ struct poly_dr
int nb_refs;
/* A pointer to compiler's data reference description. */
void *compiler_dr;
data_reference_p compiler_dr;
/* A pointer to the PBB that contains this data reference. */
poly_bb_p pbb;
......@@ -199,7 +199,7 @@ struct poly_dr
#define PDR_BASE_OBJECT_SET(PDR) (PDR->dr_base_object_set)
#define PDR_NB_SUBSCRIPTS(PDR) (PDR->nb_subscripts)
void new_poly_dr (poly_bb_p, int, enum poly_dr_type, void *,
void new_poly_dr (poly_bb_p, int, enum poly_dr_type, data_reference_p,
graphite_dim_t, isl_map *, isl_set *);
void free_poly_dr (poly_dr_p);
void debug_pdr (poly_dr_p, int);
......@@ -232,7 +232,7 @@ pdr_may_write_p (poly_dr_p pdr)
struct poly_bb
{
/* Pointer to a basic block or a statement in the compiler. */
void *black_box;
gimple_poly_bb_p black_box;
/* Pointer to the SCOP containing this PBB. */
scop_p scop;
......@@ -282,7 +282,7 @@ struct poly_bb
#define PBB_DRS(PBB) (PBB->drs)
#define PBB_IS_REDUCTION(PBB) (PBB->is_reduction)
extern poly_bb_p new_poly_bb (scop_p, void *);
extern poly_bb_p new_poly_bb (scop_p, gimple_poly_bb_p);
extern void free_poly_bb (poly_bb_p);
extern void debug_loop_vec (poly_bb_p);
extern void print_pbb_domain (FILE *, poly_bb_p, int);
......@@ -366,7 +366,7 @@ pdr_scop (poly_dr_p pdr)
/* Set black box of PBB to BLACKBOX. */
static inline void
pbb_set_black_box (poly_bb_p pbb, void *black_box)
pbb_set_black_box (poly_bb_p pbb, gimple_poly_bb_p black_box)
{
pbb->black_box = black_box;
}
......@@ -399,10 +399,10 @@ struct scop
-128 >= a >= 127
0 >= b >= 65,535
c = 2a + b */
isl_set *context;
isl_set *param_context;
/* The context used internally by ISL. */
isl_ctx *ctx;
isl_ctx *isl_context;
/* The original dependence relations:
RAW are read after write dependences,
......
......@@ -1610,17 +1610,15 @@ void
scop_detection::build_scop_bbs_1 (scop_p scop, sbitmap visited, basic_block bb)
{
sese region = SCOP_REGION (scop);
vec<basic_block> dom;
poly_bb_p pbb;
if (bitmap_bit_p (visited, bb->index) || !bb_in_sese_p (bb, region))
return;
pbb = new_poly_bb (scop, try_generate_gimple_bb (scop, bb));
poly_bb_p pbb = new_poly_bb (scop, try_generate_gimple_bb (scop, bb));
SCOP_BBS (scop).safe_push (pbb);
bitmap_set_bit (visited, bb->index);
dom = get_dominated_by (CDI_DOMINATORS, bb);
vec<basic_block> dom = get_dominated_by (CDI_DOMINATORS, bb);
if (!dom.exists ())
return;
......@@ -1781,18 +1779,16 @@ scan_tree_for_params (sese s, tree e)
static void
find_params_in_bb (sese region, gimple_poly_bb_p gbb)
{
/* Find parameters in the access functions of data references. */
int i;
unsigned j;
data_reference_p dr;
gimple *stmt;
loop_p loop = GBB_BB (gbb)->loop_father;
/* Find parameters in the access functions of data references. */
FOR_EACH_VEC_ELT (GBB_DATA_REFS (gbb), i, dr)
for (j = 0; j < DR_NUM_DIMENSIONS (dr); j++)
for (unsigned j = 0; j < DR_NUM_DIMENSIONS (dr); j++)
scan_tree_for_params (region, DR_ACCESS_FN (dr, j));
/* Find parameters in conditional statements. */
gimple *stmt;
loop_p loop = GBB_BB (gbb)->loop_father;
FOR_EACH_VEC_ELT (GBB_CONDITIONS (gbb), i, stmt)
{
tree lhs = scalar_evolution_in_region (region, loop,
......@@ -1811,11 +1807,9 @@ find_params_in_bb (sese region, gimple_poly_bb_p gbb)
static void
find_scop_parameters (scop_p scop)
{
poly_bb_p pbb;
unsigned i;
sese region = SCOP_REGION (scop);
struct loop *loop;
int nbp;
/* Find the parameters used in the loop bounds. */
FOR_EACH_VEC_ELT (SESE_LOOP_NEST (region), i, loop)
......@@ -1830,10 +1824,11 @@ find_scop_parameters (scop_p scop)
}
/* Find the parameters used in data accesses. */
poly_bb_p pbb;
FOR_EACH_VEC_ELT (SCOP_BBS (scop), i, pbb)
find_params_in_bb (region, PBB_BLACK_BOX (pbb));
nbp = sese_nb_params (region);
int nbp = sese_nb_params (region);
scop_set_nb_params (scop, nbp);
SESE_ADD_PARAMS (region) = false;
}
......
......@@ -328,7 +328,7 @@ graphite_transform_loops (void)
FOR_EACH_VEC_ELT (scops, i, scop)
if (dbg_cnt (graphite_scop))
{
scop->ctx = ctx;
scop->isl_context = ctx;
build_poly_scop (scop);
if (dump_file && dump_flags)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment