Coverage Report

Created: 2018-04-23 18:20

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/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/id.h>
15
#include <isl/aff.h>
16
#include <isl_sort.h>
17
#include <isl_val_private.h>
18
19
#include <isl_pw_macro.h>
20
21
#ifdef HAS_TYPE
22
__isl_give PW *FN(PW,alloc_size)(__isl_take isl_space *dim,
23
  enum isl_fold type, int n)
24
#else
25
__isl_give PW *FN(PW,alloc_size)(__isl_take isl_space *dim, int n)
26
#endif
27
278k
{
28
278k
  isl_ctx *ctx;
29
278k
  struct PW *pw;
30
278k
31
278k
  if (!dim)
32
0
    return NULL;
33
278k
  ctx = isl_space_get_ctx(dim);
34
278k
  isl_assert(ctx, n >= 0, goto error);
35
278k
  pw = isl_alloc(ctx, struct PW,
36
278k
      sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
37
278k
  if (!pw)
38
0
    goto error;
39
278k
40
278k
  pw->ref = 1;
41
#ifdef HAS_TYPE
42
  pw->type = type;
43
#endif
44
  pw->size = n;
45
278k
  pw->n = 0;
46
278k
  pw->dim = dim;
47
278k
  return pw;
48
278k
error:
49
0
  isl_space_free(dim);
50
0
  return NULL;
51
278k
}
isl_pw_aff_alloc_size
Line
Count
Source
27
246k
{
28
246k
  isl_ctx *ctx;
29
246k
  struct PW *pw;
30
246k
31
246k
  if (!dim)
32
0
    return NULL;
33
246k
  ctx = isl_space_get_ctx(dim);
34
246k
  isl_assert(ctx, n >= 0, goto error);
35
246k
  pw = isl_alloc(ctx, struct PW,
36
246k
      sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
37
246k
  if (!pw)
38
0
    goto error;
39
246k
40
246k
  pw->ref = 1;
41
#ifdef HAS_TYPE
42
  pw->type = type;
43
#endif
44
  pw->size = n;
45
246k
  pw->n = 0;
46
246k
  pw->dim = dim;
47
246k
  return pw;
48
246k
error:
49
0
  isl_space_free(dim);
50
0
  return NULL;
51
246k
}
isl_pw_multi_aff_alloc_size
Line
Count
Source
27
32.7k
{
28
32.7k
  isl_ctx *ctx;
29
32.7k
  struct PW *pw;
30
32.7k
31
32.7k
  if (!dim)
32
0
    return NULL;
33
32.7k
  ctx = isl_space_get_ctx(dim);
34
32.7k
  isl_assert(ctx, n >= 0, goto error);
35
32.7k
  pw = isl_alloc(ctx, struct PW,
36
32.7k
      sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
37
32.7k
  if (!pw)
38
0
    goto error;
39
32.7k
40
32.7k
  pw->ref = 1;
41
#ifdef HAS_TYPE
42
  pw->type = type;
43
#endif
44
  pw->size = n;
45
32.7k
  pw->n = 0;
46
32.7k
  pw->dim = dim;
47
32.7k
  return pw;
48
32.7k
error:
49
0
  isl_space_free(dim);
50
0
  return NULL;
51
32.7k
}
isl_pw_qpolynomial_fold_alloc_size
Line
Count
Source
27
35
{
28
35
  isl_ctx *ctx;
29
35
  struct PW *pw;
30
35
31
35
  if (!dim)
32
0
    return NULL;
33
35
  ctx = isl_space_get_ctx(dim);
34
35
  isl_assert(ctx, n >= 0, goto error);
35
35
  pw = isl_alloc(ctx, struct PW,
36
35
      sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
37
35
  if (!pw)
38
0
    goto error;
39
35
40
35
  pw->ref = 1;
41
35
#ifdef HAS_TYPE
42
35
  pw->type = type;
43
35
#endif
44
35
  pw->size = n;
45
35
  pw->n = 0;
46
35
  pw->dim = dim;
47
35
  return pw;
48
35
error:
49
0
  isl_space_free(dim);
50
0
  return NULL;
51
35
}
isl_pw_qpolynomial_alloc_size
Line
Count
Source
27
104
{
28
104
  isl_ctx *ctx;
29
104
  struct PW *pw;
30
104
31
104
  if (!dim)
32
0
    return NULL;
33
104
  ctx = isl_space_get_ctx(dim);
34
104
  isl_assert(ctx, n >= 0, goto error);
35
104
  pw = isl_alloc(ctx, struct PW,
36
104
      sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
37
104
  if (!pw)
38
0
    goto error;
39
104
40
104
  pw->ref = 1;
41
#ifdef HAS_TYPE
42
  pw->type = type;
43
#endif
44
  pw->size = n;
45
104
  pw->n = 0;
46
104
  pw->dim = dim;
47
104
  return pw;
48
104
error:
49
0
  isl_space_free(dim);
50
0
  return NULL;
51
104
}
52
53
#ifdef HAS_TYPE
54
__isl_give PW *FN(PW,ZERO)(__isl_take isl_space *dim, enum isl_fold type)
55
16
{
56
16
  return FN(PW,alloc_size)(dim, type, 0);
57
16
}
58
#else
59
__isl_give PW *FN(PW,ZERO)(__isl_take isl_space *dim)
60
7.97k
{
61
7.97k
  return FN(PW,alloc_size)(dim, 0);
62
7.97k
}
isl_pw_aff_empty
Line
Count
Source
60
3.35k
{
61
3.35k
  return FN(PW,alloc_size)(dim, 0);
62
3.35k
}
isl_pw_multi_aff_empty
Line
Count
Source
60
4.61k
{
61
4.61k
  return FN(PW,alloc_size)(dim, 0);
62
4.61k
}
isl_pw_qpolynomial_zero
Line
Count
Source
60
2
{
61
2
  return FN(PW,alloc_size)(dim, 0);
62
2
}
63
#endif
64
65
__isl_give PW *FN(PW,add_piece)(__isl_take PW *pw,
66
  __isl_take isl_set *set, __isl_take EL *el)
67
278k
{
68
278k
  isl_ctx *ctx;
69
278k
  isl_space *el_dim = NULL;
70
278k
71
278k
  if (!pw || !set || !el)
72
0
    goto error;
73
278k
74
278k
  if (isl_set_plain_is_empty(set) || 
FN277k
(EL,EL_IS_ZERO)(el)277k
) {
75
762
    isl_set_free(set);
76
762
    FN(EL,free)(el);
77
762
    return pw;
78
762
  }
79
277k
80
277k
  ctx = isl_set_get_ctx(set);
81
#ifdef HAS_TYPE
82
18
  if (pw->type != el->type)
83
0
    isl_die(ctx, isl_error_invalid, "fold types don't match",
84
      goto error);
85
#endif
86
277k
  
el_dim = 18
FN(EL,get_space(el));
87
277k
  isl_assert(ctx, isl_space_is_equal(pw->dim, el_dim), goto error);
88
277k
  isl_assert(ctx, pw->n < pw->size, goto error);
89
277k
90
277k
  pw->p[pw->n].set = set;
91
277k
  pw->p[pw->n].FIELD = el;
92
277k
  pw->n++;
93
277k
  
94
277k
  isl_space_free(el_dim);
95
277k
  return pw;
96
277k
error:
97
0
  isl_space_free(el_dim);
98
0
  FN(PW,free)(pw);
99
0
  isl_set_free(set);
100
0
  FN(EL,free)(el);
101
0
  return NULL;
102
277k
}
isl_pw_aff_add_piece
Line
Count
Source
67
247k
{
68
247k
  isl_ctx *ctx;
69
247k
  isl_space *el_dim = NULL;
70
247k
71
247k
  if (!pw || !set || !el)
72
0
    goto error;
73
247k
74
247k
  if (isl_set_plain_is_empty(set) || 
FN247k
(EL,EL_IS_ZERO)(el)247k
) {
75
393
    isl_set_free(set);
76
393
    FN(EL,free)(el);
77
393
    return pw;
78
393
  }
79
247k
80
247k
  ctx = isl_set_get_ctx(set);
81
#ifdef HAS_TYPE
82
  if (pw->type != el->type)
83
    isl_die(ctx, isl_error_invalid, "fold types don't match",
84
      goto error);
85
#endif
86
247k
  el_dim = FN(EL,get_space(el));
87
247k
  isl_assert(ctx, isl_space_is_equal(pw->dim, el_dim), goto error);
88
247k
  isl_assert(ctx, pw->n < pw->size, goto error);
89
247k
90
247k
  pw->p[pw->n].set = set;
91
247k
  pw->p[pw->n].FIELD = el;
92
247k
  pw->n++;
93
247k
  
94
247k
  isl_space_free(el_dim);
95
247k
  return pw;
96
247k
error:
97
0
  isl_space_free(el_dim);
98
0
  FN(PW,free)(pw);
99
0
  isl_set_free(set);
100
0
  FN(EL,free)(el);
101
0
  return NULL;
102
247k
}
isl_pw_multi_aff_add_piece
Line
Count
Source
67
30.5k
{
68
30.5k
  isl_ctx *ctx;
69
30.5k
  isl_space *el_dim = NULL;
70
30.5k
71
30.5k
  if (!pw || !set || !el)
72
0
    goto error;
73
30.5k
74
30.5k
  if (isl_set_plain_is_empty(set) || 
FN30.2k
(EL,EL_IS_ZERO)(el)30.2k
) {
75
310
    isl_set_free(set);
76
310
    FN(EL,free)(el);
77
310
    return pw;
78
310
  }
79
30.2k
80
30.2k
  ctx = isl_set_get_ctx(set);
81
#ifdef HAS_TYPE
82
  if (pw->type != el->type)
83
    isl_die(ctx, isl_error_invalid, "fold types don't match",
84
      goto error);
85
#endif
86
30.2k
  el_dim = FN(EL,get_space(el));
87
30.2k
  isl_assert(ctx, isl_space_is_equal(pw->dim, el_dim), goto error);
88
30.2k
  isl_assert(ctx, pw->n < pw->size, goto error);
89
30.2k
90
30.2k
  pw->p[pw->n].set = set;
91
30.2k
  pw->p[pw->n].FIELD = el;
92
30.2k
  pw->n++;
93
30.2k
  
94
30.2k
  isl_space_free(el_dim);
95
30.2k
  return pw;
96
30.2k
error:
97
0
  isl_space_free(el_dim);
98
0
  FN(PW,free)(pw);
99
0
  isl_set_free(set);
100
0
  FN(EL,free)(el);
101
0
  return NULL;
102
30.2k
}
isl_pw_qpolynomial_fold_add_piece
Line
Count
Source
67
24
{
68
24
  isl_ctx *ctx;
69
24
  isl_space *el_dim = NULL;
70
24
71
24
  if (!pw || !set || !el)
72
0
    goto error;
73
24
74
24
  if (isl_set_plain_is_empty(set) || 
FN18
(EL,EL_IS_ZERO)(el)18
) {
75
6
    isl_set_free(set);
76
6
    FN(EL,free)(el);
77
6
    return pw;
78
6
  }
79
18
80
18
  ctx = isl_set_get_ctx(set);
81
18
#ifdef HAS_TYPE
82
18
  if (pw->type != el->type)
83
18
    
isl_die0
(ctx, isl_error_invalid, "fold types don't match",
84
18
      goto error);
85
18
#endif
86
18
  el_dim = FN(EL,get_space(el));
87
18
  isl_assert(ctx, isl_space_is_equal(pw->dim, el_dim), goto error);
88
18
  isl_assert(ctx, pw->n < pw->size, goto error);
89
18
90
18
  pw->p[pw->n].set = set;
91
18
  pw->p[pw->n].FIELD = el;
92
18
  pw->n++;
93
18
  
94
18
  isl_space_free(el_dim);
95
18
  return pw;
96
18
error:
97
0
  isl_space_free(el_dim);
98
0
  FN(PW,free)(pw);
99
0
  isl_set_free(set);
100
0
  FN(EL,free)(el);
101
0
  return NULL;
102
18
}
isl_pw_qpolynomial_add_piece
Line
Count
Source
67
151
{
68
151
  isl_ctx *ctx;
69
151
  isl_space *el_dim = NULL;
70
151
71
151
  if (!pw || !set || !el)
72
0
    goto error;
73
151
74
151
  if (isl_set_plain_is_empty(set) || 
FN107
(EL,EL_IS_ZERO)(el)107
) {
75
53
    isl_set_free(set);
76
53
    FN(EL,free)(el);
77
53
    return pw;
78
53
  }
79
98
80
98
  ctx = isl_set_get_ctx(set);
81
#ifdef HAS_TYPE
82
  if (pw->type != el->type)
83
    isl_die(ctx, isl_error_invalid, "fold types don't match",
84
      goto error);
85
#endif
86
98
  el_dim = FN(EL,get_space(el));
87
98
  isl_assert(ctx, isl_space_is_equal(pw->dim, el_dim), goto error);
88
98
  isl_assert(ctx, pw->n < pw->size, goto error);
89
98
90
98
  pw->p[pw->n].set = set;
91
98
  pw->p[pw->n].FIELD = el;
92
98
  pw->n++;
93
98
  
94
98
  isl_space_free(el_dim);
95
98
  return pw;
96
98
error:
97
0
  isl_space_free(el_dim);
98
0
  FN(PW,free)(pw);
99
0
  isl_set_free(set);
100
0
  FN(EL,free)(el);
101
0
  return NULL;
102
98
}
103
104
/* Does the space of "set" correspond to that of the domain of "el".
105
 */
106
static isl_bool FN(PW,compatible_domain)(__isl_keep EL *el,
107
  __isl_keep isl_set *set)
108
106k
{
109
106k
  isl_bool ok;
110
106k
  isl_space *el_space, *set_space;
111
106k
112
106k
  if (!set || !el)
113
0
    return isl_bool_error;
114
106k
  set_space = isl_set_get_space(set);
115
106k
  el_space = FN(EL,get_space)(el);
116
106k
  ok = isl_space_is_domain_internal(set_space, el_space);
117
106k
  isl_space_free(el_space);
118
106k
  isl_space_free(set_space);
119
106k
  return ok;
120
106k
}
isl_aff.c:isl_pw_aff_compatible_domain
Line
Count
Source
108
82.0k
{
109
82.0k
  isl_bool ok;
110
82.0k
  isl_space *el_space, *set_space;
111
82.0k
112
82.0k
  if (!set || !el)
113
0
    return isl_bool_error;
114
82.0k
  set_space = isl_set_get_space(set);
115
82.0k
  el_space = FN(EL,get_space)(el);
116
82.0k
  ok = isl_space_is_domain_internal(set_space, el_space);
117
82.0k
  isl_space_free(el_space);
118
82.0k
  isl_space_free(set_space);
119
82.0k
  return ok;
120
82.0k
}
isl_aff.c:isl_pw_multi_aff_compatible_domain
Line
Count
Source
108
24.1k
{
109
24.1k
  isl_bool ok;
110
24.1k
  isl_space *el_space, *set_space;
111
24.1k
112
24.1k
  if (!set || !el)
113
0
    return isl_bool_error;
114
24.1k
  set_space = isl_set_get_space(set);
115
24.1k
  el_space = FN(EL,get_space)(el);
116
24.1k
  ok = isl_space_is_domain_internal(set_space, el_space);
117
24.1k
  isl_space_free(el_space);
118
24.1k
  isl_space_free(set_space);
119
24.1k
  return ok;
120
24.1k
}
isl_fold.c:isl_pw_qpolynomial_fold_compatible_domain
Line
Count
Source
108
12
{
109
12
  isl_bool ok;
110
12
  isl_space *el_space, *set_space;
111
12
112
12
  if (!set || !el)
113
0
    return isl_bool_error;
114
12
  set_space = isl_set_get_space(set);
115
12
  el_space = FN(EL,get_space)(el);
116
12
  ok = isl_space_is_domain_internal(set_space, el_space);
117
12
  isl_space_free(el_space);
118
12
  isl_space_free(set_space);
119
12
  return ok;
120
12
}
isl_polynomial.c:isl_pw_qpolynomial_compatible_domain
Line
Count
Source
108
33
{
109
33
  isl_bool ok;
110
33
  isl_space *el_space, *set_space;
111
33
112
33
  if (!set || !el)
113
0
    return isl_bool_error;
114
33
  set_space = isl_set_get_space(set);
115
33
  el_space = FN(EL,get_space)(el);
116
33
  ok = isl_space_is_domain_internal(set_space, el_space);
117
33
  isl_space_free(el_space);
118
33
  isl_space_free(set_space);
119
33
  return ok;
120
33
}
121
122
/* Check that the space of "set" corresponds to that of the domain of "el".
123
 */
124
static isl_stat FN(PW,check_compatible_domain)(__isl_keep EL *el,
125
  __isl_keep isl_set *set)
126
106k
{
127
106k
  isl_bool ok;
128
106k
129
106k
  ok = FN(PW,compatible_domain)(el, set);
130
106k
  if (ok < 0)
131
0
    return isl_stat_error;
132
106k
  if (!ok)
133
106k
    
isl_die0
(isl_set_get_ctx(set), isl_error_invalid,
134
106k
      "incompatible spaces", return isl_stat_error);
135
106k
136
106k
  return isl_stat_ok;
137
106k
}
isl_aff.c:isl_pw_aff_check_compatible_domain
Line
Count
Source
126
82.0k
{
127
82.0k
  isl_bool ok;
128
82.0k
129
82.0k
  ok = FN(PW,compatible_domain)(el, set);
130
82.0k
  if (ok < 0)
131
0
    return isl_stat_error;
132
82.0k
  if (!ok)
133
82.0k
    
isl_die0
(isl_set_get_ctx(set), isl_error_invalid,
134
82.0k
      "incompatible spaces", return isl_stat_error);
135
82.0k
136
82.0k
  return isl_stat_ok;
137
82.0k
}
isl_aff.c:isl_pw_multi_aff_check_compatible_domain
Line
Count
Source
126
24.1k
{
127
24.1k
  isl_bool ok;
128
24.1k
129
24.1k
  ok = FN(PW,compatible_domain)(el, set);
130
24.1k
  if (ok < 0)
131
0
    return isl_stat_error;
132
24.1k
  if (!ok)
133
24.1k
    
isl_die0
(isl_set_get_ctx(set), isl_error_invalid,
134
24.1k
      "incompatible spaces", return isl_stat_error);
135
24.1k
136
24.1k
  return isl_stat_ok;
137
24.1k
}
isl_fold.c:isl_pw_qpolynomial_fold_check_compatible_domain
Line
Count
Source
126
12
{
127
12
  isl_bool ok;
128
12
129
12
  ok = FN(PW,compatible_domain)(el, set);
130
12
  if (ok < 0)
131
0
    return isl_stat_error;
132
12
  if (!ok)
133
12
    
isl_die0
(isl_set_get_ctx(set), isl_error_invalid,
134
12
      "incompatible spaces", return isl_stat_error);
135
12
136
12
  return isl_stat_ok;
137
12
}
isl_polynomial.c:isl_pw_qpolynomial_check_compatible_domain
Line
Count
Source
126
33
{
127
33
  isl_bool ok;
128
33
129
33
  ok = FN(PW,compatible_domain)(el, set);
130
33
  if (ok < 0)
131
0
    return isl_stat_error;
132
33
  if (!ok)
133
33
    
isl_die0
(isl_set_get_ctx(set), isl_error_invalid,
134
33
      "incompatible spaces", return isl_stat_error);
135
33
136
33
  return isl_stat_ok;
137
33
}
138
139
#ifdef HAS_TYPE
140
__isl_give PW *FN(PW,alloc)(enum isl_fold type,
141
  __isl_take isl_set *set, __isl_take EL *el)
142
#else
143
__isl_give PW *FN(PW,alloc)(__isl_take isl_set *set, __isl_take EL *el)
144
#endif
145
106k
{
146
106k
  PW *pw;
147
106k
148
106k
  if (FN(PW,check_compatible_domain)(el, set) < 0)
149
0
    goto error;
150
12
151
#ifdef HAS_TYPE
152
12
  pw = FN(PW,alloc_size)(FN(EL,get_space)(el), type, 1);
153
#else
154
106k
  pw = FN(PW,alloc_size)(FN(EL,get_space)(el), 1);
155
#endif
156
157
106k
  return FN(PW,add_piece)(pw, set, el);
158
106k
error:
159
0
  isl_set_free(set);
160
0
  FN(EL,free)(el);
161
0
  return NULL;
162
106k
}
isl_pw_aff_alloc
Line
Count
Source
145
82.0k
{
146
82.0k
  PW *pw;
147
82.0k
148
82.0k
  if (FN(PW,check_compatible_domain)(el, set) < 0)
149
0
    goto error;
150
82.0k
151
#ifdef HAS_TYPE
152
  pw = FN(PW,alloc_size)(FN(EL,get_space)(el), type, 1);
153
#else
154
82.0k
  pw = FN(PW,alloc_size)(FN(EL,get_space)(el), 1);
155
82.0k
#endif
156
82.0k
157
82.0k
  return FN(PW,add_piece)(pw, set, el);
158
82.0k
error:
159
0
  isl_set_free(set);
160
0
  FN(EL,free)(el);
161
0
  return NULL;
162
82.0k
}
isl_pw_multi_aff_alloc
Line
Count
Source
145
24.1k
{
146
24.1k
  PW *pw;
147
24.1k
148
24.1k
  if (FN(PW,check_compatible_domain)(el, set) < 0)
149
0
    goto error;
150
24.1k
151
#ifdef HAS_TYPE
152
  pw = FN(PW,alloc_size)(FN(EL,get_space)(el), type, 1);
153
#else
154
24.1k
  pw = FN(PW,alloc_size)(FN(EL,get_space)(el), 1);
155
24.1k
#endif
156
24.1k
157
24.1k
  return FN(PW,add_piece)(pw, set, el);
158
24.1k
error:
159
0
  isl_set_free(set);
160
0
  FN(EL,free)(el);
161
0
  return NULL;
162
24.1k
}
isl_pw_qpolynomial_fold_alloc
Line
Count
Source
145
12
{
146
12
  PW *pw;
147
12
148
12
  if (FN(PW,check_compatible_domain)(el, set) < 0)
149
0
    goto error;
150
12
151
12
#ifdef HAS_TYPE
152
12
  pw = FN(PW,alloc_size)(FN(EL,get_space)(el), type, 1);
153
#else
154
  pw = FN(PW,alloc_size)(FN(EL,get_space)(el), 1);
155
#endif
156
157
12
  return FN(PW,add_piece)(pw, set, el);
158
12
error:
159
0
  isl_set_free(set);
160
0
  FN(EL,free)(el);
161
0
  return NULL;
162
12
}
isl_pw_qpolynomial_alloc
Line
Count
Source
145
33
{
146
33
  PW *pw;
147
33
148
33
  if (FN(PW,check_compatible_domain)(el, set) < 0)
149
0
    goto error;
150
33
151
#ifdef HAS_TYPE
152
  pw = FN(PW,alloc_size)(FN(EL,get_space)(el), type, 1);
153
#else
154
33
  pw = FN(PW,alloc_size)(FN(EL,get_space)(el), 1);
155
33
#endif
156
33
157
33
  return FN(PW,add_piece)(pw, set, el);
158
33
error:
159
0
  isl_set_free(set);
160
0
  FN(EL,free)(el);
161
0
  return NULL;
162
33
}
163
164
__isl_give PW *FN(PW,dup)(__isl_keep PW *pw)
165
68.4k
{
166
68.4k
  int i;
167
68.4k
  PW *dup;
168
68.4k
169
68.4k
  if (!pw)
170
0
    return NULL;
171
0
172
#ifdef HAS_TYPE
173
0
  dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, pw->n);
174
#else
175
68.4k
  dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->n);
176
#endif
177
68.4k
  if (!dup)
178
0
    return NULL;
179
68.4k
180
138k
  
for (i = 0; 68.4k
i < pw->n;
++i70.3k
)
181
70.3k
    dup = FN(PW,add_piece)(dup, isl_set_copy(pw->p[i].set),
182
70.3k
              FN(EL,copy)(pw->p[i].FIELD));
183
68.4k
184
68.4k
  return dup;
185
68.4k
}
isl_pw_aff_dup
Line
Count
Source
165
67.0k
{
166
67.0k
  int i;
167
67.0k
  PW *dup;
168
67.0k
169
67.0k
  if (!pw)
170
0
    return NULL;
171
67.0k
172
#ifdef HAS_TYPE
173
  dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, pw->n);
174
#else
175
67.0k
  dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->n);
176
67.0k
#endif
177
67.0k
  if (!dup)
178
0
    return NULL;
179
67.0k
180
136k
  
for (i = 0; 67.0k
i < pw->n;
++i68.9k
)
181
68.9k
    dup = FN(PW,add_piece)(dup, isl_set_copy(pw->p[i].set),
182
68.9k
              FN(EL,copy)(pw->p[i].FIELD));
183
67.0k
184
67.0k
  return dup;
185
67.0k
}
isl_pw_multi_aff_dup
Line
Count
Source
165
1.39k
{
166
1.39k
  int i;
167
1.39k
  PW *dup;
168
1.39k
169
1.39k
  if (!pw)
170
0
    return NULL;
171
1.39k
172
#ifdef HAS_TYPE
173
  dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, pw->n);
174
#else
175
1.39k
  dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->n);
176
1.39k
#endif
177
1.39k
  if (!dup)
178
0
    return NULL;
179
1.39k
180
2.82k
  
for (i = 0; 1.39k
i < pw->n;
++i1.42k
)
181
1.42k
    dup = FN(PW,add_piece)(dup, isl_set_copy(pw->p[i].set),
182
1.42k
              FN(EL,copy)(pw->p[i].FIELD));
183
1.39k
184
1.39k
  return dup;
185
1.39k
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_dup
isl_pw_qpolynomial_dup
Line
Count
Source
165
1
{
166
1
  int i;
167
1
  PW *dup;
168
1
169
1
  if (!pw)
170
0
    return NULL;
171
1
172
#ifdef HAS_TYPE
173
  dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, pw->n);
174
#else
175
1
  dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->n);
176
1
#endif
177
1
  if (!dup)
178
0
    return NULL;
179
1
180
2
  
for (i = 0; 1
i < pw->n;
++i1
)
181
1
    dup = FN(PW,add_piece)(dup, isl_set_copy(pw->p[i].set),
182
1
              FN(EL,copy)(pw->p[i].FIELD));
183
1
184
1
  return dup;
