Coverage Report

Created: 2018-05-23 17:40

/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.4k
{
23
88.4k
  return multi && multi->n == 0;
24
88.4k
}
isl_aff.c:isl_multi_pw_aff_has_explicit_domain
Line
Count
Source
22
41.6k
{
23
41.6k
  return multi && multi->n == 0;
24
41.6k
}
isl_aff.c:isl_multi_union_pw_aff_has_explicit_domain
Line
Count
Source
22
46.7k
{
23
46.7k
  return multi && multi->n == 0;
24
46.7k
}
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.5k
{
31
13.5k
  if (!multi)
32
0
    return isl_stat_error;
33
13.5k
  if (!FN(MULTI(BASE),has_explicit_domain)(multi))
34
13.5k
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_internal,
35
13.5k
      "expression does not have an explicit domain",
36
13.5k
      return isl_stat_error);
37
13.5k
  return isl_stat_ok;
38
13.5k
}
isl_aff.c:isl_multi_pw_aff_check_has_explicit_domain
Line
Count
Source
30
2.97k
{
31
2.97k
  if (!multi)
32
0
    return isl_stat_error;
33
2.97k
  if (!FN(MULTI(BASE),has_explicit_domain)(multi))
34
2.97k
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_internal,
35
2.97k
      "expression does not have an explicit domain",
36
2.97k
      return isl_stat_error);
37
2.97k
  return isl_stat_ok;
38
2.97k
}
isl_aff.c:isl_multi_union_pw_aff_check_has_explicit_domain
Line
Count
Source
30
10.5k
{
31
10.5k
  if (!multi)
32
0
    return isl_stat_error;
33
10.5k
  if (!FN(MULTI(BASE),has_explicit_domain)(multi))
34
10.5k
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_internal,
35
10.5k
      "expression does not have an explicit domain",
36
10.5k
      return isl_stat_error);
37
10.5k
  return isl_stat_ok;
38
10.5k
}
39
40
/* Return the explicit domain of "multi", assuming it has one.
41
 */
42
static __isl_give DOM *FN(MULTI(BASE),get_explicit_domain)(
43
  __isl_keep MULTI(BASE) *multi)
44
1.96k
{
45
1.96k
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
46
0
    return NULL;
47
1.96k
  return FN(DOM,copy)(multi->u.dom);
48
1.96k
}
isl_aff.c:isl_multi_pw_aff_get_explicit_domain
Line
Count
Source
44
266
{
45
266
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
46
0
    return NULL;
47
266
  return FN(DOM,copy)(multi->u.dom);
48
266
}
isl_aff.c:isl_multi_union_pw_aff_get_explicit_domain
Line
Count
Source
44
1.69k
{
45
1.69k
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
46
0
    return NULL;
47
1.69k
  return FN(DOM,copy)(multi->u.dom);
48
1.69k
}
49
50
/* Replace the explicit domain of "multi" by "dom", assuming it has one.
51
 */
52
static __isl_give MULTI(BASE) *FN(MULTI(BASE),set_explicit_domain)(
53
  __isl_take MULTI(BASE) *multi, __isl_take DOM *dom)
54
426
{
55
426
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
56
0
    goto error;
57
426
  multi = FN(MULTI(BASE),cow)(multi);
58
426
  if (!multi || !dom)
59
0
    goto error;
60
426
  FN(DOM,free)(multi->u.dom);
61
426
  multi->u.dom = dom;
62
426
  if (!multi->u.dom)
63
0
    return FN(MULTI(BASE),free)(multi);
64
426
  return multi;
65
426
error:
66
0
  FN(MULTI(BASE),free)(multi);
67
0
  FN(DOM,free)(dom);
68
0
  return NULL;
69
426
}
isl_aff.c:isl_multi_pw_aff_set_explicit_domain
Line
Count
Source
54
195
{
55
195
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
56
0
    goto error;
57
195
  multi = FN(MULTI(BASE),cow)(multi);
58
195
  if (!multi || !dom)
59
0
    goto error;
60
195
  FN(DOM,free)(multi->u.dom);
61
195
  multi->u.dom = dom;
62
195
  if (!multi->u.dom)
63
0
    return FN(MULTI(BASE),free)(multi);
64
195
  return multi;
65
195
error:
66
0
  FN(MULTI(BASE),free)(multi);
67
0
  FN(DOM,free)(dom);
68
0
  return NULL;
69
195
}
isl_aff.c:isl_multi_union_pw_aff_set_explicit_domain
Line
Count
Source
54
231
{
55
231
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
56
0
    goto error;
57
231
  multi = FN(MULTI(BASE),cow)(multi);
58
231
  if (!multi || !dom)
59
0
    goto error;
60
231
  FN(DOM,free)(multi->u.dom);
61
231
  multi->u.dom = dom;
62
231
  if (!multi->u.dom)
63
0
    return FN(MULTI(BASE),free)(multi);
64
231
  return multi;
65
231
error:
66
0
  FN(MULTI(BASE),free)(multi);
67
0
  FN(DOM,free)(dom);
68
0
  return NULL;
69
231
}
70
71
/* Intersect the domain of "dst" with the explicit domain of "src".
72
 */
