Commit a0bb35c7 by Andreas Simbuerger Committed by Sebastian Pop

Resolve CLooG's value_* macros to their respective mpz_* counterparts.

2010-04-11  Andreas Simbuerger  <simbuerg@fim.uni-passau.de>

	* graphite-blocking.c (pbb_strip_mine_profitable_p): Resolve
	CLooG's value_* macros to their respective mpz_* counterparts.
	* graphite-clast-to-gimple.c (clast_to_gcc_expression): Same.
	(graphite_create_new_loop_guard): Same.
	* graphite-interchange.c (build_linearized_memory_access): Same.
	(pdr_stride_in_loop): Same.
	(memory_strides_in_loop_1): Same.
	(1st_interchange_profitable_p): Same.
	* graphite-poly.c (extend_scattering): Same.
	(psct_scattering_dim_for_loop_depth): Same.
	(pbb_number_of_iterations): Same.
	(pbb_number_of_iterations_at_time): Same.
	* graphite-poly.h (new_1st_loop): Same.
	* graphite-ppl.c (cloog_matrix_to_ppl_constraint): Same.
	(oppose_constraint): Same.
	(insert_constraint_into_matrix): Same.
	(ppl_set_inhomogeneous_gmp): Same.
	(ppl_set_coef_gmp): Same.
	(ppl_strip_loop): Same.
	(ppl_lexico_compare_linear_expressions): Same.
	(ppl_max_for_le_pointset): Same.
	(ppl_min_for_le_pointset): Same.
	(ppl_build_realtion): Same.
	* graphite-ppl.h (gmp_cst_to_tree): Same.
	(ppl_set_inhomogeneous): Same.
	(ppl_set_inhomogeneous_tree): Same.
	(ppl_set_coef): Same.
	(ppl_set_coef_tree): Same.
	* graphite-sese-to-poly.c (build_pbb_scattering_polyhedrons): Same.
	(build_scop_scattering): Same.
	(add_value_to_dim): Same.
	(scan_tree_for_params_right_scev): Same.
	(scan_tree_for_params_int): Same.
	(scan_tree_for_params): Same.
	(find_params_in_bb): Same.
	(find_scop_parameters): Same.
	(add_upper_bounds_from_estimated_nit): Same.
	(build_loop_iteration_domains): Same.
	(create_linear_expr_from_tree): Same.
	(add_condition_to_domain): Same.
	(pdr_add_memory_accesses): Same.