185
1
}
186
187
__isl_give PW *FN(PW,cow)(__isl_take PW *pw)
188
196k
{
189
196k
  if (!pw)
190
0
    return NULL;
191
196k
192
196k
  if (pw->ref == 1)
193
127k
    return pw;
194
68.4k
  pw->ref--;
195
68.4k
  return FN(PW,dup)(pw);
196
68.4k
}
isl_pw_aff_cow
Line
Count
Source
188
185k
{
189
185k
  if (!pw)
190
0
    return NULL;
191
185k
192
185k
  if (pw->ref == 1)
193
118k
    return pw;
194
67.0k
  pw->ref--;
195
67.0k
  return FN(PW,dup)(pw);
196
67.0k
}
isl_pw_multi_aff_cow
Line
Count
Source
188
10.5k
{
189
10.5k
  if (!pw)
190
0
    return NULL;
191
10.5k
192
10.5k
  if (pw->ref == 1)
193
9.16k
    return pw;
194
1.39k
  pw->ref--;
195
1.39k
  return FN(PW,dup)(pw);
196
1.39k
}
isl_pw_qpolynomial_fold_cow
Line
Count
Source
188
7
{
189
7
  if (!pw)
190
0
    return NULL;
191
7
192
7
  if (pw->ref == 1)
193
7
    return pw;
194
0
  pw->ref--;
195
0
  return FN(PW,dup)(pw);
196
0
}
isl_pw_qpolynomial_cow
Line
Count
Source
188
51
{
189
51
  if (!pw)
190
0
    return NULL;
191
51
192
51
  if (pw->ref == 1)
193
50
    return pw;
194
1
  pw->ref--;
195
1
  return FN(PW,dup)(pw);
196
1
}
197
198
__isl_give PW *FN(PW,copy)(__isl_keep PW *pw)
199
468k
{
200
468k
  if (!pw)
201
46.3k
    return NULL;
202
421k
203
421k
  pw->ref++;
204
421k
  return pw;
205
421k
}
isl_pw_aff_copy
Line
Count
Source
199
426k
{
200
426k
  if (!pw)
201
46.3k
    return NULL;
202
379k
203
379k
  pw->ref++;
204
379k
  return pw;
205
379k
}
isl_pw_multi_aff_copy
Line
Count
Source
199
41.7k
{
200
41.7k
  if (!pw)
201
0
    return NULL;
202
41.7k
203
41.7k
  pw->ref++;
204
41.7k
  return pw;
205
41.7k
}
isl_pw_qpolynomial_fold_copy
Line
Count
Source
199
2
{
200
2
  if (!pw)
201
0
    return NULL;
202
2
203
2
  pw->ref++;
204
2
  return pw;
205
2
}
isl_pw_qpolynomial_copy
Line
Count
Source
199
10
{
200
10
  if (!pw)
201
0
    return NULL;
202
10
203
10
  pw->ref++;
204
10
  return pw;
205
10
}
206
207
__isl_null PW *FN(PW,free)(__isl_take PW *pw)
208
680k
{
209
680k
  int i;
210
680k
211
680k
  if (!pw)
212
48.1k
    return NULL;
213
631k
  if (--pw->ref > 0)
214
353k
    return NULL;
215
278k
216
555k
  
for (i = 0; 278k
i < pw->n;
++i277k
) {
217
277k
    isl_set_free(pw->p[i].set);
218
277k
    FN(EL,free)(pw->p[i].FIELD);
219
277k
  }
220
278k
  isl_space_free(pw->dim);
221
278k
  free(pw);
222
278k
223
278k
  return NULL;
224
278k
}
isl_pw_aff_free
Line
Count
Source
208
606k
{
209
606k
  int i;
210
606k
211
606k
  if (!pw)
212
48.1k
    return NULL;
213
558k
  if (--pw->ref > 0)
214
312k
    return NULL;
215
245k
216
492k
  
for (i = 0; 245k
i < pw->n;
++i247k
) {
217
247k
    isl_set_free(pw->p[i].set);
218
247k
    FN(EL,free)(pw->p[i].FIELD);
219
247k
  }
220
245k
  isl_space_free(pw->dim);
221
245k
  free(pw);
222
245k
223
245k
  return NULL;
224
245k
}
isl_pw_multi_aff_free
Line
Count
Source
208
73.1k
{
209
73.1k
  int i;
210
73.1k
211
73.1k
  if (!pw)
212
0
    return NULL;
213
73.1k
  if (--pw->ref > 0)
214
40.3k
    return NULL;
215
32.7k
216
62.9k
  
for (i = 0; 32.7k
i < pw->n;
++i30.1k
) {
217
30.1k
    isl_set_free(pw->p[i].set);
218
30.1k
    FN(EL,free)(pw->p[i].FIELD);
219
30.1k
  }
220
32.7k
  isl_space_free(pw->dim);
221
32.7k
  free(pw);
222
32.7k
223
32.7k
  return NULL;
224
32.7k
}
isl_pw_qpolynomial_fold_free
Line
Count
Source
208
37
{
209
37
  int i;
210
37
211
37
  if (!pw)
212
0
    return NULL;
213
37
  if (--pw->ref > 0)
214
2
    return NULL;
215
35
216
53
  
for (i = 0; 35
i < pw->n;
++i18
) {
217
18
    isl_set_free(pw->p[i].set);
218
18
    FN(EL,free)(pw->p[i].FIELD);
219
18
  }
220
35
  isl_space_free(pw->dim);
221
35
  free(pw);
222
35
223
35
  return NULL;
224
35
}
isl_pw_qpolynomial_free
Line
Count
Source
208
113
{
209
113
  int i;
210
113
211
113
  if (!pw)
212
0
    return NULL;
213
113
  if (--pw->ref > 0)
214
9
    return NULL;
215
104
216
202
  
for (i = 0; 104
i < pw->n;
++i98
) {
217
98
    isl_set_free(pw->p[i].set);
218
98
    FN(EL,free)(pw->p[i].FIELD);
219
98
  }
220
104
  isl_space_free(pw->dim);
221
104
  free(pw);
222
104
223
104
  return NULL;
224
104
}
225
226
const char *FN(PW,get_dim_name)(__isl_keep PW *pw, enum isl_dim_type type,
227
  unsigned pos)
228
0
{
229
0
  return pw ? isl_space_get_dim_name(pw->dim, type, pos) : NULL;
230
0
}
Unexecuted instantiation: isl_pw_aff_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_qpolynomial_get_dim_name
231
232
isl_bool FN(PW,has_dim_id)(__isl_keep PW *pw, enum isl_dim_type type,
233
  unsigned pos)
234
0
{
235
0
  return pw ? isl_space_has_dim_id(pw->dim, type, pos) : isl_bool_error;
236
0
}
Unexecuted instantiation: isl_pw_aff_has_dim_id
Unexecuted instantiation: isl_pw_multi_aff_has_dim_id
Unexecuted instantiation: isl_pw_qpolynomial_fold_has_dim_id
Unexecuted instantiation: isl_pw_qpolynomial_has_dim_id
237
238
__isl_give isl_id *FN(PW,get_dim_id)(__isl_keep PW *pw, enum isl_dim_type type,
239
  unsigned pos)
240
16
{
241
16
  return pw ? isl_space_get_dim_id(pw->dim, type, pos) : NULL;
242
16
}
isl_pw_aff_get_dim_id
Line
Count
Source
240
16
{
241
16
  return pw ? isl_space_get_dim_id(pw->dim, type, pos) : NULL;
242
16
}
Unexecuted instantiation: isl_pw_multi_aff_get_dim_id
Unexecuted instantiation: isl_pw_qpolynomial_fold_get_dim_id
Unexecuted instantiation: isl_pw_qpolynomial_get_dim_id
243
244
isl_bool FN(PW,has_tuple_name)(__isl_keep PW *pw, enum isl_dim_type type)
245
0
{
246
0
  return pw ? isl_space_has_tuple_name(pw->dim, type) : isl_bool_error;
247
0
}
Unexecuted instantiation: isl_pw_aff_has_tuple_name
Unexecuted instantiation: isl_pw_multi_aff_has_tuple_name
Unexecuted instantiation: isl_pw_qpolynomial_fold_has_tuple_name
Unexecuted instantiation: isl_pw_qpolynomial_has_tuple_name
248
249
const char *FN(PW,get_tuple_name)(__isl_keep PW *pw, enum isl_dim_type type)
250
0
{
251
0
  return pw ? isl_space_get_tuple_name(pw->dim, type) : NULL;
252
0
}
Unexecuted instantiation: isl_pw_aff_get_tuple_name
Unexecuted instantiation: isl_pw_multi_aff_get_tuple_name
Unexecuted instantiation: isl_pw_qpolynomial_fold_get_tuple_name
Unexecuted instantiation: isl_pw_qpolynomial_get_tuple_name
253
254
isl_bool FN(PW,has_tuple_id)(__isl_keep PW *pw, enum isl_dim_type type)
255
0
{
256
0
  return pw ? isl_space_has_tuple_id(pw->dim, type) : isl_bool_error;
257
0
}
Unexecuted instantiation: isl_pw_aff_has_tuple_id
Unexecuted instantiation: isl_pw_multi_aff_has_tuple_id
Unexecuted instantiation: isl_pw_qpolynomial_fold_has_tuple_id
Unexecuted instantiation: isl_pw_qpolynomial_has_tuple_id
258
259
__isl_give isl_id *FN(PW,get_tuple_id)(__isl_keep PW *pw, enum isl_dim_type type)
260
346
{
261
346
  return pw ? isl_space_get_tuple_id(pw->dim, type) : NULL;
262
346
}
Unexecuted instantiation: isl_pw_aff_get_tuple_id
isl_pw_multi_aff_get_tuple_id
Line
Count
Source
260
346
{
261
346
  return pw ? isl_space_get_tuple_id(pw->dim, type) : NULL;
262
346
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_get_tuple_id
Unexecuted instantiation: isl_pw_qpolynomial_get_tuple_id
263
264
isl_bool FN(PW,IS_ZERO)(__isl_keep PW *pw)
265
71.5k
{
266
71.5k
  if (!pw)
267
0
    return isl_bool_error;
268
71.5k
269
71.5k
  return pw->n == 0;
270
71.5k
}
isl_pw_aff_is_empty
Line
Count
Source
265
45.9k
{
266
45.9k
  if (!pw)
267
0
    return isl_bool_error;
268
45.9k
269
45.9k
  return pw->n == 0;
270
45.9k
}
isl_pw_multi_aff_is_empty
Line
Count
Source
265
25.4k
{
266
25.4k
  if (!pw)
267
0
    return isl_bool_error;
268
25.4k
269
25.4k
  return pw->n == 0;
270
25.4k
}
isl_pw_qpolynomial_fold_is_zero
Line
Count
Source
265
26
{
266
26
  if (!pw)
267
0
    return isl_bool_error;
268
26
269
26
  return pw->n == 0;
270
26
}
isl_pw_qpolynomial_is_zero
Line
Count
Source
265
102
{
266
102
  if (!pw)
267
0
    return isl_bool_error;
268
102
269
102
  return pw->n == 0;
270
102
}
271
272
#ifndef NO_REALIGN
273
__isl_give PW *FN(PW,realign_domain)(__isl_take PW *pw,
274
  __isl_take isl_reordering *exp)
275
9.43k
{
276
9.43k
  int i;
277
9.43k
278
9.43k
  pw = FN(PW,cow)(pw);
279
9.43k
  if (!pw || !exp)
280
0
    goto error;
281
9.43k
282
19.3k
  
for (i = 0; 9.43k
i < pw->n;
++i9.87k
) {
283
9.87k
    pw->p[i].set = isl_set_realign(pw->p[i].set,
284
9.87k
                isl_reordering_copy(exp));
285
9.87k
    if (!pw->p[i].set)
286
0
      goto error;
287
9.87k
    pw->p[i].FIELD = FN(EL,realign_domain)(pw->p[i].FIELD,
288
9.87k
                isl_reordering_copy(exp));
289
9.87k
    if (!pw->p[i].FIELD)
290
9.87k
      
goto error0
;
291
9.87k
  }
292
9.43k
293
9.43k
  pw = FN(PW,reset_domain_space)(pw, isl_space_copy(exp->dim));
294
9.43k
295
9.43k
  isl_reordering_free(exp);
296
9.43k
  return pw;
297
9.43k
error:
298
0
  isl_reordering_free(exp);
299
0
  FN(PW,free)(pw);
300
0
  return NULL;
301
9.43k
}
isl_pw_aff_realign_domain
Line
Count
Source
275
9.42k
{
276
9.42k
  int i;
277
9.42k
278
9.42k
  pw = FN(PW,cow)(pw);
279
9.42k
  if (!pw || !exp)
280
0
    goto error;
281
9.42k
282
19.2k
  
for (i = 0; 9.42k
i < pw->n;
++i9.87k
) {
283
9.87k
    pw->p[i].set = isl_set_realign(pw->p[i].set,
284
9.87k
                isl_reordering_copy(exp));
285
9.87k
    if (!pw->p[i].set)
286
0
      goto error;
287
9.87k
    pw->p[i].FIELD = FN(EL,realign_domain)(pw->p[i].FIELD,
288
9.87k
                isl_reordering_copy(exp));
289
9.87k
    if (!pw->p[i].FIELD)
290
9.87k
      
goto error0
;
291
9.87k
  }
292
9.42k
293
9.42k
  pw = FN(PW,reset_domain_space)(pw, isl_space_copy(exp->dim));
294
9.42k
295
9.42k
  isl_reordering_free(exp);
296
9.42k
  return pw;
297
9.42k
error:
298
0
  isl_reordering_free(exp);
299
0
  FN(PW,free)(pw);
300
0
  return NULL;
301
9.42k
}
isl_pw_multi_aff_realign_domain
Line
Count
Source
275
7
{
276
7
  int i;
277
7
278
7
  pw = FN(PW,cow)(pw);
279
7
  if (!pw || !exp)
280
0
    goto error;
281
7
282
14
  
for (i = 0; 7
i < pw->n;
++i7
) {
283
7
    pw->p[i].set = isl_set_realign(pw->p[i].set,
284
7
                isl_reordering_copy(exp));
285
7
    if (!pw->p[i].set)
286
0
      goto error;
287
7
    pw->p[i].FIELD = FN(EL,realign_domain)(pw->p[i].FIELD,
288
7
                isl_reordering_copy(exp));
289
7
    if (!pw->p[i].FIELD)
290
7
      
goto error0
;
291
7
  }
292
7
293
7
  pw = FN(PW,reset_domain_space)(pw, isl_space_copy(exp->dim));
294
7
295
7
  isl_reordering_free(exp);
296
7
  return pw;
297
7
error:
298
0
  isl_reordering_free(exp);
299
0
  FN(PW,free)(pw);
300
0
  return NULL;
301
7
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_realign_domain
Unexecuted instantiation: isl_pw_qpolynomial_realign_domain
302
303
/* Align the parameters of "pw" to those of "model".
304
 */
305
__isl_give PW *FN(PW,align_params)(__isl_take PW *pw, __isl_take isl_space *model)
306
46.4k
{
307
46.4k
  isl_ctx *ctx;
308
46.4k
  isl_bool equal_params;
309
46.4k
310
46.4k
  if (!pw || !model)
311
0
    goto error;
312
46.4k
313
46.4k
  ctx = isl_space_get_ctx(model);
314
46.4k
  if (!isl_space_has_named_params(model))
315
46.4k
    
isl_die0
(ctx, isl_error_invalid,
316
46.4k
      "model has unnamed parameters", goto error);
317
46.4k
  if (!isl_space_has_named_params(pw->dim))
318
46.4k
    
isl_die0
(ctx, isl_error_invalid,
319
46.4k
      "input has unnamed parameters", goto error);
320
46.4k
  equal_params = isl_space_has_equal_params(pw->dim, model);
321
46.4k
  if (equal_params < 0)
322
0
    goto error;
323
46.4k
  if (!equal_params) {
324
9.12k
    isl_reordering *exp;
325
9.12k
326
9.12k
    model = isl_space_drop_dims(model, isl_dim_in,
327
9.12k
          0, isl_space_dim(model, isl_dim_in));
328
9.12k
    model = isl_space_drop_dims(model, isl_dim_out,
329
9.12k
          0, isl_space_dim(model, isl_dim_out));
330
9.12k
    exp = isl_parameter_alignment_reordering(pw->dim, model);
331
9.12k
    exp = isl_reordering_extend_space(exp,
332
9.12k
          FN(PW,get_domain_space)(pw));
333
9.12k
    pw = FN(PW,realign_domain)(pw, exp);
334
9.12k
  }
335
46.4k
336
46.4k
  isl_space_free(model);
337
46.4k
  return pw;
338
46.4k
error:
339
0
  isl_space_free(model);
340
0
  FN(PW,free)(pw);
341
0
  return NULL;
342
46.4k
}
isl_pw_aff_align_params
Line
Count
Source
306
27.0k
{
307
27.0k
  isl_ctx *ctx;
308
27.0k
  isl_bool equal_params;
309
27.0k
310
27.0k
  if (!pw || !model)
311
0
    goto error;
312
27.0k
313
27.0k
  ctx = isl_space_get_ctx(model);
314
27.0k
  if (!isl_space_has_named_params(model))
315
27.0k
    
isl_die0
(ctx, isl_error_invalid,
316
27.0k
      "model has unnamed parameters", goto error);
317
27.0k
  if (!isl_space_has_named_params(pw->dim))
318
27.0k
    
isl_die0
(ctx, isl_error_invalid,
319
27.0k
      "input has unnamed parameters", goto error);
320
27.0k
  equal_params = isl_space_has_equal_params(pw->dim, model);
321
27.0k
  if (equal_params < 0)
322
0
    goto error;
323
27.0k
  if (!equal_params) {
324
9.12k
    isl_reordering *exp;
325
9.12k
326
9.12k
    model = isl_space_drop_dims(model, isl_dim_in,
327
9.12k
          0, isl_space_dim(model, isl_dim_in));
328
9.12k
    model = isl_space_drop_dims(model, isl_dim_out,
329
9.12k
          0, isl_space_dim(model, isl_dim_out));
330
9.12k
    exp = isl_parameter_alignment_reordering(pw->dim, model);
331
9.12k
    exp = isl_reordering_extend_space(exp,
332
9.12k
          FN(PW,get_domain_space)(pw));
333
9.12k
    pw = FN(PW,realign_domain)(pw, exp);
334
9.12k
  }
335
27.0k
336
27.0k
  isl_space_free(model);
337
27.0k
  return pw;
338
27.0k
error:
339
0
  isl_space_free(model);
340
0
  FN(PW,free)(pw);
341
0
  return NULL;
342
27.0k
}
isl_pw_multi_aff_align_params
Line
Count
Source
306
19.3k
{
307
19.3k
  isl_ctx *ctx;
308
19.3k
  isl_bool equal_params;
309
19.3k
310
19.3k
  if (!pw || !model)
311
0
    goto error;
312
19.3k
313
19.3k
  ctx = isl_space_get_ctx(model);
314
19.3k
  if (!isl_space_has_named_params(model))
315
19.3k
    
isl_die0
(ctx, isl_error_invalid,
316
19.3k
      "model has unnamed parameters", goto error);
317
19.3k
  if (!isl_space_has_named_params(pw->dim))
318
19.3k
    
isl_die0
(ctx, isl_error_invalid,
319
19.3k
      "input has unnamed parameters", goto error);
320
19.3k
  equal_params = isl_space_has_equal_params(pw->dim, model);
321
19.3k
  if (equal_params < 0)
322
0
    goto error;
323
19.3k
  if (!equal_params) {
324
5
    isl_reordering *exp;
325
5
326
5
    model = isl_space_drop_dims(model, isl_dim_in,
327
5
          0, isl_space_dim(model, isl_dim_in));
328
5
    model = isl_space_drop_dims(model, isl_dim_out,
329
5
          0, isl_space_dim(model, isl_dim_out));
330
5
    exp = isl_parameter_alignment_reordering(pw->dim, model);
331
5
    exp = isl_reordering_extend_space(exp,
332
5
          FN(PW,get_domain_space)(pw));
333
5
    pw = FN(PW,realign_domain)(pw, exp);
334
5
  }
335
19.3k
336
19.3k
  isl_space_free(model);
337
19.3k
  return pw;
338
19.3k
error:
339
0
  isl_space_free(model);
340
0
  FN(PW,free)(pw);
341
0
  return NULL;
342
19.3k
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_align_params
isl_pw_qpolynomial_align_params
Line
Count
Source
306
5
{
307
5
  isl_ctx *ctx;
308
5
  isl_bool equal_params;
309
5
310
5
  if (!pw || !model)
311
0
    goto error;
312
5
313
5
  ctx = isl_space_get_ctx(model);
314
5
  if (!isl_space_has_named_params(model))
315
5
    
isl_die0
(ctx, isl_error_invalid,
316
5
      "model has unnamed parameters", goto error);
317
5
  if (!isl_space_has_named_params(pw->dim))
318
5
    
isl_die0
(ctx, isl_error_invalid,
319
5
      "input has unnamed parameters", goto error);
320
5
  equal_params = isl_space_has_equal_params(pw->dim, model);
321
5
  if (equal_params < 0)
322
0
    goto error;
323
5
  if (!equal_params) {
324
0
    isl_reordering *exp;
325
0
326
0
    model = isl_space_drop_dims(model, isl_dim_in,
327
0
          0, isl_space_dim(model, isl_dim_in));
328
0
    model = isl_space_drop_dims(model, isl_dim_out,
329
0
          0, isl_space_dim(model, isl_dim_out));
330
0
    exp = isl_parameter_alignment_reordering(pw->dim, model);
331
0
    exp = isl_reordering_extend_space(exp,
332
0
          FN(PW,get_domain_space)(pw));
333
0
    pw = FN(PW,realign_domain)(pw, exp);
334
0
  }
335
5
336
5
  isl_space_free(model);
337
5
  return pw;
338
5
error:
339
0
  isl_space_free(model);
340
0
  FN(PW,free)(pw);
341
0
  return NULL;
342
5
}
343
344
static __isl_give PW *FN(PW,align_params_pw_pw_and)(__isl_take PW *pw1,
345
  __isl_take PW *pw2,
346
  __isl_give PW *(*fn)(__isl_take PW *pw1, __isl_take PW *pw2))
347
89.2k
{
348
89.2k
  isl_ctx *ctx;
349
89.2k
  isl_bool equal_params;
350
89.2k
351
89.2k
  if (!pw1 || 
!pw289.2k
)
352
1
    goto error;
353
89.2k
  equal_params = isl_space_has_equal_params(pw1->dim, pw2->dim);
354
89.2k
  if (equal_params < 0)
355
0
    goto error;
356
89.2k
  if (equal_params)
357
85.7k
    return fn(pw1, pw2);
358
3.46k
  ctx = FN(PW,get_ctx)(pw1);
359
3.46k
  if (!isl_space_has_named_params(pw1->dim) ||
360
3.46k
      !isl_space_has_named_params(pw2->dim))
361
3.46k
    
isl_die0
(ctx, isl_error_invalid,
362
3.46k
      "unaligned unnamed parameters", goto error);
363
3.46k
  pw1 = FN(PW,align_params)(pw1, FN(PW,get_space)(pw2));
364
3.46k
  pw2 = FN(PW,align_params)(pw2, FN(PW,get_space)(pw1));
365
3.46k
  return fn(pw1, pw2);
366
3.46k
error:
367
1
  FN(PW,free)(pw1);
368
1
  FN(PW,free)(pw2);
369
1
  return NULL;
370
3.46k
}
isl_aff.c:isl_pw_aff_align_params_pw_pw_and
Line
Count
Source
347
83.0k
{
348
83.0k
  isl_ctx *ctx;
349
83.0k
  isl_bool equal_params;
350
83.0k
351
83.0k
  if (!pw1 || 
!pw283.0k
)
352
1
    goto error;
353
83.0k
  equal_params = isl_space_has_equal_params(pw1->dim, pw2->dim);
354
83.0k
  if (equal_params < 0)
355
0
    goto error;
356
83.0k
  if (equal_params)
357
79.5k
    return fn(pw1, pw2);
358
3.46k
  ctx = FN(PW,get_ctx)(pw1);
359
3.46k
  if (!isl_space_has_named_params(pw1->dim) ||
360
3.46k
      !isl_space_has_named_params(pw2->dim))
361
3.46k
    
isl_die0
(ctx, isl_error_invalid,
362
3.46k
      "unaligned unnamed parameters", goto error);
363
3.46k
  pw1 = FN(PW,align_params)(pw1, FN(PW,get_space)(pw2));
364
3.46k
  pw2 = FN(PW,align_params)(pw2, FN(PW,get_space)(pw1));
365
3.46k
  return fn(pw1, pw2);
366
3.46k
error:
367
1
  FN(PW,free)(pw1);
368
1
  FN(PW,free)(pw2);
369
1
  return NULL;
370
3.46k
}
isl_aff.c:isl_pw_multi_aff_align_params_pw_pw_and
Line
Count
Source
347
6.16k
{
348
6.16k
  isl_ctx *ctx;
349
6.16k
  isl_bool equal_params;
350
6.16k
351
6.16k
  if (!pw1 || !pw2)
352
0
    goto error;
353
6.16k
  equal_params = isl_space_has_equal_params(pw1->dim, pw2->dim);
354
6.16k
  if (equal_params < 0)
355
0
    goto error;
356
6.16k
  if (equal_params)
357
6.16k
    return fn(pw1, pw2);
358
0
  ctx = FN(PW,get_ctx)(pw1);
359
0
  if (!isl_space_has_named_params(pw1->dim) ||
360
0
      !isl_space_has_named_params(pw2->dim))
361
0
    isl_die(ctx, isl_error_invalid,
362
0
      "unaligned unnamed parameters", goto error);
363
0
  pw1 = FN(PW,align_params)(pw1, FN(PW,get_space)(pw2));
364
0
  pw2 = FN(PW,align_params)(pw2, FN(PW,get_space)(pw1));
365
0
  return fn(pw1, pw2);
366
0
error:
367
0
  FN(PW,free)(pw1);
368
0
  FN(PW,free)(pw2);
369
0
  return NULL;
370
0
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_align_params_pw_pw_and
isl_polynomial.c:isl_pw_qpolynomial_align_params_pw_pw_and
Line
Count
Source
347
26
{
348
26
  isl_ctx *ctx;
349
26
  isl_bool equal_params;
350
26
351
26
  if (!pw1 || !pw2)
352
0
    goto error;
353
26
  equal_params = isl_space_has_equal_params(pw1->dim, pw2->dim);
354
26
  if (equal_params < 0)
355
0
    goto error;
356
26
  if (equal_params)
357
26
    return fn(pw1, pw2);
358
0
  ctx = FN(PW,get_ctx)(pw1);
359
0
  if (!isl_space_has_named_params(pw1->dim) ||
360
0
      !isl_space_has_named_params(pw2->dim))
361
0
    isl_die(ctx, isl_error_invalid,
362
0
      "unaligned unnamed parameters", goto error);
363
0
  pw1 = FN(PW,align_params)(pw1, FN(PW,get_space)(pw2));
364
0
  pw2 = FN(PW,align_params)(pw2, FN(PW,get_space)(pw1));
365
0
  return fn(pw1, pw2);
366
0
error:
367
0
  FN(PW,free)(pw1);
368
0
  FN(PW,free)(pw2);
369
0
  return NULL;
370
0
}
371
372
static __isl_give PW *FN(PW,align_params_pw_set_and)(__isl_take PW *pw,
373
  __isl_take isl_set *set,
374
  __isl_give PW *(*fn)(__isl_take PW *pw, __isl_take isl_set *set))
375
58.2k
{
376
58.2k
  isl_ctx *ctx;
377
58.2k
  isl_bool aligned;
378
58.2k
379
58.2k
  if (!pw || !set)
380
0
    goto error;
381
58.2k
  aligned = isl_set_space_has_equal_params(set, pw->dim);
382
58.2k
  if (aligned < 0)
383
0
    goto error;
384
58.2k
  if (aligned)
385
58.2k
    return fn(pw, set);
386
2
  ctx = FN(PW,get_ctx)(pw);
387
2
  if (!isl_space_has_named_params(pw->dim) ||
388
2
      !isl_space_has_named_params(set->dim))
389
2
    
isl_die0
(ctx, isl_error_invalid,
390
2
      "unaligned unnamed parameters", goto error);
391
2
  pw = FN(PW,align_params)(pw, isl_set_get_space(set));
392
2
  set = isl_set_align_params(set, FN(PW,get_space)(pw));
393
2
  return fn(pw, set);
394
2
error:
395
0
  FN(PW,free)(pw);
396
0
  isl_set_free(set);
397
0
  return NULL;
398
2
}
isl_aff.c:isl_pw_aff_align_params_pw_set_and
Line
Count
Source
375
53.1k
{
376
53.1k
  isl_ctx *ctx;
377
53.1k
  isl_bool aligned;
378
53.1k
379
53.1k
  if (!pw || !set)
380
0
    goto error;
381
53.1k
  aligned = isl_set_space_has_equal_params(set, pw->dim);
382
53.1k
  if (aligned < 0)
383
0
    goto error;
384
53.1k
  if (aligned)
385
53.1k
    return fn(pw, set);
386
2
  ctx = FN(PW,get_ctx)(pw);
387
2
  if (!isl_space_has_named_params(pw->dim) ||
388
2
      !isl_space_has_named_params(set->dim))
389
2
    
isl_die0
(ctx, isl_error_invalid,
390
2
      "unaligned unnamed parameters", goto error);
391
2
  pw = FN(PW,align_params)(pw, isl_set_get_space(set));
392
2
  set = isl_set_align_params(set, FN(PW,get_space)(pw));
393
2
  return fn(pw, set);
394
2
error:
395
0
  FN(PW,free)(pw);
396
0
  isl_set_free(set);
397
0
  return NULL;
398
2
}
isl_aff.c:isl_pw_multi_aff_align_params_pw_set_and
Line
Count
Source
375
5.12k
{
376
5.12k
  isl_ctx *ctx;
377
5.12k
  isl_bool aligned;
378
5.12k
379
5.12k
  if (!pw || !set)
380
0
    goto error;
381
5.12k
  aligned = isl_set_space_has_equal_params(set, pw->dim);
382
5.12k
  if (aligned < 0)
383
0
    goto error;
384
5.12k
  if (aligned)
385
5.12k
    return fn(pw, set);
386
0
  ctx = FN(PW,get_ctx)(pw);
387
0
  if (!isl_space_has_named_params(pw->dim) ||
388
0
      !isl_space_has_named_params(set->dim))
389
0
    isl_die(ctx, isl_error_invalid,
390
0
      "unaligned unnamed parameters", goto error);
391
0
  pw = FN(PW,align_params)(pw, isl_set_get_space(set));
392
0
  set = isl_set_align_params(set, FN(PW,get_space)(pw));
393
0
  return fn(pw, set);
394
0
error:
395
0
  FN(PW,free)(pw);
396
0
  isl_set_free(set);
397
0
  return NULL;
398
0
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_align_params_pw_set_and
isl_polynomial.c:isl_pw_qpolynomial_align_params_pw_set_and
Line
Count
Source
375
39
{
376
39
  isl_ctx *ctx;
377
39
  isl_bool aligned;
378
39
379
39
  if (!pw || !set)
380
0
    goto error;
381
39
  aligned = isl_set_space_has_equal_params(set, pw->dim);
382
39
  if (aligned < 0)
383
0
    goto error;
384
39
  if (aligned)
385
39
    return fn(pw, set);
386
0
  ctx = FN(PW,get_ctx)(pw);
387
0
  if (!isl_space_has_named_params(pw->dim) ||
388
0
      !isl_space_has_named_params(set->dim))
389
0
    isl_die(ctx, isl_error_invalid,
390
0
      "unaligned unnamed parameters", goto error);
391
0
  pw = FN(PW,align_params)(pw, isl_set_get_space(set));
392
0
  set = isl_set_align_params(set, FN(PW,get_space)(pw));
393
0
  return fn(pw, set);
394
0
error:
395
0
  FN(PW,free)(pw);
396
0
  isl_set_free(set);
397
0
  return NULL;
398
0
}
399
#endif
400
401
static __isl_give PW *FN(PW,union_add_aligned)(__isl_take PW *pw1,
402
  __isl_take PW *pw2)
403
3.92k
{
404
3.92k
  int i, j, n;
405
3.92k
  struct PW *res;
406
3.92k
  isl_ctx *ctx;
407
3.92k
  isl_set *set;
408
3.92k
409
3.92k
  if (!pw1 || !pw2)
410
0
    goto error;
411
3.92k
412
3.92k
  ctx = isl_space_get_ctx(pw1->dim);
413
#ifdef HAS_TYPE
414
0
  if (pw1->type != pw2->type)
415
0
    isl_die(ctx, isl_error_invalid,
416
      "fold types don't match", goto error);
417
#endif
418
3.92k
  isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
419
0
420
3.92k
  if (FN(PW,IS_ZERO)(pw1)) {
421
3.47k
    FN(PW,free)(pw1);
422
3.47k
    return pw2;
423
3.47k
  }
424
447
425
447
  if (FN(PW,IS_ZERO)(pw2)) {
426
290
    FN(PW,free)(pw2);
427
290
    return pw1;
428
290
  }
429
157
430
157
  n = (pw1->n + 1) * (pw2->n + 1);
431
#ifdef HAS_TYPE
432
0
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), pw1->type, n);
433
#else
434
157
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), n);
435
#endif
436
437
349
  for (i = 0; i < pw1->n; 
++i192
) {
438
192
    set = isl_set_copy(pw1->p[i].set);
439
386
    for (j = 0; j < pw2->n; 
++j194
) {
440
194
      struct isl_set *common;
441
194
      EL *sum;
442
194
      common = isl_set_intersect(isl_set_copy(pw1->p[i].set),
443
194
            isl_set_copy(pw2->p[j].set));
444
194
      if (isl_set_plain_is_empty(common)) {
445
168
        isl_set_free(common);
446
168
        continue;
447
168
      }
448
26
      set = isl_set_subtract(set,
449
26
          isl_set_copy(pw2->p[j].set));
450
26
451
26
      sum = FN(EL,add_on_domain)(common,
452
26
               FN(EL,copy)(pw1->p[i].FIELD),
453
26
               FN(EL,copy)(pw2->p[j].FIELD));
454
26
455
26
      res = FN(PW,add_piece)(res, common, sum);
456
26
    }
457
192
    res = FN(PW,add_piece)(res, set, FN(EL,copy)(pw1->p[i].FIELD));
458
192
  }
459
157
460
315
  for (j = 0; j < pw2->n; 
++j158
) {
461
158
    set = isl_set_copy(pw2->p[j].set);
462
352
    for (i = 0; i < pw1->n; 
++i194
)
463
194
      set = isl_set_subtract(set,
464
194
          isl_set_copy(pw1->p[i].set));
465
158
    res = FN(PW,add_piece)(res, set, FN(EL,copy)(pw2->p[j].FIELD));
466
158
  }
467
157
468
157
  FN(PW,free)(pw1);
469
157
  FN(PW,free)(pw2);
470
157
471
157
  return res;
472
157
error:
473
0
  FN(PW,free)(pw1);
474
0
  FN(PW,free)(pw2);
475
0
  return NULL;
476
157
}
isl_aff.c:isl_pw_aff_union_add_aligned
Line
Count
Source
403
3.43k
{
404
3.43k
  int i, j, n;
405
3.43k
  struct PW *res;
406
3.43k
  isl_ctx *ctx;
407
3.43k
  isl_set *set;
408
3.43k
409
3.43k
  if (!pw1 || !pw2)
410
0
    goto error;
411
3.43k
412
3.43k
  ctx = isl_space_get_ctx(pw1->dim);
413
#ifdef HAS_TYPE
414
  if (pw1->type != pw2->type)
415
    isl_die(ctx, isl_error_invalid,
416
      "fold types don't match", goto error);
417
#endif
418
3.43k
  isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
419
3.43k
420
3.43k
  if (FN(PW,IS_ZERO)(pw1)) {
421
3.35k
    FN(PW,free)(pw1);
422
3.35k
    return pw2;
423
3.35k
  }
424
84
425
84
  if (FN(PW,IS_ZERO)(pw2)) {
426
0
    FN(PW,free)(pw2);
427
0
    return pw1;
428
0
  }
429
84
430
84
  n = (pw1->n + 1) * (pw2->n + 1);
431
#ifdef HAS_TYPE
432
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), pw1->type, n);
433
#else
434
84
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), n);
435
84
#endif
436
84
437
169
  for (i = 0; i < pw1->n; 
++i85
) {
438
85
    set = isl_set_copy(pw1->p[i].set);
439
170
    for (j = 0; j < pw2->n; 
++j85
) {
440
85
      struct isl_set *common;
441
85
      EL *sum;
442
85
      common = isl_set_intersect(isl_set_copy(pw1->p[i].set),
443
85
            isl_set_copy(pw2->p[j].set));
444
85
      if (isl_set_plain_is_empty(common)) {
445
83
        isl_set_free(common);
446
83
        continue;
447
83
      }
448
2
      set = isl_set_subtract(set,
449
2
          isl_set_copy(pw2->p[j].set));
450
2
451
2
      sum = FN(EL,add_on_domain)(common,
452
2
               FN(EL,copy)(pw1->p[i].FIELD),
453
2
               FN(EL,copy)(pw2->p[j].FIELD));
454
2
455
2
      res = FN(PW,add_piece)(res, common, sum);
456
2
    }
457
85
    res = FN(PW,add_piece)(res, set, FN(EL,copy)(pw1->p[i].FIELD));
458
85
  }
