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
This commit is contained in:
Andreas Simbuerger 2010-05-06 21:53:29 +00:00 committed by Sebastian Pop
parent 14c2101daa
commit a0bb35c774
9 changed files with 218 additions and 167 deletions

View File

@ -1,3 +1,47 @@
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>
PR middle-end/43519

View File

@ -184,13 +184,13 @@ pbb_strip_mine_profitable_p (poly_bb_p pbb,
Value niter, strip_stride;
bool res;
value_init (strip_stride);
value_init (niter);
value_set_si (strip_stride, stride);
mpz_init (strip_stride);
mpz_init (niter);
mpz_set_si (strip_stride, stride);
pbb_number_of_iterations_at_time (pbb, psct_dynamic_dim (pbb, depth), niter);
res = value_gt (niter, strip_stride);
value_clear (strip_stride);
value_clear (niter);
res = (mpz_cmp (niter, strip_stride) > 0);
mpz_clear (strip_stride);
mpz_clear (niter);
return res;
}

View File

@ -311,7 +311,7 @@ clast_to_gcc_expression (tree type, struct clast_expr *e,
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,
newivs_index, params_index);
@ -323,7 +323,7 @@ clast_to_gcc_expression (tree type, struct clast_expr *e,
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,
newivs_index, params_index);
@ -1036,11 +1036,11 @@ graphite_create_new_loop_guard (sese region, edge entry_edge,
However lb < ub + 1 is false, as expected. */
tree one;
Value gmp_one;
value_init (gmp_one);
value_set_si (gmp_one, 1);
mpz_init (gmp_one);
mpz_set_si (gmp_one, 1);
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,
type, ub, one);

View File

