Coverage Report

Created: 2017-10-03 07:32

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/tools/polly/lib/External/isl/isl_pw_templ.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2010-2011 INRIA Saclay
3
 * Copyright 2011      Sven Verdoolaege
4
 * Copyright 2012-2014 Ecole Normale Superieure
5
 *
6
 * Use of this software is governed by the MIT license
7
 *
8
 * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France,
9
 * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod,
10
 * 91893 Orsay, France
11
 * and Ecole Normale Superieure, 45 rue d’Ulm, 75230 Paris, France
12
 */
13
14
#include <isl/aff.h>
15
#include <isl_sort.h>
16
#include <isl_val_private.h>
17
18
#include <isl_pw_macro.h>
19
20
#ifdef HAS_TYPE
21
__isl_give PW *FN(PW,alloc_size)(__isl_take isl_space *dim,
22
  enum isl_fold type, int n)
23
#else
24
__isl_give PW *FN(PW,alloc_size)(__isl_take isl_space *dim, int n)
25
#endif
26
244k
{
27
244k
  isl_ctx *ctx;
28
244k
  struct PW *pw;
29
244k
30
244k
  if (!dim)
31
0
    return NULL;
32
244k
  ctx = isl_space_get_ctx(dim);
33
244k
  isl_assert(ctx, n >= 0, goto error);
34
244k
  
pw = 244k
isl_alloc244k
(ctx, struct PW,
35
244k
      sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
36
244k
  if (!pw)
37
0
    goto error;
38
244k
39
244k
  pw->ref = 1;
40
#ifdef HAS_TYPE
41
  pw->type = type;
42
#endif
43
  pw->size = n;
44
244k
  pw->n = 0;
45
244k
  pw->dim = dim;
46
244k
  return pw;
47
0
error:
48
0
  isl_space_free(dim);
49
0
  return NULL;
50
244k
}
isl_pw_qpolynomial_fold_alloc_size
Line
Count
Source
26
35
{
27
35
  isl_ctx *ctx;
28
35
  struct PW *pw;
29
35
30
35
  if (!dim)
31
0
    return NULL;
32
35
  ctx = isl_space_get_ctx(dim);
33
35
  isl_assert(ctx, n >= 0, goto error);
34
35
  
pw = 35
isl_alloc35
(ctx, struct PW,
35
35
      sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
36
35
  if (!pw)
37
0
    goto error;
38
35
39
35
  pw->ref = 1;
40
35
#ifdef HAS_TYPE
41
35
  pw->type = type;
42
35
#endif
43
35
  pw->size = n;
44
35
  pw->n = 0;
45
35
  pw->dim = dim;
46
35
  return pw;
47
0
error:
48
0
  isl_space_free(dim);
49
0
  return NULL;
50
35
}
isl_pw_multi_aff_alloc_size
Line
Count
Source
26
29.7k
{
27
29.7k
  isl_ctx *ctx;
28
29.7k
  struct PW *pw;
29
29.7k
30
29.7k
  if (!dim)
31
0
    return NULL;
32
29.7k
  ctx = isl_space_get_ctx(dim);
33
29.7k
  isl_assert(ctx, n >= 0, goto error);
34
29.7k
  
pw = 29.7k
isl_alloc29.7k
(ctx, struct PW,
35
29.7k
      sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
36
29.7k
  if (!pw)
37
0
    goto error;
38
29.7k
39
29.7k
  pw->ref = 1;
40
#ifdef HAS_TYPE
41
  pw->type = type;
42
#endif
43
  pw->size = n;
44
29.7k
  pw->n = 0;
45
29.7k
  pw->dim = dim;
46
29.7k
  return pw;
47
0
error:
48
0
  isl_space_free(dim);
49
0
  return NULL;
50
29.7k
}
isl_pw_aff_alloc_size
Line
Count
Source
26
214k
{
27
214k
  isl_ctx *ctx;
28
214k
  struct PW *pw;
29
214k
30
214k
  if (!dim)
31
0
    return NULL;
32
214k
  ctx = isl_space_get_ctx(dim);
33
214k
  isl_assert(ctx, n >= 0, goto error);
34
214k
  
pw = 214k
isl_alloc214k
(ctx, struct PW,
35
214k
      sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
36
214k
  if (!pw)
37
0
    goto error;
38
214k
39
214k
  pw->ref = 1;
40
#ifdef HAS_TYPE
41
  pw->type = type;
42
#endif
43
  pw->size = n;
44
214k
  pw->n = 0;
45
214k
  pw->dim = dim;
46
214k
  return pw;
47
0
error:
48
0
  isl_space_free(dim);
49
0
  return NULL;
50
214k
}
isl_pw_qpolynomial_alloc_size
Line
Count
Source
26
104
{
27
104
  isl_ctx *ctx;
28
104
  struct PW *pw;
29
104
30
104
  if (!dim)
31
0
    return NULL;
32
104
  ctx = isl_space_get_ctx(dim);
33
104
  isl_assert(ctx, n >= 0, goto error);
34
104
  
pw = 104
isl_alloc104
(ctx, struct PW,
35
104
      sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
36
104
  if (!pw)
37
0
    goto error;
38
104
39
104
  pw->ref = 1;
40
#ifdef HAS_TYPE
41
  pw->type = type;
42
#endif
43
  pw->size = n;
44
104
  pw->n = 0;
45
104
  pw->dim = dim;
46
104
  return pw;
47
0
error:
48
0
  isl_space_free(dim);
49
0
  return NULL;
50
104
}
51
52
#ifdef HAS_TYPE
53
__isl_give PW *FN(PW,ZERO)(__isl_take isl_space *dim, enum isl_fold type)
54
16
{
55
16
  return FN(PW,alloc_size)(dim, type, 0);
56
16
}
57
#else
58
__isl_give PW *FN(PW,ZERO)(__isl_take isl_space *dim)
59
7.58k
{
60
7.58k
  return FN(PW,alloc_size)(dim, 0);
61
7.58k
}
isl_pw_multi_aff_empty
Line
Count
Source
59
3.86k
{
60
3.86k
  return FN(PW,alloc_size)(dim, 0);
61
3.86k
}
isl_pw_aff_empty
Line
Count
Source
59
3.72k
{
60
3.72k
  return FN(PW,alloc_size)(dim, 0);
61
3.72k
}
isl_pw_qpolynomial_zero
Line
Count
Source
59
2
{
60
2
  return FN(PW,alloc_size)(dim, 0);
61
2
}
62
#endif
63
64
__isl_give PW *FN(PW,add_piece)(__isl_take PW *pw,
65
  __isl_take isl_set *set, __isl_take EL *el)
66
243k
{
67
243k
  isl_ctx *ctx;
68
243k
  isl_space *el_dim = NULL;
69
243k
70
243k
  if (
!pw || 243k
!set243k
||
!el243k
)
71
0
    goto error;
72
243k
73
243k
  
if (243k
isl_set_plain_is_empty(set) || 243k
FN243k
(EL,EL_IS_ZERO)(el)243k
) {
74
679
    isl_set_free(set);
75
679
    FN(EL,free)(el);
76
679
    return pw;
77
679
  }
78
243k
79
243k
  ctx = isl_set_get_ctx(set);
80
#ifdef HAS_TYPE
81
18
  if (pw->type != el->type)
82
0
    isl_die(ctx, isl_error_invalid, "fold types don't match",
83
      goto error);
84
#endif
85
243k
  
el_dim = 18
FN243k
(EL,get_space(el));
86
243k
  isl_assert(ctx, isl_space_is_equal(pw->dim, el_dim), goto error);
87
243k
  
isl_assert243k
(ctx, pw->n < pw->size, goto error);
88
243k
89
243k
  pw->p[pw->n].set = set;
90
243k
  pw->p[pw->n].FIELD = el;
91
243k
  pw->n++;
92
243k
  
93
243k
  isl_space_free(el_dim);
94
243k
  return pw;
95
0
error:
96
0
  isl_space_free(el_dim);
97
0
  FN(PW,free)(pw);
98
0
  isl_set_free(set);
99
0
  FN(EL,free)(el);
100
0
  return NULL;
101
243k
}
isl_pw_multi_aff_add_piece
Line
Count
Source
66
28.0k
{
67
28.0k
  isl_ctx *ctx;
68
28.0k
  isl_space *el_dim = NULL;
69
28.0k
70
28.0k
  if (
!pw || 28.0k
!set28.0k
||
!el28.0k
)
71
0
    goto error;
72
28.0k
73
28.0k
  
if (28.0k
isl_set_plain_is_empty(set) || 28.0k
FN27.8k
(EL,EL_IS_ZERO)(el)27.8k
) {
74
281
    isl_set_free(set);
75
281
    FN(EL,free)(el);
76
281
    return pw;
77
281
  }
78
28.0k
79
27.8k
  ctx = isl_set_get_ctx(set);
80
#ifdef HAS_TYPE
81
  if (pw->type != el->type)
82
    isl_die(ctx, isl_error_invalid, "fold types don't match",
83
      goto error);
84
#endif
85
27.8k
  el_dim = FN(EL,get_space(el));
86
27.8k
  isl_assert(ctx, isl_space_is_equal(pw->dim, el_dim), goto error);
87
27.8k
  
isl_assert27.8k
(ctx, pw->n < pw->size, goto error);
88
27.8k
89
27.8k
  pw->p[pw->n].set = set;
90
27.8k
  pw->p[pw->n].FIELD = el;
91
27.8k
  pw->n++;
92
27.8k
  
93
27.8k
  isl_space_free(el_dim);
94
27.8k
  return pw;
95
0
error:
96
0
  isl_space_free(el_dim);
97
0
  FN(PW,free)(pw);
98
0
  isl_set_free(set);
99
0
  FN(EL,free)(el);
100
0
  return NULL;
101
28.0k
}
isl_pw_qpolynomial_fold_add_piece
Line
Count
Source
66
24
{
67
24
  isl_ctx *ctx;
68
24
  isl_space *el_dim = NULL;
69
24
70
24
  if (
!pw || 24
!set24
||
!el24
)
71
0
    goto error;
72
24
73
24
  
if (24
isl_set_plain_is_empty(set) || 24
FN18
(EL,EL_IS_ZERO)(el)18
) {
74
6
    isl_set_free(set);
75
6
    FN(EL,free)(el);
76
6
    return pw;
77
6
  }
78
24
79
18
  ctx = isl_set_get_ctx(set);
80
18
#ifdef HAS_TYPE
81
18
  if (pw->type != el->type)
82
0
    isl_die(ctx, isl_error_invalid, "fold types don't match",
83
18
      goto error);
84
18
#endif
85
18
  
el_dim = 18
FN18
(EL,get_space(el));
86
18
  isl_assert(ctx, isl_space_is_equal(pw->dim, el_dim), goto error);
87
18
  
isl_assert18
(ctx, pw->n < pw->size, goto error);
88
18
89
18
  pw->p[pw->n].set = set;
90
18
  pw->p[pw->n].FIELD = el;
91
18
  pw->n++;
92
18
  
93
18
  isl_space_free(el_dim);
94
18
  return pw;
95
0
error:
96
0
  isl_space_free(el_dim);
97
0
  FN(PW,free)(pw);
98
0
  isl_set_free(set);
99
0
  FN(EL,free)(el);
100
0
  return NULL;
101
24
}
isl_pw_qpolynomial_add_piece
Line
Count
Source
66
151
{
67
151
  isl_ctx *ctx;
68
151
  isl_space *el_dim = NULL;
69
151
70
151
  if (
!pw || 151
!set151
||
!el151
)
71
0
    goto error;
72
151
73
151
  
if (151
isl_set_plain_is_empty(set) || 151
FN107
(EL,EL_IS_ZERO)(el)107
) {
74
53
    isl_set_free(set);
75
53
    FN(EL,free)(el);
76
53
    return pw;
77
53
  }
78
151
79
98
  ctx = isl_set_get_ctx(set);
80
#ifdef HAS_TYPE
81
  if (pw->type != el->type)
82
    isl_die(ctx, isl_error_invalid, "fold types don't match",
83
      goto error);
84
#endif
85
98
  el_dim = FN(EL,get_space(el));
86
98
  isl_assert(ctx, isl_space_is_equal(pw->dim, el_dim), goto error);
87
98
  
isl_assert98
(ctx, pw->n < pw->size, goto error);
88
98
89
98
  pw->p[pw->n].set = set;
90
98
  pw->p[pw->n].FIELD = el;
91
98
  pw->n++;
92
98
  
93
98
  isl_space_free(el_dim);
94
98
  return pw;
95
0
error:
96
0
  isl_space_free(el_dim);
97
0
  FN(PW,free)(pw);
98
0
  isl_set_free(set);
99
0
  FN(EL,free)(el);
100
0
  return NULL;
101
151
}
isl_pw_aff_add_piece
Line
Count
Source
66
215k
{
67
215k
  isl_ctx *ctx;
68
215k
  isl_space *el_dim = NULL;
69
215k
70
215k
  if (
!pw || 215k
!set215k
||
!el215k
)
71
0
    goto error;
72
215k
73
215k
  
if (215k
isl_set_plain_is_empty(set) || 215k
FN215k
(EL,EL_IS_ZERO)(el)215k
) {
74
339
    isl_set_free(set);
75
339
    FN(EL,free)(el);
76
339
    return pw;
77
339
  }
78
215k
79
215k
  ctx = isl_set_get_ctx(set);
80
#ifdef HAS_TYPE
81
  if (pw->type != el->type)
82
    isl_die(ctx, isl_error_invalid, "fold types don't match",
83
      goto error);
84
#endif
85
215k
  el_dim = FN(EL,get_space(el));
86
215k
  isl_assert(ctx, isl_space_is_equal(pw->dim, el_dim), goto error);
87
215k
  
isl_assert215k
(ctx, pw->n < pw->size, goto error);
88
215k
89
215k
  pw->p[pw->n].set = set;
90
215k
  pw->p[pw->n].FIELD = el;
91
215k
  pw->n++;
92
215k
  
93
215k
  isl_space_free(el_dim);
94
215k
  return pw;
95
0
error:
96
0
  isl_space_free(el_dim);
97
0
  FN(PW,free)(pw);
98
0
  isl_set_free(set);
99
0
  FN(EL,free)(el);
100
0
  return NULL;
101
215k
}
102
103
#ifdef HAS_TYPE
104
__isl_give PW *FN(PW,alloc)(enum isl_fold type,
105
  __isl_take isl_set *set, __isl_take EL *el)
106
#else
107
__isl_give PW *FN(PW,alloc)(__isl_take isl_set *set, __isl_take EL *el)
108
#endif
109
98.1k
{
110
98.1k
  PW *pw;
111
98.1k
112
98.1k
  if (
!set || 98.1k
!el98.1k
)
113
0
    goto error;
114
98.1k
115
#ifdef HAS_TYPE
116
12
  
pw = 12
FN12
(PW,alloc_size)(
FN12
(EL,get_space)(el), type, 1);
117
#else
118
98.1k
  
pw = 98.1k
FN98.1k
(PW,alloc_size)(
FN98.1k
(EL,get_space)(el), 1);
119
#endif
120
121
98.1k
  return FN(PW,add_piece)(pw, set, el);
122
0
error:
123
0
  isl_set_free(set);
124
0
  FN(EL,free)(el);
125
0
  return NULL;
126
98.1k
}
isl_pw_aff_alloc
Line
Count
Source
109
75.8k
{
110
75.8k
  PW *pw;
111
75.8k
112
75.8k
  if (
!set || 75.8k
!el75.8k
)
113
0
    goto error;
114
75.8k
115
#ifdef HAS_TYPE
116
  pw = FN(PW,alloc_size)(FN(EL,get_space)(el), type, 1);
117
#else
118
75.8k
  
pw = 75.8k
FN75.8k
(PW,alloc_size)(
FN75.8k
(EL,get_space)(el), 1);
119
75.8k
#endif
120
75.8k
121
75.8k
  return FN(PW,add_piece)(pw, set, el);
122
0
error:
123
0
  isl_set_free(set);
124
0
  FN(EL,free)(el);
125
0
  return NULL;
126
75.8k
}
isl_pw_qpolynomial_alloc
Line
Count
Source
109
33
{
110
33
  PW *pw;
111
33
112
33
  if (
!set || 33
!el33
)
113
0
    goto error;
114
33
115
#ifdef HAS_TYPE
116
  pw = FN(PW,alloc_size)(FN(EL,get_space)(el), type, 1);
117
#else
118
33
  
pw = 33
FN33
(PW,alloc_size)(
FN33
(EL,get_space)(el), 1);
119
33
#endif
120
33
121
33
  return FN(PW,add_piece)(pw, set, el);
122
0
error:
123
0
  isl_set_free(set);
124
0
  FN(EL,free)(el);
125
0
  return NULL;
126
33
}
isl_pw_qpolynomial_fold_alloc
Line
Count
Source
109
12
{
110
12
  PW *pw;
111
12
112
12
  if (
!set || 12
!el12
)
113
0
    goto error;
114
12
115
12
#ifdef HAS_TYPE
116
12
  
pw = 12
FN12
(PW,alloc_size)(
FN12
(EL,get_space)(el), type, 1);
117
#else
118
  pw = FN(PW,alloc_size)(FN(EL,get_space)(el), 1);
119
#endif
120
121
12
  return FN(PW,add_piece)(pw, set, el);
122
0
error:
123
0
  isl_set_free(set);
124
0
  FN(EL,free)(el);
125
0
  return NULL;
126
12
}
isl_pw_multi_aff_alloc
Line
Count
Source
109
22.2k
{
110
22.2k
  PW *pw;
111
22.2k
112
22.2k
  if (
!set || 22.2k
!el22.2k
)
113
0
    goto error;
114
22.2k
115
#ifdef HAS_TYPE
116
  pw = FN(PW,alloc_size)(FN(EL,get_space)(el), type, 1);
117
#else
118
22.2k
  
pw = 22.2k
FN22.2k
(PW,alloc_size)(
FN22.2k
(EL,get_space)(el), 1);
119
22.2k
#endif
120
22.2k
121
22.2k
  return FN(PW,add_piece)(pw, set, el);
122
0
error:
123
0
  isl_set_free(set);
124
0
  FN(EL,free)(el);
125
0
  return NULL;
126
22.2k
}
127
128
__isl_give PW *FN(PW,dup)(__isl_keep PW *pw)
129
49.0k
{
130
49.0k
  int i;
131
49.0k
  PW *dup;
132
49.0k
133
49.0k
  if (!pw)
134
0
    return NULL;
135
49.0k
136
#ifdef HAS_TYPE
137
0
  
dup = 0
FN0
(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, pw->n);
138
#else
139
49.0k
  
dup = 49.0k
FN49.0k
(PW,alloc_size)(isl_space_copy(pw->dim), pw->n);
140
#endif
141
49.0k
  if (!dup)
142
0
    return NULL;
143
49.0k
144
99.4k
  
for (i = 0; 49.0k
i < pw->n99.4k
;
++i50.4k
)
145
50.4k
    
dup = 50.4k
FN50.4k
(PW,add_piece)(dup, isl_set_copy(pw->p[i].set),
146
50.4k
              
FN50.4k
(EL,copy)(pw->p[i].
FIELD50.4k
));
147
49.0k
148
49.0k
  return dup;
149
49.0k
}
isl_pw_aff_dup
Line
Count
Source
129
47.7k
{
130
47.7k
  int i;
131
47.7k
  PW *dup;
132
47.7k
133
47.7k
  if (!pw)
134
0
    return NULL;
135
47.7k
136
#ifdef HAS_TYPE
137
  dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, pw->n);
138
#else
139
47.7k
  
dup = 47.7k
FN47.7k
(PW,alloc_size)(isl_space_copy(pw->dim), pw->n);
140
47.7k
#endif
141
47.7k
  if (!dup)
142
0
    return NULL;
143
47.7k
144
96.8k
  
for (i = 0; 47.7k
i < pw->n96.8k
;
++i49.0k
)
145
49.0k
    
dup = 49.0k
FN49.0k
(PW,add_piece)(dup, isl_set_copy(pw->p[i].set),
146
49.0k
              
FN49.0k
(EL,copy)(pw->p[i].
FIELD49.0k
));
147
47.7k
148
47.7k
  return dup;
149
47.7k
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_dup
isl_pw_multi_aff_dup
Line
Count
Source
129
1.29k
{
130
1.29k
  int i;
131
1.29k
  PW *dup;
132
1.29k
133
1.29k
  if (!pw)
134
0
    return NULL;
135
1.29k
136
#ifdef HAS_TYPE
137
  dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, pw->n);
138
#else
139
1.29k
  
dup = 1.29k
FN1.29k
(PW,alloc_size)(isl_space_copy(pw->dim), pw->n);
140
1.29k
#endif
141
1.29k
  if (!dup)
142
0
    return NULL;
143
1.29k
144
2.62k
  
for (i = 0; 1.29k
i < pw->n2.62k
;
++i1.32k
)
145
1.32k
    
dup = 1.32k
FN1.32k
(PW,add_piece)(dup, isl_set_copy(pw->p[i].set),
146
1.32k
              
FN1.32k
(EL,copy)(pw->p[i].
FIELD1.32k
));
147
1.29k
148
1.29k
  return dup;
149
1.29k
}
isl_pw_qpolynomial_dup
Line
Count
Source
129
1
{
130
1
  int i;
131
1
  PW *dup;
132
1
133
1
  if (!pw)
134
0
    return NULL;
135
1
136
#ifdef HAS_TYPE
137
  dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, pw->n);
138
#else
139
1
  
dup = 1
FN1
(PW,alloc_size)(isl_space_copy(pw->dim), pw->n);
140
1
#endif
141
1
  if (!dup)
142
0
    return NULL;
143
1
144
2
  
for (i = 0; 1
i < pw->n2
;
++i1
)
145
1
    
dup = 1
FN1
(PW,add_piece)(dup, isl_set_copy(pw->p[i].set),
146
1
              
FN1
(EL,copy)(pw->p[i].
FIELD1
));
147
1
148
1
  return dup;
149
1
}
150
151
__isl_give PW *FN(PW,cow)(__isl_take PW *pw)
152
183k
{
153
183k
  if (!pw)
154
0
    return NULL;
155
183k
156
183k
  
if (183k
pw->ref == 1183k
)
157
134k
    return pw;
158
49.0k
  pw->ref--;
159
49.0k
  return FN(PW,dup)(pw);
160
183k
}
isl_pw_qpolynomial_fold_cow
Line
Count
Source
152
7
{
153
7
  if (!pw)
154
0
    return NULL;
155
7
156
7
  
if (7
pw->ref == 17
)
157
7
    return pw;
158
0
  pw->ref--;
159
0
  return FN(PW,dup)(pw);
160
7
}
isl_pw_multi_aff_cow
Line
Count
Source
152
9.97k
{
153
9.97k
  if (!pw)
154
0
    return NULL;
155
9.97k
156
9.97k
  
if (9.97k
pw->ref == 19.97k
)
157
8.67k
    return pw;
158
1.29k
  pw->ref--;
159
1.29k
  return FN(PW,dup)(pw);
160
9.97k
}
isl_pw_qpolynomial_cow
Line
Count
Source
152
51
{
153
51
  if (!pw)
154
0
    return NULL;
155
51
156
51
  
if (51
pw->ref == 151
)
157
50
    return pw;
158
1
  pw->ref--;
159
1
  return FN(PW,dup)(pw);
160
51
}
isl_pw_aff_cow
Line
Count
Source
152
173k
{
153
173k
  if (!pw)
154
0
    return NULL;
155
173k
156
173k
  
if (173k
pw->ref == 1173k
)
157
125k
    return pw;
158
47.7k
  pw->ref--;
159
47.7k
  return FN(PW,dup)(pw);
160
173k
}
161
162
__isl_give PW *FN(PW,copy)(__isl_keep PW *pw)
163
239k
{
164
239k
  if (!pw)
165
33.4k
    return NULL;
166
239k
167
205k
  pw->ref++;
168
205k
  return pw;
169
239k
}
isl_pw_qpolynomial_fold_copy
Line
Count
Source
163
2
{
164
2
  if (!pw)
165
0
    return NULL;
166
2
167
2
  pw->ref++;
168
2
  return pw;
169
2
}
isl_pw_qpolynomial_copy
Line
Count
Source
163
10
{
164
10
  if (!pw)
165
0
    return NULL;
166
10
167
10
  pw->ref++;
168
10
  return pw;
169
10
}
isl_pw_aff_copy
Line
Count
Source
163
202k
{
164
202k
  if (!pw)
165
33.4k
    return NULL;
166
202k
167
168k
  pw->ref++;
168
168k
  return pw;
169
202k
}
isl_pw_multi_aff_copy
Line
Count
Source
163
37.0k
{
164
37.0k
  if (!pw)
165
0
    return NULL;
166
37.0k
167
37.0k
  pw->ref++;
168
37.0k
  return pw;
169
37.0k
}
170
171
__isl_null PW *FN(PW,free)(__isl_take PW *pw)
172
447k
{
173
447k
  int i;
174
447k
175
447k
  if (!pw)
176
46.1k
    return NULL;
177
401k
  
if (401k
--pw->ref > 0401k
)
178
156k
    return NULL;
179
401k
180
486k
  
for (i = 0; 244k
i < pw->n486k
;
++i242k
) {
181
242k
    isl_set_free(pw->p[i].set);
182
242k
    
FN242k
(EL,free)(pw->p[i].
FIELD242k
);
183
242k
  }
184
244k
  isl_space_free(pw->dim);
185
244k
  free(pw);
186
244k
187
244k
  return NULL;
188
447k
}
isl_pw_qpolynomial_fold_free
Line
Count
Source
172
37
{
173
37
  int i;
174
37
175
37
  if (!pw)
176
0
    return NULL;
177
37
  
if (37
--pw->ref > 037
)
178
2
    return NULL;
179
37
180
53
  
for (i = 0; 35
i < pw->n53
;
++i18
) {
181
18
    isl_set_free(pw->p[i].set);
182
18
    
FN18
(EL,free)(pw->p[i].
FIELD18
);
183
18
  }
184
35
  isl_space_free(pw->dim);
185
35
  free(pw);
186
35
187
35
  return NULL;
188
37
}
isl_pw_qpolynomial_free
Line
Count
Source
172
113
{
173
113
  int i;
174
113
175
113
  if (!pw)
176
0
    return NULL;
177
113
  
if (113
--pw->ref > 0113
)
178
9
    return NULL;
179
113
180
202
  
for (i = 0; 104
i < pw->n202
;
++i98
) {
181
98
    isl_set_free(pw->p[i].set);
182
98
    
FN98
(EL,free)(pw->p[i].
FIELD98
);
183
98
  }
184
104
  isl_space_free(pw->dim);
185
104
  free(pw);
186
104
187
104
  return NULL;
188
113
}
isl_pw_aff_free
Line
Count
Source
172
381k
{
173
381k
  int i;
174
381k
175
381k
  if (!pw)
176
46.1k
    return NULL;
177
335k
  
if (335k
--pw->ref > 0335k
)
178
121k
    return NULL;
179
335k
180
429k
  
for (i = 0; 214k
i < pw->n429k
;
++i214k
) {
181
214k
    isl_set_free(pw->p[i].set);
182
214k
    
FN214k
(EL,free)(pw->p[i].
FIELD214k
);
183
214k
  }
184
214k
  isl_space_free(pw->dim);
185
214k
  free(pw);
186
214k
187
214k
  return NULL;
188
381k
}
isl_pw_multi_aff_free
Line
Count
Source
172
65.4k
{
173
65.4k
  int i;
174
65.4k
175
65.4k
  if (!pw)
176
0
    return NULL;
177
65.4k
  
if (65.4k
--pw->ref > 065.4k
)
178
35.7k
    return NULL;
179
65.4k
180
57.4k
  
for (i = 0; 29.6k
i < pw->n57.4k
;
++i27.7k
) {
181
27.7k
    isl_set_free(pw->p[i].set);
182
27.7k
    
FN27.7k
(EL,free)(pw->p[i].
FIELD27.7k
);
183
27.7k
  }
184
29.6k
  isl_space_free(pw->dim);
185
29.6k
  free(pw);
186
29.6k
187
29.6k
  return NULL;
188
65.4k
}
189
190
const char *FN(PW,get_dim_name)(__isl_keep PW *pw, enum isl_dim_type type,
191
  unsigned pos)
192
0
{
193
0
  return pw ? isl_space_get_dim_name(pw->dim, type, pos) : NULL;
194
0
}
Unexecuted instantiation: isl_pw_qpolynomial_get_dim_name
Unexecuted instantiation: isl_pw_multi_aff_get_dim_name
Unexecuted instantiation: isl_pw_qpolynomial_fold_get_dim_name
Unexecuted instantiation: isl_pw_aff_get_dim_name
195
196
isl_bool FN(PW,has_dim_id)(__isl_keep PW *pw, enum isl_dim_type type,
197
  unsigned pos)
198
0
{
199
0
  return pw ? 
isl_space_has_dim_id(pw->dim, type, pos)0
:
isl_bool_error0
;
200
0
}
Unexecuted instantiation: isl_pw_aff_has_dim_id
Unexecuted instantiation: isl_pw_qpolynomial_has_dim_id
Unexecuted instantiation: isl_pw_qpolynomial_fold_has_dim_id
Unexecuted instantiation: isl_pw_multi_aff_has_dim_id
201
202
__isl_give isl_id *FN(PW,get_dim_id)(__isl_keep PW *pw, enum isl_dim_type type,
203
  unsigned pos)
204
16
{
205
16
  return pw ? isl_space_get_dim_id(pw->dim, type, pos) : NULL;
206
16
}
Unexecuted instantiation: isl_pw_multi_aff_get_dim_id
Unexecuted instantiation: isl_pw_qpolynomial_get_dim_id
isl_pw_aff_get_dim_id
Line
Count
Source
204
16
{
205
16
  return pw ? isl_space_get_dim_id(pw->dim, type, pos) : NULL;
206
16
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_get_dim_id
207
208
isl_bool FN(PW,has_tuple_name)(__isl_keep PW *pw, enum isl_dim_type type)
209
0
{
210
0
  return pw ? 
isl_space_has_tuple_name(pw->dim, type)0
:
isl_bool_error0
;
211
0
}
Unexecuted instantiation: isl_pw_multi_aff_has_tuple_name
Unexecuted instantiation: isl_pw_qpolynomial_has_tuple_name
Unexecuted instantiation: isl_pw_qpolynomial_fold_has_tuple_name
Unexecuted instantiation: isl_pw_aff_has_tuple_name
212
213
const char *FN(PW,get_tuple_name)(__isl_keep PW *pw, enum isl_dim_type type)
214
0
{
215
0
  return pw ? isl_space_get_tuple_name(pw->dim, type) : NULL;
216
0
}
Unexecuted instantiation: isl_pw_multi_aff_get_tuple_name
Unexecuted instantiation: isl_pw_qpolynomial_fold_get_tuple_name
Unexecuted instantiation: isl_pw_aff_get_tuple_name
Unexecuted instantiation: isl_pw_qpolynomial_get_tuple_name
217
218
isl_bool FN(PW,has_tuple_id)(__isl_keep PW *pw, enum isl_dim_type type)
219
0
{
220
0
  return pw ? 
isl_space_has_tuple_id(pw->dim, type)0
:
isl_bool_error0
;
221
0
}
Unexecuted instantiation: isl_pw_qpolynomial_has_tuple_id
Unexecuted instantiation: isl_pw_aff_has_tuple_id
Unexecuted instantiation: isl_pw_qpolynomial_fold_has_tuple_id
Unexecuted instantiation: isl_pw_multi_aff_has_tuple_id
222
223
__isl_give isl_id *FN(PW,get_tuple_id)(__isl_keep PW *pw, enum isl_dim_type type)
224
342
{
225
342
  return pw ? isl_space_get_tuple_id(pw->dim, type) : NULL;
226
342
}
Unexecuted instantiation: isl_pw_qpolynomial_get_tuple_id
Unexecuted instantiation: isl_pw_aff_get_tuple_id
Unexecuted instantiation: isl_pw_qpolynomial_fold_get_tuple_id
isl_pw_multi_aff_get_tuple_id
Line
Count
Source
224
342
{
225
342
  return pw ? isl_space_get_tuple_id(pw->dim, type) : NULL;
226
342
}
227
228
isl_bool FN(PW,IS_ZERO)(__isl_keep PW *pw)
229
58.5k
{
230
58.5k
  if (!pw)
231
0
    return isl_bool_error;
232
58.5k
233
58.5k
  return pw->n == 0;
234
58.5k
}
isl_pw_multi_aff_is_empty
Line
Count
Source
229
22.0k
{
230
22.0k
  if (!pw)
231
0
    return isl_bool_error;
232
22.0k
233
22.0k
  return pw->n == 0;
234
22.0k
}
isl_pw_aff_is_empty
Line
Count
Source
229
36.3k
{
230
36.3k
  if (!pw)
231
0
    return isl_bool_error;
232
36.3k
233
36.3k
  return pw->n == 0;
234
36.3k
}
isl_pw_qpolynomial_is_zero
Line
Count
Source
229
102
{
230
102
  if (!pw)
231
0
    return isl_bool_error;
232
102
233
102
  return pw->n == 0;
234
102
}
isl_pw_qpolynomial_fold_is_zero
Line
Count
Source
229
26
{
230
26
  if (!pw)
231
0
    return isl_bool_error;
232
26
233
26
  return pw->n == 0;
234
26
}
235
236
#ifndef NO_REALIGN
237
__isl_give PW *FN(PW,realign_domain)(__isl_take PW *pw,
238
  __isl_take isl_reordering *exp)
239
9.07k
{
240
9.07k
  int i;
241
9.07k
242
9.07k
  pw = FN(PW,cow)(pw);
243
9.07k
  if (
!pw || 9.07k
!exp9.07k
)
244
0
    goto error;
245
9.07k
246
18.5k
  
for (i = 0; 9.07k
i < pw->n18.5k
;
++i9.52k
) {
247
9.52k
    pw->p[i].set = isl_set_realign(pw->p[i].set,
248
9.52k
                isl_reordering_copy(exp));
249
9.52k
    if (!pw->p[i].set)
250
0
      goto error;
251
9.52k
    
pw->p[i].9.52k
FIELD9.52k
=
FN9.52k
(EL,realign_domain)(pw->p[i].
FIELD9.52k
,
252
9.52k
                isl_reordering_copy(exp));
253
9.52k
    if (
!pw->p[i].9.52k
FIELD9.52k
)
254
0
      goto error;
255
9.52k
  }
256
9.07k
257
9.07k
  
pw = 9.07k
FN9.07k
(PW,reset_domain_space)(pw, isl_space_copy(exp->dim));
258
9.07k
259
9.07k
  isl_reordering_free(exp);
260
9.07k
  return pw;
261
0
error:
262
0
  isl_reordering_free(exp);
263
0
  FN(PW,free)(pw);
264
0
  return NULL;
265
9.07k
}
isl_pw_aff_realign_domain
Line
Count
Source
239
9.07k
{
240
9.07k
  int i;
241
9.07k
242
9.07k
  pw = FN(PW,cow)(pw);
243
9.07k
  if (
!pw || 9.07k
!exp9.07k
)
244
0
    goto error;
245
9.07k
246
18.5k
  
for (i = 0; 9.07k
i < pw->n18.5k
;
++i9.52k
) {
247
9.52k
    pw->p[i].set = isl_set_realign(pw->p[i].set,
248
9.52k
                isl_reordering_copy(exp));
249
9.52k
    if (!pw->p[i].set)
250
0
      goto error;
251
9.52k
    
pw->p[i].9.52k
FIELD9.52k
=
FN9.52k
(EL,realign_domain)(pw->p[i].
FIELD9.52k
,
252
9.52k
                isl_reordering_copy(exp));
253
9.52k
    if (
!pw->p[i].9.52k
FIELD9.52k
)
254
0
      goto error;
255
9.52k
  }
256
9.07k
257
9.07k
  
pw = 9.07k
FN9.07k
(PW,reset_domain_space)(pw, isl_space_copy(exp->dim));
258
9.07k
259
9.07k
  isl_reordering_free(exp);
260
9.07k
  return pw;
261
0
error:
262
0
  isl_reordering_free(exp);
263
0
  FN(PW,free)(pw);
264
0
  return NULL;
265
9.07k
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_realign_domain
Unexecuted instantiation: isl_pw_multi_aff_realign_domain
Unexecuted instantiation: isl_pw_qpolynomial_realign_domain
266
267
/* Align the parameters of "pw" to those of "model".
268
 */
269
__isl_give PW *FN(PW,align_params)(__isl_take PW *pw, __isl_take isl_space *model)
270
34.8k
{
271
34.8k
  isl_ctx *ctx;
272
34.8k
  isl_bool equal_params;
273
34.8k
274
34.8k
  if (
!pw || 34.8k
!model34.8k
)
275
0
    goto error;
276
34.8k
277
34.8k
  ctx = isl_space_get_ctx(model);
278
34.8k
  if (!isl_space_has_named_params(model))
279
0
    isl_die(ctx, isl_error_invalid,
280
34.8k
      "model has unnamed parameters", goto error);
281
34.8k
  
if (34.8k
!isl_space_has_named_params(pw->dim)34.8k
)
282
0
    isl_die(ctx, isl_error_invalid,
283
34.8k
      "input has unnamed parameters", goto error);
284
34.8k
  equal_params = isl_space_has_equal_params(pw->dim, model);
285
34.8k
  if (equal_params < 0)
286
0
    goto error;
287
34.8k
  
if (34.8k
!equal_params34.8k
) {
288
8.88k
    isl_reordering *exp;
289
8.88k
290
8.88k
    model = isl_space_drop_dims(model, isl_dim_in,
291
8.88k
          0, isl_space_dim(model, isl_dim_in));
292
8.88k
    model = isl_space_drop_dims(model, isl_dim_out,
293
8.88k
          0, isl_space_dim(model, isl_dim_out));
294
8.88k
    exp = isl_parameter_alignment_reordering(pw->dim, model);
295
8.88k
    exp = isl_reordering_extend_space(exp,
296
8.88k
          FN(PW,get_domain_space)(pw));
297
8.88k
    pw = FN(PW,realign_domain)(pw, exp);
298
8.88k
  }
299
34.8k
300
34.8k
  isl_space_free(model);
301
34.8k
  return pw;
302
0
error:
303
0
  isl_space_free(model);
304
0
  FN(PW,free)(pw);
305
0
  return NULL;
306
34.8k
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_align_params
isl_pw_qpolynomial_align_params
Line
Count
Source
270
5
{
271
5
  isl_ctx *ctx;
272
5
  isl_bool equal_params;
273
5
274
5
  if (
!pw || 5
!model5
)
275
0
    goto error;
276
5
277
5
  ctx = isl_space_get_ctx(model);
278
5
  if (!isl_space_has_named_params(model))
279
0
    isl_die(ctx, isl_error_invalid,
280
5
      "model has unnamed parameters", goto error);
281
5
  
if (5
!isl_space_has_named_params(pw->dim)5
)
282
0
    isl_die(ctx, isl_error_invalid,
283
5
      "input has unnamed parameters", goto error);
284
5
  equal_params = isl_space_has_equal_params(pw->dim, model);
285
5
  if (equal_params < 0)
286
0
    goto error;
287
5
  
if (5
!equal_params5
) {
288
0
    isl_reordering *exp;
289
0
290
0
    model = isl_space_drop_dims(model, isl_dim_in,
291
0
          0, isl_space_dim(model, isl_dim_in));
292
0
    model = isl_space_drop_dims(model, isl_dim_out,
293
0
          0, isl_space_dim(model, isl_dim_out));
294
0
    exp = isl_parameter_alignment_reordering(pw->dim, model);
295
0
    exp = isl_reordering_extend_space(exp,
296
0
          FN(PW,get_domain_space)(pw));
297
0
    pw = FN(PW,realign_domain)(pw, exp);
298
0
  }
299
5
300
5
  isl_space_free(model);
301
5
  return pw;
302
0
error:
303
0
  isl_space_free(model);
304
0
  FN(PW,free)(pw);
305
0
  return NULL;
306
5
}
isl_pw_aff_align_params
Line
Count
Source
270
17.2k
{
271
17.2k
  isl_ctx *ctx;
272
17.2k
  isl_bool equal_params;
273
17.2k
274
17.2k
  if (
!pw || 17.2k
!model17.2k
)
275
0
    goto error;
276
17.2k
277
17.2k
  ctx = isl_space_get_ctx(model);
278
17.2k
  if (!isl_space_has_named_params(model))
279
0
    isl_die(ctx, isl_error_invalid,
280
17.2k
      "model has unnamed parameters", goto error);
281
17.2k
  
if (17.2k
!isl_space_has_named_params(pw->dim)17.2k
)
282
0
    isl_die(ctx, isl_error_invalid,
283
17.2k
      "input has unnamed parameters", goto error);
284
17.2k
  equal_params = isl_space_has_equal_params(pw->dim, model);
285
17.2k
  if (equal_params < 0)
286
0
    goto error;
287
17.2k
  
if (17.2k
!equal_params17.2k
) {
288
8.88k
    isl_reordering *exp;
289
8.88k
290
8.88k
    model = isl_space_drop_dims(model, isl_dim_in,
291
8.88k
          0, isl_space_dim(model, isl_dim_in));
292
8.88k
    model = isl_space_drop_dims(model, isl_dim_out,
293
8.88k
          0, isl_space_dim(model, isl_dim_out));
294
8.88k
    exp = isl_parameter_alignment_reordering(pw->dim, model);
295
8.88k
    exp = isl_reordering_extend_space(exp,
296
8.88k
          FN(PW,get_domain_space)(pw));
297
8.88k
    pw = FN(PW,realign_domain)(pw, exp);
298
8.88k
  }
299
17.2k
300
17.2k
  isl_space_free(model);
301
17.2k
  return pw;
302
0
error:
303
0
  isl_space_free(model);
304
0
  FN(PW,free)(pw);
305
0
  return NULL;
306
17.2k
}
isl_pw_multi_aff_align_params
Line
Count
Source
270
17.5k
{
271
17.5k
  isl_ctx *ctx;
272
17.5k
  isl_bool equal_params;
273
17.5k
274
17.5k
  if (
!pw || 17.5k
!model17.5k
)
275
0
    goto error;
276
17.5k
277
17.5k
  ctx = isl_space_get_ctx(model);
278
17.5k
  if (!isl_space_has_named_params(model))
279
0
    isl_die(ctx, isl_error_invalid,
280
17.5k
      "model has unnamed parameters", goto error);
281
17.5k
  
if (17.5k
!isl_space_has_named_params(pw->dim)17.5k
)
282
0
    isl_die(ctx, isl_error_invalid,
283
17.5k
      "input has unnamed parameters", goto error);
284
17.5k
  equal_params = isl_space_has_equal_params(pw->dim, model);
285
17.5k
  if (equal_params < 0)
286
0
    goto error;
287
17.5k
  
if (17.5k
!equal_params17.5k
) {
288
0
    isl_reordering *exp;
289
0
290
0
    model = isl_space_drop_dims(model, isl_dim_in,
291
0
          0, isl_space_dim(model, isl_dim_in));
292
0
    model = isl_space_drop_dims(model, isl_dim_out,
293
0
          0, isl_space_dim(model, isl_dim_out));
294
0
    exp = isl_parameter_alignment_reordering(pw->dim, model);
295
0
    exp = isl_reordering_extend_space(exp,
296
0
          FN(PW,get_domain_space)(pw));
297
0
    pw = FN(PW,realign_domain)(pw, exp);
298
0
  }
299
17.5k
300
17.5k
  isl_space_free(model);
301
17.5k
  return pw;
302
0
error:
303
0
  isl_space_free(model);
304
0
  FN(PW,free)(pw);
305
0
  return NULL;
306
17.5k
}
307
308
static __isl_give PW *FN(PW,align_params_pw_pw_and)(__isl_take PW *pw1,
309
  __isl_take PW *pw2,
310
  __isl_give PW *(*fn)(__isl_take PW *pw1, __isl_take PW *pw2))
311
83.6k
{
312
83.6k
  isl_ctx *ctx;
313
83.6k
  isl_bool equal_params;
314
83.6k
315
83.6k
  if (
!pw1 || 83.6k
!pw283.6k
)
316
1
    goto error;
317
83.6k
  equal_params = isl_space_has_equal_params(pw1->dim, pw2->dim);
318
83.6k
  if (equal_params < 0)
319
0
    goto error;
320
83.6k
  
if (83.6k
equal_params83.6k
)
321
80.2k
    return fn(pw1, pw2);
322
3.39k
  
ctx = 3.39k
FN3.39k
(PW,get_ctx)(pw1);
323
3.39k
  if (!isl_space_has_named_params(pw1->dim) ||
324
3.39k
      !isl_space_has_named_params(pw2->dim))
325
0
    isl_die(ctx, isl_error_invalid,
326
3.39k
      "unaligned unnamed parameters", goto error);
327
3.39k
  
pw1 = 3.39k
FN3.39k
(PW,align_params)(pw1,
FN3.39k
(PW,get_space)(pw2));
328
3.39k
  pw2 = 
FN3.39k
(PW,align_params)(pw2,
FN3.39k
(PW,get_space)(pw1));
329
3.39k
  return fn(pw1, pw2);
330
1
error:
331
1
  FN(PW,free)(pw1);
332
1
  FN(PW,free)(pw2);
333
1
  return NULL;
334
83.6k
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_align_params_pw_pw_and
isl_aff.c:isl_pw_multi_aff_align_params_pw_pw_and
Line
Count
Source
311
5.29k
{
312
5.29k
  isl_ctx *ctx;
313
5.29k
  isl_bool equal_params;
314
5.29k
315
5.29k
  if (
!pw1 || 5.29k
!pw25.29k
)
316
0
    goto error;
317
5.29k
  equal_params = isl_space_has_equal_params(pw1->dim, pw2->dim);
318
5.29k
  if (equal_params < 0)
319
0
    goto error;
320
5.29k
  
if (5.29k
equal_params5.29k
)
321
5.29k
    return fn(pw1, pw2);
322
0
  
ctx = 0
FN0
(PW,get_ctx)(pw1);
323
0
  if (!isl_space_has_named_params(pw1->dim) ||
324
0
      !isl_space_has_named_params(pw2->dim))
325
0
    isl_die(ctx, isl_error_invalid,
326
0
      "unaligned unnamed parameters", goto error);
327
0
  
pw1 = 0
FN0
(PW,align_params)(pw1,
FN0
(PW,get_space)(pw2));
328
0
  pw2 = 
FN0
(PW,align_params)(pw2,
FN0
(PW,get_space)(pw1));
329
0
  return fn(pw1, pw2);
330
0
error:
331
0
  FN(PW,free)(pw1);
332
0
  FN(PW,free)(pw2);
333
0
  return NULL;
334
5.29k
}
isl_polynomial.c:isl_pw_qpolynomial_align_params_pw_pw_and
Line
Count
Source
311
26
{
312
26
  isl_ctx *ctx;
313
26
  isl_bool equal_params;
314
26
315
26
  if (
!pw1 || 26
!pw226
)
316
0
    goto error;
317
26
  equal_params = isl_space_has_equal_params(pw1->dim, pw2->dim);
318
26
  if (equal_params < 0)
319
0
    goto error;
320
26
  
if (26
equal_params26
)
321
26
    return fn(pw1, pw2);
322
0
  
ctx = 0
FN0
(PW,get_ctx)(pw1);
323
0
  if (!isl_space_has_named_params(pw1->dim) ||
324
0
      !isl_space_has_named_params(pw2->dim))
325
0
    isl_die(ctx, isl_error_invalid,
326
0
      "unaligned unnamed parameters", goto error);
327
0
  
pw1 = 0
FN0
(PW,align_params)(pw1,
FN0
(PW,get_space)(pw2));
328
0
  pw2 = 
FN0
(PW,align_params)(pw2,
FN0
(PW,get_space)(pw1));
329
0
  return fn(pw1, pw2);
330
0
error:
331
0
  FN(PW,free)(pw1);
332
0
  FN(PW,free)(pw2);
333
0
  return NULL;
334
26
}
isl_aff.c:isl_pw_aff_align_params_pw_pw_and
Line
Count
Source
311
78.2k
{
312
78.2k
  isl_ctx *ctx;
313
78.2k
  isl_bool equal_params;
314
78.2k
315
78.2k
  if (
!pw1 || 78.2k
!pw278.2k
)
316
1
    goto error;
317
78.2k
  equal_params = isl_space_has_equal_params(pw1->dim, pw2->dim);
318
78.2k
  if (equal_params < 0)
319
0
    goto error;
320
78.2k
  
if (78.2k
equal_params78.2k
)
321
74.8k
    return fn(pw1, pw2);
322
3.39k
  
ctx = 3.39k
FN3.39k
(PW,get_ctx)(pw1);
323
3.39k
  if (!isl_space_has_named_params(pw1->dim) ||
324
3.39k
      !isl_space_has_named_params(pw2->dim))
325
0
    isl_die(ctx, isl_error_invalid,
326
3.39k
      "unaligned unnamed parameters", goto error);
327
3.39k
  
pw1 = 3.39k
FN3.39k
(PW,align_params)(pw1,
FN3.39k
(PW,get_space)(pw2));
328
3.39k
  pw2 = 
FN3.39k
(PW,align_params)(pw2,
FN3.39k
(PW,get_space)(pw1));
329
3.39k
  return fn(pw1, pw2);
330
1
error:
331
1
  FN(PW,free)(pw1);
332
1
  FN(PW,free)(pw2);
333
1
  return NULL;
334
78.2k
}
335
336
static __isl_give PW *FN(PW,align_params_pw_set_and)(__isl_take PW *pw,
337
  __isl_take isl_set *set,
338
  __isl_give PW *(*fn)(__isl_take PW *pw, __isl_take isl_set *set))
339
50.0k
{
340
50.0k
  isl_ctx *ctx;
341
50.0k
  isl_bool aligned;
342
50.0k
343
50.0k
  if (
!pw || 50.0k
!set50.0k
)
344
0
    goto error;
345
50.0k
  aligned = isl_set_space_has_equal_params(set, pw->dim);
346
50.0k
  if (aligned < 0)
347
0
    goto error;
348
50.0k
  
if (50.0k
aligned50.0k
)
349
50.0k
    return fn(pw, set);
350
2
  
ctx = 2
FN2
(PW,get_ctx)(pw);
351
2
  if (!isl_space_has_named_params(pw->dim) ||
352
2
      !isl_space_has_named_params(set->dim))
353
0
    isl_die(ctx, isl_error_invalid,
354
2
      "unaligned unnamed parameters", goto error);
355
2
  
pw = 2
FN2
(PW,align_params)(pw, isl_set_get_space(set));
356
2
  set = isl_set_align_params(set, FN(PW,get_space)(pw));
357
2
  return fn(pw, set);
358
0
error:
359
0
  FN(PW,free)(pw);
360
0
  isl_set_free(set);
361
0
  return NULL;
362
50.0k
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_align_params_pw_set_and
isl_aff.c:isl_pw_multi_aff_align_params_pw_set_and
Line
Count
Source
339
4.96k
{
340
4.96k
  isl_ctx *ctx;
341
4.96k
  isl_bool aligned;
342
4.96k
343
4.96k
  if (
!pw || 4.96k
!set4.96k
)
344
0
    goto error;
345
4.96k
  aligned = isl_set_space_has_equal_params(set, pw->dim);
346
4.96k
  if (aligned < 0)
347
0
    goto error;
348
4.96k
  
if (4.96k
aligned4.96k
)
349
4.96k
    return fn(pw, set);
350
0
  
ctx = 0
FN0
(PW,get_ctx)(pw);
351
0
  if (!isl_space_has_named_params(pw->dim) ||
352
0
      !isl_space_has_named_params(set->dim))
353
0
    isl_die(ctx, isl_error_invalid,
354
0
      "unaligned unnamed parameters", goto error);
355
0
  
pw = 0
FN0
(PW,align_params)(pw, isl_set_get_space(set));
356
0
  set = isl_set_align_params(set, FN(PW,get_space)(pw));
357
0
  return fn(pw, set);
358
0
error:
359
0
  FN(PW,free)(pw);
360
0
  isl_set_free(set);
361
0
  return NULL;
362
4.96k
}
isl_aff.c:isl_pw_aff_align_params_pw_set_and
Line
Count
Source
339
45.0k
{
340
45.0k
  isl_ctx *ctx;
341
45.0k
  isl_bool aligned;
342
45.0k
343
45.0k
  if (
!pw || 45.0k
!set45.0k
)
344
0
    goto error;
345
45.0k
  aligned = isl_set_space_has_equal_params(set, pw->dim);
346
45.0k
  if (aligned < 0)
347
0
    goto error;
348
45.0k
  
if (45.0k
aligned45.0k
)
349
45.0k
    return fn(pw, set);
350
2
  
ctx = 2
FN2
(PW,get_ctx)(pw);
351
2
  if (!isl_space_has_named_params(pw->dim) ||
352
2
      !isl_space_has_named_params(set->dim))
353
0
    isl_die(ctx, isl_error_invalid,
354
2
      "unaligned unnamed parameters", goto error);
355
2
  
pw = 2
FN2
(PW,align_params)(pw, isl_set_get_space(set));
356
2
  set = isl_set_align_params(set, FN(PW,get_space)(pw));
357
2
  return fn(pw, set);
358
0
error:
359
0
  FN(PW,free)(pw);
360
0
  isl_set_free(set);
361
0
  return NULL;
362
45.0k
}
isl_polynomial.c:isl_pw_qpolynomial_align_params_pw_set_and
Line
Count
Source
339
39
{
340
39
  isl_ctx *ctx;
341
39
  isl_bool aligned;
342
39
343
39
  if (
!pw || 39
!set39
)
344
0
    goto error;
345
39
  aligned = isl_set_space_has_equal_params(set, pw->dim);
346
39
  if (aligned < 0)
347
0
    goto error;
348
39
  
if (39
aligned39
)
349
39
    return fn(pw, set);
350
0
  
ctx = 0
FN0
(PW,get_ctx)(pw);
351
0
  if (!isl_space_has_named_params(pw->dim) ||
352
0
      !isl_space_has_named_params(set->dim))
353
0
    isl_die(ctx, isl_error_invalid,
354
0
      "unaligned unnamed parameters", goto error);
355
0
  
pw = 0
FN0
(PW,align_params)(pw, isl_set_get_space(set));
356
0
  set = isl_set_align_params(set, FN(PW,get_space)(pw));
357
0
  return fn(pw, set);
358
0
error:
359
0
  FN(PW,free)(pw);
360
0
  isl_set_free(set);
361
0
  return NULL;
362
39
}
363
#endif
364
365
static __isl_give PW *FN(PW,union_add_aligned)(__isl_take PW *pw1,
366
  __isl_take PW *pw2)
367
3.88k
{
368
3.88k
  int i, j, n;
369
3.88k
  struct PW *res;
370
3.88k
  isl_ctx *ctx;
371
3.88k
  isl_set *set;
372
3.88k
373
3.88k
  if (
!pw1 || 3.88k
!pw23.88k
)
374
0
    goto error;
375
3.88k
376
3.88k
  ctx = isl_space_get_ctx(pw1->dim);
377
#ifdef HAS_TYPE
378
0
  if (pw1->type != pw2->type)
379
0
    isl_die(ctx, isl_error_invalid,
380
      "fold types don't match", goto error);
381
#endif
382
3.88k
  
isl_assert3.88k
(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
383
0
384
3.88k
  
if (3.88k
FN3.88k
(PW,IS_ZERO)(pw1)3.88k
) {
385
3.07k
    FN(PW,free)(pw1);
386
3.07k
    return pw2;
387
3.07k
  }
388
3.88k
389
811
  
if (811
FN811
(PW,IS_ZERO)(pw2)811
) {
390
675
    FN(PW,free)(pw2);
391
675
    return pw1;
392
675
  }
393
811
394
136
  n = (pw1->n + 1) * (pw2->n + 1);
395
#ifdef HAS_TYPE
396
0
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), pw1->type, n);
397
#else
398
136
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), n);
399
#endif
400
401
321
  for (i = 0; 
i < pw1->n321
;
++i185
) {
402
185
    set = isl_set_copy(pw1->p[i].set);
403
372
    for (j = 0; 
j < pw2->n372
;
++j187
) {
404
187
      struct isl_set *common;
405
187
      EL *sum;
406
187
      common = isl_set_intersect(isl_set_copy(pw1->p[i].set),
407
187
            isl_set_copy(pw2->p[j].set));
408
187
      if (
isl_set_plain_is_empty(common)187
) {
409
163
        isl_set_free(common);
410
163
        continue;
411
163
      }
412
24
      set = isl_set_subtract(set,
413
24
          isl_set_copy(pw2->p[j].set));
414
24
415
24
      sum = FN(EL,add_on_domain)(common,
416
24
               
FN24
(EL,copy)(pw1->p[i].
FIELD24
),
417
24
               
FN24
(EL,copy)(pw2->p[j].
FIELD24
));
418
24
419
24
      res = FN(PW,add_piece)(res, common, sum);
420
187
    }
421
185
    res = 
FN185
(PW,add_piece)(res, set,
FN185
(EL,copy)(pw1->p[i].
FIELD185
));
422
185
  }
423
136
424
273
  for (j = 0; 
j < pw2->n273
;
++j137
) {
425
137
    set = isl_set_copy(pw2->p[j].set);
426
324
    for (i = 0; 
i < pw1->n324
;
++i187
)
427
187
      set = isl_set_subtract(set,
428
187
          isl_set_copy(pw1->p[i].set));
429
137
    res = 
FN137
(PW,add_piece)(res, set,
FN137
(EL,copy)(pw2->p[j].
FIELD137
));
430
137
  }
431
136
432
136
  FN(PW,free)(pw1);
433
136
  FN(PW,free)(pw2);
434
136
435
136
  return res;
436
0
error:
437
0
  FN(PW,free)(pw1);
438
0
  FN(PW,free)(pw2);
439
0
  return NULL;
440
3.88k
}
isl_polynomial.c:isl_pw_qpolynomial_union_add_aligned
Line
Count
Source
367
24
{
368
24
  int i, j, n;
369
24
  struct PW *res;
370
24
  isl_ctx *ctx;
371
24
  isl_set *set;
372
24
373
24
  if (
!pw1 || 24
!pw224
)
374
0
    goto error;
375
24
376
24
  ctx = isl_space_get_ctx(pw1->dim);
377
#ifdef HAS_TYPE
378
  if (pw1->type != pw2->type)
379
    isl_die(ctx, isl_error_invalid,
380
      "fold types don't match", goto error);
381
#endif
382
24
  isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
383
24
384
24
  
if (24
FN24
(PW,IS_ZERO)(pw1)24
) {
385
0
    FN(PW,free)(pw1);
386
0
    return pw2;
387
0
  }
388
24
389
24
  
if (24
FN24
(PW,IS_ZERO)(pw2)24
) {
390
0
    FN(PW,free)(pw2);
391
0
    return pw1;
392
0
  }
393
24
394
24
  n = (pw1->n + 1) * (pw2->n + 1);
395
#ifdef HAS_TYPE
396
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), pw1->type, n);
397
#else
398
24
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), n);
399
24
#endif
400
24
401
49
  for (i = 0; 
i < pw1->n49
;
++i25
) {
402
25
    set = isl_set_copy(pw1->p[i].set);
403
52
    for (j = 0; 
j < pw2->n52
;
++j27
) {
404
27
      struct isl_set *common;
405
27
      EL *sum;
406
27
      common = isl_set_intersect(isl_set_copy(pw1->p[i].set),
407
27
            isl_set_copy(pw2->p[j].set));
408
27
      if (
isl_set_plain_is_empty(common)27
) {
409
5
        isl_set_free(common);
410
5
        continue;
411
5
      }
412
22
      set = isl_set_subtract(set,
413
22
          isl_set_copy(pw2->p[j].set));
414
22
415
22
      sum = FN(EL,add_on_domain)(common,
416
22
               
FN22
(EL,copy)(pw1->p[i].
FIELD22
),
417
22
               
FN22
(EL,copy)(pw2->p[j].
FIELD22
));
418
22
419
22
      res = FN(PW,add_piece)(res, common, sum);
420
27
    }
421
25
    res = 
FN25
(PW,add_piece)(res, set,
FN25
(EL,copy)(pw1->p[i].
FIELD25
));
422
25
  }
423
24
424
49
  for (j = 0; 
j < pw2->n49
;
++j25
) {
425
25
    set = isl_set_copy(pw2->p[j].set);
426
52
    for (i = 0; 
i < pw1->n52
;
++i27
)
427
27
      set = isl_set_subtract(set,
428
27
          isl_set_copy(pw1->p[i].set));
429
25
    res = 
FN25
(PW,add_piece)(res, set,
FN25
(EL,copy)(pw2->p[j].
FIELD25
));
430
25
  }
431
24
432
24
  FN(PW,free)(pw1);
433
24
  FN(PW,free)(pw2);
434
24
435
24
  return res;
436
0
error:
437
0
  FN(PW,free)(pw1);
438
0
  FN(PW,free)(pw2);
439
0
  return NULL;
440
24
}
isl_aff.c:isl_pw_aff_union_add_aligned
Line
Count
Source
367
3.05k
{
368
3.05k
  int i, j, n;
369
3.05k
  struct PW *res;
370
3.05k
  isl_ctx *ctx;
371
3.05k
  isl_set *set;
372
3.05k
373
3.05k
  if (
!pw1 || 3.05k
!pw23.05k
)
374
0
    goto error;
375
3.05k
376
3.05k
  ctx = isl_space_get_ctx(pw1->dim);
377
#ifdef HAS_TYPE
378
  if (pw1->type != pw2->type)
379
    isl_die(ctx, isl_error_invalid,
380
      "fold types don't match", goto error);
381
#endif
382
3.05k
  isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
383
3.05k
384
3.05k
  
if (3.05k
FN3.05k
(PW,IS_ZERO)(pw1)3.05k
) {
385
2.99k
    FN(PW,free)(pw1);
386
2.99k
    return pw2;
387
2.99k
  }
388
3.05k
389
56
  
if (56
FN56
(PW,IS_ZERO)(pw2)56
) {
390
0
    FN(PW,free)(pw2);
391
0
    return pw1;
392
0
  }
393
56
394
56
  n = (pw1->n + 1) * (pw2->n + 1);
395
#ifdef HAS_TYPE
396
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), pw1->type, n);
397
#else
398
56
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), n);
399
56
#endif
400
56
401
112
  for (i = 0; 
i < pw1->n112
;
++i56
) {
402
56
    set = isl_set_copy(pw1->p[i].set);
403
112
    for (j = 0; 
j < pw2->n112
;
++j56
) {
404
56
      struct isl_set *common;
405
56
      EL *sum;
406
56
      common = isl_set_intersect(isl_set_copy(pw1->p[i].set),
407
56
            isl_set_copy(pw2->p[j].set));
408
56
      if (
isl_set_plain_is_empty(common)56
) {
409
56
        isl_set_free(common);
410
56
        continue;
411
56
      }
412
0
      set = isl_set_subtract(set,
413
0
          isl_set_copy(pw2->p[j].set));
414
0
415
0
      sum = FN(EL,add_on_domain)(common,
416
0
               
FN0
(EL,copy)(pw1->p[i].
FIELD0
),
417
0
               
FN0
(EL,copy)(pw2->p[j].
FIELD0
));
418
0
419
0
      res = FN(PW,add_piece)(res, common, sum);
420
56
    }
421
56
    res = 
FN56
(PW,add_piece)(res, set,
FN56
(EL,copy)(pw1->p[i].
FIELD56
));
422
56
  }