From-SVN: r159132
parent 14c2101d
2010-04-11 Andreas Simbuerger <simbuerg@fim.uni-passau.de>
* graphite-blocking.c (pbb_strip_mine_profitable_p): Resolve
CLooG's value_* macros to their respective mpz_* counterparts.
* graphite-clast-to-gimple.c (clast_to_gcc_expression): Same.
(graphite_create_new_loop_guard): Same.
* graphite-interchange.c (build_linearized_memory_access): Same.
(pdr_stride_in_loop): Same.
(memory_strides_in_loop_1): Same.
(1st_interchange_profitable_p): Same.
* graphite-poly.c (extend_scattering): Same.
(psct_scattering_dim_for_loop_depth): Same.
(pbb_number_of_iterations): Same.
(pbb_number_of_iterations_at_time): Same.
* graphite-poly.h (new_1st_loop): Same.
* graphite-ppl.c (cloog_matrix_to_ppl_constraint): Same.
(oppose_constraint): Same.
(insert_constraint_into_matrix): Same.
(ppl_set_inhomogeneous_gmp): Same.
(ppl_set_coef_gmp): Same.
(ppl_strip_loop): Same.
(ppl_lexico_compare_linear_expressions): Same.
(ppl_max_for_le_pointset): Same.
(ppl_min_for_le_pointset): Same.
(ppl_build_realtion): Same.
* graphite-ppl.h (gmp_cst_to_tree): Same.
(ppl_set_inhomogeneous): Same.
(ppl_set_inhomogeneous_tree): Same.
(ppl_set_coef): Same.
(ppl_set_coef_tree): Same.
* graphite-sese-to-poly.c (build_pbb_scattering_polyhedrons): Same.
(build_scop_scattering): Same.
(add_value_to_dim): Same.
(scan_tree_for_params_right_scev): Same.
(scan_tree_for_params_int): Same.
(scan_tree_for_params): Same.
(find_params_in_bb): Same.
(find_scop_parameters): Same.
(add_upper_bounds_from_estimated_nit): Same.
(build_loop_iteration_domains): Same.
(create_linear_expr_from_tree): Same.
(add_condition_to_domain): Same.
(pdr_add_memory_accesses): Same.
2010-04-05 Sebastian Pop <sebastian.pop@amd.com> 2010-04-05 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/43519 PR middle-end/43519
......
...@@ -184,13 +184,13 @@ pbb_strip_mine_profitable_p (poly_bb_p pbb, ...@@ -184,13 +184,13 @@ pbb_strip_mine_profitable_p (poly_bb_p pbb,
Value niter, strip_stride; Value niter, strip_stride;
bool res; bool res;
value_init (strip_stride); mpz_init (strip_stride);
value_init (niter); mpz_init (niter);
value_set_si (strip_stride, stride); mpz_set_si (strip_stride, stride);
pbb_number_of_iterations_at_time (pbb, psct_dynamic_dim (pbb, depth), niter); pbb_number_of_iterations_at_time (pbb, psct_dynamic_dim (pbb, depth), niter);
res = value_gt (niter, strip_stride); res = (mpz_cmp (niter, strip_stride) > 0);
value_clear (strip_stride); mpz_clear (strip_stride);
value_clear (niter); mpz_clear (niter);
return res; return res;
} }
......
...@@ -311,7 +311,7 @@ clast_to_gcc_expression (tree type, struct clast_expr *e, ...@@ -311,7 +311,7 @@ clast_to_gcc_expression (tree type, struct clast_expr *e,
if (t->var) if (t->var)
{ {
if (value_one_p (t->val)) if (mpz_cmp_si (t->val, 1) == 0)
{ {
tree name = clast_name_to_gcc (t->var, region, newivs, tree name = clast_name_to_gcc (t->var, region, newivs,
newivs_index, params_index); newivs_index, params_index);
...@@ -323,7 +323,7 @@ clast_to_gcc_expression (tree type, struct clast_expr *e, ...@@ -323,7 +323,7 @@ clast_to_gcc_expression (tree type, struct clast_expr *e,
return name; return name;
} }
else if (value_mone_p (t->val)) else if (mpz_cmp_si (t->val, -1) == 0)
{ {
tree name = clast_name_to_gcc (t->var, region, newivs, tree name = clast_name_to_gcc (t->var, region, newivs,
newivs_index, params_index); newivs_index, params_index);
...@@ -1036,11 +1036,11 @@ graphite_create_new_loop_guard (sese region, edge entry_edge, ...@@ -1036,11 +1036,11 @@ graphite_create_new_loop_guard (sese region, edge entry_edge,
However lb < ub + 1 is false, as expected. */ However lb < ub + 1 is false, as expected. */
tree one; tree one;
Value gmp_one; Value gmp_one;
value_init (gmp_one); mpz_init (gmp_one);
value_set_si (gmp_one, 1); mpz_set_si (gmp_one, 1);
one = gmp_cst_to_tree (type, gmp_one); one = gmp_cst_to_tree (type, gmp_one);
value_clear (gmp_one); mpz_clear (gmp_one);
ub_one = fold_build2 (POINTER_TYPE_P (type) ? POINTER_PLUS_EXPR : PLUS_EXPR, ub_one = fold_build2 (POINTER_TYPE_P (type) ? POINTER_PLUS_EXPR : PLUS_EXPR,
type, ub, one); type, ub, one);
......
...@@ -83,10 +83,10 @@ build_linearized_memory_access (ppl_dimension_type offset, poly_dr_p pdr) ...@@ -83,10 +83,10 @@ build_linearized_memory_access (ppl_dimension_type offset, poly_dr_p pdr)
ppl_new_Linear_Expression_with_dimension (&res, dim); ppl_new_Linear_Expression_with_dimension (&res, dim);
value_init (size); mpz_init (size);
value_set_si (size, 1); mpz_set_si (size, 1);
value_init (sub_size); mpz_init (sub_size);
value_set_si (sub_size, 1); mpz_set_si (sub_size, 1);
for (i = last - 1; i >= first; i--) for (i = last - 1; i >= first; i--)
{ {
...@@ -95,12 +95,12 @@ build_linearized_memory_access (ppl_dimension_type offset, poly_dr_p pdr) ...@@ -95,12 +95,12 @@ build_linearized_memory_access (ppl_dimension_type offset, poly_dr_p pdr)
ppl_new_Linear_Expression_with_dimension (&le, dim - offset); ppl_new_Linear_Expression_with_dimension (&le, dim - offset);
ppl_set_coef (le, i, 1); ppl_set_coef (le, i, 1);
ppl_max_for_le_pointset (PDR_ACCESSES (pdr), le, sub_size); ppl_max_for_le_pointset (PDR_ACCESSES (pdr), le, sub_size);
value_multiply (size, size, sub_size); mpz_mul (size, size, sub_size);
ppl_delete_Linear_Expression (le); ppl_delete_Linear_Expression (le);
} }
value_clear (sub_size); mpz_clear (sub_size);
value_clear (size); mpz_clear (size);
return res; return res;
} }
...@@ -319,9 +319,15 @@ pdr_stride_in_loop (Value stride, graphite_dim_t depth, poly_dr_p pdr) ...@@ -319,9 +319,15 @@ pdr_stride_in_loop (Value stride, graphite_dim_t depth, poly_dr_p pdr)
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
{ {
char *str;
void (*gmp_free) (void *, size_t);
fprintf (dump_file, "\nStride in BB_%d, DR_%d, depth %d:", fprintf (dump_file, "\nStride in BB_%d, DR_%d, depth %d:",
pbb_index (pbb), PDR_ID (pdr), (int) depth); pbb_index (pbb), PDR_ID (pdr), (int) depth);
value_print (dump_file, " %s ", stride); str = mpz_get_str (0, 10, stride);
fprintf (dump_file, " %s ", str);
mp_get_memory_functions (NULL, NULL, &gmp_free);
(*gmp_free) (str, strlen (str) + 1);
} }
ppl_delete_Pointset_Powerset_C_Polyhedron (p1); ppl_delete_Pointset_Powerset_C_Polyhedron (p1);
...@@ -341,8 +347,8 @@ memory_strides_in_loop_1 (lst_p loop, graphite_dim_t depth, Value strides) ...@@ -341,8 +347,8 @@ memory_strides_in_loop_1 (lst_p loop, graphite_dim_t depth, Value strides)
poly_dr_p pdr; poly_dr_p pdr;
Value s, n; Value s, n;
value_init (s); mpz_init (s);
value_init (n); mpz_init (n);
for (j = 0; VEC_iterate (lst_p, LST_SEQ (loop), j, l); j++) for (j = 0; VEC_iterate (lst_p, LST_SEQ (loop), j, l); j++)
if (LST_LOOP_P (l)) if (LST_LOOP_P (l))
...@@ -351,13 +357,13 @@ memory_strides_in_loop_1 (lst_p loop, graphite_dim_t depth, Value strides) ...@@ -351,13 +357,13 @@ memory_strides_in_loop_1 (lst_p loop, graphite_dim_t depth, Value strides)
for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (LST_PBB (l)), i, pdr); i++) for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (LST_PBB (l)), i, pdr); i++)
{ {
pdr_stride_in_loop (s, depth, pdr); pdr_stride_in_loop (s, depth, pdr);
value_set_si (n, PDR_NB_REFS (pdr)); mpz_set_si (n, PDR_NB_REFS (pdr));
value_multiply (s, s, n); mpz_mul (s, s, n);
value_addto (strides, strides, s); mpz_add (strides, strides, s);
} }
value_clear (s); mpz_clear (s);
value_clear (n); mpz_clear (n);
} }
/* Sets STRIDES to the sum of all the strides of the data references /* Sets STRIDES to the sum of all the strides of the data references
...@@ -366,13 +372,13 @@ memory_strides_in_loop_1 (lst_p loop, graphite_dim_t depth, Value strides) ...@@ -366,13 +372,13 @@ memory_strides_in_loop_1 (lst_p loop, graphite_dim_t depth, Value strides)
static void static void
memory_strides_in_loop (lst_p loop, graphite_dim_t depth, Value strides) memory_strides_in_loop (lst_p loop, graphite_dim_t depth, Value strides)
{ {
if (value_mone_p (loop->memory_strides)) if (mpz_cmp_si (loop->memory_strides, -1) == 0)
{ {
value_set_si (strides, 0); mpz_set_si (strides, 0);
memory_strides_in_loop_1 (loop, depth, strides); memory_strides_in_loop_1 (loop, depth, strides);
} }
else else
value_assign (strides, loop->memory_strides); mpz_set (strides, loop->memory_strides);
} }
/* Return true when the interchange of loops LOOP1 and LOOP2 is /* Return true when the interchange of loops LOOP1 and LOOP2 is
...@@ -466,16 +472,16 @@ lst_interchange_profitable_p (lst_p loop1, lst_p loop2) ...@@ -466,16 +472,16 @@ lst_interchange_profitable_p (lst_p loop1, lst_p loop2)
&& LST_LOOP_P (loop1) && LST_LOOP_P (loop2) && LST_LOOP_P (loop1) && LST_LOOP_P (loop2)
&& lst_depth (loop1) < lst_depth (loop2)); && lst_depth (loop1) < lst_depth (loop2));
value_init (d1); mpz_init (d1);
value_init (d2); mpz_init (d2);
memory_strides_in_loop (loop1, lst_depth (loop1), d1); memory_strides_in_loop (loop1, lst_depth (loop1), d1);
memory_strides_in_loop (loop2, lst_depth (loop2), d2); memory_strides_in_loop (loop2, lst_depth (loop2), d2);
res = value_lt (d1, d2); res = value_lt (d1, d2);
value_clear (d1); mpz_clear (d1);
value_clear (d2); mpz_clear (d2);
return res; return res;
} }
......
...@@ -83,8 +83,8 @@ extend_scattering (poly_bb_p pbb, int max_scattering) ...@@ -83,8 +83,8 @@ extend_scattering (poly_bb_p pbb, int max_scattering)
Value one; Value one;
nb_added_dims = max_scattering - pbb_nb_scattering_transform (pbb); nb_added_dims = max_scattering - pbb_nb_scattering_transform (pbb);
value_init (one); mpz_init (one);
value_set_si (one, 1); mpz_set_si (one, 1);
ppl_new_Coefficient (&coef); ppl_new_Coefficient (&coef);
ppl_assign_Coefficient_from_mpz_t (coef, one); ppl_assign_Coefficient_from_mpz_t (coef, one);
...@@ -113,7 +113,7 @@ extend_scattering (poly_bb_p pbb, int max_scattering) ...@@ -113,7 +113,7 @@ extend_scattering (poly_bb_p pbb, int max_scattering)
} }
ppl_delete_Coefficient (coef); ppl_delete_Coefficient (coef);
value_clear (one); mpz_clear (one);
} }
/* All scattering matrices in SCOP will have the same number of scattering /* All scattering matrices in SCOP will have the same number of scattering
...@@ -1001,7 +1001,7 @@ psct_scattering_dim_for_loop_depth (poly_bb_p pbb, graphite_dim_t loop_depth) ...@@ -1001,7 +1001,7 @@ psct_scattering_dim_for_loop_depth (poly_bb_p pbb, graphite_dim_t loop_depth)
Value val; Value val;
graphite_dim_t i; graphite_dim_t i;
value_init (val); mpz_init (val);
ppl_new_Coefficient (&coef); ppl_new_Coefficient (&coef);
ppl_Polyhedron_get_constraints (ph, &pcs); ppl_Polyhedron_get_constraints (ph, &pcs);
ppl_new_Constraint_System_const_iterator (&cit); ppl_new_Constraint_System_const_iterator (&cit);
...@@ -1017,7 +1017,7 @@ psct_scattering_dim_for_loop_depth (poly_bb_p pbb, graphite_dim_t loop_depth) ...@@ -1017,7 +1017,7 @@ psct_scattering_dim_for_loop_depth (poly_bb_p pbb, graphite_dim_t loop_depth)
ppl_Linear_Expression_coefficient (expr, iter, coef); ppl_Linear_Expression_coefficient (expr, iter, coef);
ppl_Coefficient_to_mpz_t (coef, val); ppl_Coefficient_to_mpz_t (coef, val);
if (value_zero_p (val)) if (mpz_sgn (val))
{ {
ppl_delete_Linear_Expression (expr); ppl_delete_Linear_Expression (expr);
continue; continue;
...@@ -1032,7 +1032,7 @@ psct_scattering_dim_for_loop_depth (poly_bb_p pbb, graphite_dim_t loop_depth) ...@@ -1032,7 +1032,7 @@ psct_scattering_dim_for_loop_depth (poly_bb_p pbb, graphite_dim_t loop_depth)
if (value_notzero_p (val)) if (value_notzero_p (val))
{ {
value_clear (val); mpz_clear (val);
ppl_delete_Linear_Expression (expr); ppl_delete_Linear_Expression (expr);
ppl_delete_Coefficient (coef); ppl_delete_Coefficient (coef);
ppl_delete_Constraint_System_const_iterator (cit); ppl_delete_Constraint_System_const_iterator (cit);
...@@ -1060,7 +1060,7 @@ pbb_number_of_iterations (poly_bb_p pbb, ...@@ -1060,7 +1060,7 @@ pbb_number_of_iterations (poly_bb_p pbb,
ppl_Pointset_Powerset_C_Polyhedron_space_dimension (PBB_DOMAIN (pbb), &dim); ppl_Pointset_Powerset_C_Polyhedron_space_dimension (PBB_DOMAIN (pbb), &dim);
ppl_new_Linear_Expression_with_dimension (&le, dim); ppl_new_Linear_Expression_with_dimension (&le, dim);
ppl_set_coef (le, pbb_iterator_dim (pbb, loop_depth), 1); ppl_set_coef (le, pbb_iterator_dim (pbb, loop_depth), 1);
value_set_si (niter, -1); mpz_set_si (niter, -1);
ppl_max_for_le_pointset (PBB_DOMAIN (pbb), le, niter); ppl_max_for_le_pointset (PBB_DOMAIN (pbb), le, niter);
ppl_delete_Linear_Expression (le); ppl_delete_Linear_Expression (le);
} }
...@@ -1106,7 +1106,7 @@ pbb_number_of_iterations_at_time (poly_bb_p pbb, ...@@ -1106,7 +1106,7 @@ pbb_number_of_iterations_at_time (poly_bb_p pbb,
ppl_Pointset_Powerset_C_Polyhedron_space_dimension (sctr, &dim); ppl_Pointset_Powerset_C_Polyhedron_space_dimension (sctr, &dim);
ppl_new_Linear_Expression_with_dimension (&le, dim); ppl_new_Linear_Expression_with_dimension (&le, dim);
ppl_set_coef (le, time_depth, 1); ppl_set_coef (le, time_depth, 1);
value_set_si (niter, -1); mpz_set_si (niter, -1);
ppl_max_for_le_pointset (sctr, le, niter); ppl_max_for_le_pointset (sctr, le, niter);
ppl_delete_Linear_Expression (le); ppl_delete_Linear_Expression (le);
......
...@@ -681,8 +681,8 @@ new_lst_loop (VEC (lst_p, heap) *seq) ...@@ -681,8 +681,8 @@ new_lst_loop (VEC (lst_p, heap) *seq)
LST_LOOP_P (lst) = true; LST_LOOP_P (lst) = true;
LST_SEQ (lst) = seq; LST_SEQ (lst) = seq;
LST_LOOP_FATHER (lst) = NULL; LST_LOOP_FATHER (lst) = NULL;
value_init (LST_LOOP_MEMORY_STRIDES (lst)); mpz_init (LST_LOOP_MEMORY_STRIDES (lst));
value_set_si (LST_LOOP_MEMORY_STRIDES (lst), -1); mpz_set_si (LST_LOOP_MEMORY_STRIDES (lst), -1);
for (i = 0; VEC_iterate (lst_p, seq, i, l); i++) for (i = 0; VEC_iterate (lst_p, seq, i, l); i++)
LST_LOOP_FATHER (l) = lst; LST_LOOP_FATHER (l) = lst;
...@@ -719,7 +719,7 @@ free_lst (lst_p lst) ...@@ -719,7 +719,7 @@ free_lst (lst_p lst)
for (i = 0; VEC_iterate (lst_p, LST_SEQ (lst), i, l); i++) for (i = 0; VEC_iterate (lst_p, LST_SEQ (lst), i, l); i++)
free_lst (l); free_lst (l);
value_clear (LST_LOOP_MEMORY_STRIDES (lst)); mpz_clear (LST_LOOP_MEMORY_STRIDES (lst));
VEC_free (lst_p, heap, LST_SEQ (lst)); VEC_free (lst_p, heap, LST_SEQ (lst));
} }
......
...@@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "ggc.h" #include "ggc.h"
#ifdef HAVE_cloog #ifdef HAVE_cloog
#include "ppl_c.h" #include "ppl_c.h"
#include "cloog/cloog.h" #include "cloog/cloog.h"
#include "graphite-ppl.h" #include "graphite-ppl.h"
...@@ -55,7 +56,7 @@ cloog_matrix_to_ppl_constraint (CloogMatrix *matrix, int row) ...@@ -55,7 +56,7 @@ cloog_matrix_to_ppl_constraint (CloogMatrix *matrix, int row)
ppl_Linear_Expression_add_to_inhomogeneous (expr, coef); ppl_Linear_Expression_add_to_inhomogeneous (expr, coef);
ppl_delete_Coefficient (coef); ppl_delete_Coefficient (coef);
if (value_zero_p (matrix->p[row][0])) if (mpz_sgn (matrix->p[row][0]))
ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_EQUAL); ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_EQUAL);
else else
ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL); ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL);
...@@ -122,7 +123,7 @@ oppose_constraint (CloogMatrix *m, int row) ...@@ -122,7 +123,7 @@ oppose_constraint (CloogMatrix *m, int row)
/* Do not oppose the first column: it is the eq/ineq one. */ /* Do not oppose the first column: it is the eq/ineq one. */
for (k = 1; k < m->NbColumns; k++) for (k = 1; k < m->NbColumns; k++)
value_oppose (m->p[row][k], m->p[row][k]); mpz_neg (m->p[row][k], m->p[row][k]);
} }
/* Inserts constraint CSTR at row ROW of matrix M. */ /* Inserts constraint CSTR at row ROW of matrix M. */
...@@ -144,18 +145,18 @@ insert_constraint_into_matrix (CloogMatrix *m, int row, ...@@ -144,18 +145,18 @@ insert_constraint_into_matrix (CloogMatrix *m, int row,
} }
for (i = dim; i < nb_cols - 1; i++) for (i = dim; i < nb_cols - 1; i++)
value_set_si (m->p[row][i + 1], 0); mpz_set_si (m->p[row][i + 1], 0);
ppl_Constraint_inhomogeneous_term (cstr, c); ppl_Constraint_inhomogeneous_term (cstr, c);
ppl_Coefficient_to_mpz_t (c, m->p[row][nb_cols - 1]); ppl_Coefficient_to_mpz_t (c, m->p[row][nb_cols - 1]);
value_set_si (m->p[row][0], 1); mpz_set_si (m->p[row][0], 1);
switch (ppl_Constraint_type (cstr)) switch (ppl_Constraint_type (cstr))
{ {
case PPL_CONSTRAINT_TYPE_LESS_THAN: case PPL_CONSTRAINT_TYPE_LESS_THAN:
oppose_constraint (m, row); oppose_constraint (m, row);
case PPL_CONSTRAINT_TYPE_GREATER_THAN: case PPL_CONSTRAINT_TYPE_GREATER_THAN:
value_sub_int (m->p[row][nb_cols - 1], mpz_sub_ui (m->p[row][nb_cols - 1],
m->p[row][nb_cols - 1], 1); m->p[row][nb_cols - 1], 1);
break; break;
...@@ -165,7 +166,7 @@ insert_constraint_into_matrix (CloogMatrix *m, int row, ...@@ -165,7 +166,7 @@ insert_constraint_into_matrix (CloogMatrix *m, int row,
break; break;
case PPL_CONSTRAINT_TYPE_EQUAL: case PPL_CONSTRAINT_TYPE_EQUAL:
value_set_si (m->p[row][0], 0); mpz_set_si (m->p[row][0], 0);
break; break;
default: default:
...@@ -280,20 +281,20 @@ ppl_set_inhomogeneous_gmp (ppl_Linear_Expression_t e, Value x) ...@@ -280,20 +281,20 @@ ppl_set_inhomogeneous_gmp (ppl_Linear_Expression_t e, Value x)
Value v0, v1; Value v0, v1;
ppl_Coefficient_t c; ppl_Coefficient_t c;
value_init (v0); mpz_init (v0);
value_init (v1); mpz_init (v1);
ppl_new_Coefficient (&c); ppl_new_Coefficient (&c);
ppl_Linear_Expression_inhomogeneous_term (e, c); ppl_Linear_Expression_inhomogeneous_term (e, c);
ppl_Coefficient_to_mpz_t (c, v1); ppl_Coefficient_to_mpz_t (c, v1);
value_oppose (v1, v1); mpz_neg (v1, v1);
value_assign (v0, x); mpz_set (v0, x);
value_addto (v0, v0, v1); mpz_add (v0, v0, v1);
ppl_assign_Coefficient_from_mpz_t (c, v0); ppl_assign_Coefficient_from_mpz_t (c, v0);
ppl_Linear_Expression_add_to_inhomogeneous (e, c); ppl_Linear_Expression_add_to_inhomogeneous (e, c);
value_clear (v0); mpz_clear (v0);
value_clear (v1); mpz_clear (v1);
ppl_delete_Coefficient (c); ppl_delete_Coefficient (c);
} }
...@@ -305,20 +306,20 @@ ppl_set_coef_gmp (ppl_Linear_Expression_t e, ppl_dimension_type i, Value x) ...@@ -305,20 +306,20 @@ ppl_set_coef_gmp (ppl_Linear_Expression_t e, ppl_dimension_type i, Value x)
Value v0, v1; Value v0, v1;
ppl_Coefficient_t c; ppl_Coefficient_t c;
value_init (v0); mpz_init (v0);
value_init (v1); mpz_init (v1);
ppl_new_Coefficient (&c); ppl_new_Coefficient (&c);
ppl_Linear_Expression_coefficient (e, i, c); ppl_Linear_Expression_coefficient (e, i, c);
ppl_Coefficient_to_mpz_t (c, v1); ppl_Coefficient_to_mpz_t (c, v1);
value_oppose (v1, v1); mpz_neg (v1, v1);
value_assign (v0, x); mpz_set (v0, x);
value_addto (v0, v0, v1); mpz_add (v0, v0, v1);
ppl_assign_Coefficient_from_mpz_t (c, v0); ppl_assign_Coefficient_from_mpz_t (c, v0);
ppl_Linear_Expression_add_to_coefficient (e, i, c); ppl_Linear_Expression_add_to_coefficient (e, i, c);
value_clear (v0); mpz_clear (v0);
value_clear (v1); mpz_clear (v1);
ppl_delete_Coefficient (c); ppl_delete_Coefficient (c);
} }
...@@ -423,7 +424,7 @@ ppl_strip_loop (ppl_Polyhedron_t ph, ppl_dimension_type loop, int stride) ...@@ -423,7 +424,7 @@ ppl_strip_loop (ppl_Polyhedron_t ph, ppl_dimension_type loop, int stride)
ppl_Coefficient_t c; ppl_Coefficient_t c;
Value val; Value val;
value_init (val); mpz_init (val);
ppl_new_Coefficient (&c); ppl_new_Coefficient (&c);
ppl_Polyhedron_space_dimension (ph, &dim); ppl_Polyhedron_space_dimension (ph, &dim);
...@@ -455,7 +456,7 @@ ppl_strip_loop (ppl_Polyhedron_t ph, ppl_dimension_type loop, int stride) ...@@ -455,7 +456,7 @@ ppl_strip_loop (ppl_Polyhedron_t ph, ppl_dimension_type loop, int stride)
ppl_Linear_Expression_coefficient (expr, loop, c); ppl_Linear_Expression_coefficient (expr, loop, c);
ppl_delete_Linear_Expression (expr); ppl_delete_Linear_Expression (expr);
ppl_Coefficient_to_mpz_t (c, val); ppl_Coefficient_to_mpz_t (c, val);
v = value_get_si (val); v = mpz_get_si (val);
if (0 < v || v < 0) if (0 < v || v < 0)
ppl_Polyhedron_add_constraint (tmp, cstr); ppl_Polyhedron_add_constraint (tmp, cstr);
...@@ -499,7 +500,7 @@ ppl_strip_loop (ppl_Polyhedron_t ph, ppl_dimension_type loop, int stride) ...@@ -499,7 +500,7 @@ ppl_strip_loop (ppl_Polyhedron_t ph, ppl_dimension_type loop, int stride)
ppl_delete_Constraint (new_cstr); ppl_delete_Constraint (new_cstr);
} }
value_clear (val); mpz_clear (val);
ppl_delete_Coefficient (c); ppl_delete_Coefficient (c);
return res; return res;
} }
...@@ -520,8 +521,8 @@ ppl_lexico_compare_linear_expressions (ppl_Linear_Expression_t a, ...@@ -520,8 +521,8 @@ ppl_lexico_compare_linear_expressions (ppl_Linear_Expression_t a,
ppl_Linear_Expression_space_dimension (a, &length1); ppl_Linear_Expression_space_dimension (a, &length1);
ppl_Linear_Expression_space_dimension (b, &length2); ppl_Linear_Expression_space_dimension (b, &length2);
ppl_new_Coefficient (&c); ppl_new_Coefficient (&c);
value_init (va); mpz_init (va);
value_init (vb); mpz_init (vb);
if (length1 < length2) if (length1 < length2)
min_length = length1; min_length = length1;
...@@ -534,19 +535,19 @@ ppl_lexico_compare_linear_expressions (ppl_Linear_Expression_t a, ...@@ -534,19 +535,19 @@ ppl_lexico_compare_linear_expressions (ppl_Linear_Expression_t a,
ppl_Coefficient_to_mpz_t (c, va); ppl_Coefficient_to_mpz_t (c, va);
ppl_Linear_Expression_coefficient (b, i, c); ppl_Linear_Expression_coefficient (b, i, c);
ppl_Coefficient_to_mpz_t (c, vb); ppl_Coefficient_to_mpz_t (c, vb);
res = value_compare (va, vb); res = mpz_cmp (va, vb);
if (res == 0) if (res == 0)
continue; continue;
value_clear (va); mpz_clear (va);
value_clear (vb); mpz_clear (vb);
ppl_delete_Coefficient (c); ppl_delete_Coefficient (c);
return res; return res;
} }
value_clear (va); mpz_clear (va);
value_clear (vb); mpz_clear (vb);
ppl_delete_Coefficient (c); ppl_delete_Coefficient (c);
return length1 - length2; return length1 - length2;
} }
...@@ -653,8 +654,8 @@ ppl_max_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t ps, ...@@ -653,8 +654,8 @@ ppl_max_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t ps,
Value dv, nv; Value dv, nv;
int maximum, err; int maximum, err;
value_init (nv); mpz_init (nv);
value_init (dv); mpz_init (dv);
ppl_new_Coefficient (&num); ppl_new_Coefficient (&num);
ppl_new_Coefficient (&denom); ppl_new_Coefficient (&denom);
err = ppl_Pointset_Powerset_C_Polyhedron_maximize (ps, le, num, denom, &maximum); err = ppl_Pointset_Powerset_C_Polyhedron_maximize (ps, le, num, denom, &maximum);
...@@ -664,11 +665,11 @@ ppl_max_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t ps, ...@@ -664,11 +665,11 @@ ppl_max_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t ps,
ppl_Coefficient_to_mpz_t (num, nv); ppl_Coefficient_to_mpz_t (num, nv);
ppl_Coefficient_to_mpz_t (denom, dv); ppl_Coefficient_to_mpz_t (denom, dv);
gcc_assert (value_notzero_p (dv)); gcc_assert (value_notzero_p (dv));
value_division (res, nv, dv); mpz_tdiv_q (res, nv, dv);
} }
value_clear (nv); mpz_clear (nv);
value_clear (dv); mpz_clear (dv);
ppl_delete_Coefficient (num); ppl_delete_Coefficient (num);
ppl_delete_Coefficient (denom); ppl_delete_Coefficient (denom);
} }
...@@ -684,8 +685,8 @@ ppl_min_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t ps, ...@@ -684,8 +685,8 @@ ppl_min_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t ps,
Value dv, nv; Value dv, nv;
int minimum, err; int minimum, err;
value_init (nv); mpz_init (nv);
value_init (dv); mpz_init (dv);
ppl_new_Coefficient (&num); ppl_new_Coefficient (&num);
ppl_new_Coefficient (&denom); ppl_new_Coefficient (&denom);
err = ppl_Pointset_Powerset_C_Polyhedron_minimize (ps, le, num, denom, &minimum); err = ppl_Pointset_Powerset_C_Polyhedron_minimize (ps, le, num, denom, &minimum);
...@@ -695,11 +696,11 @@ ppl_min_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t ps, ...@@ -695,11 +696,11 @@ ppl_min_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t ps,
ppl_Coefficient_to_mpz_t (num, nv); ppl_Coefficient_to_mpz_t (num, nv);
ppl_Coefficient_to_mpz_t (denom, dv); ppl_Coefficient_to_mpz_t (denom, dv);
gcc_assert (value_notzero_p (dv)); gcc_assert (value_notzero_p (dv));
value_division (res, nv, dv); mpz_tdiv_q (res, nv, dv);
} }
value_clear (nv); mpz_clear (nv);
value_clear (dv); mpz_clear (dv);
ppl_delete_Coefficient (num); ppl_delete_Coefficient (num);
ppl_delete_Coefficient (denom); ppl_delete_Coefficient (denom);
} }
...@@ -716,13 +717,13 @@ ppl_build_relation (int dim, int pos1, int pos2, int c, ...@@ -716,13 +717,13 @@ ppl_build_relation (int dim, int pos1, int pos2, int c,
ppl_Coefficient_t coef; ppl_Coefficient_t coef;
Value v, v_op, v_c; Value v, v_op, v_c;
value_init (v); mpz_init (v);
value_init (v_op); mpz_init (v_op);
value_init (v_c); mpz_init (v_c);
value_set_si (v, 1); mpz_set_si (v, 1);
value_set_si (v_op, -1); mpz_set_si (v_op, -1);
value_set_si (v_c, c); mpz_set_si (v_c, c);
ppl_new_Coefficient (&coef); ppl_new_Coefficient (&coef);
ppl_new_Linear_Expression_with_dimension (&expr, dim); ppl_new_Linear_Expression_with_dimension (&expr, dim);
...@@ -738,9 +739,9 @@ ppl_build_relation (int dim, int pos1, int pos2, int c, ...@@ -738,9 +739,9 @@ ppl_build_relation (int dim, int pos1, int pos2, int c,
ppl_delete_Linear_Expression (expr); ppl_delete_Linear_Expression (expr);
ppl_delete_Coefficient (coef); ppl_delete_Coefficient (coef);
value_clear (v); mpz_clear (v);
value_clear (v_op); mpz_clear (v_op);
value_clear (v_c); mpz_clear (v_c);
return cstr; return cstr;
} }
......
...@@ -71,10 +71,10 @@ gmp_cst_to_tree (tree type, Value val) ...@@ -71,10 +71,10 @@ gmp_cst_to_tree (tree type, Value val)
Value tmp; Value tmp;
double_int di; double_int di;
value_init (tmp); mpz_init (tmp);
value_assign (tmp, val); mpz_set (tmp, val);
di = mpz_get_double_int (t, tmp, true); di = mpz_get_double_int (t, tmp, true);
value_clear (tmp); mpz_clear (tmp);
return double_int_to_tree (t, di); return double_int_to_tree (t, di);
} }
...@@ -85,10 +85,10 @@ static inline void ...@@ -85,10 +85,10 @@ static inline void
ppl_set_inhomogeneous (ppl_Linear_Expression_t e, int x) ppl_set_inhomogeneous (ppl_Linear_Expression_t e, int x)
{ {
Value v; Value v;
value_init (v); mpz_init (v);
value_set_si (v, x); mpz_set_si (v, x);
ppl_set_inhomogeneous_gmp (e, v); ppl_set_inhomogeneous_gmp (e, v);
value_clear (v); mpz_clear (v);
} }
/* Set the inhomogeneous term of E to the tree X. */ /* Set the inhomogeneous term of E to the tree X. */
...@@ -97,10 +97,10 @@ static inline void ...@@ -97,10 +97,10 @@ static inline void
ppl_set_inhomogeneous_tree (ppl_Linear_Expression_t e, tree x) ppl_set_inhomogeneous_tree (ppl_Linear_Expression_t e, tree x)
{ {
Value v; Value v;
value_init (v); mpz_init (v);
tree_int_to_gmp (x, v); tree_int_to_gmp (x, v);
ppl_set_inhomogeneous_gmp (e, v); ppl_set_inhomogeneous_gmp (e, v);
value_clear (v); mpz_clear (v);
} }
/* Set E[I] to integer X. */ /* Set E[I] to integer X. */
...@@ -109,10 +109,10 @@ static inline void ...@@ -109,10 +109,10 @@ static inline void
ppl_set_coef (ppl_Linear_Expression_t e, ppl_dimension_type i, int x) ppl_set_coef (ppl_Linear_Expression_t e, ppl_dimension_type i, int x)
{ {
Value v; Value v;
value_init (v); mpz_init (v);
value_set_si (v, x); mpz_set_si (v, x);
ppl_set_coef_gmp (e, i, v); ppl_set_coef_gmp (e, i, v);
value_clear (v); mpz_clear (v);
} }
/* Set E[I] to tree X. */ /* Set E[I] to tree X. */
...@@ -121,10 +121,10 @@ static inline void ...@@ -121,10 +121,10 @@ static inline void
ppl_set_coef_tree (ppl_Linear_Expression_t e, ppl_dimension_type i, tree x) ppl_set_coef_tree (ppl_Linear_Expression_t e, ppl_dimension_type i, tree x)
{ {
Value v; Value v;
value_init (v); mpz_init (v);
tree_int_to_gmp (x, v); tree_int_to_gmp (x, v);
ppl_set_coef_gmp (e, i, v); ppl_set_coef_gmp (e, i, v);
value_clear (v); mpz_clear (v);
} }
/* Sets RES to the max of V1 and V2. */ /* Sets RES to the max of V1 and V2. */
...@@ -132,9 +132,9 @@ ppl_set_coef_tree (ppl_Linear_Expression_t e, ppl_dimension_type i, tree x) ...@@ -132,9 +132,9 @@ ppl_set_coef_tree (ppl_Linear_Expression_t e, ppl_dimension_type i, tree x)
static inline void static inline void
value_max (Value res, Value v1, Value v2) value_max (Value res, Value v1, Value v2)
{ {
if (value_compare (v1, v2) < 0) if (mpz_cmp (v1, v2) < 0)
value_assign (res, v2); mpz_set (res, v2);
value_assign (res, v1); mpz_set (res, v1);
} }
/* Builds a new identity map for dimension DIM. */ /* Builds a new identity map for dimension DIM. */
......
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