From a6d1ff0fe3e91fa8b68af77f8bdfd4361682352d Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 14 Aug 2014 20:00:09 +0200 Subject: [PATCH] add isl_schedule_node_get_prefix_schedule_relation Signed-off-by: Sven Verdoolaege --- doc/user.pod | 5 +++++ include/isl/schedule_node.h | 2 ++ isl_schedule_node.c | 47 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+) diff --git a/doc/user.pod b/doc/user.pod index b8c27120..d8a613e9 100644 --- a/doc/user.pod +++ b/doc/user.pod @@ -7791,6 +7791,9 @@ partial schedules related to the node. isl_schedule_node_get_prefix_schedule_union_map( __isl_keep isl_schedule_node *node); __isl_give isl_union_map * + isl_schedule_node_get_prefix_schedule_relation( + __isl_keep isl_schedule_node *node); + __isl_give isl_union_map * isl_schedule_node_get_subtree_schedule_union_map( __isl_keep isl_schedule_node *node); @@ -7800,6 +7803,8 @@ C and C return a relative ordering on the domain elements that reach the given node determined by its ancestors. +The function C +additionally includes the domain constraints in the result. The function C returns a representation of the partial schedule defined by the subtree rooted at the given node. diff --git a/include/isl/schedule_node.h b/include/isl/schedule_node.h index 7d0842c8..25ce2fd8 100644 --- a/include/isl/schedule_node.h +++ b/include/isl/schedule_node.h @@ -148,6 +148,8 @@ isl_schedule_node_get_prefix_schedule_union_pw_multi_aff( __isl_keep isl_schedule_node *node); __isl_give isl_union_map *isl_schedule_node_get_prefix_schedule_union_map( __isl_keep isl_schedule_node *node); +__isl_give isl_union_map *isl_schedule_node_get_prefix_schedule_relation( + __isl_keep isl_schedule_node *node); __isl_give isl_union_map *isl_schedule_node_get_subtree_schedule_union_map( __isl_keep isl_schedule_node *node); __isl_give isl_union_map *isl_schedule_node_get_subtree_expansion( diff --git a/isl_schedule_node.c b/isl_schedule_node.c index 871b98aa..1f8db085 100644 --- a/isl_schedule_node.c +++ b/isl_schedule_node.c @@ -662,6 +662,53 @@ __isl_give isl_union_map *isl_schedule_node_get_prefix_schedule_union_map( return isl_union_map_from_union_pw_multi_aff(upma); } +/* Return the concatenation of the partial schedules of all outer band + * nodes of "node" intersected with all outer domain constraints. + * + * Essentially, this functions intersected the domain of the output + * of isl_schedule_node_get_prefix_schedule_union_map with the output + * of isl_schedule_node_get_domain, except that it only traverses + * the ancestors of "node" once. + */ +__isl_give isl_union_map *isl_schedule_node_get_prefix_schedule_relation( + __isl_keep isl_schedule_node *node) +{ + int n; + isl_space *space; + isl_union_map *prefix; + struct isl_schedule_node_get_filter_prefix_data data; + + if (!node) + return NULL; + + space = isl_schedule_get_space(node->schedule); + if (node->tree == node->schedule->root) + return isl_union_map_empty(space); + + space = isl_space_set_from_params(space); + data.initialized = 0; + data.universe_domain = 0; + data.universe_filter = 0; + data.collect_prefix = 1; + data.filter = NULL; + data.prefix = isl_multi_union_pw_aff_zero(space); + + n = isl_schedule_tree_list_n_schedule_tree(node->ancestors); + if (collect_filter_prefix(node->ancestors, n, &data) < 0) + data.prefix = isl_multi_union_pw_aff_free(data.prefix); + + if (data.prefix && + isl_multi_union_pw_aff_dim(data.prefix, isl_dim_set) == 0) { + isl_multi_union_pw_aff_free(data.prefix); + prefix = isl_union_map_from_domain(data.filter); + } else { + prefix = isl_union_map_from_multi_union_pw_aff(data.prefix); + prefix = isl_union_map_intersect_domain(prefix, data.filter); + } + + return prefix; +} + /* Return the domain elements that reach "node". * * If "node" is pointing at the root of the schedule tree, then -- 2.11.4.GIT