File: isl_map_bound_templ.c

package info (click to toggle)
llvm-toolchain-13 1%3A13.0.1-11
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,418,840 kB
  • sloc: cpp: 5,290,826; ansic: 996,570; asm: 544,593; python: 188,212; objc: 72,027; lisp: 30,291; f90: 25,395; sh: 24,898; javascript: 9,780; pascal: 9,398; perl: 7,484; ml: 5,432; awk: 3,523; makefile: 2,913; xml: 953; cs: 573; fortran: 539
file content (57 lines) | stat: -rw-r--r-- 1,587 bytes parent folder | download | duplicates (23)
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
56
57
/*
 * Copyright 2018      Cerebras Systems
 *
 * Use of this software is governed by the MIT license
 *
 * Written by Sven Verdoolaege,
 * Cerebras Systems, 175 S San Antonio Rd, Los Altos, CA, USA
 */

#include "isl_multi_macro.h"
#undef TYPE
#define TYPE CAT(isl_,BASE)

/* Check that "map" and "multi" live in the same space, ignoring parameters.
 */
static isl_stat FN(check_map_equal_tuples_multi,BASE)(__isl_keep isl_map *map,
	__isl_keep MULTI(BASE) *multi)
{
	isl_space *map_space, *multi_space;

	map_space = isl_map_peek_space(map);
	multi_space = FN(MULTI(BASE),peek_space)(multi);
	return isl_space_check_equal_tuples(map_space, multi_space);
}

/* Apply "map_bound" to "map" with the corresponding value in "bound"
 * for each output dimension.
 * If "bound" has an explicit domain (which implies that "bound"
 * is zero-dimensional), then intersect the domain of "map"
 * with this explicit domain instead.
 */
static __isl_give isl_map *FN(map_bound_multi,BASE)(__isl_take isl_map *map,
	__isl_take MULTI(BASE) *bound,
	__isl_give isl_map *map_bound(__isl_take isl_map *map,
		unsigned pos, __isl_take TYPE *value))
{
	int i;
	isl_size dim;

	dim = isl_map_dim(map, isl_dim_out);
	if (dim < 0 || FN(check_map_equal_tuples_multi,BASE)(map, bound) < 0)
		goto error;

	for (i = 0; i < dim; ++i) {
		TYPE *el;

		el = FN(MULTI(BASE),get_at)(bound, i);
		map = map_bound(map, i, el);
	}
	map = FN(FN(isl_map_intersect_multi,BASE),explicit_domain)(map, bound);
	FN(MULTI(BASE),free)(bound);
	return map;
error:
	isl_map_free(map);
	FN(MULTI(BASE),free)(bound);
	return NULL;
}