From: Sven Verdoolaege Date: Mon, 25 Jul 2011 09:48:49 +0000 (+0200) Subject: isl_stream_read_map: accept arbitrary affine expressions in tuples X-Git-Tag: isl-0.08~181 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b12d657d0331bb25f3fe461654ae48f9a673f1a7;p=platform%2Fupstream%2Fisl.git isl_stream_read_map: accept arbitrary affine expressions in tuples Signed-off-by: Sven Verdoolaege --- diff --git a/isl_input.c b/isl_input.c index f9bbdff..175c2ec 100644 --- a/isl_input.c +++ b/isl_input.c @@ -566,6 +566,9 @@ static __isl_give isl_map *read_var_list(struct isl_stream *s, int i = 0; struct isl_token *tok; + if (isl_stream_next_token_is(s, ']')) + return map; + while ((tok = next_token(s)) != NULL) { int new_name = 0; @@ -581,10 +584,7 @@ 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); - } else if (tok->type == ISL_TOKEN_IDENT || - tok->type == ISL_TOKEN_VALUE || - tok->type == '-' || - tok->type == '(') { + } else { if (type == isl_dim_param) { isl_stream_error(s, tok, "expecting unique identifier"); @@ -596,8 +596,7 @@ static __isl_give isl_map *read_var_list(struct isl_stream *s, goto error; map = isl_map_add_dims(map, type, 1); map = read_var_def(s, map, type, v); - } else - break; + } tok = isl_stream_next_token(s); if (tok && tok->type == ']' && diff --git a/isl_test.c b/isl_test.c index d8248a3..94f415c 100644 --- a/isl_test.c +++ b/isl_test.c @@ -120,6 +120,10 @@ void test_parse(struct isl_ctx *ctx) str2 = "[n] -> { [c1] : c1 >= 0 and 3c1 <= -4 + n }"; test_parse_map_equal(ctx, str, str2); + str = "{ [i,j] -> [i] : i < j; [i,j] -> [j] : j <= i }"; + str2 = "{ [i,j] -> [min(i,j)] }"; + 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 }"); }