Home | History | Annotate | Line # | Download | only in dist
      1 /*
      2  * Copyright 2011      Sven Verdoolaege
      3  * Copyright 2012-2013 Ecole Normale Superieure
      4  *
      5  * Use of this software is governed by the MIT license
      6  *
      7  * Written by Sven Verdoolaege,
      8  * Ecole Normale Superieure, 45 rue dUlm, 75230 Paris, France
      9  */
     10 
     11 #include <isl_multi_macro.h>
     12 
     13 /* Intersect the parameter domain "dom1" with "dom2".
     14  * That is, intersect the parameters of "dom2" with "dom1".
     15  *
     16  * Even though "dom1" is known to only involve parameter constraints,
     17  * it may be of type isl_union_set, so explicitly convert it
     18  * to an isl_set first.
     19  */
     20 static __isl_give DOM *FN(MULTI(BASE),params_domain_intersect)(DOM *dom1,
     21 	__isl_take DOM *dom2)
     22 {
     23 	isl_set *params;
     24 
     25 	params = FN(DOM,params)(dom1);
     26 	dom2 = FN(DOM,intersect_params)(dom2, params);
     27 
     28 	return dom2;
     29 }
     30 
     31 /* Intersect the domain of "multi" with "domain".
     32  *
     33  * If "multi" has an explicit domain, then only this domain
     34  * needs to be intersected.
     35  */
     36 __isl_give MULTI(BASE) *FN(MULTI(BASE),intersect_domain)(
     37 	__isl_take MULTI(BASE) *multi, __isl_take DOM *domain)
     38 {
     39 	if (FN(MULTI(BASE),check_compatible_domain)(multi, domain) < 0)
     40 		domain = FN(DOM,free)(domain);
     41 	return FN(FN(MULTI(BASE),apply),DOMBASE)(multi, domain,
     42 				&FN(EL,intersect_domain),
     43 				&FN(DOM,intersect),
     44 				&FN(MULTI(BASE),params_domain_intersect));
     45 }
     46 
     47 /* Intersect the parameter domain of "multi" with "domain".
     48  *
     49  * If "multi" has an explicit domain, then only this domain
     50  * needs to be intersected.
     51  */
     52 __isl_give MULTI(BASE) *FN(MULTI(BASE),intersect_params)(
     53 	__isl_take MULTI(BASE) *multi, __isl_take isl_set *domain)
     54 {
     55 	return FN(MULTI(BASE),apply_set)(multi, domain,
     56 					&FN(EL,intersect_params),
     57 					&FN(DOM,intersect_params),
     58 					&FN(DOM,intersect_params));
     59 }
     60