From eb004c31d4680d6bedcdd2f640a2b264fde5c509 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sun, 6 Mar 2011 22:07:14 +0100 Subject: [PATCH] iscc: add pow Signed-off-by: Sven Verdoolaege --- doc/isl.tex | 6 ++++++ iscc.c | 29 +++++++++++++++++++++++++++++ isl | 2 +- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/doc/isl.tex b/doc/isl.tex index 1b3876f..d26d3f0 100644 --- a/doc/isl.tex +++ b/doc/isl.tex @@ -728,6 +728,12 @@ $q_2$ := \ai[\tt]{lpoly} $q_1$ & polynomial underapproximation of $q_1$ \\ $q_2$ := \ai[\tt]{upoly} $q_1$ & polynomial overapproximation of $q_1$ \\ +$l$ := \ai[\tt]{pow} $m$\ & +compute an overapproximation of the power +of $m$ and return a list containing the overapproximation +and a boolean that is true if the overapproximation +is known to be exact +\\ $o$ := \ai[\tt]{read} {\tt "}{\it filename}{\tt"} & read object from file \\ diff --git a/iscc.c b/iscc.c index a3c4117..c427327 100644 --- a/iscc.c +++ b/iscc.c @@ -561,6 +561,33 @@ __isl_give isl_map *union_map_sample(__isl_take isl_union_map *umap) return isl_map_from_basic_map(isl_union_map_sample(umap)); } +static __isl_give struct isl_list *union_map_power( + __isl_take isl_union_map *umap) +{ + isl_ctx *ctx; + struct isl_list *list; + int exact; + + ctx = isl_union_map_get_ctx(umap); + list = isl_list_alloc(ctx, 2); + if (!list) + goto error2; + + list->obj[0].type = isl_obj_union_map; + list->obj[0].v = isl_union_map_power(umap, &exact); + list->obj[1].type = isl_obj_bool; + list->obj[1].v = exact ? &isl_bool_true : &isl_bool_false; + if (exact < 0 || !list->obj[0].v) + goto error; + + return list; +error2: + isl_union_map_free(umap); +error: + isl_list_free(list); + return NULL; +} + static __isl_give struct isl_list *union_pw_qpolynomial_upper_bound( __isl_take isl_union_pw_qpolynomial *upwqp) { @@ -801,6 +828,8 @@ struct isc_named_un_op named_un_ops[] = { {"upoly", { -1, isl_obj_union_pw_qpolynomial, isl_obj_union_pw_qpolynomial, (isc_un_op_fn) &union_pw_qpolynomial_upoly } }, + {"pow", { -1, isl_obj_union_map, isl_obj_list, + (isc_un_op_fn) &union_map_power } }, {"sample", { -1, isl_obj_union_set, isl_obj_set, (isc_un_op_fn) &union_set_sample } }, {"sample", { -1, isl_obj_union_map, isl_obj_map, diff --git a/isl b/isl index 3482bf1..7677bff 160000 --- a/isl +++ b/isl @@ -1 +1 @@ -Subproject commit 3482bf1f4da8c70be2a8eae2554c6fadbd274b53 +Subproject commit 7677bff0e4a5599f65bec4137f485447efe7814a -- 2.11.4.GIT