Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/polly/lib/External/isl/isl_multi_dims.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2011      Sven Verdoolaege
3
 * Copyright 2012-2013 Ecole Normale Superieure
4
 *
5
 * Use of this software is governed by the MIT license
6
 *
7
 * Written by Sven Verdoolaege,
8
 * Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
9
 */
10
11
#include <isl_space_private.h>
12
13
#include <isl_multi_macro.h>
14
15
/* Check whether "multi" has non-zero coefficients for any dimension
16
 * in the given range or if any of these dimensions appear
17
 * with non-zero coefficients in any of the integer divisions involved.
18
 */
19
isl_bool FN(MULTI(BASE),involves_dims)(__isl_keep MULTI(BASE) *multi,
20
  enum isl_dim_type type, unsigned first, unsigned n)
21
9
{
22
9
  int i;
23
9
24
9
  if (!multi)
25
0
    return isl_bool_error;
26
9
  if (n == 0)
27
6
    return isl_bool_false;
28
3
29
3
  for (i = 0; i < multi->n; 
++i0
) {
30
0
    isl_bool involves;
31
0
32
0
    involves = FN(EL,involves_dims)(multi->u.p[i], type, first, n);
33
0
    if (involves < 0 || involves)
34
0
      return involves;
35
0
  }
36
3
37
3
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
38
3
    return FN(MULTI(BASE),involves_explicit_domain_dims)(multi,
39
3
                type, first, n);
40
0
41
0
  return isl_bool_false;
42
0
}
isl_multi_aff_involves_dims
Line
Count
Source
21
6
{
22
6
  int i;
23
6
24
6
  if (!multi)
25
0
    return isl_bool_error;
26
6
  if (n == 0)
27
6
    return isl_bool_false;
28
0
29
0
  for (i = 0; i < multi->n; ++i) {
30
0
    isl_bool involves;
31
0
32
0
    involves = FN(EL,involves_dims)(multi->u.p[i], type, first, n);
33
0
    if (involves < 0 || involves)
34
0
      return involves;
35
0
  }
36
0
37
0
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
38
0
    return FN(MULTI(BASE),involves_explicit_domain_dims)(multi,
39
0
                type, first, n);
40
0
41
0
  return isl_bool_false;
42
0
}
isl_multi_pw_aff_involves_dims
Line
Count
Source
21
3
{
22
3
  int i;
23
3
24
3
  if (!multi)
25
0
    return isl_bool_error;
26
3
  if (n == 0)
27
0
    return isl_bool_false;
28
3
29
3
  for (i = 0; i < multi->n; 
++i0
) {
30
0
    isl_bool involves;
31
0
32
0
    involves = FN(EL,involves_dims)(multi->u.p[i], type, first, n);
33
0
    if (involves < 0 || involves)
34
0
      return involves;
35
0
  }
36
3
37
3
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
38
3
    return FN(MULTI(BASE),involves_explicit_domain_dims)(multi,
39
3
                type, first, n);
40
0
41
0
  return isl_bool_false;
42
0
}
Unexecuted instantiation: isl_multi_val_involves_dims
43
44
__isl_give MULTI(BASE) *FN(MULTI(BASE),insert_dims)(
45
  __isl_take MULTI(BASE) *multi,
46
  enum isl_dim_type type, unsigned first, unsigned n)
47
19
{
48
19
  int i;
49
19
50
19
  if (!multi)
51
0
    return NULL;
52
19
  if (type == isl_dim_out)
53
19
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
54
19
      "cannot insert output/set dimensions",
55
19
      return FN(MULTI(BASE),free)(multi));
56
19
  if (n == 0 && 
!isl_space_is_named_or_nested(multi->space, type)6
)
57
6
    return multi;
58
13
59
13
  multi = FN(MULTI(BASE),cow)(multi);
60
13
  if (!multi)
61
0
    return NULL;
62
13
63
13
  multi->space = isl_space_insert_dims(multi->space, type, first, n);
64
13
  if (!multi->space)
65
0
    return FN(MULTI(BASE),free)(multi);
66
13
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
67
1
    multi = FN(MULTI(BASE),insert_explicit_domain_dims)(multi,
68
1
                type, first, n);
69
13
  if (!multi)
70
0
    return NULL;
71
13
72
25
  
for (i = 0; 13
i < multi->n;
++i12
) {
73
12
    multi->u.p[i] = FN(EL,insert_dims)(multi->u.p[i],
74
12
              type, first, n);
75
12
    if (!multi->u.p[i])
76
0
      return FN(MULTI(BASE),free)(multi);
77
12
  }
78
13
79
13
  return multi;
80
13
}
isl_multi_aff_insert_dims
Line
Count
Source
47
18
{
48
18
  int i;
49
18
50
18
  if (!multi)
51
0
    return NULL;
52
18
  if (type == isl_dim_out)
53
18
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
54
18
      "cannot insert output/set dimensions",
55
18
      return FN(MULTI(BASE),free)(multi));
56
18
  if (n == 0 && 
!isl_space_is_named_or_nested(multi->space, type)6
)
57
6
    return multi;
58
12
59
12
  multi = FN(MULTI(BASE),cow)(multi);
60
12
  if (!multi)
61
0
    return NULL;
62
12
63
12
  multi->space = isl_space_insert_dims(multi->space, type, first, n);