@ -83,10 +83,10 @@ build_linearized_memory_access (ppl_dimension_type offset, poly_dr_p pdr)
ppl_new_Linear_Expression_with_dimension (&res, dim);
value_init (size);
value_set_si (size, 1);
value_init (sub_size);
value_set_si (sub_size, 1);
mpz_init (size);
mpz_set_si (size, 1);
mpz_init (sub_size);
mpz_set_si (sub_size, 1);
for (i = last - 1; i >= first; i--)
{
@ -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_set_coef (le, i, 1);
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);
}
value_clear (sub_size);
value_clear (size);
mpz_clear (sub_size);
mpz_clear (size);
return res;
}
@ -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))
{
char *str;
void (*gmp_free) (void *, size_t);
fprintf (dump_file, "\nStride in BB_%d, DR_%d, depth %d:",
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);
@ -341,8 +347,8 @@ memory_strides_in_loop_1 (lst_p loop, graphite_dim_t depth, Value strides)
poly_dr_p pdr;
Value s, n;
value_init (s);
value_init (n);
mpz_init (s);
mpz_init (n);
for (j = 0; VEC_iterate (lst_p, LST_SEQ (loop), j, l); j++)
if (LST_LOOP_P (l))
@ -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++)
{
pdr_stride_in_loop (s, depth, pdr);
value_set_si (n, PDR_NB_REFS (pdr));
value_multiply (s, s, n);
value_addto (strides, strides, s);
mpz_set_si (n, PDR_NB_REFS (pdr));
mpz_mul (s, s, n);
mpz_add (strides, strides, s);
}
value_clear (s);
value_clear (n);
mpz_clear (s);
mpz_clear (n);
}
/* 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)
static void
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);
}
else
value_assign (strides, loop->memory_strides);
mpz_set (strides, loop->memory_strides);
}
/* 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)
&& LST_LOOP_P (loop1) && LST_LOOP_P (loop2)
&& lst_depth (loop1) < lst_depth (loop2));
value_init (d1);
value_init (d2);
mpz_init (d1);
mpz_init (d2);
memory_strides_in_loop (loop1, lst_depth (loop1), d1);
memory_strides_in_loop (loop2, lst_depth (loop2), d2);
res = value_lt (d1, d2);
value_clear (d1);
value_clear (d2);
mpz_clear (d1);
mpz_clear (d2);
return res;
}

View File

@ -83,8 +83,8 @@ extend_scattering (poly_bb_p pbb, int max_scattering)
Value one;
nb_added_dims = max_scattering - pbb_nb_scattering_transform (pbb);
value_init (one);
value_set_si (one, 1);
mpz_init (one);
mpz_set_si (one, 1);
ppl_new_Coefficient (&coef);
ppl_assign_Coefficient_from_mpz_t (coef, one);
@ -113,7 +113,7 @@ extend_scattering (poly_bb_p pbb, int max_scattering)
}
ppl_delete_Coefficient (coef);
value_clear (one);
mpz_clear (one);
}
/* 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)
Value val;
graphite_dim_t i;
value_init (val);
mpz_init (val);
ppl_new_Coefficient (&coef);
ppl_Polyhedron_get_constraints (ph, &pcs);
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)
ppl_Linear_Expression_coefficient (expr, iter, coef);
ppl_Coefficient_to_mpz_t (coef, val);
if (value_zero_p (val))
if (mpz_sgn (val))
{
ppl_delete_Linear_Expression (expr);
continue;
@ -1032,7 +1032,7 @@ psct_scattering_dim_for_loop_depth (poly_bb_p pbb, graphite_dim_t loop_depth)
if (value_notzero_p (val))
{
value_clear (val);
mpz_clear (val);
ppl_delete_Linear_Expression (expr);
ppl_delete_Coefficient (coef);
ppl_delete_Constraint_System_const_iterator (cit);
@ -1060,7 +1060,7 @@ pbb_number_of_iterations (poly_bb_p pbb,
ppl_Pointset_Powerset_C_Polyhedron_space_dimension (PBB_DOMAIN (pbb), &dim);
ppl_new_Linear_Expression_with_dimension (&le, dim);
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_delete_Linear_Expression (le);
}
@ -1106,7 +1106,7 @@ pbb_number_of_iterations_at_time (poly_bb_p pbb,
ppl_Pointset_Powerset_C_Polyhedron_space_dimension (sctr, &dim);
ppl_new_Linear_Expression_with_dimension (&le, dim);
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_delete_Linear_Expression (le);

View File

@ -681,8 +681,8 @@ new_lst_loop (VEC (lst_p, heap) *seq)
LST_LOOP_P (lst) = true;
LST_SEQ (lst) = seq;
LST_LOOP_FATHER (lst) = NULL;
value_init (LST_LOOP_MEMORY_STRIDES (lst));
value_set_si (LST_LOOP_MEMORY_STRIDES (lst), -1);
mpz_init (LST_LOOP_MEMORY_STRIDES (lst));
mpz_set_si (LST_LOOP_MEMORY_STRIDES (lst), -1);
for (i = 0; VEC_iterate (lst_p, seq, i, l); i++)
LST_LOOP_FATHER (l) = lst;
@ -719,7 +719,7 @@ free_lst (lst_p lst)
for (i = 0; VEC_iterate (lst_p, LST_SEQ (lst), i, l); i++)
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));
}

View File

@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "ggc.h"
#ifdef HAVE_cloog
#include "ppl_c.h"
#include "cloog/cloog.h"
#include "graphite-ppl.h"
@ -55,7 +56,7 @@ cloog_matrix_to_ppl_constraint (CloogMatrix *matrix, int row)
ppl_Linear_Expression_add_to_inhomogeneous (expr, 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);
else
ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL);
@ -122,7 +123,7 @@ oppose_constraint (CloogMatrix *m, int row)
/* Do not oppose the first column: it is the eq/ineq one. */
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. */
@ -144,18 +145,18 @@ insert_constraint_into_matrix (CloogMatrix *m, int row,
}
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_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))
{
case PPL_CONSTRAINT_TYPE_LESS_THAN:
oppose_constraint (m, row);
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);
break;
@ -165,7 +166,7 @@ insert_constraint_into_matrix (CloogMatrix *m, int row,
break;
case PPL_CONSTRAINT_TYPE_EQUAL:
value_set_si (m->p[row][0], 0);
mpz_set_si (m->p[row][0], 0);
break;
default:
@ -280,20 +281,20 @@ ppl_set_inhomogeneous_gmp (ppl_Linear_Expression_t e, Value x)
Value v0, v1;
ppl_Coefficient_t c;
value_init (v0);
value_init (v1);
mpz_init (v0);
mpz_init (v1);
ppl_new_Coefficient (&c);
ppl_Linear_Expression_inhomogeneous_term (e, c);
ppl_Coefficient_to_mpz_t (c, v1);
value_oppose (v1, v1);
value_assign (v0, x);
value_addto (v0, v0, v1);
mpz_neg (v1, v1);
mpz_set (v0, x);
mpz_add (v0, v0, v1);
ppl_assign_Coefficient_from_mpz_t (c, v0);
ppl_Linear_Expression_add_to_inhomogeneous (e, c);
value_clear (v0);
value_clear (v1);
mpz_clear (v0);
mpz_clear (v1);
ppl_delete_Coefficient (c);
}
@ -305,20 +306,20 @@ ppl_set_coef_gmp (ppl_Linear_Expression_t e, ppl_dimension_type i, Value x)
Value v0, v1;
ppl_Coefficient_t c;
value_init (v0);
value_init (v1);
mpz_init (v0);
mpz_init (v1);
ppl_new_Coefficient (&c);
ppl_Linear_Expression_coefficient (e, i, c);
ppl_Coefficient_to_mpz_t (c, v1);
value_oppose (v1, v1);
value_assign (v0, x);
value_addto (v0, v0, v1);
mpz_neg (v1, v1);
mpz_set (v0, x);
mpz_add (v0, v0, v1);
ppl_assign_Coefficient_from_mpz_t (c, v0);
ppl_Linear_Expression_add_to_coefficient (e, i, c);
value_clear (v0);
value_clear (v1);
mpz_clear (v0);
mpz_clear (v1);
ppl_delete_Coefficient (c);
}
@ -423,7 +424,7 @@ ppl_strip_loop (ppl_Polyhedron_t ph, ppl_dimension_type loop, int stride)
ppl_Coefficient_t c;
Value val;
value_init (val);
mpz_init (val);
ppl_new_Coefficient (&c);
ppl_Polyhedron_space_dimension (ph, &dim);
@ -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_delete_Linear_Expression (expr);
ppl_Coefficient_to_mpz_t (c, val);
v = value_get_si (val);
v = mpz_get_si (val);
if (0 < v || v < 0)
ppl_Polyhedron_add_constraint (tmp, cstr);
@ -499,7 +500,7 @@ ppl_strip_loop (ppl_Polyhedron_t ph, ppl_dimension_type loop, int stride)
ppl_delete_Constraint (new_cstr);
}
value_clear (val);
mpz_clear (val);
ppl_delete_Coefficient (c);
return res;
}
@ -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 (b, &length2);
ppl_new_Coefficient (&c);
value_init (va);
value_init (vb);
mpz_init (va);
mpz_init (vb);
if (length1 < length2)
min_length = length1;
@ -534,19 +535,19 @@ ppl_lexico_compare_linear_expressions (ppl_Linear_Expression_t a,
ppl_Coefficient_to_mpz_t (c, va);
ppl_Linear_Expression_coefficient (b, i, c);
ppl_Coefficient_to_mpz_t (c, vb);
res = value_compare (va, vb);
res = mpz_cmp (va, vb);
if (res == 0)
continue;
value_clear (va);
value_clear (vb);
mpz_clear (va);
mpz_clear (vb);
ppl_delete_Coefficient (c);
return res;
}
value_clear (va);
value_clear (vb);
mpz_clear (va);
mpz_clear (vb);
ppl_delete_Coefficient (c);
return length1 - length2;
}
@ -653,8 +654,8 @@ ppl_max_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t ps,
Value dv, nv;
int maximum, err;
value_init (nv);
value_init (dv);
mpz_init (nv);
mpz_init (dv);
ppl_new_Coefficient (&num);
ppl_new_Coefficient (&denom);
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,
ppl_Coefficient_to_mpz_t (num, nv);
ppl_Coefficient_to_mpz_t (denom, dv);
gcc_assert (value_notzero_p (dv));
value_division (res, nv, dv);
mpz_tdiv_q (res, nv, dv);
}
value_clear (nv);
value_clear (dv);
mpz_clear (nv);
mpz_clear (dv);
ppl_delete_Coefficient (num);
ppl_delete_Coefficient (denom);
}
@ -684,8 +685,8 @@ ppl_min_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t ps,
Value dv, nv;
int minimum, err;
value_init (nv);
value_init (dv);
mpz_init (nv);
mpz_init (dv);
ppl_new_Coefficient (&num);
ppl_new_Coefficient (&denom);
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,
ppl_Coefficient_to_mpz_t (num, nv);
ppl_Coefficient_to_mpz_t (denom, dv);
gcc_assert (value_notzero_p (dv));
value_division (res, nv, dv);
mpz_tdiv_q (res, nv, dv);
}
value_clear (nv);
value_clear (dv);
mpz_clear (nv);
mpz_clear (dv);
ppl_delete_Coefficient (num);
ppl_delete_Coefficient (denom);
}
@ -716,13 +717,13 @@ ppl_build_relation (int dim, int pos1, int pos2, int c,
ppl_Coefficient_t coef;
Value v, v_op, v_c;
value_init (v);
value_init (v_op);
value_init (v_c);
mpz_init (v);
mpz_init (v_op);
mpz_init (v_c);
value_set_si (v, 1);
value_set_si (v_op, -1);
value_set_si (v_c, c);
mpz_set_si (v, 1);
mpz_set_si (v_op, -1);
mpz_set_si (v_c, c);
ppl_new_Coefficient (&coef);
ppl_new_Linear_Expression_with_dimension (&expr, dim);
@ -738,9 +739,9 @@ ppl_build_relation (int dim, int pos1, int pos2, int c,
ppl_delete_Linear_Expression (expr);
ppl_delete_Coefficient (coef);
value_clear (v);
value_clear (v_op);
value_clear (v_c);
mpz_clear (v);
mpz_clear (v_op);
mpz_clear (v_c);
return cstr;
}

View File

@ -71,10 +71,10 @@ gmp_cst_to_tree (tree type, Value val)
Value tmp;
double_int di;
value_init (tmp);
value_assign (tmp, val);
mpz_init (tmp);
mpz_set (tmp, val);
di = mpz_get_double_int (t, tmp, true);
value_clear (tmp);
mpz_clear (tmp);
return double_int_to_tree (t, di);
}
@ -85,10 +85,10 @@ static inline void
ppl_set_inhomogeneous (ppl_Linear_Expression_t e, int x)
{
Value v;
value_init (v);
value_set_si (v, x);
mpz_init (v);
mpz_set_si (v, x);
ppl_set_inhomogeneous_gmp (e, v);
value_clear (v);
mpz_clear (v);
}
/* Set the inhomogeneous term of E to the tree X. */
@ -97,10 +97,10 @@ static inline void
ppl_set_inhomogeneous_tree (ppl_Linear_Expression_t e, tree x)
{
Value v;
value_init (v);
mpz_init (v);
tree_int_to_gmp (x, v);
ppl_set_inhomogeneous_gmp (e, v);
value_clear (v);
mpz_clear (v);
}
/* Set E[I] to integer X. */
@ -109,10 +109,10 @@ static inline void
ppl_set_coef (ppl_Linear_Expression_t e, ppl_dimension_type i, int x)
{
Value v;
value_init (v);
value_set_si (v, x);
mpz_init (v);
mpz_set_si (v, x);
ppl_set_coef_gmp (e, i, v);
value_clear (v);
mpz_clear (v);
}
/* Set E[I] to tree X. */
@ -121,10 +121,10 @@ static inline void
ppl_set_coef_tree (ppl_Linear_Expression_t e, ppl_dimension_type i, tree x)
{
Value v;
value_init (v);
mpz_init (v);
tree_int_to_gmp (x, v);
ppl_set_coef_gmp (e, i, v);
value_clear (v);
mpz_clear (v);
}
/* 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)
static inline void
value_max (Value res, Value v1, Value v2)
{
if (value_compare (v1, v2) < 0)
value_assign (res, v2);
value_assign (res, v1);
if (mpz_cmp (v1, v2) < 0)
mpz_set (res, v2);
mpz_set (res, v1);
}
/* Builds a new identity map for dimension DIM. */

