File: isl_pw_print_templ.c

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (55 lines) | stat: -rw-r--r-- 1,237 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
 * Copyright 2011      Sven Verdoolaege
 *
 * Use of this software is governed by the MIT license
 *
 * Written by Sven Verdoolaege.
 */

#undef EL
#define EL CAT(isl_,BASE)
#undef PW
#define PW CAT(isl_pw_,BASE)

/* Print the body of a piecewise expression, i.e., a semicolon delimited
 * sequence of expressions, each followed by constraints.
 */
static __isl_give isl_printer *FN(print_body_pw,BASE)(
	__isl_take isl_printer *p, __isl_keep PW *pw)
{
	int i;

	if (!pw)
		return isl_printer_free(p);

	for (i = 0; i < pw->n; ++i) {
		EL *el;
		isl_space *space;

		if (i)
			p = isl_printer_print_str(p, "; ");
		el = FN(PW,peek_base_at)(pw, i);
		p = FN(print_body,BASE)(p, el);
		space = FN(EL,get_domain_space)(el);
		p = print_disjuncts(set_to_map(pw->p[i].set), space, p, 0);
		isl_space_free(space);
	}
	return p;
}

/* Print a piecewise expression in isl format.
 */
static __isl_give isl_printer *FN(FN(print_pw,BASE),isl)(
	__isl_take isl_printer *p, __isl_keep PW *pw)
{
	struct isl_print_space_data data = { 0 };

	if (!pw)
		return isl_printer_free(p);

	p = print_param_tuple(p, pw->dim, &data);
	p = isl_printer_print_str(p, "{ ");
	p = FN(print_body_pw,BASE)(p, pw);
	p = isl_printer_print_str(p, " }");
	return p;
}