Coverage Report

Created: 2018-06-24 14:39

/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
46.1k
{
17
46.1k
  return u ? u->space->ctx : NULL;
18
46.1k
}
isl_union_pw_aff_get_ctx
Line
Count
Source
16
18.3k
{
17
18.3k
  return u ? u->space->ctx : NULL;
18
18.3k
}
isl_union_pw_multi_aff_get_ctx
Line
Count
Source
16
27.8k
{
17
27.8k
  return u ? u->space->ctx : NULL;
18
27.8k
}
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
91.1k
{
24
91.1k
  if (!u)
25
0
    return NULL;
26
91.1k
  return u->space;
27
91.1k
}
isl_aff.c:isl_union_pw_aff_peek_space
Line
Count
Source
23
63.8k
{
24
63.8k
  if (!u)
25
0
    return NULL;
26
63.8k
  return u->space;
27
63.8k
}
isl_aff.c:isl_union_pw_multi_aff_peek_space
Line
Count
Source
23
27.2k
{
24
27.2k
  if (!u)
25
0
    return NULL;
26
27.2k
  return u->space;
27
27.2k
}
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
91.1k
{
33
91.1k
  return isl_space_copy(FN(UNION,peek_space)(u));
34
91.1k
}
isl_union_pw_aff_get_space
Line
Count
Source
32
63.8k
{
33
63.8k
  return isl_space_copy(FN(UNION,peek_space)(u));
34
63.8k
}
isl_union_pw_multi_aff_get_space
Line
Count
Source
32
27.2k
{
33
27.2k
  return isl_space_copy(FN(UNION,peek_space)(u));
34
27.2k
}
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
20.6k
{
70
20.6k
  UNION *u;
71
20.6k
72
20.6k
  dim = isl_space_params(dim);
73
20.6k
  if (!dim)
74
0
    return NULL;
75
20.6k
76
20.6k
  u = isl_calloc_type(dim->ctx, UNION);
77
20.6k
  if (!u)
78
0
    goto error;
79
20.6k
80
20.6k
  u->ref = 1;
81
#ifdef HAS_TYPE
82
  u->type = type;
83
#endif
84
  u->space = dim;
85
20.6k
  if (isl_hash_table_init(dim->ctx, &u->table, size) < 0)
86
0
    return FN(UNION,free)(u);
87
20.6k
88
20.6k
  return u;
89
20.6k
error:
90
0
  isl_space_free(dim);
91
0
  return NULL;
92
20.6k
}
isl_aff.c:isl_union_pw_aff_alloc
Line
Count
Source
69
8.23k
{
70
8.23k
  UNION *u;
71
8.23k
72
8.23k
  dim = isl_space_params(dim);
73
8.23k
  if (!dim)
74
0
    return NULL;
75
8.23k
76
8.23k
  u = isl_calloc_type(dim->ctx, UNION);
77
8.23k
  if (!u)
78
0
    goto error;
79
8.23k
80
8.23k
  u->ref = 1;
81
#ifdef HAS_TYPE
82
  u->type = type;
83
#endif
84
  u->space = dim;
85
8.23k
  if (isl_hash_table_init(dim->ctx, &u->table, size) < 0)
86
0
    return FN(UNION,free)(u);
87
8.23k
88
8.23k
  return u;
89
8.23k
error:
90
0
  isl_space_free(dim);
91
0
  return NULL;
92
8.23k
}
isl_aff.c:isl_union_pw_multi_aff_alloc
Line
Count
Source
69
12.3k
{
70
12.3k
  UNION *u;
71
12.3k
72
12.3k
  dim = isl_space_params(dim);
73
12.3k
  if (!dim)
74
0
    return NULL;
75
12.3k
76
12.3k
  u = isl_calloc_type(dim->ctx, UNION);
77
12.3k
  if (!u)
78
0
    goto error;
79
12.3k
80
12.3k
  u->ref = 1;
81
#ifdef HAS_TYPE
82
  u->type = type;
83
#endif
84
  u->space = dim;
85
12.3k
  if (isl_hash_table_init(dim->ctx, &u->table, size) < 0)
86
0
    return FN(UNION,free)(u);
87
12.3k
88
12.3k
  return u;
89
12.3k
error:
90
0
  isl_space_free(dim);
91
0
  return NULL;
92
12.3k
}
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
12.7k
{
102
12.7k
  return FN(UNION,alloc)(dim, 16);
103
12.7k
}
isl_union_pw_aff_empty
Line
Count
Source
101
3.10k
{
102
3.10k
  return FN(UNION,alloc)(dim, 16);
103
3.10k
}
isl_union_pw_multi_aff_empty
Line
Count
Source
101
9.68k
{
102
9.68k
  return FN(UNION,alloc)(dim, 16);
103
9.68k
}
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
34.6k
{
108
34.6k
  if (!u)
109
0
    return NULL;
110
34.6k
111
34.6k
  u->ref++;
112
34.6k
  return u;
113
34.6k
}
isl_union_pw_aff_copy
Line
Count
Source
107
26.1k
{
108
26.1k
  if (!u)
109
0
    return NULL;
110
26.1k
111
26.1k
  u->ref++;
112
26.1k
  return u;
113
26.1k
}
isl_union_pw_multi_aff_copy
Line
Count
Source
107
8.52k
{
108
8.52k
  if (!u)
109
0
    return NULL;
110
8.52k
111
8.52k
  u->ref++;
112
8.52k
  return u;
113
8.52k
}
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
30.7k
{
153
30.7k
  int empty;
154
30.7k
  struct isl_hash_table_entry *entry;
155
30.7k
156
30.7k
  if (!part)
157
0
    goto error;
158
30.7k
159
30.7k
  empty = FN(PART,IS_ZERO)(part);
160
30.7k
  if (empty < 0)
161
0
    goto error;
162
30.7k
  if (empty) {
163
1
    FN(PART,free)(part);
164
1
    return u;
165
1
  }
166
30.7k
167
30.7k
  u = FN(UNION,align_params)(u, FN(PART,get_space)(part));
168
30.7k
  part = FN(PART,align_params)(part, FN(UNION,get_space)(u));
169
30.7k
170
30.7k
  u = FN(UNION,cow)(u);
171
30.7k
172
30.7k
  if (!u)
173
0
    goto error;
174
30.7k
175
30.7k
  if (FN(UNION,check_disjoint_domain_other)(u, part) < 0)
176
1
    goto error;
177
30.7k
  entry = FN(UNION,find_part_entry)(u, part->dim, 1);
178
30.7k
  if (!entry)
179
0
    goto error;
180
30.7k
181
30.7k
  if (!entry->data)
182
30.7k
    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
30.7k
199
30.7k
  return u;
200
30.7k
error:
201
1
  FN(PART,free)(part);
202
1
  FN(UNION,free)(u);
203
1
  return NULL;
204
30.7k
}
isl_aff.c:isl_union_pw_aff_add_part_generic
Line
Count
Source
152
16.8k
{
153
16.8k
  int empty;
154
16.8k
  struct isl_hash_table_entry *entry;
155
16.8k
156
16.8k
  if (!part)
157
0
    goto error;
158
16.8k
159
16.8k
  empty = FN(PART,IS_ZERO)(part);
160
16.8k
  if (empty < 0)
161
0
    goto error;
162
16.8k
  if (empty) {
163
0
    FN(PART,free)(part);
164
0
    return u;
165
0
  }
166
16.8k
167
16.8k
  u = FN(UNION,align_params)(u, FN(PART,get_space)(part));
168
16.8k
  part = FN(PART,align_params)(part, FN(UNION,get_space)(u));
169
16.8k
170
16.8k
  u = FN(UNION,cow)(u);
171
16.8k
172
16.8k
  if (!u)
173
0
    goto error;
174
16.8k
175
16.8k
  if (FN(UNION,check_disjoint_domain_other)(u, part) < 0)
176
0
    goto error;
177
16.8k
  entry = FN(UNION,find_part_entry)(u, part->dim, 1);
178
16.8k
  if (!entry)
179
0
    goto error;
180
16.8k
181
16.8k
  if (!entry->data)
182
16.8k
    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
16.8k
199
16.8k
  return u;
200
16.8k
error:
201
0
  FN(PART,free)(part);
202
0
  FN(UNION,free)(u);
203
0
  return NULL;
204
16.8k
}
isl_aff.c:isl_union_pw_multi_aff_add_part_generic
Line
Count
Source
152
13.8k
{
153
13.8k
  int empty;
154
13.8k
  struct isl_hash_table_entry *entry;
155
13.8k
156
13.8k
  if (!part)
157
0
    goto error;
158
13.8k
159
13.8k
  empty = FN(PART,IS_ZERO)(part);
160
13.8k
  if (empty < 0)
161
0
    goto error;
162
13.8k
  if (empty) {
163
1
    FN(PART,free)(part);
164
1
    return u;
165
1
  }
166
13.8k
167
13.8k
  u = FN(UNION,align_params)(u, FN(PART,get_space)(part));
168
13.8k
  part = FN(PART,align_params)(part, FN(UNION,get_space)(u));
169
13.8k
170
13.8k
  u = FN(UNION,cow)(u);
171
13.8k
172
13.8k
  if (!u)
173
0
    goto error;
174
13.8k
175
13.8k
  if (FN(UNION,check_disjoint_domain_other)(u, part) < 0)
176
1
    goto error;
177
13.8k
  entry = FN(UNION,find_part_entry)(u, part->dim, 1);
178
13.8k
  if (!entry)
179
0
    goto error;
180
13.8k
181
13.8k
  if (!entry->data)
182
13.8k
    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
13.8k
199
13.8k
  return u;
200
13.8k
error:
201
1
  FN(PART,free)(part);
202
1
  FN(UNION,free)(u);
203
1
  return NULL;
204
13.8k
}
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
30.1k
{
212
30.1k
  return FN(UNION,add_part_generic)(u, part, 1);
213
30.1k
}
isl_union_pw_aff_add_pw_aff
Line
Count
Source
211
16.4k
{
212
16.4k
  return FN(UNION,add_part_generic)(u, part, 1);
213
16.4k
}
isl_union_pw_multi_aff_add_pw_multi_aff
Line
Count
Source
211
13.6k
{
212
13.6k
  return FN(UNION,add_part_generic)(u, part, 1);
213
13.6k
}
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
7.80k
{
235
7.80k
  if (!u)
236
0
    goto error;
237
7.80k
  return FN(UNION,alloc)(space, u->table.n);
238
7.80k
error:
239
0
  isl_space_free(space);
240
0
  return NULL;
241
7.80k
}
isl_aff.c:isl_union_pw_aff_alloc_same_size_on_space
Line
Count
Source
234
5.12k
{
235
5.12k
  if (!u)
236
0
    goto error;
237
5.12k
  return FN(UNION,alloc)(space, u->table.n);
238
5.12k
error:
239
0
  isl_space_free(space);
240
0
  return NULL;
241
5.12k
}
isl_aff.c:isl_union_pw_multi_aff_alloc_same_size_on_space
Line
Count
Source
234
2.67k
{
235
2.67k
  if (!u)
236
0
    goto error;
237
2.67k
  return FN(UNION,alloc)(space, u->table.n);
238
2.67k
error:
239
0
  isl_space_free(space);
240
0
  return NULL;
241
2.67k
}
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
1.42k
{
249
1.42k
  return FN(UNION,alloc_same_size_on_space)(u, FN(UNION,get_space)(u));
250
1.42k
}
isl_aff.c:isl_union_pw_multi_aff_alloc_same_size
Line
Count
Source
248
131
{
249
131
  return FN(UNION,alloc_same_size_on_space)(u, FN(UNION,get_space)(u));
250
131
}
isl_aff.c:isl_union_pw_aff_alloc_same_size
Line
Count
Source
248
1.28k
{
249
1.28k
  return FN(UNION,alloc_same_size_on_space)(u, FN(UNION,get_space)(u));
250
1.28k
}
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
11.8k
{
268
11.8k
  S(UNION,transform_data) *data = (S(UNION,transform_data) *)user;
269
11.8k
270
11.8k
  part = data->fn(part, data->user);
271
11.8k
  data->res = FN(FN(UNION,add),BASE)(data->res, part);
272
11.8k
  if (!data->res)
273
0
    return isl_stat_error;
274
11.8k
275
11.8k
  return isl_stat_ok;
276
11.8k
}
isl_aff.c:isl_union_pw_aff_transform_entry
Line
Count
Source
267
9.41k
{
268
9.41k
  S(UNION,transform_data) *data = (S(UNION,transform_data) *)user;
269
9.41k
270
9.41k
  part = data->fn(part, data->user);
271
9.41k
  data->res = FN(FN(UNION,add),BASE)(data->res, part);
272
9.41k
  if (!data->res)
273
0
    return isl_stat_error;
274
9.41k
275
9.41k
  return isl_stat_ok;
276
9.41k
}
isl_aff.c:isl_union_pw_multi_aff_transform_entry
Line
Count
Source
267
2.44k
{
268
2.44k
  S(UNION,transform_data) *data = (S(UNION,transform_data) *)user;
269
2.44k
270
2.44k
  part = data->fn(part, data->user);
271
2.44k
  data->res = FN(FN(UNION,add),BASE)(data->res, part);
272
2.44k
  if (!data->res)
273
0
    return isl_stat_error;
274
2.44k
275
2.44k
  return isl_stat_ok;
276
2.44k
}
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
6.38k
{
285
6.38k
  S(UNION,transform_data) data = { fn, user };
286
6.38k
287
6.38k
  data.res = FN(UNION,alloc_same_size_on_space)(u, space);
288
6.38k
  if (FN(FN(UNION,foreach),BASE)(u,
289
6.38k
          &FN(UNION,transform_entry), &data) < 0)
290
0
    data.res = FN(UNION,free)(data.res);
291
6.38k
  FN(UNION,free)(u);
292
6.38k
  return data.res;
293
6.38k
}
isl_aff.c:isl_union_pw_aff_transform_space
Line
Count
Source
284
3.84k
{
285
3.84k
  S(UNION,transform_data) data = { fn, user };
286
3.84k
287
3.84k
  data.res = FN(UNION,alloc_same_size_on_space)(u, space);
288
3.84k
  if (FN(FN(UNION,foreach),BASE)(u,
289
3.84k
          &FN(UNION,transform_entry), &data) < 0)
290
0
    data.res = FN(UNION,free)(data.res);
291
3.84k
  FN(UNION,free)(u);
292
3.84k
  return data.res;
293
3.84k
}
isl_aff.c:isl_union_pw_multi_aff_transform_space
Line
Count
Source
284
2.54k
{
285
2.54k
  S(UNION,transform_data) data = { fn, user };
286
2.54k
287
2.54k
  data.res = FN(UNION,alloc_same_size_on_space)(u, space);
288
2.54k
  if (FN(FN(UNION,foreach),BASE)(u,
289
2.54k
          &FN(UNION,transform_entry), &data) < 0)
290
0
    data.res = FN(UNION,free)(data.res);
291
2.54k
  FN(UNION,free)(u);
292
2.54k
  return data.res;
293
2.54k
}
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
6.20k
{
301
6.20k
  return FN(UNION,transform_space)(u, FN(UNION,get_space)(u), fn, user);
302
6.20k
}
isl_aff.c:isl_union_pw_aff_transform
Line
Count
Source
300
3.66k
{
301
3.66k
  return FN(UNION,transform_space)(u, FN(UNION,get_space)(u), fn, user);
302
3.66k
}
isl_aff.c:isl_union_pw_multi_aff_transform
Line
Count
Source
300
2.54k
{
301
2.54k
  return FN(UNION,transform_space)(u, FN(UNION,get_space)(u), fn, user);
302
2.54k
}
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
998
{
308
998
  S(UNION,transform_data) *data = (S(UNION,transform_data) *) user;
309
998
310
998
  *part = data->fn(*part, data->user);
311
998
  if (!*part)
312
0
    return isl_stat_error;
313
998
  return isl_stat_ok;
314
998
}
isl_aff.c:isl_union_pw_aff_transform_inplace_entry
Line
Count
Source
307
998
{
308
998
  S(UNION,transform_data) *data = (S(UNION,transform_data) *) user;
309
998
310
998
  *part = data->fn(*part, data->user);
311
998
  if (!*part)
312
0
    return isl_stat_error;
313
998
  return isl_stat_ok;
314
998
}
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
2.89k
{
326
2.89k
  isl_bool single_ref;
327
2.89k
328
2.89k
  single_ref = FN(UNION,has_single_reference)(u);
329
2.89k
  if (single_ref < 0)
330
0
    return FN(UNION,free)(u);
331
2.89k
  if (single_ref) {
332
686
    S(UNION,transform_data) data = { fn, user };
333
686
    if (FN(UNION,foreach_inplace)(u,
334
686
        &FN(UNION,transform_inplace_entry), &data) < 0)
335
0
      return FN(UNION,free)(u);
336
686
    return u;
337
686
  }
338
2.20k
  return FN(UNION,transform)(u, fn, user);
339
2.20k
}
isl_aff.c:isl_union_pw_aff_transform_inplace
Line
Count
Source
325
2.89k
{
326
2.89k
  isl_bool single_ref;
327
2.89k
328
2.89k
  single_ref = FN(UNION,has_single_reference)(u);
329
2.89k
  if (single_ref < 0)
330
0
    return FN(UNION,free)(u);
331
2.89k
  if (single_ref) {
332
686
    S(UNION,transform_data) data = { fn, user };
333
686
    if (FN(UNION,foreach_inplace)(u,
334
686
        &FN(UNION,transform_inplace_entry), &data) < 0)
335
0
      return FN(UNION,free)(u);
336
686
    return u;
337
686
  }
338
2.20k
  return FN(UNION,transform)(u, fn, user);
339
2.20k
}
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
2.66k
{
346
2.66k
  return part;
347
2.66k
}
isl_aff.c:isl_union_pw_aff_copy_part
Line
Count
Source
345
218
{
346
218
  return part;
347
218
}
isl_aff.c:isl_union_pw_multi_aff_copy_part
Line
Count
Source
345
2.44k
{
346
2.44k
  return part;
347
2.44k
}
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
2.68k
{
351
2.68k
  u = FN(UNION,copy)(u);
352
2.68k
  return FN(UNION,transform)(u, &FN(UNION,copy_part), NULL);
353
2.68k
}
isl_union_pw_aff_dup
Line
Count
Source
350
142
{
351
142
  u = FN(UNION,copy)(u);
352
142
  return FN(UNION,transform)(u, &FN(UNION,copy_part), NULL);
353
142
}
isl_union_pw_multi_aff_dup
Line
Count
Source
350
2.54k
{
351
2.54k
  u = FN(UNION,copy)(u);
352
2.54k
  return FN(UNION,transform)(u, &FN(UNION,copy_part), NULL);
353
2.54k
}
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
31.1k
{
357
31.1k
  if (!u)
358
0
    return NULL;
359
31.1k
360
31.1k
  if (u->ref == 1)
361
28.5k
    return u;
362
2.68k
  u->ref--;
363
2.68k
  return FN(UNION,dup)(u);
364
2.68k
}
isl_union_pw_aff_cow
Line
Count
Source
356
17.1k
{
357
17.1k
  if (!u)
358
0
    return NULL;
359
17.1k
360
17.1k
  if (u->ref == 1)
361
17.0k
    return u;
362
142
  u->ref--;
363
142
  return FN(UNION,dup)(u);
364
142
}
isl_union_pw_multi_aff_cow
Line
Count
Source
356
14.0k
{
357
14.0k
  if (!u)
358
0
    return NULL;
359
14.0k
360
14.0k
  if (u->ref == 1)
361
11.4k
    return u;
362
2.54k
  u->ref--;
363
2.54k
  return FN(UNION,dup)(u);
364
2.54k
}
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
63.1k
{
368
63.1k
  if (!u)
369
10.6k
    return NULL;
370
52.5k
371
52.5k
  if (--u->ref > 0)
372
31.9k
    return NULL;
373
20.5k
374
20.5k
  isl_hash_table_foreach(u->space->ctx, &u->table,
375
20.5k
        &FN(UNION,free_u_entry), NULL);
376
20.5k
  isl_hash_table_clear(&u->table);
377
20.5k
  isl_space_free(u->space);
378
20.5k
  free(u);
379
20.5k
  return NULL;
380
20.5k
}
isl_union_pw_aff_free
Line
Count
Source
367
44.7k
{
368
44.7k
  if (!u)
369
10.6k
    return NULL;
370
34.1k
371
34.1k
  if (--u->ref > 0)
372
25.9k
    return NULL;
373
8.18k
374
8.18k
  isl_hash_table_foreach(u->space->ctx, &u->table,
375
8.18k
        &FN(UNION,free_u_entry), NULL);
376
8.18k
  isl_hash_table_clear(&u->table);
377
8.18k
  isl_space_free(u->space);
378
8.18k
  free(u);
379
8.18k
  return NULL;
380
8.18k
}
isl_union_pw_multi_aff_free
Line
Count
Source
367
18.3k
{
368
18.3k
  if (!u)
369
1
    return NULL;
370
18.3k
371
18.3k
  if (--u->ref > 0)
372
5.98k
    return NULL;
373
12.3k
374
12.3k
  isl_hash_table_foreach(u->space->ctx, &u->table,
375
12.3k
        &FN(UNION,free_u_entry), NULL);
376
12.3k
  isl_hash_table_clear(&u->table);
377
12.3k
  isl_space_free(u->space);
378
12.3k
  free(u);
379
12.3k
  return NULL;
380
12.3k
}
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
328
{
384
328
  isl_reordering *exp = user;
385
328
386
328
  exp = isl_reordering_extend_space(isl_reordering_copy(exp),
387
328
            FN(PART,get_domain_space)(part));
388
328
  return FN(PART,realign_domain)(part, exp);
389
328
}
isl_aff.c:isl_union_pw_aff_align_entry
Line
Count
Source
383
326
{
384
326
  isl_reordering *exp = user;
385
326
386
326
  exp = isl_reordering_extend_space(isl_reordering_copy(exp),
387
326
            FN(PART,get_domain_space)(part));
388
326
  return FN(PART,realign_domain)(part, exp);
389
326
}
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
180
{
396
180
  isl_space *space;
397
180
398
180
  if (!u || !r)
399
0
    goto error;
400
180
401
180
  space = isl_reordering_get_space(r);
402
180
  u = FN(UNION,transform_space)(u, space, &FN(UNION,align_entry), r);
403
180
  isl_reordering_free(r);
404
180
  return u;
405
180
error:
406
0
  FN(UNION,free)(u);
407
0
  isl_reordering_free(r);
408
0
  return NULL;
409
180
}
isl_aff.c:isl_union_pw_aff_realign_domain
Line
Count
Source
395
178
{
396
178
  isl_space *space;
397
178
398
178
  if (!u || !r)
399
0
    goto error;
400
178
401
178
  space = isl_reordering_get_space(r);
402
178
  u = FN(UNION,transform_space)(u, space, &FN(UNION,align_entry), r);
403
178
  isl_reordering_free(r);
404
178
  return u;
405
178
error:
406
0
  FN(UNION,free)(u);
407
0
  isl_reordering_free(r);
408
0
  return NULL;
409
178
}
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
36.1k
{
416
36.1k
  isl_bool equal_params;
417
36.1k
  isl_reordering *r;
418
36.1k
419
36.1k
  if (!u || !model)
420
0
    goto error;
421
36.1k
422
36.1k
  equal_params = isl_space_has_equal_params(u->space, model);
423
36.1k
  if (equal_params < 0)
424
0
    goto error;
425
36.1k
  if (equal_params) {
426
36.1k
    isl_space_free(model);
427
36.1k
    return u;
428
36.1k
  }
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
20.8k
{
416
20.8k
  isl_bool equal_params;
417
20.8k
  isl_reordering *r;
418
20.8k
419
20.8k
  if (!u || !model)
420
0
    goto error;
421
20.8k
422
20.8k
  equal_params = isl_space_has_equal_params(u->space, model);
423
20.8k
  if (equal_params < 0)
424
0
    goto error;
425
20.8k
  if (equal_params) {
426
20.8k
    isl_space_free(model);
427
20.8k
    return u;
428
20.8k
  }
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
15.2k
{
416
15.2k
  isl_bool equal_params;
417
15.2k
  isl_reordering *r;
418
15.2k
419
15.2k
  if (!u || !model)
420
0
    goto error;
421
15.2k
422
15.2k
  equal_params = isl_space_has_equal_params(u->space, model);
423
15.2k
  if (equal_params < 0)
424
0
    goto error;
425
15.2k
  if (equal_params) {
426
15.2k
    isl_space_free(model);
427
15.2k
    return u;
428
15.2k
  }
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
559
{
445
559
  UNION **u = (UNION **)user;
446
559
447
559
  *u = FN(UNION,add_part_generic)(*u, part, 0);
448
559
449
559
  return isl_stat_ok;
450
559
}
isl_aff.c:isl_union_pw_aff_union_add_part
Line
Count
Source
444
353
{
445
353
  UNION **u = (UNION **)user;
446
353
447
353
  *u = FN(UNION,add_part_generic)(*u, part, 0);
448
353
449
353
  return isl_stat_ok;
450
353
}
isl_aff.c:isl_union_pw_multi_aff_union_add_part
Line
Count
Source
444
205
{
445
205
  UNION **u = (UNION **)user;
446
205
447
205
  *u = FN(UNION,add_part_generic)(*u, part, 0);
448
205
449
205
  return isl_stat_ok;
450
205
}
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
458
{
465
458
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
466
458
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
467
458
468
458
  u1 = FN(UNION,cow)(u1);
469
458
470
458
  if (!u1 || !u2)
471
0
    goto error;
472
458
473
458
  if (FN(FN(UNION,foreach),BASE)(u2, &FN(UNION,union_add_part), &u1) < 0)
474
0
    goto error;
475
458
476
458
  FN(UNION,free)(u2);
477
458
478
458
  return u1;
479
458
error:
480
0
  FN(UNION,free)(u1);
481
0
  FN(UNION,free)(u2);
482
0
  return NULL;
483
458
}
isl_aff.c:isl_union_pw_aff_union_add_
Line
Count
Source
464
338
{
465
338
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
466
338
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
467
338
468
338
  u1 = FN(UNION,cow)(u1);
469
338
470
338
  if (!u1 || !u2)
471
0
    goto error;
472
338
473
338
  if (FN(FN(UNION,foreach),BASE)(u2, &FN(UNION,union_add_part), &u1) < 0)
474
0
    goto error;
475
338
476
338
  FN(UNION,free)(u2);
477
338
478
338
  return u1;
479
338
error:
480
0
  FN(UNION,free)(u1);
481
0
  FN(UNION,free)(u2);
482
0
  return NULL;
483
338
}
isl_aff.c:isl_union_pw_multi_aff_union_add_
Line
Count
Source
464
119
{
465
119
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
466
119
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
467
119
468
119
  u1 = FN(UNION,cow)(u1);
469
119
470
119
  if (!u1 || !u2)
471
0
    goto error;
472
119
473
119
  if (FN(FN(UNION,foreach),BASE)(u2, &FN(UNION,union_add_part), &u1) < 0)
474
0
    goto error;
475
119
476
119
  FN(UNION,free)(u2);
477
119
478
119
  return u1;
479
119
error:
480
0
  FN(UNION,free)(u1);
481
0
  FN(UNION,free)(u2);
482
0
  return NULL;
483
119
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_union_add_
isl_polynomial.c:isl_union_pw_qpolynomial_union_add_
Line
Count
Source
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
957
{
487
957
  isl_space *dim;
488
957
  UNION *u;
489
957
490
957
  if (!part)
491
0
    return NULL;
492
957
493
957
  dim = FN(PART,get_space)(part);
494
957
  dim = isl_space_drop_dims(dim, isl_dim_in, 0, isl_space_dim(dim, isl_dim_in));
495
957
  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
957
  u = FN(UNION,ZERO)(dim);
500
#endif
501
957
  u = FN(FN(UNION,add),BASE)(u, part);
502
957
503
957
  return u;
504
957
}
isl_union_pw_aff_from_pw_aff
Line
Count
Source
486
954
{
487
954
  isl_space *dim;
488
954
  UNION *u;
489
954
490
954
  if (!part)
491
0
    return NULL;
492
954
493
954
  dim = FN(PART,get_space)(part);
494
954
  dim = isl_space_drop_dims(dim, isl_dim_in, 0, isl_space_dim(dim, isl_dim_in));
495
954
  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
954
  u = FN(UNION,ZERO)(dim);
500
954
#endif
501
954
  u = FN(FN(UNION,add),BASE)(u, part);
502
954
503
954
  return u;
504
954
}
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
645
{
518
645
  S(UNION,match_bin_data) *data = user;
519
645
  struct isl_hash_table_entry *entry2;
520
645
  isl_space *space;
521
645
  PART *part2;
522
645
523
645
  space = FN(PART,get_space)(part);
524
645
  entry2 = FN(UNION,find_part_entry)(data->u2, space, 0);
525
645
  isl_space_free(space);
526
645
  if (!entry2)
527
0
    goto error;
528
645
  if (entry2 == isl_hash_table_entry_none) {
529
2
    FN(PART,free)(part);
530
2
    return isl_stat_ok;
531
2
  }
532
643
533
643
  part2 = entry2->data;
534
643
  if (!isl_space_tuple_is_equal(part->dim, isl_dim_out,
535
643
          part2->dim, isl_dim_out))
536
643
    
isl_die0
(FN(UNION,get_ctx)(data->u2), isl_error_invalid,
537
643
      "entries should have the same range space",
538
643
      goto error);
539
643
540
643
  part = data->fn(part, FN(PART, copy)(entry2->data));
541
643
542
643
  data->res = FN(FN(UNION,add),BASE)(data->res, part);
543
643
  if (!data->res)
544
0
    return isl_stat_error;
545
643
546
643
  return isl_stat_ok;
547
643
error:
548
0
  FN(PART,free)(part);
549
0
  return isl_stat_error;
550
643
}
isl_aff.c:isl_union_pw_aff_match_bin_entry
Line
Count
Source
517
643
{
518
643
  S(UNION,match_bin_data) *data = user;
519
643
  struct isl_hash_table_entry *entry2;
520
643
  isl_space *space;
521
643
  PART *part2;
522
643
523
643
  space = FN(PART,get_space)(part);
524
643
  entry2 = FN(UNION,find_part_entry)(data->u2, space, 0);
525
643
  isl_space_free(space);
526
643
  if (!entry2)
527
0
    goto error;
528
643
  if (entry2 == isl_hash_table_entry_none) {
529
1
    FN(PART,free)(part);
530
1
    return isl_stat_ok;
531
1
  }
532
642
533
642
  part2 = entry2->data;
534
642
  if (!isl_space_tuple_is_equal(part->dim, isl_dim_out,
535
642
          part2->dim, isl_dim_out))
536
642
    
isl_die0
(FN(UNION,get_ctx)(data->u2), isl_error_invalid,
537
642
      "entries should have the same range space",
538
642
      goto error);
539
642
540
642
  part = data->fn(part, FN(PART, copy)(entry2->data));
541
642
542
642
  data->res = FN(FN(UNION,add),BASE)(data->res, part);
543
642
  if (!data->res)
544
0
    return isl_stat_error;
545
642
546
642
  return isl_stat_ok;
547
642
error:
548
0
  FN(PART,free)(part);
549
0
  return isl_stat_error;
550
642
}
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
429
{
566
429
  S(UNION,match_bin_data) data = { NULL, NULL, fn };
567
429
568
429
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
569
429
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
570
429
571
429
  if (!u1 || !u2)
572
0
    goto error;
573
429
574
429
  data.u2 = u2;
575
429
  data.res = FN(UNION,alloc_same_size)(u1);
576
429
  if (FN(FN(UNION,foreach),BASE)(u1,
577
429
            &FN(UNION,match_bin_entry), &data) < 0)
578
0
    goto error;
579
429
580
429
  FN(UNION,free)(u1);
581
429
  FN(UNION,free)(u2);
582
429
  return data.res;
583
429
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
429
}
isl_aff.c:isl_union_pw_aff_match_bin_op
Line
Count
Source
565
428
{
566
428
  S(UNION,match_bin_data) data = { NULL, NULL, fn };
567
428
568
428
  u1 = FN(UNION,align_params)(u1, FN(UNION,get_space)(u2));
569
428
  u2 = FN(UNION,align_params)(u2, FN(UNION,get_space)(u1));
570
428
571
428
  if (!u1 || !u2)
572
0
    goto error;
573
428
574
428
  data.u2 = u2;
575
428
  data.res = FN(UNION,alloc_same_size)(u1);
576
428
  if (FN(FN(UNION,foreach),BASE)(u1,
577
428
            &FN(UNION,match_bin_entry), &data) < 0)
578
0
    goto error;
579
428
580
428
  FN(UNION,free)(u1);
581
428
  FN(UNION,free)(u2);
582
428
  return data.res;
583
428
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
428
}
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
162
{
598
#if DEFAULT_IS_ZERO
599
1
  return FN(UNION,union_add_)(u1, u2);
600
#else
601
161
  return FN(UNION,match_bin_op)(u1, u2, &FN(PART,add));
602
#endif
603
}
isl_union_pw_aff_add
Line
Count
Source
597
160
{
598
#if DEFAULT_IS_ZERO
599
  return FN(UNION,union_add_)(u1, u2);
600
#else
601
160
  return FN(UNION,match_bin_op)(u1, u2, &FN(PART,add));
602
160
#endif
603
160
}
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
268
{
610
268
  return FN(UNION,match_bin_op)(u1, u2, &FN(PART,sub));
611
268
}
isl_union_pw_aff_sub
Line
Count
Source
609
268
{
610
268
  return FN(UNION,match_bin_op)(u1, u2, &FN(PART,sub));
611
268
}
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
5.71k
{
622
5.71k
  S(UNION,any_set_data) *data = user;
623
5.71k
624
5.71k
  return data->fn(part, isl_set_copy(data->set));
625
5.71k
}
isl_aff.c:isl_union_pw_aff_any_set_entry
Line
Count
Source
621
5.71k
{
622
5.71k
  S(UNION,any_set_data) *data = user;
623
5.71k
624
5.71k
  return data->fn(part, isl_set_copy(data->set));
625
5.71k
}
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
1.31k
{
633
1.31k
  S(UNION,any_set_data) data = { NULL, fn };
634
1.31k
635
1.31k
  u = FN(UNION,align_params)(u, isl_set_get_space(set));
636
1.31k
  set = isl_set_align_params(set, FN(UNION,get_space)(u));
637
1.31k
638
1.31k
  if (!u || !set)
639
0
    goto error;
640
1.31k
641
1.31k
  data.set = set;
642
1.31k
  u = FN(UNION,transform)(u, &FN(UNION,any_set_entry), &data);
643
1.31k
  isl_set_free(set);
644
1.31k
  return u;
645
1.31k
error:
646
0
  FN(UNION,free)(u);
647
0
  isl_set_free(set);
648
0
  return NULL;
649
1.31k
}
isl_aff.c:isl_union_pw_aff_any_set_op
Line
Count
Source
632
1.31k
{
633
1.31k
  S(UNION,any_set_data) data = { NULL, fn };
634
1.31k
635
1.31k
  u = FN(UNION,align_params)(u, isl_set_get_space(set));
636
1.31k
  set = isl_set_align_params(set, FN(UNION,get_space)(u));
637
1.31k
638
1.31k
  if (!u || !set)
639
0
    goto error;
640
1.31k
641
1.31k
  data.set = set;
642
1.31k
  u = FN(UNION,transform)(u, &FN(UNION,any_set_entry), &data);
643
1.31k
  isl_set_free(set);
644
1.31k
  return u;
645
1.31k
error:
646
0
  FN(UNION,free)(u);
647
0
  isl_set_free(set);
648
0
  return NULL;
649
1.31k
}
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
1.31k
{
656
1.31k
  return FN(UNION,any_set_op)(u, set, &FN(PW,intersect_params));
657
1.31k
}
isl_union_pw_aff_intersect_params
Line
Count
Source
655
1.31k
{
656
1.31k
  return FN(UNION,any_set_op)(u, set, &FN(PW,intersect_params));
657
1.31k
}
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
500
{
676
500
  isl_set *set = (isl_set *)entry;
677
500
  isl_space *dim = (isl_space *)val;
678
500
679
500
  return isl_space_is_equal(set->dim, dim);
680
500
}
isl_aff.c:isl_union_pw_aff_set_has_dim
Line
Count
Source
675
470
{
676
470
  isl_set *set = (isl_set *)entry;
677
470
  isl_space *dim = (isl_space *)val;
678
470
679
470
  return isl_space_is_equal(set->dim, dim);
680
470
}
isl_aff.c:isl_union_pw_multi_aff_set_has_dim
Line
Count
Source
675
29
{
676
29
  isl_set *set = (isl_set *)entry;
677
29
  isl_space *dim = (isl_space *)val;
678
29
679
29
  return isl_space_is_equal(set->dim, dim);
680
29
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_set_has_dim
isl_polynomial.c:isl_union_pw_qpolynomial_set_has_dim
Line
Count
Source
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
696
{
688
696
  S(UNION,match_domain_data) *data = user;
689
696
  uint32_t hash;
690
696
  struct isl_hash_table_entry *entry2;
691
696
  isl_space *space;
692
696
693
696
  space = FN(PART,get_domain_space)(part);
694
696
  hash = isl_space_get_hash(space);
695
696
  entry2 = isl_hash_table_find(data->uset->dim->ctx, &data->uset->table,
696
696
             hash, &FN(UNION,set_has_dim), space, 0);
697
696
  isl_space_free(space);
698
696
  if (!entry2) {
699
196
    FN(PART,free)(part);
700
196
    return isl_stat_ok;
701
196
  }
702
500
703
500
  part = data->fn(part, isl_set_copy(entry2->data));
704
500
705
500
  data->res = FN(FN(UNION,add),BASE)(data->res, part);
706
500
  if (!data->res)
707
0
    return isl_stat_error;
708
500
709
500
  return isl_stat_ok;
710
500
}
isl_aff.c:isl_union_pw_aff_match_domain_entry
Line
Count
Source
687
664
{
688
664
  S(UNION,match_domain_data) *data = user;
689
664
  uint32_t hash;
690
664
  struct isl_hash_table_entry *entry2;
691
664
  isl_space *space;
692
664
693
664
  space = FN(PART,get_domain_space)(part);
694
664
  hash = isl_space_get_hash(space);
695
664
  entry2 = isl_hash_table_find(data->uset->dim->ctx, &data->uset->table,
696
664
             hash, &FN(UNION,set_has_dim), space, 0);
697
664
  isl_space_free(space);
698
664
  if (!entry2) {
699
194
    FN(PART,free)(part);
700
194
    return isl_stat_ok;
701
194
  }
702
470
703
470
  part = data->fn(part, isl_set_copy(entry2->data));
704
470
705
470
  data->res = FN(FN(UNION,add),BASE)(data->res, part);
706
470
  if (!data->res)
707
0
    return isl_stat_error;
708
470
709
470
  return isl_stat_ok;
710
470
}
isl_aff.c:isl_union_pw_multi_aff_match_domain_entry
Line
Count
Source
687
31
{
688
31
  S(UNION,match_domain_data) *data = user;
689
31
  uint32_t hash;
690
31
  struct isl_hash_table_entry *entry2;
691
31
  isl_space *space;
692
31
693
31
  space = FN(PART,get_domain_space)(part);
694
31
  hash = isl_space_get_hash(space);
695
31
  entry2 = isl_hash_table_find(data->uset->dim->ctx, &data->uset->table,
696
31
             hash, &FN(UNION,set_has_dim), space, 0);
697
31
  isl_space_free(space);
698
31
  if (!entry2) {
699
2
    FN(PART,free)(part);
700
2
    return isl_stat_ok;
701
2
  }
702
29
703
29
  part = data->fn(part, isl_set_copy(entry2->data));
704
29
705
29
  data->res = FN(FN(UNION,add),BASE)(data->res, part);
706
29
  if (!data->res)
707
0
    return isl_stat_error;
708
29
709
29
  return isl_stat_ok;
710
29
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_match_domain_entry
isl_polynomial.c:isl_union_pw_qpolynomial_match_domain_entry
Line
Count
Source
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
357
{
720
357
  S(UNION,match_domain_data) data = { NULL, NULL, fn };
721
357
722
357
  u = FN(UNION,align_params)(u, isl_union_set_get_space(uset));
723
357
  uset = isl_union_set_align_params(uset, FN(UNION,get_space)(u));
724
357
725
357
  if (!u || !uset)
726
0
    goto error;
727
357
728
357
  data.uset = uset;
729
357
  data.res = FN(UNION,alloc_same_size)(u);
730
357
  if (FN(FN(UNION,foreach),BASE)(u,
731
357
           &FN(UNION,match_domain_entry), &data) < 0)
732
0
    goto error;
733
357
734
357
  FN(UNION,free)(u);
735
357
  isl_union_set_free(uset);
736
357
  return data.res;
737
357
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
357
}
isl_aff.c:isl_union_pw_aff_match_domain_op
Line
Count
Source
719
335
{
720
335
  S(UNION,match_domain_data) data = { NULL, NULL, fn };
721
335
722
335
  u = FN(UNION,align_params)(u, isl_union_set_get_space(uset));
723
335
  uset = isl_union_set_align_params(uset, FN(UNION,get_space)(u));
724
335
725
335
  if (!u || !uset)
726
0
    goto error;
727
335
728
335
  data.uset = uset;
729
335
  data.res = FN(UNION,alloc_same_size)(u);
730
335
  if (FN(FN(UNION,foreach),BASE)(u,
731
335
           &FN(UNION,match_domain_entry), &data) < 0)
732
0
    goto error;
733
335
734
335
  FN(UNION,free)(u);
735
335
  isl_union_set_free(uset);
736
335
  return data.res;
737
335
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
335
}
isl_aff.c:isl_union_pw_multi_aff_match_domain_op
Line
Count
Source
719
21
{
720
21
  S(UNION,match_domain_data) data = { NULL, NULL, fn };
721
21
722
21
  u = FN(UNION,align_params)(u, isl_union_set_get_space(uset));
723
21
  uset = isl_union_set_align_params(uset, FN(UNION,get_space)(u));
724
21
725
21
  if (!u || !uset)
726
0
    goto error;
727
21
728
21
  data.uset = uset;
729
21
  data.res = FN(UNION,alloc_same_size)(u);
730
21
  if (FN(FN(UNION,foreach),BASE)(u,
731
21
           &FN(UNION,match_domain_entry), &data) < 0)
732
0
    goto error;
733
21
734
21
  FN(UNION,free)(u);
735
21
  isl_union_set_free(uset);
736
21
  return data.res;
737
21
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
21
}
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_match_domain_op
isl_polynomial.c:isl_union_pw_qpolynomial_match_domain_op
Line
Count
Source
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
58
{
751
58
  if (isl_union_set_is_params(uset))
752
0
    return FN(UNION,intersect_params)(u,
753
0
            isl_set_from_union_set(uset));
754
58
  return FN(UNION,match_domain_op)(u, uset, &FN(PW,intersect_domain));
755
58
}
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
20
{
751
20
  if (isl_union_set_is_params(uset))
752
0
    return FN(UNION,intersect_params)(u,
753
0
            isl_set_from_union_set(uset));
754
20
  return FN(UNION,match_domain_op)(u, uset, &FN(PW,intersect_domain));
755
20
}
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
299
{
786
299
  if (isl_union_set_is_params(uset))
787
0
    return FN(UNION,gist_params)(u, isl_set_from_union_set(uset));
788
299
  return FN(UNION,match_domain_op)(u, uset, &FN(PW,gist));
789
299
}
isl_union_pw_aff_gist
Line
Count
Source
785
298
{
786
298
  if (isl_union_set_is_params(uset))
787
0
    return FN(UNION,gist_params)(u, isl_set_from_union_set(uset));
788
298
  return FN(UNION,match_domain_op)(u, uset, &FN(PW,gist));
789
298
}
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
9.73k
{
823
9.73k
  isl_union_set **uset = (isl_union_set **)user;
824
9.73k
825
9.73k
  *uset = isl_union_set_add_set(*uset, FN(PART,domain)(part));
826
9.73k
827
9.73k
  return isl_stat_ok;
828
9.73k
}
isl_aff.c:isl_union_pw_aff_domain_entry
Line
Count
Source
822
9.72k
{
823
9.72k
  isl_union_set **uset = (isl_union_set **)user;
824
9.72k
825
9.72k
  *uset = isl_union_set_add_set(*uset, FN(PART,domain)(part));
826
9.72k
827
9.72k
  return isl_stat_ok;
828
9.72k
}
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
6.04k
{
832
6.04k
  isl_union_set *uset;
833
6.04k
834
6.04k
  uset = isl_union_set_empty(FN(UNION,get_space)(u));
835
6.04k
  if (FN(FN(UNION,foreach),BASE)(u, &FN(UNION,domain_entry), &uset) < 0)
836
0
    goto error;
837
6.04k
838
6.04k
  FN(UNION,free)(u);
839
6.04k
  
840
6.04k
  return uset;
841
6.04k
error:
842
0
  isl_union_set_free(uset);
843
0
  FN(UNION,free)(u);
844
0
  return NULL;
845
6.04k
}
isl_union_pw_aff_domain
Line
Count
Source
831
6.04k
{
832
6.04k
  isl_union_set *uset;
833
6.04k
834
6.04k
  uset = isl_union_set_empty(FN(UNION,get_space)(u));
835
6.04k
  if (FN(FN(UNION,foreach),BASE)(u, &FN(UNION,domain_entry), &uset) < 0)
836
0
    goto error;
837
6.04k
838
6.04k
  FN(UNION,free)(u);
839
6.04k
  
840
6.04k
  return uset;
841
6.04k
error:
842
0
  isl_union_set_free(uset);
843
0
  FN(UNION,free)(u);
844
0
  return NULL;
845
6.04k
}
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
159
{
873
159
  isl_val *v = user;
874
159
875
159
  return FN(PART,scale_val)(part, isl_val_copy(v));
876
159
}
isl_aff.c:isl_union_pw_aff_scale_val_entry
Line
Count
Source
872
159
{
873
159
  isl_val *v = user;
874
159
875
159
  return FN(PART,scale_val)(part, isl_val_copy(v));
876
159
}
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
189
{
883
189
  if (!u || !v)
884
0
    goto error;
885
189
  if (isl_val_is_one(v)) {
886
35
    isl_val_free(v);
887
35
    return u;
888
35
  }
889
154
890
154
  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
154
903
154
  if (!isl_val_is_rat(v))
904
154
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
905
154
      "expecting rational factor", goto error);
906
154
907
154
  u = FN(UNION,transform_inplace)(u, &FN(UNION,scale_val_entry), v);
908
154
  if (isl_val_is_neg(v))
909
2
    u = FN(UNION,negate_type)(u);
910
154
911
154
  isl_val_free(v);
912
154
  return u;
913
154
error:
914
0
  isl_val_free(v);
915
0
  FN(UNION,free)(u);
916
0
  return NULL;
917
154
}
isl_union_pw_aff_scale_val
Line
Count
Source
882
189
{
883
189
  if (!u || !v)
884
0
    goto error;
885
189
  if (isl_val_is_one(v)) {
886
35
    isl_val_free(v);
887
35
    return u;
888
35
  }
889
154
890
154
  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
154
903
154
  if (!isl_val_is_rat(v))
904
154
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
905
154
      "expecting rational factor", goto error);
906
154
907
154
  u = FN(UNION,transform_inplace)(u, &FN(UNION,scale_val_entry), v);
908
154
  if (isl_val_is_neg(v))
909
2
    u = FN(UNION,negate_type)(u);
910
154
911
154
  isl_val_free(v);
912
154
  return u;
913
154
error:
914
0
  isl_val_free(v);
915
0
  FN(UNION,free)(u);
916
0
  return NULL;
917
154
}
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
157
{
924
157
  isl_val *v = user;
925
157
926
157
  return FN(PART,scale_down_val)(part, isl_val_copy(v));
927
157
}
isl_aff.c:isl_union_pw_aff_scale_down_val_entry
Line
Count
Source
923
157
{
924
157
  isl_val *v = user;
925
157
926
157
  return FN(PART,scale_down_val)(part, isl_val_copy(v));
927
157
}
Unexecuted instantiation: isl_aff.c:isl_union_pw_multi_aff_scale_down_val_entry
Unexecuted instantiation: isl_fold.c:isl_union_pw_qpolynomial_fold_scale_down_val_entry
Unexecuted instantiation: isl_polynomial.c:isl_union_pw_qpolynomial_scale_down_val_entry
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
172
{
934
172
  if (!u || !v)
935
0
    goto error;
936
172
  if (isl_val_is_one(v)) {
937
18
    isl_val_free(v);
938
18
    return u;
939
18
  }
940
154
941
154
  if (!isl_val_is_rat(v))
942
154
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
943
154
      "expecting rational factor", goto error);
944
154
  if (isl_val_is_zero(v))
945
154
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
946
154
      "cannot scale down by zero", goto error);
947
154
948
154
  u = FN(UNION,transform_inplace)(u, &FN(UNION,scale_down_val_entry), v);
949
154
  if (isl_val_is_neg(v))
950
0
    u = FN(UNION,negate_type)(u);
951
154
952
154
  isl_val_free(v);
953
154
  return u;
954
154
error:
955
0
  isl_val_free(v);
956
0
  FN(UNION,free)(u);
957
0
  return NULL;
958
154
}
isl_union_pw_aff_scale_down_val
Line
Count
Source
933
172
{
934
172
  if (!u || !v)
935
0
    goto error;
936
172
  if (isl_val_is_one(v)) {
937
18
    isl_val_free(v);
938
18
    return u;
939
18
  }
940
154
941
154
  if (!isl_val_is_rat(v))
942
154
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
943
154
      "expecting rational factor", goto error);
944
154
  if (isl_val_is_zero(v))
945
154
    
isl_die0
(isl_val_get_ctx(v), isl_error_invalid,
946
154
      "cannot scale down by zero", goto error);
947
154
948
154
  u = FN(UNION,transform_inplace)(u, &FN(UNION,scale_down_val_entry), v);
949
154
  if (isl_val_is_neg(v))
950
0
    u = FN(UNION,negate_type)(u);
951
154
952
154
  isl_val_free(v);
953
154
  return u;
954
154
error:
955
0
  isl_val_free(v);
956
0
  FN(UNION,free)(u);
957
0
  return NULL;
958
154
}
Unexecuted instantiation: isl_union_pw_multi_aff_scale_down_val
Unexecuted instantiation: isl_union_pw_qpolynomial_fold_scale_down_val
Unexecuted instantiation: isl_union_pw_qpolynomial_scale_down_val
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