64
12
  if (!multi->space)
65
0
    return FN(MULTI(BASE),free)(multi);
66
12
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
67
0
    multi = FN(MULTI(BASE),insert_explicit_domain_dims)(multi,
68
0
                type, first, n);
69
12
  if (!multi)
70
0
    return NULL;
71
12
72
24
  
for (i = 0; 12
i < multi->n;
++i12
) {
73
12
    multi->u.p[i] = FN(EL,insert_dims)(multi->u.p[i],
74
12
              type, first, n);
75
12
    if (!multi->u.p[i])
76
0
      return FN(MULTI(BASE),free)(multi);
77
12
  }
78
12
79
12
  return multi;
80
12
}
isl_multi_pw_aff_insert_dims
Line
Count
Source
47
1
{
48
1
  int i;
49
1
50
1
  if (!multi)
51
0
    return NULL;
52
1
  if (type == isl_dim_out)
53
1
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
54
1
      "cannot insert output/set dimensions",
55
1
      return FN(MULTI(BASE),free)(multi));
56
1
  if (n == 0 && 
!isl_space_is_named_or_nested(multi->space, type)0
)
57
0
    return multi;
58
1
59
1
  multi = FN(MULTI(BASE),cow)(multi);
60
1
  if (!multi)
61
0
    return NULL;
62
1
63
1
  multi->space = isl_space_insert_dims(multi->space, type, first, n);
64
1
  if (!multi->space)
65
0
    return FN(MULTI(BASE),free)(multi);
66
1
  if (FN(MULTI(BASE),has_explicit_domain)(multi))
67
1
    multi = FN(MULTI(BASE),insert_explicit_domain_dims)(multi,
68
1
                type, first, n);
69
1
  if (!multi)
70
0
    return NULL;
71
1
72
1
  for (i = 0; i < multi->n; 
++i0
) {
73
0
    multi->u.p[i] = FN(EL,insert_dims)(multi->u.p[i],
74
0
              type, first, n);
75
0
    if (!multi->u.p[i])
76
0
      return FN(MULTI(BASE),free)(multi);
77
0
  }
78
1
79
1
  return multi;
80
1
}
Unexecuted instantiation: isl_multi_val_insert_dims
81
82
__isl_give MULTI(BASE) *FN(MULTI(BASE),add_dims)(__isl_take MULTI(BASE) *multi,
83
  enum isl_dim_type type, unsigned n)
84
0
{
85
0
  unsigned pos;
86
0
87
0
  pos = FN(MULTI(BASE),dim)(multi, type);
88
0
89
0
  return FN(MULTI(BASE),insert_dims)(multi, type, pos, n);
90
0
}
Unexecuted instantiation: isl_multi_aff_add_dims
Unexecuted instantiation: isl_multi_pw_aff_add_dims
Unexecuted instantiation: isl_multi_val_add_dims
91
92
/* Project the domain of "multi" onto its parameter space.
93
 * "multi" may not involve any of the domain dimensions.
94
 */
95
__isl_give MULTI(BASE) *FN(MULTI(BASE),project_domain_on_params)(
96
  __isl_take MULTI(BASE) *multi)
97
6
{
98
6
  unsigned n;
99
6
  isl_bool involves;
100
6
  isl_space *space;
101
6
102
6
  n = FN(MULTI(BASE),dim)(multi, isl_dim_in);
103
6
  involves = FN(MULTI(BASE),involves_dims)(multi, isl_dim_in, 0, n);
104
6
  if (involves < 0)
105
0
    return FN(MULTI(BASE),free)(multi);
106
6
  if (involves)
107
6
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
108
6
        "expression involves some of the domain dimensions",
109
6
        return FN(MULTI(BASE),free)(multi));
110
6
  multi = FN(MULTI(BASE),drop_dims)(multi, isl_dim_in, 0, n);
111
6
  space = FN(MULTI(BASE),get_domain_space)(multi);
112
6
  space = isl_space_params(space);
113
6
  multi = FN(MULTI(BASE),reset_domain_space)(multi, space);
114
6
  return multi;
115
6
}
isl_multi_aff_project_domain_on_params
Line
Count
Source
97
6
{
98
6
  unsigned n;
99
6
  isl_bool involves;
100
6
  isl_space *space;
101
6
102
6
  n = FN(MULTI(BASE),dim)(multi, isl_dim_in);
103
6
  involves = FN(MULTI(BASE),involves_dims)(multi, isl_dim_in, 0, n);
104
6
  if (involves < 0)
105
0
    return FN(MULTI(BASE),free)(multi);
106
6
  if (involves)
107
6
    
isl_die0
(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid,
108
6
        "expression involves some of the domain dimensions",
109
6
        return FN(MULTI(BASE),free)(multi));
110
6
  multi = FN(MULTI(BASE),drop_dims)(multi, isl_dim_in, 0, n);
111
6
  space = FN(MULTI(BASE),get_domain_space)(multi);
112
6
  space = isl_space_params(space);
113
6
  multi = FN(MULTI(BASE),reset_domain_space)(multi, space);
114
6
  return multi;
115
6
}
Unexecuted instantiation: isl_multi_pw_aff_project_domain_on_params
Unexecuted instantiation: isl_multi_val_project_domain_on_params