summaryrefslogtreecommitdiff
path: root/isl_schedule.c
diff options
context:
space:
mode:
Diffstat (limited to 'isl_schedule.c')
-rw-r--r--isl_schedule.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/isl_schedule.c b/isl_schedule.c
index 62b45836..6d98af37 100644
--- a/isl_schedule.c
+++ b/isl_schedule.c
@@ -478,6 +478,36 @@ error:
return NULL;
}
+/* Replace the domain of the schedule "schedule" with the gist
+ * of the original domain with respect to the parameter domain "context".
+ */
+__isl_give isl_schedule *isl_schedule_gist_domain_params(
+ __isl_take isl_schedule *schedule, __isl_take isl_set *context)
+{
+ enum isl_schedule_node_type root_type;
+ isl_schedule_node *node;
+
+ if (!schedule || !context)
+ goto error;
+
+ root_type = isl_schedule_tree_get_type(schedule->root);
+ if (root_type != isl_schedule_node_domain)
+ isl_die(isl_schedule_get_ctx(schedule), isl_error_invalid,
+ "root node must be a domain node", goto error);
+
+ node = isl_schedule_get_root(schedule);
+ isl_schedule_free(schedule);
+ node = isl_schedule_node_domain_gist_params(node, context);
+ schedule = isl_schedule_node_get_schedule(node);
+ isl_schedule_node_free(node);
+
+ return schedule;
+error:
+ isl_schedule_free(schedule);
+ isl_set_free(context);
+ return NULL;
+}
+
/* Return an isl_union_map representation of the schedule.
* If we still have access to the schedule tree, then we return
* an isl_union_map corresponding to the subtree schedule of the child
@@ -1102,3 +1132,23 @@ void isl_schedule_dump(__isl_keep isl_schedule *schedule)
isl_printer_free(printer);
}
+
+/* Return a string representation of "schedule".
+ * Print the schedule in flow format.
+ */
+__isl_give char *isl_schedule_to_str(__isl_keep isl_schedule *schedule)
+{
+ isl_printer *printer;
+ char *s;
+
+ if (!schedule)
+ return NULL;
+
+ printer = isl_printer_to_str(isl_schedule_get_ctx(schedule));
+ printer = isl_printer_set_yaml_style(printer, ISL_YAML_STYLE_FLOW);
+ printer = isl_printer_print_schedule(printer, schedule);
+ s = isl_printer_get_str(printer);
+ isl_printer_free(printer);
+
+ return s;
+}