isl_map.c: div_involves_vars: use isl_basic_map_var_offset
[isl.git] / isl_drop_unused_params_templ.c
blob08664e9d93ffb074cba0fbab703fa20d69bad241
1 /*
2 * Use of this software is governed by the MIT license
3 */
5 #define xFN(TYPE,NAME) TYPE ## _ ## NAME
6 #define FN(TYPE,NAME) xFN(TYPE,NAME)
8 /* Drop all parameters not referenced by "obj".
9 */
10 __isl_give TYPE *FN(TYPE,drop_unused_params)(__isl_take TYPE *obj)
12 int i;
13 isl_size n;
15 n = FN(TYPE,dim)(obj, isl_dim_param);
16 if (n < 0 || FN(TYPE,check_named_params)(obj) < 0)
17 return FN(TYPE,free)(obj);
19 for (i = n - 1; i >= 0; i--) {
20 isl_bool involves;
22 involves = FN(TYPE,involves_dims)(obj, isl_dim_param, i, 1);
23 if (involves < 0)
24 return FN(TYPE,free)(obj);
25 if (!involves)
26 obj = FN(TYPE,drop_dims)(obj, isl_dim_param, i, 1);
29 return obj;