From: Sven Verdoolaege Date: Wed, 2 Nov 2011 10:16:27 +0000 (+0100) Subject: add isl_pw_*_intersect_params X-Git-Tag: isl-0.09~57 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ff92580f1acb24424de00e9e33e3e5317e202e7a;p=platform%2Fupstream%2Fisl.git add isl_pw_*_intersect_params Signed-off-by: Sven Verdoolaege --- diff --git a/doc/user.pod b/doc/user.pod index 82b02dc..2044701 100644 --- a/doc/user.pod +++ b/doc/user.pod @@ -2859,6 +2859,9 @@ Operations include __isl_give isl_pw_aff *isl_pw_aff_intersect_domain( __isl_take isl_pw_aff *pa, __isl_take isl_set *set); + __isl_give isl_pw_aff *isl_pw_aff_intersect_params( + __isl_take isl_pw_aff *pa, + __isl_take isl_set *set); __isl_give isl_aff *isl_aff_mul(__isl_take isl_aff *aff1, __isl_take isl_aff *aff2); @@ -3098,6 +3101,9 @@ Operations include __isl_give isl_multi_aff *isl_multi_aff_scale( __isl_take isl_multi_aff *maff, isl_int f); + __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params( + __isl_take isl_pw_multi_aff *pma, + __isl_take isl_set *set); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain( __isl_take isl_pw_multi_aff *pma, __isl_take isl_set *set); @@ -3501,6 +3507,9 @@ obviously equal, use __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_intersect_domain( __isl_take isl_pw_qpolynomial *pwpq, __isl_take isl_set *set); + __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_intersect_params( + __isl_take isl_pw_qpolynomial *pwpq, + __isl_take isl_set *set); __isl_give isl_union_set *isl_union_pw_qpolynomial_domain( __isl_take isl_union_pw_qpolynomial *upwqp); @@ -3687,6 +3696,11 @@ obviously equal, use __isl_take isl_union_pw_qpolynomial_fold *upwf, __isl_take isl_point *pnt); + __isl_give isl_pw_qpolynomial_fold * + sl_pw_qpolynomial_fold_intersect_params( + __isl_take isl_pw_qpolynomial_fold *pwf, + __isl_take isl_set *set); + __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain( __isl_take isl_union_pw_qpolynomial_fold *upwf); __isl_give isl_union_pw_qpolynomial_fold *isl_union_pw_qpolynomial_fold_intersect_domain( diff --git a/include/isl/aff.h b/include/isl/aff.h index 0aa8cfb..1154e3f 100644 --- a/include/isl/aff.h +++ b/include/isl/aff.h @@ -157,6 +157,8 @@ __isl_give isl_pw_aff *isl_pw_aff_floor(__isl_take isl_pw_aff *pwaff); __isl_give isl_pw_aff *isl_pw_aff_mod(__isl_take isl_pw_aff *pwaff, isl_int mod); +__isl_give isl_pw_aff *isl_pw_aff_intersect_params(__isl_take isl_pw_aff *pa, + __isl_take isl_set *set); __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(__isl_take isl_pw_aff *pa, __isl_take isl_set *set); @@ -304,6 +306,8 @@ __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add( __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add( __isl_take isl_pw_multi_aff *pma1, __isl_take isl_pw_multi_aff *pma2); +__isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params( + __isl_take isl_pw_multi_aff *pma, __isl_take isl_set *set); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain( __isl_take isl_pw_multi_aff *pma, __isl_take isl_set *set); diff --git a/include/isl/polynomial.h b/include/isl/polynomial.h index 5fdecfb..96c435b 100644 --- a/include/isl/polynomial.h +++ b/include/isl/polynomial.h @@ -168,6 +168,8 @@ __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_set_dim_name( __isl_give isl_set *isl_pw_qpolynomial_domain(__isl_take isl_pw_qpolynomial *pwqp); __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_intersect_domain( __isl_take isl_pw_qpolynomial *pwpq, __isl_take isl_set *set); +__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_intersect_params( + __isl_take isl_pw_qpolynomial *pwpq, __isl_take isl_set *set); __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_project_domain_on_params( __isl_take isl_pw_qpolynomial *pwqp); @@ -346,6 +348,8 @@ __isl_give isl_set *isl_pw_qpolynomial_fold_domain( __isl_take isl_pw_qpolynomial_fold *pwf); __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_intersect_domain( __isl_take isl_pw_qpolynomial_fold *pwf, __isl_take isl_set *set); +__isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_intersect_params( + __isl_take isl_pw_qpolynomial_fold *pwf, __isl_take isl_set *set); __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add( __isl_take isl_pw_qpolynomial_fold *pwf1, diff --git a/isl_pw_templ.c b/isl_pw_templ.c index 8e5d15f..f254b0c 100644 --- a/isl_pw_templ.c +++ b/isl_pw_templ.c @@ -645,8 +645,14 @@ __isl_give isl_set *FN(PW,domain)(__isl_take PW *pw) return dom; } -static __isl_give PW *FN(PW,intersect_domain_aligned)(__isl_take PW *pw, - __isl_take isl_set *set) +/* Restrict the domain of "pw" by combining each cell + * with "set" through a call to "fn", where "fn" may be + * isl_set_intersect or isl_set_intersect_params. + */ +static __isl_give PW *FN(PW,intersect_aligned)(__isl_take PW *pw, + __isl_take isl_set *set, + __isl_give isl_set *(*fn)(__isl_take isl_set *set1, + __isl_take isl_set *set2)) { int i; @@ -664,7 +670,7 @@ static __isl_give PW *FN(PW,intersect_domain_aligned)(__isl_take PW *pw, for (i = pw->n - 1; i >= 0; --i) { isl_basic_set *aff; - pw->p[i].set = isl_set_intersect(pw->p[i].set, isl_set_copy(set)); + pw->p[i].set = fn(pw->p[i].set, isl_set_copy(set)); if (!pw->p[i].set) goto error; aff = isl_set_affine_hull(isl_set_copy(pw->p[i].set)); @@ -689,6 +695,12 @@ error: return NULL; } +static __isl_give PW *FN(PW,intersect_domain_aligned)(__isl_take PW *pw, + __isl_take isl_set *set) +{ + return FN(PW,intersect_aligned)(pw, set, &isl_set_intersect); +} + __isl_give PW *FN(PW,intersect_domain)(__isl_take PW *pw, __isl_take isl_set *context) { @@ -696,6 +708,21 @@ __isl_give PW *FN(PW,intersect_domain)(__isl_take PW *pw, &FN(PW,intersect_domain_aligned)); } +static __isl_give PW *FN(PW,intersect_params_aligned)(__isl_take PW *pw, + __isl_take isl_set *set) +{ + return FN(PW,intersect_aligned)(pw, set, &isl_set_intersect_params); +} + +/* Intersect the domain of "pw" with the parameter domain "context". + */ +__isl_give PW *FN(PW,intersect_params)(__isl_take PW *pw, + __isl_take isl_set *context) +{ + return FN(PW,align_params_pw_set_and)(pw, context, + &FN(PW,intersect_params_aligned)); +} + static __isl_give PW *FN(PW,gist_aligned)(__isl_take PW *pw, __isl_take isl_set *context) {