* 91893 Orsay, France
*/
+#include <isl_ctx_private.h>
+#include <isl_map_private.h>
#include <isl_bound.h>
#include <isl_bernstein.h>
#include <isl_range.h>
struct isl_bound *bound = (struct isl_bound *)user;
isl_pw_qpolynomial_fold *top_pwf;
isl_pw_qpolynomial_fold *top_pwf_tight;
- isl_dim *dim;
+ isl_space *dim;
isl_morph *morph;
unsigned orig_nvar, final_nvar;
int r;
final_nvar = isl_basic_set_dim(bset, isl_dim_set);
- dim = isl_morph_get_ran_dim(morph);
- dim = isl_dim_drop(dim, isl_dim_set, 0, isl_dim_size(dim, isl_dim_set));
+ dim = isl_morph_get_ran_space(morph);
+ dim = isl_space_drop_dims(dim, isl_dim_set, 0, isl_space_dim(dim, isl_dim_set));
top_pwf = bound->pwf;
top_pwf_tight = bound->pwf_tight;
- bound->pwf = isl_pw_qpolynomial_fold_zero(isl_dim_copy(dim),
+ bound->pwf = isl_pw_qpolynomial_fold_zero(isl_space_copy(dim),
bound->type);
bound->pwf_tight = isl_pw_qpolynomial_fold_zero(dim, bound->type);
__isl_take isl_qpolynomial *poly, void *user)
{
struct isl_bound *bound = (struct isl_bound *)user;
- isl_dim *dim;
- isl_dim *target_dim;
+ isl_space *dim;
isl_pw_qpolynomial_fold *top_pwf;
isl_pw_qpolynomial_fold *top_pwf_tight;
int nparam;
int n_in;
int r;
- if (!isl_basic_set_is_wrapping(bset))
+ if (!bound->wrapping)
return unwrapped_guarded_poly_bound(bset, poly, user);
- target_dim = isl_basic_set_get_dim(bset);
- target_dim = isl_dim_unwrap(target_dim);
- target_dim = isl_dim_domain(target_dim);
-
- nparam = isl_dim_size(target_dim, isl_dim_param);
- n_in = isl_dim_size(target_dim, isl_dim_set);
+ nparam = isl_space_dim(bound->dim, isl_dim_param);
+ n_in = isl_space_dim(bound->dim, isl_dim_set);
bset = isl_basic_set_move_dims(bset, isl_dim_param, nparam,
isl_dim_set, 0, n_in);
poly = isl_qpolynomial_move_dims(poly, isl_dim_param, nparam,
isl_dim_set, 0, n_in);
- dim = isl_basic_set_get_dim(bset);
- dim = isl_dim_drop(dim, isl_dim_set, 0, isl_dim_size(dim, isl_dim_set));
+ dim = isl_basic_set_get_space(bset);
+ dim = isl_space_drop_dims(dim, isl_dim_set, 0, isl_space_dim(dim, isl_dim_set));
top_pwf = bound->pwf;
top_pwf_tight = bound->pwf_tight;
- bound->pwf = isl_pw_qpolynomial_fold_zero(isl_dim_copy(dim),
+ bound->pwf = isl_pw_qpolynomial_fold_zero(isl_space_copy(dim),
bound->type);
bound->pwf_tight = isl_pw_qpolynomial_fold_zero(dim, bound->type);
r = unwrapped_guarded_poly_bound(bset, poly, user);
- bound->pwf = isl_pw_qpolynomial_fold_reset_dim(bound->pwf,
- isl_dim_copy(target_dim));
- bound->pwf_tight = isl_pw_qpolynomial_fold_reset_dim(bound->pwf_tight,
- target_dim);
+ bound->pwf = isl_pw_qpolynomial_fold_reset_space(bound->pwf,
+ isl_space_copy(bound->dim));
+ bound->pwf_tight = isl_pw_qpolynomial_fold_reset_space(bound->pwf_tight,
+ isl_space_copy(bound->dim));
bound->pwf = isl_pw_qpolynomial_fold_fold(top_pwf, bound->pwf);
bound->pwf_tight = isl_pw_qpolynomial_fold_fold(top_pwf_tight,
__isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_bound(
__isl_take isl_pw_qpolynomial_fold *pwf, int *tight)
{
- isl_dim *dim;
unsigned nvar;
struct isl_bound bound;
int covers;
if (!pwf)
return NULL;
- dim = isl_pw_qpolynomial_fold_get_dim(pwf);
- nvar = isl_dim_size(dim, isl_dim_set);
+ bound.dim = isl_pw_qpolynomial_fold_get_space(pwf);
- if (isl_pw_qpolynomial_fold_is_zero(pwf)) {
- isl_pw_qpolynomial_fold_free(pwf);
- dim = isl_dim_drop(dim, isl_dim_set, 0, nvar);
+ bound.wrapping = isl_space_is_wrapping(bound.dim);
+ if (bound.wrapping)
+ bound.dim = isl_space_unwrap(bound.dim);
+ nvar = isl_space_dim(bound.dim, isl_dim_out);
+ bound.dim = isl_space_domain(bound.dim);
+
+ if (nvar == 0) {
if (tight)
*tight = 1;
- return isl_pw_qpolynomial_fold_zero(dim, pwf->type);
+ return isl_pw_qpolynomial_fold_reset_space(pwf, bound.dim);
}
- if (nvar == 0) {
- isl_dim_free(dim);
+ if (isl_pw_qpolynomial_fold_is_zero(pwf)) {
+ enum isl_fold type = pwf->type;
+ isl_pw_qpolynomial_fold_free(pwf);
if (tight)
*tight = 1;
- return pwf;
+ return isl_pw_qpolynomial_fold_zero(bound.dim, type);
}
- if (isl_dim_is_wrapping(dim)) {
- dim = isl_dim_unwrap(dim);
- nvar = isl_dim_size(dim, isl_dim_out);
- dim = isl_dim_domain(dim);
- if (nvar == 0) {
- if (tight)
- *tight = 1;
- return isl_pw_qpolynomial_fold_reset_dim(pwf, dim);
- }
- } else
- dim = isl_dim_drop(dim, isl_dim_set, 0, nvar);
-
- bound.pwf = isl_pw_qpolynomial_fold_zero(isl_dim_copy(dim), pwf->type);
- bound.pwf_tight = isl_pw_qpolynomial_fold_zero(isl_dim_copy(dim),
+ bound.pwf = isl_pw_qpolynomial_fold_zero(isl_space_copy(bound.dim),
+ pwf->type);
+ bound.pwf_tight = isl_pw_qpolynomial_fold_zero(isl_space_copy(bound.dim),
pwf->type);
bound.check_tight = !!tight;
if (tight)
*tight = covers;
- isl_dim_free(dim);
+ isl_space_free(bound.dim);
isl_pw_qpolynomial_fold_free(pwf);
if (covers) {
isl_pw_qpolynomial_fold_free(bound.pwf_tight);
isl_pw_qpolynomial_fold_free(bound.pwf);
isl_pw_qpolynomial_fold_free(pwf);
- isl_dim_free(dim);
+ isl_space_free(bound.dim);
return NULL;
}
__isl_take isl_union_pw_qpolynomial *upwqp,
enum isl_fold type, int *tight)
{
- isl_dim *dim;
+ isl_space *dim;
struct isl_union_bound_data data = { type, 1, NULL };
if (!upwqp)
if (!tight)
data.tight = 0;
- dim = isl_union_pw_qpolynomial_get_dim(upwqp);
+ dim = isl_union_pw_qpolynomial_get_space(upwqp);
data.res = isl_union_pw_qpolynomial_fold_zero(dim, type);
if (isl_union_pw_qpolynomial_foreach_pw_qpolynomial(upwqp,
&bound_pw, &data) < 0)