459
84
460
168
  for (j = 0; j < pw2->n; 
++j84
) {
461
84
    set = isl_set_copy(pw2->p[j].set);
462
169
    for (i = 0; i < pw1->n; 
++i85
)
463
85
      set = isl_set_subtract(set,
464
85
          isl_set_copy(pw1->p[i].set));
465
84
    res = FN(PW,add_piece)(res, set, FN(EL,copy)(pw2->p[j].FIELD));
466
84
  }
467
84
468
84
  FN(PW,free)(pw1);
469
84
  FN(PW,free)(pw2);
470
84
471
84
  return res;
472
84
error:
473
0
  FN(PW,free)(pw1);
474
0
  FN(PW,free)(pw2);
475
0
  return NULL;
476
84
}
isl_aff.c:isl_pw_multi_aff_union_add_aligned
Line
Count
Source
403
464
{
404
464
  int i, j, n;
405
464
  struct PW *res;
406
464
  isl_ctx *ctx;
407
464
  isl_set *set;
408
464
409
464
  if (!pw1 || !pw2)
410
0
    goto error;
411
464
412
464
  ctx = isl_space_get_ctx(pw1->dim);
413
#ifdef HAS_TYPE
414
  if (pw1->type != pw2->type)
415
    isl_die(ctx, isl_error_invalid,
416
      "fold types don't match", goto error);
417
#endif
418
464
  isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
419
464
420
464
  if (FN(PW,IS_ZERO)(pw1)) {
421
125
    FN(PW,free)(pw1);
422
125
    return pw2;
423
125
  }
424
339
425
339
  if (FN(PW,IS_ZERO)(pw2)) {
426
290
    FN(PW,free)(pw2);
427
290
    return pw1;
428
290
  }
429
49
430
49
  n = (pw1->n + 1) * (pw2->n + 1);
431
#ifdef HAS_TYPE
432
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), pw1->type, n);
433
#else
434
49
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), n);
435
49
#endif
436
49
437
131
  for (i = 0; i < pw1->n; 
++i82
) {
438
82
    set = isl_set_copy(pw1->p[i].set);
439
164
    for (j = 0; j < pw2->n; 
++j82
) {
440
82
      struct isl_set *common;
441
82
      EL *sum;
442
82
      common = isl_set_intersect(isl_set_copy(pw1->p[i].set),
443
82
            isl_set_copy(pw2->p[j].set));
444
82
      if (isl_set_plain_is_empty(common)) {
445
80
        isl_set_free(common);
446
80
        continue;
447
80
      }
448
2
      set = isl_set_subtract(set,
449
2
          isl_set_copy(pw2->p[j].set));
450
2
451
2
      sum = FN(EL,add_on_domain)(common,
452
2
               FN(EL,copy)(pw1->p[i].FIELD),
453
2
               FN(EL,copy)(pw2->p[j].FIELD));
454
2
455
2
      res = FN(PW,add_piece)(res, common, sum);
456
2
    }
457
82
    res = FN(PW,add_piece)(res, set, FN(EL,copy)(pw1->p[i].FIELD));
458
82
  }
459
49
460
98
  for (j = 0; j < pw2->n; 
++j49
) {
461
49
    set = isl_set_copy(pw2->p[j].set);
462
131
    for (i = 0; i < pw1->n; 
++i82
)
463
82
      set = isl_set_subtract(set,
464
82
          isl_set_copy(pw1->p[i].set));
465
49
    res = FN(PW,add_piece)(res, set, FN(EL,copy)(pw2->p[j].FIELD));
466
49
  }
467
49
468
49
  FN(PW,free)(pw1);
469
49
  FN(PW,free)(pw2);
470
49
471
49
  return res;
472
49
error:
473
0
  FN(PW,free)(pw1);
474
0
  FN(PW,free)(pw2);
475
0
  return NULL;
476
49
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_union_add_aligned
isl_polynomial.c:isl_pw_qpolynomial_union_add_aligned
Line
Count
Source
403
24
{
404
24
  int i, j, n;
405
24
  struct PW *res;
406
24
  isl_ctx *ctx;
407
24
  isl_set *set;
408
24
409
24
  if (!pw1 || !pw2)
410
0
    goto error;
411
24
412
24
  ctx = isl_space_get_ctx(pw1->dim);
413
#ifdef HAS_TYPE
414
  if (pw1->type != pw2->type)
415
    isl_die(ctx, isl_error_invalid,
416
      "fold types don't match", goto error);
417
#endif
418
24
  isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
419
24
420
24
  if (FN(PW,IS_ZERO)(pw1)) {
421
0
    FN(PW,free)(pw1);
422
0
    return pw2;
423
0
  }
424
24
425
24
  if (FN(PW,IS_ZERO)(pw2)) {
426
0
    FN(PW,free)(pw2);
427
0
    return pw1;
428
0
  }
429
24
430
24
  n = (pw1->n + 1) * (pw2->n + 1);
431
#ifdef HAS_TYPE
432
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), pw1->type, n);
433
#else
434
24
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), n);
435
24
#endif
436
24
437
49
  for (i = 0; i < pw1->n; 
++i25
) {
438
25
    set = isl_set_copy(pw1->p[i].set);
439
52
    for (j = 0; j < pw2->n; 
++j27
) {
440
27
      struct isl_set *common;
441
27
      EL *sum;
442
27
      common = isl_set_intersect(isl_set_copy(pw1->p[i].set),
443
27
            isl_set_copy(pw2->p[j].set));
444
27
      if (isl_set_plain_is_empty(common)) {
445
5
        isl_set_free(common);
446
5
        continue;
447
5
      }
448
22
      set = isl_set_subtract(set,
449
22
          isl_set_copy(pw2->p[j].set));
450
22
451
22
      sum = FN(EL,add_on_domain)(common,
452
22
               FN(EL,copy)(pw1->p[i].FIELD),
453
22
               FN(EL,copy)(pw2->p[j].FIELD));
454
22
455
22
      res = FN(PW,add_piece)(res, common, sum);
456
22
    }
457
25
    res = FN(PW,add_piece)(res, set, FN(EL,copy)(pw1->p[i].FIELD));
458
25
  }
459
24
460
49
  for (j = 0; j < pw2->n; 
++j25
) {
461
25
    set = isl_set_copy(pw2->p[j].set);
462
52
    for (i = 0; i < pw1->n; 
++i27
)
463
27
      set = isl_set_subtract(set,
464
27
          isl_set_copy(pw1->p[i].set));
465
25
    res = FN(PW,add_piece)(res, set, FN(EL,copy)(pw2->p[j].FIELD));
466
25
  }
467
24
468
24
  FN(PW,free)(pw1);
469
24
  FN(PW,free)(pw2);
470
24
471
24
  return res;
472
24
error:
473
0
  FN(PW,free)(pw1);
474
0
  FN(PW,free)(pw2);
475
0
  return NULL;
476
24
}
477
478
/* Private version of "union_add".  For isl_pw_qpolynomial and
479
 * isl_pw_qpolynomial_fold, we prefer to simply call it "add".
480
 */
481
static __isl_give PW *FN(PW,union_add_)(__isl_take PW *pw1, __isl_take PW *pw2)
482
3.92k
{
483
3.92k
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
484
3.92k
            &FN(PW,union_add_aligned));
485
3.92k
}
isl_aff.c:isl_pw_aff_union_add_
Line
Count
Source
482
3.43k
{
483
3.43k
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
484
3.43k
            &FN(PW,union_add_aligned));
485
3.43k
}
isl_aff.c:isl_pw_multi_aff_union_add_
Line
Count
Source
482
464
{
483
464
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
484
464
            &FN(PW,union_add_aligned));
485
464
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_union_add_
isl_polynomial.c:isl_pw_qpolynomial_union_add_
Line
Count
Source
482
24
{
483
24
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
484
24
            &FN(PW,union_add_aligned));
485
24
}
486
487
/* Make sure "pw" has room for at least "n" more pieces.
488
 *
489
 * If there is only one reference to pw, we extend it in place.
490
 * Otherwise, we create a new PW and copy the pieces.
491
 */
492
static __isl_give PW *FN(PW,grow)(__isl_take PW *pw, int n)
493
443
{
494
443
  int i;
495
443
  isl_ctx *ctx;
496
443
  PW *res;
497
443
498
443
  if (!pw)
499
0
    return NULL;
500
443
  if (pw->n + n <= pw->size)
501
0
    return pw;
502
443
  ctx = FN(PW,get_ctx)(pw);
503
443
  n += pw->n;
504
443
  if (pw->ref == 1) {
505
443
    res = isl_realloc(ctx, pw, struct PW,
506
443
          sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
507
443
    if (!res)
508
0
      return FN(PW,free)(pw);
509
443
    res->size = n;
510
443
    return res;
511
443
  }
512
#ifdef HAS_TYPE
513
0
  res = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, n);
514
#else
515
0
  res = FN(PW,alloc_size)(isl_space_copy(pw->dim), n);
516
#endif
517
0
  if (!res)
518
0
    return FN(PW,free)(pw);
519
0
  for (i = 0; i < pw->n; ++i)
520
0
    res = FN(PW,add_piece)(res, isl_set_copy(pw->p[i].set),
521
0
              FN(EL,copy)(pw->p[i].FIELD));
522
0
  FN(PW,free)(pw);
523
0
  return res;
524
0
}
isl_aff.c:isl_pw_aff_grow
Line
Count
Source
493
354
{
494
354
  int i;
495
354
  isl_ctx *ctx;
496
354
  PW *res;
497
354
498
354
  if (!pw)
499
0
    return NULL;
500
354
  if (pw->n + n <= pw->size)
501
0
    return pw;
502
354
  ctx = FN(PW,get_ctx)(pw);
503
354
  n += pw->n;
504
354
  if (pw->ref == 1) {
505
354
    res = isl_realloc(ctx, pw, struct PW,
506
354
          sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
507
354
    if (!res)
508
0
      return FN(PW,free)(pw);
509
354
    res->size = n;
510
354
    return res;
511
354
  }
512
#ifdef HAS_TYPE
513
  res = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, n);
514
#else
515
0
  res = FN(PW,alloc_size)(isl_space_copy(pw->dim), n);
516
0
#endif
517
0
  if (!res)
518
0
    return FN(PW,free)(pw);
519
0
  for (i = 0; i < pw->n; ++i)
520
0
    res = FN(PW,add_piece)(res, isl_set_copy(pw->p[i].set),
521
0
              FN(EL,copy)(pw->p[i].FIELD));
522
0
  FN(PW,free)(pw);
523
0
  return res;
524
0
}
isl_aff.c:isl_pw_multi_aff_grow
Line
Count
Source
493
88
{
494
88
  int i;
495
88
  isl_ctx *ctx;
496
88
  PW *res;
497
88
498
88
  if (!pw)
499
0
    return NULL;
500
88
  if (pw->n + n <= pw->size)
501
0
    return pw;
502
88
  ctx = FN(PW,get_ctx)(pw);
503
88
  n += pw->n;
504
88
  if (pw->ref == 1) {
505
88
    res = isl_realloc(ctx, pw, struct PW,
506
88
          sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
507
88
    if (!res)
508
0
      return FN(PW,free)(pw);
509
88
    res->size = n;
510
88
    return res;
511
88
  }
512
#ifdef HAS_TYPE
513
  res = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, n);
514
#else
515
0
  res = FN(PW,alloc_size)(isl_space_copy(pw->dim), n);
516
0
#endif
517
0
  if (!res)
518
0
    return FN(PW,free)(pw);
519
0
  for (i = 0; i < pw->n; ++i)
520
0
    res = FN(PW,add_piece)(res, isl_set_copy(pw->p[i].set),
521
0
              FN(EL,copy)(pw->p[i].FIELD));
522
0
  FN(PW,free)(pw);
523
0
  return res;
524
0
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_grow
isl_polynomial.c:isl_pw_qpolynomial_grow
Line
Count
Source
493
1
{
494
1
  int i;
495
1
  isl_ctx *ctx;
496
1
  PW *res;
497
1
498
1
  if (!pw)
499
0
    return NULL;
500
1
  if (pw->n + n <= pw->size)
501
0
    return pw;
502
1
  ctx = FN(PW,get_ctx)(pw);
503
1
  n += pw->n;
504
1
  if (pw->ref == 1) {
505
1
    res = isl_realloc(ctx, pw, struct PW,
506
1
          sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
507
1
    if (!res)
508
0
      return FN(PW,free)(pw);
509
1
    res->size = n;
510
1
    return res;
511
1
  }
512
#ifdef HAS_TYPE
513
  res = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, n);
514
#else
515
0
  res = FN(PW,alloc_size)(isl_space_copy(pw->dim), n);
516
0
#endif
517
0
  if (!res)
518
0
    return FN(PW,free)(pw);
519
0
  for (i = 0; i < pw->n; ++i)
520
0
    res = FN(PW,add_piece)(res, isl_set_copy(pw->p[i].set),
521
0
              FN(EL,copy)(pw->p[i].FIELD));
522
0
  FN(PW,free)(pw);
523
0
  return res;
524
0
}
525
526
static __isl_give PW *FN(PW,add_disjoint_aligned)(__isl_take PW *pw1,
527
  __isl_take PW *pw2)
528
8.52k
{
529
8.52k
  int i;
530
8.52k
  isl_ctx *ctx;
531
8.52k
532
8.52k
  if (!pw1 || !pw2)
533
0
    goto error;
534
8.52k
535
8.52k
  if (pw1->size < pw1->n + pw2->n && 
pw1->n < pw2->n4.34k
)
536
3.90k
    return FN(PW,add_disjoint_aligned)(pw2, pw1);
537
4.61k
538
4.61k
  ctx = isl_space_get_ctx(pw1->dim);
539
#ifdef HAS_TYPE
540
0
  if (pw1->type != pw2->type)
541
0
    isl_die(ctx, isl_error_invalid,
542
      "fold types don't match", goto error);
543
#endif
544
4.61k
  isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
545
0
546
4.61k
  if (FN(PW,IS_ZERO)(pw1)) {
547
234
    FN(PW,free)(pw1);
548
234
    return pw2;
549
234
  }
550
4.38k
551
4.38k
  if (FN(PW,IS_ZERO)(pw2)) {
552
3.94k
    FN(PW,free)(pw2);
553
3.94k
    return pw1;
554
3.94k
  }
555
443
556
443
  pw1 = FN(PW,grow)(pw1, pw2->n);
557
443
  if (!pw1)
558
0
    goto error;
559
443
560
886
  
for (i = 0; 443
i < pw2->n;
++i443
)
561
443
    pw1 = FN(PW,add_piece)(pw1,
562
443
        isl_set_copy(pw2->p[i].set),
563
443
        FN(EL,copy)(pw2->p[i].FIELD));
564
443
565
443
  FN(PW,free)(pw2);
566
443
567
443
  return pw1;
568
443
error:
569
0
  FN(PW,free)(pw1);
570
0
  FN(PW,free)(pw2);
571
0
  return NULL;
572
443
}
isl_aff.c:isl_pw_aff_add_disjoint_aligned
Line
Count
Source
528
635
{
529
635
  int i;
530
635
  isl_ctx *ctx;
531
635
532
635
  if (!pw1 || !pw2)
533
0
    goto error;
534
635
535
635
  if (pw1->size < pw1->n + pw2->n && 
pw1->n < pw2->n359
)
536
5
    return FN(PW,add_disjoint_aligned)(pw2, pw1);
537
630
538
630
  ctx = isl_space_get_ctx(pw1->dim);
539
#ifdef HAS_TYPE
540
  if (pw1->type != pw2->type)
541
    isl_die(ctx, isl_error_invalid,
542
      "fold types don't match", goto error);
543
#endif
544
630
  isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
545
630
546
630
  if (FN(PW,IS_ZERO)(pw1)) {
547
234
    FN(PW,free)(pw1);
548
234
    return pw2;
549
234
  }
550
396
551
396
  if (FN(PW,IS_ZERO)(pw2)) {
552
42
    FN(PW,free)(pw2);
553
42
    return pw1;
554
42
  }
555
354
556
354
  pw1 = FN(PW,grow)(pw1, pw2->n);
557
354
  if (!pw1)
558
0
    goto error;
559
354
560
708
  
for (i = 0; 354
i < pw2->n;
++i354
)
561
354
    pw1 = FN(PW,add_piece)(pw1,
562
354
        isl_set_copy(pw2->p[i].set),
563
354
        FN(EL,copy)(pw2->p[i].FIELD));
564
354
565
354
  FN(PW,free)(pw2);
566
354
567
354
  return pw1;
568
354
error:
569
0
  FN(PW,free)(pw1);
570
0
  FN(PW,free)(pw2);
571
0
  return NULL;
572
354
}
isl_aff.c:isl_pw_multi_aff_add_disjoint_aligned
Line
Count
Source
528
7.88k
{
529
7.88k
  int i;
530
7.88k
  isl_ctx *ctx;
531
7.88k
532
7.88k
  if (!pw1 || !pw2)
533
0
    goto error;
534
7.88k
535
7.88k
  if (pw1->size < pw1->n + pw2->n && 
pw1->n < pw2->n3.98k
)
536
3.89k
    return FN(PW,add_disjoint_aligned)(pw2, pw1);
537
3.98k
538
3.98k
  ctx = isl_space_get_ctx(pw1->dim);
539
#ifdef HAS_TYPE
540
  if (pw1->type != pw2->type)
541
    isl_die(ctx, isl_error_invalid,
542
      "fold types don't match", goto error);
543
#endif
544
3.98k
  isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
545
3.98k
546
3.98k
  if (FN(PW,IS_ZERO)(pw1)) {
547
0
    FN(PW,free)(pw1);
548
0
    return pw2;
549
0
  }
550
3.98k
551
3.98k
  if (FN(PW,IS_ZERO)(pw2)) {
552
3.89k
    FN(PW,free)(pw2);
553
3.89k
    return pw1;
554
3.89k
  }
555
88
556
88
  pw1 = FN(PW,grow)(pw1, pw2->n);
557
88
  if (!pw1)
558
0
    goto error;
559
88
560
176
  
for (i = 0; 88
i < pw2->n;
++i88
)
561
88
    pw1 = FN(PW,add_piece)(pw1,
562
88
        isl_set_copy(pw2->p[i].set),
563
88
        FN(EL,copy)(pw2->p[i].FIELD));
564
88
565
88
  FN(PW,free)(pw2);
566
88
567
88
  return pw1;
568
88
error:
569
0
  FN(PW,free)(pw1);
570
0
  FN(PW,free)(pw2);
571
0
  return NULL;
572
88
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_add_disjoint_aligned
isl_polynomial.c:isl_pw_qpolynomial_add_disjoint_aligned
Line
Count
Source
528
3
{
529
3
  int i;
530
3
  isl_ctx *ctx;
531
3
532
3
  if (!pw1 || !pw2)
533
0
    goto error;
534
3
535
3
  if (pw1->size < pw1->n + pw2->n && 
pw1->n < pw2->n2
)
536
1
    return FN(PW,add_disjoint_aligned)(pw2, pw1);
537
2
538
2
  ctx = isl_space_get_ctx(pw1->dim);
539
#ifdef HAS_TYPE
540
  if (pw1->type != pw2->type)
541
    isl_die(ctx, isl_error_invalid,
542
      "fold types don't match", goto error);
543
#endif
544
2
  isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
545
2
546
2
  if (FN(PW,IS_ZERO)(pw1)) {
547
0
    FN(PW,free)(pw1);
548
0
    return pw2;
549
0
  }
550
2
551
2
  if (FN(PW,IS_ZERO)(pw2)) {
552
1
    FN(PW,free)(pw2);
553
1
    return pw1;
554
1
  }
555
1
556
1
  pw1 = FN(PW,grow)(pw1, pw2->n);
557
1
  if (!pw1)
558
0
    goto error;
559
1
560
2
  
for (i = 0; 1
i < pw2->n;
++i1
)
561
1
    pw1 = FN(PW,add_piece)(pw1,
562
1
        isl_set_copy(pw2->p[i].set),
563
1
        FN(EL,copy)(pw2->p[i].FIELD));
564
1
565
1
  FN(PW,free)(pw2);
566
1
567
1
  return pw1;
568
1
error:
569
0
  FN(PW,free)(pw1);
570
0
  FN(PW,free)(pw2);
571
0
  return NULL;
572
1
}
573
574
__isl_give PW *FN(PW,add_disjoint)(__isl_take PW *pw1, __isl_take PW *pw2)
575
4.61k
{
576
4.61k
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
577
4.61k
            &FN(PW,add_disjoint_aligned));
578
4.61k
}
isl_pw_aff_add_disjoint
Line
Count
Source
575
630
{
576
630
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
577
630
            &FN(PW,add_disjoint_aligned));
578
630
}
isl_pw_multi_aff_add_disjoint
Line
Count
Source
575
3.98k
{
576
3.98k
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
577
3.98k
            &FN(PW,add_disjoint_aligned));
