Hello, In the isl library used by Graphite, isl_val replaced isl_val (that become obsolete).
This patch implements the required changes in Graphite. No regressions for c/c++/fortran on x86-64 Linux. Mircea Index: gcc/graphite-interchange.c =================================================================== --- gcc/graphite-interchange.c (revision 212311) +++ gcc/graphite-interchange.c (working copy) @@ -29,6 +29,18 @@ #include <isl/map.h> #include <isl/union_map.h> #include <isl/ilp.h> +#include <isl/val.h> +/* For C++ linkage of C functions. + Missing from isl/val_gmp.h in isl 0.12 versions. + Appearing in isl/val_gmp.h in isl 0.13. + To be removed when passing to isl 0.13. */ +#if defined(__cplusplus) +extern "C" { +#endif +#include <isl/val_gmp.h> +#if defined(__cplusplus) +} +#endif #include <cloog/cloog.h> #include <cloog/isl/domain.h> #endif @@ -79,13 +91,13 @@ isl_local_space *ls = isl_local_space_from_space (isl_map_get_space (map)); unsigned offset, nsubs; int i; - isl_int size, subsize; + isl_ctx *ctx; + isl_val *size, *subsize, *size1; + res = isl_equality_alloc (ls); - isl_int_init (size); - isl_int_set_ui (size, 1); - isl_int_init (subsize); - isl_int_set_ui (subsize, 1); + ctx = isl_local_space_get_ctx (ls); + size = isl_val_int_from_ui (ctx, 1); nsubs = isl_set_dim (pdr->extent, isl_dim_set); /* -1 for the already included L dimension. */ @@ -98,18 +110,17 @@ isl_space *dc; isl_aff *aff; - res = isl_constraint_set_coefficient (res, isl_dim_out, offset + i, size); - + size1 = isl_val_copy (size); + res = isl_constraint_set_coefficient_val (res, isl_dim_out, offset + i, size); dc = isl_set_get_space (pdr->extent); aff = isl_aff_zero_on_domain (isl_local_space_from_space (dc)); aff = isl_aff_set_coefficient_si (aff, isl_dim_in, i, 1); - isl_set_max (pdr->extent, aff, &subsize); + subsize = isl_set_max_val (pdr->extent, aff); isl_aff_free (aff); - isl_int_mul (size, size, subsize); + size = isl_val_mul (size1, subsize); } - isl_int_clear (subsize); - isl_int_clear (size); + isl_val_free (size); return res; } @@ -126,7 +137,7 @@ isl_aff *aff; isl_space *dc; isl_constraint *lma, *c; - isl_int islstride; + isl_val *islstride; graphite_dim_t time_depth; unsigned offset, nt; unsigned i; @@ -239,10 +250,9 @@ aff = isl_aff_zero_on_domain (isl_local_space_from_space (dc)); aff = isl_aff_set_coefficient_si (aff, isl_dim_in, offset - 1, -1); aff = isl_aff_set_coefficient_si (aff, isl_dim_in, offset + offset - 1, 1); - isl_int_init (islstride); - isl_set_max (set, aff, &islstride); - isl_int_get_gmp (islstride, stride); - isl_int_clear (islstride); + islstride = isl_set_max_val (set, aff); + isl_val_get_num_gmp (islstride, stride); + isl_val_free (islstride); isl_aff_free (aff); isl_set_free (set); Index: gcc/graphite-poly.c =================================================================== --- gcc/graphite-poly.c (revision 212311) +++ gcc/graphite-poly.c (working copy) @@ -28,6 +28,18 @@ #include <isl/constraint.h> #include <isl/ilp.h> #include <isl/aff.h> +#include <isl/val.h> +/* For C++ linkage of C functions. + Missing from isl/val_gmp.h in isl 0.12 versions. + Appearing in isl/val_gmp.h in isl 0.13. + To be removed when passing to isl 0.13. */ +#if defined(__cplusplus) +extern "C" { +#endif +#include <isl/val_gmp.h> +#if defined(__cplusplus) +} +#endif #include <cloog/cloog.h> #include <cloog/isl/domain.h> #endif @@ -1029,11 +1041,8 @@ isl_set *transdomain; isl_space *dc; isl_aff *aff; - isl_int isllb, islub; + isl_val *isllb, *islub; - isl_int_init (isllb); - isl_int_init (islub); - /* Map the iteration domain through the current scatter, and work on the resulting set. */ transdomain = isl_set_apply (isl_set_copy (pbb->domain), @@ -1046,15 +1055,14 @@ /* And find the min/max for that function. */ /* XXX isl check results? */ - isl_set_min (transdomain, aff, &isllb); - isl_set_max (transdomain, aff, &islub); + isllb = isl_set_min_val (transdomain, aff); + islub = isl_set_max_val (transdomain, aff); - isl_int_sub (islub, islub, isllb); - isl_int_add_ui (islub, islub, 1); - isl_int_get_gmp (islub, res); + islub = isl_val_sub (islub, isllb); + islub = isl_val_add_ui (islub, 1); + isl_val_get_num_gmp (islub, res); - isl_int_clear (isllb); - isl_int_clear (islub); + isl_val_free (islub); isl_aff_free (aff); isl_set_free (transdomain); } Index: gcc/graphite-optimize-isl.c =================================================================== --- gcc/graphite-optimize-isl.c (revision 212311) +++ gcc/graphite-optimize-isl.c (working copy) @@ -273,7 +273,7 @@ isl_aff *Aff; int PointDimension; /* ip */ int TileDimension; /* it */ - isl_int VectorWidthMP; + isl_val *VectorWidthMP; int i; /* assert (0 <= DimToVectorize && DimToVectorize < ScheduleDimensions);*/ @@ -304,10 +304,9 @@ Aff = isl_aff_zero_on_domain (LocalSpaceRange); Aff = isl_aff_set_constant_si (Aff, VectorWidth); Aff = isl_aff_set_coefficient_si (Aff, isl_dim_in, TileDimension, 1); - isl_int_init (VectorWidthMP); - isl_int_set_si (VectorWidthMP, VectorWidth); - Aff = isl_aff_mod (Aff, VectorWidthMP); - isl_int_clear (VectorWidthMP); + + VectorWidthMP = isl_val_int_from_si (ctx, VectorWidth); + Aff = isl_aff_mod_val (Aff, VectorWidthMP); Modulo = isl_pw_aff_zero_set (isl_pw_aff_from_aff (Aff)); TilingMap = isl_map_intersect_range (TilingMap, Modulo); Index: gcc/graphite-sese-to-poly.c =================================================================== --- gcc/graphite-sese-to-poly.c (revision 212311) +++ gcc/graphite-sese-to-poly.c (working copy) @@ -26,6 +26,18 @@ #include <isl/union_map.h> #include <isl/constraint.h> #include <isl/aff.h> +#include <isl/val.h> +/* For C++ linkage of C functions. + Missing from isl/val_gmp.h in isl 0.12 versions. + Appearing in isl/val_gmp.h in isl 0.13. + To be removed when passing to isl 0.13. */ +#if defined(__cplusplus) +extern "C" { +#endif +#include <isl/val_gmp.h> +#if defined(__cplusplus) +} +#endif #include <cloog/cloog.h> #include <cloog/cloog.h> #include <cloog/isl/domain.h> @@ -480,13 +492,11 @@ int i; int nb_iterators = pbb_dim_iter_domain (pbb); int used_scattering_dimensions = nb_iterators * 2 + 1; - isl_int val; + isl_val *val; isl_space *dc, *dm; gcc_assert (scattering_dimensions >= used_scattering_dimensions); - isl_int_init (val); - dc = isl_set_get_space (pbb->domain); dm = isl_space_add_dims (isl_space_from_domain (dc), isl_dim_out, scattering_dimensions); @@ -500,12 +510,10 @@ isl_constraint *c = isl_equality_alloc (isl_local_space_from_space (isl_map_get_space (pbb->schedule))); - if (0 != isl_aff_get_coefficient (static_sched, isl_dim_in, - i / 2, &val)) - gcc_unreachable (); + val = isl_aff_get_coefficient_val (static_sched, isl_dim_in, i / 2); - isl_int_neg (val, val); - c = isl_constraint_set_constant (c, val); + val = isl_val_neg (val); + c = isl_constraint_set_constant_val (c, val); c = isl_constraint_set_coefficient_si (c, isl_dim_out, i, 1); pbb->schedule = isl_map_add_constraint (pbb->schedule, c); } @@ -519,8 +527,6 @@ } } - isl_int_clear (val); - pbb->transformed = isl_map_copy (pbb->schedule); } @@ -699,12 +705,12 @@ isl_local_space *ls = isl_local_space_from_space (isl_space_copy (space)); isl_aff *aff = isl_aff_zero_on_domain (ls); isl_set *dom = isl_set_universe (space); - isl_int v; + isl_val *v; + isl_ctx *ct; - isl_int_init (v); - isl_int_set_gmp (v, g); - aff = isl_aff_add_constant (aff, v); - isl_int_clear (v); + ct = isl_aff_get_ctx (aff); + v = isl_val_int_from_gmp (ct, g); + aff = isl_aff_add_constant_val (aff, v); return isl_pw_aff_alloc (dom, aff); } @@ -727,19 +733,17 @@ /* Compute pwaff mod 2^width. */ +extern isl_ctx *the_isl_ctx; + static isl_pw_aff * wrap (isl_pw_aff *pwaff, unsigned width) { - isl_int mod; + isl_val *mod; - isl_int_init (mod); - isl_int_set_si (mod, 1); - isl_int_mul_2exp (mod, mod, width); + mod = isl_val_int_from_ui(the_isl_ctx, width); + mod = isl_val_2exp (mod); + pwaff = isl_pw_aff_mod_val (pwaff, mod); - pwaff = isl_pw_aff_mod (pwaff, mod); - - isl_int_clear (mod); - return pwaff; } @@ -994,11 +998,10 @@ isl_space *space; isl_constraint *c; int pos = isl_set_dim (outer, isl_dim_set); - isl_int v; + isl_val *v; mpz_t g; mpz_init (g); - isl_int_init (v); inner = isl_set_add_dims (inner, isl_dim_set, 1); space = isl_set_get_space (inner); @@ -1016,8 +1019,8 @@ (isl_local_space_from_space (isl_space_copy (space))); c = isl_constraint_set_coefficient_si (c, isl_dim_set, pos, -1); tree_int_to_gmp (nb_iters, g); - isl_int_set_gmp (v, g); - c = isl_constraint_set_constant (c, v); + v = isl_val_int_from_gmp (the_isl_ctx, g); + c = isl_constraint_set_constant_val (c, v); inner = isl_set_add_constraint (inner, c); } @@ -1071,9 +1074,9 @@ c = isl_inequality_alloc (isl_local_space_from_space (isl_space_copy (space))); c = isl_constraint_set_coefficient_si (c, isl_dim_set, pos, -1); - isl_int_set_gmp (v, g); + v = isl_val_int_from_gmp (the_isl_ctx, g); mpz_clear (g); - c = isl_constraint_set_constant (c, v); + c = isl_constraint_set_constant_val (c, v); inner = isl_set_add_constraint (inner, c); } else @@ -1096,7 +1099,6 @@ isl_set_free (outer); isl_space_free (space); - isl_int_clear (v); mpz_clear (g); } @@ -1330,17 +1332,15 @@ isl_space *space = isl_set_get_space (scop->context); isl_constraint *c; mpz_t g; - isl_int v; + isl_val *v; c = isl_inequality_alloc (isl_local_space_from_space (space)); mpz_init (g); - isl_int_init (v); tree_int_to_gmp (lb, g); - isl_int_set_gmp (v, g); - isl_int_neg (v, v); + v = isl_val_int_from_gmp (the_isl_ctx, g); + v = isl_val_neg (v); mpz_clear (g); - c = isl_constraint_set_constant (c, v); - isl_int_clear (v); + c = isl_constraint_set_constant_val (c, v); c = isl_constraint_set_coefficient_si (c, isl_dim_param, p, 1); scop->context = isl_set_add_constraint (scop->context, c); @@ -1351,17 +1351,15 @@ isl_space *space = isl_set_get_space (scop->context); isl_constraint *c; mpz_t g; - isl_int v; + isl_val *v; c = isl_inequality_alloc (isl_local_space_from_space (space)); mpz_init (g); - isl_int_init (v); tree_int_to_gmp (ub, g); - isl_int_set_gmp (v, g); + v = isl_val_int_from_gmp (the_isl_ctx, g); mpz_clear (g); - c = isl_constraint_set_constant (c, v); - isl_int_clear (v); + c = isl_constraint_set_constant_val (c, v); c = isl_constraint_set_coefficient_si (c, isl_dim_param, p, -1); scop->context = isl_set_add_constraint (scop->context, c); Index: gcc/graphite-clast-to-gimple.c =================================================================== --- gcc/graphite-clast-to-gimple.c (revision 212311) +++ gcc/graphite-clast-to-gimple.c (working copy) @@ -28,6 +28,18 @@ #include <isl/constraint.h> #include <isl/ilp.h> #include <isl/aff.h> +#include <isl/val.h> +/* For C++ linkage of C functions. + Missing from isl/val_gmp.h in isl 0.12 versions. + Appearing in isl/val_gmp.h in isl 0.13. + To be removed when passing to isl 0.13. */ +#if defined(__cplusplus) +extern "C" { +#endif +#include <isl/val_gmp.h> +#if defined(__cplusplus) +} +#endif #include <cloog/cloog.h> #include <cloog/isl/domain.h> #endif @@ -871,18 +883,18 @@ static void compute_bounds_for_param (scop_p scop, int param, mpz_t low, mpz_t up) { - isl_int v; + isl_val *v; isl_aff *aff = isl_aff_zero_on_domain (isl_local_space_from_space (isl_set_get_space (scop->context))); aff = isl_aff_add_coefficient_si (aff, isl_dim_param, param, 1); - isl_int_init (v); - isl_set_min (scop->context, aff, &v); - isl_int_get_gmp (v, low); - isl_set_max (scop->context, aff, &v); - isl_int_get_gmp (v, up); - isl_int_clear (v); + v = isl_set_min_val (scop->context, aff); + isl_val_get_num_gmp (v, low); + isl_val_free (v); + v = isl_set_max_val (scop->context, aff); + isl_val_get_num_gmp (v, up); + isl_val_free (v); isl_aff_free (aff); } @@ -901,8 +913,7 @@ isl_set *domain; isl_aff *dimension; isl_local_space *local_space; - isl_int isl_value; - enum isl_lp_result lp_result; + isl_val *isl_value; domain = isl_set_copy (isl_set_from_cloog_domain (loop->domain)); local_space = isl_local_space_from_space (isl_set_get_space (domain)); @@ -911,17 +922,12 @@ isl_set_dim (domain, isl_dim_set) - 1, 1); - isl_int_init (isl_value); - - lp_result = isl_set_min (domain, dimension, &isl_value); - assert (lp_result == isl_lp_ok); - isl_int_get_gmp (isl_value, low); - - lp_result = isl_set_max (domain, dimension, &isl_value); - assert (lp_result == isl_lp_ok); - isl_int_get_gmp (isl_value, up); - - isl_int_clear (isl_value); + isl_value = isl_set_min_val (domain, dimension); + isl_val_get_num_gmp (isl_value, low); + isl_val_free (isl_value); + isl_value = isl_set_max_val (domain, dimension); + isl_val_get_num_gmp (isl_value, up); + isl_val_free (isl_value); isl_set_free (domain); isl_aff_free (dimension); }
2014-07-06 Mircea Namolaru <mircea.namol...@inria.fr> Replacement of isl-int by isl_val * graphite-clast-to-gimple.c: include isl/val.h, isl/val_gmp.h (compute_bounds_for_param): use isl_val instead of isl_int (compute_bounds_for_loop): likewise * graphite-interchange.c: include isl/val.h, isl/val_gmp.h (build_linearized_memory_access): use isl_val instead of isl_int (pdr_stride_in_loop): likewise * graphite-optimize-isl.c: (getPrevectorMap): use isl_val instead of isl_int * graphite-poly.c: (pbb_number_of_iterations_at_time): use ils_val instead of isl_int graphite-sese-to-poly.c: include isl/val.h, isl/val_gmp.h (extern the_isl_ctx): declare (build_pbb_scattering_polyhedrons): use isl_val instead of isl_int (extract_affine_gmp): likewise (wrap): likewise (build_loop_iteration_domains): likewise (add_param_constraints): likewise (add_param_constraints): likewise