add isl_union_pw_multi_aff_flat_range_product
[platform/upstream/isl.git] / isl_input.c
index 548ff41..495366f 100644 (file)
@@ -574,7 +574,7 @@ static __isl_give isl_pw_aff *accept_ternary(struct isl_stream *s,
        __isl_take isl_map *cond, struct vars *v)
 {
        isl_space *dim;
-       isl_pw_aff *pwaff1 = NULL, *pwaff2 = NULL;
+       isl_pw_aff *pwaff1 = NULL, *pwaff2 = NULL, *pa_cond;
 
        if (!cond)
                return NULL;
@@ -595,7 +595,8 @@ static __isl_give isl_pw_aff *accept_ternary(struct isl_stream *s,
        if (!pwaff1)
                goto error;
 
-       return isl_pw_aff_cond(isl_map_wrap(cond), pwaff1, pwaff2);
+       pa_cond = isl_set_indicator_function(isl_map_wrap(cond));
+       return isl_pw_aff_cond(pa_cond, pwaff1, pwaff2);
 error:
        isl_map_free(cond);
        isl_pw_aff_free(pwaff1);
@@ -899,7 +900,7 @@ static __isl_give isl_map *read_tuple(struct isl_stream *s,
                nested = read_nested_tuple(s, isl_map_universe(dim), v);
                if (type == isl_dim_in) {
                        nested = isl_map_reverse(nested);
-                       map = isl_map_intersect(nested, map);
+                       map = isl_map_intersect_params(nested, map);
                } else {
                        isl_set *set;
                        dim = isl_set_get_space(nested);
@@ -1058,9 +1059,15 @@ static int resolve_paren_expr(struct isl_stream *s,
        if (!tok || tok->type != '(')
                goto error;
 
+       if (isl_stream_next_token_is(s, '('))
+               if (resolve_paren_expr(s, v, isl_map_copy(map)))
+                       goto error;
+
        if (isl_stream_next_token_is(s, ISL_TOKEN_EXISTS) ||
+           isl_stream_next_token_is(s, ISL_TOKEN_NOT) ||
            isl_stream_next_token_is(s, ISL_TOKEN_TRUE) ||
-           isl_stream_next_token_is(s, ISL_TOKEN_FALSE)) {
+           isl_stream_next_token_is(s, ISL_TOKEN_FALSE) ||
+           isl_stream_next_token_is(s, ISL_TOKEN_MAP)) {
                map = read_disjuncts(s, v, map);
                if (isl_stream_eat(s, ')'))
                        goto error;
@@ -1552,7 +1559,7 @@ static __isl_give isl_pw_qpolynomial *read_factor(struct isl_stream *s,
                int pow;
 
                isl_stream_push_token(s, tok);
-               pwaff = accept_affine(s, isl_map_get_space(map), v);
+               pwaff = accept_div(s, isl_map_get_space(map), v);
                pow = optional_power(s);
                pwqp = isl_pw_qpolynomial_from_pw_aff(pwaff);
                pwqp = isl_pw_qpolynomial_pow(pwqp, pow);
@@ -2536,7 +2543,7 @@ __isl_give isl_pw_aff *isl_stream_read_pw_aff(struct isl_stream *s)
                pa_i = read_pw_aff_with_dom(s, aff_dom, v);
                vars_drop(v, v->n - n);
 
-               pa = isl_pw_aff_add(pa, pa_i);
+               pa = isl_pw_aff_union_add(pa, pa_i);
        }
 
        if (isl_stream_eat(s, '}'))