Coverage Report

Created: 2018-02-20 23:11

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/polly/lib/External/isl/isl_union_templ.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2010      INRIA Saclay
3
 * Copyright 2013      Ecole Normale Superieure
4
 *
5
 * Use of this software is governed by the MIT license
6
 *
7
 * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France,
8
 * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod,
9
 * 91893 Orsay, France 
10
 * and Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
11
 */
12
13
__isl_give UNION *FN(UNION,cow)(__isl_take UNION *u);
14
15
isl_ctx *FN(UNION,get_ctx)(__isl_keep UNION *u)
16
39.1k
{
17
39.1k
  return u ? u->space->ctx : NULL;
18
39.1k
}
isl_union_pw_aff_get_ctx
Line
Count
Source
16
11.8k
{
17
11.8k
  return u ? u->space->ctx : NULL;
18
11.8k
}
isl_union_pw_multi_aff_get_ctx
Line
Count
Source
16
27.3k
{
17
27.3k
  return u ? u->space->ctx : NULL;
18
27.3k
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_get_ctx
isl_union_pw_qpolynomial_get_ctx
Line
Count
Source
16
7
{
17
7
  return u ? u->space->ctx : NULL;
18
7
}
19
20
__isl_give isl_space *FN(UNION,get_space)(__isl_keep UNION *u)
21
80.9k
{
22
80.9k
  if (!u)
23
0
    return NULL;
24
80.9k
  return isl_space_copy(u->space);
25
80.9k
}
isl_union_pw_aff_get_space
Line
Count
Source
21
53.9k
{
22
53.9k
  if (!u)
23
0
    return NULL;
24
53.9k
  return isl_space_copy(u->space);
25
53.9k
}
isl_union_pw_multi_aff_get_space
Line
Count
Source
21
27.0k
{
22
27.0k
  if (!u)
23
0
    return NULL;
24
27.0k
  return isl_space_copy(u->space);
25
27.0k
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_get_space
isl_union_pw_qpolynomial_get_space
Line
Count
Source
21
12
{
22
12
  if (!u)
23
0
    return NULL;
24
12
  return isl_space_copy(u->space);
25
12
}
26
27
/* Return the number of parameters of "u", where "type"
28
 * is required to be set to isl_dim_param.
29
 */
30
unsigned FN(UNION,dim)(__isl_keep UNION *u, enum isl_dim_type type)
31
0
{
32
0
  if (!u)
33
0
    return 0;
34
0
35
0
  if (type != isl_dim_param)
36
0
    isl_die(FN(UNION,get_ctx)(u), isl_error_invalid,
37
0
      "can only reference parameters", return 0);
38
0
39
0
  return isl_space_dim(u->space, type);
40
0
}
Unexecuted instantiation: isl_union_pw_aff_dim
Unexecuted instantiation: isl_union_pw_multi_aff_dim
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_dim
Unexecuted instantiation: isl_union_pw_qpolynomial_dim
41
42
/* Return the position of the parameter with the given name
43
 * in "u".
44
 * Return -1 if no such dimension can be found.
45
 */
46
int FN(UNION,find_dim_by_name)(__isl_keep UNION *u, enum isl_dim_type type,
47
  const char *name)
48
0
{
49
0
  if (!u)
50
0
    return -1;
51
0
  return isl_space_find_dim_by_name(u->space, type, name);
52
0
}
Unexecuted instantiation: isl_union_pw_aff_find_dim_by_name
Unexecuted instantiation: isl_union_pw_multi_aff_find_dim_by_name
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_find_dim_by_name
Unexecuted instantiation: isl_union_pw_qpolynomial_find_dim_by_name
53
54
#ifdef HAS_TYPE
55
static __isl_give UNION *FN(UNION,alloc)(__isl_take isl_space *dim,
56
  enum isl_fold type, int size)
57
#else
58
static __isl_give UNION *FN(UNION,alloc)(__isl_take isl_space *dim, int size)
59
#endif
60
18.9k
{
61
18.9k
  UNION *u;
62
18.9k
63
18.9k
  dim = isl_space_params(dim);
64
18.9k
  if (!dim)
65
0
    return NULL;
66
18.9k
67
18.9k
  u = isl_calloc_type(dim->ctx, UNION);
68
18.9k
  if (!u)
69
0
    goto error;
70
18.9k
71
18.9k
  u->ref = 1;
72
#ifdef HAS_TYPE
73
  u->type = type;
74
#endif
75
  u->space = dim;
76
18.9k
  if (isl_hash_table_init(dim->ctx, &u->table, size) < 0)
77
0
    return FN(UNION,free)(u);
78
18.9k
79
18.9k
  return u;
80
18.9k
error:
81
0
  isl_space_free(dim);
82
0
  return NULL;
83
18.9k
}
isl_aff.c:isl_union_pw_aff_alloc
Line
Count
Source
60
6.60k
{
61
6.60k
  UNION *u;
62
6.60k
63
6.60k
  dim = isl_space_params(dim);
64
6.60k
  if (!dim)
65
0
    return NULL;
66
6.60k
67
6.60k
  u = isl_calloc_type(dim->ctx, UNION);
68
6.60k
  if (!u)
69
0
    goto error;
70
6.60k
71
6.60k
  u->ref = 1;
72
#ifdef HAS_TYPE
73
  u->type = type;
74
#endif
75
  u->space = dim;
76
6.60k
  if (isl_hash_table_init(dim->ctx, &u->table, size) < 0)
77
0
    return FN(UNION,free)(u);
78
6.60k
79
6.60k
  return u;
80
6.60k
error:
81
0
  isl_space_free(dim);
82
0
  return NULL;
83
6.60k
}
isl_aff.c:isl_union_pw_multi_aff_alloc
Line
Count
Source
60
12.3k
{
61
12.3k
  UNION *u;
62
12.3k
63
12.3k
  dim = isl_space_params(dim);
64
12.3k
  if (!dim)
65
0
    return NULL;
66
12.3k
67
12.3k
  u = isl_calloc_type(dim->ctx, UNION);
68
12.3k
  if (!u)
69
0
    goto error;
70
12.3k
71
12.3k
  u->ref = 1;
72
#ifdef HAS_TYPE
73
  u->type = type;
74
#endif
75
  u->space = dim;
76
12.3k
  if (isl_hash_table_init(dim->ctx, &u->table, size) < 0)
77
0
    return FN(UNION,free)(u);
78
12.3k
79
12.3k
  return u;
80
12.3k
error:
81
0
  isl_space_free(dim);
82
0
  return NULL;
83
12.3k
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_alloc
isl_polynomial.c:isl_union_pw_qpolynomial_alloc
Line
Count
Source
60
4
{
61
4
  UNION *u;
62
4
63
4
  dim = isl_space_params(dim);
64
4
  if (!dim)
65
0
    return NULL;
66
4
67
4
  u = isl_calloc_type(dim->ctx, UNION);
68
4
  if (!u)
69
0
    goto error;
70
4
71
4
  u->ref = 1;
72
#ifdef HAS_TYPE
73
  u->type = type;
74
#endif
75
  u->space = dim;
76
4
  if (isl_hash_table_init(dim->ctx, &u->table, size) < 0)
77
0
    return FN(UNION,free)(u);
78
4
79
4
  return u;
80
4
error:
81
0
  isl_space_free(dim);
82
0
  return NULL;
83
4
}
84
85
#ifdef HAS_TYPE
86
__isl_give UNION *FN(UNION,ZERO)(__isl_take isl_space *dim, enum isl_fold type)
87
0
{
88
0
  return FN(UNION,alloc)(dim, type, 16);
89
0
}
90
#else
91
__isl_give UNION *FN(UNION,ZERO)(__isl_take isl_space *dim)
92
12.5k
{
93
12.5k
  return FN(UNION,alloc)(dim, 16);
94
12.5k
}
isl_union_pw_aff_empty
Line
Count
Source
92
2.86k
{
93
2.86k
  return FN(UNION,alloc)(dim, 16);
94
2.86k
}
isl_union_pw_multi_aff_empty
Line
Count
Source
92
9.70k
{
93
9.70k
  return FN(UNION,alloc)(dim, 16);
94
9.70k
}
isl_union_pw_qpolynomial_zero
Line
Count
Source
92
3
{
93
3
  return FN(UNION,alloc)(dim, 16);
94
3
}
95
#endif
96
97
__isl_give UNION *FN(UNION,copy)(__isl_keep UNION *u)
98
34.1k
{
99
34.1k
  if (!u)
100
0
    return NULL;
101
34.1k
102
34.1k
  u->ref++;
103
34.1k
  return u;
104
34.1k
}
isl_union_pw_aff_copy
Line
Count
Source
98
25.6k
{
99
25.6k
  if (!u)
100
0
    return NULL;
101
25.6k
102
25.6k
  u->ref++;
103
25.6k
  return u;
104
25.6k
}
isl_union_pw_multi_aff_copy
Line
Count
Source
98
8.46k
{
99
8.46k
  if (!u)
100
0
    return NULL;
101
8.46k
102
8.46k
  u->ref++;
103
8.46k
  return u;
104
8.46k
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_copy
isl_union_pw_qpolynomial_copy
Line
Count
Source
98
4
{
99
4
  if (!u)
100
0
    return NULL;
101
4
102
4
  u->ref++;
103
4
  return u;
104
4
}
105
106
/* Extract the element of "u" living in "space" (ignoring parameters).
107
 *
108
 * Return the ZERO element if "u" does not contain any element
109
 * living in "space".
110
 */
111
__isl_give PART *FN(FN(UNION,extract),PARTS)(__isl_keep UNION *u,
112
  __isl_take isl_space *space)
113
0
{
114
0
  struct isl_hash_table_entry *entry;
115
0
  isl_bool equal_params;
116
0
117
0
  if (!u || !space)
118
0
    goto error;
119
0
  equal_params = isl_space_has_equal_params(u->space, space);
120
0
  if (equal_params < 0)
121
0
    goto error;
122
0
  if (!equal_params) {
123
0
    space = isl_space_drop_dims(space, isl_dim_param,
124
0
          0, isl_space_dim(space, isl_dim_param));
125
0
    space = isl_space_align_params(space,
126
0
          FN(UNION,get_space)(u));
127
0
    if (!space)
128
0
      goto error;
129
0
  }
130
0
131
0
  entry = FN(UNION,find_part_entry)(u, space, 0);
132
0
  if (!entry)
133
0
    goto error;
134
0
  if (entry == isl_hash_table_entry_none)
135
#ifdef HAS_TYPE
136
0
    return FN(PART,ZERO)(space, u->type);
137
#else
138
0
    return FN(PART,ZERO)(space);
139
0
#endif
140
0
  isl_space_free(space);
141
0
  return FN(PART,copy)(entry->data);
142
0
error:
143
0
  isl_space_free(space);
144
0
  return NULL;
145
0
}
Unexecuted instantiation: isl_union_pw_aff_extract_pw_aff
Unexecuted instantiation: isl_union_pw_multi_aff_extract_pw_multi_aff
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_extract_pw_qpolynomial_fold
Unexecuted instantiation: isl_union_pw_qpolynomial_extract_pw_qpolynomial
146
147
/* Add "part" to "u".
148
 * If "disjoint" is set, then "u" is not allowed to already have
149
 * a part that is defined over a domain that overlaps with the domain
150
 * of "part".
151
 * Otherwise, compute the union sum of "part" and the part in "u"
152
 * defined on the same space.
153
 */
154
static __isl_give UNION *FN(UNION,add_part_generic)(__isl_take UNION *u,
155
  __isl_take PART *part, int disjoint)
156
24.1k
{
157
24.1k
  int empty;
158
24.1k
  struct isl_hash_table_entry *entry;
159
24.1k
160
24.1k
  if (!part)
161
0
    goto error;
162
24.1k
163
24.1k
  empty = FN(PART,IS_ZERO)(part);
164
24.1k
  if (empty < 0)
165
0
    goto error;
166
24.1k
  if (empty) {
167
1
    FN(PART,free)(part);
168
1
    return u;
169
1
  }
170
24.1k
171
24.1k
  u = FN(UNION,align_params)(u, FN(PART,get_space)(part));
172
24.1k
  part = FN(PART,align_params)(part, FN(UNION,get_space)(u));
173
24.1k
174
24.1k
  u = FN(UNION,cow)(u);
175
24.1k
176
24.1k
  if (!u)
177
0
    goto error;
178
24.1k
179
24.1k
  if (FN(UNION,check_disjoint_domain_other)(u, part) < 0)
180
1
    goto error;
181
24.1k
  entry = FN(UNION,find_part_entry)(u, part->dim, 1);
182
24.1k
  if (!entry)
183
0
    goto error;
184
24.1k
185
24.1k
  if (!entry->data)
186
24.1k
    entry->data = part;
187
3
  else {
188
3
    if (disjoint &&
189
3
        
FN1
(UNION,check_disjoint_domain)(entry->data, part) < 01
)
190
0
      goto error;
191
3
    entry->data = FN(PART,union_add_)(entry->data,
192
3
            FN(PART,copy)(part));
193
3
    if (!entry->data)
194
0
      goto error;
195
3
    empty = FN(PART,IS_ZERO)(part);
196
3
    if (empty < 0)
197
0
      goto error;
198
3
    if (empty)
199
0
      u = FN(UNION,remove_part_entry)(u, entry);
200
3
    FN(PART,free)(part);
201
3
  }
202
24.1k
203
24.1k
  return u;
204
24.1k
error:
205
1
  FN(PART,free)(part);
206
1
  FN(UNION,free)(u);
207
1
  return NULL;
208
24.1k
}
isl_aff.c:isl_union_pw_aff_add_part_generic
Line
Count
Source
156
10.5k
{
157
10.5k
  int empty;
158
10.5k
  struct isl_hash_table_entry *entry;
159
10.5k
160
10.5k
  if (!part)
161
0
    goto error;
162
10.5k
163
10.5k
  empty = FN(PART,IS_ZERO)(part);
164
10.5k
  if (empty < 0)
165
0
    goto error;
166
10.5k
  if (empty) {
167
0
    FN(PART,free)(part);
168
0
    return u;
169
0
  }
170
10.5k
171
10.5k
  u = FN(UNION,align_params)(u, FN(PART,get_space)(part));
172
10.5k
  part = FN(PART,align_params)(part, FN(UNION,get_space)(u));
173
10.5k
174
10.5k
  u = FN(UNION,cow)(u);
175
10.5k
176
10.5k
  if (!u)
177
0
    goto error;
178
10.5k
179
10.5k
  if (FN(UNION,check_disjoint_domain_other)(u, part) < 0)
180
0
    goto error;
181
10.5k
  entry = FN(UNION,find_part_entry)(u, part->dim, 1);
182
10.5k
  if (!entry)
183
0
    goto error;
184
10.5k
185
10.5k
  if (!entry->data)
186
10.5k
    entry->data = part;
187
0
  else {
188
0
    if (disjoint &&
189
0
        FN(UNION,check_disjoint_domain)(entry->data, part) < 0)
190
0
      goto error;
191
0
    entry->data = FN(PART,union_add_)(entry->data,
192
0
            FN(PART,copy)(part));
193
0
    if (!entry->data)
194
0
      goto error;
195
0
    empty = FN(PART,IS_ZERO)(part);
196
0
    if (empty < 0)
197
0
      goto error;
198
0
    if (empty)
199
0
      u = FN(UNION,remove_part_entry)(u, entry);
200
0
    FN(PART,free)(part);
201
0
  }
202
10.5k
203
10.5k
  return u;
204
10.5k
error:
205
0
  FN(PART,free)(part);
206
0
  FN(UNION,free)(u);
207
0
  return NULL;
208
10.5k
}
isl_aff.c:isl_union_pw_multi_aff_add_part_generic
Line
Count
Source
156
13.6k
{
157
13.6k
  int empty;
158
13.6k
  struct isl_hash_table_entry *entry;
159
13.6k
160
13.6k
  if (!part)
161
0
    goto error;
162
13.6k
163
13.6k
  empty = FN(PART,IS_ZERO)(part);
164
13.6k
  if (empty < 0)
165
0
    goto error;
166
13.6k
  if (empty) {
167
1
    FN(PART,free)(part);
168
1
    return u;
169
1
  }
170
13.6k
171
13.6k
  u = FN(UNION,align_params)(u, FN(PART,get_space)(part));
172
13.6k
  part = FN(PART,align_params)(part, FN(UNION,get_space)(u));
173
13.6k
174
13.6k
  u = FN(UNION,cow)(u);
175
13.6k
176
13.6k
  if (!u)
177
0
    goto error;
178
13.6k
179
13.6k
  if (FN(UNION,check_disjoint_domain_other)(u, part) < 0)
180
1
    goto error;
181
13.6k
  entry = FN(UNION,find_part_entry)(u, part->dim, 1);
182
13.6k
  if (!entry)
183
0
    goto error;
184
13.6k
185
13.6k
  if (!entry->data)
186
13.6k
    entry->data = part;
187
3
  else {
188
3
    if (disjoint &&
189
3
        
FN1
(UNION,check_disjoint_domain)(entry->data, part) < 01
)
190
0
      goto error;
191
3
    entry->data = FN(PART,union_add_)(entry->data,
192
3
            FN(PART,copy)(part));
193
3
    if (!entry->data)
194
0
      goto error;
195
3
    empty = FN(PART,IS_ZERO)(part);
196
3
    if (empty < 0)
197
0
      goto error;
198
3
    if (empty)
199
0
      u = FN(UNION,remove_part_entry)(u, entry);
200
3
    FN(PART,free)(part);
201
3
  }
202
13.6k
203
13.6k
  return u;
204
13.6k
error:
205
1
  FN(PART,free)(part);
206
1
  FN(UNION,free)(u);
207
1
  return NULL;
208
13.6k
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_add_part_generic
isl_polynomial.c:isl_union_pw_qpolynomial_add_part_generic
Line
Count
Source
156
5
{
157
5
  int empty;
158
5
  struct isl_hash_table_entry *entry;
159
5
160
5
  if (!part)
161
0
    goto error;
162
5
163
5
  empty = FN(PART,IS_ZERO)(part);
164
5
  if (empty < 0)
165
0
    goto error;
166
5
  if (empty) {
167
0
    FN(PART,free)(part);
168
0
    return u;
169
0
  }
170
5
171
5
  u = FN(UNION,align_params)(u, FN(PART,get_space)(part));
172
5
  part = FN(PART,align_params)(part, FN(UNION,get_space)(u));
173
5
174
5
  u = FN(UNION,cow)(u);
175
5
176
5
  if (!u)
177
0
    goto error;
178
5
179
5
  if (FN(UNION,check_disjoint_domain_other)(u, part) < 0)
180
0
    goto error;
181
5
  entry = FN(UNION,find_part_entry)(u, part->dim, 1);
182
5
  if (!entry)
183
0
    goto error;
184
5
185
5
  if (!entry->data)
186
5
    entry->data = part;
187
0
  else {
188
0
    if (disjoint &&
189
0
        FN(UNION,check_disjoint_domain)(entry->data, part) < 0)
190
0
      goto error;
191
0
    entry->data = FN(PART,union_add_)(entry->data,
192
0
            FN(PART,copy)(part));
193
0
    if (!entry->data)
194
0
      goto error;
195
0
    empty = FN(PART,IS_ZERO)(part);
196
0
    if (empty < 0)
197
0
      goto error;
198
0
    if (empty)
199
0
      u = FN(UNION,remove_part_entry)(u, entry);
200
0
    FN(PART,free)(part);
201
0
  }
202
5
203
5
  return u;
204
5
error:
205
0
  FN(PART,free)(part);
206
0
  FN(UNION,free)(u);
207
0
  return NULL;
208
5
}
209
210
/* Add "part" to "u", where "u" is assumed not to already have
211
 * a part that is defined on the same space as "part".
212
 */
213
__isl_give UNION *FN(FN(UNION,add),PARTS)(__isl_take UNION *u,
214
  __isl_take PART *part)
215
23.7k
{
216
23.7k
  return FN(UNION,add_part_generic)(u, part, 1);
217
23.7k
}
isl_union_pw_aff_add_pw_aff
Line
Count
Source
215
10.2k
{
216
10.2k
  return FN(UNION,add_part_generic)(u, part, 1);
217
10.2k
}
isl_union_pw_multi_aff_add_pw_multi_aff
Line
Count
Source
215
13.4k
{
216
13.4k
  return FN(UNION,add_part_generic)(u, part, 1);
217
13.4k
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_add_pw_qpolynomial_fold
isl_union_pw_qpolynomial_add_pw_qpolynomial
Line
Count
Source
215
4
{
216
4
  return FN(UNION,add_part_generic)(u, part, 1);
217
4
}
218
219
#ifdef HAS_TYPE
220
/* Allocate a UNION with the same type and the same size as "u" and
221
 * with space "space".
222
 */
223
static __isl_give UNION *FN(UNION,alloc_same_size_on_space)(__isl_keep UNION *u,
224
  __isl_take isl_space *space)
225
0
{
226
0
  if (!u)
227
0
    goto error;
228
0
  return FN(UNION,alloc)(space, u->type, u->table.n);
229
0
error:
230
0
  isl_space_free(space);
231
0
  return NULL;
232
0
}
233
#else
234
/* Allocate a UNION with the same size as "u" and with space "space".
235
 */
236
static __isl_give UNION *FN(UNION,alloc_same_size_on_space)(__isl_keep UNION *u,
237
  __isl_take isl_space *space)
238
6.38k
{
239
6.38k
  if (!u)
240
0
    goto error;
241
6.38k
  return FN(UNION,alloc)(space, u->table.n);
242
6.38k
error:
243
0
  isl_space_free(space);
244
0
  return NULL;
245
6.38k
}
isl_aff.c:isl_union_pw_aff_alloc_same_size_on_space
Line
Count
Source
238
3.74k
{
239
3.74k
  if (!u)
240
0
    goto error;
241
3.74k
  return FN(UNION,alloc)(space, u->table.n);
242
3.74k
error:
243
0
  isl_space_free(space);
244
0
  return NULL;
245
3.74k
}
isl_aff.c:isl_union_pw_multi_aff_alloc_same_size_on_space
Line
Count
Source
238
2.64k
{
239
2.64k
  if (!u)
240
0
    goto error;
241
2.64k
  return FN(UNION,alloc)(space, u->table.n);
242
2.64k
error:
243
0
  isl_space_free(space);
244
0
  return NULL;
245
2.64k
}
isl_polynomial.c:isl_union_pw_qpolynomial_alloc_same_size_on_space
Line
Count
Source
238
1
{
239
1
  if (!u)
240
0
    goto error;
241
1
  return FN(UNION,alloc)(space, u->table.n);
242
1
error:
243
0
  isl_space_free(space);
244
0
  return NULL;
245
1
}
246
#endif
247
248
/* Allocate a UNION with the same space, the same type (if any) and
249
 * the same size as "u".
250
 */
251
static __isl_give UNION *FN(UNION,alloc_same_size)(__isl_keep UNION *u)
252
1.34k
{
253
1.34k
  return FN(UNION,alloc_same_size_on_space)(u, FN(UNION,get_space)(u));
254
1.34k
}
isl_aff.c:isl_union_pw_multi_aff_alloc_same_size
Line
Count
Source
252
123
{
253
123
  return FN(UNION,alloc_same_size_on_space)(u, FN(UNION,get_space)(u));
254
123
}
isl_aff.c:isl_union_pw_aff_alloc_same_size
Line
Count
Source
252
1.22k
{
253
1.22k
  return FN(UNION,alloc_same_size_on_space)(u, FN(UNION,get_space)(u));
254
1.22k
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_alloc_same_size
isl_polynomial.c:isl_union_pw_qpolynomial_alloc_same_size
Line
Count
Source
252
1
{
253
1
  return FN(UNION,alloc_same_size_on_space)(u, FN(UNION,get_space)(u));
254
1
}
255
256
/* Internal data structure for isl_union_*_transform_space.
257
 * "fn' is applied to each entry in the input.
258
 * "res" collects the results.
259
 */
260
S(UNION,transform_data)
261
{
262
  __isl_give PART *(*fn)(__isl_take PART *part, void *user);
263
  void *user;
264
265
  UNION *res;
266
};
267
268
/* Apply data->fn to "part" and add the result to data->res.
269
 */
270
static isl_stat FN(UNION,transform_entry)(__isl_take PART *part, void *user)
271
5.92k
{
272
5.92k
  S(UNION,transform_data) *data = (S(UNION,transform_data) *)user;
273
5.92k
274
5.92k
  part = data->fn(part, data->user);
275
5.92k
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
276
5.92k
  if (!data->res)
277
0
    return isl_stat_error;
278
5.92k
279
5.92k
  return isl_stat_ok;
280
5.92k
}
isl_aff.c:isl_union_pw_aff_transform_entry
Line
Count
Source
271
3.62k
{
272
3.62k
  S(UNION,transform_data) *data = (S(UNION,transform_data) *)user;
273
3.62k
274
3.62k
  part = data->fn(part, data->user);
275
3.62k
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
276
3.62k
  if (!data->res)
277
0
    return isl_stat_error;
278
3.62k
279
3.62k
  return isl_stat_ok;
280
3.62k
}
isl_aff.c:isl_union_pw_multi_aff_transform_entry
Line
Count
Source
271
2.29k
{
272
2.29k
  S(UNION,transform_data) *data = (S(UNION,transform_data) *)user;
273
2.29k
274
2.29k
  part = data->fn(part, data->user);
275
2.29k
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
276
2.29k
  if (!data->res)
277
0
    return isl_stat_error;
278
2.29k
279
2.29k
  return isl_stat_ok;
280
2.29k
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_transform_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_transform_entry
281
282
/* Return a UNION living in "space" that is obtained by applying "fn"
283
 * to each of the entries in "u".
284
 */
285
static __isl_give UNION *FN(UNION,transform_space)(__isl_take UNION *u,
286
  isl_space *space,
287
  __isl_give PART *(*fn)(__isl_take PART *part, void *user), void *user)
288
5.04k
{
289
5.04k
  S(UNION,transform_data) data = { fn, user };
290
5.04k
291
5.04k
  data.res = FN(UNION,alloc_same_size_on_space)(u, space);
292
5.04k
  if (FN(FN(UNION,foreach),PARTS)(u,
293
5.04k
          &FN(UNION,transform_entry), &data) < 0)
294
0
    data.res = FN(UNION,free)(data.res);
295
5.04k
  FN(UNION,free)(u);
296
5.04k
  return data.res;
297
5.04k
}
isl_aff.c:isl_union_pw_aff_transform_space
Line
Count
Source
288
2.51k
{
289
2.51k
  S(UNION,transform_data) data = { fn, user };
290
2.51k
291
2.51k
  data.res = FN(UNION,alloc_same_size_on_space)(u, space);
292
2.51k
  if (FN(FN(UNION,foreach),PARTS)(u,
293
2.51k
          &FN(UNION,transform_entry), &data) < 0)
294
0
    data.res = FN(UNION,free)(data.res);
295
2.51k
  FN(UNION,free)(u);
296
2.51k
  return data.res;
297
2.51k
}
isl_aff.c:isl_union_pw_multi_aff_transform_space
Line
Count
Source
288
2.52k
{
289
2.52k
  S(UNION,transform_data) data = { fn, user };
290
2.52k
291
2.52k
  data.res = FN(UNION,alloc_same_size_on_space)(u, space);
292
2.52k
  if (FN(FN(UNION,foreach),PARTS)(u,
293
2.52k
          &FN(UNION,transform_entry), &data) < 0)
294
0
    data.res = FN(UNION,free)(data.res);
295
2.52k
  FN(UNION,free)(u);
296
2.52k
  return data.res;
297
2.52k
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_transform_space
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_transform_space
298
299
/* Return a UNION that lives in the same space as "u" and that is obtained
300
 * by applying "fn" to each of the entries in "u".
301
 */
302
static __isl_give UNION *FN(UNION,transform)(__isl_take UNION *u,
303
  __isl_give PART *(*fn)(__isl_take PART *part, void *user), void *user)
304
4.87k
{
305
4.87k
  return FN(UNION,transform_space)(u, FN(UNION,get_space)(u), fn, user);
306
4.87k
}
isl_aff.c:isl_union_pw_aff_transform
Line
Count
Source
304
2.35k
{
305
2.35k
  return FN(UNION,transform_space)(u, FN(UNION,get_space)(u), fn, user);
306
2.35k
}
isl_aff.c:isl_union_pw_multi_aff_transform
Line
Count
Source
304
2.51k
{
305
2.51k
  return FN(UNION,transform_space)(u, FN(UNION,get_space)(u), fn, user);
306
2.51k
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_transform
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_transform
307
308
/* Apply data->fn to *part and store the result back into *part.
309
 */
310
static isl_stat FN(UNION,transform_inplace_entry)(void **part, void *user)
311
990
{
312
990
  S(UNION,transform_data) *data = (S(UNION,transform_data) *) user;
313
990
314
990
  *part = data->fn(*part, data->user);
315
990
  if (!*part)
316
0
    return isl_stat_error;
317
990
  return isl_stat_ok;
318
990
}
isl_aff.c:isl_union_pw_aff_transform_inplace_entry
Line
Count
Source
311
990
{
312
990
  S(UNION,transform_data) *data = (S(UNION,transform_data) *) user;
313
990
314
990
  *part = data->fn(*part, data->user);
315
990
  if (!*part)
316
0
    return isl_stat_error;
317
990
  return isl_stat_ok;
318
990
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_transform_inplace_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_transform_inplace_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_transform_inplace_entry
319
320
/* Update "u" by applying "fn" to each entry.
321
 * This operation is assumed not to change the number of entries nor
322
 * the spaces of the entries.
323
 *
324
 * If there is only one reference to "u", then change "u" inplace.
325
 * Otherwise, create a new UNION from "u" and discard the original.
326
 */
327
static __isl_give UNION *FN(UNION,transform_inplace)(__isl_take UNION *u,
328
  __isl_give PART *(*fn)(__isl_take PART *part, void *user), void *user)
329
2.89k
{
330
2.89k
  isl_bool single_ref;
331
2.89k
332
2.89k
  single_ref = FN(UNION,has_single_reference)(u);
333
2.89k
  if (single_ref < 0)
334
0
    return FN(UNION,free)(u);
335
2.89k
  if (single_ref) {
336
684
    S(UNION,transform_data) data = { fn, user };
337
684
    if (FN(UNION,foreach_inplace)(u,
338
684
        &FN(UNION,transform_inplace_entry), &data) < 0)
339
0
      return FN(UNION,free)(u);
340
684
    return u;
341
684
  }
342
2.21k
  return FN(UNION,transform)(u, fn, user);
343
2.21k
}
isl_aff.c:isl_union_pw_aff_transform_inplace
Line
Count
Source
329
2.89k
{
330
2.89k
  isl_bool single_ref;
331
2.89k
332
2.89k
  single_ref = FN(UNION,has_single_reference)(u);
333
2.89k
  if (single_ref < 0)
334
0
    return FN(UNION,free)(u);
335
2.89k
  if (single_ref) {
336
684
    S(UNION,transform_data) data = { fn, user };
337
684
    if (FN(UNION,foreach_inplace)(u,
338
684
        &FN(UNION,transform_inplace_entry), &data) < 0)
339
0
      return FN(UNION,free)(u);
340
684
    return u;
341
684
  }
342
2.21k
  return FN(UNION,transform)(u, fn, user);
343
2.21k
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_transform_inplace
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_transform_inplace
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_transform_inplace
344
345
/* An isl_union_*_transform callback for use in isl_union_*_dup
346
 * that simply returns "part".
347
 */
348
static __isl_give PART *FN(UNION,copy_part)(__isl_take PART *part, void *user)
349
2.51k
{
350
2.51k
  return part;
351
2.51k
}
isl_aff.c:isl_union_pw_aff_copy_part
Line
Count
Source
349
218
{
350
218
  return part;
351
218
}
isl_aff.c:isl_union_pw_multi_aff_copy_part
Line
Count
Source
349
2.29k
{
350
2.29k
  return part;
351
2.29k
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_copy_part
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_copy_part
352
353
__isl_give UNION *FN(UNION,dup)(__isl_keep UNION *u)
354
2.65k
{
355
2.65k
  u = FN(UNION,copy)(u);
356
2.65k
  return FN(UNION,transform)(u, &FN(UNION,copy_part), NULL);
357
2.65k
}
isl_union_pw_aff_dup
Line
Count
Source
354
142
{
355
142
  u = FN(UNION,copy)(u);
356
142
  return FN(UNION,transform)(u, &FN(UNION,copy_part), NULL);
357
142
}
isl_union_pw_multi_aff_dup
Line
Count
Source
354
2.51k
{
355
2.51k
  u = FN(UNION,copy)(u);
356
2.51k
  return FN(UNION,transform)(u, &FN(UNION,copy_part), NULL);
357
2.51k
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_dup
Unexecuted instantiation: isl_union_pw_qpolynomial_dup
358
359
__isl_give UNION *FN(UNION,cow)(__isl_take UNION *u)
360
24.5k
{
361
24.5k
  if (!u)
362
0
    return NULL;
363
24.5k
364
24.5k
  if (u->ref == 1)
365
21.8k
    return u;
366
2.65k
  u->ref--;
367
2.65k
  return FN(UNION,dup)(u);
368
2.65k
}
isl_union_pw_aff_cow
Line
Count
Source
360
10.7k
{
361
10.7k
  if (!u)
362
0
    return NULL;
363
10.7k
364
10.7k
  if (u->ref == 1)
365
10.6k
    return u;
366
142
  u->ref--;
367
142
  return FN(UNION,dup)(u);
368
142
}
isl_union_pw_multi_aff_cow
Line
Count
Source
360
13.7k
{
361
13.7k
  if (!u)
362
0
    return NULL;
363
13.7k
364
13.7k
  if (u->ref == 1)
365
11.2k
    return u;
366
2.51k
  u->ref--;
367
2.51k
  return FN(UNION,dup)(u);
368
2.51k
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_cow
isl_union_pw_qpolynomial_cow
Line
Count
Source
360
6
{
361
6
  if (!u)
362
0
    return NULL;
363
6
364
6
  if (u->ref == 1)
365
6
    return u;
366
0
  u->ref--;
367
0
  return FN(UNION,dup)(u);
368
0
}
369
370
__isl_null UNION *FN(UNION,free)(__isl_take UNION *u)
371
60.8k
{
372
60.8k
  if (!u)
373
10.4k
    return NULL;
374
50.3k
375
50.3k
  if (--u->ref > 0)
376
31.4k
    return NULL;
377
18.9k
378
18.9k
  isl_hash_table_foreach(u->space->ctx, &u->table,
379
18.9k
        &FN(UNION,free_u_entry), NULL);
380
18.9k
  isl_hash_table_clear(&u->table);
381
18.9k
  isl_space_free(u->space);
382
18.9k
  free(u);
383
18.9k
  return NULL;
384
18.9k
}
isl_union_pw_aff_free
Line
Count
Source
371
42.4k
{
372
42.4k
  if (!u)
373
10.4k
    return NULL;
374
32.0k
375
32.0k
  if (--u->ref > 0)
376
25.5k
    return NULL;
377
6.55k
378
6.55k
  isl_hash_table_foreach(u->space->ctx, &u->table,
379
6.55k
        &FN(UNION,free_u_entry), NULL);
380
6.55k
  isl_hash_table_clear(&u->table);
381
6.55k
  isl_space_free(u->space);
382
6.55k
  free(u);
383
6.55k
  return NULL;
384
6.55k
}
isl_union_pw_multi_aff_free
Line
Count
Source
371
18.3k
{
372
18.3k
  if (!u)
373
1
    return NULL;
374
18.3k
375
18.3k
  if (--u->ref > 0)
376
5.94k
    return NULL;
377
12.3k
378
12.3k
  isl_hash_table_foreach(u->space->ctx, &u->table,
379
12.3k
        &FN(UNION,free_u_entry), NULL);
380
12.3k
  isl_hash_table_clear(&u->table);
381
12.3k
  isl_space_free(u->space);
382
12.3k
  free(u);
383
12.3k
  return NULL;
384
12.3k
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_free
isl_union_pw_qpolynomial_free
Line
Count
Source
371
8
{
372
8
  if (!u)
373
0
    return NULL;
374
8
375
8
  if (--u->ref > 0)
376
4
    return NULL;
377
4
378
4
  isl_hash_table_foreach(u->space->ctx, &u->table,
379
4
        &FN(UNION,free_u_entry), NULL);
380
4
  isl_hash_table_clear(&u->table);
381
4
  isl_space_free(u->space);
382
4
  free(u);
383
4
  return NULL;
384
4
}
385
386
static __isl_give PART *FN(UNION,align_entry)(__isl_take PART *part, void *user)
387
286
{
388
286
  isl_reordering *exp = user;
389
286
390
286
  exp = isl_reordering_extend_space(isl_reordering_copy(exp),
391
286
            FN(PART,get_domain_space)(part));
392
286
  return FN(PART,realign_domain)(part, exp);
393
286
}
isl_aff.c:isl_union_pw_aff_align_entry
Line
Count
Source
387
286
{
388
286
  isl_reordering *exp = user;
389
286
390
286
  exp = isl_reordering_extend_space(isl_reordering_copy(exp),
391
286
            FN(PART,get_domain_space)(part));
392
286
  return FN(PART,realign_domain)(part, exp);
393
286
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_align_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_align_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_align_entry
394
395
/* Reorder the parameters of "u" according to the given reordering.
396
 */
397
static __isl_give UNION *FN(UNION,realign_domain)(__isl_take UNION *u,
398
  __isl_take isl_reordering *r)
399
169
{
400
169
  isl_space *space;
401
169
402
169
  if (!u || !r)
403
0
    goto error;
404
169
405
169
  space = isl_space_copy(r->dim);
406
169
  u = FN(UNION,transform_space)(u, space, &FN(UNION,align_entry), r);
407
169
  isl_reordering_free(r);
408
169
  return u;
409
169
error:
410
0
  FN(UNION,free)(u);
411
0
  isl_reordering_free(r);
412
0
  return NULL;
413
169
}
isl_aff.c:isl_union_pw_aff_realign_domain
Line
Count
Source
399
165
{
400
165
  isl_space *space;
401
165
402
165
  if (!u || !r)
403
0
    goto error;
404
165
405
165
  space = isl_space_copy(r->dim);
406
165
  u = FN(UNION,transform_space)(u, space, &FN(UNION,align_entry), r);
407
165
  isl_reordering_free(r);
408
165
  return u;
409
165
error:
410
0
  FN(UNION,free)(u);
411
0
  isl_reordering_free(r);
412
0
  return NULL;
413
165
}
isl_aff.c:isl_union_pw_multi_aff_realign_domain
Line
Count
Source
399
4
{
400
4
  isl_space *space;
401
4
402
4
  if (!u || !r)
403
0
    goto error;
404
4
405
4
  space = isl_space_copy(r->dim);
406
4
  u = FN(UNION,transform_space)(u, space, &FN(UNION,align_entry), r);
407
4
  isl_reordering_free(r);
408
4
  return u;
409
4
error:
410
0
  FN(UNION,free)(u);
411
0
  isl_reordering_free(r);
412
0
  return NULL;
413
4
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_realign_domain
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_realign_domain
414
415
/* Align the parameters of "u" to those of "model".
416
 */
417
__isl_give UNION *FN(UNION,align_params)(__isl_take UNION *u,
418
  __isl_take isl_space *model)
419
27.6k
{
420
27.6k
  isl_bool equal_params;
421
27.6k
  isl_reordering *r;
422
27.6k
423
27.6k
  if (!u || !model)
424
0
    goto error;
425
27.6k
426
27.6k
  equal_params = isl_space_has_equal_params(u->space, model);
427
27.6k
  if (equal_params < 0)
428
0
    goto error;
429
27.6k
  if (equal_params) {
430
27.6k
    isl_space_free(model);
431
27.6k
    return u;
432
27.6k
  }
433
5
434
5
  model = isl_space_params(model);
435
5
  r = isl_parameter_alignment_reordering(u->space, model);
436
5
  isl_space_free(model);
437
5
438
5
  return FN(UNION,realign_domain)(u, r);
439
5
error:
440
0
  isl_space_free(model);
441
0
  FN(UNION,free)(u);
442
0
  return NULL;
443
5
}
isl_union_pw_aff_align_params
Line
Count
Source
419
12.7k
{
420
12.7k
  isl_bool equal_params;
421
12.7k
  isl_reordering *r;
422
12.7k
423
12.7k
  if (!u || !model)
424
0
    goto error;
425
12.7k
426
12.7k
  equal_params = isl_space_has_equal_params(u->space, model);
427
12.7k
  if (equal_params < 0)
428
0
    goto error;
429
12.7k
  if (equal_params) {
430
12.7k
    isl_space_free(model);
431
12.7k
    return u;
432
12.7k
  }
433
1
434
1
  model = isl_space_params(model);
435
1
  r = isl_parameter_alignment_reordering(u->space, model);
436
1
  isl_space_free(model);
437
1
438
1
  return FN(UNION,realign_domain)(u, r);
439
1
error:
440
0
  isl_space_free(model);
441
0
  FN(UNION,free)(u);
442
0
  return NULL;
443
1
}
isl_union_pw_multi_aff_align_params
Line
Count
Source
419
14.9k
{
420
14.9k
  isl_bool equal_params;
421
14.9k
  isl_reordering *r;
422
14.9k
423
14.9k
  if (!u || !model)
424
0
    goto error;
425
14.9k
426
14.9k
  equal_params = isl_space_has_equal_params(u->space, model);
427
14.9k
  if (equal_params < 0)
428
0
    goto error;
429
14.9k
  if (equal_params) {
430
14.9k
    isl_space_free(model);
431
14.9k
    return u;
432
14.9k
  }
433
4
434
4
  model = isl_space_params(model);
435
4
  r = isl_parameter_alignment_reordering(u->space, model);
436
4
  isl_space_free(model);
437
4
438
4
  return FN(UNION,realign_domain)(u, r);
439
4
error:
440
0
  isl_space_free(model);
441
0
  FN(UNION,free)(u);
442
0
  return NULL;
443
4
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_align_params
isl_union_pw_qpolynomial_align_params
Line
Count
Source
419
10
{
420
10
  isl_bool equal_params;
421
10
  isl_reordering *r;
422
10
423
10
  if (!u || !model)
424
0
    goto error;
425
10
426
10
  equal_params = isl_space_has_equal_params(u->space, model);
427
10
  if (equal_params < 0)
428
0
    goto error;
429
10
  if (equal_params) {
430
10
    isl_space_free(model);
431
10
    return u;
432
10
  }
433
0
434
0
  model = isl_space_params(model);
435
0
  r = isl_parameter_alignment_reordering(u->space, model);
436
0
  isl_space_free(model);
437
0
438
0
  return FN(UNION,realign_domain)(u, r);
439
0
error:
440
0
  isl_space_free(model);
441
0
  FN(UNION,free)(u);
442
0
  return NULL;
443
0
}
444
445
/* Add "part" to *u, taking the union sum if "u" already has
446
 * a part defined on the same space as "part".
447
 */
448
static isl_stat FN(UNION,union_add_part)(__isl_take PART *part, void *user)
449
459
{
450
459
  UNION **u = (UNION **)user;
451
459
452
459
  *u = FN(UNION,add_part_generic)(*u, part, 0);
453
459
454
459
  return isl_stat_ok;
455
459
}
isl_aff.c:isl_union_pw_aff_union_add_part
Line
Count
Source
449
254
{
450
254
  UNION **u = (UNION **)user;
451
254
452
254
  *u = FN(UNION,add_part_generic)(*u, part, 0);
453
254
454
254
  return isl_stat_ok;
455
254
}
isl_aff.c:isl_union_pw_multi_aff_union_add_part
Line
Count
Source
449
204
{
450
204
  UNION **u = (UNION **)user;
451
204
452
204
  *u = FN(UNION,add_part_generic)(*u, part, 0);
453
204
454
204
  return isl_stat_ok;
455
204
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_union_add_part
isl_polynomial.c:isl_union_pw_qpolynomial_union_add_part
Line
Count
Source
449
1
{
450
1
  UNION **u = (UNION **)user;
451
1
452
1
  *u = FN(UNION,add_part_generic)(*u, part, 0);
453
1
454
1
  return isl_stat_ok;
455
1
}
456
457
/* Compute the sum of "u1" and "u2" on the union of their domains,
458
 * with the actual sum on the shared domain and
459
 * the defined expression on the symmetric difference of the domains.
460
 *
461
 * This is an internal function that is exposed under different
462
 * names depending on whether the base expressions have a zero default
463
 * value.
464
 * If they do, then this function is called "add".
465
 * Otherwise, it is called "union_add".
466
 */
467
static __isl_give UNION *FN(UNION,union_add_)(__isl_take UNION *u1,
468
  __isl_take UNION *u2)
469
374
{
470
374
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
471
374
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
472
374
473
374
  u1 = FN(UNION,cow)(u1);
474
374
475
374
  if (!u1 || !u2)
476
0
    goto error;
477
374
478
374
  if (FN(FN(UNION,foreach),PARTS)(u2, &FN(UNION,union_add_part), &u1) < 0)
479
0
    goto error;
480
374
481
374
  FN(UNION,free)(u2);
482
374
483
374
  return u1;
484
374
error:
485
0
  FN(UNION,free)(u1);
486
0
  FN(UNION,free)(u2);
487
0
  return NULL;
488
374
}
isl_aff.c:isl_union_pw_aff_union_add_
Line
Count
Source
469
254
{
470
254
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
471
254
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
472
254
473
254
  u1 = FN(UNION,cow)(u1);
474
254
475
254
  if (!u1 || !u2)
476
0
    goto error;
477
254
478
254
  if (FN(FN(UNION,foreach),PARTS)(u2, &FN(UNION,union_add_part), &u1) < 0)
479
0
    goto error;
480
254
481
254
  FN(UNION,free)(u2);
482
254
483
254
  return u1;
484
254
error:
485
0
  FN(UNION,free)(u1);
486
0
  FN(UNION,free)(u2);
487
0
  return NULL;
488
254
}
isl_aff.c:isl_union_pw_multi_aff_union_add_
Line
Count
Source
469
119
{
470
119
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
471
119
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
472
119
473
119
  u1 = FN(UNION,cow)(u1);
474
119
475
119
  if (!u1 || !u2)
476
0
    goto error;
477
119
478
119
  if (FN(FN(UNION,foreach),PARTS)(u2, &FN(UNION,union_add_part), &u1) < 0)
479
0
    goto error;
480
119
481
119
  FN(UNION,free)(u2);
482
119
483
119
  return u1;
484
119
error:
485
0
  FN(UNION,free)(u1);
486
0
  FN(UNION,free)(u2);
487
0
  return NULL;
488
119
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_union_add_
isl_polynomial.c:isl_union_pw_qpolynomial_union_add_
Line
Count
Source
469
1
{
470
1
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
471
1
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
472
1
473
1
  u1 = FN(UNION,cow)(u1);
474
1
475
1
  if (!u1 || !u2)
476
0
    goto error;
477
1
478
1
  if (FN(FN(UNION,foreach),PARTS)(u2, &FN(UNION,union_add_part), &u1) < 0)
479
0
    goto error;
480
1
481
1
  FN(UNION,free)(u2);
482
1
483
1
  return u1;
484
1
error:
485
0
  FN(UNION,free)(u1);
486
0
  FN(UNION,free)(u2);
487
0
  return NULL;
488
1
}
489
490
__isl_give UNION *FN(FN(UNION,from),PARTS)(__isl_take PART *part)
491
765
{
492
765
  isl_space *dim;
493
765
  UNION *u;
494
765
495
765
  if (!part)
496
0
    return NULL;
497
765
498
765
  dim = FN(PART,get_space)(part);
499
765
  dim = isl_space_drop_dims(dim, isl_dim_in, 0, isl_space_dim(dim, isl_dim_in));
500
765
  dim = isl_space_drop_dims(dim, isl_dim_out, 0, isl_space_dim(dim, isl_dim_out));
501
#ifdef HAS_TYPE
502
0
  u = FN(UNION,ZERO)(dim, part->type);
503
#else
504
765
  u = FN(UNION,ZERO)(dim);
505
#endif
506
765
  u = FN(FN(UNION,add),PARTS)(u, part);
507
765
508
765
  return u;
509
765
}
isl_union_pw_aff_from_pw_aff
Line
Count
Source
491
762
{
492
762
  isl_space *dim;
493
762
  UNION *u;
494
762
495
762
  if (!part)
496
0
    return NULL;
497
762
498
762
  dim = FN(PART,get_space)(part);
499
762
  dim = isl_space_drop_dims(dim, isl_dim_in, 0, isl_space_dim(dim, isl_dim_in));
500
762
  dim = isl_space_drop_dims(dim, isl_dim_out, 0, isl_space_dim(dim, isl_dim_out));
501
#ifdef HAS_TYPE
502
  u = FN(UNION,ZERO)(dim, part->type);
503
#else
504
762
  u = FN(UNION,ZERO)(dim);
505
762
#endif
506
762
  u = FN(FN(UNION,add),PARTS)(u, part);
507
762
508
762
  return u;
509
762
}
Unexecuted instantiation: isl_union_pw_multi_aff_from_pw_multi_aff
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_from_pw_qpolynomial_fold
isl_union_pw_qpolynomial_from_pw_qpolynomial
Line
Count
Source
491
3
{
492
3
  isl_space *dim;
493
3
  UNION *u;
494
3
495
3
  if (!part)
496
0
    return NULL;
497
3
498
3
  dim = FN(PART,get_space)(part);
499
3
  dim = isl_space_drop_dims(dim, isl_dim_in, 0, isl_space_dim(dim, isl_dim_in));
500
3
  dim = isl_space_drop_dims(dim, isl_dim_out, 0, isl_space_dim(dim, isl_dim_out));
501
#ifdef HAS_TYPE
502
  u = FN(UNION,ZERO)(dim, part->type);
503
#else
504
3
  u = FN(UNION,ZERO)(dim);
505
3
#endif
506
3
  u = FN(FN(UNION,add),PARTS)(u, part);
507
3
508
3
  return u;
509
3
}
510
511
S(UNION,match_bin_data) {
512
  UNION *u2;
513
  UNION *res;
514
  __isl_give PART *(*fn)(__isl_take PART *, __isl_take PART *);
515
};
516
517
/* Check if data->u2 has an element living in the same space as "part".
518
 * If so, call data->fn on the two elements and add the result to
519
 * data->res.
520
 */
521
static isl_stat FN(UNION,match_bin_entry)(__isl_take PART *part, void *user)
522
602
{
523
602
  S(UNION,match_bin_data) *data = user;
524
602
  struct isl_hash_table_entry *entry2;
525
602
  isl_space *space;
526
602
  PART *part2;
527
602
528
602
  space = FN(PART,get_space)(part);
529
602
  entry2 = FN(UNION,find_part_entry)(data->u2, space, 0);
530
602
  isl_space_free(space);
531
602
  if (!entry2)
532
0
    goto error;
533
602
  if (entry2 == isl_hash_table_entry_none) {
534
1
    FN(PART,free)(part);
535
1
    return isl_stat_ok;
536
1
  }
537
601
538
601
  part2 = entry2->data;
539
601
  if (!isl_space_tuple_is_equal(part->dim, isl_dim_out,
540
601
          part2->dim, isl_dim_out))
541
601
    
isl_die0
(FN(UNION,get_ctx)(data->u2), isl_error_invalid,
542
601
      "entries should have the same range space",
543
601
      goto error);
544
601
545
601
  part = data->fn(part, FN(PART, copy)(entry2->data));
546
601
547
601
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
548
601
  if (!data->res)
549
0
    return isl_stat_error;
550
601
551
601
  return isl_stat_ok;
552
601
error:
553
0
  FN(PART,free)(part);
554
0
  return isl_stat_error;
555
601
}
isl_aff.c:isl_union_pw_aff_match_bin_entry
Line
Count
Source
522
600
{
523
600
  S(UNION,match_bin_data) *data = user;
524
600
  struct isl_hash_table_entry *entry2;
525
600
  isl_space *space;
526
600
  PART *part2;
527
600
528
600
  space = FN(PART,get_space)(part);
529
600
  entry2 = FN(UNION,find_part_entry)(data->u2, space, 0);
530
600
  isl_space_free(space);
531
600
  if (!entry2)
532
0
    goto error;
533
600
  if (entry2 == isl_hash_table_entry_none) {
534
0
    FN(PART,free)(part);
535
0
    return isl_stat_ok;
536
0
  }
537
600
538
600
  part2 = entry2->data;
539
600
  if (!isl_space_tuple_is_equal(part->dim, isl_dim_out,
540
600
          part2->dim, isl_dim_out))
541
600
    
isl_die0
(FN(UNION,get_ctx)(data->u2), isl_error_invalid,
542
600
      "entries should have the same range space",
543
600
      goto error);
544
600
545
600
  part = data->fn(part, FN(PART, copy)(entry2->data));
546
600
547
600
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
548
600
  if (!data->res)
549
0
    return isl_stat_error;
550
600
551
600
  return isl_stat_ok;
552
600
error:
553
0
  FN(PART,free)(part);
554
0
  return isl_stat_error;
555
600
}
isl_aff.c:isl_union_pw_multi_aff_match_bin_entry
Line
Count
Source
522
2
{
523
2
  S(UNION,match_bin_data) *data = user;
524
2
  struct isl_hash_table_entry *entry2;
525
2
  isl_space *space;
526
2
  PART *part2;
527
2
528
2
  space = FN(PART,get_space)(part);
529
2
  entry2 = FN(UNION,find_part_entry)(data->u2, space, 0);
530
2
  isl_space_free(space);
531
2
  if (!entry2)
532
0
    goto error;
533
2
  if (entry2 == isl_hash_table_entry_none) {
534
1
    FN(PART,free)(part);
535
1
    return isl_stat_ok;
536
1
  }
537
1
538
1
  part2 = entry2->data;
539
1
  if (!isl_space_tuple_is_equal(part->dim, isl_dim_out,
540
1
          part2->dim, isl_dim_out))
541
1
    
isl_die0
(FN(UNION,get_ctx)(data->u2), isl_error_invalid,
542
1
      "entries should have the same range space",
543
1
      goto error);
544
1
545
1
  part = data->fn(part, FN(PART, copy)(entry2->data));
546
1
547
1
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
548
1
  if (!data->res)
549
0
    return isl_stat_error;
550
1
551
1
  return isl_stat_ok;
552
1
error:
553
0
  FN(PART,free)(part);
554
0
  return isl_stat_error;
555
1
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_match_bin_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_match_bin_entry
556
557
/* This function is currently only used from isl_polynomial.c
558
 * and not from isl_fold.c.
559
 */
560
static __isl_give UNION *FN(UNION,match_bin_op)(__isl_take UNION *u1,
561
  __isl_take UNION *u2,
562
  __isl_give PART *(*fn)(__isl_take PART *, __isl_take PART *))
563
  __attribute__ ((unused));
564
/* For each pair of elements in "u1" and "u2" living in the same space,
565
 * call "fn" and collect the results.
566
 */
567
static __isl_give UNION *FN(UNION,match_bin_op)(__isl_take UNION *u1,
568
  __isl_take UNION *u2,
569
  __isl_give PART *(*fn)(__isl_take PART *, __isl_take PART *))
570
406
{
571
406
  S(UNION,match_bin_data) data = { NULL, NULL, fn };
572
406
573
406
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
574
406
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
575
406
576
406
  if (!u1 || !u2)
577
0
    goto error;
578
406
579
406
  data.u2 = u2;
580
406
  data.res = FN(UNION,alloc_same_size)(u1);
581
406
  if (FN(FN(UNION,foreach),PARTS)(u1,
582
406
            &FN(UNION,match_bin_entry), &data) < 0)
583
0
    goto error;
584
406
585
406
  FN(UNION,free)(u1);
586
406
  FN(UNION,free)(u2);
587
406
  return data.res;
588
406
error:
589
0
  FN(UNION,free)(u1);
590
0
  FN(UNION,free)(u2);
591
0
  FN(UNION,free)(data.res);
592
0
  return NULL;
593
406
}
isl_aff.c:isl_union_pw_aff_match_bin_op
Line
Count
Source
570
405
{
571
405
  S(UNION,match_bin_data) data = { NULL, NULL, fn };
572
405
573
405
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
574
405
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
575
405
576
405
  if (!u1 || !u2)
577
0
    goto error;
578
405
579
405
  data.u2 = u2;
580
405
  data.res = FN(UNION,alloc_same_size)(u1);
581
405
  if (FN(FN(UNION,foreach),PARTS)(u1,
582
405
            &FN(UNION,match_bin_entry), &data) < 0)
583
0
    goto error;
584
405
585
405
  FN(UNION,free)(u1);
586
405
  FN(UNION,free)(u2);
587
405
  return data.res;
588
405
error:
589
0
  FN(UNION,free)(u1);
590
0
  FN(UNION,free)(u2);
591
0
  FN(UNION,free)(data.res);
592
0
  return NULL;
593
405
}
isl_aff.c:isl_union_pw_multi_aff_match_bin_op
Line
Count
Source
570
1
{
571
1
  S(UNION,match_bin_data) data = { NULL, NULL, fn };
572
1
573
1
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
574
1
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
575
1
576
1
  if (!u1 || !u2)
577
0
    goto error;
578
1
579
1
  data.u2 = u2;
580
1
  data.res = FN(UNION,alloc_same_size)(u1);
581
1
  if (FN(FN(UNION,foreach),PARTS)(u1,
582
1
            &FN(UNION,match_bin_entry), &data) < 0)
583
0
    goto error;
584
1
585
1
  FN(UNION,free)(u1);
586
1
  FN(UNION,free)(u2);
587
1
  return data.res;
588
1
error:
589
0
  FN(UNION,free)(u1);
590
0
  FN(UNION,free)(u2);
591
0
  FN(UNION,free)(data.res);
592
0
  return NULL;
593
1
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_match_bin_op
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_match_bin_op
594
595
/* Compute the sum of "u1" and "u2".
596
 *
597
 * If the base expressions have a default zero value, then the sum
598
 * is computed on the union of the domains of "u1" and "u2".
599
 * Otherwise, it is computed on their shared domains.
600
 */
601
__isl_give UNION *FN(UNION,add)(__isl_take UNION *u1, __isl_take UNION *u2)
602
140
{
603
#if DEFAULT_IS_ZERO
604
1
  return FN(UNION,union_add_)(u1, u2);
605
#else
606
139
  return FN(UNION,match_bin_op)(u1, u2, &FN(PART,add));
607
#endif
608
}
isl_union_pw_aff_add
Line
Count
Source
602
138
{
603
#if DEFAULT_IS_ZERO
604
  return FN(UNION,union_add_)(u1, u2);
605
#else
606
138
  return FN(UNION,match_bin_op)(u1, u2, &FN(PART,add));
607
138
#endif
608
138
}
isl_union_pw_multi_aff_add
Line
Count
Source
602
1
{
603
#if DEFAULT_IS_ZERO
604
  return FN(UNION,union_add_)(u1, u2);
605
#else
606
1
  return FN(UNION,match_bin_op)(u1, u2, &FN(PART,add));
607
1
#endif
608
1
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_add
isl_union_pw_qpolynomial_add
Line
Count
Source
602
1
{
603
1
#if DEFAULT_IS_ZERO
604
1
  return FN(UNION,union_add_)(u1, u2);
605
#else
606
  return FN(UNION,match_bin_op)(u1, u2, &FN(PART,add));
607
#endif
608
}
609
610
#ifndef NO_SUB
611
/* Subtract "u2" from "u1" and return the result.
612
 */
613
__isl_give UNION *FN(UNION,sub)(__isl_take UNION *u1, __isl_take UNION *u2)
614
267
{
615
267
  return FN(UNION,match_bin_op)(u1, u2, &FN(PART,sub));
616
267
}
isl_union_pw_aff_sub
Line
Count
Source
614
267
{
615
267
  return FN(UNION,match_bin_op)(u1, u2, &FN(PART,sub));
616
267
}
Unexecuted instantiation: isl_union_pw_multi_aff_sub
Unexecuted instantiation: isl_union_pw_qpolynomial_sub
617
#endif
618
619
S(UNION,any_set_data) {
620
  isl_set *set;
621
  __isl_give PW *(*fn)(__isl_take PW*, __isl_take isl_set*);
622
};
623
624
static __isl_give PART *FN(UNION,any_set_entry)(__isl_take PART *part,
625
  void *user)
626
0
{
627
0
  S(UNION,any_set_data) *data = user;
628
0
629
0
  return data->fn(part, isl_set_copy(data->set));
630
0
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_aff_any_set_entry
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_any_set_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_any_set_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_any_set_entry
631
632
/* Update each element of "u" by calling "fn" on the element and "set".
633
 */
634
static __isl_give UNION *FN(UNION,any_set_op)(__isl_take UNION *u,
635
  __isl_take isl_set *set,
636
  __isl_give PW *(*fn)(__isl_take PW*, __isl_take isl_set*))
637
0
{
638
0
  S(UNION,any_set_data) data = { NULL, fn };
639
0
640
0
  u = FN(UNION,align_params)(u, isl_set_get_space(set));
641
0
  set = isl_set_align_params(set, FN(UNION,get_space)(u));
642
0
643
0
  if (!u || !set)
644
0
    goto error;
645
0
646
0
  data.set = set;
647
0
  u = FN(UNION,transform)(u, &FN(UNION,any_set_entry), &data);
648
0
  isl_set_free(set);
649
0
  return u;
650
0
error:
651
0
  FN(UNION,free)(u);
652
0
  isl_set_free(set);
653
0
  return NULL;
654
0
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_aff_any_set_op
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_any_set_op
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_any_set_op
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_any_set_op
655
656
/* Intersect the domain of "u" with the parameter domain "context".
657
 */
658
__isl_give UNION *FN(UNION,intersect_params)(__isl_take UNION *u,
659
  __isl_take isl_set *set)
660
0
{
661
0
  return FN(UNION,any_set_op)(u, set, &FN(PW,intersect_params));
662
0
}
Unexecuted instantiation: isl_union_pw_aff_intersect_params
Unexecuted instantiation: isl_union_pw_multi_aff_intersect_params
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_intersect_params
Unexecuted instantiation: isl_union_pw_qpolynomial_intersect_params
663
664
/* Compute the gist of the domain of "u" with respect to
665
 * the parameter domain "context".
666
 */
667
__isl_give UNION *FN(UNION,gist_params)(__isl_take UNION *u,
668
  __isl_take isl_set *set)
669
0
{
670
0
  return FN(UNION,any_set_op)(u, set, &FN(PW,gist_params));
671
0
}
Unexecuted instantiation: isl_union_pw_aff_gist_params
Unexecuted instantiation: isl_union_pw_multi_aff_gist_params
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_gist_params
Unexecuted instantiation: isl_union_pw_qpolynomial_gist_params
672
673
S(UNION,match_domain_data) {
674
  isl_union_set *uset;
675
  UNION *res;
676
  __isl_give PW *(*fn)(__isl_take PW*, __isl_take isl_set*);
677
};
678
679
static int FN(UNION,set_has_dim)(const void *entry, const void *val)
680
418
{
681
418
  isl_set *set = (isl_set *)entry;
682
418
  isl_space *dim = (isl_space *)val;
683
418
684
418
  return isl_space_is_equal(set->dim, dim);
685
418
}
isl_aff.c:isl_union_pw_aff_set_has_dim
Line
Count
Source
680
388
{
681
388
  isl_set *set = (isl_set *)entry;
682
388
  isl_space *dim = (isl_space *)val;
683
388
684
388
  return isl_space_is_equal(set->dim, dim);
685
388
}
isl_aff.c:isl_union_pw_multi_aff_set_has_dim
Line
Count
Source
680
29
{
681
29
  isl_set *set = (isl_set *)entry;
682
29
  isl_space *dim = (isl_space *)val;
683
29
684
29
  return isl_space_is_equal(set->dim, dim);
685
29
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_set_has_dim
isl_polynomial.c:isl_union_pw_qpolynomial_set_has_dim
Line
Count
Source
680
1
{
681
1
  isl_set *set = (isl_set *)entry;
682
1
  isl_space *dim = (isl_space *)val;
683
1
684
1
  return isl_space_is_equal(set->dim, dim);
685
1
}
686
687
/* Find the set in data->uset that lives in the same space as the domain
688
 * of "part", apply data->fn to *entry and this set (if any), and add
689
 * the result to data->res.
690
 */
691
static isl_stat FN(UNION,match_domain_entry)(__isl_take PART *part, void *user)
692
605
{
693
605
  S(UNION,match_domain_data) *data = user;
694
605
  uint32_t hash;
695
605
  struct isl_hash_table_entry *entry2;
696
605
  isl_space *space;
697
605
698
605
  space = FN(PART,get_domain_space)(part);
699
605
  hash = isl_space_get_hash(space);
700
605
  entry2 = isl_hash_table_find(data->uset->dim->ctx, &data->uset->table,
701
605
             hash, &FN(UNION,set_has_dim), space, 0);
702
605
  isl_space_free(space);
703
605
  if (!entry2) {
704
187
    FN(PART,free)(part);
705
187
    return isl_stat_ok;
706
187
  }
707
418
708
418
  part = data->fn(part, isl_set_copy(entry2->data));
709
418
710
418
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
711
418
  if (!data->res)
712
0
    return isl_stat_error;
713
418
714
418
  return isl_stat_ok;
715
418
}
isl_aff.c:isl_union_pw_aff_match_domain_entry
Line
Count
Source
692
573
{
693
573
  S(UNION,match_domain_data) *data = user;
694
573
  uint32_t hash;
695
573
  struct isl_hash_table_entry *entry2;
696
573
  isl_space *space;
697
573
698
573
  space = FN(PART,get_domain_space)(part);
699
573
  hash = isl_space_get_hash(space);
700
573
  entry2 = isl_hash_table_find(data->uset->dim->ctx, &data->uset->table,
701
573
             hash, &FN(UNION,set_has_dim), space, 0);
702
573
  isl_space_free(space);
703
573
  if (!entry2) {
704
185
    FN(PART,free)(part);
705
185
    return isl_stat_ok;
706
185
  }
707
388
708
388
  part = data->fn(part, isl_set_copy(entry2->data));
709
388
710
388
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
711
388
  if (!data->res)
712
0
    return isl_stat_error;
713
388
714
388
  return isl_stat_ok;
715
388
}
isl_aff.c:isl_union_pw_multi_aff_match_domain_entry
Line
Count
Source
692
31
{
693
31
  S(UNION,match_domain_data) *data = user;
694
31
  uint32_t hash;
695
31
  struct isl_hash_table_entry *entry2;
696
31
  isl_space *space;
697
31
698
31
  space = FN(PART,get_domain_space)(part);
699
31
  hash = isl_space_get_hash(space);
700
31
  entry2 = isl_hash_table_find(data->uset->dim->ctx, &data->uset->table,
701
31
             hash, &FN(UNION,set_has_dim), space, 0);
702
31
  isl_space_free(space);
703
31
  if (!entry2) {
704
2
    FN(PART,free)(part);
705
2
    return isl_stat_ok;
706
2
  }
707
29
708
29
  part = data->fn(part, isl_set_copy(entry2->data));
709
29
710
29
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
711
29
  if (!data->res)
712
0
    return isl_stat_error;
713
29
714
29
  return isl_stat_ok;
715
29
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_match_domain_entry
isl_polynomial.c:isl_union_pw_qpolynomial_match_domain_entry
Line
Count
Source
692
1
{
693
1
  S(UNION,match_domain_data) *data = user;
694
1
  uint32_t hash;
695
1
  struct isl_hash_table_entry *entry2;
696
1
  isl_space *space;
697
1
698
1
  space = FN(PART,get_domain_space)(part);
699
1
  hash = isl_space_get_hash(space);
700
1
  entry2 = isl_hash_table_find(data->uset->dim->ctx, &data->uset->table,
701
1
             hash, &FN(UNION,set_has_dim), space, 0);
702
1
  isl_space_free(space);
703
1
  if (!entry2) {
704
0
    FN(PART,free)(part);
705
0
    return isl_stat_ok;
706
0
  }
707
1
708
1
  part = data->fn(part, isl_set_copy(entry2->data));
709
1
710
1
  data->res = FN(FN(UNION,add),PARTS)(data->res, part);
711
1
  if (!data->res)
712
0
    return isl_stat_error;
713
1
714
1
  return isl_stat_ok;
715
1
}
716
717
/* Apply fn to each pair of PW in u and set in uset such that
718
 * the set lives in the same space as the domain of PW
719
 * and collect the results.
720
 */
721
static __isl_give UNION *FN(UNION,match_domain_op)(__isl_take UNION *u,
722
  __isl_take isl_union_set *uset,
723
  __isl_give PW *(*fn)(__isl_take PW*, __isl_take isl_set*))
724
319
{
725
319
  S(UNION,match_domain_data) data = { NULL, NULL, fn };
726
319
727
319
  u = FN(UNION,align_params)(u, isl_union_set_get_space(uset));
728
319
  uset = isl_union_set_align_params(uset, FN(UNION,get_space)(u));
729
319
730
319
  if (!u || !uset)
731
0
    goto error;
732
319
733
319
  data.uset = uset;
734
319
  data.res = FN(UNION,alloc_same_size)(u);
735
319
  if (FN(FN(UNION,foreach),PARTS)(u,
736
319
           &FN(UNION,match_domain_entry), &data) < 0)
737
0
    goto error;
738
319
739
319
  FN(UNION,free)(u);
740
319
  isl_union_set_free(uset);
741
319
  return data.res;
742
319
error:
743
0
  FN(UNION,free)(u);
744
0
  isl_union_set_free(uset);
745
0
  FN(UNION,free)(data.res);
746
0
  return NULL;
747
319
}
isl_aff.c:isl_union_pw_aff_match_domain_op
Line
Count
Source
724
297
{
725
297
  S(UNION,match_domain_data) data = { NULL, NULL, fn };
726
297
727
297
  u = FN(UNION,align_params)(u, isl_union_set_get_space(uset));
728
297
  uset = isl_union_set_align_params(uset, FN(UNION,get_space)(u));
729
297
730
297
  if (!u || !uset)
731
0
    goto error;
732
297
733
297
  data.uset = uset;
734
297
  data.res = FN(UNION,alloc_same_size)(u);
735
297
  if (FN(FN(UNION,foreach),PARTS)(u,
736
297
           &FN(UNION,match_domain_entry), &data) < 0)
737
0
    goto error;
738
297
739
297
  FN(UNION,free)(u);
740
297
  isl_union_set_free(uset);
741
297
  return data.res;
742
297
error:
743
0
  FN(UNION,free)(u);
744
0
  isl_union_set_free(uset);
745
0
  FN(UNION,free)(data.res);
746
0
  return NULL;
747
297
}
isl_aff.c:isl_union_pw_multi_aff_match_domain_op
Line
Count
Source
724
21
{
725
21
  S(UNION,match_domain_data) data = { NULL, NULL, fn };
726
21
727
21
  u = FN(UNION,align_params)(u, isl_union_set_get_space(uset));
728
21
  uset = isl_union_set_align_params(uset, FN(UNION,get_space)(u));
729
21
730
21
  if (!u || !uset)
731
0
    goto error;
732
21
733
21
  data.uset = uset;
734
21
  data.res = FN(UNION,alloc_same_size)(u);
735
21
  if (FN(FN(UNION,foreach),PARTS)(u,
736
21
           &FN(UNION,match_domain_entry), &data) < 0)
737
0
    goto error;
738
21
739
21
  FN(UNION,free)(u);
740
21
  isl_union_set_free(uset);
741
21
  return data.res;
742
21
error:
743
0
  FN(UNION,free)(u);
744
0
  isl_union_set_free(uset);
745
0
  FN(UNION,free)(data.res);
746
0
  return NULL;
747
21
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_match_domain_op
isl_polynomial.c:isl_union_pw_qpolynomial_match_domain_op
Line
Count
Source
724
1
{
725
1
  S(UNION,match_domain_data) data = { NULL, NULL, fn };
726
1
727
1
  u = FN(UNION,align_params)(u, isl_union_set_get_space(uset));
728
1
  uset = isl_union_set_align_params(uset, FN(UNION,get_space)(u));
729
1
730
1
  if (!u || !uset)
731
0
    goto error;
732
1
733
1
  data.uset = uset;
734
1
  data.res = FN(UNION,alloc_same_size)(u);
735
1
  if (FN(FN(UNION,foreach),PARTS)(u,
736
1
           &FN(UNION,match_domain_entry), &data) < 0)
737
0
    goto error;
738
1
739
1
  FN(UNION,free)(u);
740
1
  isl_union_set_free(uset);
741
1
  return data.res;
742
1
error:
743
0
  FN(UNION,free)(u);
744
0
  isl_union_set_free(uset);
745
0
  FN(UNION,free)(data.res);
746
0
  return NULL;
747
1
}
748
749
/* Intersect the domain of "u" with "uset".
750
 * If "uset" is a parameters domain, then intersect the parameter
751
 * domain of "u" with this set.
752
 */
753
__isl_give UNION *FN(UNION,intersect_domain)(__isl_take UNION *u,
754
  __isl_take isl_union_set *uset)
755
27
{
756
27
  if (isl_union_set_is_params(uset))
757
0
    return FN(UNION,intersect_params)(u,
758
0
            isl_set_from_union_set(uset));
759
27
  return FN(UNION,match_domain_op)(u, uset, &FN(PW,intersect_domain));
760
27
}
isl_union_pw_aff_intersect_domain
Line
Count
Source
755
6
{
756
6
  if (isl_union_set_is_params(uset))
757
0
    return FN(UNION,intersect_params)(u,
758
0
            isl_set_from_union_set(uset));
759
6
  return FN(UNION,match_domain_op)(u, uset, &FN(PW,intersect_domain));
760
6
}
isl_union_pw_multi_aff_intersect_domain
Line
Count
Source
755
20
{
756
20
  if (isl_union_set_is_params(uset))
757
0
    return FN(UNION,intersect_params)(u,
758
0
            isl_set_from_union_set(uset));
759
20
  return FN(UNION,match_domain_op)(u, uset, &FN(PW,intersect_domain));
760
20
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_intersect_domain
isl_union_pw_qpolynomial_intersect_domain
Line
Count
Source
755
1
{
756
1
  if (isl_union_set_is_params(uset))
757
0
    return FN(UNION,intersect_params)(u,
758
0
            isl_set_from_union_set(uset));
759
1
  return FN(UNION,match_domain_op)(u, uset, &FN(PW,intersect_domain));
760
1
}
761
762
/* Take the set (which may be empty) in data->uset that lives
763
 * in the same space as the domain of "pw", subtract it from the domain
764
 * of "part" and return the result.
765
 */
766
static __isl_give PART *FN(UNION,subtract_domain_entry)(__isl_take PART *part,
767
  void *user)
768
3
{
769
3
  isl_union_set *uset = user;
770
3
  isl_space *space;
771
3
  isl_set *set;
772
3
773
3
  space = FN(PART,get_domain_space)(part);
774
3
  set = isl_union_set_extract_set(uset, space);
775
3
  return FN(PART,subtract_domain)(part, set);
776
3
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_aff_subtract_domain_entry
isl_aff.c:isl_union_pw_multi_aff_subtract_domain_entry
Line
Count
Source
768
3
{
769
3
  isl_union_set *uset = user;
770
3
  isl_space *space;
771
3
  isl_set *set;
772
3
773
3
  space = FN(PART,get_domain_space)(part);
774
3
  set = isl_union_set_extract_set(uset, space);
775
3
  return FN(PART,subtract_domain)(part, set);
776
3
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_subtract_domain_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_subtract_domain_entry
777
778
/* Subtract "uset' from the domain of "u".
779
 */
780
__isl_give UNION *FN(UNION,subtract_domain)(__isl_take UNION *u,
781
  __isl_take isl_union_set *uset)
782
3
{
783
3
  u = FN(UNION,transform)(u, &FN(UNION,subtract_domain_entry), uset);
784
3
  isl_union_set_free(uset);
785
3
  return u;
786
3
}
Unexecuted instantiation: isl_union_pw_aff_subtract_domain
isl_union_pw_multi_aff_subtract_domain
Line
Count
Source
782
3
{
783
3
  u = FN(UNION,transform)(u, &FN(UNION,subtract_domain_entry), uset);
784
3
  isl_union_set_free(uset);
785
3
  return u;
786
3
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_subtract_domain
Unexecuted instantiation: isl_union_pw_qpolynomial_subtract_domain
787
788
__isl_give UNION *FN(UNION,gist)(__isl_take UNION *u,
789
  __isl_take isl_union_set *uset)
790
292
{
791
292
  if (isl_union_set_is_params(uset))
792
0
    return FN(UNION,gist_params)(u, isl_set_from_union_set(uset));
793
292
  return FN(UNION,match_domain_op)(u, uset, &FN(PW,gist));
794
292
}
isl_union_pw_aff_gist
Line
Count
Source
790
291
{
791
291
  if (isl_union_set_is_params(uset))
792
0
    return FN(UNION,gist_params)(u, isl_set_from_union_set(uset));
793
291
  return FN(UNION,match_domain_op)(u, uset, &FN(PW,gist));
794
291
}
isl_union_pw_multi_aff_gist
Line
Count
Source
790
1
{
791
1
  if (isl_union_set_is_params(uset))
792
0
    return FN(UNION,gist_params)(u, isl_set_from_union_set(uset));
793
1
  return FN(UNION,match_domain_op)(u, uset, &FN(PW,gist));
794
1
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_gist
Unexecuted instantiation: isl_union_pw_qpolynomial_gist
795
796
/* Coalesce an entry in a UNION.  Coalescing is performed in-place.
797
 * Since the UNION may have several references, the entry is only
798
 * replaced if the coalescing is successful.
799
 */
800
static isl_stat FN(UNION,coalesce_entry)(void **entry, void *user)
801
0
{
802
0
  PART **part_p = (PART **) entry;
803
0
  PART *part;
804
0
805
0
  part = FN(PART,copy)(*part_p);
806
0
  part = FN(PW,coalesce)(part);
807
0
  if (!part)
808
0
    return isl_stat_error;
809
0
  FN(PART,free)(*part_p);
810
0
  *part_p = part;
811
0
812
0
  return isl_stat_ok;
813
0
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_aff_coalesce_entry
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_coalesce_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_coalesce_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_coalesce_entry
814
815
__isl_give UNION *FN(UNION,coalesce)(__isl_take UNION *u)
816
0
{
817
0
  if (FN(UNION,foreach_inplace)(u, &FN(UNION,coalesce_entry), NULL) < 0)
818
0
    goto error;
819
0
820
0
  return u;
821
0
error:
822
0
  FN(UNION,free)(u);
823
0
  return NULL;
824
0
}
Unexecuted instantiation: isl_union_pw_aff_coalesce
Unexecuted instantiation: isl_union_pw_multi_aff_coalesce
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_coalesce
Unexecuted instantiation: isl_union_pw_qpolynomial_coalesce
825
826
static isl_stat FN(UNION,domain_entry)(__isl_take PART *part, void *user)
827
9.68k
{
828
9.68k
  isl_union_set **uset = (isl_union_set **)user;
829
9.68k
830
9.68k
  *uset = isl_union_set_add_set(*uset, FN(PART,domain)(part));
831
9.68k
832
9.68k
  return isl_stat_ok;
833
9.68k
}
isl_aff.c:isl_union_pw_aff_domain_entry
Line
Count
Source
827
9.68k
{
828
9.68k
  isl_union_set **uset = (isl_union_set **)user;
829
9.68k
830
9.68k
  *uset = isl_union_set_add_set(*uset, FN(PART,domain)(part));
831
9.68k
832
9.68k
  return isl_stat_ok;
833
9.68k
}
isl_aff.c:isl_union_pw_multi_aff_domain_entry
Line
Count
Source
827
1
{
828
1
  isl_union_set **uset = (isl_union_set **)user;
829
1
830
1
  *uset = isl_union_set_add_set(*uset, FN(PART,domain)(part));
831
1
832
1
  return isl_stat_ok;
833
1
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_domain_entry
isl_polynomial.c:isl_union_pw_qpolynomial_domain_entry
Line
Count
Source
827
1
{
828
1
  isl_union_set **uset = (isl_union_set **)user;
829
1
830
1
  *uset = isl_union_set_add_set(*uset, FN(PART,domain)(part));
831
1
832
1
  return isl_stat_ok;
833
1
}
834
835
__isl_give isl_union_set *FN(UNION,domain)(__isl_take UNION *u)
836
6.01k
{
837
6.01k
  isl_union_set *uset;
838
6.01k
839
6.01k
  uset = isl_union_set_empty(FN(UNION,get_space)(u));
840
6.01k
  if (FN(FN(UNION,foreach),PARTS)(u, &FN(UNION,domain_entry), &uset) < 0)
841
0
    goto error;
842
6.01k
843
6.01k
  FN(UNION,free)(u);
844
6.01k
  
845
6.01k
  return uset;
846
6.01k
error:
847
0
  isl_union_set_free(uset);
848
0
  FN(UNION,free)(u);
849
0
  return NULL;
850
6.01k
}
isl_union_pw_aff_domain
Line
Count
Source
836
6.01k
{
837
6.01k
  isl_union_set *uset;
838
6.01k
839
6.01k
  uset = isl_union_set_empty(FN(UNION,get_space)(u));
840
6.01k
  if (FN(FN(UNION,foreach),PARTS)(u, &FN(UNION,domain_entry), &uset) < 0)
841
0
    goto error;
842
6.01k
843
6.01k
  FN(UNION,free)(u);
844
6.01k
  
845
6.01k
  return uset;
846
6.01k
error:
847
0
  isl_union_set_free(uset);
848
0
  FN(UNION,free)(u);
849
0
  return NULL;
850
6.01k
}
isl_union_pw_multi_aff_domain
Line
Count
Source
836
1
{
837
1
  isl_union_set *uset;
838
1
839
1
  uset = isl_union_set_empty(FN(UNION,get_space)(u));
840
1
  if (FN(FN(UNION,foreach),PARTS)(u, &FN(UNION,domain_entry), &uset) < 0)
841
0
    goto error;
842
1
843
1
  FN(UNION,free)(u);
844
1
  
845
1
  return uset;
846
1
error:
847
0
  isl_union_set_free(uset);
848
0
  FN(UNION,free)(u);
849
0
  return NULL;
850
1
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_domain
isl_union_pw_qpolynomial_domain
Line
Count
Source
836
1
{
837
1
  isl_union_set *uset;
838
1
839
1
  uset = isl_union_set_empty(FN(UNION,get_space)(u));
840
1
  if (FN(FN(UNION,foreach),PARTS)(u, &FN(UNION,domain_entry), &uset) < 0)
841
0
    goto error;
842
1
843
1
  FN(UNION,free)(u);
844
1
  
845
1
  return uset;
846
1
error:
847
0
  isl_union_set_free(uset);
848
0
  FN(UNION,free)(u);
849
0
  return NULL;
850
1
}
851
852
#ifdef HAS_TYPE
853
/* Negate the type of "u".
854
 */
855
static __isl_give UNION *FN(UNION,negate_type)(__isl_take UNION *u)
856
0
{
857
0
  u = FN(UNION,cow)(u);
858
0
  if (!u)
859
0
    return NULL;
860
0
  u->type = isl_fold_type_negate(u->type);
861
0
  return u;
862
0
}
863
#else
864
/* Negate the type of "u".
865
 * Since "u" does not have a type, do nothing.
866
 */
867
static __isl_give UNION *FN(UNION,negate_type)(__isl_take UNION *u)
868
0
{
869
0
  return u;
870
0
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_aff_negate_type
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_negate_type
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_negate_type
871
#endif
872
873
/* Multiply "part" by the isl_val "user" and return the result.
874
 */
875
static __isl_give PART *FN(UNION,scale_val_entry)(__isl_take PART *part,
876
  void *user)
877
155
{
878
155
  isl_val *v = user;
879
155
880
155
  return FN(PART,scale_val)(part, isl_val_copy(v));
881
155
}
isl_aff.c:isl_union_pw_aff_scale_val_entry
Line
Count
Source
877
155
{
878
155
  isl_val *v = user;
879
155
880
155
  return FN(PART,scale_val)(part, isl_val_copy(v));
881
155
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_scale_val_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_scale_val_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_scale_val_entry
882
883
/* Multiply "u" by "v" and return the result.
884
 */
885
__isl_give UNION *FN(UNION,scale_val)(__isl_take UNION *u,
886
  __isl_take isl_val *v)
887
170
{
888
170
  if (!u || !v)
889
0
    goto error;
890
170
  if (isl_val_is_one(v)) {
891
18
    isl_val_free(v);
892
18
    return u;
893
18
  }
894
152
895
152
  if (DEFAULT_IS_ZERO && 
u0
&&
isl_val_is_zero(v)0
) {
896
0
    UNION *zero;
897
0
    isl_space *space = FN(UNION,get_space)(u);
898
#ifdef HAS_TYPE
899
0
    zero = FN(UNION,ZERO)(space, u->type);
900
#else
901
0
    zero = FN(UNION,ZERO)(space);
902
#endif
903
0
    FN(UNION,free)(u);
904
0
    isl_val_free(v);
905
0
    return zero;
906
0
  }
907
152
908
152
  if (!isl_val_is_rat(v))
909
152
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
910
152
      "expecting rational factor", goto error);
911
152
912
152
  u = FN(UNION,transform_inplace)(u, &FN(UNION,scale_val_entry), v);
913
152
  if (isl_val_is_neg(v))
914
0
    u = FN(UNION,negate_type)(u);
915
152
916
152
  isl_val_free(v);
917
152
  return u;
918
152
error:
919
0
  isl_val_free(v);
920
0
  FN(UNION,free)(u);
921
0
  return NULL;
922
152
}
isl_union_pw_aff_scale_val
Line
Count
Source
887
170
{
888
170
  if (!u || !v)
889
0
    goto error;
890
170
  if (isl_val_is_one(v)) {
891
18
    isl_val_free(v);
892
18
    return u;
893
18
  }
894
152
895
152
  if (DEFAULT_IS_ZERO && 
u0
&&
isl_val_is_zero(v)0
) {
896
0
    UNION *zero;
897
0
    isl_space *space = FN(UNION,get_space)(u);
898
#ifdef HAS_TYPE
899
    zero = FN(UNION,ZERO)(space, u->type);
900
#else
901
0
    zero = FN(UNION,ZERO)(space);
902
0
#endif
903
0
    FN(UNION,free)(u);
904
0
    isl_val_free(v);
905
0
    return zero;
906
0
  }
907
152
908
152
  if (!isl_val_is_rat(v))
909
152
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
910
152
      "expecting rational factor", goto error);
911
152
912
152
  u = FN(UNION,transform_inplace)(u, &FN(UNION,scale_val_entry), v);
913
152
  if (isl_val_is_neg(v))
914
0
    u = FN(UNION,negate_type)(u);
915
152
916
152
  isl_val_free(v);
917
152
  return u;
918
152
error:
919
0
  isl_val_free(v);
920
0
  FN(UNION,free)(u);
921
0
  return NULL;
922
152
}
Unexecuted instantiation: isl_union_pw_multi_aff_scale_val
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_scale_val
Unexecuted instantiation: isl_union_pw_qpolynomial_scale_val
923
924
/* Divide "part" by the isl_val "user" and return the result.
925
 */
926
static __isl_give PART *FN(UNION,scale_down_val_entry)(__isl_take PART *part,
927
  void *user)
928
157
{
929
157
  isl_val *v = user;
930
157
931
157
  return FN(PART,scale_down_val)(part, isl_val_copy(v));
932
157
}
isl_aff.c:isl_union_pw_aff_scale_down_val_entry
Line
Count
Source
928
157
{
929
157
  isl_val *v = user;
930
157
931
157
  return FN(PART,scale_down_val)(part, isl_val_copy(v));
932
157
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_scale_down_val_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_scale_down_val_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_scale_down_val_entry
933
934
/* Divide "u" by "v" and return the result.
935
 */
936
__isl_give UNION *FN(UNION,scale_down_val)(__isl_take UNION *u,
937
  __isl_take isl_val *v)
938
172
{
939
172
  if (!u || !v)
940
0
    goto error;
941
172
  if (isl_val_is_one(v)) {
942
18
    isl_val_free(v);
943
18
    return u;
944
18
  }
945
154
946
154
  if (!isl_val_is_rat(v))
947
154
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
948
154
      "expecting rational factor", goto error);
949
154
  if (isl_val_is_zero(v))
950
154
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
951
154
      "cannot scale down by zero", goto error);
952
154
953
154
  u = FN(UNION,transform_inplace)(u, &FN(UNION,scale_down_val_entry), v);
954
154
  if (isl_val_is_neg(v))
955
0
    u = FN(UNION,negate_type)(u);
956
154
957
154
  isl_val_free(v);
958
154
  return u;
959
154
error:
960
0
  isl_val_free(v);
961
0
  FN(UNION,free)(u);
962
0
  return NULL;
963
154
}
isl_union_pw_aff_scale_down_val
Line
Count
Source
938
172
{
939
172
  if (!u || !v)
940
0
    goto error;
941
172
  if (isl_val_is_one(v)) {
942
18
    isl_val_free(v);
943
18
    return u;
944
18
  }
945
154
946
154
  if (!isl_val_is_rat(v))
947
154
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
948
154
      "expecting rational factor", goto error);
949
154
  if (isl_val_is_zero(v))
950
154
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
951
154
      "cannot scale down by zero", goto error);
952
154
953
154
  u = FN(UNION,transform_inplace)(u, &FN(UNION,scale_down_val_entry), v);
954
154
  if (isl_val_is_neg(v))
955
0
    u = FN(UNION,negate_type)(u);
956
154
957
154
  isl_val_free(v);
958
154
  return u;
959
154
error:
960
0
  isl_val_free(v);
961
0
  FN(UNION,free)(u);
962
0
  return NULL;
963
154
}
Unexecuted instantiation: isl_union_pw_multi_aff_scale_down_val
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_scale_down_val
Unexecuted instantiation: isl_union_pw_qpolynomial_scale_down_val
964
965
S(UNION,plain_is_equal_data)
966
{
967
  UNION *u2;
968
  isl_bool is_equal;
969
};
970
971
static isl_stat FN(UNION,plain_is_equal_entry)(void **entry, void *user)
972
33
{
973
33
  S(UNION,plain_is_equal_data) *data = user;
974
33
  struct isl_hash_table_entry *entry2;
975
33
  PW *pw = *entry;
976
33
977
33
  entry2 = FN(UNION,find_part_entry)(data->u2, pw->dim, 0);
978
33
  if (!entry2 || entry2 == isl_hash_table_entry_none) {
979
0
    if (!entry2)
980
0
      data->is_equal = isl_bool_error;
981
0
    else
982
0
      data->is_equal = isl_bool_false;
983
0
    return isl_stat_error;
984
0
  }
985
33
986
33
  data->is_equal = FN(PW,plain_is_equal)(pw, entry2->data);
987
33
  if (data->is_equal < 0 || !data->is_equal)
988
0
    return isl_stat_error;
989
33
990
33
  return isl_stat_ok;
991
33
}
isl_aff.c:isl_union_pw_aff_plain_is_equal_entry
Line
Count
Source
972
21
{
973
21
  S(UNION,plain_is_equal_data) *data = user;
974
21
  struct isl_hash_table_entry *entry2;
975
21
  PW *pw = *entry;
976
21
977
21
  entry2 = FN(UNION,find_part_entry)(data->u2, pw->dim, 0);
978
21
  if (!entry2 || entry2 == isl_hash_table_entry_none) {
979
0
    if (!entry2)
980
0
      data->is_equal = isl_bool_error;
981
0
    else
982
0
      data->is_equal = isl_bool_false;
983
0
    return isl_stat_error;
984
0
  }
985
21
986
21
  data->is_equal = FN(PW,plain_is_equal)(pw, entry2->data);
987
21
  if (data->is_equal < 0 || !data->is_equal)
988
0
    return isl_stat_error;
989
21
990
21
  return isl_stat_ok;
991
21
}
isl_aff.c:isl_union_pw_multi_aff_plain_is_equal_entry
Line
Count
Source
972
11
{
973
11
  S(UNION,plain_is_equal_data) *data = user;
974
11
  struct isl_hash_table_entry *entry2;
975
11
  PW *pw = *entry;
976
11
977
11
  entry2 = FN(UNION,find_part_entry)(data->u2, pw->dim, 0);
978
11
  if (!entry2 || entry2 == isl_hash_table_entry_none) {
979
0
    if (!entry2)
980
0
      data->is_equal = isl_bool_error;
981
0
    else
982
0
      data->is_equal = isl_bool_false;
983
0
    return isl_stat_error;
984
0
  }
985
11
986
11
  data->is_equal = FN(PW,plain_is_equal)(pw, entry2->data);
987
11
  if (data->is_equal < 0 || !data->is_equal)
988
0
    return isl_stat_error;
989
11
990
11
  return isl_stat_ok;
991
11
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_plain_is_equal_entry
isl_polynomial.c:isl_union_pw_qpolynomial_plain_is_equal_entry
Line
Count
Source
972
1
{
973
1
  S(UNION,plain_is_equal_data) *data = user;
974
1
  struct isl_hash_table_entry *entry2;
975
1
  PW *pw = *entry;
976
1
977
1
  entry2 = FN(UNION,find_part_entry)(data->u2, pw->dim, 0);
978
1
  if (!entry2 || entry2 == isl_hash_table_entry_none) {
979
0
    if (!entry2)
980
0
      data->is_equal = isl_bool_error;
981
0
    else
982
0
      data->is_equal = isl_bool_false;
983
0
    return isl_stat_error;
984
0
  }
985
1
986
1
  data->is_equal = FN(PW,plain_is_equal)(pw, entry2->data);
987
1
  if (data->is_equal < 0 || !data->is_equal)
988
0
    return isl_stat_error;
989
1
990
1
  return isl_stat_ok;
991
1
}
992
993
isl_bool FN(UNION,plain_is_equal)(__isl_keep UNION *u1, __isl_keep UNION *u2)
994
29
{
995
29
  S(UNION,plain_is_equal_data) data = { NULL, isl_bool_true };
996
29
  int n1, n2;
997
29
998
29
  if (!u1 || !u2)
999
0
    return isl_bool_error;
1000
29
  if (u1 == u2)
1001
0
    return isl_bool_true;
1002
29
  if (u1->table.n != u2->table.n)
1003
0
    return isl_bool_false;
1004
29
  n1 = FN(FN(UNION,n),PARTS)(u1);
1005
29
  n2 = FN(FN(UNION,n),PARTS)(u2);
1006
29
  if (n1 < 0 || n2 < 0)
1007
0
    return isl_bool_error;
1008
29
  if (n1 != n2)
1009
0
    return isl_bool_false;
1010
29
1011
29
  u1 = FN(UNION,copy)(u1);
1012
29
  u2 = FN(UNION,copy)(u2);
1013
29
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
1014
29
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
1015
29
  if (!u1 || !u2)
1016
0
    goto error;
1017
29
1018
29
  data.u2 = u2;
1019
29
  if (FN(UNION,foreach_inplace)(u1,
1020
29
             &FN(UNION,plain_is_equal_entry), &data) < 0 &&
1021
29
      
data.is_equal0
)
1022
0
    goto error;
1023
29
1024
29
  FN(UNION,free)(u1);
1025
29
  FN(UNION,free)(u2);
1026
29
1027
29
  return data.is_equal;
1028
29
error:
1029
0
  FN(UNION,free)(u1);
1030
0
  FN(UNION,free)(u2);
1031
0
  return isl_bool_error;
1032
29
}
isl_union_pw_aff_plain_is_equal
Line
Count
Source
994
19
{
995
19
  S(UNION,plain_is_equal_data) data = { NULL, isl_bool_true };
996
19
  int n1, n2;
997
19
998
19
  if (!u1 || !u2)
999
0
    return isl_bool_error;
1000
19
  if (u1 == u2)
1001
0
    return isl_bool_true;
1002
19
  if (u1->table.n != u2->table.n)
1003
0
    return isl_bool_false;
1004
19
  n1 = FN(FN(UNION,n),PARTS)(u1);
1005
19
  n2 = FN(FN(UNION,n),PARTS)(u2);
1006
19
  if (n1 < 0 || n2 < 0)
1007
0
    return isl_bool_error;
1008
19
  if (n1 != n2)
1009
0
    return isl_bool_false;
1010
19
1011
19
  u1 = FN(UNION,copy)(u1);
1012
19
  u2 = FN(UNION,copy)(u2);
1013
19
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
1014
19
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
1015
19
  if (!u1 || !u2)
1016
0
    goto error;
1017
19
1018
19
  data.u2 = u2;
1019
19
  if (FN(UNION,foreach_inplace)(u1,
1020
19
             &FN(UNION,plain_is_equal_entry), &data) < 0 &&
1021
19
      
data.is_equal0
)
1022
0
    goto error;
1023
19
1024
19
  FN(UNION,free)(u1);
1025
19
  FN(UNION,free)(u2);
1026
19
1027
19
  return data.is_equal;
1028
19
error:
1029
0
  FN(UNION,free)(u1);
1030
0
  FN(UNION,free)(u2);
1031
0
  return isl_bool_error;
1032
19
}
isl_union_pw_multi_aff_plain_is_equal
Line
Count
Source
994
9
{
995
9
  S(UNION,plain_is_equal_data) data = { NULL, isl_bool_true };
996
9
  int n1, n2;
997
9
998
9
  if (!u1 || !u2)
999
0
    return isl_bool_error;
1000
9
  if (u1 == u2)
1001
0
    return isl_bool_true;
1002
9
  if (u1->table.n != u2->table.n)
1003
0
    return isl_bool_false;
1004
9
  n1 = FN(FN(UNION,n),PARTS)(u1);
1005
9
  n2 = FN(FN(UNION,n),PARTS)(u2);
1006
9
  if (n1 < 0 || n2 < 0)
1007
0
    return isl_bool_error;
1008
9
  if (n1 != n2)
1009
0
    return isl_bool_false;
1010
9
1011
9
  u1 = FN(UNION,copy)(u1);
1012
9
  u2 = FN(UNION,copy)(u2);
1013
9
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
1014
9
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
1015
9
  if (!u1 || !u2)
1016
0
    goto error;
1017
9
1018
9
  data.u2 = u2;
1019
9
  if (FN(UNION,foreach_inplace)(u1,
1020
9
             &FN(UNION,plain_is_equal_entry), &data) < 0 &&
1021
9
      
data.is_equal0
)
1022
0
    goto error;
1023
9
1024
9
  FN(UNION,free)(u1);
1025
9
  FN(UNION,free)(u2);
1026
9
1027
9
  return data.is_equal;
1028
9
error:
1029
0
  FN(UNION,free)(u1);
1030
0
  FN(UNION,free)(u2);
1031
0
  return isl_bool_error;
1032
9
}
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_plain_is_equal
isl_union_pw_qpolynomial_plain_is_equal
Line
Count
Source
994
1
{
995
1
  S(UNION,plain_is_equal_data) data = { NULL, isl_bool_true };
996
1
  int n1, n2;
997
1
998
1
  if (!u1 || !u2)
999
0
    return isl_bool_error;
1000
1
  if (u1 == u2)
1001
0
    return isl_bool_true;
1002
1
  if (u1->table.n != u2->table.n)
1003
0
    return isl_bool_false;
1004
1
  n1 = FN(FN(UNION,n),PARTS)(u1);
1005
1
  n2 = FN(FN(UNION,n),PARTS)(u2);
1006
1
  if (n1 < 0 || n2 < 0)
1007
0
    return isl_bool_error;
1008
1
  if (n1 != n2)
1009
0
    return isl_bool_false;
1010
1
1011
1
  u1 = FN(UNION,copy)(u1);
1012
1
  u2 = FN(UNION,copy)(u2);
1013
1
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
1014
1
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
1015
1
  if (!u1 || !u2)
1016
0
    goto error;
1017
1
1018
1
  data.u2 = u2;
1019
1
  if (FN(UNION,foreach_inplace)(u1,
1020
1
             &FN(UNION,plain_is_equal_entry), &data) < 0 &&
1021
1
      
data.is_equal0
)
1022
0
    goto error;
1023
1
1024
1
  FN(UNION,free)(u1);
1025
1
  FN(UNION,free)(u2);
1026
1
1027
1
  return data.is_equal;
1028
1
error:
1029
0
  FN(UNION,free)(u1);
1030
0
  FN(UNION,free)(u2);
1031
0
  return isl_bool_error;
1032
1
}
1033
1034
/* Check whether the element that "entry" points to involves any NaNs and
1035
 * store the result in *nan.
1036
 * Abort as soon as one such element has been found.
1037
 */
1038
static isl_stat FN(UNION,involves_nan_entry)(void **entry, void *user)
1039
0
{
1040
0
  isl_bool *nan = user;
1041
0
  PW *pw = *entry;
1042
0
1043
0
  *nan = FN(PW,involves_nan)(pw);
1044
0
  if (*nan < 0 || !nan)
1045
0
    return isl_stat_error;
1046
0
1047
0
  return isl_stat_ok;
1048
0
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_aff_involves_nan_entry
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_involves_nan_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_involves_nan_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_involves_nan_entry
1049
1050
/* Does "u" involve any NaNs?
1051
 */
1052
isl_bool FN(UNION,involves_nan)(__isl_keep UNION *u)
1053
0
{
1054
0
  isl_bool nan = isl_bool_false;
1055
0
1056
0
  if (!u)
1057
0
    return isl_bool_error;
1058
0
1059
0
  if (FN(UNION,foreach_inplace)(u,
1060
0
            &FN(UNION,involves_nan_entry), &nan) < 0 &&
1061
0
      !nan)
1062
0
    return isl_bool_error;
1063
0
1064
0
  return nan;
1065
0
}
Unexecuted instantiation: isl_union_pw_aff_involves_nan
Unexecuted instantiation: isl_union_pw_multi_aff_involves_nan
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_involves_nan
Unexecuted instantiation: isl_union_pw_qpolynomial_involves_nan
1066
1067
/* Internal data structure for isl_union_*_drop_dims.
1068
 * type, first and n are passed to isl_*_drop_dims.
1069
 */
1070
S(UNION,drop_dims_data) {
1071
  enum isl_dim_type type;
1072
  unsigned first;
1073
  unsigned n;
1074
};
1075
1076
/* Drop the parameters specified by "data" from "part" and return the result.
1077
 */
1078
static __isl_give PART *FN(UNION,drop_dims_entry)(__isl_take PART *part,
1079
  void *user)
1080
0
{
1081
0
  S(UNION,drop_dims_data) *data = user;
1082
0
1083
0
  return FN(PART,drop_dims)(part, data->type, data->first, data->n);
1084
0
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_aff_drop_dims_entry
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_drop_dims_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_drop_dims_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_drop_dims_entry
1085
1086
/* Drop the specified parameters from "u".
1087
 * That is, type is required to be isl_dim_param.
1088
 */
1089
__isl_give UNION *FN(UNION,drop_dims)( __isl_take UNION *u,
1090
  enum isl_dim_type type, unsigned first, unsigned n)
1091
0
{
1092
0
  isl_space *space;
1093
0
  S(UNION,drop_dims_data) data = { type, first, n };
1094
0
1095
0
  if (!u)
1096
0
    return NULL;
1097
0
1098
0
  if (type != isl_dim_param)
1099
0
    isl_die(FN(UNION,get_ctx)(u), isl_error_invalid,
1100
0
      "can only project out parameters",
1101
0
      return FN(UNION,free)(u));
1102
0
1103
0
  space = FN(UNION,get_space)(u);
1104
0
  space = isl_space_drop_dims(space, type, first, n);
1105
0
  return FN(UNION,transform_space)(u, space, &FN(UNION,drop_dims_entry),
1106
0
          &data);
1107
0
}
Unexecuted instantiation: isl_union_pw_aff_drop_dims
Unexecuted instantiation: isl_union_pw_multi_aff_drop_dims
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_drop_dims
Unexecuted instantiation: isl_union_pw_qpolynomial_drop_dims
1108
1109
/* Internal data structure for isl_union_*_set_dim_name.
1110
 * pos is the position of the parameter that needs to be renamed.
1111
 * s is the new name.
1112
 */
1113
S(UNION,set_dim_name_data) {
1114
  unsigned pos;
1115
  const char *s;
1116
};
1117
1118
/* Change the name of the parameter at position data->pos of "part" to data->s
1119
 * and return the result.
1120
 */
1121
static __isl_give PART *FN(UNION,set_dim_name_entry)(__isl_take PART *part,
1122
  void *user)
1123
0
{
1124
0
  S(UNION,set_dim_name_data) *data = user;
1125
0
1126
0
  return FN(PART,set_dim_name)(part, isl_dim_param, data->pos, data->s);
1127
0
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_aff_set_dim_name_entry
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_set_dim_name_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_set_dim_name_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_set_dim_name_entry
1128
1129
/* Change the name of the parameter at position "pos" to "s".
1130
 * That is, type is required to be isl_dim_param.
1131
 */
1132
__isl_give UNION *FN(UNION,set_dim_name)(__isl_take UNION *u,
1133
  enum isl_dim_type type, unsigned pos, const char *s)
1134
0
{
1135
0
  S(UNION,set_dim_name_data) data = { pos, s };
1136
0
  isl_space *space;
1137
0
1138
0
  if (!u)
1139
0
    return NULL;
1140
0
1141
0
  if (type != isl_dim_param)
1142
0
    isl_die(FN(UNION,get_ctx)(u), isl_error_invalid,
1143
0
      "can only set parameter names",
1144
0
      return FN(UNION,free)(u));
1145
0
1146
0
  space = FN(UNION,get_space)(u);
1147
0
  space = isl_space_set_dim_name(space, type, pos, s);
1148
0
  return FN(UNION,transform_space)(u, space,
1149
0
          &FN(UNION,set_dim_name_entry), &data);
1150
0
}
Unexecuted instantiation: isl_union_pw_aff_set_dim_name
Unexecuted instantiation: isl_union_pw_multi_aff_set_dim_name
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_set_dim_name
Unexecuted instantiation: isl_union_pw_qpolynomial_set_dim_name
1151
1152
/* Reset the user pointer on all identifiers of parameters and tuples
1153
 * of the space of "part" and return the result.
1154
 */
1155
static __isl_give PART *FN(UNION,reset_user_entry)(__isl_take PART *part,
1156
  void *user)
1157
0
{
1158
0
  return FN(PART,reset_user)(part);
1159
0
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_aff_reset_user_entry
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_reset_user_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_reset_user_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_reset_user_entry
1160
1161
/* Reset the user pointer on all identifiers of parameters and tuples
1162
 * of the spaces of "u".
1163
 */
1164
__isl_give UNION *FN(UNION,reset_user)(__isl_take UNION *u)
1165
0
{
1166
0
  isl_space *space;
1167
0
1168
0
  space = FN(UNION,get_space)(u);
1169
0
  space = isl_space_reset_user(space);
1170
0
  return FN(UNION,transform_space)(u, space, &FN(UNION,reset_user_entry),
1171
0
          NULL);
1172
0
}
Unexecuted instantiation: isl_union_pw_aff_reset_user
Unexecuted instantiation: isl_union_pw_multi_aff_reset_user
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_reset_user
Unexecuted instantiation: isl_union_pw_qpolynomial_reset_user