Coverage Report

Created: 2018-11-13 17:19

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/polly/lib/External/isl/isl_multi_explicit_domain.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2017      Sven Verdoolaege
3
 *
4
 * Use of this software is governed by the MIT license
5
 *
6
 * Written by Sven Verdoolaege.
7
 */
8
9
/* These versions of the explicit domain functions are used
10
 * when the multi expression may have an explicit domain.
11
 */
12
13
#include <isl_multi_macro.h>
14
15
__isl_give MULTI(BASE) *FN(MULTI(BASE),cow)(__isl_take MULTI(BASE) *multi);
16
17
/* Does "multi" have an explicit domain?
18
 *
19
 * An explicit domain is only available if "multi" is zero-dimensional.
20
 */
21
static int FN(MULTI(BASE),has_explicit_domain)(__isl_keep MULTI(BASE) *multi)
22
88.9k
{
23
88.9k
  return multi && multi->n == 0;
24
88.9k
}
isl_aff.c:isl_multi_pw_aff_has_explicit_domain
Line
Count
Source
22
41.9k
{
23
41.9k
  return multi && multi->n == 0;
24
41.9k
}
isl_aff.c:isl_multi_union_pw_aff_has_explicit_domain
Line
Count
Source
22
46.9k
{
23
46.9k
  return multi && multi->n == 0;
24
46.9k
}
25
26
/* Check that "multi" has an explicit domain.
27
 */
28
static isl_stat FN(MULTI(BASE),check_has_explicit_domain)(
29
  __isl_keep MULTI(BASE) *multi)
30
13.6k
{
31
13.6k
  if (!multi)
32
0
    return isl_stat_error;
33
13.6k
  if (!FN(MULTI(BASE),has_explicit_domain)(multi))
34
13.6k
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_internal,
35
13.6k
      "expression does not have an explicit domain",
36
13.6k
      return isl_stat_error);
37
13.6k
  return isl_stat_ok;
38
13.6k
}
isl_aff.c:isl_multi_pw_aff_check_has_explicit_domain
Line
Count
Source
30
2.99k
{
31
2.99k
  if (!multi)
32
0
    return isl_stat_error;
33
2.99k
  if (!FN(MULTI(BASE),has_explicit_domain)(multi))
34
2.99k
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_internal,
35
2.99k
      "expression does not have an explicit domain",
36
2.99k
      return isl_stat_error);
37
2.99k
  return isl_stat_ok;
38
2.99k
}
isl_aff.c:isl_multi_union_pw_aff_check_has_explicit_domain
Line
Count
Source
30
10.6k
{
31
10.6k
  if (!multi)
32
0
    return isl_stat_error;
33
10.6k
  if (!FN(MULTI(BASE),has_explicit_domain)(multi))
34
10.6k
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_internal,
35
10.6k
      "expression does not have an explicit domain",
36
10.6k
      return isl_stat_error);
37
10.6k
  return isl_stat_ok;
38
10.6k
}
39
40
/* Return the explicit domain of "multi", assuming it has one.
41
 */
42
static __isl_keep DOM *FN(MULTI(BASE),peek_explicit_domain)(
43
  __isl_keep MULTI(BASE) *multi)
44
1.98k
{
45
1.98k
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
46
0
    return NULL;
47
1.98k
  return multi->u.dom;
48
1.98k
}
isl_aff.c:isl_multi_pw_aff_peek_explicit_domain
Line
Count
Source
44
267
{
45
267
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
46
0
    return NULL;
47
267
  return multi->u.dom;
48
267
}
isl_aff.c:isl_multi_union_pw_aff_peek_explicit_domain
Line
Count
Source
44
1.71k
{
45
1.71k
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
46
0
    return NULL;
47
1.71k
  return multi->u.dom;
48
1.71k
}
49
50
/* Return a copy of the explicit domain of "multi", assuming it has one.
51
 */
52
static __isl_give DOM *FN(MULTI(BASE),get_explicit_domain)(
53
  __isl_keep MULTI(BASE) *multi)
54
654
{
55
654
  return FN(DOM,copy)(FN(MULTI(BASE),peek_explicit_domain)(multi));
56
654
}
isl_aff.c:isl_multi_pw_aff_get_explicit_domain
Line
Count
Source
54
260
{
55
260
  return FN(DOM,copy)(FN(MULTI(BASE),peek_explicit_domain)(multi));
56
260
}
isl_aff.c:isl_multi_union_pw_aff_get_explicit_domain
Line
Count
Source
54
394
{
55
394
  return FN(DOM,copy)(FN(MULTI(BASE),peek_explicit_domain)(multi));
56
394
}
57
58
/* Replace the explicit domain of "multi" by "dom", assuming it has one.
59
 */