423
56
424
112
  for (j = 0; 
j < pw2->n112
;
++j56
) {
425
56
    set = isl_set_copy(pw2->p[j].set);
426
112
    for (i = 0; 
i < pw1->n112
;
++i56
)
427
56
      set = isl_set_subtract(set,
428
56
          isl_set_copy(pw1->p[i].set));
429
56
    res = 
FN56
(PW,add_piece)(res, set,
FN56
(EL,copy)(pw2->p[j].
FIELD56
));
430
56
  }
431
56
432
56
  FN(PW,free)(pw1);
433
56
  FN(PW,free)(pw2);
434
56
435
56
  return res;
436
0
error:
437
0
  FN(PW,free)(pw1);
438
0
  FN(PW,free)(pw2);
439
0
  return NULL;
440
3.05k
}
isl_aff.c:isl_pw_multi_aff_union_add_aligned
Line
Count
Source
367
808
{
368
808
  int i, j, n;
369
808
  struct PW *res;
370
808
  isl_ctx *ctx;
371
808
  isl_set *set;
372
808
373
808
  if (
!pw1 || 808
!pw2808
)
374
0
    goto error;
375
808
376
808
  ctx = isl_space_get_ctx(pw1->dim);
377
#ifdef HAS_TYPE
378
  if (pw1->type != pw2->type)
379
    isl_die(ctx, isl_error_invalid,
380
      "fold types don't match", goto error);
381
#endif
382
808
  isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
383
808
384
808
  
if (808
FN808
(PW,IS_ZERO)(pw1)808
) {
385
77
    FN(PW,free)(pw1);
386
77
    return pw2;
387
77
  }
388
808
389
731
  
if (731
FN731
(PW,IS_ZERO)(pw2)731
) {
390
675
    FN(PW,free)(pw2);
391
675
    return pw1;
392
675
  }
393
731
394
56
  n = (pw1->n + 1) * (pw2->n + 1);
395
#ifdef HAS_TYPE
396
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), pw1->type, n);
397
#else
398
56
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), n);
399
56
#endif
400
56
401
160
  for (i = 0; 
i < pw1->n160
;
++i104
) {
402
104
    set = isl_set_copy(pw1->p[i].set);
403
208
    for (j = 0; 
j < pw2->n208
;
++j104
) {
404
104
      struct isl_set *common;
405
104
      EL *sum;
406
104
      common = isl_set_intersect(isl_set_copy(pw1->p[i].set),
407
104
            isl_set_copy(pw2->p[j].set));
408
104
      if (
isl_set_plain_is_empty(common)104
) {
409
102
        isl_set_free(common);
410
102
        continue;
411
102
      }
412
2
      set = isl_set_subtract(set,
413
2
          isl_set_copy(pw2->p[j].set));
414
2
415
2
      sum = FN(EL,add_on_domain)(common,
416
2
               
FN2
(EL,copy)(pw1->p[i].
FIELD2
),
417
2
               
FN2
(EL,copy)(pw2->p[j].
FIELD2
));
418
2
419
2
      res = FN(PW,add_piece)(res, common, sum);
420
104
    }
421
104
    res = 
FN104
(PW,add_piece)(res, set,
FN104
(EL,copy)(pw1->p[i].
FIELD104
));
422
104
  }
