From 78d6a460302ac3f23778d9483ff2402c224e3e01 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 20 Jun 2011 15:54:42 +0200 Subject: [PATCH] add isl_dim_dump Signed-off-by: Sven Verdoolaege --- include/isl/dim.h | 5 +++++ isl_output.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/include/isl/dim.h b/include/isl/dim.h index ed6b8f97..5cb26645 100644 --- a/include/isl/dim.h +++ b/include/isl/dim.h @@ -11,6 +11,7 @@ #define ISL_DIM_H #include +#include #if defined(__cplusplus) extern "C" { @@ -96,6 +97,10 @@ int isl_dim_compatible(struct isl_dim *dim1, struct isl_dim *dim2); unsigned isl_dim_size(__isl_keep isl_dim *dim, enum isl_dim_type type); unsigned isl_dim_total(struct isl_dim *dim); +__isl_give isl_printer *isl_printer_print_dim(__isl_take isl_printer *p, + __isl_keep isl_dim *dim); +void isl_dim_dump(__isl_keep isl_dim *dim); + #if defined(__cplusplus) } #endif diff --git a/isl_output.c b/isl_output.c index 8a2febd0..bfd64577 100644 --- a/isl_output.c +++ b/isl_output.c @@ -2120,6 +2120,43 @@ void isl_constraint_dump(__isl_keep isl_constraint *c) isl_printer_free(printer); } +__isl_give isl_printer *isl_printer_print_dim(__isl_take isl_printer *p, + __isl_keep isl_dim *dim) +{ + if (!dim) + goto error; + + if (isl_dim_size(dim, isl_dim_param) > 0) { + p = print_tuple(dim, p, isl_dim_param, 0, 0, NULL); + p = isl_printer_print_str(p, " -> "); + } + + p = isl_printer_print_str(p, "{ "); + p = print_tuple(dim, p, isl_dim_in, 0, 0, NULL); + p = isl_printer_print_str(p, " -> "); + p = print_tuple(dim, p, isl_dim_out, 0, 0, NULL); + p = isl_printer_print_str(p, " }"); + + return p; +error: + isl_printer_free(p); + return NULL; +} + +void isl_dim_dump(__isl_keep isl_dim *dim) +{ + isl_printer *printer; + + if (!dim) + return; + + printer = isl_printer_to_file(isl_dim_get_ctx(dim), stderr); + printer = isl_printer_print_dim(printer, dim); + printer = isl_printer_end_line(printer); + + isl_printer_free(printer); +} + __isl_give isl_printer *isl_printer_print_local_space(__isl_take isl_printer *p, __isl_keep isl_local_space *ls) { -- 2.11.4.GIT