73
static __isl_give MULTI(BASE) *FN(MULTI(BASE),intersect_explicit_domain)(
74
  __isl_take MULTI(BASE) *dst, __isl_keep MULTI(BASE) *src)
75
1.32k
{
76
1.32k
  DOM *dom;
77
1.32k
78
1.32k
  dom = FN(MULTI(BASE),get_explicit_domain)(src);
79
1.32k
  dst = FN(MULTI(BASE),intersect_domain)(dst, dom);
80
1.32k
81
1.32k
  return dst;
82
1.32k
}
isl_aff.c:isl_multi_pw_aff_intersect_explicit_domain
Line
Count
Source
75
7
{
76
7
  DOM *dom;
77
7
78
7
  dom = FN(MULTI(BASE),get_explicit_domain)(src);
79
7
  dst = FN(MULTI(BASE),intersect_domain)(dst, dom);
80
7
81
7
  return dst;
82
7
}
isl_aff.c:isl_multi_union_pw_aff_intersect_explicit_domain
Line
Count
Source
75
1.31k
{
76
1.31k
  DOM *dom;
77
1.31k
78
1.31k
  dom = FN(MULTI(BASE),get_explicit_domain)(src);
79
1.31k
  dst = FN(MULTI(BASE),intersect_domain)(dst, dom);
80
1.31k
81
1.31k
  return dst;
82
1.31k
}
83
84
/* Set the explicit domain of "dst" to that of "src".
85
 */
86
static __isl_give MULTI(BASE) *FN(MULTI(BASE),copy_explicit_domain)(
87
  __isl_take MULTI(BASE) *dst, __isl_keep MULTI(BASE) *src)
88
1
{
89
1
  DOM *dom;
90
1
91
1
  dom = FN(MULTI(BASE),get_explicit_domain)(src);
92
1
  dst = FN(MULTI(BASE),set_explicit_domain)(dst, dom);
93
1
94
1
  return dst;
95
1
}
isl_aff.c:isl_multi_pw_aff_copy_explicit_domain
Line
Count
Source
88
1
{
89
1
  DOM *dom;
90
1
91
1
  dom = FN(MULTI(BASE),get_explicit_domain)(src);
92
1
  dst = FN(MULTI(BASE),set_explicit_domain)(dst, dom);
93
1
94
1
  return dst;
95
1
}
Unexecuted instantiation: isl_aff.c:isl_multi_union_pw_aff_copy_explicit_domain
96
97
/* Align the parameters of the explicit domain of "multi" to those of "space".
98
 */
99
static __isl_give MULTI(BASE) *FN(MULTI(BASE),align_explicit_domain_params)(
100
  __isl_take MULTI(BASE) *multi, __isl_take isl_space *space)
101
41
{
102
41
  DOM *dom;
103
41
104
41
  dom = FN(MULTI(BASE),get_explicit_domain)(multi);
105
41
  dom = FN(DOM,align_params)(dom, space);
106
41
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, dom);
107
41
108
41
  return multi;
109
41
}
isl_aff.c:isl_multi_pw_aff_align_explicit_domain_params
Line
Count
Source
101
5
{
102
5
  DOM *dom;
103
5
104
5
  dom = FN(MULTI(BASE),get_explicit_domain)(multi);
105
5
  dom = FN(DOM,align_params)(dom, space);
106
5
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, dom);
107
5
108
5
  return multi;
109
5
}
isl_aff.c:isl_multi_union_pw_aff_align_explicit_domain_params
Line
Count
Source
101
36
{
102
36
  DOM *dom;
103
36
104
36
  dom = FN(MULTI(BASE),get_explicit_domain)(multi);
105
36
  dom = FN(DOM,align_params)(dom, space);
106
36
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, dom);
107
36
108
36
  return multi;
109
36
}
110
111
/* Replace the space of the explicit domain of "multi" by "space",
112
 * without modifying its dimension.
113
 */
114
static __isl_give MULTI(BASE) *FN(MULTI(BASE),reset_explicit_domain_space)(
115
  __isl_take MULTI(BASE) *multi, __isl_take isl_space *space)
116
63
{
117
63
  DOM *dom;
118
63
119
63
  dom = FN(MULTI(BASE),get_explicit_domain)(multi);
120
63
  dom = FN(DOM,reset_equal_dim_space)(dom, space);
121
63
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, dom);
122
63
123
63
  return multi;
124
63
}
isl_aff.c:isl_multi_pw_aff_reset_explicit_domain_space
Line
Count
Source
116
22
{
117
22
  DOM *dom;
118
22
119
22
  dom = FN(MULTI(BASE),get_explicit_domain)(multi);
120
22
  dom = FN(DOM,reset_equal_dim_space)(dom, space);
121
22
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, dom);
122
22
123
22
  return multi;
