Coverage Report

Created: 2019-04-21 11:35

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