From 1958e06fc7d498ca62b6fb6a52ce60fc194877c5 Mon Sep 17 00:00:00 2001 From: Alexandre Isoard Date: Fri, 26 Feb 2016 18:45:08 +0100 Subject: [PATCH] isl_output.c: also print dimension name for dimensions defined by equality If a dimension is defined by an equality then an affine expression is printed instead of the dimension name. For example, the map { [i] -> [j] : j = i } is printed as { [i] -> [i] } This has the side effect of dropping the name of the dimension from the printed representation. This commit prints both the name and the expression in the form of an equality if the dimension is named. The behavior is unchanged for unnamed dimensions. In other words, the same example is printed as follows: { [i] -> [j = i] } This kind of expression is already parsed correctly by isl. Signed-off-by: Alexandre Isoard Signed-off-by: Sven Verdoolaege --- isl_output.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/isl_output.c b/isl_output.c index aeb7a98e..a894cf8d 100644 --- a/isl_output.c +++ b/isl_output.c @@ -1134,7 +1134,8 @@ static int defining_equality(__isl_keep isl_basic_map *eq, * data->user is assumed to be an isl_basic_map keeping track of equalities. * * If the current dimension is defined by these equalities, then print - * the corresponding expression. Otherwise, print the name of the dimension. + * the corresponding expression, assigned to the name of the dimension + * if there is any. Otherwise, print the name of the dimension. */ static __isl_give isl_printer *print_dim_eq(__isl_take isl_printer *p, struct isl_print_space_data *data, unsigned pos) @@ -1144,6 +1145,11 @@ static __isl_give isl_printer *print_dim_eq(__isl_take isl_printer *p, j = defining_equality(eq, data->space, data->type, pos); if (j >= 0) { + if (isl_space_has_dim_name(data->space, data->type, pos)) { + p = print_name(data->space, p, data->type, pos, + data->latex); + p = isl_printer_print_str(p, " = "); + } pos += 1 + isl_space_offset(data->space, data->type); p = print_affine_of_len(eq->dim, NULL, p, eq->eq[j], pos); } else { -- 2.11.4.GIT