From 2e10ff78a1439557b802a0bedac571a4ded33ea0 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 26 Jul 2011 17:12:49 +0200 Subject: [PATCH] isl_stream_read_map: accept assignments to tuple variables Signed-off-by: Sven Verdoolaege --- isl_input.c | 15 +++++++++++---- isl_test.c | 4 ++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/isl_input.c b/isl_input.c index 3465e1f..159ab73 100644 --- a/isl_input.c +++ b/isl_input.c @@ -658,14 +658,19 @@ static __isl_give isl_map *read_var_def(struct isl_stream *s, int pos; isl_map *def_map; - pos = isl_map_dim(map, isl_dim_in); - if (type == isl_dim_out) - pos += isl_map_dim(map, isl_dim_out); + if (type == isl_dim_param) + pos = isl_map_dim(map, isl_dim_param); + else { + pos = isl_map_dim(map, isl_dim_in); + if (type == isl_dim_out) + pos += isl_map_dim(map, isl_dim_out); + type = isl_dim_in; + } --pos; def = accept_extended_affine(s, isl_dim_wrap(isl_map_get_dim(map)), v); def_map = isl_map_from_pw_aff(def); - def_map = isl_map_equate(def_map, isl_dim_in, pos, isl_dim_out, 0); + def_map = isl_map_equate(def_map, type, pos, isl_dim_out, 0); def_map = isl_set_unwrap(isl_map_domain(def_map)); map = isl_map_intersect(map, def_map); @@ -697,6 +702,8 @@ static __isl_give isl_map *read_var_list(struct isl_stream *s, map = isl_map_add_dims(map, type, 1); map = set_name(map, type, i, v->v->name); isl_token_free(tok); + if (isl_stream_eat_if_available(s, '=')) + map = read_var_def(s, map, type, v); } else { if (type == isl_dim_param) { isl_stream_error(s, tok, diff --git a/isl_test.c b/isl_test.c index ed18c17..909335f 100644 --- a/isl_test.c +++ b/isl_test.c @@ -136,6 +136,10 @@ void test_parse(struct isl_ctx *ctx) str2 = "{ [i] -> [5] : i <= 0; [i] -> [4] : i >= 1 }"; test_parse_map_equal(ctx, str, str2); + str = "[N=2,M] -> { [i=[(M+N)/4]] }"; + str2 = "[N, M] -> { [i] : N = 2 and 4i <= 2 + M and 4i >= -1 + M }"; + test_parse_map_equal(ctx, str, str2); + test_parse_pwqp(ctx, "{ [i] -> i + [ (i + [i/3])/2 ] }"); test_parse_map(ctx, "{ S1[i] -> [([i/10]),i%10] : 0 <= i <= 45 }"); } -- 2.7.4