423
56
424
112
  for (j = 0; 
j < pw2->n112
;
++j56
) {
425
56
    set = isl_set_copy(pw2->p[j].set);
426
160
    for (i = 0; 
i < pw1->n160
;
++i104
)
427
104
      set = isl_set_subtract(set,
428
104
          isl_set_copy(pw1->p[i].set));
429
56
    res = 
FN56
(PW,add_piece)(res, set,
FN56
(EL,copy)(pw2->p[j].
FIELD56
));
430
56
  }
431
56
432
56
  FN(PW,free)(pw1);
433
56
  FN(PW,free)(pw2);
434
56
435
56
  return res;
436
0
error:
437
0
  FN(PW,free)(pw1);
438
0
  FN(PW,free)(pw2);
439
0
  return NULL;
440
808
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_union_add_aligned
441
442
/* Private version of "union_add".  For isl_pw_qpolynomial and
443
 * isl_pw_qpolynomial_fold, we prefer to simply call it "add".
444
 */
445
static __isl_give PW *FN(PW,union_add_)(__isl_take PW *pw1, __isl_take PW *pw2)
446
3.88k
{
447
3.88k
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
448
3.88k
            &FN(PW,union_add_aligned));
449
3.88k
}
isl_aff.c:isl_pw_aff_union_add_
Line
Count
Source
446
3.05k
{
447
3.05k
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
448
3.05k
            &FN(PW,union_add_aligned));
449
3.05k
}
isl_aff.c:isl_pw_multi_aff_union_add_
Line
Count
Source
446
808
{
447
808
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
448
808
            &FN(PW,union_add_aligned));
449
808
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_union_add_
isl_polynomial.c:isl_pw_qpolynomial_union_add_
Line
Count
Source
446
24
{
447
24
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
448
24
            &FN(PW,union_add_aligned));
449
24
}
450
451
/* Make sure "pw" has room for at least "n" more pieces.
452
 *
453
 * If there is only one reference to pw, we extend it in place.
454
 * Otherwise, we create a new PW and copy the pieces.
455
 */
