File: isl_multi_tuple_id_templ.c

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (145 lines) | stat: -rw-r--r-- 4,000 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*
 * Copyright 2011      Sven Verdoolaege
 * Copyright 2012-2013 Ecole Normale Superieure
 *
 * Use of this software is governed by the MIT license
 *
 * Written by Sven Verdoolaege,
 * Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
 */

#include <isl/space.h>

#include <isl_multi_macro.h>

const char *FN(MULTI(BASE),get_tuple_name)(__isl_keep MULTI(BASE) *multi,
	enum isl_dim_type type)
{
	return multi ? isl_space_get_tuple_name(multi->space, type) : NULL;
}

/* Does the specified tuple have an id?
 */
isl_bool FN(MULTI(BASE),has_tuple_id)(__isl_keep MULTI(BASE) *multi,
	enum isl_dim_type type)
{
	if (!multi)
		return isl_bool_error;
	return isl_space_has_tuple_id(multi->space, type);
}

/* Does the (range) tuple of "multi" have an identifier?
 *
 * Technically, the implementation should use isl_dim_set if "multi"
 * lives in a set space and isl_dim_out if it lives in a map space.
 * Internally, however, it can be assumed that isl_dim_set is equal
 * to isl_dim_out.
 */
isl_bool FN(MULTI(BASE),has_range_tuple_id)(__isl_keep MULTI(BASE) *multi)
{
	return FN(MULTI(BASE),has_tuple_id)(multi, isl_dim_out);
}

/* Return the id of the specified tuple.
 */
__isl_give isl_id *FN(MULTI(BASE),get_tuple_id)(__isl_keep MULTI(BASE) *multi,
	enum isl_dim_type type)
{
	return multi ? isl_space_get_tuple_id(multi->space, type) : NULL;
}

/* Return the identifier of the (range) tuple of "multi", assuming it has one.
 *
 * Technically, the implementation should use isl_dim_set if "multi"
 * lives in a set space and isl_dim_out if it lives in a map space.
 * Internally, however, it can be assumed that isl_dim_set is equal
 * to isl_dim_out.
 */
__isl_give isl_id *FN(MULTI(BASE),get_range_tuple_id)(
	__isl_keep MULTI(BASE) *multi)
{
	return FN(MULTI(BASE),get_tuple_id)(multi, isl_dim_out);
}

__isl_give MULTI(BASE) *FN(MULTI(BASE),set_tuple_name)(
	__isl_keep MULTI(BASE) *multi, enum isl_dim_type type,
	const char *s)
{
	isl_space *space;

	multi = FN(MULTI(BASE),cow)(multi);
	if (!multi)
		return NULL;

	space = FN(MULTI(BASE),get_space)(multi);
	space = isl_space_set_tuple_name(space, type, s);

	return FN(MULTI(BASE),reset_space)(multi, space);
}

__isl_give MULTI(BASE) *FN(MULTI(BASE),set_tuple_id)(
	__isl_take MULTI(BASE) *multi, enum isl_dim_type type,
	__isl_take isl_id *id)
{
	isl_space *space;

	multi = FN(MULTI(BASE),cow)(multi);
	if (!multi)
		goto error;

	space = FN(MULTI(BASE),get_space)(multi);
	space = isl_space_set_tuple_id(space, type, id);

	return FN(MULTI(BASE),reset_space)(multi, space);
error:
	isl_id_free(id);
	return NULL;
}

/* Replace the identifier of the (range) tuple of "multi" by "id".
 *
 * Technically, the implementation should use isl_dim_set if "multi"
 * lives in a set space and isl_dim_out if it lives in a map space.
 * Internally, however, it can be assumed that isl_dim_set is equal
 * to isl_dim_out.
 */
__isl_give MULTI(BASE) *FN(MULTI(BASE),set_range_tuple_id)(
	__isl_take MULTI(BASE) *multi, __isl_take isl_id *id)
{
	return FN(MULTI(BASE),set_tuple_id)(multi, isl_dim_out, id);
}

/* Drop the id on the specified tuple.
 */
__isl_give MULTI(BASE) *FN(MULTI(BASE),reset_tuple_id)(
	__isl_take MULTI(BASE) *multi, enum isl_dim_type type)
{
	isl_space *space;

	if (!multi)
		return NULL;
	if (!FN(MULTI(BASE),has_tuple_id)(multi, type))
		return multi;

	multi = FN(MULTI(BASE),cow)(multi);
	if (!multi)
		return NULL;

	space = FN(MULTI(BASE),get_space)(multi);
	space = isl_space_reset_tuple_id(space, type);

	return FN(MULTI(BASE),reset_space)(multi, space);
}

/* Drop the identifier of the (range) tuple of "multi".
 *
 * Technically, the implementation should use isl_dim_set if "multi"
 * lives in a set space and isl_dim_out if it lives in a map space.
 * Internally, however, it can be assumed that isl_dim_set is equal
 * to isl_dim_out.
 */
__isl_give MULTI(BASE) *FN(MULTI(BASE),reset_range_tuple_id)(
	__isl_take MULTI(BASE) *multi)
{
	return FN(MULTI(BASE),reset_tuple_id)(multi, isl_dim_out);
}