60
static __isl_give MULTI(BASE) *FN(MULTI(BASE),set_explicit_domain)(
61
  __isl_take MULTI(BASE) *multi, __isl_take DOM *dom)
62
436
{
63
436
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
64
0
    goto error;
65
436
  multi = FN(MULTI(BASE),cow)(multi);
66
436
  if (!multi || !dom)
67
0
    goto error;
68
436
  FN(DOM,free)(multi->u.dom);
69
436
  multi->u.dom = dom;
70
436
  if (!multi->u.dom)
71
0
    return FN(MULTI(BASE),free)(multi);
72
436
  return multi;
73
436
error:
74
0
  FN(MULTI(BASE),free)(multi);
75
0
  FN(DOM,free)(dom);
76
0
  return NULL;
77
436
}
isl_aff.c:isl_multi_pw_aff_set_explicit_domain
Line
Count
Source
62
196
{
63
196
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
64
0
    goto error;
65
196
  multi = FN(MULTI(BASE),cow)(multi);
66
196
  if (!multi || !dom)
67
0
    goto error;
68
196
  FN(DOM,free)(multi->u.dom);
69
196
  multi->u.dom = dom;
70
196
  if (!multi->u.dom)
71
0
    return FN(MULTI(BASE),free)(multi);
72
196
  return multi;
73
196
error:
74
0
  FN(MULTI(BASE),free)(multi);
75
0
  FN(DOM,free)(dom);
76
0
  return NULL;
77
196
}
isl_aff.c:isl_multi_union_pw_aff_set_explicit_domain
Line
Count
Source
62
240
{
63
240
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
64
0
    goto error;
65
240
  multi = FN(MULTI(BASE),cow)(multi);
66
240
  if (!multi || !dom)
67
0
    goto error;
68
240
  FN(DOM,free)(multi->u.dom);
69
240
  multi->u.dom = dom;
70
240
  if (!multi->u.dom)
71
0
    return FN(MULTI(BASE),free)(multi);
72
240
  return multi;
73
240
error:
74
0
  FN(MULTI(BASE),free)(multi);
75
0
  FN(DOM,free)(dom);
76
0
  return NULL;
77
240
}
78
79
/* Intersect the domain of "dst" with the explicit domain of "src".
80
 *
81
 * In the case of isl_multi_union_pw_aff objects, the explicit domain
82
 * of "src" is allowed to have only constraints on the parameters, even
83
 * if the domain of "dst" contains actual domain elements.  In this case,
84
 * the domain of "dst" is intersected with those parameter constraints.
85
 */
86
static __isl_give MULTI(BASE) *FN(MULTI(BASE),intersect_explicit_domain)(
87
  __isl_take MULTI(BASE) *dst, __isl_keep MULTI(BASE) *src)
88
1.32k
{
89
1.32k
  isl_bool is_params;
90
1.32k
  DOM *dom;
91
1.32k
92
1.32k
  dom = FN(MULTI(BASE),peek_explicit_domain)(src);
93
1.32k
  is_params = FN(DOM,is_params)(dom);
94
1.32k
  if (is_params < 0)
95
0
    return FN(MULTI(BASE),free)(dst);
96
1.32k
97
1.32k
  dom = FN(DOM,copy)(dom);
98
1.32k
  if (!is_params) {
99
18
    dst = FN(MULTI(BASE),intersect_domain)(dst, dom);
100
1.31k
  } else {
101
1.31k
    isl_set *params;
102
1.31k
103
1.31k
    params = FN(DOM,params)(dom);
104
1.31k
    dst = FN(MULTI(BASE),intersect_params)(dst, params);
105
1.31k
  }
106
1.32k
107
1.32k
  return dst;
108
1.32k
}
isl_aff.c:isl_multi_pw_aff_intersect_explicit_domain
Line
Count
Source
88
7
{
89
7
  isl_bool is_params;
90
7
  DOM *dom;
91
7
92
7
  dom = FN(MULTI(BASE),peek_explicit_domain)(src);
93
7
  is_params = FN(DOM,is_params)(dom);
94
7
  if (is_params < 0)
95
0
    return FN(MULTI(BASE),free)(dst);
96
7
97
7
  dom = FN(DOM,copy)(dom);
98
7
  if (!is_params) {
99
7
    dst = FN(MULTI(BASE),intersect_domain)(dst, dom);
100
7
  } else {
101
0
    isl_set *params;
102
0
103
0
    params = FN(DOM,params)(dom);
104
0
    dst = FN(MULTI(BASE),intersect_params)(dst, params);
105
0
  }
106
7
107
7
  return dst;
108
7
}
isl_aff.c:isl_multi_union_pw_aff_intersect_explicit_domain
Line
Count
Source
88
1.32k
{
89
1.32k
  isl_bool is_params;
90
1.32k
  DOM *dom;
91
1.32k
92
1.32k
  dom = FN(MULTI(BASE),peek_explicit_domain)(src);
93
1.32k
  is_params = FN(DOM,is_params)(dom);
94
1.32k
  if (is_params < 0)
95
0
    return FN(MULTI(BASE),free)(dst);
96
1.32k
97
1.32k
  dom = FN(DOM,copy)(dom);
98
1.32k
  if (!is_params) {
99
11
    dst = FN(MULTI(BASE),intersect_domain)(dst, dom);
100
1.31k
  } else {
101
1.31k
    isl_set *params;
102
1.31k
103
1.31k
    params = FN(DOM,params)(dom);
104
1.31k
    dst = FN(MULTI(BASE),intersect_params)(dst, params);
105
1.31k
  }
106
1.32k
107
1.32k
  return dst;
108
1.32k
}
109
110
/* Set the explicit domain of "dst" to that of "src".
111
 */