456
static __isl_give PW *FN(PW,grow)(__isl_take PW *pw, int n)
457
373
{
458
373
  int i;
459
373
  isl_ctx *ctx;
460
373
  PW *res;
461
373
462
373
  if (!pw)
463
0
    return NULL;
464
373
  
if (373
pw->n + n <= pw->size373
)
465
0
    return pw;
466
373
  
ctx = 373
FN373
(PW,get_ctx)(pw);
467
373
  n += pw->n;
468
373
  if (
pw->ref == 1373
) {
469
373
    res = isl_realloc(ctx, pw, struct PW,
470
373
          sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
471
373
    if (!res)
472
0
      
return 0
FN0
(PW,free)(pw);
473
373
    res->size = n;
474
373
    return res;
475
373
  }
476
#ifdef HAS_TYPE
477
0
  
res = 0
FN0
(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, n);
478
#else
479
0
  
res = 0
FN0
(PW,alloc_size)(isl_space_copy(pw->dim), n);
480
#endif
481
0
  if (!res)
482
0
    
return 0
FN0
(PW,free)(pw);
483
0
  
for (i = 0; 0
i < pw->n0
;
++i0
)
484
0
    
res = 0
FN0
(PW,add_piece)(res, isl_set_copy(pw->p[i].set),
485
0
              
FN0
(EL,copy)(pw->p[i].
FIELD0
));
486
0
  FN(PW,free)(pw);
487
0
  return res;
488
373
}
isl_polynomial.c:isl_pw_qpolynomial_grow
Line
Count
Source
457
1
{
458
1
  int i;
459
1
  isl_ctx *ctx;
460
1
  PW *res;
461
1
462
1
  if (!pw)
463
0
    return NULL;
464
1
  
if (1
pw->n + n <= pw->size1
)
465
0
    return pw;
466
1
  
ctx = 1
FN1
(PW,get_ctx)(pw);
467
1
  n += pw->n;
468
1
  if (
pw->ref == 11
) {
469
1
    res = isl_realloc(ctx, pw, struct PW,
470
1
          sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
471
1
    if (!res)
472
0
      
return 0
FN0
(PW,free)(pw);
473
1
    res->size = n;
474
1
    return res;
475
1
  }
476
#ifdef HAS_TYPE
477
  res = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, n);
478
#else
479
1
  
res = 0
FN0
(PW,alloc_size)(isl_space_copy(pw->dim), n);
480
0
#endif
481
0
  if (!res)
482
0
    
return 0
FN0
(PW,free)(pw);
483
0
  
for (i = 0; 0
i < pw->n0
;
++i0
)
484
0
    
res = 0
FN0
(PW,add_piece)(res, isl_set_copy(pw->p[i].set),
485
0
              
FN0
(EL,copy)(pw->p[i].
FIELD0
));
486
0
  FN(PW,free)(pw);
487
0
  return res;
488
1
}
isl_aff.c:isl_pw_multi_aff_grow
Line
Count
Source
457
85
{
458
85
  int i;
459
85
  isl_ctx *ctx;
460
85
  PW *res;
461
85
462
85
  if (!pw)
463
0
    return NULL;
464
85
  
if (85
pw->n + n <= pw->size85
)
465
0
    return pw;
466
85
  
ctx = 85
FN85
(PW,get_ctx)(pw);
467
85
  n += pw->n;
468
85
  if (
pw->ref == 185
) {
469
85
    res = isl_realloc(ctx, pw, struct PW,
470
85
          sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
471
85
    if (!res)
472
0
      
return 0
FN0
(PW,free)(pw);
473
85
    res->size = n;
474
85
    return res;
475
85
  }
476
#ifdef HAS_TYPE
477
  res = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, n);
478
#else
479
85
  
res = 0
FN0
(PW,alloc_size)(isl_space_copy(pw->dim), n);
480
0
#endif
481
0
  if (!res)
482
0
    
return 0
FN0
(PW,free)(pw);
483
0
  
for (i = 0; 0
i < pw->n0
;
++i0
)
484
0
    
res = 0
FN0
(PW,add_piece)(res, isl_set_copy(pw->p[i].set),
485
0
              
FN0
(EL,copy)(pw->p[i].
FIELD0
));
486
0
  FN(PW,free)(pw);
487
0
  return res;
488
85
}
isl_aff.c:isl_pw_aff_grow
Line
Count
Source
457
287
{
458
287
  int i;
459
287
  isl_ctx *ctx;
460
287
  PW *res;
461
287
462
287
  if (!pw)
463
0
    return NULL;
464
287
  
if (287
pw->n + n <= pw->size287
)
465
0
    return pw;
466
287
  
ctx = 287
FN287
(PW,get_ctx)(pw);
467
287
  n += pw->n;
468
287
  if (
pw->ref == 1287
) {
469
287
    res = isl_realloc(ctx, pw, struct PW,
470
287
          sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
471
287
    if (!res)
472
0
      
return 0
FN0
(PW,free)(pw);
473
287
    res->size = n;
474
287
    return res;
475
287
  }
476
#ifdef HAS_TYPE
477
  res = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, n);
478
#else
479
287
  
res = 0
FN0
(PW,alloc_size)(isl_space_copy(pw->dim), n);
480
0
#endif
481
0
  if (!res)
482
0
    
return 0
FN0
(PW,free)(pw);
483
0
  
for (i = 0; 0
i < pw->n0
;
++i0
)
484
0
    
res = 0
FN0
(PW,add_piece)(res, isl_set_copy(pw->p[i].set),
485
0
              
FN0
(EL,copy)(pw->p[i].
FIELD0
));
486
0
  FN(PW,free)(pw);
487
0
  return res;
488
287
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_grow
489
490
static __isl_give PW *FN(PW,add_disjoint_aligned)(__isl_take PW *pw1,
491
  __isl_take PW *pw2)
492
7.57k
{
493
7.57k
  int i;
494
7.57k
  isl_ctx *ctx;
495
7.57k
496
7.57k
  if (
!pw1 || 7.57k
!pw27.57k
)
497
0
    goto error;
498
7.57k
499
7.57k
  
if (7.57k
pw1->size < pw1->n + pw2->n && 7.57k
pw1->n < pw2->n3.90k
)
500
3.52k
    
return 3.52k
FN3.52k
(PW,add_disjoint_aligned)(pw2, pw1);
501
7.57k
502
4.04k
  ctx = isl_space_get_ctx(pw1->dim);
503
#ifdef HAS_TYPE
504
0
  if (pw1->type != pw2->type)
505
0
    isl_die(ctx, isl_error_invalid,
506
      "fold types don't match", goto error);
507
#endif
508
4.04k
  
isl_assert4.04k
(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
509
0
510
4.04k
  
if (4.04k
FN4.04k
(PW,IS_ZERO)(pw1)4.04k
) {
511
126
    FN(PW,free)(pw1);
512
126
    return pw2;
513
126
  }
514
4.04k
515
3.92k
  
if (3.92k
FN3.92k
(PW,IS_ZERO)(pw2)3.92k
) {
516
3.54k
    FN(PW,free)(pw2);
517
3.54k
    return pw1;
518
3.54k
  }
519
3.92k
520
373
  
pw1 = 373
FN373
(PW,grow)(pw1, pw2->n);
521
373
  if (!pw1)
522
0
    goto error;
523
373
524
746
  
for (i = 0; 373
i < pw2->n746
;
++i373
)
525
373
    
pw1 = 373
FN373
(PW,add_piece)(pw1,
526
373
        isl_set_copy(pw2->p[i].set),
527
373
        
FN373
(EL,copy)(pw2->p[i].
FIELD373
));
528
373
529
373
  FN(PW,free)(pw2);
530
373
531
373
  return pw1;
532
0
error:
533
0
  FN(PW,free)(pw1);
534
0
  FN(PW,free)(pw2);
535
0
  return NULL;
536
7.57k
}
isl_aff.c:isl_pw_aff_add_disjoint_aligned
Line
Count
Source
492
1.88k
{
493
1.88k
  int i;
494
1.88k
  isl_ctx *ctx;
495
1.88k
496
1.88k
  if (
!pw1 || 1.88k
!pw21.88k
)
497
0
    goto error;
498
1.88k
499
1.88k
  
if (1.88k
pw1->size < pw1->n + pw2->n && 1.88k
pw1->n < pw2->n1.01k
)
500
724
    
return 724
FN724
(PW,add_disjoint_aligned)(pw2, pw1);
501
1.88k
502
1.15k
  ctx = isl_space_get_ctx(pw1->dim);
503
#ifdef HAS_TYPE
504
  if (pw1->type != pw2->type)
505
    isl_die(ctx, isl_error_invalid,
506
      "fold types don't match", goto error);
507
#endif
508
1.15k
  isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
509
1.15k
510
1.15k
  
if (1.15k
FN1.15k
(PW,IS_ZERO)(pw1)1.15k
) {
511
126
    FN(PW,free)(pw1);
512
126
    return pw2;
513
126
  }
514
1.15k
515
1.03k
  
if (1.03k
FN1.03k
(PW,IS_ZERO)(pw2)1.03k
) {
516
746
    FN(PW,free)(pw2);
517
746
    return pw1;
518
746
  }
519
1.03k
520
287
  
pw1 = 287
FN287
(PW,grow)(pw1, pw2->n);
521
287
  if (!pw1)
522
0
    goto error;
523
287
524
574
  
for (i = 0; 287
i < pw2->n574
;
++i287
)
525
287
    
pw1 = 287
FN287
(PW,add_piece)(pw1,
526
287
        isl_set_copy(pw2->p[i].set),
527
287
        
FN287
(EL,copy)(pw2->p[i].
FIELD287
));
528
287
529
287
  FN(PW,free)(pw2);
530
287
531
287
  return pw1;
532
0
error:
533
0
  FN(PW,free)(pw1);
534
0
  FN(PW,free)(pw2);
535
0
  return NULL;
536
1.88k
}
isl_polynomial.c:isl_pw_qpolynomial_add_disjoint_aligned
Line
Count
Source
492
3
{
493
3
  int i;
494
3
  isl_ctx *ctx;
495
3
496
3
  if (
!pw1 || 3
!pw23
)
497
0
    goto error;
498
3
499
3
  
if (3
pw1->size < pw1->n + pw2->n && 3
pw1->n < pw2->n2
)
500
1
    
return 1
FN1
(PW,add_disjoint_aligned)(pw2, pw1);
501
3
502
2
  ctx = isl_space_get_ctx(pw1->dim);
503
#ifdef HAS_TYPE
504
  if (pw1->type != pw2->type)
505
    isl_die(ctx, isl_error_invalid,
506
      "fold types don't match", goto error);
507
#endif
508
2
  isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
509
2
510
2
  
if (2
FN2
(PW,IS_ZERO)(pw1)2
) {
511
0
    FN(PW,free)(pw1);
512
0
    return pw2;
513
0
  }
514
2
515
2
  
if (2
FN2
(PW,IS_ZERO)(pw2)2
) {
516
1
    FN(PW,free)(pw2);
517
1
    return pw1;
518
1
  }
519
2
520
1
  
pw1 = 1
FN1
(PW,grow)(pw1, pw2->n);
521
1
  if (!pw1)
522
0
    goto error;
523
1
524
2
  
for (i = 0; 1
i < pw2->n2
;
++i1
)
525
1
    
pw1 = 1
FN1
(PW,add_piece)(pw1,
526
1
        isl_set_copy(pw2->p[i].set),
527
1
        
FN1
(EL,copy)(pw2->p[i].
FIELD1
));
528
1
529
1
  FN(PW,free)(pw2);
530
1
531
1
  return pw1;
532
0
error:
533
0
  FN(PW,free)(pw1);
534
0
  FN(PW,free)(pw2);
535
0
  return NULL;
536
3
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_add_disjoint_aligned
isl_aff.c:isl_pw_multi_aff_add_disjoint_aligned
Line
Count
Source
492
5.68k
{
493
5.68k
  int i;
494
5.68k
  isl_ctx *ctx;
495
5.68k
496
5.68k
  if (
!pw1 || 5.68k
!pw25.68k
)
497
0
    goto error;
498
5.68k
499
5.68k
  
if (5.68k
pw1->size < pw1->n + pw2->n && 5.68k
pw1->n < pw2->n2.88k
)
500
2.80k
    
return 2.80k
FN2.80k
(PW,add_disjoint_aligned)(pw2, pw1);
501
5.68k
502
2.88k
  ctx = isl_space_get_ctx(pw1->dim);
503
#ifdef HAS_TYPE
504
  if (pw1->type != pw2->type)
505
    isl_die(ctx, isl_error_invalid,
506
      "fold types don't match", goto error);
507
#endif
508
2.88k
  isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
509
2.88k
510
2.88k
  
if (2.88k
FN2.88k
(PW,IS_ZERO)(pw1)2.88k
) {
511
0
    FN(PW,free)(pw1);
512
0
    return pw2;
513
0
  }
514
2.88k
515
2.88k
  
if (2.88k
FN2.88k
(PW,IS_ZERO)(pw2)2.88k
) {
516
2.80k
    FN(PW,free)(pw2);
517
2.80k
    return pw1;
518
2.80k
  }
519
2.88k
520
85
  
pw1 = 85
FN85
(PW,grow)(pw1, pw2->n);
521
85
  if (!pw1)
522
0
    goto error;
523
85
524
170
  
for (i = 0; 85
i < pw2->n170
;
++i85
)
525
85
    
pw1 = 85
FN85
(PW,add_piece)(pw1,
526
85
        isl_set_copy(pw2->p[i].set),
527
85
        
FN85
(EL,copy)(pw2->p[i].
FIELD85
));
528
85
529
85
  FN(PW,free)(pw2);
530
85
531
85
  return pw1;
532
0
error:
533
0
  FN(PW,free)(pw1);
534
0
  FN(PW,free)(pw2);
535
0
  return NULL;
536
5.68k
}
537
538
__isl_give PW *FN(PW,add_disjoint)(__isl_take PW *pw1, __isl_take PW *pw2)
539
4.04k
{
540
4.04k
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
541
4.04k
            &FN(PW,add_disjoint_aligned));
542
4.04k
}
isl_pw_aff_add_disjoint
Line
Count
Source
539
1.15k
{
540
1.15k
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
541
1.15k
            &FN(PW,add_disjoint_aligned));
542
1.15k
}
isl_pw_multi_aff_add_disjoint
Line
Count
Source
539
2.88k
{
540
2.88k
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
541
2.88k
            &FN(PW,add_disjoint_aligned));
542
2.88k
}
isl_pw_qpolynomial_add_disjoint
Line
Count
Source
539
2
{
540
2
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
541
2
            &FN(PW,add_disjoint_aligned));
542
2
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_add_disjoint
543
544
/* This function is currently only used from isl_aff.c
545
 */
546
static __isl_give PW *FN(PW,on_shared_domain_in)(__isl_take PW *pw1,
547
  __isl_take PW *pw2, __isl_take isl_space *space,
548
  __isl_give EL *(*fn)(__isl_take EL *el1, __isl_take EL *el2))
549
  __attribute__ ((unused));
550
551
/* Apply "fn" to pairs of elements from pw1 and pw2 on shared domains.
552
 * The result of "fn" (and therefore also of this function) lives in "space".
553
 */
554
static __isl_give PW *FN(PW,on_shared_domain_in)(__isl_take PW *pw1,
555
  __isl_take PW *pw2, __isl_take isl_space *space,
556
  __isl_give EL *(*fn)(__isl_take EL *el1, __isl_take EL *el2))
557
73.8k
{
558
73.8k
  int i, j, n;
559
73.8k
  PW *res = NULL;
560
73.8k
561
73.8k
  if (
!pw1 || 73.8k
!pw273.8k
)
562
0
    goto error;
563
73.8k
564
73.8k
  n = pw1->n * pw2->n;
565
#ifdef HAS_TYPE
566
  res = FN(PW,alloc_size)(isl_space_copy(space), pw1->type, n);
567
#else
568
73.8k
  res = FN(PW,alloc_size)(isl_space_copy(space), n);
569
73.8k
#endif
570
73.8k
571
150k
  for (i = 0; 
i < pw1->n150k
;
++i76.1k
) {
572
155k
    for (j = 0; 
j < pw2->n155k
;
++j79.3k
) {
573
79.3k
      isl_set *common;
574
79.3k
      EL *res_ij;
575
79.3k
      int empty;
576
79.3k
577
79.3k
      common = isl_set_intersect(
578
79.3k
          isl_set_copy(pw1->p[i].set),
579
79.3k
          isl_set_copy(pw2->p[j].set));
580
79.3k
      empty = isl_set_plain_is_empty(common);
581
79.3k
      if (
empty < 0 || 79.3k
empty79.3k
) {
582
2.98k
        isl_set_free(common);
583
2.98k
        if (empty < 0)
584
0
          goto error;
585
2.98k
        continue;
586
2.98k
      }
587
79.3k
588
76.3k
      
res_ij = fn(76.3k
FN76.3k
(EL,copy)(pw1->p[i].
FIELD76.3k
),
589
76.3k
            
FN76.3k
(EL,copy)(pw2->p[j].
FIELD76.3k
));
590
76.3k
      res_ij = FN(EL,gist)(res_ij, isl_set_copy(common));
591
76.3k
592
76.3k
      res = FN(PW,add_piece)(res, common, res_ij);
593
79.3k
    }
594
76.1k
  }
595
73.8k
596
73.8k
  isl_space_free(space);
597
73.8k
  FN(PW,free)(pw1);
598
73.8k
  FN(PW,free)(pw2);
599
73.8k
  return res;
600
0
error:
601
0
  isl_space_free(space);
602
0
  FN(PW,free)(pw1);
603
0
  FN(PW,free)(pw2);
604
0
  FN(PW,free)(res);
605
0
  return NULL;
606
73.8k
}
isl_aff.c:isl_pw_multi_aff_on_shared_domain_in
Line
Count
Source
557
178
{
558
178
  int i, j, n;
559
178
  PW *res = NULL;
560
178
561
178
  if (
!pw1 || 178
!pw2178
)
562
0
    goto error;
563
178
564
178
  n = pw1->n * pw2->n;
565
#ifdef HAS_TYPE
566
  res = FN(PW,alloc_size)(isl_space_copy(space), pw1->type, n);
567
#else
568
178
  res = FN(PW,alloc_size)(isl_space_copy(space), n);
569
178
#endif
570
178
571
356
  for (i = 0; 
i < pw1->n356
;
++i178
) {
572
359
    for (j = 0; 
j < pw2->n359
;
++j181
) {
573
181
      isl_set *common;
574
181
      EL *res_ij;
575
181
      int empty;
576
181
577
181
      common = isl_set_intersect(
578
181
          isl_set_copy(pw1->p[i].set),
579
181
          isl_set_copy(pw2->p[j].set));
580
181
      empty = isl_set_plain_is_empty(common);
581
181
      if (
empty < 0 || 181
empty181
) {
582
0
        isl_set_free(common);
583
0
        if (empty < 0)
584
0
          goto error;
585
0
        continue;
586
0
      }
587
181
588
181
      
res_ij = fn(181
FN181
(EL,copy)(pw1->p[i].
FIELD181
),
589
181
            
FN181
(EL,copy)(pw2->p[j].
FIELD181
));
590
181
      res_ij = FN(EL,gist)(res_ij, isl_set_copy(common));
591
181
592
181
      res = FN(PW,add_piece)(res, common, res_ij);
593
181
    }
594
178
  }
595
178
596
178
  isl_space_free(space);
597
178
  FN(PW,free)(pw1);
598
178
  FN(PW,free)(pw2);
599
178
  return res;
600
0
error:
601
0
  isl_space_free(space);
602
0
  FN(PW,free)(pw1);
603
0
  FN(PW,free)(pw2);
604
0
  FN(PW,free)(res);
605
0
  return NULL;
606
178
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_on_shared_domain_in
isl_aff.c:isl_pw_aff_on_shared_domain_in
Line
Count
Source
557
73.6k
{
558
73.6k
  int i, j, n;
559
73.6k
  PW *res = NULL;
560
73.6k
561
73.6k
  if (
!pw1 || 73.6k
!pw273.6k
)
562
0
    goto error;
563
73.6k
564
73.6k
  n = pw1->n * pw2->n;
565
#ifdef HAS_TYPE
566
  res = FN(PW,alloc_size)(isl_space_copy(space), pw1->type, n);
567
#else
568
73.6k
  res = FN(PW,alloc_size)(isl_space_copy(space), n);
569
73.6k
#endif
570
73.6k
571
149k
  for (i = 0; 
i < pw1->n149k
;
++i75.9k
) {
572
155k
    for (j = 0; 
j < pw2->n155k
;
++j79.1k
) {
573
79.1k
      isl_set *common;
574
79.1k
      EL *res_ij;
575
79.1k
      int empty;
576
79.1k
577
79.1k
      common = isl_set_intersect(
578
79.1k
          isl_set_copy(pw1->p[i].set),
579
79.1k
          isl_set_copy(pw2->p[j].set));
580
79.1k
      empty = isl_set_plain_is_empty(common);
581
79.1k
      if (
empty < 0 || 79.1k
empty79.1k
) {
582
2.98k
        isl_set_free(common);
583
2.98k
        if (empty < 0)
584
0
          goto error;
585
2.98k
        continue;
586
2.98k
      }
587
79.1k
588
76.1k
      
res_ij = fn(76.1k
FN76.1k
(EL,copy)(pw1->p[i].
FIELD76.1k
),
589
76.1k
            
FN76.1k
(EL,copy)(pw2->p[j].
FIELD76.1k
));
590
76.1k
      res_ij = FN(EL,gist)(res_ij, isl_set_copy(common));
591
76.1k
592
76.1k
      res = FN(PW,add_piece)(res, common, res_ij);
593
79.1k
    }
594
75.9k
  }
595
73.6k
596
73.6k
  isl_space_free(space);
597
73.6k
  FN(PW,free)(pw1);
598
73.6k
  FN(PW,free)(pw2);
599
73.6k
  return res;
600
0
error:
601
0
  isl_space_free(space);
602
0
  FN(PW,free)(pw1);
603
0
  FN(PW,free)(pw2);
604
0
  FN(PW,free)(res);
605
0
  return NULL;
606
73.6k
}
Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_on_shared_domain_in
607
608
/* This function is currently only used from isl_aff.c
609
 */
610
static __isl_give PW *FN(PW,on_shared_domain)(__isl_take PW *pw1,
611
  __isl_take PW *pw2,
612
  __isl_give EL *(*fn)(__isl_take EL *el1, __isl_take EL *el2))
613
  __attribute__ ((unused));
614
615
/* Apply "fn" to pairs of elements from pw1 and pw2 on shared domains.
616
 * The result of "fn" is assumed to live in the same space as "pw1" and "pw2".
617
 */
618
static __isl_give PW *FN(PW,on_shared_domain)(__isl_take PW *pw1,
619
  __isl_take PW *pw2,
620
  __isl_give EL *(*fn)(__isl_take EL *el1, __isl_take EL *el2))
621
73.6k
{
622
73.6k
  isl_space *space;
623
73.6k
624
73.6k
  if (
!pw1 || 73.6k
!pw273.6k
)
625
0
    goto error;
626
73.6k
627
73.6k
  space = isl_space_copy(pw1->dim);
628
73.6k
  return FN(PW,on_shared_domain_in)(pw1, pw2, space, fn);
629
0
error:
630
0
  FN(PW,free)(pw1);
631
0
  FN(PW,free)(pw2);
632
0
  return NULL;
633
73.6k
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_on_shared_domain
isl_aff.c:isl_pw_aff_on_shared_domain
Line
Count
Source
621
73.6k
{
622
73.6k
  isl_space *space;
623
73.6k
624
73.6k
  if (
!pw1 || 73.6k
!pw273.6k
)
625
0
    goto error;
626
73.6k
627
73.6k
  space = isl_space_copy(pw1->dim);
628
73.6k
  return FN(PW,on_shared_domain_in)(pw1, pw2, space, fn);
629
0
error:
630
0
  FN(PW,free)(pw1);
631
0
  FN(PW,free)(pw2);
632
0
  return NULL;
633
73.6k
}
isl_aff.c:isl_pw_multi_aff_on_shared_domain
Line
Count
Source
621
1
{
622
1
  isl_space *space;
623
1
624
1
  if (
!pw1 || 1
!pw21
)
625
0
    goto error;
626
1
627
1
  space = isl_space_copy(pw1->dim);
628
1
  return FN(PW,on_shared_domain_in)(pw1, pw2, space, fn);
629
0
error:
630
0
  FN(PW,free)(pw1);
631
0
  FN(PW,free)(pw2);
632
0
  return NULL;
633
1
}
Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_on_shared_domain
634
635
#ifndef NO_NEG
636
__isl_give PW *FN(PW,neg)(__isl_take PW *pw)
637
23.0k
{
638
23.0k
  int i;
639
23.0k
640
23.0k
  if (!pw)
641
0
    return NULL;
642
23.0k
643
23.0k
  
if (23.0k
FN23.0k
(PW,IS_ZERO)(pw)23.0k
)
644
0
    return pw;
645
23.0k
646
23.0k
  
pw = 23.0k
FN23.0k
(PW,cow)(pw);
647
23.0k
  if (!pw)
648
0
    return NULL;
649
23.0k
650
46.8k
  
for (i = 0; 23.0k
i < pw->n46.8k
;
++i23.8k
) {
651
23.8k
    pw->p[i].
FIELD23.8k
=
FN23.8k
(EL,neg)(pw->p[i].
FIELD23.8k
);
652
23.8k
    if (
!pw->p[i].23.8k
FIELD23.8k
)
653
0
      
return 0
FN0
(PW,free)(pw);
654
23.8k
  }
655
23.0k
656
23.0k
  return pw;
657
23.0k
}
Unexecuted instantiation: isl_pw_multi_aff_neg
isl_pw_aff_neg
Line
Count
Source
637
23.0k
{
638
23.0k
  int i;
639
23.0k
640
23.0k
  if (!pw)
641
0
    return NULL;
642
23.0k
643
23.0k
  
if (23.0k
FN23.0k
(PW,IS_ZERO)(pw)23.0k
)
644
0
    return pw;
645
23.0k
646
23.0k
  
pw = 23.0k
FN23.0k
(PW,cow)(pw);
647
23.0k
  if (!pw)
648
0
    return NULL;
649
23.0k
650
46.8k
  
for (i = 0; 23.0k
i < pw->n46.8k
;
++i23.8k
) {
651
23.8k
    pw->p[i].
FIELD23.8k
=
FN23.8k
(EL,neg)(pw->p[i].
FIELD23.8k
);
652
23.8k
    if (
!pw->p[i].23.8k
FIELD23.8k
)
653
0
      
return 0
FN0
(PW,free)(pw);
654
23.8k
  }
655
23.0k
656
23.0k
  return pw;
657
23.0k
}
isl_pw_qpolynomial_neg
Line
Count
Source
637
11
{
638
11
  int i;
639
11
640
11
  if (!pw)
641
0
    return NULL;
642
11
643
11
  
if (11
FN11
(PW,IS_ZERO)(pw)11
)
644
0
    return pw;
645
11
646
11
  
pw = 11
FN11
(PW,cow)(pw);
647
11
  if (!pw)
648
0
    return NULL;
649
11
650
23
  
for (i = 0; 11
i < pw->n23
;
++i12
) {
651
12
    pw->p[i].
FIELD12
=
FN12
(EL,neg)(pw->p[i].
FIELD12
);
652
12
    if (
!pw->p[i].12
FIELD12
)
653
0
      
return 0
FN0
(PW,free)(pw);
654
12
  }
655
11
656
11
  return pw;
657
11
}
658
#endif
659
660
#ifndef NO_SUB
661
__isl_give PW *FN(PW,sub)(__isl_take PW *pw1, __isl_take PW *pw2)
662
6.80k
{
663
6.80k
  return 
FN6.80k
(PW,add)(pw1,
FN6.80k
(PW,neg)(pw2));
664
6.80k
}
isl_pw_aff_sub
Line
Count
Source
662
6.79k
{
663
6.79k
  return 
FN6.79k
(PW,add)(pw1,
FN6.79k
(PW,neg)(pw2));
664
6.79k
}
isl_pw_qpolynomial_sub
Line
Count
Source
662
9
{
663
9
  return 
FN9
(PW,add)(pw1,
FN9
(PW,neg)(pw2));
664
9
}
665
#endif
666
667
#ifndef NO_EVAL
668
__isl_give isl_val *FN(PW,eval)(__isl_take PW *pw, __isl_take isl_point *pnt)
669
1
{
670
1
  int i;
671
1
  int found = 0;
672
1
  isl_ctx *ctx;
673
1
  isl_space *pnt_dim = NULL;
674
1
  isl_val *v;
675
1
676
1
  if (
!pw || 1
!pnt1
)
677
0
    goto error;
678
1
  ctx = isl_point_get_ctx(pnt);
679
1
  pnt_dim = isl_point_get_space(pnt);
680
1
  isl_assert(ctx, isl_space_is_domain_internal(pnt_dim, pw->dim),
681
1
        goto error);
682
1
683
1
  
for (i = 0; 1
i < pw->n1
;
++i0
) {
684
1
    found = isl_set_contains_point(pw->p[i].set, pnt);
685
1
    if (found < 0)
686
0
      goto error;
687
1
    
if (1
found1
)
688
1
      break;
689
1
  }
690
1
  
if (1
found1
)
691
1
    
v = 1
FN1
(EL,eval)(
FN1
(EL,copy)(pw->p[i].
FIELD1
),
692
1
              isl_point_copy(pnt));
693
1
  else
694
0
    v = isl_val_zero(ctx);
695
1
  FN(PW,free)(pw);
696
1
  isl_space_free(pnt_dim);
697
1
  isl_point_free(pnt);
698
1
  return v;
699
0
error:
700
0
  FN(PW,free)(pw);
701
0
  isl_space_free(pnt_dim);
702
0
  isl_point_free(pnt);
703
0
  return NULL;
704
1
}
isl_pw_qpolynomial_eval
Line
Count
Source
669
1
{
670
1
  int i;
671
1
  int found = 0;
672
1
  isl_ctx *ctx;
673
1
  isl_space *pnt_dim = NULL;
674
1
  isl_val *v;
675
1
676
1
  if (
!pw || 1
!pnt1
)
677
0
    goto error;
678
1
  ctx = isl_point_get_ctx(pnt);
679
1
  pnt_dim = isl_point_get_space(pnt);
680
1
  isl_assert(ctx, isl_space_is_domain_internal(pnt_dim, pw->dim),
681
1
        goto error);
682
1
683
1
  
for (i = 0; 1
i < pw->n1
;
++i0
) {
684
1
    found = isl_set_contains_point(pw->p[i].set, pnt);
685
1
    if (found < 0)
686
0
      goto error;
687
1
    
if (1
found1
)
688
1
      break;
689
1
  }
690
1
  
if (1
found1
)
691
1
    
v = 1
FN1
(EL,eval)(
FN1
(EL,copy)(pw->p[i].
FIELD1
),
692
1
              isl_point_copy(pnt));
693
1
  else
694
0
    v = isl_val_zero(ctx);
695
1
  FN(PW,free)(pw);
696
1
  isl_space_free(pnt_dim);
697
1
  isl_point_free(pnt);
698
1
  return v;
699
0
error:
700
0
  FN(PW,free)(pw);
701
0
  isl_space_free(pnt_dim);
702
0
  isl_point_free(pnt);
703
0
  return NULL;
704
1
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_eval
705
#endif
706
707
/* Return the parameter domain of "pw".
708
 */
709
__isl_give isl_set *FN(PW,params)(__isl_take PW *pw)
710
0
{
711
0
  return isl_set_params(FN(PW,domain)(pw));
712
0
}
Unexecuted instantiation: isl_pw_aff_params
Unexecuted instantiation: isl_pw_multi_aff_params
Unexecuted instantiation: isl_pw_qpolynomial_fold_params
Unexecuted instantiation: isl_pw_qpolynomial_params
713
714
__isl_give isl_set *FN(PW,domain)(__isl_take PW *pw)
715
53.5k
{
716
53.5k
  int i;
717
53.5k
  isl_set *dom;
718
53.5k
719
53.5k
  if (!pw)
720
0
    return NULL;
721
53.5k
722
53.5k
  
dom = isl_set_empty(53.5k
FN53.5k
(PW,get_domain_space)(pw));
723
108k
  for (i = 0; 
i < pw->n108k
;
++i55.1k
)
724
55.1k
    dom = isl_set_union_disjoint(dom, isl_set_copy(pw->p[i].set));
725
53.5k
726
53.5k
  FN(PW,free)(pw);
727
53.5k
728
53.5k
  return dom;
729
53.5k
}
isl_pw_multi_aff_domain
Line
Count
Source
715
906
{
716
906
  int i;
717
906
  isl_set *dom;
718
906
719
906
  if (!pw)
720
0
    return NULL;
721
906
722
906
  
dom = isl_set_empty(906
FN906
(PW,get_domain_space)(pw));
723
1.83k
  for (i = 0; 
i < pw->n1.83k
;
++i930
)
724
930
    dom = isl_set_union_disjoint(dom, isl_set_copy(pw->p[i].set));
725
906
726
906
  FN(PW,free)(pw);
727
906
728
906
  return dom;
729
906
}
isl_pw_aff_domain
Line
Count
Source
715
52.6k
{
716
52.6k
  int i;
717
52.6k
  isl_set *dom;
718
52.6k
719
52.6k
  if (!pw)
720
0
    return NULL;
721
52.6k
722
52.6k
  
dom = isl_set_empty(52.6k
FN52.6k
(PW,get_domain_space)(pw));
723
106k
  for (i = 0; 
i < pw->n106k
;
++i54.2k
)
724
54.2k
    dom = isl_set_union_disjoint(dom, isl_set_copy(pw->p[i].set));
725
52.6k
726
52.6k
  FN(PW,free)(pw);
727
52.6k
728
52.6k
  return dom;
729
52.6k
}
isl_pw_qpolynomial_domain
Line
Count
Source
715
1
{
716
1
  int i;
717
1
  isl_set *dom;
718
1
719
1
  if (!pw)
720
0
    return NULL;
721
1
722
1
  
dom = isl_set_empty(1
FN1
(PW,get_domain_space)(pw));
723
2
  for (i = 0; 
i < pw->n2
;
++i1
)
724
1
    dom = isl_set_union_disjoint(dom, isl_set_copy(pw->p[i].set));
725
1
726
1
  FN(PW,free)(pw);
727
1
728
1
  return dom;
729
1
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_domain
730
731
/* Exploit the equalities in the domain of piece "i" of "pw"
732
 * to simplify the associated function.
733
 * If the domain of piece "i" is empty, then remove it entirely,
734
 * replacing it with the final piece.
735
 */
736
static int FN(PW,exploit_equalities_and_remove_if_empty)(__isl_keep PW *pw,
737
  int i)
738
37.9k
{
739
37.9k
  isl_basic_set *aff;
740
37.9k
  int empty = isl_set_plain_is_empty(pw->p[i].set);
741
37.9k
742
37.9k
  if (empty < 0)
743
0
    return -1;
744
37.9k
  
if (37.9k
empty37.9k
) {
745
25
    isl_set_free(pw->p[i].set);
746
25
    
FN25
(EL,free)(pw->p[i].
FIELD25
);
747
25
    if (i != pw->n - 1)
748
0
      pw->p[i] = pw->p[pw->n - 1];
749
25
    pw->n--;
750
25
751
25
    return 0;
752
25
  }
753
37.9k
754
37.9k
  aff = isl_set_affine_hull(isl_set_copy(pw->p[i].set));
755
37.9k
  pw->p[i].
FIELD37.9k
=
FN37.9k
(EL,substitute_equalities)(pw->p[i].
FIELD37.9k
, aff);
756
37.9k
  if (
!pw->p[i].37.9k
FIELD37.9k
)
757
0
    return -1;
758
37.9k
759
37.9k
  return 0;
760
37.9k
}
isl_polynomial.c:isl_pw_qpolynomial_exploit_equalities_and_remove_if_empty
Line
Count
Source
738
35
{
739
35
  isl_basic_set *aff;
740
35
  int empty = isl_set_plain_is_empty(pw->p[i].set);
741
35
742
35
  if (empty < 0)
743
0
    return -1;
744
35
  
if (35
empty35
) {
745
0
    isl_set_free(pw->p[i].set);
746
0
    
FN0
(EL,free)(pw->p[i].
FIELD0
);
747
0
    if (i != pw->n - 1)
748
0
      pw->p[i] = pw->p[pw->n - 1];
749
0
    pw->n--;
750
0
751
0
    return 0;
752
0
  }
753
35
754
35
  aff = isl_set_affine_hull(isl_set_copy(pw->p[i].set));
755
35
  pw->p[i].
FIELD35
=
FN35
(EL,substitute_equalities)(pw->p[i].
FIELD35
, aff);
756
35
  if (
!pw->p[i].35
FIELD35
)
757
0
    return -1;
758
35
759
35
  return 0;
760
35
}
isl_aff.c:isl_pw_multi_aff_exploit_equalities_and_remove_if_empty
Line
Count
Source
738
2.89k
{
739
2.89k
  isl_basic_set *aff;
740
2.89k
  int empty = isl_set_plain_is_empty(pw->p[i].set);
741
2.89k
742
2.89k
  if (empty < 0)
743
0
    return -1;
744
2.89k
  
if (2.89k
empty2.89k
) {
745
5
    isl_set_free(pw->p[i].set);
746
5
    
FN5
(EL,free)(pw->p[i].
FIELD5
);
747
5
    if (i != pw->n - 1)
748
0
      pw->p[i] = pw->p[pw->n - 1];
749
5
    pw->n--;
750
5
751
5
    return 0;
752
5
  }
753
2.89k
754
2.89k
  aff = isl_set_affine_hull(isl_set_copy(pw->p[i].set));
755
2.89k
  pw->p[i].
FIELD2.89k
=
FN2.89k
(EL,substitute_equalities)(pw->p[i].
FIELD2.89k
, aff);
756
2.89k
  if (
!pw->p[i].2.89k
FIELD2.89k
)
757
0
    return -1;
758
2.89k
759
2.89k
  return 0;
760
2.89k
}
isl_aff.c:isl_pw_aff_exploit_equalities_and_remove_if_empty
Line
Count
Source
738
35.0k
{
739
35.0k
  isl_basic_set *aff;
740
35.0k
  int empty = isl_set_plain_is_empty(pw->p[i].set);
741
35.0k
742
35.0k
  if (empty < 0)
743
0
    return -1;
744
35.0k
  
if (35.0k
empty35.0k
) {
745
20
    isl_set_free(pw->p[i].set);
746
20
    
FN20
(EL,free)(pw->p[i].
FIELD20
);
747
20
    if (i != pw->n - 1)
748
0
      pw->p[i] = pw->p[pw->n - 1];
749
20
    pw->n--;
750
20
751
20
    return 0;
752
20
  }
753
35.0k
754
35.0k
  aff = isl_set_affine_hull(isl_set_copy(pw->p[i].set));
755
35.0k
  pw->p[i].
FIELD35.0k
=
FN35.0k
(EL,substitute_equalities)(pw->p[i].
FIELD35.0k
, aff);
756
35.0k
  if (
!pw->p[i].35.0k
FIELD35.0k
)
757
0
    return -1;
758
35.0k
759
35.0k
  return 0;
760
35.0k
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_exploit_equalities_and_remove_if_empty
761
762
/* Convert a piecewise expression defined over a parameter domain
763
 * into one that is defined over a zero-dimensional set.
764
 */
765
__isl_give PW *FN(PW,from_range)(__isl_take PW *pw)
766
0
{
767
0
  isl_space *space;
768
0
769
0
  if (!pw)
770
0
    return NULL;
771
0
  
if (0
!isl_space_is_set(pw->dim)0
)
772
0
    isl_die(FN(PW,get_ctx)(pw), isl_error_invalid,
773
0
      "not living in a set space", return FN(PW,free)(pw));
774
0
775
0
  
space = 0
FN0
(PW,get_space)(pw);
776
0
  space = isl_space_from_range(space);
777
0
  pw = FN(PW,reset_space)(pw, space);
778
0
779
0
  return pw;
780
0
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_from_range
Unexecuted instantiation: isl_pw_aff_from_range
Unexecuted instantiation: isl_pw_qpolynomial_from_range
Unexecuted instantiation: isl_pw_multi_aff_from_range
781
782
/* Fix the value of the given parameter or domain dimension of "pw"
783
 * to be equal to "value".
784
 */
785
__isl_give PW *FN(PW,fix_si)(__isl_take PW *pw, enum isl_dim_type type,
786
  unsigned pos, int value)
787
0
{
788
0
  int i;
789
0
790
0
  if (!pw)
791
0
    return NULL;
792
0
793
0
  
if (0
type == isl_dim_out0
)
794
0
    isl_die(FN(PW,get_ctx)(pw), isl_error_invalid,
795
0
      "cannot fix output dimension", return FN(PW,free)(pw));
796
0
797
0
  
if (0
pw->n == 00
)
798
0
    return pw;
799
0
800
0
  
if (0
type == isl_dim_in0
)
801
0
    type = isl_dim_set;
802
0
803
0
  pw = FN(PW,cow)(pw);
804
0
  if (!pw)
805
0
    
return 0
FN0
(PW,free)(pw);
806
0
807
0
  
for (i = pw->n - 1; 0
i >= 00
;
--i0
) {
808
0
    pw->p[i].set = isl_set_fix_si(pw->p[i].set, type, pos, value);
809
0
    if (
FN0
(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 00
)
810
0
      
return 0
FN0
(PW,free)(pw);
811
0
  }
812
0
813
0
  return pw;
814
0
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_fix_si
Unexecuted instantiation: isl_pw_multi_aff_fix_si
Unexecuted instantiation: isl_pw_aff_fix_si
Unexecuted instantiation: isl_pw_qpolynomial_fix_si
815
816
/* Restrict the domain of "pw" by combining each cell
817
 * with "set" through a call to "fn", where "fn" may be
818
 * isl_set_intersect, isl_set_intersect_params or isl_set_subtract.
819
 */
820
static __isl_give PW *FN(PW,restrict_domain_aligned)(__isl_take PW *pw,
821
  __isl_take isl_set *set,
822
  __isl_give isl_set *(*fn)(__isl_take isl_set *set1,
823
            __isl_take isl_set *set2))
824
36.7k
{
825
36.7k
  int i;
826
36.7k
827
36.7k
  if (
!pw || 36.7k
!set36.7k
)
828
0
    goto error;
829
36.7k
830
36.7k
  
if (36.7k
pw->n == 036.7k
) {
831
2
    isl_set_free(set);
832
2
    return pw;
833
2
  }
834
36.7k
835
36.7k
  
pw = 36.7k
FN36.7k
(PW,cow)(pw);
836
36.7k
  if (!pw)
837
0
    goto error;
838
36.7k
839
74.7k
  
for (i = pw->n - 1; 36.7k
i >= 074.7k
;
--i37.9k
) {
840
37.9k
    pw->p[i].set = fn(pw->p[i].set, isl_set_copy(set));
841
37.9k
    if (
FN37.9k
(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 037.9k
)
842
0
      goto error;
843
37.9k
  }
844
36.7k
  
845
36.7k
  isl_set_free(set);
846
36.7k
  return pw;
847
0
error:
848
0
  isl_set_free(set);
849
0
  FN(PW,free)(pw);
850
0
  return NULL;
851
36.7k
}
isl_polynomial.c:isl_pw_qpolynomial_restrict_domain_aligned
Line
Count
Source
824
35
{
825
35
  int i;
826
35
827
35
  if (
!pw || 35
!set35
)
828
0
    goto error;
829
35
830
35
  
if (35
pw->n == 035
) {
831
1
    isl_set_free(set);
832
1
    return pw;
833
1
  }
834
35
835
34
  
pw = 34
FN34
(PW,cow)(pw);
836
34
  if (!pw)
837
0
    goto error;
838
34
839
68
  
for (i = pw->n - 1; 34
i >= 068
;
--i34
) {
840
34
    pw->p[i].set = fn(pw->p[i].set, isl_set_copy(set));
841
34
    if (
FN34
(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 034
)
842
0
      goto error;
843
34
  }
844
34
  
845
34
  isl_set_free(set);
846
34
  return pw;
847
0
error:
848
0
  isl_set_free(set);
849
0
  FN(PW,free)(pw);
850
0
  return NULL;
851
35
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_restrict_domain_aligned
isl_aff.c:isl_pw_multi_aff_restrict_domain_aligned
Line
Count
Source
824
2.86k
{
825
2.86k
  int i;
826
2.86k
827
2.86k
  if (
!pw || 2.86k
!set2.86k
)
828
0
    goto error;
829
2.86k
830
2.86k
  
if (2.86k
pw->n == 02.86k
) {
831
1
    isl_set_free(set);
832
1
    return pw;
833
1
  }
834
2.86k
835
2.86k
  
pw = 2.86k
FN2.86k
(PW,cow)(pw);
836
2.86k
  if (!pw)
837
0
    goto error;
838
2.86k
839
5.76k
  
for (i = pw->n - 1; 2.86k
i >= 05.76k
;
--i2.89k
) {
840
2.89k
    pw->p[i].set = fn(pw->p[i].set, isl_set_copy(set));
841
2.89k
    if (
FN2.89k
(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 02.89k
)
842
0
      goto error;
843
2.89k
  }
844
2.86k
  
845
2.86k
  isl_set_free(set);
846
2.86k
  return pw;
847
0
error:
848
0
  isl_set_free(set);
849
0
  FN(PW,free)(pw);
850
0
  return NULL;
851
2.86k
}
isl_aff.c:isl_pw_aff_restrict_domain_aligned
Line
Count
Source
824
33.8k
{
825
33.8k
  int i;
826
33.8k
827
33.8k
  if (
!pw || 33.8k
!set33.8k
)
828
0
    goto error;
829
33.8k
830
33.8k
  
if (33.8k
pw->n == 033.8k
) {
831
0
    isl_set_free(set);
832
0
    return pw;
833
0
  }
834
33.8k
835
33.8k
  
pw = 33.8k
FN33.8k
(PW,cow)(pw);
836
33.8k
  if (!pw)
837
0
    goto error;
838
33.8k
839
68.8k
  
for (i = pw->n - 1; 33.8k
i >= 068.8k
;
--i35.0k
) {
840
35.0k
    pw->p[i].set = fn(pw->p[i].set, isl_set_copy(set));
841
35.0k
    if (
FN35.0k
(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 035.0k
)
842
0
      goto error;
843
35.0k
  }
844
33.8k
  
845
33.8k
  isl_set_free(set);
846
33.8k
  return pw;
847
0
error:
848
0
  isl_set_free(set);
849
0
  FN(PW,free)(pw);
850
0
  return NULL;
851
33.8k
}
852
853
static __isl_give PW *FN(PW,intersect_domain_aligned)(__isl_take PW *pw,
854
  __isl_take isl_set *set)
855
36.0k
{
856
36.0k
  return FN(PW,restrict_domain_aligned)(pw, set, &isl_set_intersect);
857
36.0k
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_intersect_domain_aligned
isl_aff.c:isl_pw_multi_aff_intersect_domain_aligned
Line
Count
Source
855
2.19k
{
856
2.19k
  return FN(PW,restrict_domain_aligned)(pw, set, &isl_set_intersect);
857
2.19k
}
isl_aff.c:isl_pw_aff_intersect_domain_aligned
Line
Count
Source
855
33.8k
{
856
33.8k
  return FN(PW,restrict_domain_aligned)(pw, set, &isl_set_intersect);
857
33.8k
}
isl_polynomial.c:isl_pw_qpolynomial_intersect_domain_aligned
Line
Count
Source
855
35
{
856
35
  return FN(PW,restrict_domain_aligned)(pw, set, &isl_set_intersect);
857
35
}
858
859
__isl_give PW *FN(PW,intersect_domain)(__isl_take PW *pw,
860
  __isl_take isl_set *context)
861
36.0k
{
862
36.0k
  return FN(PW,align_params_pw_set_and)(pw, context,
863
36.0k
          &FN(PW,intersect_domain_aligned));
864
36.0k
}
isl_pw_multi_aff_intersect_domain
Line
Count
Source
861
2.19k
{
862
2.19k
  return FN(PW,align_params_pw_set_and)(pw, context,
863
2.19k
          &FN(PW,intersect_domain_aligned));
864
2.19k
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_intersect_domain
isl_pw_qpolynomial_intersect_domain
Line
Count
Source
861
35
{
862
35
  return FN(PW,align_params_pw_set_and)(pw, context,
863
35
          &FN(PW,intersect_domain_aligned));
864
35
}
isl_pw_aff_intersect_domain
Line
Count
Source
861
33.8k
{
862
33.8k
  return FN(PW,align_params_pw_set_and)(pw, context,
863
33.8k
          &FN(PW,intersect_domain_aligned));
864
33.8k
}
865
866
static __isl_give PW *FN(PW,intersect_params_aligned)(__isl_take PW *pw,
867
  __isl_take isl_set *set)
868
674
{
869
674
  return FN(PW,restrict_domain_aligned)(pw, set,
870
674
          &isl_set_intersect_params);
871
674
}
Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_intersect_params_aligned
isl_aff.c:isl_pw_multi_aff_intersect_params_aligned
Line
Count
Source
868
674
{
869
674
  return FN(PW,restrict_domain_aligned)(pw, set,
870
674
          &isl_set_intersect_params);
871
674
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_intersect_params_aligned
Unexecuted instantiation: isl_aff.c:isl_pw_aff_intersect_params_aligned
872
873
/* Intersect the domain of "pw" with the parameter domain "context".
874
 */
875
__isl_give PW *FN(PW,intersect_params)(__isl_take PW *pw,
876
  __isl_take isl_set *context)
877
674
{
878
674
  return FN(PW,align_params_pw_set_and)(pw, context,
879
674
          &FN(PW,intersect_params_aligned));
880
674
}
Unexecuted instantiation: isl_pw_qpolynomial_intersect_params
Unexecuted instantiation: isl_pw_qpolynomial_fold_intersect_params
isl_pw_multi_aff_intersect_params
Line
Count
Source
877
674
{
878
674
  return FN(PW,align_params_pw_set_and)(pw, context,
879
674
          &FN(PW,intersect_params_aligned));
880
674
}
Unexecuted instantiation: isl_pw_aff_intersect_params
881
882
/* Subtract "domain' from the domain of "pw", assuming their
883
 * parameters have been aligned.
884
 */
885
static __isl_give PW *FN(PW,subtract_domain_aligned)(__isl_take PW *pw,
886
  __isl_take isl_set *domain)
887
3
{
888
3
  return FN(PW,restrict_domain_aligned)(pw, domain, &isl_set_subtract);
889
3
}
Unexecuted instantiation: isl_aff.c:isl_pw_aff_subtract_domain_aligned
Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_subtract_domain_aligned
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_subtract_domain_aligned
isl_aff.c:isl_pw_multi_aff_subtract_domain_aligned
Line
Count
Source
887
3
{
888
3
  return FN(PW,restrict_domain_aligned)(pw, domain, &isl_set_subtract);
889
3
}
890
891
/* Subtract "domain' from the domain of "pw".
892
 */
893
__isl_give PW *FN(PW,subtract_domain)(__isl_take PW *pw,
894
  __isl_take isl_set *domain)
895
3
{
896
3
  return FN(PW,align_params_pw_set_and)(pw, domain,
897
3
          &FN(PW,subtract_domain_aligned));
898
3
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_subtract_domain
isl_pw_multi_aff_subtract_domain
Line
Count
Source
895
3
{
896
3
  return FN(PW,align_params_pw_set_and)(pw, domain,
897
3
          &FN(PW,subtract_domain_aligned));
898
3
}
Unexecuted instantiation: isl_pw_qpolynomial_subtract_domain
Unexecuted instantiation: isl_pw_aff_subtract_domain
899
900
/* Compute the gist of "pw" with respect to the domain constraints
901
 * of "context" for the case where the domain of the last element
902
 * of "pw" is equal to "context".
903
 * Call "fn_el" to compute the gist of this element, replace
904
 * its domain by the universe and drop all other elements
905
 * as their domains are necessarily disjoint from "context".
906
 */
907
static __isl_give PW *FN(PW,gist_last)(__isl_take PW *pw,
908
  __isl_take isl_set *context,
909
  __isl_give EL *(*fn_el)(__isl_take EL *el, __isl_take isl_set *set))
910
10.1k
{
911
10.1k
  int i;
912
10.1k
  isl_space *space;
913
10.1k
914
10.1k
  for (i = 0; 
i < pw->n - 110.1k
;
++i0
) {
915
0
    isl_set_free(pw->p[i].set);
916
0
    
FN0
(EL,free)(pw->p[i].
FIELD0
);
917
0
  }
918
10.1k
  pw->p[0].
FIELD10.1k
= pw->p[pw->n - 1].
FIELD10.1k
;
919
10.1k
  pw->p[0].set = pw->p[pw->n - 1].set;
920
10.1k
  pw->n = 1;
921
10.1k
922
10.1k
  space = isl_set_get_space(context);
923
10.1k
  pw->p[0].
FIELD10.1k
= fn_el(pw->p[0].
FIELD10.1k
, context);
924
10.1k
  context = isl_set_universe(space);
925
10.1k
  isl_set_free(pw->p[0].set);
926
10.1k
  pw->p[0].set = context;
927
10.1k
928
10.1k
  if (
!pw->p[0].10.1k
FIELD10.1k
||
!pw->p[0].set10.1k
)
929
0
    
return 0
FN0
(PW,free)(pw);
930
10.1k
931
10.1k
  return pw;
932
10.1k
}
isl_aff.c:isl_pw_aff_gist_last
Line
Count
Source
910
8.22k
{
911
8.22k
  int i;
912
8.22k
  isl_space *space;
913
8.22k
914
8.22k
  for (i = 0; 
i < pw->n - 18.22k
;
++i0
) {
915
0
    isl_set_free(pw->p[i].set);
916
0
    
FN0
(EL,free)(pw->p[i].
FIELD0
);
917
0
  }
918
8.22k
  pw->p[0].
FIELD8.22k
= pw->p[pw->n - 1].
FIELD8.22k
;
919
8.22k
  pw->p[0].set = pw->p[pw->n - 1].set;
920
8.22k
  pw->n = 1;
921
8.22k
922
8.22k
  space = isl_set_get_space(context);
923
8.22k
  pw->p[0].
FIELD8.22k
= fn_el(pw->p[0].
FIELD8.22k
, context);
924
8.22k
  context = isl_set_universe(space);
925
8.22k
  isl_set_free(pw->p[0].set);
926
8.22k
  pw->p[0].set = context;
927
8.22k
928
8.22k
  if (
!pw->p[0].8.22k
FIELD8.22k
||
!pw->p[0].set8.22k
)
929
0
    
return 0
FN0
(PW,free)(pw);
930
8.22k
931
8.22k
  return pw;
932
8.22k
}
isl_aff.c:isl_pw_multi_aff_gist_last
Line
Count
Source
910
1.92k
{
911
1.92k
  int i;
912
1.92k
  isl_space *space;
913
1.92k
914
1.92k
  for (i = 0; 
i < pw->n - 11.92k
;
++i0
) {
915
0
    isl_set_free(pw->p[i].set);
916
0
    
FN0
(EL,free)(pw->p[i].
FIELD0
);
917
0
  }
918
1.92k
  pw->p[0].
FIELD1.92k
= pw->p[pw->n - 1].
FIELD1.92k
;
919
1.92k
  pw->p[0].set = pw->p[pw->n - 1].set;
920
1.92k
  pw->n = 1;
921
1.92k
922
1.92k
  space = isl_set_get_space(context);
923
1.92k
  pw->p[0].
FIELD1.92k
= fn_el(pw->p[0].
FIELD1.92k
, context);
924
1.92k
  context = isl_set_universe(space);
925
1.92k
  isl_set_free(pw->p[0].set);
926
1.92k
  pw->p[0].set = context;
927
1.92k
928
1.92k
  if (
!pw->p[0].1.92k
FIELD1.92k
||
!pw->p[0].set1.92k
)
929
0
    
return 0
FN0
(PW,free)(pw);
930
1.92k
931
1.92k
  return pw;
932
1.92k
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_gist_last
isl_polynomial.c:isl_pw_qpolynomial_gist_last
Line
Count
Source
910
1
{
911
1
  int i;
912
1
  isl_space *space;
913
1
914
1
  for (i = 0; 
i < pw->n - 11
;
++i0
) {
915
0
    isl_set_free(pw->p[i].set);
916
0
    
FN0
(EL,free)(pw->p[i].
FIELD0
);
917
0
  }
918
1
  pw->p[0].
FIELD1
= pw->p[pw->n - 1].
FIELD1
;
919
1
  pw->p[0].set = pw->p[pw->n - 1].set;
920
1
  pw->n = 1;
921
1
922
1
  space = isl_set_get_space(context);
923
1
  pw->p[0].
FIELD1
= fn_el(pw->p[0].
FIELD1
, context);
924
1
  context = isl_set_universe(space);
925
1
  isl_set_free(pw->p[0].set);
926
1
  pw->p[0].set = context;
927
1
928
1
  if (
!pw->p[0].1
FIELD1
||
!pw->p[0].set1
)
929
0
    
return 0
FN0
(PW,free)(pw);
930
1
931
1
  return pw;
932
1
}
933
934
/* Compute the gist of "pw" with respect to the domain constraints
935
 * of "context".  Call "fn_el" to compute the gist of the elements
936
 * and "fn_dom" to compute the gist of the domains.
937
 *
938
 * If the piecewise expression is empty or the context is the universe,
939
 * then nothing can be simplified.
940
 */
941
static __isl_give PW *FN(PW,gist_aligned)(__isl_take PW *pw,
942
  __isl_take isl_set *context,
943
  __isl_give EL *(*fn_el)(__isl_take EL *el,
944
            __isl_take isl_set *set),
945
  __isl_give isl_set *(*fn_dom)(__isl_take isl_set *set,
946
            __isl_take isl_basic_set *bset))
947
13.3k
{
948
13.3k
  int i;
949
13.3k
  int is_universe;
950
13.3k
  isl_bool aligned;
951
13.3k
  isl_basic_set *hull = NULL;
952
13.3k
953
13.3k
  if (
!pw || 13.3k
!context13.3k
)
954
0
    goto error;
955
13.3k
956
13.3k
  
if (13.3k
pw->n == 013.3k
) {
957
0
    isl_set_free(context);
958
0
    return pw;
959
0
  }
960
13.3k
961
13.3k
  is_universe = isl_set_plain_is_universe(context);
962
13.3k
  if (is_universe < 0)
963
0
    goto error;
964
13.3k
  
if (13.3k
is_universe13.3k
) {
965
1.12k
    isl_set_free(context);
966
1.12k
    return pw;
967
1.12k
  }
968
13.3k
969
12.2k
  aligned = isl_set_space_has_equal_params(context, pw->dim);
970
12.2k
  if (aligned < 0)
971
0
    goto error;
972
12.2k
  
if (12.2k
!aligned12.2k
) {
973
0
    pw = FN(PW,align_params)(pw, isl_set_get_space(context));
974
0
    context = isl_set_align_params(context, FN(PW,get_space)(pw));
975
0
  }
976
12.2k
977
12.2k
  pw = FN(PW,cow)(pw);
978
12.2k
  if (!pw)
979
0
    goto error;
980
12.2k
981
12.2k
  
if (12.2k
pw->n == 112.2k
) {
982
12.2k
    int equal;
983
12.2k
984
12.2k
    equal = isl_set_plain_is_equal(pw->p[0].set, context);
985
12.2k
    if (equal < 0)
986
0
      goto error;
987
12.2k
    
if (12.2k
equal12.2k
)
988
10.1k
      
return 10.1k
FN10.1k
(PW,gist_last)(pw, context, fn_el);
989
12.2k
  }
990
12.2k
991
2.09k
  context = isl_set_compute_divs(context);
992
2.09k
  hull = isl_set_simple_hull(isl_set_copy(context));
993
2.09k
994
4.22k
  for (i = pw->n - 1; 
i >= 04.22k
;
--i2.13k
) {
995
2.13k
    isl_set *set_i;
996
2.13k
    int empty;
997
2.13k
998
2.13k
    if (
i == pw->n - 12.13k
) {
999
2.09k
      int equal;
1000
2.09k
      equal = isl_set_plain_is_equal(pw->p[i].set, context);
1001
2.09k
      if (equal < 0)
1002
0
        goto error;
1003
2.09k
      
if (2.09k
equal2.09k
) {
1004
0
        isl_basic_set_free(hull);
1005
0
        return FN(PW,gist_last)(pw, context, fn_el);
1006
0
      }
1007
2.09k
    }
1008
2.13k
    set_i = isl_set_intersect(isl_set_copy(pw->p[i].set),
1009
2.13k
             isl_set_copy(context));
1010
2.13k
    empty = isl_set_plain_is_empty(set_i);
1011
2.13k
    pw->p[i].
FIELD2.13k
= fn_el(pw->p[i].
FIELD2.13k
, set_i);
1012
2.13k
    pw->p[i].set = fn_dom(pw->p[i].set, isl_basic_set_copy(hull));
1013
2.13k
    if (
empty < 0 || 2.13k
!pw->p[i].2.13k
FIELD2.13k
||
!pw->p[i].set2.13k
)
1014
0
      goto error;
1015
2.13k
    
if (2.13k
empty2.13k
) {
1016
1
      isl_set_free(pw->p[i].set);
1017
1
      
FN1
(EL,free)(pw->p[i].
FIELD1
);
1018
1
      if (i != pw->n - 1)
1019
0
        pw->p[i] = pw->p[pw->n - 1];
1020
1
      pw->n--;
1021
1
    }
1022
2.13k
  }
1023
2.09k
1024
2.09k
  isl_basic_set_free(hull);
1025
2.09k
  isl_set_free(context);
1026
2.09k
1027
2.09k
  return pw;
1028
0
error:
1029
0
  FN(PW,free)(pw);
1030
0
  isl_basic_set_free(hull);
1031
0
  isl_set_free(context);
1032
0
  return NULL;
1033
13.3k
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_gist_aligned
isl_polynomial.c:isl_pw_qpolynomial_gist_aligned
Line
Count
Source
947
4
{
948
4
  int i;
949
4
  int is_universe;
950
4
  isl_bool aligned;
951
4
  isl_basic_set *hull = NULL;
952
4
953
4
  if (
!pw || 4
!context4
)
954
0
    goto error;
955
4
956
4
  
if (4
pw->n == 04
) {
957
0
    isl_set_free(context);
958
0
    return pw;
959
0
  }
960
4
961
4
  is_universe = isl_set_plain_is_universe(context);
962
4
  if (is_universe < 0)
963
0
    goto error;
964
4
  
if (4
is_universe4
) {
965
0
    isl_set_free(context);
966
0
    return pw;
967
0
  }
968
4
969
4
  aligned = isl_set_space_has_equal_params(context, pw->dim);
970
4
  if (aligned < 0)
971
0
    goto error;
972
4
  
if (4
!aligned4
) {
973
0
    pw = FN(PW,align_params)(pw, isl_set_get_space(context));
974
0
    context = isl_set_align_params(context, FN(PW,get_space)(pw));
975
0
  }
976
4
977
4
  pw = FN(PW,cow)(pw);
978
4
  if (!pw)
979
0
    goto error;
980
4
981
4
  
if (4
pw->n == 14
) {
982
4
    int equal;
983
4
984
4
    equal = isl_set_plain_is_equal(pw->p[0].set, context);
985
4
    if (equal < 0)
986
0
      goto error;
987
4
    
if (4
equal4
)
988
1
      
return 1
FN1
(PW,gist_last)(pw, context, fn_el);
989
4
  }
990
4
991
3
  context = isl_set_compute_divs(context);
992
3
  hull = isl_set_simple_hull(isl_set_copy(context));
993
3
994
6
  for (i = pw->n - 1; 
i >= 06
;
--i3
) {
995
3
    isl_set *set_i;
996
3
    int empty;
997
3
998
3
    if (
i == pw->n - 13
) {
999
3
      int equal;
1000
3
      equal = isl_set_plain_is_equal(pw->p[i].set, context);
1001
3
      if (equal < 0)
1002
0
        goto error;
1003
3
      
if (3
equal3
) {
1004
0
        isl_basic_set_free(hull);
1005
0
        return FN(PW,gist_last)(pw, context, fn_el);
1006
0
      }
1007
3
    }
1008
3
    set_i = isl_set_intersect(isl_set_copy(pw->p[i].set),
1009
3
             isl_set_copy(context));
1010
3
    empty = isl_set_plain_is_empty(set_i);
1011
3
    pw->p[i].
FIELD3
= fn_el(pw->p[i].
FIELD3
, set_i);
1012
3
    pw->p[i].set = fn_dom(pw->p[i].set, isl_basic_set_copy(hull));
1013
3
    if (
empty < 0 || 3
!pw->p[i].3
FIELD3
||
!pw->p[i].set3
)
1014
0
      goto error;
1015
3
    
if (3
empty3
) {
1016
0
      isl_set_free(pw->p[i].set);
1017
0
      
FN0
(EL,free)(pw->p[i].
FIELD0
);
1018
0
      if (i != pw->n - 1)
1019
0
        pw->p[i] = pw->p[pw->n - 1];
1020
0
      pw->n--;
1021
0
    }
1022
3
  }
1023
3
1024
3
  isl_basic_set_free(hull);
1025
3
  isl_set_free(context);
1026
3
1027
3
  return pw;
1028
0
error:
1029
0
  FN(PW,free)(pw);
1030
0
  isl_basic_set_free(hull);
1031
0
  isl_set_free(context);
1032
0
  return NULL;
1033
4
}
isl_aff.c:isl_pw_aff_gist_aligned
Line
Count
Source
947
11.2k
{
948
11.2k
  int i;
949
11.2k
  int is_universe;
950
11.2k
  isl_bool aligned;
951
11.2k
  isl_basic_set *hull = NULL;
952
11.2k
953
11.2k
  if (
!pw || 11.2k
!context11.2k
)
954
0
    goto error;
955
11.2k
956
11.2k
  
if (11.2k
pw->n == 011.2k
) {
957
0
    isl_set_free(context);
958
0
    return pw;
959
0
  }
960
11.2k
961
11.2k
  is_universe = isl_set_plain_is_universe(context);
962
11.2k
  if (is_universe < 0)
963
0
    goto error;
964
11.2k
  
if (11.2k
is_universe11.2k
) {
965
1.05k
    isl_set_free(context);
966
1.05k
    return pw;
967
1.05k
  }
968
11.2k
969
10.2k
  aligned = isl_set_space_has_equal_params(context, pw->dim);
970
10.2k
  if (aligned < 0)
971
0
    goto error;
972
10.2k
  
if (10.2k
!aligned10.2k
) {
973
0
    pw = FN(PW,align_params)(pw, isl_set_get_space(context));
974
0
    context = isl_set_align_params(context, FN(PW,get_space)(pw));
975
0
  }
976
10.2k
977
10.2k
  pw = FN(PW,cow)(pw);
978
10.2k
  if (!pw)
979
0
    goto error;
980
10.2k
981
10.2k
  
if (10.2k
pw->n == 110.2k
) {
982
10.1k
    int equal;
983
10.1k
984
10.1k
    equal = isl_set_plain_is_equal(pw->p[0].set, context);
985
10.1k
    if (equal < 0)
986
0
      goto error;
987
10.1k
    
if (10.1k
equal10.1k
)
988
8.22k
      
return 8.22k
FN8.22k
(PW,gist_last)(pw, context, fn_el);
989
10.1k
  }
990
10.2k
991
1.99k
  context = isl_set_compute_divs(context);
992
1.99k
  hull = isl_set_simple_hull(isl_set_copy(context));
993
1.99k
994
4.01k
  for (i = pw->n - 1; 
i >= 04.01k
;
--i2.02k
) {
995
2.02k
    isl_set *set_i;
996
2.02k
    int empty;
997
2.02k
998
2.02k
    if (
i == pw->n - 12.02k
) {
999
1.99k
      int equal;
1000
1.99k
      equal = isl_set_plain_is_equal(pw->p[i].set, context);
1001
1.99k
      if (equal < 0)
1002
0
        goto error;
1003
1.99k
      
if (1.99k
equal1.99k
) {
1004
0
        isl_basic_set_free(hull);
1005
0
        return FN(PW,gist_last)(pw, context, fn_el);
1006
0
      }
1007
1.99k
    }
1008
2.02k
    set_i = isl_set_intersect(isl_set_copy(pw->p[i].set),
1009
2.02k
             isl_set_copy(context));
1010
2.02k
    empty = isl_set_plain_is_empty(set_i);
1011
2.02k
    pw->p[i].
FIELD2.02k
= fn_el(pw->p[i].
FIELD2.02k
, set_i);
1012
2.02k
    pw->p[i].set = fn_dom(pw->p[i].set, isl_basic_set_copy(hull));
1013
2.02k
    if (
empty < 0 || 2.02k
!pw->p[i].2.02k
FIELD2.02k
||
!pw->p[i].set2.02k
)
1014
0
      goto error;
1015
2.02k
    
if (2.02k
empty2.02k
) {
1016
0
      isl_set_free(pw->p[i].set);
1017
0
      
FN0
(EL,free)(pw->p[i].
FIELD0
);
1018
0
      if (i != pw->n - 1)
1019
0
        pw->p[i] = pw->p[pw->n - 1];
1020
0
      pw->n--;
1021
0
    }
1022
2.02k
  }
1023
1.99k
1024
1.99k
  isl_basic_set_free(hull);
1025
1.99k
  isl_set_free(context);
1026
1.99k
1027
1.99k
  return pw;
1028
0
error:
1029
0
  FN(PW,free)(pw);
1030
0
  isl_basic_set_free(hull);
1031
0
  isl_set_free(context);
1032
0
  return NULL;
1033
11.2k
}
isl_aff.c:isl_pw_multi_aff_gist_aligned
Line
Count
Source
947
2.09k
{
948
2.09k
  int i;
949
2.09k
  int is_universe;
950
2.09k
  isl_bool aligned;
951
2.09k
  isl_basic_set *hull = NULL;
952
2.09k
953
2.09k
  if (
!pw || 2.09k
!context2.09k
)
954
0
    goto error;
955
2.09k
956
2.09k
  
if (2.09k
pw->n == 02.09k
) {
957
0
    isl_set_free(context);
958
0
    return pw;
959
0
  }
960
2.09k
961
2.09k
  is_universe = isl_set_plain_is_universe(context);
962
2.09k
  if (is_universe < 0)
963
0
    goto error;
964
2.09k
  
if (2.09k
is_universe2.09k
) {
965
69
    isl_set_free(context);
966
69
    return pw;
967
69
  }
968
2.09k
969
2.02k
  aligned = isl_set_space_has_equal_params(context, pw->dim);
970
2.02k
  if (aligned < 0)
971
0
    goto error;
972
2.02k
  
if (2.02k
!aligned2.02k
) {
973
0
    pw = FN(PW,align_params)(pw, isl_set_get_space(context));
974
0
    context = isl_set_align_params(context, FN(PW,get_space)(pw));
975
0
  }
976
2.02k
977
2.02k
  pw = FN(PW,cow)(pw);
978
2.02k
  if (!pw)
979
0
    goto error;
980
2.02k
981
2.02k
  
if (2.02k
pw->n == 12.02k
) {
982
2.02k
    int equal;
983
2.02k
984
2.02k
    equal = isl_set_plain_is_equal(pw->p[0].set, context);
985
2.02k
    if (equal < 0)
986
0
      goto error;
987
2.02k
    
if (2.02k
equal2.02k
)
988
1.92k
      
return 1.92k
FN1.92k
(PW,gist_last)(pw, context, fn_el);
989
2.02k
  }
990
2.02k
991
101
  context = isl_set_compute_divs(context);
992
101
  hull = isl_set_simple_hull(isl_set_copy(context));
993
101
994
202
  for (i = pw->n - 1; 
i >= 0202
;
--i101
) {
995
101
    isl_set *set_i;
996
101
    int empty;
997
101
998
101
    if (
i == pw->n - 1101
) {
999
101
      int equal;
1000
101
      equal = isl_set_plain_is_equal(pw->p[i].set, context);
1001
101
      if (equal < 0)
1002
0
        goto error;
1003
101
      
if (101
equal101
) {
1004
0
        isl_basic_set_free(hull);
1005
0
        return FN(PW,gist_last)(pw, context, fn_el);
1006
0
      }
1007
101
    }
1008
101
    set_i = isl_set_intersect(isl_set_copy(pw->p[i].set),
1009
101
             isl_set_copy(context));
1010
101
    empty = isl_set_plain_is_empty(set_i);
1011
101
    pw->p[i].
FIELD101
= fn_el(pw->p[i].
FIELD101
, set_i);
1012
101
    pw->p[i].set = fn_dom(pw->p[i].set, isl_basic_set_copy(hull));
1013
101
    if (
empty < 0 || 101
!pw->p[i].101
FIELD101
||
!pw->p[i].set101
)
1014
0
      goto error;
1015
101
    
if (101
empty101
) {
1016
1
      isl_set_free(pw->p[i].set);
1017
1
      
FN1
(EL,free)(pw->p[i].
FIELD1
);
1018
1
      if (i != pw->n - 1)
1019
0
        pw->p[i] = pw->p[pw->n - 1];
1020
1
      pw->n--;
1021
1
    }
1022
101
  }
1023
101
1024
101
  isl_basic_set_free(hull);
1025
101
  isl_set_free(context);
1026
101
1027
101
  return pw;
1028
0
error:
1029
0
  FN(PW,free)(pw);
1030
0
  isl_basic_set_free(hull);
1031
0
  isl_set_free(context);
1032
0
  return NULL;
1033
2.09k
}
1034
1035
static __isl_give PW *FN(PW,gist_domain_aligned)(__isl_take PW *pw,
1036
  __isl_take isl_set *set)
1037
13.3k
{
1038
13.3k
  return 
FN13.3k
(PW,gist_aligned)(pw, set, &
FN13.3k
(EL,gist),
1039
13.3k
          &isl_set_gist_basic_set);
1040
13.3k
}
isl_polynomial.c:isl_pw_qpolynomial_gist_domain_aligned
Line
Count
Source
1037
4
{
1038
4
  return 
FN4
(PW,gist_aligned)(pw, set, &
FN4
(EL,gist),
1039
4
          &isl_set_gist_basic_set);
1040
4
}
isl_aff.c:isl_pw_multi_aff_gist_domain_aligned
Line
Count
Source
1037
2.09k
{
1038
2.09k
  return 
FN2.09k
(PW,gist_aligned)(pw, set, &
FN2.09k
(EL,gist),
1039
2.09k
          &isl_set_gist_basic_set);
1040
2.09k
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_gist_domain_aligned
isl_aff.c:isl_pw_aff_gist_domain_aligned
Line
Count
Source
1037
11.2k
{
1038
11.2k
  return 
FN11.2k
(PW,gist_aligned)(pw, set, &
FN11.2k
(EL,gist),
1039
11.2k
          &isl_set_gist_basic_set);
1040
11.2k
}
1041
1042
__isl_give PW *FN(PW,gist)(__isl_take PW *pw, __isl_take isl_set *context)
1043
13.3k
{
1044
13.3k
  return FN(PW,align_params_pw_set_and)(pw, context,
1045
13.3k
            &FN(PW,gist_domain_aligned));
1046
13.3k
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_gist
isl_pw_qpolynomial_gist
Line
Count
Source
1043
4
{
1044
4
  return FN(PW,align_params_pw_set_and)(pw, context,
1045
4
            &FN(PW,gist_domain_aligned));
1046
4
}
isl_pw_multi_aff_gist
Line
Count
Source
1043
2.09k
{
1044
2.09k
  return FN(PW,align_params_pw_set_and)(pw, context,
1045
2.09k
            &FN(PW,gist_domain_aligned));
1046
2.09k
}
isl_pw_aff_gist
Line
Count
Source
1043
11.2k
{
1044
11.2k
  return FN(PW,align_params_pw_set_and)(pw, context,
1045
11.2k
            &FN(PW,gist_domain_aligned));
1046
11.2k
}
1047
1048
static __isl_give PW *FN(PW,gist_params_aligned)(__isl_take PW *pw,
1049
  __isl_take isl_set *set)
1050
0
{
1051
0
  return 
FN0
(PW,gist_aligned)(pw, set, &
FN0
(EL,gist_params),
1052
0
          &isl_set_gist_params_basic_set);
1053
0
}
Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_gist_params_aligned
Unexecuted instantiation: isl_aff.c:isl_pw_multi_aff_gist_params_aligned
Unexecuted instantiation: isl_aff.c:isl_pw_aff_gist_params_aligned
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_gist_params_aligned
1054
1055
__isl_give PW *FN(PW,gist_params)(__isl_take PW *pw,
1056
  __isl_take isl_set *context)
1057
0
{
1058
0
  return FN(PW,align_params_pw_set_and)(pw, context,
1059
0
            &FN(PW,gist_params_aligned));
1060
0
}
Unexecuted instantiation: isl_pw_aff_gist_params
Unexecuted instantiation: isl_pw_qpolynomial_gist_params
Unexecuted instantiation: isl_pw_qpolynomial_fold_gist_params
Unexecuted instantiation: isl_pw_multi_aff_gist_params
1061
1062
/* Return -1 if the piece "p1" should be sorted before "p2"
1063
 * and 1 if it should be sorted after "p2".
1064
 * Return 0 if they do not need to be sorted in a specific order.
1065
 *
1066
 * The two pieces are compared on the basis of their function value expressions.
1067
 */
1068
static int FN(PW,sort_field_cmp)(const void *p1, const void *p2, void *arg)
1069
2.61k
{
1070
2.61k
  struct FN(PW,piece) const *pc1 = p1;
1071
2.61k
  struct FN(PW,piece) const *pc2 = p2;
1072
2.61k
1073
2.61k
  return 
FN2.61k
(EL,plain_cmp)(pc1->
FIELD2.61k
, pc2->
FIELD2.61k
);
1074
2.61k
}
isl_polynomial.c:isl_pw_qpolynomial_sort_field_cmp
Line
Count
Source
1069
1
{
1070
1
  struct FN(PW,piece) const *pc1 = p1;
1071
1
  struct FN(PW,piece) const *pc2 = p2;
1072
1
1073
1
  return 
FN1
(EL,plain_cmp)(pc1->
FIELD1
, pc2->
FIELD1
);
1074
1
}
isl_aff.c:isl_pw_aff_sort_field_cmp
Line
Count
Source
1069
555
{
1070
555
  struct FN(PW,piece) const *pc1 = p1;
1071
555
  struct FN(PW,piece) const *pc2 = p2;
1072
555
1073
555
  return 
FN555
(EL,plain_cmp)(pc1->
FIELD555
, pc2->
FIELD555
);
1074
555
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_sort_field_cmp
isl_aff.c:isl_pw_multi_aff_sort_field_cmp
Line
Count
Source
1069
2.05k
{
1070
2.05k
  struct FN(PW,piece) const *pc1 = p1;
1071
2.05k
  struct FN(PW,piece) const *pc2 = p2;
1072
2.05k
1073
2.05k
  return 
FN2.05k
(EL,plain_cmp)(pc1->
FIELD2.05k
, pc2->
FIELD2.05k
);
1074
2.05k
}
1075
1076
/* Sort the pieces of "pw" according to their function value
1077
 * expressions and then combine pairs of adjacent pieces with
1078
 * the same such expression.
1079
 *
1080
 * The sorting is performed in place because it does not
1081
 * change the meaning of "pw", but care needs to be
1082
 * taken not to change any possible other copies of "pw"
1083
 * in case anything goes wrong.
1084
 */
1085
__isl_give PW *FN(PW,sort)(__isl_take PW *pw)
1086
27.8k
{
1087
27.8k
  int i, j;
1088
27.8k
  isl_set *set;
1089
27.8k
1090
27.8k
  if (!pw)
1091
1
    return NULL;
1092
27.8k
  
if (27.8k
pw->n <= 127.8k
)
1093
26.8k
    return pw;
1094
933
  
if (933
isl_sort(pw->p, pw->n, sizeof(pw->p[0]),
1095
933
        &FN(PW,sort_field_cmp), NULL) < 0)
1096
0
    
return 0
FN0
(PW,free)(pw);
1097
2.74k
  
for (i = pw->n - 1; 933
i >= 12.74k
;
--i1.81k
) {
1098
1.81k
    if (
!1.81k
FN1.81k
(EL,plain_is_equal)(pw->p[i - 1].
FIELD1.81k
, pw->p[i].
FIELD1.81k
))
1099
1.75k
      continue;
1100
55
    set = isl_set_union(isl_set_copy(pw->p[i - 1].set),
1101
55
            isl_set_copy(pw->p[i].set));
1102
55
    if (!set)
1103
0
      
return 0
FN0
(PW,free)(pw);
1104
55
    isl_set_free(pw->p[i].set);
1105
55
    
FN55
(EL,free)(pw->p[i].
FIELD55
);
1106
55
    isl_set_free(pw->p[i - 1].set);
1107
55
    pw->p[i - 1].set = set;
1108
68
    for (j = i + 1; 
j < pw->n68
;
++j13
)
1109
13
      pw->p[j - 1] = pw->p[j];
1110
1.81k
    pw->n--;
1111
1.81k
  }
1112
933
1113
933
  return pw;
1114
27.8k
}
isl_pw_multi_aff_sort
Line
Count
Source
1086
3.92k
{
1087
3.92k
  int i, j;
1088
3.92k
  isl_set *set;
1089
3.92k
1090
3.92k
  if (!pw)
1091
0
    return NULL;
1092
3.92k
  
if (3.92k
pw->n <= 13.92k
)
1093
3.29k
    return pw;
1094
635
  
if (635
isl_sort(pw->p, pw->n, sizeof(pw->p[0]),
1095
635
        &FN(PW,sort_field_cmp), NULL) < 0)
1096
0
    
return 0
FN0
(PW,free)(pw);
1097
2.02k
  
for (i = pw->n - 1; 635
i >= 12.02k
;
--i1.38k
) {
1098
1.38k
    if (
!1.38k
FN1.38k
(EL,plain_is_equal)(pw->p[i - 1].
FIELD1.38k
, pw->p[i].
FIELD1.38k
))
1099
1.33k
      continue;
1100
48
    set = isl_set_union(isl_set_copy(pw->p[i - 1].set),
1101
48
            isl_set_copy(pw->p[i].set));
1102
48
    if (!set)
1103
0
      
return 0
FN0
(PW,free)(pw);
1104
48
    isl_set_free(pw->p[i].set);
1105
48
    
FN48
(EL,free)(pw->p[i].
FIELD48
);
1106
48
    isl_set_free(pw->p[i - 1].set);
1107
48
    pw->p[i - 1].set = set;
1108
49
    for (j = i + 1; 
j < pw->n49
;
++j1
)
1109
1
      pw->p[j - 1] = pw->p[j];
1110
1.38k
    pw->n--;
1111
1.38k
  }
1112
635
1113
635
  return pw;
1114
3.92k
}
isl_pw_qpolynomial_sort
Line
Count
Source
1086
7
{
1087
7
  int i, j;
1088
7
  isl_set *set;
1089
7
1090
7
  if (!pw)
1091
0
    return NULL;
1092
7
  
if (7
pw->n <= 17
)
1093
6
    return pw;
1094
1
  
if (1
isl_sort(pw->p, pw->n, sizeof(pw->p[0]),
1095
1
        &FN(PW,sort_field_cmp), NULL) < 0)
1096
0
    
return 0
FN0
(PW,free)(pw);
1097
2
  
for (i = pw->n - 1; 1
i >= 12
;
--i1
) {
1098
1
    if (
!1
FN1
(EL,plain_is_equal)(pw->p[i - 1].
FIELD1
, pw->p[i].
FIELD1
))
1099
1
      continue;
1100
0
    set = isl_set_union(isl_set_copy(pw->p[i - 1].set),
1101
0
            isl_set_copy(pw->p[i].set));
1102
0
    if (!set)
1103
0
      
return 0
FN0
(PW,free)(pw);
1104
0
    isl_set_free(pw->p[i].set);
1105
0
    
FN0
(EL,free)(pw->p[i].
FIELD0
);
1106
0
    isl_set_free(pw->p[i - 1].set);
1107
0
    pw->p[i - 1].set = set;
1108
0
    for (j = i + 1; 
j < pw->n0
;
++j0
)
1109
0
      pw->p[j - 1] = pw->p[j];
1110
1
    pw->n--;
1111
1
  }
1112
1
1113
1
  return pw;
1114
7
}
isl_pw_aff_sort
Line
Count
Source
1086
23.8k
{
1087
23.8k
  int i, j;
1088
23.8k
  isl_set *set;
1089
23.8k
1090
23.8k
  if (!pw)
1091
1
    return NULL;
1092
23.8k
  
if (23.8k
pw->n <= 123.8k
)
1093
23.6k
    return pw;
1094
297
  
if (297
isl_sort(pw->p, pw->n, sizeof(pw->p[0]),
1095
297
        &FN(PW,sort_field_cmp), NULL) < 0)
1096
0
    
return 0
FN0
(PW,free)(pw);
1097
721
  
for (i = pw->n - 1; 297
i >= 1721
;
--i424
) {
1098
424
    if (
!424
FN424
(EL,plain_is_equal)(pw->p[i - 1].
FIELD424
, pw->p[i].
FIELD424
))
1099
417
      continue;
1100
7
    set = isl_set_union(isl_set_copy(pw->p[i - 1].set),
1101
7
            isl_set_copy(pw->p[i].set));
1102
7
    if (!set)
1103
0
      
return 0
FN0
(PW,free)(pw);
1104
7
    isl_set_free(pw->p[i].set);
1105
7
    
FN7
(EL,free)(pw->p[i].
FIELD7
);
1106
7
    isl_set_free(pw->p[i - 1].set);
1107
7
    pw->p[i - 1].set = set;
1108
19
    for (j = i + 1; 
j < pw->n19
;
++j12
)
1109
12
      pw->p[j - 1] = pw->p[j];
1110
424
    pw->n--;
1111
424
  }
1112
297
1113
297
  return pw;
1114
23.8k
}
isl_pw_qpolynomial_fold_sort
Line
Count
Source
1086
2
{
1087
2
  int i, j;
1088
2
  isl_set *set;
1089
2
1090
2
  if (!pw)
1091
0
    return NULL;
1092
2
  
if (2
pw->n <= 12
)
1093
2
    return pw;
1094
0
  
if (0
isl_sort(pw->p, pw->n, sizeof(pw->p[0]),
1095
0
        &FN(PW,sort_field_cmp), NULL) < 0)
1096
0
    
return 0
FN0
(PW,free)(pw);
1097
0
  
for (i = pw->n - 1; 0
i >= 10
;
--i0
) {
1098
0
    if (
!0
FN0
(EL,plain_is_equal)(pw->p[i - 1].
FIELD0
, pw->p[i].
FIELD0
))
1099
0
      continue;
1100
0
    set = isl_set_union(isl_set_copy(pw->p[i - 1].set),
1101
0
            isl_set_copy(pw->p[i].set));
1102
0
    if (!set)
1103
0
      
return 0
FN0
(PW,free)(pw);
1104
0
    isl_set_free(pw->p[i].set);
1105
0
    
FN0
(EL,free)(pw->p[i].
FIELD0
);
1106
0
    isl_set_free(pw->p[i - 1].set);
1107
0
    pw->p[i - 1].set = set;
1108
0
    for (j = i + 1; 
j < pw->n0
;
++j0
)
1109
0
      pw->p[j - 1] = pw->p[j];
1110
0
    pw->n--;
1111
0
  }
1112
0
1113
0
  return pw;
1114
2
}
1115
1116
/* Coalesce the domains of "pw".
1117
 *
1118
 * Prior to the actual coalescing, first sort the pieces such that
1119
 * pieces with the same function value expression are combined
1120
 * into a single piece, the combined domain of which can then
1121
 * be coalesced.
1122
 */
1123
__isl_give PW *FN(PW,coalesce)(__isl_take PW *pw)
1124
24.0k
{
1125
24.0k
  int i;
1126
24.0k
1127
24.0k
  pw = FN(PW,sort)(pw);
1128
24.0k
  if (!pw)
1129
1
    return NULL;
1130
24.0k
1131
48.5k
  
for (i = 0; 24.0k
i < pw->n48.5k
;
++i24.5k
) {
1132
24.5k
    pw->p[i].set = isl_set_coalesce(pw->p[i].set);
1133
24.5k
    if (!pw->p[i].set)
1134
0
      goto error;
1135
24.5k
  }
1136
24.0k
1137
24.0k
  return pw;
1138
0
error:
1139
0
  FN(PW,free)(pw);
1140
0
  return NULL;
1141
24.0k
}
isl_pw_aff_coalesce
Line
Count
Source
1124
23.0k
{
1125
23.0k
  int i;
1126
23.0k
1127
23.0k
  pw = FN(PW,sort)(pw);
1128
23.0k
  if (!pw)
1129
1
    return NULL;
1130
23.0k
1131
46.4k
  
for (i = 0; 23.0k
i < pw->n46.4k
;
++i23.3k
) {
1132
23.3k
    pw->p[i].set = isl_set_coalesce(pw->p[i].set);
1133
23.3k
    if (!pw->p[i].set)
1134
0
      goto error;
1135
23.3k
  }
1136
23.0k
1137
23.0k
  return pw;
1138
0
error:
1139
0
  FN(PW,free)(pw);
1140
0
  return NULL;
1141
23.0k
}
isl_pw_multi_aff_coalesce
Line
Count
Source
1124
1.05k
{
1125
1.05k
  int i;
1126
1.05k
1127
1.05k
  pw = FN(PW,sort)(pw);
1128
1.05k
  if (!pw)
1129
0
    return NULL;
1130
1.05k
1131
2.16k
  
for (i = 0; 1.05k
i < pw->n2.16k
;
++i1.11k
) {
1132
1.11k
    pw->p[i].set = isl_set_coalesce(pw->p[i].set);
1133
1.11k
    if (!pw->p[i].set)
1134
0
      goto error;
1135
1.11k
  }
1136
1.05k
1137
1.05k
  return pw;
1138
0
error:
1139
0
  FN(PW,free)(pw);
1140
0
  return NULL;
1141
1.05k
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_coalesce
isl_pw_qpolynomial_coalesce
Line
Count
Source
1124
1
{
1125
1
  int i;
1126
1
1127
1
  pw = FN(PW,sort)(pw);
1128
1
  if (!pw)
1129
0
    return NULL;
1130
1
1131
3
  
for (i = 0; 1
i < pw->n3
;
++i2
) {
1132
2
    pw->p[i].set = isl_set_coalesce(pw->p[i].set);
1133
2
    if (!pw->p[i].set)
1134
0
      goto error;
1135
2
  }
1136
1
1137
1
  return pw;
1138
0
error:
1139
0
  FN(PW,free)(pw);
1140
0
  return NULL;
1141
1
}
1142
1143
isl_ctx *FN(PW,get_ctx)(__isl_keep PW *pw)
1144
26.5k
{
1145
26.5k
  return pw ? isl_space_get_ctx(pw->dim) : NULL;
1146
26.5k
}
isl_pw_multi_aff_get_ctx
Line
Count
Source
1144
2.95k
{
1145
2.95k
  return pw ? isl_space_get_ctx(pw->dim) : NULL;
1146
2.95k
}
isl_pw_qpolynomial_get_ctx
Line
Count
Source
1144
1
{
1145
1
  return pw ? isl_space_get_ctx(pw->dim) : NULL;
1146
1
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_get_ctx
isl_pw_aff_get_ctx
Line
Count
Source
1144
23.5k
{
1145
23.5k
  return pw ? isl_space_get_ctx(pw->dim) : NULL;
1146
23.5k
}
1147
1148
#ifndef NO_INVOLVES_DIMS
1149
isl_bool FN(PW,involves_dims)(__isl_keep PW *pw, enum isl_dim_type type,
1150
  unsigned first, unsigned n)
1151
91
{
1152
91
  int i;
1153
91
  enum isl_dim_type set_type;
1154
91
1155
91
  if (!pw)
1156
0
    return isl_bool_error;
1157
91
  
if (91
pw->n == 0 || 91
n == 091
)
1158
0
    return isl_bool_false;
1159
91
1160
91
  
set_type = type == isl_dim_in ? 91
isl_dim_set91
:
type0
;
1161
91
1162
182
  for (i = 0; 
i < pw->n182
;
++i91
) {
1163
91
    isl_bool involves = 
FN91
(EL,involves_dims)(pw->p[i].
FIELD91
,
1164
91
              type, first, n);
1165
91
    if (
involves < 0 || 91
involves91
)
1166
0
      return involves;
1167
91
    involves = isl_set_involves_dims(pw->p[i].set,
1168
91
              set_type, first, n);
1169
91
    if (
involves < 0 || 91
involves91
)
1170
0
      return involves;
1171
91
  }
1172
91
  return isl_bool_false;
1173
91
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_involves_dims
Unexecuted instantiation: isl_pw_qpolynomial_involves_dims
isl_pw_aff_involves_dims
Line
Count
Source
1151
91
{
1152
91
  int i;
1153
91
  enum isl_dim_type set_type;
1154
91
1155
91
  if (!pw)
1156
0
    return isl_bool_error;
1157
91
  
if (91
pw->n == 0 || 91
n == 091
)
1158
0
    return isl_bool_false;
1159
91
1160
91
  
set_type = type == isl_dim_in ? 91
isl_dim_set91
:
type0
;
1161
91
1162
182
  for (i = 0; 
i < pw->n182
;
++i91
) {
1163
91
    isl_bool involves = 
FN91
(EL,involves_dims)(pw->p[i].
FIELD91
,
1164
91
              type, first, n);
1165
91
    if (
involves < 0 || 91
involves91
)
1166
0
      return involves;
1167
91
    involves = isl_set_involves_dims(pw->p[i].set,
1168
91
              set_type, first, n);
1169
91
    if (
involves < 0 || 91
involves91
)
1170
0
      return involves;
1171
91
  }
1172
91
  return isl_bool_false;
1173
91
}
1174
#endif
1175
1176
__isl_give PW *FN(PW,set_dim_name)(__isl_take PW *pw,
1177
  enum isl_dim_type type, unsigned pos, const char *s)
1178
0
{
1179
0
  int i;
1180
0
  enum isl_dim_type set_type;
1181
0
1182
0
  pw = FN(PW,cow)(pw);
1183
0
  if (!pw)
1184
0
    return NULL;
1185
0
1186
0
  
set_type = type == isl_dim_in ? 0
isl_dim_set0
:
type0
;
1187
0
1188
0
  pw->dim = isl_space_set_dim_name(pw->dim, type, pos, s);
1189
0
  if (!pw->dim)
1190
0
    goto error;
1191
0
1192
0
  
for (i = 0; 0
i < pw->n0
;
++i0
) {
1193
0
    pw->p[i].set = isl_set_set_dim_name(pw->p[i].set,
1194
0
              set_type, pos, s);
1195
0
    if (!pw->p[i].set)
1196
0
      goto error;
1197
0
    
pw->p[i].0
FIELD0
=
FN0
(EL,set_dim_name)(pw->p[i].
FIELD0
, type, pos, s);
1198
0
    if (
!pw->p[i].0
FIELD0
)
1199
0
      goto error;
1200
0
  }
1201
0
1202
0
  return pw;
1203
0
error:
1204
0
  FN(PW,free)(pw);
1205
0
  return NULL;
1206
0
}
Unexecuted instantiation: isl_pw_multi_aff_set_dim_name
Unexecuted instantiation: isl_pw_aff_set_dim_name
Unexecuted instantiation: isl_pw_qpolynomial_set_dim_name
Unexecuted instantiation: isl_pw_qpolynomial_fold_set_dim_name
1207
1208
#ifndef NO_DROP_DIMS
1209
__isl_give PW *FN(PW,drop_dims)(__isl_take PW *pw,
1210
  enum isl_dim_type type, unsigned first, unsigned n)
1211
641
{
1212
641
  int i;
1213
641
  enum isl_dim_type set_type;
1214
641
1215
641
  if (!pw)
1216
0
    return NULL;
1217
641
  
if (641
n == 0 && 641
!isl_space_get_tuple_name(pw->dim, type)0
)
1218
0
    return pw;
1219
641
1220
641
  
set_type = type == isl_dim_in ? 641
isl_dim_set91
:
type550
;
1221
641
1222
641
  pw = FN(PW,cow)(pw);
1223
641
  if (!pw)
1224
0
    return NULL;
1225
641
  pw->dim = isl_space_drop_dims(pw->dim, type, first, n);
1226
641
  if (!pw->dim)
1227
0
    goto error;
1228
1.28k
  
for (i = 0; 641
i < pw->n1.28k
;
++i641
) {
1229
641
    pw->p[i].
FIELD641
=
FN641
(EL,drop_dims)(pw->p[i].
FIELD641
, type, first, n);
1230
641
    if (
!pw->p[i].641
FIELD641
)
1231
0
      goto error;
1232
641
    
if (641
type == isl_dim_out641
)
1233
550
      continue;
1234
91
    pw->p[i].set = isl_set_drop(pw->p[i].set, set_type, first, n);
1235
91
    if (!pw->p[i].set)
1236
0
      goto error;
1237
641
  }
1238
641
1239
641
  return pw;
1240
0
error:
1241
0
  FN(PW,free)(pw);
1242
0
  return NULL;
1243
641
}
Unexecuted instantiation: isl_pw_qpolynomial_drop_dims
isl_pw_multi_aff_drop_dims
Line
Count
Source
1211
550
{
1212
550
  int i;
1213
550
  enum isl_dim_type set_type;
1214
550
1215
550
  if (!pw)
1216
0
    return NULL;
1217
550
  
if (550
n == 0 && 550
!isl_space_get_tuple_name(pw->dim, type)0
)
1218
0
    return pw;
1219
550
1220
550
  
set_type = type == isl_dim_in ? 550
isl_dim_set0
:
type550
;
1221
550
1222
550
  pw = FN(PW,cow)(pw);
1223
550
  if (!pw)
1224
0
    return NULL;
1225
550
  pw->dim = isl_space_drop_dims(pw->dim, type, first, n);
1226
550
  if (!pw->dim)
1227
0
    goto error;
1228
1.10k
  
for (i = 0; 550
i < pw->n1.10k
;
++i550
) {
1229
550
    pw->p[i].
FIELD550
=
FN550
(EL,drop_dims)(pw->p[i].
FIELD550
, type, first, n);
1230
550
    if (
!pw->p[i].550
FIELD550
)
1231
0
      goto error;
1232
550
    
if (550
type == isl_dim_out550
)
1233
550
      continue;
1234
0
    pw->p[i].set = isl_set_drop(pw->p[i].set, set_type, first, n);
1235
0
    if (!pw->p[i].set)
1236
0
      goto error;
1237
550
  }
1238
550
1239
550
  return pw;
1240
0
error:
1241
0
  FN(PW,free)(pw);
1242
0
  return NULL;
1243
550
}
isl_pw_aff_drop_dims
Line
Count
Source
1211
91
{
1212
91
  int i;
1213
91
  enum isl_dim_type set_type;
1214
91
1215
91
  if (!pw)
1216
0
    return NULL;
1217
91
  
if (91
n == 0 && 91
!isl_space_get_tuple_name(pw->dim, type)0
)
1218
0
    return pw;
1219
91
1220
91
  
set_type = type == isl_dim_in ? 91
isl_dim_set91
:
type0
;
1221
91
1222
91
  pw = FN(PW,cow)(pw);
1223
91
  if (!pw)
1224
0
    return NULL;
1225
91
  pw->dim = isl_space_drop_dims(pw->dim, type, first, n);
1226
91
  if (!pw->dim)
1227
0
    goto error;
1228
182
  
for (i = 0; 91
i < pw->n182
;
++i91
) {
1229
91
    pw->p[i].
FIELD91
=
FN91
(EL,drop_dims)(pw->p[i].
FIELD91
, type, first, n);
1230
91
    if (
!pw->p[i].91
FIELD91
)
1231
0
      goto error;
1232
91
    
if (91
type == isl_dim_out91
)
1233
0
      continue;
1234
91
    pw->p[i].set = isl_set_drop(pw->p[i].set, set_type, first, n);
1235
91
    if (!pw->p[i].set)
1236
0
      goto error;
1237
91
  }
1238
91
1239
91
  return pw;
1240
0
error:
1241
0
  FN(PW,free)(pw);
1242
0
  return NULL;
1243
91
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_drop_dims
1244
1245
/* This function is very similar to drop_dims.
1246
 * The only difference is that the cells may still involve
1247
 * the specified dimensions.  They are removed using
1248
 * isl_set_project_out instead of isl_set_drop.
1249
 */
1250
__isl_give PW *FN(PW,project_out)(__isl_take PW *pw,
1251
  enum isl_dim_type type, unsigned first, unsigned n)
1252
114
{
1253
114
  int i;
1254
114
  enum isl_dim_type set_type;
1255
114
1256
114
  if (!pw)
1257
0
    return NULL;
1258
114
  
if (114
n == 0 && 114
!isl_space_get_tuple_name(pw->dim, type)1
)
1259
0
    return pw;
1260
114
1261
114
  
set_type = type == isl_dim_in ? 114
isl_dim_set114
:
type0
;
1262
114
1263
114
  pw = FN(PW,cow)(pw);
1264
114
  if (!pw)
1265
0
    return NULL;
1266
114
  pw->dim = isl_space_drop_dims(pw->dim, type, first, n);
1267
114
  if (!pw->dim)
1268
0
    goto error;
1269
337
  
for (i = 0; 114
i < pw->n337
;
++i223
) {
1270
223
    pw->p[i].set = isl_set_project_out(pw->p[i].set,
1271
223
              set_type, first, n);
1272
223
    if (!pw->p[i].set)
1273
0
      goto error;
1274
223
    
pw->p[i].223
FIELD223
=
FN223
(EL,drop_dims)(pw->p[i].
FIELD223
, type, first, n);
1275
223
    if (
!pw->p[i].223
FIELD223
)
1276
0
      goto error;
1277
223
  }
1278
114
1279
114
  return pw;
1280
0
error:
1281
0
  FN(PW,free)(pw);
1282
0
  return NULL;
1283
114
}
isl_pw_qpolynomial_fold_project_out
Line
Count
Source
1252
1
{
1253
1
  int i;
1254
1
  enum isl_dim_type set_type;
1255
1
1256
1
  if (!pw)
1257
0
    return NULL;
1258
1
  
if (1
n == 0 && 1
!isl_space_get_tuple_name(pw->dim, type)1
)
1259
0
    return pw;
1260
1
1261
1
  
set_type = type == isl_dim_in ? 1
isl_dim_set1
:
type0
;
1262
1
1263
1
  pw = FN(PW,cow)(pw);
1264
1
  if (!pw)
1265
0
    return NULL;
1266
1
  pw->dim = isl_space_drop_dims(pw->dim, type, first, n);
1267
1
  if (!pw->dim)
1268
0
    goto error;
1269
2
  
for (i = 0; 1
i < pw->n2
;
++i1
) {
1270
1
    pw->p[i].set = isl_set_project_out(pw->p[i].set,
1271
1
              set_type, first, n);
1272
1
    if (!pw->p[i].set)
1273
0
      goto error;
1274
1
    
pw->p[i].1
FIELD1
=
FN1
(EL,drop_dims)(pw->p[i].
FIELD1
, type, first, n);
1275
1
    if (
!pw->p[i].1
FIELD1
)
1276
0
      goto error;
1277
1
  }
1278
1
1279
1
  return pw;
1280
0
error:
1281
0
  FN(PW,free)(pw);
1282
0
  return NULL;
1283
1
}
Unexecuted instantiation: isl_pw_aff_project_out
Unexecuted instantiation: isl_pw_qpolynomial_project_out
isl_pw_multi_aff_project_out
Line
Count
Source
1252
113
{
1253
113
  int i;
1254
113
  enum isl_dim_type set_type;
1255
113
1256
113
  if (!pw)
1257
0
    return NULL;
1258
113
  
if (113
n == 0 && 113
!isl_space_get_tuple_name(pw->dim, type)0
)
1259
0
    return pw;
1260
113
1261
113
  
set_type = type == isl_dim_in ? 113
isl_dim_set113
:
type0
;
1262
113
1263
113
  pw = FN(PW,cow)(pw);
1264
113
  if (!pw)
1265
0
    return NULL;
1266
113
  pw->dim = isl_space_drop_dims(pw->dim, type, first, n);
1267
113
  if (!pw->dim)
1268
0
    goto error;
1269
335
  
for (i = 0; 113
i < pw->n335
;
++i222
) {
1270
222
    pw->p[i].set = isl_set_project_out(pw->p[i].set,
1271
222
              set_type, first, n);
1272
222
    if (!pw->p[i].set)
1273
0
      goto error;
1274
222
    
pw->p[i].222
FIELD222
=
FN222
(EL,drop_dims)(pw->p[i].
FIELD222
, type, first, n);
1275
222
    if (
!pw->p[i].222
FIELD222
)
1276
0
      goto error;
1277
222
  }
1278
113
1279
113
  return pw;
1280
0
error:
1281
0
  FN(PW,free)(pw);
1282
0
  return NULL;
1283
113
}
1284
1285
/* Project the domain of pw onto its parameter space.
1286
 */
1287
__isl_give PW *FN(PW,project_domain_on_params)(__isl_take PW *pw)
1288
1
{
1289
1
  isl_space *space;
1290
1
  unsigned n;
1291
1
1292
1
  n = FN(PW,dim)(pw, isl_dim_in);
1293
1
  pw = FN(PW,project_out)(pw, isl_dim_in, 0, n);
1294
1
  space = FN(PW,get_domain_space)(pw);
1295
1
  space = isl_space_params(space);
1296
1
  pw = FN(PW,reset_domain_space)(pw, space);
1297
1
  return pw;
1298
1
}
Unexecuted instantiation: isl_pw_qpolynomial_project_domain_on_params
isl_pw_qpolynomial_fold_project_domain_on_params
Line
Count
Source
1288
1
{
1289
1
  isl_space *space;
1290
1
  unsigned n;
1291
1
1292
1
  n = FN(PW,dim)(pw, isl_dim_in);
1293
1
  pw = FN(PW,project_out)(pw, isl_dim_in, 0, n);
1294
1
  space = FN(PW,get_domain_space)(pw);
1295
1
  space = isl_space_params(space);
1296
1
  pw = FN(PW,reset_domain_space)(pw, space);
1297
1
  return pw;
1298
1
}
Unexecuted instantiation: isl_pw_multi_aff_project_domain_on_params
Unexecuted instantiation: isl_pw_aff_project_domain_on_params
1299
#endif
1300
1301
#ifndef NO_INSERT_DIMS
1302
__isl_give PW *FN(PW,insert_dims)(__isl_take PW *pw, enum isl_dim_type type,
1303
  unsigned first, unsigned n)
1304
3.33k
{
1305
3.33k
  int i;
1306
3.33k
  enum isl_dim_type set_type;
1307
3.33k
1308
3.33k
  if (!pw)
1309
0
    return NULL;
1310
3.33k
  
if (3.33k
n == 0 && 3.33k
!isl_space_is_named_or_nested(pw->dim, type)0
)
1311
0
    return pw;
1312
3.33k
1313
3.33k
  
set_type = type == isl_dim_in ? 3.33k
isl_dim_set3.33k
:
type0
;
1314
3.33k
1315
3.33k
  pw = FN(PW,cow)(pw);
1316
3.33k
  if (!pw)
1317
0
    return NULL;
1318
3.33k
1319
3.33k
  pw->dim = isl_space_insert_dims(pw->dim, type, first, n);
1320
3.33k
  if (!pw->dim)
1321
0
    goto error;
1322
3.33k
1323
6.66k
  
for (i = 0; 3.33k
i < pw->n6.66k
;
++i3.33k
) {
1324
3.33k
    pw->p[i].set = isl_set_insert_dims(pw->p[i].set,
1325
3.33k
                  set_type, first, n);
1326
3.33k
    if (!pw->p[i].set)
1327
0
      goto error;
1328
3.33k
    
pw->p[i].3.33k
FIELD3.33k
=
FN3.33k
(EL,insert_dims)(pw->p[i].
FIELD3.33k
,
1329
3.33k
                type, first, n);
1330
3.33k
    if (
!pw->p[i].3.33k
FIELD3.33k
)
1331
0
      goto error;
1332
3.33k
  }
1333
3.33k
1334
3.33k
  return pw;
1335
0
error:
1336
0
  FN(PW,free)(pw);
1337
0
  return NULL;
1338
3.33k
}
isl_pw_aff_insert_dims
Line
Count
Source
1304
3.33k
{
1305
3.33k
  int i;
1306
3.33k
  enum isl_dim_type set_type;
1307
3.33k
1308
3.33k
  if (!pw)
1309
0
    return NULL;
1310
3.33k
  
if (3.33k
n == 0 && 3.33k
!isl_space_is_named_or_nested(pw->dim, type)0
)
1311
0
    return pw;
1312
3.33k
1313
3.33k
  
set_type = type == isl_dim_in ? 3.33k
isl_dim_set3.33k
:
type0
;
1314
3.33k
1315
3.33k
  pw = FN(PW,cow)(pw);
1316
3.33k
  if (!pw)
1317
0
    return NULL;
1318
3.33k
1319
3.33k
  pw->dim = isl_space_insert_dims(pw->dim, type, first, n);
1320
3.33k
  if (!pw->dim)
1321
0
    goto error;
1322
3.33k
1323
6.66k
  
for (i = 0; 3.33k
i < pw->n6.66k
;
++i3.33k
) {
1324
3.33k
    pw->p[i].set = isl_set_insert_dims(pw->p[i].set,
1325
3.33k
                  set_type, first, n);
1326
3.33k
    if (!pw->p[i].set)
1327
0
      goto error;
1328
3.33k
    
pw->p[i].3.33k
FIELD3.33k
=
FN3.33k
(EL,insert_dims)(pw->p[i].
FIELD3.33k
,
1329
3.33k
                type, first, n);
1330
3.33k
    if (
!pw->p[i].3.33k
FIELD3.33k
)
1331
0
      goto error;
1332
3.33k
  }
1333
3.33k
1334
3.33k
  return pw;
1335
0
error:
1336
0
  FN(PW,free)(pw);
1337
0
  return NULL;
1338
3.33k
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_insert_dims
Unexecuted instantiation: isl_pw_qpolynomial_insert_dims
1339
#endif
1340
1341
__isl_give PW *FN(PW,fix_dim)(__isl_take PW *pw,
1342
  enum isl_dim_type type, unsigned pos, isl_int v)
1343
1
{
1344
1
  int i;
1345
1
1346
1
  if (!pw)
1347
0
    return NULL;
1348
1
1349
1
  
if (1
type == isl_dim_in1
)
1350
0
    type = isl_dim_set;
1351
1
1352
1
  pw = FN(PW,cow)(pw);
1353
1
  if (!pw)
1354
0
    return NULL;
1355
2
  
for (i = 0; 1
i < pw->n2
;
++i1
) {
1356
1
    pw->p[i].set = isl_set_fix(pw->p[i].set, type, pos, v);
1357
1
    if (
FN1
(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 01
)
1358
0
      
return 0
FN0
(PW,free)(pw);
1359
1
  }
1360
1
1361
1
  return pw;
1362
1
}
Unexecuted instantiation: isl_pw_multi_aff_fix_dim
isl_pw_qpolynomial_fix_dim
Line
Count
Source
1343
1
{
1344
1
  int i;
1345
1
1346
1
  if (!pw)
1347
0
    return NULL;
1348
1
1349
1
  
if (1
type == isl_dim_in1
)
1350
0
    type = isl_dim_set;
1351
1
1352
1
  pw = FN(PW,cow)(pw);
1353
1
  if (!pw)
1354
0
    return NULL;
1355
2
  
for (i = 0; 1
i < pw->n2
;
++i1
) {
1356
1
    pw->p[i].set = isl_set_fix(pw->p[i].set, type, pos, v);
1357
1
    if (
FN1
(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 01
)
1358
0
      
return 0
FN0
(PW,free)(pw);
1359
1
  }
1360
1
1361
1
  return pw;
1362
1
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_fix_dim
Unexecuted instantiation: isl_pw_aff_fix_dim
1363
1364
/* Fix the value of the variable at position "pos" of type "type" of "pw"
1365
 * to be equal to "v".
1366
 */
1367
__isl_give PW *FN(PW,fix_val)(__isl_take PW *pw,
1368
  enum isl_dim_type type, unsigned pos, __isl_take isl_val *v)
1369
1
{
1370
1
  if (!v)
1371
0
    
return 0
FN0
(PW,free)(pw);
1372
1
  
if (1
!isl_val_is_int(v)1
)
1373
0
    isl_die(FN(PW,get_ctx)(pw), isl_error_invalid,
1374
1
      "expecting integer value", goto error);
1375
1
1376
1
  
pw = 1
FN1
(PW,fix_dim)(pw, type, pos, v->n);
1377
1
  isl_val_free(v);
1378
1
1379
1
  return pw;
1380
0
error:
1381
0
  isl_val_free(v);
1382
0
  return FN(PW,free)(pw);
1383
1
}
Unexecuted instantiation: isl_pw_aff_fix_val
isl_pw_qpolynomial_fix_val
Line
Count
Source
1369
1
{
1370
1
  if (!v)
1371
0
    
return 0
FN0
(PW,free)(pw);
1372
1
  
if (1
!isl_val_is_int(v)1
)
1373
0
    isl_die(FN(PW,get_ctx)(pw), isl_error_invalid,
1374
1
      "expecting integer value", goto error);
1375
1
1376
1
  
pw = 1
FN1
(PW,fix_dim)(pw, type, pos, v->n);
1377
1
  isl_val_free(v);
1378
1
1379
1
  return pw;
1380
0
error:
1381
0
  isl_val_free(v);
1382
0
  return FN(PW,free)(pw);
1383
1
}
Unexecuted instantiation: isl_pw_multi_aff_fix_val
Unexecuted instantiation: isl_pw_qpolynomial_fold_fix_val
1384
1385
unsigned FN(PW,dim)(__isl_keep PW *pw, enum isl_dim_type type)
1386
23.8k
{
1387
23.8k
  return pw ? 
isl_space_dim(pw->dim, type)23.8k
:
00
;
1388
23.8k
}
isl_pw_aff_dim
Line
Count
Source
1386
3.33k
{
1387
3.33k
  return pw ? 
isl_space_dim(pw->dim, type)3.33k
:
00
;
1388
3.33k
}
isl_pw_multi_aff_dim
Line
Count
Source
1386
20.4k
{
1387
20.4k
  return pw ? 
isl_space_dim(pw->dim, type)20.4k
:
00
;
1388
20.4k
}
isl_pw_qpolynomial_fold_dim
Line
Count
Source
1386
3
{
1387
3
  return pw ? 
isl_space_dim(pw->dim, type)3
:
00
;
1388
3
}
Unexecuted instantiation: isl_pw_qpolynomial_dim
1389
1390
__isl_give PW *FN(PW,split_dims)(__isl_take PW *pw,
1391
  enum isl_dim_type type, unsigned first, unsigned n)
1392
0
{
1393
0
  int i;
1394
0
1395
0
  if (!pw)
1396
0
    return NULL;
1397
0
  
if (0
n == 00
)
1398
0
    return pw;
1399
0
1400
0
  
if (0
type == isl_dim_in0
)
1401
0
    type = isl_dim_set;
1402
0
1403
0
  pw = FN(PW,cow)(pw);
1404
0
  if (!pw)
1405
0
    return NULL;
1406
0
  
if (0
!pw->dim0
)
1407
0
    goto error;
1408
0
  
for (i = 0; 0
i < pw->n0
;
++i0
) {
1409
0
    pw->p[i].set = isl_set_split_dims(pw->p[i].set, type, first, n);
1410
0
    if (!pw->p[i].set)
1411
0
      goto error;
1412
0
  }
1413
0
1414
0
  return pw;
1415
0
error:
1416
0
  FN(PW,free)(pw);
1417
0
  return NULL;
1418
0
}
Unexecuted instantiation: isl_pw_aff_split_dims
Unexecuted instantiation: isl_pw_qpolynomial_split_dims
Unexecuted instantiation: isl_pw_multi_aff_split_dims
Unexecuted instantiation: isl_pw_qpolynomial_fold_split_dims
1419
1420
#ifndef NO_OPT
1421
/* Compute the maximal value attained by the piecewise quasipolynomial
1422
 * on its domain or zero if the domain is empty.
1423
 * In the worst case, the domain is scanned completely,
1424
 * so the domain is assumed to be bounded.
1425
 */
1426
__isl_give isl_val *FN(PW,opt)(__isl_take PW *pw, int max)
1427
7
{
1428
7
  int i;
1429
7
  isl_val *opt;
1430
7
1431
7
  if (!pw)
1432
0
    return NULL;
1433
7
1434
7
  
if (7
pw->n == 07
) {
1435
0
    opt = isl_val_zero(FN(PW,get_ctx)(pw));
1436
0
    FN(PW,free)(pw);
1437
0
    return opt;
1438
0
  }
1439
7
1440
7
  
opt = 7
FN7
(EL,opt_on_domain)(
FN7
(EL,copy)(pw->p[0].
FIELD7
),
1441
7
          isl_set_copy(pw->p[0].set), max);
1442
7
  for (i = 1; 
i < pw->n7
;
++i0
) {
1443
0
    isl_val *opt_i;
1444
0
    opt_i = 
FN0
(EL,opt_on_domain)(
FN0
(EL,copy)(pw->p[i].
FIELD0
),
1445
0
            isl_set_copy(pw->p[i].set), max);
1446
0
    if (max)
1447
0
      opt = isl_val_max(opt, opt_i);
1448
0
    else
1449
0
      opt = isl_val_min(opt, opt_i);
1450
0
  }
1451
7
1452
7
  FN(PW,free)(pw);
1453
7
  return opt;
1454
7
}
Unexecuted instantiation: isl_pw_qpolynomial_opt
isl_pw_qpolynomial_fold_opt
Line
Count
Source
1427
7
{
1428
7
  int i;
1429
7
  isl_val *opt;
1430
7
1431
7
  if (!pw)
1432
0
    return NULL;
1433
7
1434
7
  
if (7
pw->n == 07
) {
1435
0
    opt = isl_val_zero(FN(PW,get_ctx)(pw));
1436
0
    FN(PW,free)(pw);
1437
0
    return opt;
1438
0
  }
1439
7
1440
7
  
opt = 7
FN7
(EL,opt_on_domain)(
FN7
(EL,copy)(pw->p[0].
FIELD7
),
1441
7
          isl_set_copy(pw->p[0].set), max);
1442
7
  for (i = 1; 
i < pw->n7
;
++i0
) {
1443
0
    isl_val *opt_i;
1444
0
    opt_i = 
FN0
(EL,opt_on_domain)(
FN0
(EL,copy)(pw->p[i].
FIELD0
),
1445
0
            isl_set_copy(pw->p[i].set), max);
1446
0
    if (max)
1447
0
      opt = isl_val_max(opt, opt_i);
1448
0
    else
1449
0
      opt = isl_val_min(opt, opt_i);
1450
0
  }
1451
7
1452
7
  FN(PW,free)(pw);
1453
7
  return opt;
1454
7
}
1455
1456
__isl_give isl_val *FN(PW,max)(__isl_take PW *pw)
1457
2
{
1458
2
  return FN(PW,opt)(pw, 1);
1459
2
}
Unexecuted instantiation: isl_pw_qpolynomial_max
isl_pw_qpolynomial_fold_max
Line
Count
Source
1457
2
{
1458
2
  return FN(PW,opt)(pw, 1);
1459
2
}
1460
1461
__isl_give isl_val *FN(PW,min)(__isl_take PW *pw)
1462
5
{
1463
5
  return FN(PW,opt)(pw, 0);
1464
5
}
isl_pw_qpolynomial_fold_min
Line
Count
Source
1462
5
{
1463
5
  return FN(PW,opt)(pw, 0);
1464
5
}
Unexecuted instantiation: isl_pw_qpolynomial_min
1465
#endif
1466
1467
__isl_give isl_space *FN(PW,get_space)(__isl_keep PW *pw)
1468
188k
{
1469
188k
  return pw ? isl_space_copy(pw->dim) : NULL;
1470
188k
}
isl_pw_qpolynomial_fold_get_space
Line
Count
Source
1468
1
{
1469
1
  return pw ? isl_space_copy(pw->dim) : NULL;
1470
1
}
isl_pw_aff_get_space
Line
Count
Source
1468
134k
{
1469
134k
  return pw ? isl_space_copy(pw->dim) : NULL;
1470
134k
}
isl_pw_multi_aff_get_space
Line
Count
Source
1468
54.0k
{
1469
54.0k
  return pw ? isl_space_copy(pw->dim) : NULL;
1470
54.0k
}
isl_pw_qpolynomial_get_space
Line
Count
Source
1468
9
{
1469
9
  return pw ? isl_space_copy(pw->dim) : NULL;
1470
9
}
1471
1472
__isl_give isl_space *FN(PW,get_domain_space)(__isl_keep PW *pw)
1473
104k
{
1474
104k
  return pw ? isl_space_domain(isl_space_copy(pw->dim)) : NULL;
1475
104k
}
isl_pw_qpolynomial_fold_get_domain_space
Line
Count
Source
1473
5
{
1474
5
  return pw ? isl_space_domain(isl_space_copy(pw->dim)) : NULL;
1475
5
}
isl_pw_qpolynomial_get_domain_space
Line
Count
Source
1473
2
{
1474
2
  return pw ? isl_space_domain(isl_space_copy(pw->dim)) : NULL;
1475
2
}
isl_pw_multi_aff_get_domain_space
Line
Count
Source
1473
944
{
1474
944
  return pw ? isl_space_domain(isl_space_copy(pw->dim)) : NULL;
1475
944
}
isl_pw_aff_get_domain_space
Line
Count
Source
1473
103k
{
1474
103k
  return pw ? isl_space_domain(isl_space_copy(pw->dim)) : NULL;
1475
103k
}
1476
1477
/* Return the position of the dimension of the given type and name
1478
 * in "pw".
1479
 * Return -1 if no such dimension can be found.
1480
 */
1481
int FN(PW,find_dim_by_name)(__isl_keep PW *pw,
1482
  enum isl_dim_type type, const char *name)
1483
0
{
1484
0
  if (!pw)
1485
0
    return -1;
1486
0
  return isl_space_find_dim_by_name(pw->dim, type, name);
1487
0
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_find_dim_by_name
Unexecuted instantiation: isl_pw_multi_aff_find_dim_by_name
Unexecuted instantiation: isl_pw_qpolynomial_find_dim_by_name
Unexecuted instantiation: isl_pw_aff_find_dim_by_name
1488
1489
#ifndef NO_RESET_DIM
1490
/* Reset the space of "pw".  Since we don't know if the elements
1491
 * represent the spaces themselves or their domains, we pass along
1492
 * both when we call their reset_space_and_domain.
1493
 */
1494
static __isl_give PW *FN(PW,reset_space_and_domain)(__isl_take PW *pw,
1495
  __isl_take isl_space *space, __isl_take isl_space *domain)
1496
68.4k
{
1497
68.4k
  int i;
1498
68.4k
1499
68.4k
  pw = FN(PW,cow)(pw);
1500
68.4k
  if (
!pw || 68.4k
!space68.4k
||
!domain68.4k
)
1501
0
    goto error;
1502
68.4k
1503
137k
  
for (i = 0; 68.4k
i < pw->n137k
;
++i69.0k
) {
1504
69.0k
    pw->p[i].set = isl_set_reset_space(pw->p[i].set,
1505
69.0k
             isl_space_copy(domain));
1506
69.0k
    if (!pw->p[i].set)
1507
0
      goto error;
1508
69.0k
    
pw->p[i].69.0k
FIELD69.0k
=
FN69.0k
(EL,reset_space_and_domain)(pw->p[i].
FIELD69.0k
,
1509
69.0k
            isl_space_copy(space), isl_space_copy(domain));
1510
69.0k
    if (
!pw->p[i].69.0k
FIELD69.0k
)
1511
0
      goto error;
1512
69.0k
  }
1513
68.4k
1514
68.4k
  isl_space_free(domain);
1515
68.4k
1516
68.4k
  isl_space_free(pw->dim);
1517
68.4k
  pw->dim = space;
1518
68.4k
1519
68.4k
  return pw;
1520
0
error:
1521
0
  isl_space_free(domain);
1522
0
  isl_space_free(space);
1523
0
  FN(PW,free)(pw);
1524
0
  return NULL;
1525
68.4k
}
isl_aff.c:isl_pw_aff_reset_space_and_domain
Line
Count
Source
1496
66.1k
{
1497
66.1k
  int i;
1498
66.1k
1499
66.1k
  pw = FN(PW,cow)(pw);
1500
66.1k
  if (
!pw || 66.1k
!space66.1k
||
!domain66.1k
)
1501
0
    goto error;
1502
66.1k
1503
132k
  
for (i = 0; 66.1k
i < pw->n132k
;
++i66.6k
) {
1504
66.6k
    pw->p[i].set = isl_set_reset_space(pw->p[i].set,
1505
66.6k
             isl_space_copy(domain));
1506
66.6k
    if (!pw->p[i].set)
1507
0
      goto error;
1508
66.6k
    
pw->p[i].66.6k
FIELD66.6k
=
FN66.6k
(EL,reset_space_and_domain)(pw->p[i].
FIELD66.6k
,
1509
66.6k
            isl_space_copy(space), isl_space_copy(domain));
1510
66.6k
    if (
!pw->p[i].66.6k
FIELD66.6k
)
1511
0
      goto error;
1512
66.6k
  }
1513
66.1k
1514
66.1k
  isl_space_free(domain);
1515
66.1k
1516
66.1k
  isl_space_free(pw->dim);
1517
66.1k
  pw->dim = space;
1518
66.1k
1519
66.1k
  return pw;
1520
0
error:
1521
0
  isl_space_free(domain);
1522
0
  isl_space_free(space);
1523
0
  FN(PW,free)(pw);
1524
0
  return NULL;
1525
66.1k
}
Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_reset_space_and_domain
isl_aff.c:isl_pw_multi_aff_reset_space_and_domain
Line
Count
Source
1496
2.30k
{
1497
2.30k
  int i;
1498
2.30k
1499
2.30k
  pw = FN(PW,cow)(pw);
1500
2.30k
  if (
!pw || 2.30k
!space2.30k
||
!domain2.30k
)
1501
0
    goto error;
1502
2.30k
1503
4.71k
  
for (i = 0; 2.30k
i < pw->n4.71k
;
++i2.41k
) {
1504
2.41k
    pw->p[i].set = isl_set_reset_space(pw->p[i].set,
1505
2.41k
             isl_space_copy(domain));
1506
2.41k
    if (!pw->p[i].set)
1507
0
      goto error;
1508
2.41k
    
pw->p[i].2.41k
FIELD2.41k
=
FN2.41k
(EL,reset_space_and_domain)(pw->p[i].
FIELD2.41k
,
1509
2.41k
            isl_space_copy(space), isl_space_copy(domain));
1510
2.41k
    if (
!pw->p[i].2.41k
FIELD2.41k
)
1511
0
      goto error;
1512
2.41k
  }
1513
2.30k
1514
2.30k
  isl_space_free(domain);
1515
2.30k
1516
2.30k
  isl_space_free(pw->dim);
1517
2.30k
  pw->dim = space;
1518
2.30k
1519
2.30k
  return pw;
1520
0
error:
1521
0
  isl_space_free(domain);
1522
0
  isl_space_free(space);
1523
0
  FN(PW,free)(pw);
1524
0
  return NULL;
1525
2.30k
}
isl_fold.c:isl_pw_qpolynomial_fold_reset_space_and_domain
Line
Count
Source
1496
4
{
1497
4
  int i;
1498
4
1499
4
  pw = FN(PW,cow)(pw);
1500
4
  if (
!pw || 4
!space4
||
!domain4
)
1501
0
    goto error;
1502
4
1503
7
  
for (i = 0; 4
i < pw->n7
;
++i3
) {
1504
3
    pw->p[i].set = isl_set_reset_space(pw->p[i].set,
1505
3
             isl_space_copy(domain));
1506
3
    if (!pw->p[i].set)
1507
0
      goto error;
1508
3
    
pw->p[i].3
FIELD3
=
FN3
(EL,reset_space_and_domain)(pw->p[i].
FIELD3
,
1509
3
            isl_space_copy(space), isl_space_copy(domain));
1510
3
    if (
!pw->p[i].3
FIELD3
)
1511
0
      goto error;
1512
3
  }
1513
4
1514
4
  isl_space_free(domain);
1515
4
1516
4
  isl_space_free(pw->dim);
1517
4
  pw->dim = space;
1518
4
1519
4
  return pw;
1520
0
error:
1521
0
  isl_space_free(domain);
1522
0
  isl_space_free(space);
1523
0
  FN(PW,free)(pw);
1524
0
  return NULL;
1525
4
}
1526
1527
__isl_give PW *FN(PW,reset_domain_space)(__isl_take PW *pw,
1528
  __isl_take isl_space *domain)
1529
53.7k
{
1530
53.7k
  isl_space *space;
1531
53.7k
1532
53.7k
  space = isl_space_extend_domain_with_range(isl_space_copy(domain),
1533
53.7k
               FN(PW,get_space)(pw));
1534
53.7k
  return FN(PW,reset_space_and_domain)(pw, space, domain);
1535
53.7k
}
isl_pw_qpolynomial_fold_reset_domain_space
Line
Count
Source
1529
1
{
1530
1
  isl_space *space;
1531
1
1532
1
  space = isl_space_extend_domain_with_range(isl_space_copy(domain),
1533
1
               FN(PW,get_space)(pw));
1534
1
  return FN(PW,reset_space_and_domain)(pw, space, domain);
1535
1
}
Unexecuted instantiation: isl_pw_multi_aff_reset_domain_space
isl_pw_aff_reset_domain_space
Line
Count
Source
1529
53.7k
{
1530
53.7k
  isl_space *space;
1531
53.7k
1532
53.7k
  space = isl_space_extend_domain_with_range(isl_space_copy(domain),
1533
53.7k
               FN(PW,get_space)(pw));
1534
53.7k
  return FN(PW,reset_space_and_domain)(pw, space, domain);
1535
53.7k
}
Unexecuted instantiation: isl_pw_qpolynomial_reset_domain_space
1536
1537
__isl_give PW *FN(PW,reset_space)(__isl_take PW *pw, __isl_take isl_space *dim)
1538
14.6k
{
1539
14.6k
  isl_space *domain;
1540
14.6k
1541
14.6k
  domain = isl_space_domain(isl_space_copy(dim));
1542
14.6k
  return FN(PW,reset_space_and_domain)(pw, dim, domain);
1543
14.6k
}
isl_pw_aff_reset_space
Line
Count
Source
1538
12.3k
{
1539
12.3k
  isl_space *domain;
1540
12.3k
1541
12.3k
  domain = isl_space_domain(isl_space_copy(dim));
1542
12.3k
  return FN(PW,reset_space_and_domain)(pw, dim, domain);
1543
12.3k
}
Unexecuted instantiation: isl_pw_qpolynomial_reset_space
isl_pw_multi_aff_reset_space
Line
Count
Source
1538
2.30k
{
1539
2.30k
  isl_space *domain;
1540
2.30k
1541
2.30k
  domain = isl_space_domain(isl_space_copy(dim));
1542
2.30k
  return FN(PW,reset_space_and_domain)(pw, dim, domain);
1543
2.30k
}
isl_pw_qpolynomial_fold_reset_space
Line
Count
Source
1538
3
{
1539
3
  isl_space *domain;
1540
3
1541
3
  domain = isl_space_domain(isl_space_copy(dim));
1542
3
  return FN(PW,reset_space_and_domain)(pw, dim, domain);
1543
3
}
1544
1545
__isl_give PW *FN(PW,set_tuple_id)(__isl_take PW *pw, enum isl_dim_type type,
1546
  __isl_take isl_id *id)
1547
537
{
1548
537
  isl_space *space;
1549
537
1550
537
  pw = FN(PW,cow)(pw);
1551
537
  if (!pw)
1552
0
    goto error;
1553
537
1554
537
  
space = 537
FN537
(PW,get_space)(pw);
1555
537
  space = isl_space_set_tuple_id(space, type, id);
1556
537
1557
537
  return FN(PW,reset_space)(pw, space);
1558
0
error:
1559
0
  isl_id_free(id);
1560
0
  return FN(PW,free)(pw);
1561
537
}
isl_pw_aff_set_tuple_id
Line
Count
Source
1547
537
{
1548
537
  isl_space *space;
1549
537
1550
537
  pw = FN(PW,cow)(pw);
1551
537
  if (!pw)
1552
0
    goto error;
1553
537
1554
537
  
space = 537
FN537
(PW,get_space)(pw);
1555
537
  space = isl_space_set_tuple_id(space, type, id);
1556
537
1557
537
  return FN(PW,reset_space)(pw, space);
1558
0
error:
1559
0
  isl_id_free(id);
1560
0
  return FN(PW,free)(pw);
1561
537
}
Unexecuted instantiation: isl_pw_qpolynomial_set_tuple_id
Unexecuted instantiation: isl_pw_qpolynomial_fold_set_tuple_id
Unexecuted instantiation: isl_pw_multi_aff_set_tuple_id
1562
1563
/* Drop the id on the specified tuple.
1564
 */
1565
__isl_give PW *FN(PW,reset_tuple_id)(__isl_take PW *pw, enum isl_dim_type type)
1566
0
{
1567
0
  isl_space *space;
1568
0
1569
0
  if (!pw)
1570
0
    return NULL;
1571
0
  
if (0
!0
FN0
(PW,has_tuple_id)(pw, type))
1572
0
    return pw;
1573
0
1574
0
  
pw = 0
FN0
(PW,cow)(pw);
1575
0
  if (!pw)
1576
0
    return NULL;
1577
0
1578
0
  
space = 0
FN0
(PW,get_space)(pw);
1579
0
  space = isl_space_reset_tuple_id(space, type);
1580
0
1581
0
  return FN(PW,reset_space)(pw, space);
1582
0
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_reset_tuple_id
Unexecuted instantiation: isl_pw_multi_aff_reset_tuple_id
Unexecuted instantiation: isl_pw_aff_reset_tuple_id
Unexecuted instantiation: isl_pw_qpolynomial_reset_tuple_id
1583
1584
__isl_give PW *FN(PW,set_dim_id)(__isl_take PW *pw,
1585
  enum isl_dim_type type, unsigned pos, __isl_take isl_id *id)
1586
0
{
1587
0
  pw = FN(PW,cow)(pw);
1588
0
  if (!pw)
1589
0
    goto error;
1590
0
  pw->dim = isl_space_set_dim_id(pw->dim, type, pos, id);
1591
0
  return FN(PW,reset_space)(pw, isl_space_copy(pw->dim));
1592
0
error:
1593
0
  isl_id_free(id);
1594
0
  return FN(PW,free)(pw);
1595
0
}
Unexecuted instantiation: isl_pw_aff_set_dim_id
Unexecuted instantiation: isl_pw_qpolynomial_fold_set_dim_id
Unexecuted instantiation: isl_pw_qpolynomial_set_dim_id
Unexecuted instantiation: isl_pw_multi_aff_set_dim_id
1596
#endif
1597
1598
/* Reset the user pointer on all identifiers of parameters and tuples
1599
 * of the space of "pw".
1600
 */
1601
__isl_give PW *FN(PW,reset_user)(__isl_take PW *pw)
1602
0
{
1603
0
  isl_space *space;
1604
0
1605
0
  space = FN(PW,get_space)(pw);
1606
0
  space = isl_space_reset_user(space);
1607
0
1608
0
  return FN(PW,reset_space)(pw, space);
1609
0
}
Unexecuted instantiation: isl_pw_multi_aff_reset_user
Unexecuted instantiation: isl_pw_aff_reset_user
Unexecuted instantiation: isl_pw_qpolynomial_fold_reset_user
Unexecuted instantiation: isl_pw_qpolynomial_reset_user
1610
1611
isl_bool FN(PW,has_equal_space)(__isl_keep PW *pw1, __isl_keep PW *pw2)
1612
4
{
1613
4
  if (
!pw1 || 4
!pw24
)
1614
0
    return isl_bool_error;
1615
4
1616
4
  return isl_space_is_equal(pw1->dim, pw2->dim);
1617
4
}
Unexecuted instantiation: isl_pw_multi_aff_has_equal_space
Unexecuted instantiation: isl_pw_aff_has_equal_space
Unexecuted instantiation: isl_pw_qpolynomial_fold_has_equal_space
isl_pw_qpolynomial_has_equal_space
Line
Count
Source
1612
4
{
1613
4
  if (
!pw1 || 4
!pw24
)
1614
0
    return isl_bool_error;
1615
4
1616
4
  return isl_space_is_equal(pw1->dim, pw2->dim);
1617
4
}
1618
1619
#ifndef NO_MORPH
1620
__isl_give PW *FN(PW,morph_domain)(__isl_take PW *pw,
1621
  __isl_take isl_morph *morph)
1622
2
{
1623
2
  int i;
1624
2
  isl_ctx *ctx;
1625
2
1626
2
  if (
!pw || 2
!morph2
)
1627
0
    goto error;
1628
2
1629
2
  ctx = isl_space_get_ctx(pw->dim);
1630
2
  isl_assert(ctx, isl_space_is_domain_internal(morph->dom->dim, pw->dim),
1631
2
    goto error);
1632
2
1633
2
  
pw = 2
FN2
(PW,cow)(pw);
1634
2
  if (!pw)
1635
0
    goto error;
1636
2
  pw->dim = isl_space_extend_domain_with_range(
1637
2
      isl_space_copy(morph->ran->dim), pw->dim);
1638
2
  if (!pw->dim)
1639
0
    goto error;
1640