578
3.98k
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_add_disjoint
isl_pw_qpolynomial_add_disjoint
Line
Count
Source
575
2
{
576
2
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
577
2
            &FN(PW,add_disjoint_aligned));
578
2
}
579
580
/* This function is currently only used from isl_aff.c
581
 */
582
static __isl_give PW *FN(PW,on_shared_domain_in)(__isl_take PW *pw1,
583
  __isl_take PW *pw2, __isl_take isl_space *space,
584
  __isl_give EL *(*fn)(__isl_take EL *el1, __isl_take EL *el2))
585
  __attribute__ ((unused));
586
587
/* Apply "fn" to pairs of elements from pw1 and pw2 on shared domains.
588
 * The result of "fn" (and therefore also of this function) lives in "space".
589
 */
590
static __isl_give PW *FN(PW,on_shared_domain_in)(__isl_take PW *pw1,
591
  __isl_take PW *pw2, __isl_take isl_space *space,
592
  __isl_give EL *(*fn)(__isl_take EL *el1, __isl_take EL *el2))
593
78.7k
{
594
78.7k
  int i, j, n;
595
78.7k
  PW *res = NULL;
596
78.7k
597
78.7k
  if (!pw1 || !pw2)
598
0
    goto error;
599
78.7k
600
78.7k
  n = pw1->n * pw2->n;
601
#ifdef HAS_TYPE
602
  res = FN(PW,alloc_size)(isl_space_copy(space), pw1->type, n);
603
#else
604
78.7k
  res = FN(PW,alloc_size)(isl_space_copy(space), n);
605
78.7k
#endif
606
78.7k
607
159k
  for (i = 0; i < pw1->n; 
++i81.0k
) {
608
165k
    for (j = 0; j < pw2->n; 
++j84.2k
) {
609
84.2k
      isl_set *common;
610
84.2k
      EL *res_ij;
611
84.2k
      int empty;
612
84.2k
613
84.2k
      common = isl_set_intersect(
614
84.2k
          isl_set_copy(pw1->p[i].set),
615
84.2k
          isl_set_copy(pw2->p[j].set));
616
84.2k
      empty = isl_set_plain_is_empty(common);
617
84.2k
      if (empty < 0 || empty) {
618
2.96k
        isl_set_free(common);
619
2.96k
        if (empty < 0)
620
0
          goto error;
621
2.96k
        continue;
622
2.96k
      }
623
81.2k
624
81.2k
      res_ij = fn(FN(EL,copy)(pw1->p[i].FIELD),
625
81.2k
            FN(EL,copy)(pw2->p[j].FIELD));
626
81.2k
      res_ij = FN(EL,gist)(res_ij, isl_set_copy(common));
627
81.2k
628
81.2k
      res = FN(PW,add_piece)(res, common, res_ij);
629
81.2k
    }
630
81.0k
  }
631
78.7k
632
78.7k
  isl_space_free(space);
633
78.7k
  FN(PW,free)(pw1);
634
78.7k
  FN(PW,free)(pw2);
635
78.7k
  return res;
636
78.7k
error:
637
0
  isl_space_free(space);
638
0
  FN(PW,free)(pw1);
639
0
  FN(PW,free)(pw2);
640
0
  FN(PW,free)(res);
641
0
  return NULL;
642
78.7k
}
isl_aff.c:isl_pw_aff_on_shared_domain_in
Line
Count
Source
593
78.5k
{
594
78.5k
  int i, j, n;
595
78.5k
  PW *res = NULL;
596
78.5k
597
78.5k
  if (!pw1 || !pw2)
598
0
    goto error;
599
78.5k
600
78.5k
  n = pw1->n * pw2->n;
601
#ifdef HAS_TYPE
602
  res = FN(PW,alloc_size)(isl_space_copy(space), pw1->type, n);
603
#else
604
78.5k
  res = FN(PW,alloc_size)(isl_space_copy(space), n);
605
78.5k
#endif
606
78.5k
607
159k
  for (i = 0; i < pw1->n; 
++i80.8k
) {
608
164k
    for (j = 0; j < pw2->n; 
++j84.0k
) {
609
84.0k
      isl_set *common;
610
84.0k
      EL *res_ij;
611
84.0k
      int empty;
612
84.0k
613
84.0k
      common = isl_set_intersect(
614
84.0k
          isl_set_copy(pw1->p[i].set),
615
84.0k
          isl_set_copy(pw2->p[j].set));
616
84.0k
      empty = isl_set_plain_is_empty(common);
617
84.0k
      if (empty < 0 || empty) {
618
2.96k
        isl_set_free(common);
619
2.96k
        if (empty < 0)
620
0
          goto error;
621
2.96k
        continue;
622
2.96k
      }
623
81.0k
624
81.0k
      res_ij = fn(FN(EL,copy)(pw1->p[i].FIELD),
625
81.0k
            FN(EL,copy)(pw2->p[j].FIELD));
626
81.0k
      res_ij = FN(EL,gist)(res_ij, isl_set_copy(common));
627
81.0k
628
81.0k
      res = FN(PW,add_piece)(res, common, res_ij);
629
81.0k
    }
630
80.8k
  }
631
78.5k
632
78.5k
  isl_space_free(space);
633
78.5k
  FN(PW,free)(pw1);
634
78.5k
  FN(PW,free)(pw2);
635
78.5k
  return res;
636
78.5k
error:
637
0
  isl_space_free(space);
638
0
  FN(PW,free)(pw1);
639
0
  FN(PW,free)(pw2);
640
0
  FN(PW,free)(res);
641
0
  return NULL;
642
78.5k
}
isl_aff.c:isl_pw_multi_aff_on_shared_domain_in
Line
Count
Source
593
201
{
594
201
  int i, j, n;
595
201
  PW *res = NULL;
596
201
597
201
  if (!pw1 || !pw2)
598
0
    goto error;
599
201
600
201
  n = pw1->n * pw2->n;
601
#ifdef HAS_TYPE
602
  res = FN(PW,alloc_size)(isl_space_copy(space), pw1->type, n);
603
#else
604
201
  res = FN(PW,alloc_size)(isl_space_copy(space), n);
605
201
#endif
606
201
607
402
  for (i = 0; i < pw1->n; 
++i201
) {
608
405
    for (j = 0; j < pw2->n; 
++j204
) {
609
204
      isl_set *common;
610
204
      EL *res_ij;
611
204
      int empty;
612
204
613
204
      common = isl_set_intersect(
614
204
          isl_set_copy(pw1->p[i].set),
615
204
          isl_set_copy(pw2->p[j].set));
616
204
      empty = isl_set_plain_is_empty(common);
617
204
      if (empty < 0 || empty) {
618
0
        isl_set_free(common);
619
0
        if (empty < 0)
620
0
          goto error;
621
0
        continue;
622
0
      }
623
204
624
204
      res_ij = fn(FN(EL,copy)(pw1->p[i].FIELD),
625
204
            FN(EL,copy)(pw2->p[j].FIELD));
626
204
      res_ij = FN(EL,gist)(res_ij, isl_set_copy(common));
627
204
628
204
      res = FN(PW,add_piece)(res, common, res_ij);
629
204
    }
630
201
  }
631
201
632
201
  isl_space_free(space);
633
201
  FN(PW,free)(pw1);
634
201
  FN(PW,free)(pw2);
635
201
  return res;
636
201
error:
637
0
  isl_space_free(space);
638
0
  FN(PW,free)(pw1);
639
0
  FN(PW,free)(pw2);
640
0
  FN(PW,free)(res);
641
0
  return NULL;
642
201
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_on_shared_domain_in
Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_on_shared_domain_in
643
644
/* This function is currently only used from isl_aff.c
645
 */
646
static __isl_give PW *FN(PW,on_shared_domain)(__isl_take PW *pw1,
647
  __isl_take PW *pw2,
648
  __isl_give EL *(*fn)(__isl_take EL *el1, __isl_take EL *el2))
649
  __attribute__ ((unused));
650
651
/* Apply "fn" to pairs of elements from pw1 and pw2 on shared domains.
652
 * The result of "fn" is assumed to live in the same space as "pw1" and "pw2".
653
 */
654
static __isl_give PW *FN(PW,on_shared_domain)(__isl_take PW *pw1,
655
  __isl_take PW *pw2,
656
  __isl_give EL *(*fn)(__isl_take EL *el1, __isl_take EL *el2))
657
78.5k
{
658
78.5k
  isl_space *space;
659
78.5k
660
78.5k
  if (!pw1 || !pw2)
661
0
    goto error;
662
78.5k
663
78.5k
  space = isl_space_copy(pw1->dim);
664
78.5k
  return FN(PW,on_shared_domain_in)(pw1, pw2, space, fn);
665
78.5k
error:
666
0
  FN(PW,free)(pw1);
667
0
  FN(PW,free)(pw2);
668
0
  return NULL;
669
78.5k
}
isl_aff.c:isl_pw_aff_on_shared_domain
Line
Count
Source
657
78.5k
{
658
78.5k
  isl_space *space;
659
78.5k
660
78.5k
  if (!pw1 || !pw2)
661
0
    goto error;
662
78.5k
663
78.5k
  space = isl_space_copy(pw1->dim);
664
78.5k
  return FN(PW,on_shared_domain_in)(pw1, pw2, space, fn);
665
78.5k
error:
666
0
  FN(PW,free)(pw1);
667
0
  FN(PW,free)(pw2);
668
0
  return NULL;
669
78.5k
}
isl_aff.c:isl_pw_multi_aff_on_shared_domain
Line
Count
Source
657
1
{
658
1
  isl_space *space;
659
1
660
1
  if (!pw1 || !pw2)
661
0
    goto error;
662
1
663
1
  space = isl_space_copy(pw1->dim);
664
1
  return FN(PW,on_shared_domain_in)(pw1, pw2, space, fn);
665
1
error:
666
0
  FN(PW,free)(pw1);
667
0
  FN(PW,free)(pw2);
668
0
  return NULL;
669
1
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_on_shared_domain
Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_on_shared_domain
670
671
#ifndef NO_NEG
672
__isl_give PW *FN(PW,neg)(__isl_take PW *pw)
673
23.9k
{
674
23.9k
  int i;
675
23.9k
676
23.9k
  if (!pw)
677
0
    return NULL;
678
23.9k
679
23.9k
  if (FN(PW,IS_ZERO)(pw))
680
1
    return pw;
681
23.9k
682
23.9k
  pw = FN(PW,cow)(pw);
683
23.9k
  if (!pw)
684
0
    return NULL;
685
23.9k
686
48.6k
  
for (i = 0; 23.9k
i < pw->n;
++i24.7k
) {
687
24.7k
    pw->p[i].FIELD = FN(EL,neg)(pw->p[i].FIELD);
688
24.7k
    if (!pw->p[i].FIELD)
689
24.7k
      
return 0
FN0
(PW,free)(pw);
690
24.7k
  }
691
23.9k
692
23.9k
  return pw;
693
23.9k
}
isl_pw_aff_neg
Line
Count
Source
673
23.9k
{
674
23.9k
  int i;
675
23.9k
676
23.9k
  if (!pw)
677
0
    return NULL;
678
23.9k
679
23.9k
  if (FN(PW,IS_ZERO)(pw))
680
1
    return pw;
681
23.9k
682
23.9k
  pw = FN(PW,cow)(pw);
683
23.9k
  if (!pw)
684
0
    return NULL;
685
23.9k
686
48.6k
  
for (i = 0; 23.9k
i < pw->n;
++i24.6k
) {
687
24.6k
    pw->p[i].FIELD = FN(EL,neg)(pw->p[i].FIELD);
688
24.6k
    if (!pw->p[i].FIELD)
689
24.6k
      
return 0
FN0
(PW,free)(pw);
690
24.6k
  }
691
23.9k
692
23.9k
  return pw;
693
23.9k
}
Unexecuted instantiation: isl_pw_multi_aff_neg
isl_pw_qpolynomial_neg
Line
Count
Source
673
11
{
674
11
  int i;
675
11
676
11
  if (!pw)
677
0
    return NULL;
678
11
679
11
  if (FN(PW,IS_ZERO)(pw))
680
0
    return pw;
681
11
682
11
  pw = FN(PW,cow)(pw);
683
11
  if (!pw)
684
0
    return NULL;
685
11
686
23
  
for (i = 0; 11
i < pw->n;
++i12
) {
687
12
    pw->p[i].FIELD = FN(EL,neg)(pw->p[i].FIELD);
688
12
    if (!pw->p[i].FIELD)
689
12
      
return 0
FN0
(PW,free)(pw);
690
12
  }
691
11
692
11
  return pw;
693
11
}
694
#endif
695
696
#ifndef NO_SUB
697
__isl_give PW *FN(PW,sub)(__isl_take PW *pw1, __isl_take PW *pw2)
698
6.96k
{
699
6.96k
  return FN(PW,add)(pw1, FN(PW,neg)(pw2));
700
6.96k
}
isl_pw_aff_sub
Line
Count
Source
698
6.95k
{
699
6.95k
  return FN(PW,add)(pw1, FN(PW,neg)(pw2));
700
6.95k
}
isl_pw_qpolynomial_sub
Line
Count
Source
698
9
{
699
9
  return FN(PW,add)(pw1, FN(PW,neg)(pw2));
700
9
}
701
#endif
702
703
/* Return the parameter domain of "pw".
704
 */
705
__isl_give isl_set *FN(PW,params)(__isl_take PW *pw)
706
0
{
707
0
  return isl_set_params(FN(PW,domain)(pw));
708
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
709
710
__isl_give isl_set *FN(PW,domain)(__isl_take PW *pw)
711
55.3k
{
712
55.3k
  int i;
713
55.3k
  isl_set *dom;
714
55.3k
715
55.3k
  if (!pw)
716
0
    return NULL;
717
55.3k
718
55.3k
  dom = isl_set_empty(FN(PW,get_domain_space)(pw));
719
112k
  for (i = 0; i < pw->n; 
++i56.9k
)
720
56.9k
    dom = isl_set_union_disjoint(dom, isl_set_copy(pw->p[i].set));
721
55.3k
722
55.3k
  FN(PW,free)(pw);
723
55.3k
724
55.3k
  return dom;
725
55.3k
}
isl_pw_aff_domain
Line
Count
Source
711
54.3k
{
712
54.3k
  int i;
713
54.3k
  isl_set *dom;
714
54.3k
715
54.3k
  if (!pw)
716
0
    return NULL;
717
54.3k
718
54.3k
  dom = isl_set_empty(FN(PW,get_domain_space)(pw));
719
110k
  for (i = 0; i < pw->n; 
++i55.9k
)
720
55.9k
    dom = isl_set_union_disjoint(dom, isl_set_copy(pw->p[i].set));
721
54.3k
722
54.3k
  FN(PW,free)(pw);
723
54.3k
724
54.3k
  return dom;
725
54.3k
}
isl_pw_multi_aff_domain
Line
Count
Source
711
1.02k
{
712
1.02k
  int i;
713
1.02k
  isl_set *dom;
714
1.02k
715
1.02k
  if (!pw)
716
0
    return NULL;
717
1.02k
718
1.02k
  dom = isl_set_empty(FN(PW,get_domain_space)(pw));
719
2.07k
  for (i = 0; i < pw->n; 
++i1.04k
)
720
1.04k
    dom = isl_set_union_disjoint(dom, isl_set_copy(pw->p[i].set));
721
1.02k
722
1.02k
  FN(PW,free)(pw);
723
1.02k
724
1.02k
  return dom;
725
1.02k
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_domain
isl_pw_qpolynomial_domain
Line
Count
Source
711
1
{
712
1
  int i;
713
1
  isl_set *dom;
714
1
715
1
  if (!pw)
716
0
    return NULL;
717
1
718
1
  dom = isl_set_empty(FN(PW,get_domain_space)(pw));
719
2
  for (i = 0; i < pw->n; 
++i1
)
720
1
    dom = isl_set_union_disjoint(dom, isl_set_copy(pw->p[i].set));
721
1
722
1
  FN(PW,free)(pw);
723
1
724
1
  return dom;
725
1
}
726
727
/* Exploit the equalities in the domain of piece "i" of "pw"
728
 * to simplify the associated function.
729
 * If the domain of piece "i" is empty, then remove it entirely,
730
 * replacing it with the final piece.
731
 */
732
static int FN(PW,exploit_equalities_and_remove_if_empty)(__isl_keep PW *pw,
733
  int i)
734
45.9k
{
735
45.9k
  isl_basic_set *aff;
736
45.9k
  int empty = isl_set_plain_is_empty(pw->p[i].set);
737
45.9k
738
45.9k
  if (empty < 0)
739
0
    return -1;
740
45.9k
  if (empty) {
741
53
    isl_set_free(pw->p[i].set);
742
53
    FN(EL,free)(pw->p[i].FIELD);
743
53
    if (i != pw->n - 1)
744
0
      pw->p[i] = pw->p[pw->n - 1];
745
53
    pw->n--;
746
53
747
53
    return 0;
748
53
  }
749
45.8k
750
45.8k
  aff = isl_set_affine_hull(isl_set_copy(pw->p[i].set));
751
45.8k
  pw->p[i].FIELD = FN(EL,substitute_equalities)(pw->p[i].FIELD, aff);
752
45.8k
  if (!pw->p[i].FIELD)
753
45.8k
    
return -10
;
754
45.8k
755
45.8k
  return 0;
756
45.8k
}
isl_aff.c:isl_pw_aff_exploit_equalities_and_remove_if_empty
Line
Count
Source
734
42.8k
{
735
42.8k
  isl_basic_set *aff;
736
42.8k
  int empty = isl_set_plain_is_empty(pw->p[i].set);
737
42.8k
738
42.8k
  if (empty < 0)
739
0
    return -1;
740
42.8k
  if (empty) {
741
48
    isl_set_free(pw->p[i].set);
742
48
    FN(EL,free)(pw->p[i].FIELD);
743
48
    if (i != pw->n - 1)
744
0
      pw->p[i] = pw->p[pw->n - 1];
745
48
    pw->n--;
746
48
747
48
    return 0;
748
48
  }
749
42.8k
750
42.8k
  aff = isl_set_affine_hull(isl_set_copy(pw->p[i].set));
751
42.8k
  pw->p[i].FIELD = FN(EL,substitute_equalities)(pw->p[i].FIELD, aff);
752
42.8k
  if (!pw->p[i].FIELD)
753
42.8k
    
return -10
;
754
42.8k
755
42.8k
  return 0;
756
42.8k
}
isl_aff.c:isl_pw_multi_aff_exploit_equalities_and_remove_if_empty
Line
Count
Source
734
2.99k
{
735
2.99k
  isl_basic_set *aff;
736
2.99k
  int empty = isl_set_plain_is_empty(pw->p[i].set);
737
2.99k
738
2.99k
  if (empty < 0)
739
0
    return -1;
740
2.99k
  if (empty) {
741
5
    isl_set_free(pw->p[i].set);
742
5
    FN(EL,free)(pw->p[i].FIELD);
743
5
    if (i != pw->n - 1)
744
0
      pw->p[i] = pw->p[pw->n - 1];
745
5
    pw->n--;
746
5
747
5
    return 0;
748
5
  }
749
2.99k
750
2.99k
  aff = isl_set_affine_hull(isl_set_copy(pw->p[i].set));
751
2.99k
  pw->p[i].FIELD = FN(EL,substitute_equalities)(pw->p[i].FIELD, aff);
752
2.99k
  if (!pw->p[i].FIELD)
753
2.99k
    
return -10
;
754
2.99k
755
2.99k
  return 0;
756
2.99k
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_exploit_equalities_and_remove_if_empty
isl_polynomial.c:isl_pw_qpolynomial_exploit_equalities_and_remove_if_empty
Line
Count
Source
734
35
{
735
35
  isl_basic_set *aff;
736
35
  int empty = isl_set_plain_is_empty(pw->p[i].set);
737
35
738
35
  if (empty < 0)
739
0
    return -1;
740
35
  if (empty) {
741
0
    isl_set_free(pw->p[i].set);
742
0
    FN(EL,free)(pw->p[i].FIELD);
743
0
    if (i != pw->n - 1)
744
0
      pw->p[i] = pw->p[pw->n - 1];
745
0
    pw->n--;
746
0
747
0
    return 0;
748
0
  }
749
35
750
35
  aff = isl_set_affine_hull(isl_set_copy(pw->p[i].set));
751
35
  pw->p[i].FIELD = FN(EL,substitute_equalities)(pw->p[i].FIELD, aff);
752
35
  if (!pw->p[i].FIELD)
753
35
    
return -10
;
754
35
755
35
  return 0;
756
35
}
757
758
/* Convert a piecewise expression defined over a parameter domain
759
 * into one that is defined over a zero-dimensional set.
760
 */
761
__isl_give PW *FN(PW,from_range)(__isl_take PW *pw)
762
58
{
763
58
  isl_space *space;
764
58
765
58
  if (!pw)
766
0
    return NULL;
767
58
  if (!isl_space_is_set(pw->dim))
768
58
    
isl_die0
(FN(PW,get_ctx)(pw), isl_error_invalid,
769
58
      "not living in a set space", return FN(PW,free)(pw));
770
58
771
58
  space = FN(PW,get_space)(pw);
772
58
  space = isl_space_from_range(space);
773
58
  pw = FN(PW,reset_space)(pw, space);
774
58
775
58
  return pw;
776
58
}
isl_pw_aff_from_range
Line
Count
Source
762
58
{
763
58
  isl_space *space;
764
58
765
58
  if (!pw)
766
0
    return NULL;
767
58
  if (!isl_space_is_set(pw->dim))
768
58
    
isl_die0
(FN(PW,get_ctx)(pw), isl_error_invalid,
769
58
      "not living in a set space", return FN(PW,free)(pw));
770
58
771
58
  space = FN(PW,get_space)(pw);
772
58
  space = isl_space_from_range(space);
773
58
  pw = FN(PW,reset_space)(pw, space);
774
58
775
58
  return pw;
776
58
}
Unexecuted instantiation: isl_pw_multi_aff_from_range
Unexecuted instantiation: isl_pw_qpolynomial_fold_from_range
Unexecuted instantiation: isl_pw_qpolynomial_from_range
777
778
/* Fix the value of the given parameter or domain dimension of "pw"
779
 * to be equal to "value".
780
 */
781
__isl_give PW *FN(PW,fix_si)(__isl_take PW *pw, enum isl_dim_type type,
782
  unsigned pos, int value)
783
0
{
784
0
  int i;
785
0
786
0
  if (!pw)
787
0
    return NULL;
788
0
789
0
  if (type == isl_dim_out)
790
0
    isl_die(FN(PW,get_ctx)(pw), isl_error_invalid,
791
0
      "cannot fix output dimension", return FN(PW,free)(pw));
792
0
793
0
  if (pw->n == 0)
794
0
    return pw;
795
0
796
0
  if (type == isl_dim_in)
797
0
    type = isl_dim_set;
798
0
799
0
  pw = FN(PW,cow)(pw);
800
0
  if (!pw)
801
0
    return FN(PW,free)(pw);
802
0
803
0
  for (i = pw->n - 1; i >= 0; --i) {
804
0
    pw->p[i].set = isl_set_fix_si(pw->p[i].set, type, pos, value);
805
0
    if (FN(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 0)
806
0
      return FN(PW,free)(pw);
807
0
  }
808
0
809
0
  return pw;
810
0
}
Unexecuted instantiation: isl_pw_aff_fix_si
Unexecuted instantiation: isl_pw_multi_aff_fix_si
Unexecuted instantiation: isl_pw_qpolynomial_fold_fix_si
Unexecuted instantiation: isl_pw_qpolynomial_fix_si
811
812
/* Restrict the domain of "pw" by combining each cell
813
 * with "set" through a call to "fn", where "fn" may be
814
 * isl_set_intersect, isl_set_intersect_params or isl_set_subtract.
815
 */
816
static __isl_give PW *FN(PW,restrict_domain_aligned)(__isl_take PW *pw,
817
  __isl_take isl_set *set,
818
  __isl_give isl_set *(*fn)(__isl_take isl_set *set1,
819
            __isl_take isl_set *set2))
820
44.6k
{
821
44.6k
  int i;
822
44.6k
823
44.6k
  if (!pw || !set)
824
0
    goto error;
825
44.6k
826
44.6k
  if (pw->n == 0) {
827
4
    isl_set_free(set);
828
4
    return pw;
829
4
  }
830
44.6k
831
44.6k
  pw = FN(PW,cow)(pw);
832
44.6k
  if (!pw)
833
0
    goto error;
834
44.6k
835
90.5k
  
for (i = pw->n - 1; 44.6k
i >= 0;
--i45.9k
) {
836
45.9k
    pw->p[i].set = fn(pw->p[i].set, isl_set_copy(set));
837
45.9k
    if (FN(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 0)
838
0
      goto error;
839
45.9k
  }
840
44.6k
  
841
44.6k
  isl_set_free(set);
842
44.6k
  return pw;
843
44.6k
error:
844
0
  isl_set_free(set);
845
0
  FN(PW,free)(pw);
846
0
  return NULL;
847
44.6k
}
isl_aff.c:isl_pw_aff_restrict_domain_aligned
Line
Count
Source
820
41.6k
{
821
41.6k
  int i;
822
41.6k
823
41.6k
  if (!pw || !set)
824
0
    goto error;
825
41.6k
826
41.6k
  if (pw->n == 0) {
827
1
    isl_set_free(set);
828
1
    return pw;
829
1
  }
830
41.6k
831
41.6k
  pw = FN(PW,cow)(pw);
832
41.6k
  if (!pw)
833
0
    goto error;
834
41.6k
835
84.5k
  
for (i = pw->n - 1; 41.6k
i >= 0;
--i42.8k
) {
836
42.8k
    pw->p[i].set = fn(pw->p[i].set, isl_set_copy(set));
837
42.8k
    if (FN(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 0)
838
0
      goto error;
839
42.8k
  }
840
41.6k
  
841
41.6k
  isl_set_free(set);
842
41.6k
  return pw;
843
41.6k
error:
844
0
  isl_set_free(set);
845
0
  FN(PW,free)(pw);
846
0
  return NULL;
847
41.6k
}
isl_aff.c:isl_pw_multi_aff_restrict_domain_aligned
Line
Count
Source
820
2.96k
{
821
2.96k
  int i;
822
2.96k
823
2.96k
  if (!pw || !set)
824
0
    goto error;
825
2.96k
826
2.96k
  if (pw->n == 0) {
827
2
    isl_set_free(set);
828
2
    return pw;
829
2
  }
830
2.96k
831
2.96k
  pw = FN(PW,cow)(pw);
832
2.96k
  if (!pw)
833
0
    goto error;
834
2.96k
835
5.96k
  
for (i = pw->n - 1; 2.96k
i >= 0;
--i2.99k
) {
836
2.99k
    pw->p[i].set = fn(pw->p[i].set, isl_set_copy(set));
837
2.99k
    if (FN(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 0)
838
0
      goto error;
839
2.99k
  }
840
2.96k
  
841
2.96k
  isl_set_free(set);
842
2.96k
  return pw;
843
2.96k
error:
844
0
  isl_set_free(set);
845
0
  FN(PW,free)(pw);
846
0
  return NULL;
847
2.96k
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_restrict_domain_aligned
isl_polynomial.c:isl_pw_qpolynomial_restrict_domain_aligned
Line
Count
Source
820
35
{
821
35
  int i;
822
35
823
35
  if (!pw || !set)
824
0
    goto error;
825
35
826
35
  if (pw->n == 0) {
827
1
    isl_set_free(set);
828
1
    return pw;
829
1
  }
830
34
831
34
  pw = FN(PW,cow)(pw);
832
34
  if (!pw)
833
0
    goto error;
834
34
835
68
  
for (i = pw->n - 1; 34
i >= 0;
--i34
) {
836
34
    pw->p[i].set = fn(pw->p[i].set, isl_set_copy(set));
837
34
    if (FN(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 0)
838
0
      goto error;
839
34
  }
840
34
  
841
34
  isl_set_free(set);
842
34
  return pw;
843
34
error:
844
0
  isl_set_free(set);
845
0
  FN(PW,free)(pw);
846
0
  return NULL;
847
34
}
848
849
static __isl_give PW *FN(PW,intersect_domain_aligned)(__isl_take PW *pw,
850
  __isl_take isl_set *set)
851
38.2k
{
852
38.2k
  return FN(PW,restrict_domain_aligned)(pw, set, &isl_set_intersect);
853
38.2k
}
isl_aff.c:isl_pw_aff_intersect_domain_aligned
Line
Count
Source
851
35.9k
{
852
35.9k
  return FN(PW,restrict_domain_aligned)(pw, set, &isl_set_intersect);
853
35.9k
}
isl_aff.c:isl_pw_multi_aff_intersect_domain_aligned
Line
Count
Source
851
2.28k
{
852
2.28k
  return FN(PW,restrict_domain_aligned)(pw, set, &isl_set_intersect);
853
2.28k
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_intersect_domain_aligned
isl_polynomial.c:isl_pw_qpolynomial_intersect_domain_aligned
Line
Count
Source
851
35
{
852
35
  return FN(PW,restrict_domain_aligned)(pw, set, &isl_set_intersect);
853
35
}
854
855
__isl_give PW *FN(PW,intersect_domain)(__isl_take PW *pw,
856
  __isl_take isl_set *context)
857
38.2k
{
858
38.2k
  return FN(PW,align_params_pw_set_and)(pw, context,
859
38.2k
          &FN(PW,intersect_domain_aligned));
860
38.2k
}
isl_pw_aff_intersect_domain
Line
Count
Source
857
35.9k
{
858
35.9k
  return FN(PW,align_params_pw_set_and)(pw, context,
859
35.9k
          &FN(PW,intersect_domain_aligned));
860
35.9k
}
isl_pw_multi_aff_intersect_domain
Line
Count
Source
857
2.28k
{
858
2.28k
  return FN(PW,align_params_pw_set_and)(pw, context,
859
2.28k
          &FN(PW,intersect_domain_aligned));
860
2.28k
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_intersect_domain
isl_pw_qpolynomial_intersect_domain
Line
Count
Source
857
35
{
858
35
  return FN(PW,align_params_pw_set_and)(pw, context,
859
35
          &FN(PW,intersect_domain_aligned));
860
35
}
861
862
static __isl_give PW *FN(PW,intersect_params_aligned)(__isl_take PW *pw,
863
  __isl_take isl_set *set)
864
6.39k
{
865
6.39k
  return FN(PW,restrict_domain_aligned)(pw, set,
866
6.39k
          &isl_set_intersect_params);
867
6.39k
}
isl_aff.c:isl_pw_aff_intersect_params_aligned
Line
Count
Source
864
5.71k
{
865
5.71k
  return FN(PW,restrict_domain_aligned)(pw, set,
866
5.71k
          &isl_set_intersect_params);
867
5.71k
}
isl_aff.c:isl_pw_multi_aff_intersect_params_aligned
Line
Count
Source
864
682
{
865
682
  return FN(PW,restrict_domain_aligned)(pw, set,
866
682
          &isl_set_intersect_params);
867
682
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_intersect_params_aligned
Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_intersect_params_aligned
868
869
/* Intersect the domain of "pw" with the parameter domain "context".
870
 */
871
__isl_give PW *FN(PW,intersect_params)(__isl_take PW *pw,
872
  __isl_take isl_set *context)
873
6.39k
{
874
6.39k
  return FN(PW,align_params_pw_set_and)(pw, context,
875
6.39k
          &FN(PW,intersect_params_aligned));
876
6.39k
}
isl_pw_aff_intersect_params
Line
Count
Source
873
5.71k
{
874
5.71k
  return FN(PW,align_params_pw_set_and)(pw, context,
875
5.71k
          &FN(PW,intersect_params_aligned));
876
5.71k
}
isl_pw_multi_aff_intersect_params
Line
Count
Source
873
682
{
874
682
  return FN(PW,align_params_pw_set_and)(pw, context,
875
682
          &FN(PW,intersect_params_aligned));
876
682
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_intersect_params
Unexecuted instantiation: isl_pw_qpolynomial_intersect_params
877
878
/* Subtract "domain' from the domain of "pw", assuming their
879
 * parameters have been aligned.
880
 */
881
static __isl_give PW *FN(PW,subtract_domain_aligned)(__isl_take PW *pw,
882
  __isl_take isl_set *domain)
883
3
{
884
3
  return FN(PW,restrict_domain_aligned)(pw, domain, &isl_set_subtract);
885
3
}
Unexecuted instantiation: isl_aff.c:isl_pw_aff_subtract_domain_aligned
isl_aff.c:isl_pw_multi_aff_subtract_domain_aligned
Line
Count
Source
883
3
{
884
3
  return FN(PW,restrict_domain_aligned)(pw, domain, &isl_set_subtract);
885
3
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_subtract_domain_aligned
Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_subtract_domain_aligned
886
887
/* Subtract "domain' from the domain of "pw".
888
 */
889
__isl_give PW *FN(PW,subtract_domain)(__isl_take PW *pw,
890
  __isl_take isl_set *domain)
891
3
{
892
3
  return FN(PW,align_params_pw_set_and)(pw, domain,
893
3
          &FN(PW,subtract_domain_aligned));
894
3
}
Unexecuted instantiation: isl_pw_aff_subtract_domain
isl_pw_multi_aff_subtract_domain
Line
Count
Source
891
3
{
892
3
  return FN(PW,align_params_pw_set_and)(pw, domain,
893
3
          &FN(PW,subtract_domain_aligned));
894
3
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_subtract_domain
Unexecuted instantiation: isl_pw_qpolynomial_subtract_domain
895
896
/* Compute the gist of "pw" with respect to the domain constraints
897
 * of "context" for the case where the domain of the last element
898
 * of "pw" is equal to "context".
899
 * Call "fn_el" to compute the gist of this element, replace
900
 * its domain by the universe and drop all other elements
901
 * as their domains are necessarily disjoint from "context".
902
 */
903
static __isl_give PW *FN(PW,gist_last)(__isl_take PW *pw,
904
  __isl_take isl_set *context,
905
  __isl_give EL *(*fn_el)(__isl_take EL *el, __isl_take isl_set *set))
906
10.2k
{
907
10.2k
  int i;
908
10.2k
  isl_space *space;
909
10.2k
910
10.2k
  for (i = 0; i < pw->n - 1; 
++i0
) {
911
0
    isl_set_free(pw->p[i].set);
912
0
    FN(EL,free)(pw->p[i].FIELD);
913
0
  }
914
10.2k
  pw->p[0].FIELD = pw->p[pw->n - 1].FIELD;
915
10.2k
  pw->p[0].set = pw->p[pw->n - 1].set;
916
10.2k
  pw->n = 1;
917
10.2k
918
10.2k
  space = isl_set_get_space(context);
919
10.2k
  pw->p[0].FIELD = fn_el(pw->p[0].FIELD, context);
920
10.2k
  context = isl_set_universe(space);
921
10.2k
  isl_set_free(pw->p[0].set);
922
10.2k
  pw->p[0].set = context;
923
10.2k
924
10.2k
  if (!pw->p[0].FIELD || !pw->p[0].set)
925
0
    return FN(PW,free)(pw);
926
10.2k
927
10.2k
  return pw;
928
10.2k
}
isl_aff.c:isl_pw_aff_gist_last
Line
Count
Source
906
8.29k
{
907
8.29k
  int i;
908
8.29k
  isl_space *space;
909
8.29k
910
8.29k
  for (i = 0; i < pw->n - 1; 
++i0
) {
911
0
    isl_set_free(pw->p[i].set);
912
0
    FN(EL,free)(pw->p[i].FIELD);
913
0
  }
914
8.29k
  pw->p[0].FIELD = pw->p[pw->n - 1].FIELD;
915
8.29k
  pw->p[0].set = pw->p[pw->n - 1].set;
916
8.29k
  pw->n = 1;
917
8.29k
918
8.29k
  space = isl_set_get_space(context);
919
8.29k
  pw->p[0].FIELD = fn_el(pw->p[0].FIELD, context);
920
8.29k
  context = isl_set_universe(space);
921
8.29k
  isl_set_free(pw->p[0].set);
922
8.29k
  pw->p[0].set = context;
923
8.29k
924
8.29k
  if (!pw->p[0].FIELD || !pw->p[0].set)
925
0
    return FN(PW,free)(pw);
926
8.29k
927
8.29k
  return pw;
928
8.29k
}
isl_aff.c:isl_pw_multi_aff_gist_last
Line
Count
Source
906
1.97k
{
907
1.97k
  int i;
908
1.97k
  isl_space *space;
909
1.97k
910
1.97k
  for (i = 0; i < pw->n - 1; 
++i0
) {
911
0
    isl_set_free(pw->p[i].set);
912
0
    FN(EL,free)(pw->p[i].FIELD);
913
0
  }
914
1.97k
  pw->p[0].FIELD = pw->p[pw->n - 1].FIELD;
915
1.97k
  pw->p[0].set = pw->p[pw->n - 1].set;
916
1.97k
  pw->n = 1;
917
1.97k
918
1.97k
  space = isl_set_get_space(context);
919
1.97k
  pw->p[0].FIELD = fn_el(pw->p[0].FIELD, context);
920
1.97k
  context = isl_set_universe(space);
921
1.97k
  isl_set_free(pw->p[0].set);
922
1.97k
  pw->p[0].set = context;
923
1.97k
924
1.97k
  if (!pw->p[0].FIELD || !pw->p[0].set)
925
0
    return FN(PW,free)(pw);
926
1.97k
927
1.97k
  return pw;
928
1.97k
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_gist_last
isl_polynomial.c:isl_pw_qpolynomial_gist_last
Line
Count
Source
906
1
{
907
1
  int i;
908
1
  isl_space *space;
909
1
910
1
  for (i = 0; i < pw->n - 1; 
++i0
) {
911
0
    isl_set_free(pw->p[i].set);
912
0
    FN(EL,free)(pw->p[i].FIELD);
913
0
  }
914
1
  pw->p[0].FIELD = pw->p[pw->n - 1].FIELD;
915
1
  pw->p[0].set = pw->p[pw->n - 1].set;
916
1
  pw->n = 1;
917
1
918
1
  space = isl_set_get_space(context);
919
1
  pw->p[0].FIELD = fn_el(pw->p[0].FIELD, context);
920
1
  context = isl_set_universe(space);
921
1
  isl_set_free(pw->p[0].set);
922
1
  pw->p[0].set = context;
923
1
924
1
  if (!pw->p[0].FIELD || !pw->p[0].set)
925
0
    return FN(PW,free)(pw);
926
1
927
1
  return pw;
928
1
}
929
930
/* Compute the gist of "pw" with respect to the domain constraints
931
 * of "context".  Call "fn_el" to compute the gist of the elements
932
 * and "fn_dom" to compute the gist of the domains.
933
 *
934
 * If the piecewise expression is empty or the context is the universe,
935
 * then nothing can be simplified.
936
 */
937
static __isl_give PW *FN(PW,gist_aligned)(__isl_take PW *pw,
938
  __isl_take isl_set *context,
939
  __isl_give EL *(*fn_el)(__isl_take EL *el,
940
            __isl_take isl_set *set),
941
  __isl_give isl_set *(*fn_dom)(__isl_take isl_set *set,
942
            __isl_take isl_basic_set *bset))
943
13.6k
{
944
13.6k
  int i;
945
13.6k
  int is_universe;
946
13.6k
  isl_bool aligned;
947
13.6k
  isl_basic_set *hull = NULL;
948
13.6k
949
13.6k
  if (!pw || !context)
950
0
    goto error;
951
13.6k
952
13.6k
  if (pw->n == 0) {
953
0
    isl_set_free(context);
954
0
    return pw;
955
0
  }
956
13.6k
957
13.6k
  is_universe = isl_set_plain_is_universe(context);
958
13.6k
  if (is_universe < 0)
959
0
    goto error;
960
13.6k
  if (is_universe) {
961
1.14k
    isl_set_free(context);
962
1.14k
    return pw;
963
1.14k
  }
964
12.5k
965
12.5k
  aligned = isl_set_space_has_equal_params(context, pw->dim);
966
12.5k
  if (aligned < 0)
967
0
    goto error;
968
12.5k
  if (!aligned) {
969
0
    pw = FN(PW,align_params)(pw, isl_set_get_space(context));
970
0
    context = isl_set_align_params(context, FN(PW,get_space)(pw));
971
0
  }
972
12.5k
973
12.5k
  pw = FN(PW,cow)(pw);
974
12.5k
  if (!pw)
975
0
    goto error;
976
12.5k
977
12.5k
  if (pw->n == 1) {
978
12.4k
    int equal;
979
12.4k
980
12.4k
    equal = isl_set_plain_is_equal(pw->p[0].set, context);
981
12.4k
    if (equal < 0)
982
0
      goto error;
983
12.4k
    if (equal)
984
10.2k
      return FN(PW,gist_last)(pw, context, fn_el);
985
2.24k
  }
986
2.24k
987
2.24k
  context = isl_set_compute_divs(context);
988
2.24k
  hull = isl_set_simple_hull(isl_set_copy(context));
989
2.24k
990
4.53k
  for (i = pw->n - 1; i >= 0; 
--i2.28k
) {
991
2.28k
    isl_set *set_i;
992
2.28k
    int empty;
993
2.28k
994
2.28k
    if (i == pw->n - 1) {
995
2.24k
      int equal;
996
2.24k
      equal = isl_set_plain_is_equal(pw->p[i].set, context);
997
2.24k
      if (equal < 0)
998
0
        goto error;
999
2.24k
      if (equal) {
1000
0
        isl_basic_set_free(hull);
1001
0
        return FN(PW,gist_last)(pw, context, fn_el);
1002
0
      }
1003
2.28k
    }
1004
2.28k
    set_i = isl_set_intersect(isl_set_copy(pw->p[i].set),
1005
2.28k
             isl_set_copy(context));
1006
2.28k
    empty = isl_set_plain_is_empty(set_i);
1007
2.28k
    pw->p[i].FIELD = fn_el(pw->p[i].FIELD, set_i);
1008
2.28k
    pw->p[i].set = fn_dom(pw->p[i].set, isl_basic_set_copy(hull));
1009
2.28k
    if (empty < 0 || !pw->p[i].FIELD || !pw->p[i].set)
1010
0
      goto error;
1011
2.28k
    if (empty) {
1012
2
      isl_set_free(pw->p[i].set);
1013
2
      FN(EL,free)(pw->p[i].FIELD);
1014
2
      if (i != pw->n - 1)
1015
0
        pw->p[i] = pw->p[pw->n - 1];
1016
2
      pw->n--;
1017
2
    }
1018
2.28k
  }
1019
2.24k
1020
2.24k
  isl_basic_set_free(hull);
1021
2.24k
  isl_set_free(context);
1022
2.24k
1023
2.24k
  return pw;
1024
2.24k
error:
1025
0
  FN(PW,free)(pw);
1026
0
  isl_basic_set_free(hull);
1027
0
  isl_set_free(context);
1028
0
  return NULL;
1029
2.24k
}
isl_aff.c:isl_pw_aff_gist_aligned
Line
Count
Source
943
11.4k
{
944
11.4k
  int i;
945
11.4k
  int is_universe;
946
11.4k
  isl_bool aligned;
947
11.4k
  isl_basic_set *hull = NULL;
948
11.4k
949
11.4k
  if (!pw || !context)
950
0
    goto error;
951
11.4k
952
11.4k
  if (pw->n == 0) {
953
0
    isl_set_free(context);
954
0
    return pw;
955
0
  }
956
11.4k
957
11.4k
  is_universe = isl_set_plain_is_universe(context);
958
11.4k
  if (is_universe < 0)
959
0
    goto error;
960
11.4k
  if (is_universe) {
961
1.06k
    isl_set_free(context);
962
1.06k
    return pw;
963
1.06k
  }
964
10.4k
965
10.4k
  aligned = isl_set_space_has_equal_params(context, pw->dim);
966
10.4k
  if (aligned < 0)
967
0
    goto error;
968
10.4k
  if (!aligned) {
969
0
    pw = FN(PW,align_params)(pw, isl_set_get_space(context));
970
0
    context = isl_set_align_params(context, FN(PW,get_space)(pw));
971
0
  }
972
10.4k
973
10.4k
  pw = FN(PW,cow)(pw);
974
10.4k
  if (!pw)
975
0
    goto error;
976
10.4k
977
10.4k
  if (pw->n == 1) {
978
10.3k
    int equal;
979
10.3k
980
10.3k
    equal = isl_set_plain_is_equal(pw->p[0].set, context);
981
10.3k
    if (equal < 0)
982
0
      goto error;
983
10.3k
    if (equal)
984
8.29k
      return FN(PW,gist_last)(pw, context, fn_el);
985
2.13k
  }
986
2.13k
987
2.13k
  context = isl_set_compute_divs(context);
988
2.13k
  hull = isl_set_simple_hull(isl_set_copy(context));
989
2.13k
990
4.31k
  for (i = pw->n - 1; i >= 0; 
--i2.17k
) {
991
2.17k
    isl_set *set_i;
992
2.17k
    int empty;
993
2.17k
994
2.17k
    if (i == pw->n - 1) {
995
2.13k
      int equal;
996
2.13k
      equal = isl_set_plain_is_equal(pw->p[i].set, context);
997
2.13k
      if (equal < 0)
998
0
        goto error;
999
2.13k
      if (equal) {
1000
0
        isl_basic_set_free(hull);
1001
0
        return FN(PW,gist_last)(pw, context, fn_el);
1002
0
      }
1003
2.17k
    }
1004
2.17k
    set_i = isl_set_intersect(isl_set_copy(pw->p[i].set),
1005
2.17k
             isl_set_copy(context));
1006
2.17k
    empty = isl_set_plain_is_empty(set_i);
1007
2.17k
    pw->p[i].FIELD = fn_el(pw->p[i].FIELD, set_i);
1008
2.17k
    pw->p[i].set = fn_dom(pw->p[i].set, isl_basic_set_copy(hull));
1009
2.17k
    if (empty < 0 || !pw->p[i].FIELD || !pw->p[i].set)
1010
0
      goto error;
1011
2.17k
    if (empty) {
1012
0
      isl_set_free(pw->p[i].set);
1013
0
      FN(EL,free)(pw->p[i].FIELD);
1014
0
      if (i != pw->n - 1)
1015
0
        pw->p[i] = pw->p[pw->n - 1];
1016
0
      pw->n--;
1017
0
    }
1018
2.17k
  }
1019
2.13k
1020
2.13k
  isl_basic_set_free(hull);
1021
2.13k
  isl_set_free(context);
1022
2.13k
1023
2.13k
  return pw;
1024
2.13k
error:
1025
0
  FN(PW,free)(pw);
1026
0
  isl_basic_set_free(hull);
1027
0
  isl_set_free(context);
1028
0
  return NULL;
1029
2.13k
}
isl_aff.c:isl_pw_multi_aff_gist_aligned
Line
Count
Source
943
2.15k
{
944
2.15k
  int i;
945
2.15k
  int is_universe;
946
2.15k
  isl_bool aligned;
947
2.15k
  isl_basic_set *hull = NULL;
948
2.15k
949
2.15k
  if (!pw || !context)
950
0
    goto error;
951
2.15k
952
2.15k
  if (pw->n == 0) {
953
0
    isl_set_free(context);
954
0
    return pw;
955
0
  }
956
2.15k
957
2.15k
  is_universe = isl_set_plain_is_universe(context);
958
2.15k
  if (is_universe < 0)
959
0
    goto error;
960
2.15k
  if (is_universe) {
961
76
    isl_set_free(context);
962
76
    return pw;
963
76
  }
964
2.08k
965
2.08k
  aligned = isl_set_space_has_equal_params(context, pw->dim);
966
2.08k
  if (aligned < 0)
967
0
    goto error;
968
2.08k
  if (!aligned) {
969
0
    pw = FN(PW,align_params)(pw, isl_set_get_space(context));
970
0
    context = isl_set_align_params(context, FN(PW,get_space)(pw));
971
0
  }
972
2.08k
973
2.08k
  pw = FN(PW,cow)(pw);
974
2.08k
  if (!pw)
975
0
    goto error;
976
2.08k
977
2.08k
  if (pw->n == 1) {
978
2.08k
    int equal;
979
2.08k
980
2.08k
    equal = isl_set_plain_is_equal(pw->p[0].set, context);
981
2.08k
    if (equal < 0)
982
0
      goto error;
983
2.08k
    if (equal)
984
1.97k
      return FN(PW,gist_last)(pw, context, fn_el);
985
108
  }
986
108
987
108
  context = isl_set_compute_divs(context);
988
108
  hull = isl_set_simple_hull(isl_set_copy(context));
989
108
990
216
  for (i = pw->n - 1; i >= 0; 
--i108
) {
991
108
    isl_set *set_i;
992
108
    int empty;
993
108
994
108
    if (i == pw->n - 1) {
995
108
      int equal;
996
108
      equal = isl_set_plain_is_equal(pw->p[i].set, context);
997
108
      if (equal < 0)
998
0
        goto error;
999
108
      if (equal) {
1000
0
        isl_basic_set_free(hull);
1001
0
        return FN(PW,gist_last)(pw, context, fn_el);
1002
0
      }
1003
108
    }
1004
108
    set_i = isl_set_intersect(isl_set_copy(pw->p[i].set),
1005
108
             isl_set_copy(context));
1006
108
    empty = isl_set_plain_is_empty(set_i);
1007
108
    pw->p[i].FIELD = fn_el(pw->p[i].FIELD, set_i);
1008
108
    pw->p[i].set = fn_dom(pw->p[i].set, isl_basic_set_copy(hull));
1009
108
    if (empty < 0 || !pw->p[i].FIELD || !pw->p[i].set)
1010
0
      goto error;
1011
108
    if (empty) {
1012
2
      isl_set_free(pw->p[i].set);
1013
2
      FN(EL,free)(pw->p[i].FIELD);
1014
2
      if (i != pw->n - 1)
1015
0
        pw->p[i] = pw->p[pw->n - 1];
1016
2
      pw->n--;
1017
2
    }
1018
108
  }
1019
108
1020
108
  isl_basic_set_free(hull);
1021
108
  isl_set_free(context);
1022
108
1023
108
  return pw;
1024
108
error:
1025
0
  FN(PW,free)(pw);
1026
0
  isl_basic_set_free(hull);
1027
0
  isl_set_free(context);
1028
0
  return NULL;
1029
108
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_gist_aligned
isl_polynomial.c:isl_pw_qpolynomial_gist_aligned
Line
Count
Source
943
4
{
944
4
  int i;
945
4
  int is_universe;
946
4
  isl_bool aligned;
947
4
  isl_basic_set *hull = NULL;
948
4
949
4
  if (!pw || !context)
950
0
    goto error;
951
4
952
4
  if (pw->n == 0) {
953
0
    isl_set_free(context);
954
0
    return pw;
955
0
  }
956
4
957
4
  is_universe = isl_set_plain_is_universe(context);
958
4
  if (is_universe < 0)
959
0
    goto error;
960
4
  if (is_universe) {
961
0
    isl_set_free(context);
962
0
    return pw;
963
0
  }
964
4
965
4
  aligned = isl_set_space_has_equal_params(context, pw->dim);
966
4
  if (aligned < 0)
967
0
    goto error;
968
4
  if (!aligned) {
969
0
    pw = FN(PW,align_params)(pw, isl_set_get_space(context));
970
0
    context = isl_set_align_params(context, FN(PW,get_space)(pw));
971
0
  }
972
4
973
4
  pw = FN(PW,cow)(pw);
974
4
  if (!pw)
975
0
    goto error;
976
4
977
4
  if (pw->n == 1) {
978
4
    int equal;
979
4
980
4
    equal = isl_set_plain_is_equal(pw->p[0].set, context);
981
4
    if (equal < 0)
982
0
      goto error;
983
4
    if (equal)
984
1
      return FN(PW,gist_last)(pw, context, fn_el);
985
3
  }
986
3
987
3
  context = isl_set_compute_divs(context);
988
3
  hull = isl_set_simple_hull(isl_set_copy(context));
989
3
990
6
  for (i = pw->n - 1; i >= 0; 
--i3
) {
991
3
    isl_set *set_i;
992
3
    int empty;
993
3
994
3
    if (i == pw->n - 1) {
995
3
      int equal;
996
3
      equal = isl_set_plain_is_equal(pw->p[i].set, context);
997
3
      if (equal < 0)
998
0
        goto error;
999
3
      if (equal) {
1000
0
        isl_basic_set_free(hull);
1001
0
        return FN(PW,gist_last)(pw, context, fn_el);
1002
0
      }
1003
3
    }
1004
3
    set_i = isl_set_intersect(isl_set_copy(pw->p[i].set),
1005
3
             isl_set_copy(context));
1006
3
    empty = isl_set_plain_is_empty(set_i);
1007
3
    pw->p[i].FIELD = fn_el(pw->p[i].FIELD, set_i);
1008
3
    pw->p[i].set = fn_dom(pw->p[i].set, isl_basic_set_copy(hull));
1009
3
    if (empty < 0 || !pw->p[i].FIELD || !pw->p[i].set)
1010
0
      goto error;
1011
3
    if (empty) {
1012
0
      isl_set_free(pw->p[i].set);
1013
0
      FN(EL,free)(pw->p[i].FIELD);
1014
0
      if (i != pw->n - 1)
1015
0
        pw->p[i] = pw->p[pw->n - 1];
1016
0
      pw->n--;
1017
0
    }
1018
3
  }
1019
3
1020
3
  isl_basic_set_free(hull);
1021
3
  isl_set_free(context);
1022
3
1023
3
  return pw;
1024
3
error:
1025
0
  FN(PW,free)(pw);
1026
0
  isl_basic_set_free(hull);
1027
0
  isl_set_free(context);
1028
0
  return NULL;
1029
3
}
1030
1031
static __isl_give PW *FN(PW,gist_domain_aligned)(__isl_take PW *pw,
1032
  __isl_take isl_set *set)
1033
13.6k
{
1034
13.6k
  return FN(PW,gist_aligned)(pw, set, &FN(EL,gist),
1035
13.6k
          &isl_set_gist_basic_set);
1036
13.6k
}
isl_aff.c:isl_pw_aff_gist_domain_aligned
Line
Count
Source
1033
11.4k
{
1034
11.4k
  return FN(PW,gist_aligned)(pw, set, &FN(EL,gist),
1035
11.4k
          &isl_set_gist_basic_set);
1036
11.4k
}
isl_aff.c:isl_pw_multi_aff_gist_domain_aligned
Line
Count
Source
1033
2.15k
{
1034
2.15k
  return FN(PW,gist_aligned)(pw, set, &FN(EL,gist),
1035
2.15k
          &isl_set_gist_basic_set);
1036
2.15k
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_gist_domain_aligned
isl_polynomial.c:isl_pw_qpolynomial_gist_domain_aligned
Line
Count
Source
1033
4
{
1034
4
  return FN(PW,gist_aligned)(pw, set, &FN(EL,gist),
1035
4
          &isl_set_gist_basic_set);
1036
4
}
1037
1038
__isl_give PW *FN(PW,gist)(__isl_take PW *pw, __isl_take isl_set *context)
1039
13.6k
{
1040
13.6k
  return FN(PW,align_params_pw_set_and)(pw, context,
1041
13.6k
            &FN(PW,gist_domain_aligned));
1042
13.6k
}
isl_pw_aff_gist
Line
Count
Source
1039
11.4k
{
1040
11.4k
  return FN(PW,align_params_pw_set_and)(pw, context,
1041
11.4k
            &FN(PW,gist_domain_aligned));
1042
11.4k
}
isl_pw_multi_aff_gist
Line
Count
Source
1039
2.15k
{
1040
2.15k
  return FN(PW,align_params_pw_set_and)(pw, context,
1041
2.15k
            &FN(PW,gist_domain_aligned));
1042
2.15k
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_gist
isl_pw_qpolynomial_gist
Line
Count
Source
1039
4
{
1040
4
  return FN(PW,align_params_pw_set_and)(pw, context,
1041
4
            &FN(PW,gist_domain_aligned));
1042
4
}
1043
1044
static __isl_give PW *FN(PW,gist_params_aligned)(__isl_take PW *pw,
1045
  __isl_take isl_set *set)
1046
0
{
1047
0
  return FN(PW,gist_aligned)(pw, set, &FN(EL,gist_params),
1048
0
          &isl_set_gist_params_basic_set);
1049
0
}
Unexecuted instantiation: isl_aff.c:isl_pw_aff_gist_params_aligned
Unexecuted instantiation: isl_aff.c:isl_pw_multi_aff_gist_params_aligned
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_gist_params_aligned
Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_gist_params_aligned
1050
1051
__isl_give PW *FN(PW,gist_params)(__isl_take PW *pw,
1052
  __isl_take isl_set *context)
1053
0
{
1054
0
  return FN(PW,align_params_pw_set_and)(pw, context,
1055
0
            &FN(PW,gist_params_aligned));
1056
0
}
Unexecuted instantiation: isl_pw_aff_gist_params
Unexecuted instantiation: isl_pw_multi_aff_gist_params
Unexecuted instantiation: isl_pw_qpolynomial_fold_gist_params
Unexecuted instantiation: isl_pw_qpolynomial_gist_params
1057
1058
/* Return -1 if the piece "p1" should be sorted before "p2"
1059
 * and 1 if it should be sorted after "p2".
1060
 * Return 0 if they do not need to be sorted in a specific order.
1061
 *
1062
 * The two pieces are compared on the basis of their function value expressions.
1063
 */
1064
static int FN(PW,sort_field_cmp)(const void *p1, const void *p2, void *arg)
1065
2.34k
{
1066
2.34k
  struct FN(PW,piece) const *pc1 = p1;
1067
2.34k
  struct FN(PW,piece) const *pc2 = p2;
1068
2.34k
1069
2.34k
  return FN(EL,plain_cmp)(pc1->FIELD, pc2->FIELD);
1070
2.34k
}
isl_aff.c:isl_pw_aff_sort_field_cmp
Line
Count
Source
1065
581
{
1066
581
  struct FN(PW,piece) const *pc1 = p1;
1067
581
  struct FN(PW,piece) const *pc2 = p2;
1068
581
1069
581
  return FN(EL,plain_cmp)(pc1->FIELD, pc2->FIELD);
1070
581
}
isl_aff.c:isl_pw_multi_aff_sort_field_cmp
Line
Count
Source
1065
1.76k
{
1066
1.76k
  struct FN(PW,piece) const *pc1 = p1;
1067
1.76k
  struct FN(PW,piece) const *pc2 = p2;
1068
1.76k
1069
1.76k
  return FN(EL,plain_cmp)(pc1->FIELD, pc2->FIELD);
1070
1.76k
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_sort_field_cmp
isl_polynomial.c:isl_pw_qpolynomial_sort_field_cmp
Line
Count
Source
1065
1
{
1066
1
  struct FN(PW,piece) const *pc1 = p1;
1067
1
  struct FN(PW,piece) const *pc2 = p2;
1068
1
1069
1
  return FN(EL,plain_cmp)(pc1->FIELD, pc2->FIELD);
1070
1
}
1071
1072
/* Sort the pieces of "pw" according to their function value
1073
 * expressions and then combine pairs of adjacent pieces with
1074
 * the same such expression.
1075
 *
1076
 * The sorting is performed in place because it does not
1077
 * change the meaning of "pw", but care needs to be
1078
 * taken not to change any possible other copies of "pw"
1079
 * in case anything goes wrong.
1080
 */
1081
__isl_give PW *FN(PW,sort)(__isl_take PW *pw)
1082
29.0k
{
1083
29.0k
  int i, j;
1084
29.0k
  isl_set *set;
1085
29.0k
1086
29.0k
  if (!pw)
1087
1
    return NULL;
1088
29.0k
  if (pw->n <= 1)
1089
28.0k
    return pw;
1090
1.00k
  if (isl_sort(pw->p, pw->n, sizeof(pw->p[0]),
1091
1.00k
        &FN(PW,sort_field_cmp), NULL) < 0)
1092
0
    return FN(PW,free)(pw);
1093
2.71k
  
for (i = pw->n - 1; 1.00k
i >= 1;
--i1.71k
) {
1094
1.71k
    if (!FN(EL,plain_is_equal)(pw->p[i - 1].FIELD, pw->p[i].FIELD))
1095
1.66k
      continue;
1096
43
    set = isl_set_union(isl_set_copy(pw->p[i - 1].set),
1097
43
            isl_set_copy(pw->p[i].set));
1098
43
    if (!set)
1099
0
      return FN(PW,free)(pw);
1100
43
    isl_set_free(pw->p[i].set);
1101
43
    FN(EL,free)(pw->p[i].FIELD);
1102
43
    isl_set_free(pw->p[i - 1].set);
1103
43
    pw->p[i - 1].set = set;
1104
56
    for (j = i + 1; j < pw->n; 
++j13
)
1105
13
      pw->p[j - 1] = pw->p[j];
1106
43
    pw->n--;
1107
43
  }
1108
1.00k
1109
1.00k
  return pw;
1110
1.00k
}
isl_pw_aff_sort
Line
Count
Source
1082
24.8k
{
1083
24.8k
  int i, j;
1084
24.8k
  isl_set *set;
1085
24.8k
1086
24.8k
  if (!pw)
1087
1
    return NULL;
1088
24.8k
  if (pw->n <= 1)
1089
24.5k
    return pw;
1090
319
  if (isl_sort(pw->p, pw->n, sizeof(pw->p[0]),
1091
319
        &FN(PW,sort_field_cmp), NULL) < 0)
1092
0
    return FN(PW,free)(pw);
1093
767
  
for (i = pw->n - 1; 319
i >= 1;
--i448
) {
1094
448
    if (!FN(EL,plain_is_equal)(pw->p[i - 1].FIELD, pw->p[i].FIELD))
1095
441
      continue;
1096
7
    set = isl_set_union(isl_set_copy(pw->p[i - 1].set),
1097
7
            isl_set_copy(pw->p[i].set));
1098
7
    if (!set)
1099
0
      return FN(PW,free)(pw);
1100
7
    isl_set_free(pw->p[i].set);
1101
7
    FN(EL,free)(pw->p[i].FIELD);
1102
7
    isl_set_free(pw->p[i - 1].set);
1103
7
    pw->p[i - 1].set = set;
1104
19
    for (j = i + 1; j < pw->n; 
++j12
)
1105
12
      pw->p[j - 1] = pw->p[j];
1106
7
    pw->n--;
1107
7
  }
1108
319
1109
319
  return pw;
1110
319
}
isl_pw_multi_aff_sort
Line
Count
Source
1082
4.24k
{
1083
4.24k
  int i, j;
1084
4.24k
  isl_set *set;
1085
4.24k
1086
4.24k
  if (!pw)
1087
0
    return NULL;
1088
4.24k
  if (pw->n <= 1)
1089
3.56k
    return pw;
1090
682
  if (isl_sort(pw->p, pw->n, sizeof(pw->p[0]),
1091
682
        &FN(PW,sort_field_cmp), NULL) < 0)
1092
0
    return FN(PW,free)(pw);
1093
1.94k
  
for (i = pw->n - 1; 682
i >= 1;
--i1.26k
) {
1094
1.26k
    if (!FN(EL,plain_is_equal)(pw->p[i - 1].FIELD, pw->p[i].FIELD))
1095
1.22k
      continue;
1096
36
    set = isl_set_union(isl_set_copy(pw->p[i - 1].set),
1097
36
            isl_set_copy(pw->p[i].set));
1098
36
    if (!set)
1099
0
      return FN(PW,free)(pw);
1100
36
    isl_set_free(pw->p[i].set);
1101
36
    FN(EL,free)(pw->p[i].FIELD);
1102
36
    isl_set_free(pw->p[i - 1].set);
1103
36
    pw->p[i - 1].set = set;
1104
37
    for (j = i + 1; j < pw->n; 
++j1
)
1105
1
      pw->p[j - 1] = pw->p[j];
1106
36
    pw->n--;
1107
36
  }
1108
682
1109
682
  return pw;
1110
682
}
isl_pw_qpolynomial_fold_sort
Line
Count
Source
1082
2
{
1083
2
  int i, j;
1084
2
  isl_set *set;
1085
2
1086
2
  if (!pw)
1087
0
    return NULL;
1088
2
  if (pw->n <= 1)
1089
2
    return pw;
1090
0
  if (isl_sort(pw->p, pw->n, sizeof(pw->p[0]),
1091
0
        &FN(PW,sort_field_cmp), NULL) < 0)
1092
0
    return FN(PW,free)(pw);
1093
0
  for (i = pw->n - 1; i >= 1; --i) {
1094
0
    if (!FN(EL,plain_is_equal)(pw->p[i - 1].FIELD, pw->p[i].FIELD))
1095
0
      continue;
1096
0
    set = isl_set_union(isl_set_copy(pw->p[i - 1].set),
1097
0
            isl_set_copy(pw->p[i].set));
1098
0
    if (!set)
1099
0
      return FN(PW,free)(pw);
1100
0
    isl_set_free(pw->p[i].set);
1101
0
    FN(EL,free)(pw->p[i].FIELD);
1102
0
    isl_set_free(pw->p[i - 1].set);
1103
0
    pw->p[i - 1].set = set;
1104
0
    for (j = i + 1; j < pw->n; ++j)
1105
0
      pw->p[j - 1] = pw->p[j];
1106
0
    pw->n--;
1107
0
  }
1108
0
1109
0
  return pw;
1110
0
}
isl_pw_qpolynomial_sort
Line
Count
Source
1082
7
{
1083
7
  int i, j;
1084
7
  isl_set *set;
1085
7
1086
7
  if (!pw)
1087
0
    return NULL;
1088
7
  if (pw->n <= 1)
1089
6
    return pw;
1090
1
  if (isl_sort(pw->p, pw->n, sizeof(pw->p[0]),
1091
1
        &FN(PW,sort_field_cmp), NULL) < 0)
1092
0
    return FN(PW,free)(pw);
1093
2
  
for (i = pw->n - 1; 1
i >= 1;
--i1
) {
1094
1
    if (!FN(EL,plain_is_equal)(pw->p[i - 1].FIELD, pw->p[i].FIELD))
1095
1
      continue;
1096
0
    set = isl_set_union(isl_set_copy(pw->p[i - 1].set),
1097
0
            isl_set_copy(pw->p[i].set));
1098
0
    if (!set)
1099
0
      return FN(PW,free)(pw);
1100
0
    isl_set_free(pw->p[i].set);
1101
0
    FN(EL,free)(pw->p[i].FIELD);
1102
0
    isl_set_free(pw->p[i - 1].set);
1103
0
    pw->p[i - 1].set = set;
1104
0
    for (j = i + 1; j < pw->n; ++j)
1105
0
      pw->p[j - 1] = pw->p[j];
1106
0
    pw->n--;
1107
0
  }
1108
1
1109
1
  return pw;
1110
1
}
1111
1112
/* Coalesce the domains of "pw".
1113
 *
1114
 * Prior to the actual coalescing, first sort the pieces such that
1115
 * pieces with the same function value expression are combined
1116
 * into a single piece, the combined domain of which can then
1117
 * be coalesced.
1118
 */
1119
__isl_give PW *FN(PW,coalesce)(__isl_take PW *pw)
1120
24.5k
{
1121
24.5k
  int i;
1122
24.5k
1123
24.5k
  pw = FN(PW,sort)(pw);
1124
24.5k
  if (!pw)
1125
1
    return NULL;
1126
24.5k
1127
49.5k
  
for (i = 0; 24.5k
i < pw->n;
++i25.0k
) {
1128
25.0k
    pw->p[i].set = isl_set_coalesce(pw->p[i].set);
1129
25.0k
    if (!pw->p[i].set)
1130
0
      goto error;
1131
25.0k
  }
1132
24.5k
1133
24.5k
  return pw;
1134
24.5k
error:
1135
0
  FN(PW,free)(pw);
1136
0
  return NULL;
1137
24.5k
}
isl_pw_aff_coalesce
Line
Count
Source
1120
23.4k
{
1121
23.4k
  int i;
1122
23.4k
1123
23.4k
  pw = FN(PW,sort)(pw);
1124
23.4k
  if (!pw)
1125
1
    return NULL;
1126
23.4k
1127
47.3k
  
for (i = 0; 23.4k
i < pw->n;
++i23.8k
) {
1128
23.8k
    pw->p[i].set = isl_set_coalesce(pw->p[i].set);
1129
23.8k
    if (!pw->p[i].set)
1130
0
      goto error;
1131
23.8k
  }
1132
23.4k
1133
23.4k
  return pw;
1134
23.4k
error:
1135
0
  FN(PW,free)(pw);
1136
0
  return NULL;
1137
23.4k
}
isl_pw_multi_aff_coalesce
Line
Count
Source
1120
1.07k
{
1121
1.07k
  int i;
1122
1.07k
1123
1.07k
  pw = FN(PW,sort)(pw);
1124
1.07k
  if (!pw)
1125
0
    return NULL;
1126
1.07k
1127
2.22k
  
for (i = 0; 1.07k
i < pw->n;
++i1.14k
) {
1128
1.14k
    pw->p[i].set = isl_set_coalesce(pw->p[i].set);
1129
1.14k
    if (!pw->p[i].set)
1130
0
      goto error;
1131
1.14k
  }
1132
1.07k
1133
1.07k
  return pw;
1134
1.07k
error:
1135
0
  FN(PW,free)(pw);
1136
0
  return NULL;
1137
1.07k
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_coalesce
isl_pw_qpolynomial_coalesce
Line
Count
Source
1120
1
{
1121
1
  int i;
1122
1
1123
1
  pw = FN(PW,sort)(pw);
1124
1
  if (!pw)
1125
0
    return NULL;
1126
1
1127
3
  
for (i = 0; 1
i < pw->n;
++i2
) {
1128
2
    pw->p[i].set = isl_set_coalesce(pw->p[i].set);
1129
2
    if (!pw->p[i].set)
1130
0
      goto error;
1131
2
  }
1132
1
1133
1
  return pw;
1134
1
error:
1135
0
  FN(PW,free)(pw);
1136
0
  return NULL;
1137
1
}
1138
1139
isl_ctx *FN(PW,get_ctx)(__isl_keep PW *pw)
1140
25.0k
{
1141
25.0k
  return pw ? isl_space_get_ctx(pw->dim) : NULL;
1142
25.0k
}
isl_pw_aff_get_ctx
Line
Count
Source
1140
21.8k
{
1141
21.8k
  return pw ? isl_space_get_ctx(pw->dim) : NULL;
1142
21.8k
}
isl_pw_multi_aff_get_ctx
Line
Count
Source
1140
3.22k
{
1141
3.22k
  return pw ? isl_space_get_ctx(pw->dim) : NULL;
1142
3.22k
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_get_ctx
isl_pw_qpolynomial_get_ctx
Line
Count
Source
1140
1
{
1141
1
  return pw ? isl_space_get_ctx(pw->dim) : NULL;
1142
1
}
1143
1144
#ifndef NO_INVOLVES_DIMS
1145
isl_bool FN(PW,involves_dims)(__isl_keep PW *pw, enum isl_dim_type type,
1146
  unsigned first, unsigned n)
1147
217
{
1148
217
  int i;
1149
217
  enum isl_dim_type set_type;
1150
217
1151
217
  if (!pw)
1152
0
    return isl_bool_error;
1153
217
  if (pw->n == 0 || n == 0)
1154
0
    return isl_bool_false;
1155
217
1156
217
  set_type = type == isl_dim_in ? isl_dim_set : 
type0
;
1157
217
1158
434
  for (i = 0; i < pw->n; 
++i217
) {
1159
217
    isl_bool involves = FN(EL,involves_dims)(pw->p[i].FIELD,
1160
217
              type, first, n);
1161
217
    if (involves < 0 || involves)
1162
0
      return involves;
1163
217
    involves = isl_set_involves_dims(pw->p[i].set,
1164
217
              set_type, first, n);
1165
217
    if (involves < 0 || involves)
1166
0
      return involves;
1167
217
  }
1168
217
  return isl_bool_false;
1169
217
}
isl_pw_aff_involves_dims
Line
Count
Source
1147
217
{
1148
217
  int i;
1149
217
  enum isl_dim_type set_type;
1150
217
1151
217
  if (!pw)
1152
0
    return isl_bool_error;
1153
217
  if (pw->n == 0 || n == 0)
1154
0
    return isl_bool_false;
1155
217
1156
217
  set_type = type == isl_dim_in ? isl_dim_set : 
type0
;
1157
217
1158
434
  for (i = 0; i < pw->n; 
++i217
) {
1159
217
    isl_bool involves = FN(EL,involves_dims)(pw->p[i].FIELD,
1160
217
              type, first, n);
1161
217
    if (involves < 0 || involves)
1162
0
      return involves;
1163
217
    involves = isl_set_involves_dims(pw->p[i].set,
1164
217
              set_type, first, n);
1165
217
    if (involves < 0 || involves)
1166
0
      return involves;
1167
217
  }
1168
217
  return isl_bool_false;
1169
217
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_involves_dims
Unexecuted instantiation: isl_pw_qpolynomial_involves_dims
1170
#endif
1171
1172
__isl_give PW *FN(PW,set_dim_name)(__isl_take PW *pw,
1173
  enum isl_dim_type type, unsigned pos, const char *s)
1174
0
{
1175
0
  int i;
1176
0
  enum isl_dim_type set_type;
1177
0
1178
0
  pw = FN(PW,cow)(pw);
1179
0
  if (!pw)
1180
0
    return NULL;
1181
0
1182
0
  set_type = type == isl_dim_in ? isl_dim_set : type;
1183
0
1184
0
  pw->dim = isl_space_set_dim_name(pw->dim, type, pos, s);
1185
0
  if (!pw->dim)
1186
0
    goto error;
1187
0
1188
0
  for (i = 0; i < pw->n; ++i) {
1189
0
    pw->p[i].set = isl_set_set_dim_name(pw->p[i].set,
1190
0
              set_type, pos, s);
1191
0
    if (!pw->p[i].set)
1192
0
      goto error;
1193
0
    pw->p[i].FIELD = FN(EL,set_dim_name)(pw->p[i].FIELD, type, pos, s);
1194
0
    if (!pw->p[i].FIELD)
1195
0
      goto error;
1196
0
  }
1197
0
1198
0
  return pw;
1199
0
error:
1200
0
  FN(PW,free)(pw);
1201
0
  return NULL;
1202
0
}
Unexecuted instantiation: isl_pw_aff_set_dim_name
Unexecuted instantiation: isl_pw_multi_aff_set_dim_name
Unexecuted instantiation: isl_pw_qpolynomial_fold_set_dim_name
Unexecuted instantiation: isl_pw_qpolynomial_set_dim_name
1203
1204
#ifndef NO_DROP_DIMS
1205
__isl_give PW *FN(PW,drop_dims)(__isl_take PW *pw,
1206
  enum isl_dim_type type, unsigned first, unsigned n)
1207
827
{
1208
827
  int i;
1209
827
  enum isl_dim_type set_type;
1210
827
1211
827
  if (!pw)
1212
0
    return NULL;
1213
827
  if (n == 0 && 
!isl_space_get_tuple_name(pw->dim, type)0
)
1214
0
    return pw;
1215
827
1216
827
  set_type = type == isl_dim_in ? 
isl_dim_set217
:
type610
;
1217
827
1218
827
  pw = FN(PW,cow)(pw);
1219
827
  if (!pw)
1220
0
    return NULL;
1221
827
  pw->dim = isl_space_drop_dims(pw->dim, type, first, n);
1222
827
  if (!pw->dim)
1223
0
    goto error;
1224
1.65k
  
for (i = 0; 827
i < pw->n;
++i827
) {
1225
827
    pw->p[i].FIELD = FN(EL,drop_dims)(pw->p[i].FIELD, type, first, n);
1226
827
    if (!pw->p[i].FIELD)
1227
827
      
goto error0
;
1228
827
    if (type == isl_dim_out)
1229
610
      continue;
1230
217
    pw->p[i].set = isl_set_drop(pw->p[i].set, set_type, first, n);
1231
217
    if (!pw->p[i].set)
1232
0
      goto error;
1233
217
  }
1234
827
1235
827
  return pw;
1236
827
error:
1237
0
  FN(PW,free)(pw);
1238
0
  return NULL;
1239
827
}
isl_pw_aff_drop_dims
Line
Count
Source
1207
217
{
1208
217
  int i;
1209
217
  enum isl_dim_type set_type;
1210
217
1211
217
  if (!pw)
1212
0
    return NULL;
1213
217
  if (n == 0 && 
!isl_space_get_tuple_name(pw->dim, type)0
)
1214
0
    return pw;
1215
217
1216
217
  set_type = type == isl_dim_in ? isl_dim_set : 
type0
;
1217
217
1218
217
  pw = FN(PW,cow)(pw);
1219
217
  if (!pw)
1220
0
    return NULL;
1221
217
  pw->dim = isl_space_drop_dims(pw->dim, type, first, n);
1222
217
  if (!pw->dim)
1223
0
    goto error;
1224
434
  
for (i = 0; 217
i < pw->n;
++i217
) {
1225
217
    pw->p[i].FIELD = FN(EL,drop_dims)(pw->p[i].FIELD, type, first, n);
1226
217
    if (!pw->p[i].FIELD)
1227
217
      
goto error0
;
1228
217
    if (type == isl_dim_out)
1229
0
      continue;
1230
217
    pw->p[i].set = isl_set_drop(pw->p[i].set, set_type, first, n);
1231
217
    if (!pw->p[i].set)
1232
0
      goto error;
1233
217
  }
1234
217
1235
217
  return pw;
1236
217
error:
1237
0
  FN(PW,free)(pw);
1238
0
  return NULL;
1239
217
}
isl_pw_multi_aff_drop_dims
Line
Count
Source
1207
610
{
1208
610
  int i;
1209
610
  enum isl_dim_type set_type;
1210
610
1211
610
  if (!pw)
1212
0
    return NULL;
1213
610
  if (n == 0 && 
!isl_space_get_tuple_name(pw->dim, type)0
)
1214
0
    return pw;
1215
610
1216
610
  set_type = type == isl_dim_in ? 
isl_dim_set0
: type;
1217
610
1218
610
  pw = FN(PW,cow)(pw);
1219
610
  if (!pw)
1220
0
    return NULL;
1221
610
  pw->dim = isl_space_drop_dims(pw->dim, type, first, n);
1222
610
  if (!pw->dim)
1223
0
    goto error;
1224
1.22k
  
for (i = 0; 610
i < pw->n;
++i610
) {
1225
610
    pw->p[i].FIELD = FN(EL,drop_dims)(pw->p[i].FIELD, type, first, n);
1226
610
    if (!pw->p[i].FIELD)
1227
610
      
goto error0
;
1228
610
    if (type == isl_dim_out)
1229
610
      continue;
1230
0
    pw->p[i].set = isl_set_drop(pw->p[i].set, set_type, first, n);
1231
0
    if (!pw->p[i].set)
1232
0
      goto error;
1233
0
  }
1234
610
1235
610
  return pw;
1236
610
error:
1237
0
  FN(PW,free)(pw);
1238
0
  return NULL;
1239
610
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_drop_dims
Unexecuted instantiation: isl_pw_qpolynomial_drop_dims
1240
1241
/* This function is very similar to drop_dims.
1242
 * The only difference is that the cells may still involve
1243
 * the specified dimensions.  They are removed using
1244
 * isl_set_project_out instead of isl_set_drop.
1245
 */
1246
__isl_give PW *FN(PW,project_out)(__isl_take PW *pw,
1247
  enum isl_dim_type type, unsigned first, unsigned n)
1248
203
{
1249
203
  int i;
1250
203
  enum isl_dim_type set_type;
1251
203
1252
203
  if (!pw)
1253
0
    return NULL;
1254
203
  if (n == 0 && 
!isl_space_get_tuple_name(pw->dim, type)19
)
1255
0
    return pw;
1256
203
1257
203
  set_type = type == isl_dim_in ? isl_dim_set : 
type0
;
1258
203
1259
203
  pw = FN(PW,cow)(pw);
1260
203
  if (!pw)
1261
0
    return NULL;
1262
203
  pw->dim = isl_space_drop_dims(pw->dim, type, first, n);
1263
203
  if (!pw->dim)
1264
0
    goto error;
1265
587
  
for (i = 0; 203
i < pw->n;
++i384
) {
1266
384
    pw->p[i].set = isl_set_project_out(pw->p[i].set,
1267
384
              set_type, first, n);
1268
384
    if (!pw->p[i].set)
1269
0
      goto error;
1270
384
    pw->p[i].FIELD = FN(EL,drop_dims)(pw->p[i].FIELD, type, first, n);
1271
384
    if (!pw->p[i].FIELD)
1272
384
      
goto error0
;
1273
384
  }
1274
203
1275
203
  return pw;
1276
203
error:
1277
0
  FN(PW,free)(pw);
1278
0
  return NULL;
1279
203
}
isl_pw_aff_project_out
Line
Count
Source
1248
7
{
1249
7
  int i;
1250
7
  enum isl_dim_type set_type;
1251
7
1252
7
  if (!pw)
1253
0
    return NULL;
1254
7
  if (n == 0 && !isl_space_get_tuple_name(pw->dim, type))
1255
0
    return pw;
1256
7
1257
7
  set_type = type == isl_dim_in ? isl_dim_set : 
type0
;
1258
7
1259
7
  pw = FN(PW,cow)(pw);
1260
7
  if (!pw)
1261
0
    return NULL;
1262
7
  pw->dim = isl_space_drop_dims(pw->dim, type, first, n);
1263
7
  if (!pw->dim)
1264
0
    goto error;
1265
16
  
for (i = 0; 7
i < pw->n;
++i9
) {
1266
9
    pw->p[i].set = isl_set_project_out(pw->p[i].set,
1267
9
              set_type, first, n);
1268
9
    if (!pw->p[i].set)
1269
0
      goto error;
1270
9
    pw->p[i].FIELD = FN(EL,drop_dims)(pw->p[i].FIELD, type, first, n);
1271
9
    if (!pw->p[i].FIELD)
1272
9
      
goto error0
;
1273
9
  }
1274
7
1275
7
  return pw;
1276
7
error:
1277
0
  FN(PW,free)(pw);
1278
0
  return NULL;
1279
7
}
isl_pw_multi_aff_project_out
Line
Count
Source
1248
195
{
1249
195
  int i;
1250
195
  enum isl_dim_type set_type;
1251
195
1252
195
  if (!pw)
1253
0
    return NULL;
1254
195
  if (n == 0 && 
!isl_space_get_tuple_name(pw->dim, type)11
)
1255
0
    return pw;
1256
195
1257
195
  set_type = type == isl_dim_in ? isl_dim_set : 
type0
;
1258
195
1259
195
  pw = FN(PW,cow)(pw);
1260
195
  if (!pw)
1261
0
    return NULL;
1262
195
  pw->dim = isl_space_drop_dims(pw->dim, type, first, n);
1263
195
  if (!pw->dim)
1264
0
    goto error;
1265
569
  
for (i = 0; 195
i < pw->n;
++i374
) {
1266
374
    pw->p[i].set = isl_set_project_out(pw->p[i].set,
1267
374
              set_type, first, n);
1268
374
    if (!pw->p[i].set)
1269
0
      goto error;
1270
374
    pw->p[i].FIELD = FN(EL,drop_dims)(pw->p[i].FIELD, type, first, n);
1271
374
    if (!pw->p[i].FIELD)
1272
374
      
goto error0
;
1273
374
  }
1274
195
1275
195
  return pw;
1276
195
error:
1277
0
  FN(PW,free)(pw);
1278
0
  return NULL;
1279
195
}
isl_pw_qpolynomial_fold_project_out
Line
Count
Source
1248
1
{
1249
1
  int i;
1250
1
  enum isl_dim_type set_type;
1251
1
1252
1
  if (!pw)
1253
0
    return NULL;
1254
1
  if (n == 0 && !isl_space_get_tuple_name(pw->dim, type))
1255
0
    return pw;
1256
1
1257
1
  set_type = type == isl_dim_in ? isl_dim_set : 
type0
;
1258
1
1259
1
  pw = FN(PW,cow)(pw);
1260
1
  if (!pw)
1261
0
    return NULL;
1262
1
  pw->dim = isl_space_drop_dims(pw->dim, type, first, n);
1263
1
  if (!pw->dim)
1264
0
    goto error;
1265
2
  
for (i = 0; 1
i < pw->n;
++i1
) {
1266
1
    pw->p[i].set = isl_set_project_out(pw->p[i].set,
1267
1
              set_type, first, n);
1268
1
    if (!pw->p[i].set)
1269
0
      goto error;
1270
1
    pw->p[i].FIELD = FN(EL,drop_dims)(pw->p[i].FIELD, type, first, n);
1271
1
    if (!pw->p[i].FIELD)
1272
1
      
goto error0
;
1273
1
  }
1274
1
1275
1
  return pw;
1276
1
error:
1277
0
  FN(PW,free)(pw);
1278
0
  return NULL;
1279
1
}
Unexecuted instantiation: isl_pw_qpolynomial_project_out
1280
1281
/* Project the domain of pw onto its parameter space.
1282
 */
1283
__isl_give PW *FN(PW,project_domain_on_params)(__isl_take PW *pw)
1284
19
{
1285
19
  isl_space *space;
1286
19
  unsigned n;
1287
19
1288
19
  n = FN(PW,dim)(pw, isl_dim_in);
1289
19
  pw = FN(PW,project_out)(pw, isl_dim_in, 0, n);
1290
19
  space = FN(PW,get_domain_space)(pw);
1291
19
  space = isl_space_params(space);
1292
19
  pw = FN(PW,reset_domain_space)(pw, space);
1293
19
  return pw;
1294
19
}
isl_pw_aff_project_domain_on_params
Line
Count
Source
1284
7
{
1285
7
  isl_space *space;
1286
7
  unsigned n;
1287
7
1288
7
  n = FN(PW,dim)(pw, isl_dim_in);
1289
7
  pw = FN(PW,project_out)(pw, isl_dim_in, 0, n);
1290
7
  space = FN(PW,get_domain_space)(pw);
1291
7
  space = isl_space_params(space);
1292
7
  pw = FN(PW,reset_domain_space)(pw, space);
1293
7
  return pw;
1294
7
}
isl_pw_multi_aff_project_domain_on_params
Line
Count
Source
1284
11
{
1285
11
  isl_space *space;
1286
11
  unsigned n;
1287
11
1288
11
  n = FN(PW,dim)(pw, isl_dim_in);
1289
11
  pw = FN(PW,project_out)(pw, isl_dim_in, 0, n);
1290
11
  space = FN(PW,get_domain_space)(pw);
1291
11
  space = isl_space_params(space);
1292
11
  pw = FN(PW,reset_domain_space)(pw, space);
1293
11
  return pw;
1294
11
}
isl_pw_qpolynomial_fold_project_domain_on_params
Line
Count
Source
1284
1
{
1285
1
  isl_space *space;
1286
1
  unsigned n;
1287
1
1288
1
  n = FN(PW,dim)(pw, isl_dim_in);
1289
1
  pw = FN(PW,project_out)(pw, isl_dim_in, 0, n);
1290
1
  space = FN(PW,get_domain_space)(pw);
1291
1
  space = isl_space_params(space);
1292
1
  pw = FN(PW,reset_domain_space)(pw, space);
1293
1
  return pw;
1294
1
}
Unexecuted instantiation: isl_pw_qpolynomial_project_domain_on_params
1295
#endif
1296
1297
#ifndef NO_INSERT_DIMS
1298
__isl_give PW *FN(PW,insert_dims)(__isl_take PW *pw, enum isl_dim_type type,
1299
  unsigned first, unsigned n)
1300
3.83k
{
1301
3.83k
  int i;
1302
3.83k
  enum isl_dim_type set_type;
1303
3.83k
1304
3.83k
  if (!pw)
1305
0
    return NULL;
1306
3.83k
  if (n == 0 && 
!isl_space_is_named_or_nested(pw->dim, type)15
)
1307
13
    return pw;
1308
3.82k
1309
3.82k
  set_type = type == isl_dim_in ? isl_dim_set : 
type0
;
1310
3.82k
1311
3.82k
  pw = FN(PW,cow)(pw);
1312
3.82k
  if (!pw)
1313
0
    return NULL;
1314
3.82k
1315
3.82k
  pw->dim = isl_space_insert_dims(pw->dim, type, first, n);
1316
3.82k
  if (!pw->dim)
1317
0
    goto error;
1318
3.82k
1319
7.64k
  
for (i = 0; 3.82k
i < pw->n;
++i3.82k
) {
1320
3.82k
    pw->p[i].set = isl_set_insert_dims(pw->p[i].set,
1321
3.82k
                  set_type, first, n);
1322
3.82k
    if (!pw->p[i].set)
1323
0
      goto error;
1324
3.82k
    pw->p[i].FIELD = FN(EL,insert_dims)(pw->p[i].FIELD,
1325
3.82k
                type, first, n);
1326
3.82k
    if (!pw->p[i].FIELD)
1327
3.82k
      
goto error0
;
1328
3.82k
  }
1329
3.82k
1330
3.82k
  return pw;
1331
3.82k
error:
1332
0
  FN(PW,free)(pw);
1333
0
  return NULL;
1334
3.82k
}
isl_pw_aff_insert_dims
Line
Count
Source
1300
3.83k
{
1301
3.83k
  int i;
1302
3.83k
  enum isl_dim_type set_type;
1303
3.83k
1304
3.83k
  if (!pw)
1305
0
    return NULL;
1306
3.83k
  if (n == 0 && 
!isl_space_is_named_or_nested(pw->dim, type)15
)
1307
13
    return pw;
1308
3.82k
1309
3.82k
  set_type = type == isl_dim_in ? isl_dim_set : 
type0
;
1310
3.82k
1311
3.82k
  pw = FN(PW,cow)(pw);
1312
3.82k
  if (!pw)
1313
0
    return NULL;
1314
3.82k
1315
3.82k
  pw->dim = isl_space_insert_dims(pw->dim, type, first, n);
1316
3.82k
  if (!pw->dim)
1317
0
    goto error;
1318
3.82k
1319
7.64k
  
for (i = 0; 3.82k
i < pw->n;
++i3.82k
) {
1320
3.82k
    pw->p[i].set = isl_set_insert_dims(pw->p[i].set,
1321
3.82k
                  set_type, first, n);
1322
3.82k
    if (!pw->p[i].set)
1323
0
      goto error;
1324
3.82k
    pw->p[i].FIELD = FN(EL,insert_dims)(pw->p[i].FIELD,
1325
3.82k
                type, first, n);
1326
3.82k
    if (!pw->p[i].FIELD)
1327
3.82k
      
goto error0
;
1328
3.82k
  }
1329
3.82k
1330
3.82k
  return pw;
1331
3.82k
error:
1332
0
  FN(PW,free)(pw);
1333
0
  return NULL;
1334
3.82k
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_insert_dims
Unexecuted instantiation: isl_pw_qpolynomial_insert_dims
1335
#endif
1336
1337
__isl_give PW *FN(PW,fix_dim)(__isl_take PW *pw,
1338
  enum isl_dim_type type, unsigned pos, isl_int v)
1339
1
{
1340
1
  int i;
1341
1
1342
1
  if (!pw)
1343
0
    return NULL;
1344
1
1345
1
  if (type == isl_dim_in)
1346
0
    type = isl_dim_set;
1347
1
1348
1
  pw = FN(PW,cow)(pw);
1349
1
  if (!pw)
1350
0
    return NULL;
1351
2
  
for (i = 0; 1
i < pw->n;
++i1
) {
1352
1
    pw->p[i].set = isl_set_fix(pw->p[i].set, type, pos, v);
1353
1
    if (FN(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 0)
1354
0
      return FN(PW,free)(pw);
1355
1
  }
1356
1
1357
1
  return pw;
1358
1
}
Unexecuted instantiation: isl_pw_aff_fix_dim
Unexecuted instantiation: isl_pw_multi_aff_fix_dim
Unexecuted instantiation: isl_pw_qpolynomial_fold_fix_dim
isl_pw_qpolynomial_fix_dim
Line
Count
Source
1339
1
{
1340
1
  int i;
1341
1
1342
1
  if (!pw)
1343
0
    return NULL;
1344
1
1345
1
  if (type == isl_dim_in)
1346
0
    type = isl_dim_set;
1347
1
1348
1
  pw = FN(PW,cow)(pw);
1349
1
  if (!pw)
1350
0
    return NULL;
1351
2
  
for (i = 0; 1
i < pw->n;
++i1
) {
1352
1
    pw->p[i].set = isl_set_fix(pw->p[i].set, type, pos, v);
1353
1
    if (FN(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 0)
1354
0
      return FN(PW,free)(pw);
1355
1
  }
1356
1
1357
1
  return pw;
1358
1
}
1359
1360
/* Fix the value of the variable at position "pos" of type "type" of "pw"
1361
 * to be equal to "v".
1362
 */
1363
__isl_give PW *FN(PW,fix_val)(__isl_take PW *pw,
1364
  enum isl_dim_type type, unsigned pos, __isl_take isl_val *v)
1365
1
{
1366
1
  if (!v)
1367
0
    return FN(PW,free)(pw);
1368
1
  if (!isl_val_is_int(v))
1369
1
    
isl_die0
(FN(PW,get_ctx)(pw), isl_error_invalid,
1370
1
      "expecting integer value", goto error);
1371
1
1372
1
  pw = FN(PW,fix_dim)(pw, type, pos, v->n);
1373
1
  isl_val_free(v);
1374
1
1375
1
  return pw;
1376
1
error:
1377
0
  isl_val_free(v);
1378
0
  return FN(PW,free)(pw);
1379
1
}
Unexecuted instantiation: isl_pw_aff_fix_val
Unexecuted instantiation: isl_pw_multi_aff_fix_val
Unexecuted instantiation: isl_pw_qpolynomial_fold_fix_val
isl_pw_qpolynomial_fix_val
Line
Count
Source
1365
1
{
1366
1
  if (!v)
1367
0
    return FN(PW,free)(pw);
1368
1
  if (!isl_val_is_int(v))
1369
1
    
isl_die0
(FN(PW,get_ctx)(pw), isl_error_invalid,
1370
1
      "expecting integer value", goto error);
1371
1
1372
1
  pw = FN(PW,fix_dim)(pw, type, pos, v->n);
1373
1
  isl_val_free(v);
1374
1
1375
1
  return pw;
1376
1
error:
1377
0
  isl_val_free(v);
1378
0
  return FN(PW,free)(pw);
1379
1
}
1380
1381
unsigned FN(PW,dim)(__isl_keep PW *pw, enum isl_dim_type type)
1382
26.1k
{
1383
26.1k
  return pw ? isl_space_dim(pw->dim, type) : 
00
;
1384
26.1k
}
isl_pw_aff_dim
Line
Count
Source
1382
3.84k
{
1383
3.84k
  return pw ? isl_space_dim(pw->dim, type) : 
00
;
1384
3.84k
}
isl_pw_multi_aff_dim
Line
Count
Source
1382
22.3k
{
1383
22.3k
  return pw ? isl_space_dim(pw->dim, type) : 
00
;
1384
22.3k
}
isl_pw_qpolynomial_fold_dim
Line
Count
Source
1382
3
{
1383
3
  return pw ? isl_space_dim(pw->dim, type) : 
00
;
1384
3
}
Unexecuted instantiation: isl_pw_qpolynomial_dim
1385
1386
__isl_give PW *FN(PW,split_dims)(__isl_take PW *pw,
1387
  enum isl_dim_type type, unsigned first, unsigned n)
1388
0
{
1389
0
  int i;
1390
0
1391
0
  if (!pw)
1392
0
    return NULL;
1393
0
  if (n == 0)
1394
0
    return pw;
1395
0
1396
0
  if (type == isl_dim_in)
1397
0
    type = isl_dim_set;
1398
0
1399
0
  pw = FN(PW,cow)(pw);
1400
0
  if (!pw)
1401
0
    return NULL;
1402
0
  if (!pw->dim)
1403
0
    goto error;
1404
0
  for (i = 0; i < pw->n; ++i) {
1405
0
    pw->p[i].set = isl_set_split_dims(pw->p[i].set, type, first, n);
1406
0
    if (!pw->p[i].set)
1407
0
      goto error;
1408
0
  }
1409
0
1410
0
  return pw;
1411
0
error:
1412
0
  FN(PW,free)(pw);
1413
0
  return NULL;
1414
0
}
Unexecuted instantiation: isl_pw_aff_split_dims
Unexecuted instantiation: isl_pw_multi_aff_split_dims
Unexecuted instantiation: isl_pw_qpolynomial_fold_split_dims
Unexecuted instantiation: isl_pw_qpolynomial_split_dims
1415
1416
#ifndef NO_OPT
1417
/* Compute the maximal value attained by the piecewise quasipolynomial
1418
 * on its domain or zero if the domain is empty.
1419
 * In the worst case, the domain is scanned completely,
1420
 * so the domain is assumed to be bounded.
1421
 */
1422
__isl_give isl_val *FN(PW,opt)(__isl_take PW *pw, int max)
1423
7
{
1424
7
  int i;
1425
7
  isl_val *opt;
1426
7
1427
7
  if (!pw)
1428
0
    return NULL;
1429
7
1430
7
  if (pw->n == 0) {
1431
0
    opt = isl_val_zero(FN(PW,get_ctx)(pw));
1432
0
    FN(PW,free)(pw);
1433
0
    return opt;
1434
0
  }
1435
7
1436
7
  opt = FN(EL,opt_on_domain)(FN(EL,copy)(pw->p[0].FIELD),
1437
7
          isl_set_copy(pw->p[0].set), max);
1438
7
  for (i = 1; i < pw->n; 
++i0
) {
1439
0
    isl_val *opt_i;
1440
0
    opt_i = FN(EL,opt_on_domain)(FN(EL,copy)(pw->p[i].FIELD),
1441
0
            isl_set_copy(pw->p[i].set), max);
1442
0
    if (max)
1443
0
      opt = isl_val_max(opt, opt_i);
1444
0
    else
1445
0
      opt = isl_val_min(opt, opt_i);
1446
0
  }
1447
7
1448
7
  FN(PW,free)(pw);
1449
7
  return opt;
1450
7
}
isl_pw_qpolynomial_fold_opt
Line
Count
Source
1423
7
{
1424
7
  int i;
1425
7
  isl_val *opt;
1426
7
1427
7
  if (!pw)
1428
0
    return NULL;
1429
7
1430
7
  if (pw->n == 0) {
1431
0
    opt = isl_val_zero(FN(PW,get_ctx)(pw));
1432
0
    FN(PW,free)(pw);
1433
0
    return opt;
1434
0
  }
1435
7
1436
7
  opt = FN(EL,opt_on_domain)(FN(EL,copy)(pw->p[0].FIELD),
1437
7
          isl_set_copy(pw->p[0].set), max);
1438
7
  for (i = 1; i < pw->n; 
++i0
) {
1439
0
    isl_val *opt_i;
1440
0
    opt_i = FN(EL,opt_on_domain)(FN(EL,copy)(pw->p[i].FIELD),
1441
0
            isl_set_copy(pw->p[i].set), max);
1442
0
    if (max)
1443
0
      opt = isl_val_max(opt, opt_i);
1444
0
    else
1445
0
      opt = isl_val_min(opt, opt_i);
1446
0
  }
1447
7
1448
7
  FN(PW,free)(pw);
1449
7
  return opt;
1450
7
}
Unexecuted instantiation: isl_pw_qpolynomial_opt
1451
1452
__isl_give isl_val *FN(PW,max)(__isl_take PW *pw)
1453
2
{
1454
2
  return FN(PW,opt)(pw, 1);
1455
2
}
isl_pw_qpolynomial_fold_max
Line
Count
Source
1453
2
{
1454
2
  return FN(PW,opt)(pw, 1);
1455
2
}
Unexecuted instantiation: isl_pw_qpolynomial_max
1456
1457
__isl_give isl_val *FN(PW,min)(__isl_take PW *pw)
1458
5
{
1459
5
  return FN(PW,opt)(pw, 0);
1460
5
}
isl_pw_qpolynomial_fold_min
Line
Count
Source
1458
5
{
1459
5
  return FN(PW,opt)(pw, 0);
1460
5
}
Unexecuted instantiation: isl_pw_qpolynomial_min
1461
#endif
1462
1463
/* Return the space of "pw".
1464
 */
1465
__isl_keep isl_space *FN(PW,peek_space)(__isl_keep PW *pw)
1466
210k
{
1467
210k
  return pw ? pw->dim : NULL;
1468
210k
}
isl_pw_aff_peek_space
Line
Count
Source
1466
151k
{
1467
151k
  return pw ? pw->dim : NULL;
1468
151k
}
isl_pw_multi_aff_peek_space
Line
Count
Source
1466
58.5k
{
1467
58.5k
  return pw ? pw->dim : NULL;
1468
58.5k
}
isl_pw_qpolynomial_fold_peek_space
Line
Count
Source
1466
1
{
1467
1
  return pw ? pw->dim : NULL;
1468
1
}
isl_pw_qpolynomial_peek_space
Line
Count
Source
1466
10
{
1467
10
  return pw ? pw->dim : NULL;
1468
10
}
1469
1470
__isl_give isl_space *FN(PW,get_space)(__isl_keep PW *pw)
1471
210k
{
1472
210k
  return isl_space_copy(FN(PW,peek_space)(pw));
1473
210k
}
isl_pw_aff_get_space
Line
Count
Source
1471
151k
{
1472
151k
  return isl_space_copy(FN(PW,peek_space)(pw));
1473
151k
}
isl_pw_multi_aff_get_space
Line
Count
Source
1471
58.5k
{
1472
58.5k
  return isl_space_copy(FN(PW,peek_space)(pw));
1473
58.5k
}
isl_pw_qpolynomial_fold_get_space
Line
Count
Source
1471
1
{
1472
1
  return isl_space_copy(FN(PW,peek_space)(pw));
1473
1
}
isl_pw_qpolynomial_get_space
Line
Count
Source
1471
9
{
1472
9
  return isl_space_copy(FN(PW,peek_space)(pw));
1473
9
}
1474
1475
__isl_give isl_space *FN(PW,get_domain_space)(__isl_keep PW *pw)
1476
111k
{
1477
111k
  return pw ? isl_space_domain(isl_space_copy(pw->dim)) : NULL;
1478
111k
}
isl_pw_aff_get_domain_space
Line
Count
Source
1476
110k
{
1477
110k
  return pw ? isl_space_domain(isl_space_copy(pw->dim)) : NULL;
1478
110k
}
isl_pw_multi_aff_get_domain_space
Line
Count
Source
1476
1.09k
{
1477
1.09k
  return pw ? isl_space_domain(isl_space_copy(pw->dim)) : NULL;
1478
1.09k
}
isl_pw_qpolynomial_fold_get_domain_space
Line
Count
Source
1476
5
{
1477
5
  return pw ? isl_space_domain(isl_space_copy(pw->dim)) : NULL;
1478
5
}
isl_pw_qpolynomial_get_domain_space
Line
Count
Source
1476
2
{
1477
2
  return pw ? isl_space_domain(isl_space_copy(pw->dim)) : NULL;
1478
2
}
1479
1480
/* Return the position of the dimension of the given type and name
1481
 * in "pw".
1482
 * Return -1 if no such dimension can be found.
1483
 */
1484
int FN(PW,find_dim_by_name)(__isl_keep PW *pw,
1485
  enum isl_dim_type type, const char *name)
1486
0
{
1487
0
  if (!pw)
1488
0
    return -1;
1489
0
  return isl_space_find_dim_by_name(pw->dim, type, name);
1490
0
}
Unexecuted instantiation: isl_pw_aff_find_dim_by_name
Unexecuted instantiation: isl_pw_multi_aff_find_dim_by_name
Unexecuted instantiation: isl_pw_qpolynomial_fold_find_dim_by_name
Unexecuted instantiation: isl_pw_qpolynomial_find_dim_by_name
1491
1492
#ifndef NO_RESET_DIM
1493
/* Reset the space of "pw".  Since we don't know if the elements
1494
 * represent the spaces themselves or their domains, we pass along
1495
 * both when we call their reset_space_and_domain.
1496
 */
1497
static __isl_give PW *FN(PW,reset_space_and_domain)(__isl_take PW *pw,
1498
  __isl_take isl_space *space, __isl_take isl_space *domain)
1499
69.8k
{
1500
69.8k
  int i;
1501
69.8k
1502
69.8k
  pw = FN(PW,cow)(pw);
1503
69.8k
  if (!pw || !space || !domain)
1504
0
    goto error;
1505
69.8k
1506
140k
  
for (i = 0; 69.8k
i < pw->n;
++i70.5k
) {
1507
70.5k
    pw->p[i].set = isl_set_reset_space(pw->p[i].set,
1508
70.5k
             isl_space_copy(domain));
1509
70.5k
    if (!pw->p[i].set)
1510
0
      goto error;
1511
70.5k
    pw->p[i].FIELD = FN(EL,reset_space_and_domain)(pw->p[i].FIELD,
1512
70.5k
            isl_space_copy(space), isl_space_copy(domain));
1513
70.5k
    if (!pw->p[i].FIELD)
1514
70.5k
      
goto error0
;
1515
70.5k
  }
1516
69.8k
1517
69.8k
  isl_space_free(domain);
1518
69.8k
1519
69.8k
  isl_space_free(pw->dim);
1520
69.8k
  pw->dim = space;
1521
69.8k
1522
69.8k
  return pw;
1523
69.8k
error:
1524
0
  isl_space_free(domain);
1525
0
  isl_space_free(space);
1526
0
  FN(PW,free)(pw);
1527
0
  return NULL;
1528
69.8k
}
isl_aff.c:isl_pw_aff_reset_space_and_domain
Line
Count
Source
1499
67.3k
{
1500
67.3k
  int i;
1501
67.3k
1502
67.3k
  pw = FN(PW,cow)(pw);
1503
67.3k
  if (!pw || !space || !domain)
1504
0
    goto error;
1505
67.3k
1506
135k
  
for (i = 0; 67.3k
i < pw->n;
++i67.8k
) {
1507
67.8k
    pw->p[i].set = isl_set_reset_space(pw->p[i].set,
1508
67.8k
             isl_space_copy(domain));
1509
67.8k
    if (!pw->p[i].set)
1510
0
      goto error;
1511
67.8k
    pw->p[i].FIELD = FN(EL,reset_space_and_domain)(pw->p[i].FIELD,
1512
67.8k
            isl_space_copy(space), isl_space_copy(domain));
1513
67.8k
    if (!pw->p[i].FIELD)
1514
67.8k
      
goto error0
;
1515
67.8k
  }
1516
67.3k
1517
67.3k
  isl_space_free(domain);
1518
67.3k
1519
67.3k
  isl_space_free(pw->dim);
1520
67.3k
  pw->dim = space;
1521
67.3k
1522
67.3k
  return pw;
1523
67.3k
error:
1524
0
  isl_space_free(domain);
1525
0
  isl_space_free(space);
1526
0
  FN(PW,free)(pw);
1527
0
  return NULL;
1528
67.3k
}
isl_aff.c:isl_pw_multi_aff_reset_space_and_domain
Line
Count
Source
1499
2.51k
{
1500
2.51k
  int i;
1501
2.51k
1502
2.51k
  pw = FN(PW,cow)(pw);
1503
2.51k
  if (!pw || !space || !domain)
1504
0
    goto error;
1505
2.51k
1506
5.21k
  
for (i = 0; 2.51k
i < pw->n;
++i2.70k
) {
1507
2.70k
    pw->p[i].set = isl_set_reset_space(pw->p[i].set,
1508
2.70k
             isl_space_copy(domain));
1509
2.70k
    if (!pw->p[i].set)
1510
0
      goto error;
1511
2.70k
    pw->p[i].FIELD = FN(EL,reset_space_and_domain)(pw->p[i].FIELD,
1512
2.70k
            isl_space_copy(space), isl_space_copy(domain));
1513
2.70k
    if (!pw->p[i].FIELD)
1514
2.70k
      
goto error0
;
1515
2.70k
  }
1516
2.51k
1517
2.51k
  isl_space_free(domain);
1518
2.51k
1519
2.51k
  isl_space_free(pw->dim);
1520
2.51k
  pw->dim = space;
1521
2.51k
1522
2.51k
  return pw;
1523
2.51k
error:
1524
0
  isl_space_free(domain);
1525
0
  isl_space_free(space);
1526
0
  FN(PW,free)(pw);
1527
0
  return NULL;
1528
2.51k
}
isl_fold.c:isl_pw_qpolynomial_fold_reset_space_and_domain
Line
Count
Source
1499
4
{
1500
4
  int i;
1501
4
1502
4
  pw = FN(PW,cow)(pw);
1503
4
  if (!pw || !space || !domain)
1504
0
    goto error;
1505
4
1506
7
  
for (i = 0; 4
i < pw->n;
++i3
) {
1507
3
    pw->p[i].set = isl_set_reset_space(pw->p[i].set,
1508
3
             isl_space_copy(domain));
1509
3
    if (!pw->p[i].set)
1510
0
      goto error;
1511
3
    pw->p[i].FIELD = FN(EL,reset_space_and_domain)(pw->p[i].FIELD,
1512
3
            isl_space_copy(space), isl_space_copy(domain));
1513
3
    if (!pw->p[i].FIELD)
1514
3
      
goto error0
;
1515
3
  }
1516
4
1517
4
  isl_space_free(domain);
1518
4
1519
4
  isl_space_free(pw->dim);
1520
4
  pw->dim = space;
1521
4
1522
4
  return pw;
1523
4
error:
1524
0
  isl_space_free(domain);
1525
0
  isl_space_free(space);
1526
0
  FN(PW,free)(pw);
1527
0
  return NULL;
1528
4
}
Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_reset_space_and_domain
1529
1530
__isl_give PW *FN(PW,reset_domain_space)(__isl_take PW *pw,
1531
  __isl_take isl_space *domain)
1532
54.7k
{
1533
54.7k
  isl_space *space;
1534
54.7k
1535
54.7k
  space = isl_space_extend_domain_with_range(isl_space_copy(domain),
1536
54.7k
               FN(PW,get_space)(pw));
1537
54.7k
  return FN(PW,reset_space_and_domain)(pw, space, domain);
1538
54.7k
}
isl_pw_aff_reset_domain_space
Line
Count
Source
1532
54.7k
{
1533
54.7k
  isl_space *space;
1534
54.7k
1535
54.7k
  space = isl_space_extend_domain_with_range(isl_space_copy(domain),
1536
54.7k
               FN(PW,get_space)(pw));
1537
54.7k
  return FN(PW,reset_space_and_domain)(pw, space, domain);
1538
54.7k
}
isl_pw_multi_aff_reset_domain_space
Line
Count
Source
1532
18
{
1533
18
  isl_space *space;
1534
18
1535
18
  space = isl_space_extend_domain_with_range(isl_space_copy(domain),
1536
18
               FN(PW,get_space)(pw));
1537
18
  return FN(PW,reset_space_and_domain)(pw, space, domain);
1538
18
}
isl_pw_qpolynomial_fold_reset_domain_space
Line
Count
Source
1532
1
{
1533
1
  isl_space *space;
1534
1
1535
1
  space = isl_space_extend_domain_with_range(isl_space_copy(domain),
1536
1
               FN(PW,get_space)(pw));
1537
1
  return FN(PW,reset_space_and_domain)(pw, space, domain);
1538
1
}
Unexecuted instantiation: isl_pw_qpolynomial_reset_domain_space
1539
1540
__isl_give PW *FN(PW,reset_space)(__isl_take PW *pw, __isl_take isl_space *dim)
1541
15.1k
{
1542
15.1k
  isl_space *domain;
1543
15.1k
1544
15.1k
  domain = isl_space_domain(isl_space_copy(dim));
1545
15.1k
  return FN(PW,reset_space_and_domain)(pw, dim, domain);
1546
15.1k
}
isl_pw_aff_reset_space
Line
Count
Source
1541
12.6k
{
1542
12.6k
  isl_space *domain;
1543
12.6k
1544
12.6k
  domain = isl_space_domain(isl_space_copy(dim));
1545
12.6k
  return FN(PW,reset_space_and_domain)(pw, dim, domain);
1546
12.6k
}
isl_pw_multi_aff_reset_space
Line
Count
Source
1541
2.49k
{
1542
2.49k
  isl_space *domain;
1543
2.49k
1544
2.49k
  domain = isl_space_domain(isl_space_copy(dim));
1545
2.49k
  return FN(PW,reset_space_and_domain)(pw, dim, domain);
1546
2.49k
}
isl_pw_qpolynomial_fold_reset_space
Line
Count
Source
1541
3
{
1542
3
  isl_space *domain;
1543
3
1544
3
  domain = isl_space_domain(isl_space_copy(dim));
1545
3
  return FN(PW,reset_space_and_domain)(pw, dim, domain);
1546
3
}
Unexecuted instantiation: isl_pw_qpolynomial_reset_space
1547
1548
__isl_give PW *FN(PW,set_tuple_id)(__isl_take PW *pw, enum isl_dim_type type,
1549
  __isl_take isl_id *id)
1550
542
{
1551
542
  isl_space *space;
1552
542
1553
542
  pw = FN(PW,cow)(pw);
1554
542
  if (!pw)
1555
0
    goto error;
1556
542
1557
542
  space = FN(PW,get_space)(pw);
1558
542
  space = isl_space_set_tuple_id(space, type, id);
1559
542
1560
542
  return FN(PW,reset_space)(pw, space);
1561
542
error:
1562
0
  isl_id_free(id);
1563
0
  return FN(PW,free)(pw);
1564
542
}
isl_pw_aff_set_tuple_id
Line
Count
Source
1550
542
{
1551
542
  isl_space *space;
1552
542
1553
542
  pw = FN(PW,cow)(pw);
1554
542
  if (!pw)
1555
0
    goto error;
1556
542
1557
542
  space = FN(PW,get_space)(pw);
1558
542
  space = isl_space_set_tuple_id(space, type, id);
1559
542
1560
542
  return FN(PW,reset_space)(pw, space);
1561
542
error:
1562
0
  isl_id_free(id);
1563
0
  return FN(PW,free)(pw);
1564
542
}
Unexecuted instantiation: isl_pw_multi_aff_set_tuple_id
Unexecuted instantiation: isl_pw_qpolynomial_fold_set_tuple_id
Unexecuted instantiation: isl_pw_qpolynomial_set_tuple_id
1565
1566
/* Drop the id on the specified tuple.
1567
 */
1568
__isl_give PW *FN(PW,reset_tuple_id)(__isl_take PW *pw, enum isl_dim_type type)
1569
0
{
1570
0
  isl_space *space;
1571
0
1572
0
  if (!pw)
1573
0
    return NULL;
1574
0
  if (!FN(PW,has_tuple_id)(pw, type))
1575
0
    return pw;
1576
0
1577
0
  pw = FN(PW,cow)(pw);
1578
0
  if (!pw)
1579
0
    return NULL;
1580
0
1581
0
  space = FN(PW,get_space)(pw);
1582
0
  space = isl_space_reset_tuple_id(space, type);
1583
0
1584
0
  return FN(PW,reset_space)(pw, space);
1585
0
}
Unexecuted instantiation: isl_pw_aff_reset_tuple_id
Unexecuted instantiation: isl_pw_multi_aff_reset_tuple_id
Unexecuted instantiation: isl_pw_qpolynomial_fold_reset_tuple_id
Unexecuted instantiation: isl_pw_qpolynomial_reset_tuple_id
1586
1587
__isl_give PW *FN(PW,set_dim_id)(__isl_take PW *pw,
1588
  enum isl_dim_type type, unsigned pos, __isl_take isl_id *id)
1589
0
{
1590
0
  pw = FN(PW,cow)(pw);
1591
0
  if (!pw)
1592
0
    goto error;
1593
0
  pw->dim = isl_space_set_dim_id(pw->dim, type, pos, id);
1594
0
  return FN(PW,reset_space)(pw, isl_space_copy(pw->dim));
1595
0
error:
1596
0
  isl_id_free(id);
1597
0
  return FN(PW,free)(pw);
1598
0
}
Unexecuted instantiation: isl_pw_aff_set_dim_id
Unexecuted instantiation: isl_pw_multi_aff_set_dim_id
Unexecuted instantiation: isl_pw_qpolynomial_fold_set_dim_id
Unexecuted instantiation: isl_pw_qpolynomial_set_dim_id
1599
#endif
1600
1601
/* Reset the user pointer on all identifiers of parameters and tuples
1602
 * of the space of "pw".
1603
 */
1604
__isl_give PW *FN(PW,reset_user)(__isl_take PW *pw)
1605
0
{
1606
0
  isl_space *space;
1607
0
1608
0
  space = FN(PW,get_space)(pw);
1609
0
  space = isl_space_reset_user(space);
1610
0
1611
0
  return FN(PW,reset_space)(pw, space);
1612
0
}
Unexecuted instantiation: isl_pw_aff_reset_user
Unexecuted instantiation: isl_pw_multi_aff_reset_user
Unexecuted instantiation: isl_pw_qpolynomial_fold_reset_user
Unexecuted instantiation: isl_pw_qpolynomial_reset_user
1613
1614
isl_bool FN(PW,has_equal_space)(__isl_keep PW *pw1, __isl_keep PW *pw2)
1615
4
{
1616
4
  if (!pw1 || !pw2)
1617
0
    return isl_bool_error;
1618
4
1619
4
  return isl_space_is_equal(pw1->dim, pw2->dim);
1620
4
}
Unexecuted instantiation: isl_pw_aff_has_equal_space
Unexecuted instantiation: isl_pw_multi_aff_has_equal_space
Unexecuted instantiation: isl_pw_qpolynomial_fold_has_equal_space
isl_pw_qpolynomial_has_equal_space
Line
Count
Source
1615
4
{
1616
4
  if (!pw1 || !pw2)
1617
0
    return isl_bool_error;
1618
4
1619
4
  return isl_space_is_equal(pw1->dim, pw2->dim);
1620
4
}
1621
1622
#ifndef NO_MORPH
1623
__isl_give PW *FN(PW,morph_domain)(__isl_take PW *pw,
1624
  __isl_take isl_morph *morph)
1625
2
{
1626
2
  int i;
1627
2
  isl_ctx *ctx;
1628
2
1629
2
  if (!pw || !morph)
1630
0
    goto error;
1631
2
1632
2
  ctx = isl_space_get_ctx(pw->dim);
1633
2
  isl_assert(ctx, isl_space_is_domain_internal(morph->dom->dim, pw->dim),
1634
2
    goto error);
1635
2
1636
2
  pw = FN(PW,cow)(pw);
1637
2
  if (!pw)
1638
0
    goto error;
1639
2
  pw->dim = isl_space_extend_domain_with_range(
1640
2
      isl_space_copy(morph->ran->dim), pw->dim);
1641
2
  if (!pw->dim)
1642
0
    goto error;
1643
2
1644
3
  
for (i = 0; 2
i < pw->n;
++i1
) {
1645
1
    pw->p[i].set = isl_morph_set(isl_morph_copy(morph), pw->p[i].set);
1646
1
    if (!pw->p[i].set)
1647
0
      goto error;
1648
1
    pw->p[i].FIELD = FN(EL,morph_domain)(pw->p[i].FIELD,
1649
1
            isl_morph_copy(morph));
1650
1
    if (!pw->p[i].FIELD)
1651
1
      
goto error0
;
1652
1
  }
1653
2
1654
2
  isl_morph_free(morph);
1655
2
1656
2
  return pw;
1657
2
error:
1658
0
  FN(PW,free)(pw);
1659
0
  isl_morph_free(morph);
1660
0
  return NULL;
1661
2
}
isl_pw_qpolynomial_fold_morph_domain
Line
Count
Source
1625
2
{
1626
2
  int i;
1627
2
  isl_ctx *ctx;
1628
2
1629
2
  if (!pw || !morph)
1630
0
    goto error;
1631
2
1632
2
  ctx = isl_space_get_ctx(pw->dim);
1633
2
  isl_assert(ctx, isl_space_is_domain_internal(morph->dom->dim, pw->dim),
1634
2
    goto error);
1635
2
1636
2
  pw = FN(PW,cow)(pw);
1637
2
  if (!pw)
1638
0
    goto error;
1639
2
  pw->dim = isl_space_extend_domain_with_range(
1640
2
      isl_space_copy(morph->ran->dim), pw->dim);
1641
2
  if (!pw->dim)
1642
0
    goto error;
1643
2
1644
3
  
for (i = 0; 2
i < pw->n;
++i1
) {
1645
1
    pw->p[i].set = isl_morph_set(isl_morph_copy(morph), pw->p[i].set);
1646
1
    if (!pw->p[i].set)
1647
0
      goto error;
1648
1
    pw->p[i].FIELD = FN(EL,morph_domain)(pw->p[i].FIELD,
1649
1
            isl_morph_copy(morph));
1650
1
    if (!pw->p[i].FIELD)
1651
1
      
goto error0
;
1652
1
  }
1653
2
1654
2
  isl_morph_free(morph);
1655
2
1656
2
  return pw;
1657
2
error:
1658
0
  FN(PW,free)(pw);
1659
0
  isl_morph_free(morph);
1660
0
  return NULL;
1661
2
}
Unexecuted instantiation: isl_pw_qpolynomial_morph_domain
1662
#endif
1663
1664
int FN(PW,n_piece)(__isl_keep PW *pw)
1665
11.1k
{
1666
11.1k
  return pw ? pw->n : 
00
;
1667
11.1k
}
isl_pw_aff_n_piece
Line
Count
Source
1665
11.1k
{
1666
11.1k
  return pw ? pw->n : 
00
;
1667
11.1k
}
Unexecuted instantiation: isl_pw_multi_aff_n_piece
Unexecuted instantiation: isl_pw_qpolynomial_fold_n_piece
Unexecuted instantiation: isl_pw_qpolynomial_n_piece
1668
1669
isl_stat FN(PW,foreach_piece)(__isl_keep PW *pw,
1670
  isl_stat (*fn)(__isl_take isl_set *set, __isl_take EL *el, void *user),
1671
  void *user)
1672
12.3k
{
1673
12.3k
  int i;
1674
12.3k
1675
12.3k
  if (!pw)
1676
0
    return isl_stat_error;
1677
12.3k
1678
21.1k
  
for (i = 0; 12.3k
i < pw->n;
++i8.87k
)
1679
12.5k
    if (fn(isl_set_copy(pw->p[i].set),
1680
12.5k
        FN(EL,copy)(pw->p[i].FIELD), user) < 0)
1681
3.70k
      return isl_stat_error;
1682
12.3k
1683
12.3k
  
return isl_stat_ok8.61k
;
1684
12.3k
}
isl_pw_aff_foreach_piece
Line
Count
Source
1672
12.3k
{
1673
12.3k
  int i;
1674
12.3k
1675
12.3k
  if (!pw)
1676
0
    return isl_stat_error;
1677
12.3k
1678
21.1k
  
for (i = 0; 12.3k
i < pw->n;
++i8.87k
)
1679
12.5k
    if (fn(isl_set_copy(pw->p[i].set),
1680
12.5k
        FN(EL,copy)(pw->p[i].FIELD), user) < 0)
1681
3.70k
      return isl_stat_error;
1682
12.3k
1683
12.3k
  
return isl_stat_ok8.61k
;
1684
12.3k
}
isl_pw_multi_aff_foreach_piece
Line
Count
Source
1672
2
{
1673
2
  int i;
1674
2
1675
2
  if (!pw)
1676
0
    return isl_stat_error;
1677
2
1678
4
  
for (i = 0; 2
i < pw->n;
++i2
)
1679
2
    if (fn(isl_set_copy(pw->p[i].set),
1680
2
        FN(EL,copy)(pw->p[i].FIELD), user) < 0)
1681
0
      return isl_stat_error;
1682
2
1683
2
  return isl_stat_ok;
1684
2
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_foreach_piece
isl_pw_qpolynomial_foreach_piece
Line
Count
Source
1672
1
{
1673
1
  int i;
1674
1
1675
1
  if (!pw)
1676
0
    return isl_stat_error;
1677
1
1678
3
  
for (i = 0; 1
i < pw->n;
++i2
)
1679
2
    if (fn(isl_set_copy(pw->p[i].set),
1680
2
        FN(EL,copy)(pw->p[i].FIELD), user) < 0)
1681
0
      return isl_stat_error;
1682
1
1683
1
  return isl_stat_ok;
1684
1
}
1685
1686
#ifndef NO_LIFT
1687
static isl_bool any_divs(__isl_keep isl_set *set)
1688
2
{
1689
2
  int i;
1690
2
1691
2
  if (!set)
1692
0
    return isl_bool_error;
1693
2
1694
3
  
for (i = 0; 2
i < set->n;
++i1
)
1695
2
    if (set->p[i]->n_div > 0)
1696
1
      return isl_bool_true;
1697
2
1698
2
  
return isl_bool_false1
;
1699
2
}
isl_fold.c:any_divs
Line
Count
Source
1688
2
{
1689
2
  int i;
1690
2
1691
2
  if (!set)
1692
0
    return isl_bool_error;
1693
2
1694
3
  
for (i = 0; 2
i < set->n;
++i1
)
1695
2
    if (set->p[i]->n_div > 0)
1696
1
      return isl_bool_true;
1697
2
1698
2
  
return isl_bool_false1
;
1699
2
}
Unexecuted instantiation: isl_polynomial.c:any_divs
1700
1701
static isl_stat foreach_lifted_subset(__isl_take isl_set *set,
1702
  __isl_take EL *el,
1703
  isl_stat (*fn)(__isl_take isl_set *set, __isl_take EL *el,
1704
    void *user), void *user)
1705
1
{
1706
1
  int i;
1707
1
1708
1
  if (!set || !el)
1709
0
    goto error;
1710
1
1711
2
  
for (i = 0; 1
i < set->n;
++i1
) {
1712
1
    isl_set *lift;
1713
1
    EL *copy;
1714
1
1715
1
    lift = isl_set_from_basic_set(isl_basic_set_copy(set->p[i]));
1716
1
    lift = isl_set_lift(lift);
1717
1
1718
1
    copy = FN(EL,copy)(el);
1719
1
    copy = FN(EL,lift)(copy, isl_set_get_space(lift));
1720
1
1721
1
    if (fn(lift, copy, user) < 0)
1722
0
      goto error;
1723
1
  }
1724
1
1725
1
  isl_set_free(set);
1726
1
  FN(EL,free)(el);
1727
1
1728
1
  return isl_stat_ok;
1729
1
error:
1730
0
  isl_set_free(set);
1731
0
  FN(EL,free)(el);
1732
0
  return isl_stat_error;
1733
1
}
isl_fold.c:foreach_lifted_subset
Line
Count
Source
1705
1
{
1706
1
  int i;
1707
1
1708
1
  if (!set || !el)
1709
0
    goto error;
1710
1
1711
2
  
for (i = 0; 1
i < set->n;
++i1
) {
1712
1
    isl_set *lift;
1713
1
    EL *copy;
1714
1
1715
1
    lift = isl_set_from_basic_set(isl_basic_set_copy(set->p[i]));
1716
1
    lift = isl_set_lift(lift);
1717
1
1718
1
    copy = FN(EL,copy)(el);
1719
1
    copy = FN(EL,lift)(copy, isl_set_get_space(lift));
1720
1
1721
1
    if (fn(lift, copy, user) < 0)
1722
0
      goto error;
1723
1
  }
1724
1
1725
1
  isl_set_free(set);
1726
1
  FN(EL,free)(el);
1727
1
1728
1
  return isl_stat_ok;
1729
1
error