112
static __isl_give MULTI(BASE) *FN(MULTI(BASE),copy_explicit_domain)(
113
  __isl_take MULTI(BASE) *dst, __isl_keep MULTI(BASE) *src)
114
1
{
115
1
  DOM *dom;
116
1
117
1
  dom = FN(MULTI(BASE),get_explicit_domain)(src);
118
1
  dst = FN(MULTI(BASE),set_explicit_domain)(dst, dom);
119
1
120
1
  return dst;
121
1
}
isl_aff.c:isl_multi_pw_aff_copy_explicit_domain
Line
Count
Source
114
1
{
115
1
  DOM *dom;
116
1
117
1
  dom = FN(MULTI(BASE),get_explicit_domain)(src);
118
1
  dst = FN(MULTI(BASE),set_explicit_domain)(dst, dom);
119
1
120
1
  return dst;
121
1
}
Unexecuted instantiation: isl_aff.c:isl_multi_union_pw_aff_copy_explicit_domain
122
123
/* Align the parameters of the explicit domain of "multi" to those of "space".
124
 */
125
static __isl_give MULTI(BASE) *FN(MULTI(BASE),align_explicit_domain_params)(
126
  __isl_take MULTI(BASE) *multi, __isl_take isl_space *space)
127
41
{
128
41
  DOM *dom;
129
41
130
41
  dom = FN(MULTI(BASE),get_explicit_domain)(multi);
131
41
  dom = FN(DOM,align_params)(dom, space);
132
41
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, dom);
133
41
134
41
  return multi;
135
41
}
isl_aff.c:isl_multi_pw_aff_align_explicit_domain_params
Line
Count
Source
127
5
{
128
5
  DOM *dom;
129
5
130
5
  dom = FN(MULTI(BASE),get_explicit_domain)(multi);
131
5
  dom = FN(DOM,align_params)(dom, space);
132
5
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, dom);
133
5
134
5
  return multi;
135
5
}
isl_aff.c:isl_multi_union_pw_aff_align_explicit_domain_params
Line
Count
Source
127
36
{
128
36
  DOM *dom;
129
36
130
36
  dom = FN(MULTI(BASE),get_explicit_domain)(multi);
131
36
  dom = FN(DOM,align_params)(dom, space);
132
36
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, dom);
133
36
134
36
  return multi;
135
36
}
136
137
/* Replace the space of the explicit domain of "multi" by "space",
138
 * without modifying its dimension.
139
 */
140
static __isl_give MULTI(BASE) *FN(MULTI(BASE),reset_explicit_domain_space)(
141
  __isl_take MULTI(BASE) *multi, __isl_take isl_space *space)
142
63
{
143
63
  DOM *dom;
144
63
145
63
  dom = FN(MULTI(BASE),get_explicit_domain)(multi);
146
63
  dom = FN(DOM,reset_equal_dim_space)(dom, space);
147
63
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, dom);
148
63
149
63
  return multi;
150
63
}
isl_aff.c:isl_multi_pw_aff_reset_explicit_domain_space
Line
Count
Source
142
22
{
143
22
  DOM *dom;
144
22
145
22
  dom = FN(MULTI(BASE),get_explicit_domain)(multi);
146
22
  dom = FN(DOM,reset_equal_dim_space)(dom, space);
147
22
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, dom);
148
22
149
22
  return multi;
150
22
}
isl_aff.c:isl_multi_union_pw_aff_reset_explicit_domain_space
Line
Count
Source
142
41
{
143
41
  DOM *dom;
144
41
145
41
  dom = FN(MULTI(BASE),get_explicit_domain)(multi);
146
41
  dom = FN(DOM,reset_equal_dim_space)(dom, space);
147
41
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, dom);
148
41
149
41
  return multi;
