Polly 23.0.0git
isl_pw_print_templ.c
Go to the documentation of this file.
1/*
2 * Copyright 2011 Sven Verdoolaege
3 *
4 * Use of this software is governed by the MIT license
5 *
6 * Written by Sven Verdoolaege.
7 */
8
9#undef EL
10#define EL CAT(isl_,BASE)
11#undef PW
12#define PW CAT(isl_pw_,BASE)
13
14/* Print the empty body of a piecewise expression.
15 *
16 * In particular, print the space with some arbitrary value (zero)
17 * for all dimensions, followed by unsatisfiable constraints (false).
18 */
19static __isl_give isl_printer *FN(print_empty_body_pw,BASE)(
21{
22 struct isl_print_space_data data = { 0 };
24
25 space = FN(PW,get_space)(pw);
27 p = isl_print_space(space, p, 0, &data);
29 p = isl_printer_print_str(p, " : false");
30 return p;
31}
32
33/* Print the body of a piecewise expression, i.e., a semicolon delimited
34 * sequence of expressions, each followed by constraints.
35 */
36static __isl_give isl_printer *FN(print_body_pw,BASE)(
38{
39 int i;
40 isl_size n;
41
42 n = FN(PW,n_piece)(pw);
43 if (n < 0)
44 return isl_printer_free(p);
45
46 if (n == 0)
47 FN(print_empty_body_pw,BASE)(p, pw);
48
49 for (i = 0; i < n; ++i) {
50 EL *el;
52
53 if (i)
54 p = isl_printer_print_str(p, "; ");
55 el = FN(PW,peek_base_at)(pw, i);
56 p = FN(print_body,BASE)(p, el);
57 space = FN(EL,get_domain_space)(el);
58 p = print_disjuncts(set_to_map(pw->p[i].set), space, p, 0);
60 }
61 return p;
62}
63
64/* Print a piecewise expression in isl format.
65 */
66static __isl_give isl_printer *FN(FN(print_pw,BASE),isl)(
68{
69 struct isl_print_space_data data = { 0 };
70
71 if (!pw)
72 return isl_printer_free(p);
73
74 p = print_param_tuple(p, pw->dim, &data);
75 p = isl_printer_print_str(p, "{ ");
76 p = FN(print_body_pw,BASE)(p, pw);
77 p = isl_printer_print_str(p, " }");
78 return p;
79}
#define FN(TYPE, NAME)
#define __isl_take
Definition ctx.h:22
#define __isl_give
Definition ctx.h:19
#define __isl_keep
Definition ctx.h:25
int isl_size
Definition ctx.h:97
#define BASE
Definition flow_cmp.c:49
#define PW
Definition isl_aff.c:2897
#define EL
static __isl_give isl_printer * print_param_tuple(__isl_take isl_printer *p, __isl_keep isl_space *space, struct isl_print_space_data *data)
static __isl_give isl_printer * print_dim_zero(__isl_take isl_printer *p, struct isl_print_space_data *data, unsigned pos)
__isl_give isl_printer * isl_print_space(__isl_keep isl_space *space, __isl_take isl_printer *p, int rational, struct isl_print_space_data *data)
Definition isl_output.c:462
static __isl_give isl_printer * print_disjuncts(__isl_keep isl_map *map, __isl_keep isl_space *space, __isl_take isl_printer *p, int latex)
const char * p
Definition isl_test.c:8454
These are automatically generated conversions between the default and the checked C++ bindings for is...
Definition ISLTools.h:45
__isl_null isl_printer * isl_printer_free(__isl_take isl_printer *printer)
__isl_give isl_printer * isl_printer_print_str(__isl_take isl_printer *p, const char *s)
__isl_null isl_space * isl_space_free(__isl_take isl_space *space)
Definition isl_space.c:478
__isl_give isl_printer *(* print_dim)(__isl_take isl_printer *p, struct isl_print_space_data *data, unsigned pos)
static Signature set_to_map
n
Definition youcefn.c:8