124
22
}
isl_aff.c:isl_multi_union_pw_aff_reset_explicit_domain_space
Line
Count
Source
116
41
{
117
41
  DOM *dom;
118
41
119
41
  dom = FN(MULTI(BASE),get_explicit_domain)(multi);
120
41
  dom = FN(DOM,reset_equal_dim_space)(dom, space);
121
41
  multi = FN(MULTI(BASE),set_explicit_domain)(multi, dom);
122
41
123
41
  return multi;
124
41
}
125
126
/* Free the explicit domain of "multi".
127
 */
128
static void FN(MULTI(BASE),free_explicit_domain)(__isl_keep MULTI(BASE) *multi)
129
5.32k
{
130
5.32k
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
131
0
    return;
132
5.32k
  FN(DOM,free)(multi->u.dom);
133
5.32k
}
isl_aff.c:isl_multi_pw_aff_free_explicit_domain
Line
Count
Source
129
1.14k
{
130
1.14k
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
131
0
    return;
132
1.14k
  FN(DOM,free)(multi->u.dom);
133
1.14k
}
isl_aff.c:isl_multi_union_pw_aff_free_explicit_domain
Line
Count
Source
129
4.18k
{
130
4.18k
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
131
0
    return;
132
4.18k
  FN(DOM,free)(multi->u.dom);
133
4.18k
}
134
135
/* Do "multi1" and "multi2" have the same explicit domain?
136
 */
137
static isl_bool FN(MULTI(BASE),equal_explicit_domain)(
138
  __isl_keep MULTI(BASE) *multi1, __isl_keep MULTI(BASE) *multi2)
139
86
{
140
86
  DOM *dom1, *dom2;
141
86
  isl_bool equal;
142
86
143
86
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi1) < 0 ||
144
86
      FN(MULTI(BASE),check_has_explicit_domain)(multi2) < 0)
145
0
    return isl_bool_error;
146
86
  dom1 = FN(MULTI(BASE),get_explicit_domain)(multi1);
147
86
  dom2 = FN(MULTI(BASE),get_explicit_domain)(multi2);
148
86
  equal = FN(DOM,is_equal)(dom1, dom2);
149
86
  FN(DOM,free)(dom1);
150
86
  FN(DOM,free)(dom2);
151
86
152
86
  return equal;
153
86
}
isl_aff.c:isl_multi_pw_aff_equal_explicit_domain
Line
Count
Source
139
27
{
140
27
  DOM *dom1, *dom2;
141
27
  isl_bool equal;
142
27
143
27
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi1) < 0 ||
144
27
      FN(MULTI(BASE),check_has_explicit_domain)(multi2) < 0)
145
0
    return isl_bool_error;
146
27
  dom1 = FN(MULTI(BASE),get_explicit_domain)(multi1);
147
27
  dom2 = FN(MULTI(BASE),get_explicit_domain)(multi2);
148
27
  equal = FN(DOM,is_equal)(dom1, dom2);
149
27
  FN(DOM,free)(dom1);
150
27
  FN(DOM,free)(dom2);
151
27
152
27
  return equal;
153
27
}
isl_aff.c:isl_multi_union_pw_aff_equal_explicit_domain
Line
Count
Source
139
59
{
140
59
  DOM *dom1, *dom2;
141
59
  isl_bool equal;
142
59
143
59
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi1) < 0 ||
144
59
      FN(MULTI(BASE),check_has_explicit_domain)(multi2) < 0)
145
0
    return isl_bool_error;
146
59
  dom1 = FN(MULTI(BASE),get_explicit_domain)(multi1);
147
59
  dom2 = FN(MULTI(BASE),get_explicit_domain)(multi2);
148
59
  equal = FN(DOM,is_equal)(dom1, dom2);
149
59
  FN(DOM,free)(dom1);
150
59
  FN(DOM,free)(dom2);
151
59
152
59
  return equal;
153
59
}
154
155
static isl_stat FN(MULTI(BASE),check_explicit_domain)(
156
  __isl_keep MULTI(BASE) *multi) __attribute__ ((unused));
157
158
/* Debugging function to check that the explicit domain of "multi"
159
 * has the correct space.
160
 */
161
isl_stat FN(MULTI(BASE),check_explicit_domain)(__isl_keep MULTI(BASE) *multi)
162
0
{
163
0
  isl_space *space1, *space2;
164
0
  isl_bool equal;
165
0
166
0
  if (FN(MULTI(BASE),check_has_explicit_domain)(multi) < 0)
167
0
    return isl_stat_error;
168
0
  space1 = isl_space_domain(isl_space_copy(multi->space));
169
0
  space2 = FN(DOM,get_space)(multi->u.dom);
170
0
  equal = isl_space_is_equal(space1, space2);
171
0
  isl_space_free(space1);
172
0
  isl_space_free(space2);
173
0
  if (equal < 0)
174
0
    return isl_stat_error;
175
0
  if (!equal)
176
0
    isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_internal,
177
0
      "check failed", return isl_stat_error);
178
0
  return isl_stat_ok;
179
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