View File

@ -519,7 +519,7 @@ build_pbb_scattering_polyhedrons (ppl_Linear_Expression_t static_schedule,
gcc_assert (scattering_dimensions >= used_scattering_dimensions);
value_init (v);
mpz_init (v);
ppl_new_Coefficient (&c);
PBB_TRANSFORMED (pbb) = poly_scattering_new ();
ppl_new_C_Polyhedron_from_space_dimension
@ -533,7 +533,7 @@ build_pbb_scattering_polyhedrons (ppl_Linear_Expression_t static_schedule,
ppl_Linear_Expression_t expr;
ppl_new_Linear_Expression_with_dimension (&expr, dim);
value_set_si (v, 1);
mpz_set_si (v, 1);
ppl_assign_Coefficient_from_mpz_t (c, v);
ppl_Linear_Expression_add_to_coefficient (expr, i, c);
@ -542,7 +542,7 @@ build_pbb_scattering_polyhedrons (ppl_Linear_Expression_t static_schedule,
{
ppl_Linear_Expression_coefficient (static_schedule, i / 2, c);
ppl_Coefficient_to_mpz_t (c, v);
value_oppose (v, v);
mpz_neg (v, v);
ppl_assign_Coefficient_from_mpz_t (c, v);
ppl_Linear_Expression_add_to_inhomogeneous (expr, c);
}
@ -552,7 +552,7 @@ build_pbb_scattering_polyhedrons (ppl_Linear_Expression_t static_schedule,
{
int loop = (i - 1) / 2;
value_set_si (v, -1);
mpz_set_si (v, -1);
ppl_assign_Coefficient_from_mpz_t (c, v);
ppl_Linear_Expression_add_to_coefficient
(expr, scattering_dimensions + loop, c);
@ -564,7 +564,7 @@ build_pbb_scattering_polyhedrons (ppl_Linear_Expression_t static_schedule,
ppl_delete_Constraint (cstr);
}
value_clear (v);
mpz_clear (v);
ppl_delete_Coefficient (c);
PBB_ORIGINAL (pbb) = poly_scattering_copy (PBB_TRANSFORMED (pbb));
@ -616,7 +616,7 @@ build_scop_scattering (scop_p scop)
ppl_Coefficient_t c;
Value v;
value_init (v);
mpz_init (v);
ppl_new_Coefficient (&c);
ppl_new_Linear_Expression (&static_schedule);
@ -624,7 +624,7 @@ build_scop_scattering (scop_p scop)
because we cannot compare_prefix_loops against a previous loop,
prefix will be equal to zero, and that index will be
incremented before copying. */
value_set_si (v, -1);
mpz_set_si (v, -1);
ppl_assign_Coefficient_from_mpz_t (c, v);
ppl_Linear_Expression_add_to_coefficient (static_schedule, 0, c);
@ -645,7 +645,7 @@ build_scop_scattering (scop_p scop)
ppl_assign_Linear_Expression_from_Linear_Expression (common,
static_schedule);
value_set_si (v, 1);
mpz_set_si (v, 1);
ppl_assign_Coefficient_from_mpz_t (c, v);
ppl_Linear_Expression_add_to_coefficient (common, prefix, c);
ppl_assign_Linear_Expression_from_Linear_Expression (static_schedule,
@ -656,7 +656,7 @@ build_scop_scattering (scop_p scop)
ppl_delete_Linear_Expression (common);
}
value_clear (v);
mpz_clear (v);
ppl_delete_Coefficient (c);
ppl_delete_Linear_Expression (static_schedule);
}
@ -672,14 +672,14 @@ add_value_to_dim (ppl_dimension_type d, ppl_Linear_Expression_t expr,
ppl_new_Coefficient (&coef);
ppl_Linear_Expression_coefficient (expr, d, coef);
value_init (val);
mpz_init (val);
ppl_Coefficient_to_mpz_t (coef, val);
value_addto (val, val, k);
mpz_add (val, val, k);
ppl_assign_Coefficient_from_mpz_t (coef, val);
ppl_Linear_Expression_add_to_coefficient (expr, d, coef);
value_clear (val);
mpz_clear (val);
ppl_delete_Coefficient (coef);
}
@ -708,10 +708,10 @@ scan_tree_for_params_right_scev (sese s, tree e, int var,
| a [i * p] = ... */
gcc_assert (TREE_CODE (e) == INTEGER_CST);
value_init (val);
value_set_si (val, int_cst_value (e));
mpz_init (val);
mpz_set_si (val, int_cst_value (e));
add_value_to_dim (l, expr, val);
value_clear (val);
mpz_clear (val);
}
}
@ -725,20 +725,20 @@ scan_tree_for_params_int (tree cst, ppl_Linear_Expression_t expr, Value k)
ppl_Coefficient_t coef;
int v = int_cst_value (cst);
value_init (val);
value_set_si (val, 0);
mpz_init (val);
mpz_set_si (val, 0);
/* Necessary to not get "-1 = 2^n - 1". */
if (v < 0)
value_sub_int (val, val, -v);
mpz_sub_ui (val, val, -v);
else
value_add_int (val, val, v);
mpz_add_ui (val, val, v);
value_multiply (val, val, k);
mpz_mul (val, val, k);
ppl_new_Coefficient (&coef);
ppl_assign_Coefficient_from_mpz_t (coef, val);
ppl_Linear_Expression_add_to_inhomogeneous (expr, coef);
value_clear (val);
mpz_clear (val);
ppl_delete_Coefficient (coef);
}
@ -809,11 +809,11 @@ scan_tree_for_params (sese s, tree e, ppl_Linear_Expression_t c,
{
Value val;
gcc_assert (host_integerp (TREE_OPERAND (e, 1), 0));
value_init (val);
value_set_si (val, int_cst_value (TREE_OPERAND (e, 1)));
value_multiply (val, val, k);
mpz_init (val);
mpz_set_si (val, int_cst_value (TREE_OPERAND (e, 1)));
mpz_mul (val, val, k);
scan_tree_for_params (s, TREE_OPERAND (e, 0), c, val);
value_clear (val);
mpz_clear (val);
}
else
scan_tree_for_params (s, TREE_OPERAND (e, 0), c, k);
@ -824,11 +824,11 @@ scan_tree_for_params (sese s, tree e, ppl_Linear_Expression_t c,
{
Value val;
gcc_assert (host_integerp (TREE_OPERAND (e, 0), 0));
value_init (val);
value_set_si (val, int_cst_value (TREE_OPERAND (e, 0)));
value_multiply (val, val, k);
mpz_init (val);
mpz_set_si (val, int_cst_value (TREE_OPERAND (e, 0)));
mpz_mul (val, val, k);
scan_tree_for_params (s, TREE_OPERAND (e, 1), c, val);
value_clear (val);
mpz_clear (val);
}
else
scan_tree_for_params (s, TREE_OPERAND (e, 1), c, k);
@ -909,11 +909,11 @@ scan_tree_for_params (sese s, tree e, ppl_Linear_Expression_t c,
ppl_subtract_Linear_Expression_from_Linear_Expression (c,
tmp_expr);
ppl_delete_Linear_Expression (tmp_expr);
value_init (minus_one);
value_set_si (minus_one, -1);
mpz_init (minus_one);
mpz_set_si (minus_one, -1);
ppl_new_Coefficient_from_mpz_t (&coef, minus_one);
ppl_Linear_Expression_add_to_inhomogeneous (c, coef);
value_clear (minus_one);
mpz_clear (minus_one);
ppl_delete_Coefficient (coef);
}
@ -963,8 +963,8 @@ find_params_in_bb (sese region, gimple_bb_p gbb)
loop_p loop = GBB_BB (gbb)->loop_father;
Value one;
value_init (one);
value_set_si (one, 1);
mpz_init (one);
mpz_set_si (one, 1);
/* Find parameters in the access functions of data references. */
for (i = 0; VEC_iterate (data_reference_p, GBB_DATA_REFS (gbb), i, dr); i++)
@ -983,7 +983,7 @@ find_params_in_bb (sese region, gimple_bb_p gbb)
scan_tree_for_params (region, rhs, NULL, one);
}
value_clear (one);
mpz_clear (one);
}
/* Record the parameters used in the SCOP. A variable is a parameter
@ -998,8 +998,8 @@ find_scop_parameters (scop_p scop)
struct loop *loop;
Value one;
value_init (one);
value_set_si (one, 1);
mpz_init (one);
mpz_set_si (one, 1);
/* Find the parameters used in the loop bounds. */
for (i = 0; VEC_iterate (loop_p, SESE_LOOP_NEST (region), i, loop); i++)
@ -1013,7 +1013,7 @@ find_scop_parameters (scop_p scop)
scan_tree_for_params (region, nb_iters, NULL, one);
}
value_clear (one);
mpz_clear (one);
/* Find the parameters used in data accesses. */
for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
@ -1056,10 +1056,10 @@ add_upper_bounds_from_estimated_nit (scop_p scop, double_int nit,
ub_expr);
/* Construct the negated number of last iteration in VAL. */
value_init (val);
mpz_init (val);
mpz_set_double_int (val, nit, false);
value_sub_int (val, val, 1);
value_oppose (val, val);
mpz_sub_ui (val, val, 1);
mpz_neg (val, val);
/* NB_ITERS_LE holds the number of last iteration in
parametrical form. Subtract estimated number of last
@ -1099,7 +1099,7 @@ add_upper_bounds_from_estimated_nit (scop_p scop, double_int nit,
ppl_delete_Polyhedron (pol);
ppl_delete_Linear_Expression (nb_iters_le);
ppl_delete_Constraint (ub);
value_clear (val);
mpz_clear (val);
}
/* Builds the constraint polyhedra for LOOP in SCOP. OUTER_PH gives
@ -1170,12 +1170,12 @@ build_loop_iteration_domains (scop_p scop, struct loop *loop,
ppl_Linear_Expression_t ub_expr;
double_int nit;
value_init (one);
value_set_si (one, 1);
mpz_init (one);
mpz_set_si (one, 1);
ppl_new_Linear_Expression_with_dimension (&ub_expr, dim);
nb_iters = scalar_evolution_in_region (region, loop, nb_iters);
scan_tree_for_params (SCOP_REGION (scop), nb_iters, ub_expr, one);
value_clear (one);
mpz_clear (one);
if (estimated_loop_iterations (loop, true, &nit))
add_upper_bounds_from_estimated_nit (scop, nit, dim, ub_expr);
@ -1221,10 +1221,10 @@ create_linear_expr_from_tree (poly_bb_p pbb, tree t)
t = scalar_evolution_in_region (region, loop, t);
gcc_assert (!automatically_generated_chrec_p (t));
value_init (one);
value_set_si (one, 1);
mpz_init (one);
mpz_set_si (one, 1);
scan_tree_for_params (region, t, res, one);
value_clear (one);
mpz_clear (one);
return res;
}
@ -1278,25 +1278,25 @@ add_condition_to_domain (ppl_Pointset_Powerset_C_Polyhedron_t ps, gimple stmt,
the left or the right side of the expression. */
if (code == LT_EXPR)
{
value_init (v);
value_set_si (v, 1);
mpz_init (v);
mpz_set_si (v, 1);
ppl_new_Coefficient (&c);
ppl_assign_Coefficient_from_mpz_t (c, v);
ppl_Linear_Expression_add_to_inhomogeneous (left, c);
ppl_delete_Coefficient (c);
value_clear (v);
mpz_clear (v);
code = LE_EXPR;
}
else if (code == GT_EXPR)
{
value_init (v);
value_set_si (v, 1);
mpz_init (v);
mpz_set_si (v, 1);
ppl_new_Coefficient (&c);
ppl_assign_Coefficient_from_mpz_t (c, v);
ppl_Linear_Expression_add_to_inhomogeneous (right, c);
ppl_delete_Coefficient (c);
value_clear (v);
mpz_clear (v);
code = GE_EXPR;
}
@ -1655,7 +1655,7 @@ pdr_add_memory_accesses (ppl_Polyhedron_t accesses, data_reference_p dr,
scop_p scop = PBB_SCOP (pbb);
sese region = SCOP_REGION (scop);
value_init (v);
mpz_init (v);
for (i = 0; i < nb_subscripts; i++)
{
@ -1667,7 +1667,7 @@ pdr_add_memory_accesses (ppl_Polyhedron_t accesses, data_reference_p dr,
ppl_new_Linear_Expression_with_dimension (&fn, dom_nb_dims);
ppl_new_Linear_Expression_with_dimension (&access, accessp_nb_dims);
value_set_si (v, 1);
mpz_set_si (v, 1);
scan_tree_for_params (region, afn, fn, v);
ppl_assign_Linear_Expression_from_Linear_Expression (access, fn);
@ -1680,7 +1680,7 @@ pdr_add_memory_accesses (ppl_Polyhedron_t accesses, data_reference_p dr,
ppl_delete_Constraint (cstr);
}
value_clear (v);
mpz_clear (v);
}
/* Add constrains representing the size of the accessed data to the