150
41
}
151
152
/* Free the explicit domain of "multi".
153
 */
154
static void FN(MULTI(BASE),free_explicit_domain)(__isl_keep MULTI(BASE) *multi)
155
5.34k
{
156
5.34k
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
157
0
    return;
158
5.34k
  FN(DOM,free)(multi->u.dom);
159
5.34k
}
isl_aff.c:isl_multi_pw_aff_free_explicit_domain
Line
Count
Source
155
1.15k
{
156
1.15k
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
157
0
    return;
158
1.15k
  FN(DOM,free)(multi->u.dom);
159
1.15k
}
isl_aff.c:isl_multi_union_pw_aff_free_explicit_domain
Line
Count
Source
155
4.19k
{
156
4.19k
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
157
0
    return;
158
4.19k
  FN(DOM,free)(multi->u.dom);
159
4.19k
}
160
161
/* Do "multi1" and "multi2" have the same explicit domain?
162
 */
163
static isl_bool FN(MULTI(BASE),equal_explicit_domain)(
164
  __isl_keep MULTI(BASE) *multi1, __isl_keep MULTI(BASE) *multi2)
165
88
{
166
88
  DOM *dom1, *dom2;
167
88
  isl_bool equal;
168
88
169
88
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi1) < 0 ||
170
88
      FN(MULTI(BASE),check_has_explicit_domain)(multi2) < 0)
171
0
    return isl_bool_error;
172
88
  dom1 = FN(MULTI(BASE),get_explicit_domain)(multi1);
173
88
  dom2 = FN(MULTI(BASE),get_explicit_domain)(multi2);
174
88
  equal = FN(DOM,is_equal)(dom1, dom2);
175
88
  FN(DOM,free)(dom1);
176
88
  FN(DOM,free)(dom2);
177
88
178
88
  return equal;
179
88
}
isl_aff.c:isl_multi_pw_aff_equal_explicit_domain
Line
Count
Source
165
27
{
166
27
  DOM *dom1, *dom2;
167
27
  isl_bool equal;
168
27
169
27
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi1) < 0 ||
170
27
      FN(MULTI(BASE),check_has_explicit_domain)(multi2) < 0)
171
0
    return isl_bool_error;
172
27
  dom1 = FN(MULTI(BASE),get_explicit_domain)(multi1);
173
27
  dom2 = FN(MULTI(BASE),get_explicit_domain)(multi2);
174
27
  equal = FN(DOM,is_equal)(dom1, dom2);
175
27
  FN(DOM,free)(dom1);
176
27
  FN(DOM,free)(dom2);
177
27
178
27
  return equal;
179
27
}
isl_aff.c:isl_multi_union_pw_aff_equal_explicit_domain
Line
Count
Source
165
61
{
166
61
  DOM *dom1, *dom2;
167
61
  isl_bool equal;
168
61
169
61
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi1) < 0 ||
170
61
      FN(MULTI(BASE),check_has_explicit_domain)(multi2) < 0)
171
0
    return isl_bool_error;
172
61
  dom1 = FN(MULTI(BASE),get_explicit_domain)(multi1);
173
61
  dom2 = FN(MULTI(BASE),get_explicit_domain)(multi2);
174
61
  equal = FN(DOM,is_equal)(dom1, dom2);
175
61
  FN(DOM,free)(dom1);
176
61
  FN(DOM,free)(dom2);
177
61
178
61
  return equal;
179
61
}
180
181
static isl_stat FN(MULTI(BASE),check_explicit_domain)(
182
  __isl_keep MULTI(BASE) *multi) __attribute__ ((unused));
183
184
/* Debugging function to check that the explicit domain of "multi"
185
 * has the correct space.
186
 */
187
isl_stat FN(MULTI(BASE),check_explicit_domain)(__isl_keep MULTI(BASE) *multi)
188
0
{
189
0
  isl_space *space1, *space2;
190
0
  isl_bool equal;
191
0
192
0
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
193
0
    return isl_stat_error;
194
0
  space1 = isl_space_domain(isl_space_copy(multi->space));
195
0
  space2 = FN(DOM,get_space)(multi->u.dom);
196
0
  equal = isl_space_is_equal(space1, space2);
197
0
  isl_space_free(space1);
198
0
  isl_space_free(space2);
199
0
  if (equal < 0)
200
0
    return isl_stat_error;
201
0
  if (!equal)
202
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_internal,
203
0
      "check failed", return isl_stat_error);
204
0
  return isl_stat_ok;
205
0
}
Unexecuted instantiation: isl_aff.c:isl_multi_pw_aff_check_explicit_domain
Unexecuted instantiation: isl_aff.c:isl_multi_union_pw_aff_check_explicit_domain