From a16b3237867791721467837d4e8b694c3ae27f19 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sun, 17 Oct 2010 14:49:57 +0200 Subject: [PATCH] iscc: add before and after operations --- doc/isl.tex | 12 ++++++++++++ iscc.c | 41 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/doc/isl.tex b/doc/isl.tex index 0dd9a02..0a6ff2e 100644 --- a/doc/isl.tex +++ b/doc/isl.tex @@ -302,8 +302,12 @@ $s_2$ := $m$($s_1$) & apply map $m$ to set $s_1$ \\ $m_3$ := $m_1$ \ai[\tt]{.} $m_2$ & join of $m_1$ and $m_2$ \\ +$m_3$ := $m_1$ \ai[\tt]{before} $m_2$ & join of $m_1$ and $m_2$ +\\ $m_3$ := $m_2$($m_1)$ & join of $m_1$ and $m_2$ \\ +$m_3$ := $m_2$ \ai[\tt]{after} $m_1$ & join of $m_1$ and $m_2$ +\\ $f_3$ := $f_1$ \ai[\tt]{.} $f_2$ & join of $f_1$ and $f_2$, combining the lists of quasipolynomials over shared domains \\ @@ -311,14 +315,22 @@ $q_2$ := $m$ \ai[\tt]{.} $q_1$ & join of $m$ and $q_1$, taking the sum over all elements in the intersection of the range of $m$ and the domain of $q_1$ \\ +$q_2$ := $m$ \ai[\tt]{before} $q_1$ & $q_2$ := $m$ \ai[\tt]{.} $q_1$ +\\ $q_2$ := $q_1(m)$ & $q_2$ := $m$ \ai[\tt]{.} $q_1$ \\ +$q_2$ := $q_1$ \ai[\tt]{after} $m$ & $q_2$ := $m$ \ai[\tt]{.} $q_1$ +\\ $f_2$ := $m$ \ai[\tt]{.} $f_1$ & join of $m$ and $f_1$, computing a bound over all elements in the intersection of the range of $m$ and the domain of $f_1$ \\ +$f_2$ := $m$ \ai[\tt]{before} $f_1$ & $f_2$ := $m$ \ai[\tt]{.} $f_1$ +\\ $f_2$ := $f_1(m)$ & $f_2$ := $m$ \ai[\tt]{.} $f_1$ \\ +$f_2$ := $f_1$ \ai[\tt]{after} $m$ & $f_2$ := $m$ \ai[\tt]{.} $f_1$ +\\ $m$ := $s_1$ \ai[\tt]{->} $s_2$ & universal map with domain $s_1$ and range $s_2$ \\ diff --git a/iscc.c b/iscc.c index 8d6344b..b3f23fc 100644 --- a/iscc.c +++ b/iscc.c @@ -411,7 +411,46 @@ struct isc_bin_op bin_ops[] = { (isc_bin_op_fn) &isl_str_concat }, 0 }; + +static __isl_give isl_union_map *map_after_map(__isl_take isl_union_map *umap1, + __isl_take isl_union_map *umap2) +{ + return isl_union_map_apply_range(umap2, umap1); +} + +static __isl_give isl_union_pw_qpolynomial *qpolynomial_after_map( + __isl_take isl_union_pw_qpolynomial *upwqp, + __isl_take isl_union_map *umap) +{ + return isl_union_map_apply_union_pw_qpolynomial(umap, upwqp); +} + +static __isl_give struct isl_list *qpolynomial_fold_after_map( + __isl_take isl_union_pw_qpolynomial_fold *upwf, + __isl_take isl_union_map *umap) +{ + return union_map_apply_union_pw_qpolynomial_fold(umap, upwf); +} + struct isc_named_bin_op named_bin_ops[] = { + { "after", { -1, isl_obj_union_map, isl_obj_union_map, + isl_obj_union_map, + (isc_bin_op_fn) &map_after_map } }, + { "after", { -1, isl_obj_union_pw_qpolynomial, + isl_obj_union_map, isl_obj_union_pw_qpolynomial, + (isc_bin_op_fn) &qpolynomial_after_map } }, + { "after", { -1, isl_obj_union_pw_qpolynomial_fold, + isl_obj_union_map, isl_obj_list, + (isc_bin_op_fn) &qpolynomial_fold_after_map } }, + { "before", { -1, isl_obj_union_map, isl_obj_union_map, + isl_obj_union_map, + (isc_bin_op_fn) &isl_union_map_apply_range } }, + { "before", { -1, isl_obj_union_map, + isl_obj_union_pw_qpolynomial, isl_obj_union_pw_qpolynomial, + (isc_bin_op_fn) &isl_union_map_apply_union_pw_qpolynomial } }, + { "before", { -1, isl_obj_union_map, + isl_obj_union_pw_qpolynomial_fold, isl_obj_list, + (isc_bin_op_fn) &union_map_apply_union_pw_qpolynomial_fold } }, { "cross", { -1, isl_obj_union_set, isl_obj_union_set, isl_obj_union_set, (isc_bin_op_fn) &isl_union_set_product } }, @@ -1166,7 +1205,7 @@ static __isl_give isl_union_map *read_map(struct isl_stream *s, { struct isl_obj obj; - obj = read_expr(s, table); + obj = read_obj(s, table); obj = convert(s->ctx, obj, isl_obj_union_map); isl_assert(s->ctx, obj.type == isl_obj_union_map, goto error); return obj.v; -- 2.11.4.GIT