Richi has asked the we break the wide-int patch so that the individual port and 
front end maintainers can review their parts without have to go through the 
entire patch.    This patch covers the graphite code.

Ok?

        * graphite-clast-to-gimple.c
        (gmp_cst_to_tree): Use wide-int interfaces.
        * graphite-sese-to-poly.c
        (tree_int_to_gmp): Use wide-int interfaces.
        (build_loop_iteration_domains): Likewise.


diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index ad3e1dc..4d27335 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -70,14 +70,13 @@ gmp_cst_to_tree (tree type, mpz_t val)
 {
   tree t = type ? type : integer_type_node;
   mpz_t tmp;
-  double_int di;
 
   mpz_init (tmp);
   mpz_set (tmp, val);
-  di = mpz_get_double_int (t, tmp, true);
+  wide_int wi = wi::from_mpz (t, tmp, true);
   mpz_clear (tmp);
 
-  return double_int_to_tree (t, di);
+  return wide_int_to_tree (t, wi);
 }
 
 /* Sets RES to the min of V1 and V2.  */
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 544ea93..efe14b3 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -69,8 +69,7 @@ along with GCC; see the file COPYING3.  If not see
 static inline void
 tree_int_to_gmp (tree t, mpz_t res)
 {
-  double_int di = tree_to_double_int (t);
-  mpz_set_double_int (res, di, TYPE_UNSIGNED (TREE_TYPE (t)));
+  wi::to_mpz (t, res, TYPE_SIGN (TREE_TYPE (t)));
 }
 
 /* Returns the index of the PHI argument defined in the outermost
@@ -1021,7 +1020,7 @@ build_loop_iteration_domains (scop_p scop, struct loop 
*loop,
   /* loop_i <= expr_nb_iters */
   else if (!chrec_contains_undetermined (nb_iters))
     {
-      double_int nit;
+      widest_int nit;
       isl_pw_aff *aff;
       isl_set *valid;
       isl_local_space *ls;
@@ -1057,7 +1056,7 @@ build_loop_iteration_domains (scop_p scop, struct loop 
*loop,
          isl_constraint *c;
 
          mpz_init (g);
-         mpz_set_double_int (g, nit, false);
+         wi::to_mpz (nit, g, SIGNED);
          mpz_sub_ui (g, g, 1);
          approx = extract_affine_gmp (g, isl_set_get_space (inner));
          x = isl_pw_aff_ge_set (approx, aff);

Reply via email to