Coverage Report

Created: 2017-04-29 12:21

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/tools/polly/lib/External/isl/isl_pw_templ.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2010-2011 INRIA Saclay
3
 * Copyright 2011      Sven Verdoolaege
4
 * Copyright 2012-2014 Ecole Normale Superieure
5
 *
6
 * Use of this software is governed by the MIT license
7
 *
8
 * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France,
9
 * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod,
10
 * 91893 Orsay, France
11
 * and Ecole Normale Superieure, 45 rue d’Ulm, 75230 Paris, France
12
 */
13
14
#include <isl/aff.h>
15
#include <isl_sort.h>
16
#include <isl_val_private.h>
17
18
#include <isl_pw_macro.h>
19
20
#ifdef HAS_TYPE
21
__isl_give PW *FN(PW,alloc_size)(__isl_take isl_space *dim,
22
  enum isl_fold type, int n)
23
#else
24
__isl_give PW *FN(PW,alloc_size)(__isl_take isl_space *dim, int n)
25
#endif
26
196k
{
27
196k
  isl_ctx *ctx;
28
196k
  struct PW *pw;
29
196k
30
196k
  if (!dim)
31
0
    return NULL;
32
196k
  ctx = isl_space_get_ctx(dim);
33
196k
  isl_assert(ctx, n >= 0, goto error);
34
196k
  
pw = 196k
isl_alloc196k
(ctx, struct PW,
35
196k
      sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
36
196k
  if (!pw)
37
0
    goto error;
38
196k
39
196k
  pw->ref = 1;
40
196k
#ifdef HAS_TYPE
41
  pw->type = type;
42
#endif
43
196k
  pw->size = n;
44
196k
  pw->n = 0;
45
196k
  pw->dim = dim;
46
196k
  return pw;
47
0
error:
48
0
  isl_space_free(dim);
49
0
  return NULL;
50
196k
}
isl_pw_qpolynomial_fold_alloc_size
Line
Count
Source
26
35
{
27
35
  isl_ctx *ctx;
28
35
  struct PW *pw;
29
35
30
35
  if (!dim)
31
0
    return NULL;
32
35
  ctx = isl_space_get_ctx(dim);
33
35
  isl_assert(ctx, n >= 0, goto error);
34
35
  
pw = 35
isl_alloc35
(ctx, struct PW,
35
35
      sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
36
35
  if (!pw)
37
0
    goto error;
38
35
39
35
  pw->ref = 1;
40
35
#ifdef HAS_TYPE
41
35
  pw->type = type;
42
35
#endif
43
35
  pw->size = n;
44
35
  pw->n = 0;
45
35
  pw->dim = dim;
46
35
  return pw;
47
0
error:
48
0
  isl_space_free(dim);
49
0
  return NULL;
50
35
}
isl_pw_multi_aff_alloc_size
Line
Count
Source
26
17.1k
{
27
17.1k
  isl_ctx *ctx;
28
17.1k
  struct PW *pw;
29
17.1k
30
17.1k
  if (!dim)
31
0
    return NULL;
32
17.1k
  ctx = isl_space_get_ctx(dim);
33
17.1k
  isl_assert(ctx, n >= 0, goto error);
34
17.1k
  
pw = 17.1k
isl_alloc17.1k
(ctx, struct PW,
35
17.1k
      sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
36
17.1k
  if (!pw)
37
0
    goto error;
38
17.1k
39
17.1k
  pw->ref = 1;
40
17.1k
#ifdef HAS_TYPE
41
  pw->type = type;
42
#endif
43
17.1k
  pw->size = n;
44
17.1k
  pw->n = 0;
45
17.1k
  pw->dim = dim;
46
17.1k
  return pw;
47
0
error:
48
0
  isl_space_free(dim);
49
0
  return NULL;
50
17.1k
}
isl_pw_aff_alloc_size
Line
Count
Source
26
178k
{
27
178k
  isl_ctx *ctx;
28
178k
  struct PW *pw;
29
178k
30
178k
  if (!dim)
31
0
    return NULL;
32
178k
  ctx = isl_space_get_ctx(dim);
33
178k
  isl_assert(ctx, n >= 0, goto error);
34
178k
  
pw = 178k
isl_alloc178k
(ctx, struct PW,
35
178k
      sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
36
178k
  if (!pw)
37
0
    goto error;
38
178k
39
178k
  pw->ref = 1;
40
178k
#ifdef HAS_TYPE
41
  pw->type = type;
42
#endif
43
178k
  pw->size = n;
44
178k
  pw->n = 0;
45
178k
  pw->dim = dim;
46
178k
  return pw;
47
0
error:
48
0
  isl_space_free(dim);
49
0
  return NULL;
50
178k
}
isl_pw_qpolynomial_alloc_size
Line
Count
Source
26
104
{
27
104
  isl_ctx *ctx;
28
104
  struct PW *pw;
29
104
30
104
  if (!dim)
31
0
    return NULL;
32
104
  ctx = isl_space_get_ctx(dim);
33
104
  isl_assert(ctx, n >= 0, goto error);
34
104
  
pw = 104
isl_alloc104
(ctx, struct PW,
35
104
      sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
36
104
  if (!pw)
37
0
    goto error;
38
104
39
104
  pw->ref = 1;
40
104
#ifdef HAS_TYPE
41
  pw->type = type;
42
#endif
43
104
  pw->size = n;
44
104
  pw->n = 0;
45
104
  pw->dim = dim;
46
104
  return pw;
47
0
error:
48
0
  isl_space_free(dim);
49
0
  return NULL;
50
104
}
51
52
#ifdef HAS_TYPE
53
__isl_give PW *FN(PW,ZERO)(__isl_take isl_space *dim, enum isl_fold type)
54
16
{
55
16
  return FN(PW,alloc_size)(dim, type, 0);
56
16
}
57
#else
58
__isl_give PW *FN(PW,ZERO)(__isl_take isl_space *dim)
59
5.46k
{
60
5.46k
  return FN(PW,alloc_size)(dim, 0);
61
5.46k
}
isl_pw_multi_aff_empty
Line
Count
Source
59
2.67k
{
60
2.67k
  return FN(PW,alloc_size)(dim, 0);
61
2.67k
}
isl_pw_aff_empty
Line
Count
Source
59
2.78k
{
60
2.78k
  return FN(PW,alloc_size)(dim, 0);
61
2.78k
}
isl_pw_qpolynomial_zero
Line
Count
Source
59
2
{
60
2
  return FN(PW,alloc_size)(dim, 0);
61
2
}
62
#endif
63
64
__isl_give PW *FN(PW,add_piece)(__isl_take PW *pw,
65
  __isl_take isl_set *set, __isl_take EL *el)
66
195k
{
67
195k
  isl_ctx *ctx;
68
195k
  isl_space *el_dim = NULL;
69
195k
70
195k
  if (
!pw || 195k
!set195k
||
!el195k
)
71
0
    goto error;
72
195k
73
195k
  
if (195k
isl_set_plain_is_empty(set) || 195k
FN195k
(EL,EL_IS_ZERO)(el)195k
)
{333
74
333
    isl_set_free(set);
75
333
    FN(EL,free)(el);
76
333
    return pw;
77
333
  }
78
195k
79
195k
  ctx = isl_set_get_ctx(set);
80
195k
#ifdef HAS_TYPE
81
18
  if (pw->type != el->type)
82
0
    isl_die(ctx, isl_error_invalid, "fold types don't match",
83
      goto error);
84
#endif
85
195k
  
el_dim = 18
FN195k
(EL,get_space(el));
86
195k
  isl_assert(ctx, isl_space_is_equal(pw->dim, el_dim), goto error);
87
195k
  
isl_assert195k
(ctx, pw->n < pw->size, goto error);195k
88
195k
89
195k
  pw->p[pw->n].set = set;
90
195k
  pw->p[pw->n].FIELD = el;
91
195k
  pw->n++;
92
195k
  
93
195k
  isl_space_free(el_dim);
94
195k
  return pw;
95
0
error:
96
0
  isl_space_free(el_dim);
97
0
  FN(PW,free)(pw);
98
0
  isl_set_free(set);
99
0
  FN(EL,free)(el);
100
0
  return NULL;
101
195k
}
isl_pw_multi_aff_add_piece
Line
Count
Source
66
15.5k
{
67
15.5k
  isl_ctx *ctx;
68
15.5k
  isl_space *el_dim = NULL;
69
15.5k
70
15.5k
  if (
!pw || 15.5k
!set15.5k
||
!el15.5k
)
71
0
    goto error;
72
15.5k
73
15.5k
  
if (15.5k
isl_set_plain_is_empty(set) || 15.5k
FN15.3k
(EL,EL_IS_ZERO)(el)15.3k
)
{187
74
187
    isl_set_free(set);
75
187
    FN(EL,free)(el);
76
187
    return pw;
77
187
  }
78
15.5k
79
15.3k
  ctx = isl_set_get_ctx(set);
80
15.3k
#ifdef HAS_TYPE
81
  if (pw->type != el->type)
82
    isl_die(ctx, isl_error_invalid, "fold types don't match",
83
      goto error);
84
#endif
85
15.3k
  el_dim = FN(EL,get_space(el));
86
15.3k
  isl_assert(ctx, isl_space_is_equal(pw->dim, el_dim), goto error);
87
15.3k
  
isl_assert15.3k
(ctx, pw->n < pw->size, goto error);15.3k
88
15.3k
89
15.3k
  pw->p[pw->n].set = set;
90
15.3k
  pw->p[pw->n].FIELD = el;
91
15.3k
  pw->n++;
92
15.3k
  
93
15.3k
  isl_space_free(el_dim);
94
15.3k
  return pw;
95
0
error:
96
0
  isl_space_free(el_dim);
97
0
  FN(PW,free)(pw);
98
0
  isl_set_free(set);
99
0
  FN(EL,free)(el);
100
0
  return NULL;
101
15.3k
}
isl_pw_qpolynomial_fold_add_piece
Line
Count
Source
66
24
{
67
24
  isl_ctx *ctx;
68
24
  isl_space *el_dim = NULL;
69
24
70
24
  if (
!pw || 24
!set24
||
!el24
)
71
0
    goto error;
72
24
73
24
  
if (24
isl_set_plain_is_empty(set) || 24
FN18
(EL,EL_IS_ZERO)(el)18
)
{6
74
6
    isl_set_free(set);
75
6
    FN(EL,free)(el);
76
6
    return pw;
77
6
  }
78
24
79
18
  ctx = isl_set_get_ctx(set);
80
18
#ifdef HAS_TYPE
81
18
  if (pw->type != el->type)
82
0
    isl_die(ctx, isl_error_invalid, "fold types don't match",
83
18
      goto error);
84
18
#endif
85
18
  
el_dim = 18
FN18
(EL,get_space(el));
86
18
  isl_assert(ctx, isl_space_is_equal(pw->dim, el_dim), goto error);
87
18
  
isl_assert18
(ctx, pw->n < pw->size, goto error);18
88
18
89
18
  pw->p[pw->n].set = set;
90
18
  pw->p[pw->n].FIELD = el;
91
18
  pw->n++;
92
18
  
93
18
  isl_space_free(el_dim);
94
18
  return pw;
95
0
error:
96
0
  isl_space_free(el_dim);
97
0
  FN(PW,free)(pw);
98
0
  isl_set_free(set);
99
0
  FN(EL,free)(el);
100
0
  return NULL;
101
18
}
isl_pw_qpolynomial_add_piece
Line
Count
Source
66
151
{
67
151
  isl_ctx *ctx;
68
151
  isl_space *el_dim = NULL;
69
151
70
151
  if (
!pw || 151
!set151
||
!el151
)
71
0
    goto error;
72
151
73
151
  
if (151
isl_set_plain_is_empty(set) || 151
FN107
(EL,EL_IS_ZERO)(el)107
)
{53
74
53
    isl_set_free(set);
75
53
    FN(EL,free)(el);
76
53
    return pw;
77
53
  }
78
151
79
98
  ctx = isl_set_get_ctx(set);
80
98
#ifdef HAS_TYPE
81
  if (pw->type != el->type)
82
    isl_die(ctx, isl_error_invalid, "fold types don't match",
83
      goto error);
84
#endif
85
98
  el_dim = FN(EL,get_space(el));
86
98
  isl_assert(ctx, isl_space_is_equal(pw->dim, el_dim), goto error);
87
98
  
isl_assert98
(ctx, pw->n < pw->size, goto error);98
88
98
89
98
  pw->p[pw->n].set = set;
90
98
  pw->p[pw->n].FIELD = el;
91
98
  pw->n++;
92
98
  
93
98
  isl_space_free(el_dim);
94
98
  return pw;
95
0
error:
96
0
  isl_space_free(el_dim);
97
0
  FN(PW,free)(pw);
98
0
  isl_set_free(set);
99
0
  FN(EL,free)(el);
100
0
  return NULL;
101
98
}
isl_pw_aff_add_piece
Line
Count
Source
66
179k
{
67
179k
  isl_ctx *ctx;
68
179k
  isl_space *el_dim = NULL;
69
179k
70
179k
  if (
!pw || 179k
!set179k
||
!el179k
)
71
0
    goto error;
72
179k
73
179k
  
if (179k
isl_set_plain_is_empty(set) || 179k
FN179k
(EL,EL_IS_ZERO)(el)179k
)
{87
74
87
    isl_set_free(set);
75
87
    FN(EL,free)(el);
76
87
    return pw;
77
87
  }
78
179k
79
179k
  ctx = isl_set_get_ctx(set);
80
179k
#ifdef HAS_TYPE
81
  if (pw->type != el->type)
82
    isl_die(ctx, isl_error_invalid, "fold types don't match",
83
      goto error);
84
#endif
85
179k
  el_dim = FN(EL,get_space(el));
86
179k
  isl_assert(ctx, isl_space_is_equal(pw->dim, el_dim), goto error);
87
179k
  
isl_assert179k
(ctx, pw->n < pw->size, goto error);179k
88
179k
89
179k
  pw->p[pw->n].set = set;
90
179k
  pw->p[pw->n].FIELD = el;
91
179k
  pw->n++;
92
179k
  
93
179k
  isl_space_free(el_dim);
94
179k
  return pw;
95
0
error:
96
0
  isl_space_free(el_dim);
97
0
  FN(PW,free)(pw);
98
0
  isl_set_free(set);
99
0
  FN(EL,free)(el);
100
0
  return NULL;
101
179k
}
102
103
#ifdef HAS_TYPE
104
__isl_give PW *FN(PW,alloc)(enum isl_fold type,
105
  __isl_take isl_set *set, __isl_take EL *el)
106
#else
107
__isl_give PW *FN(PW,alloc)(__isl_take isl_set *set, __isl_take EL *el)
108
#endif
109
79.0k
{
110
79.0k
  PW *pw;
111
79.0k
112
79.0k
  if (
!set || 79.0k
!el79.0k
)
113
0
    goto error;
114
79.0k
115
79.0k
#ifdef HAS_TYPE
116
12
  
pw = 12
FN12
(PW,alloc_size)(
FN12
(EL,get_space)(el), type, 1);
117
12
#else
118
79.0k
  
pw = 79.0k
FN79.0k
(PW,alloc_size)(
FN79.0k
(EL,get_space)(el), 1);
119
79.0k
#endif
120
79.0k
121
79.0k
  return FN(PW,add_piece)(pw, set, el);
122
error:
123
  isl_set_free(set);
124
  FN(EL,free)(el);
125
  return NULL;
126
}
isl_pw_aff_alloc
Line
Count
Source
109
66.0k
{
110
66.0k
  PW *pw;
111
66.0k
112
66.0k
  if (
!set || 66.0k
!el66.0k
)
113
0
    goto error;
114
66.0k
115
66.0k
#ifdef HAS_TYPE
116
  pw = FN(PW,alloc_size)(FN(EL,get_space)(el), type, 1);
117
#else
118
66.0k
  
pw = 66.0k
FN66.0k
(PW,alloc_size)(
FN66.0k
(EL,get_space)(el), 1);
119
66.0k
#endif
120
66.0k
121
66.0k
  return FN(PW,add_piece)(pw, set, el);
122
0
error:
123
0
  isl_set_free(set);
124
0
  FN(EL,free)(el);
125
0
  return NULL;
126
66.0k
}
isl_pw_qpolynomial_alloc
Line
Count
Source
109
33
{
110
33
  PW *pw;
111
33
112
33
  if (
!set || 33
!el33
)
113
0
    goto error;
114
33
115
33
#ifdef HAS_TYPE
116
  pw = FN(PW,alloc_size)(FN(EL,get_space)(el), type, 1);
117
#else
118
33
  
pw = 33
FN33
(PW,alloc_size)(
FN33
(EL,get_space)(el), 1);
119
33
#endif
120
33
121
33
  return FN(PW,add_piece)(pw, set, el);
122
0
error:
123
0
  isl_set_free(set);
124
0
  FN(EL,free)(el);
125
0
  return NULL;
126
33
}
isl_pw_qpolynomial_fold_alloc
Line
Count
Source
109
12
{
110
12
  PW *pw;
111
12
112
12
  if (
!set || 12
!el12
)
113
0
    goto error;
114
12
115
12
#ifdef HAS_TYPE
116
12
  
pw = 12
FN12
(PW,alloc_size)(
FN12
(EL,get_space)(el), type, 1);
117
12
#else
118
  pw = FN(PW,alloc_size)(FN(EL,get_space)(el), 1);
119
#endif
120
12
121
12
  return FN(PW,add_piece)(pw, set, el);
122
0
error:
123
0
  isl_set_free(set);
124
0
  FN(EL,free)(el);
125
0
  return NULL;
126
12
}
isl_pw_multi_aff_alloc
Line
Count
Source
109
12.9k
{
110
12.9k
  PW *pw;
111
12.9k
112
12.9k
  if (
!set || 12.9k
!el12.9k
)
113
0
    goto error;
114
12.9k
115
12.9k
#ifdef HAS_TYPE
116
  pw = FN(PW,alloc_size)(FN(EL,get_space)(el), type, 1);
117
#else
118
12.9k
  
pw = 12.9k
FN12.9k
(PW,alloc_size)(
FN12.9k
(EL,get_space)(el), 1);
119
12.9k
#endif
120
12.9k
121
12.9k
  return FN(PW,add_piece)(pw, set, el);
122
0
error:
123
0
  isl_set_free(set);
124
0
  FN(EL,free)(el);
125
0
  return NULL;
126
12.9k
}
127
128
__isl_give PW *FN(PW,dup)(__isl_keep PW *pw)
129
{
130
  int i;
131
  PW *dup;
132
133
  if (!pw)
134
    return NULL;
135
136
#ifdef HAS_TYPE
137
  dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, pw->n);
138
#else
139
  dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->n);
140
#endif
141
  if (!dup)
142
    return NULL;
143
144
  for (i = 0; i < pw->n; ++i)
145
    dup = FN(PW,add_piece)(dup, isl_set_copy(pw->p[i].set),
146
              FN(EL,copy)(pw->p[i].FIELD));
147
148
  return dup;
149
}
isl_pw_aff_dup
Line
Count
Source
129
37.7k
{
130
37.7k
  int i;
131
37.7k
  PW *dup;
132
37.7k
133
37.7k
  if (!pw)
134
0
    return NULL;
135
37.7k
136
37.7k
#ifdef HAS_TYPE
137
  dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, pw->n);
138
#else
139
37.7k
  
dup = 37.7k
FN37.7k
(PW,alloc_size)(isl_space_copy(pw->dim), pw->n);
140
37.7k
#endif
141
37.7k
  if (!dup)
142
0
    return NULL;
143
37.7k
144
76.6k
  
for (i = 0; 37.7k
i < pw->n76.6k
;
++i38.9k
)
145
38.9k
    
dup = 38.9k
FN38.9k
(PW,add_piece)(dup, isl_set_copy(pw->p[i].set),
146
38.9k
              
FN38.9k
(EL,copy)(pw->p[i].
FIELD38.9k
));
147
37.7k
148
37.7k
  return dup;
149
37.7k
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_dup
isl_pw_multi_aff_dup
Line
Count
Source
129
66
{
130
66
  int i;
131
66
  PW *dup;
132
66
133
66
  if (!pw)
134
0
    return NULL;
135
66
136
66
#ifdef HAS_TYPE
137
  dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, pw->n);
138
#else
139
66
  
dup = 66
FN66
(PW,alloc_size)(isl_space_copy(pw->dim), pw->n);
140
66
#endif
141
66
  if (!dup)
142
0
    return NULL;
143
66
144
133
  
for (i = 0; 66
i < pw->n133
;
++i67
)
145
67
    
dup = 67
FN67
(PW,add_piece)(dup, isl_set_copy(pw->p[i].set),
146
67
              
FN67
(EL,copy)(pw->p[i].
FIELD67
));
147
66
148
66
  return dup;
149
66
}
isl_pw_qpolynomial_dup
Line
Count
Source
129
1
{
130
1
  int i;
131
1
  PW *dup;
132
1
133
1
  if (!pw)
134
0
    return NULL;
135
1
136
1
#ifdef HAS_TYPE
137
  dup = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, pw->n);
138
#else
139
1
  
dup = 1
FN1
(PW,alloc_size)(isl_space_copy(pw->dim), pw->n);
140
1
#endif
141
1
  if (!dup)
142
0
    return NULL;
143
1
144
2
  
for (i = 0; 1
i < pw->n2
;
++i1
)
145
1
    
dup = 1
FN1
(PW,add_piece)(dup, isl_set_copy(pw->p[i].set),
146
1
              
FN1
(EL,copy)(pw->p[i].
FIELD1
));
147
1
148
1
  return dup;
149
1
}
150
151
__isl_give PW *FN(PW,cow)(__isl_take PW *pw)
152
{
153
  if (!pw)
154
    return NULL;
155
156
  if (pw->ref == 1)
157
    return pw;
158
  pw->ref--;
159
  return FN(PW,dup)(pw);
160
}
isl_pw_qpolynomial_fold_cow
Line
Count
Source
152
6
{
153
6
  if (!pw)
154
0
    return NULL;
155
6
156
6
  
if (6
pw->ref == 16
)
157
6
    return pw;
158
0
  pw->ref--;
159
0
  return FN(PW,dup)(pw);
160
6
}
isl_pw_multi_aff_cow
Line
Count
Source
152
5.67k
{
153
5.67k
  if (!pw)
154
0
    return NULL;
155
5.67k
156
5.67k
  
if (5.67k
pw->ref == 15.67k
)
157
5.61k
    return pw;
158
66
  pw->ref--;
159
66
  return FN(PW,dup)(pw);
160
5.67k
}
isl_pw_qpolynomial_cow
Line
Count
Source
152
51
{
153
51
  if (!pw)
154
0
    return NULL;
155
51
156
51
  
if (51
pw->ref == 151
)
157
50
    return pw;
158
1
  pw->ref--;
159
1
  return FN(PW,dup)(pw);
160
51
}
isl_pw_aff_cow
Line
Count
Source
152
121k
{
153
121k
  if (!pw)
154
0
    return NULL;
155
121k
156
121k
  
if (121k
pw->ref == 1121k
)
157
83.9k
    return pw;
158
37.7k
  pw->ref--;
159
37.7k
  return FN(PW,dup)(pw);
160
121k
}
161
162
__isl_give PW *FN(PW,copy)(__isl_keep PW *pw)
163
{
164
  if (!pw)
165
    return NULL;
166
167
  pw->ref++;
168
  return pw;
169
}
isl_pw_qpolynomial_fold_copy
Line
Count
Source
163
2
{
164
2
  if (!pw)
165
0
    return NULL;
166
2
167
2
  pw->ref++;
168
2
  return pw;
169
2
}
isl_pw_qpolynomial_copy
Line
Count
Source
163
10
{
164
10
  if (!pw)
165
0
    return NULL;
166
10
167
10
  pw->ref++;
168
10
  return pw;
169
10
}
isl_pw_aff_copy
Line
Count
Source
163
145k
{
164
145k
  if (!pw)
165
17.9k
    return NULL;
166
145k
167
127k
  pw->ref++;
168
127k
  return pw;
169
145k
}
isl_pw_multi_aff_copy
Line
Count
Source
163
17.6k
{
164
17.6k
  if (!pw)
165
0
    return NULL;
166
17.6k
167
17.6k
  pw->ref++;
168
17.6k
  return pw;
169
17.6k
}
170
171
__isl_null PW *FN(PW,free)(__isl_take PW *pw)
172
{
173
  int i;
174
175
  if (!pw)
176
    return NULL;
177
  if (--pw->ref > 0)
178
    return NULL;
179
180
  for (i = 0; i < pw->n; ++i) {
181
    isl_set_free(pw->p[i].set);
182
    FN(EL,free)(pw->p[i].FIELD);
183
  }
184
  isl_space_free(pw->dim);
185
  free(pw);
186
187
  return NULL;
188
}
isl_pw_qpolynomial_fold_free
Line
Count
Source
172
37
{
173
37
  int i;
174
37
175
37
  if (!pw)
176
0
    return NULL;
177
37
  
if (37
--pw->ref > 037
)
178
2
    return NULL;
179
37
180
53
  
for (i = 0; 35
i < pw->n53
;
++i18
)
{18
181
18
    isl_set_free(pw->p[i].set);
182
18
    
FN18
(EL,free)(pw->p[i].
FIELD18
);
183
18
  }
184
35
  isl_space_free(pw->dim);
185
35
  free(pw);
186
35
187
35
  return NULL;
188
37
}
isl_pw_qpolynomial_free
Line
Count
Source
172
113
{
173
113
  int i;
174
113
175
113
  if (!pw)
176
0
    return NULL;
177
113
  
if (113
--pw->ref > 0113
)
178
9
    return NULL;
179
113
180
202
  
for (i = 0; 104
i < pw->n202
;
++i98
)
{98
181
98
    isl_set_free(pw->p[i].set);
182
98
    
FN98
(EL,free)(pw->p[i].
FIELD98
);
183
98
  }
184
104
  isl_space_free(pw->dim);
185
104
  free(pw);
186
104
187
104
  return NULL;
188
113
}
isl_pw_aff_free
Line
Count
Source
172
301k
{
173
301k
  int i;
174
301k
175
301k
  if (!pw)
176
32.5k
    return NULL;
177
268k
  
if (268k
--pw->ref > 0268k
)
178
89.9k
    return NULL;
179
268k
180
358k
  
for (i = 0; 178k
i < pw->n358k
;
++i179k
)
{179k
181
179k
    isl_set_free(pw->p[i].set);
182
179k
    
FN179k
(EL,free)(pw->p[i].
FIELD179k
);
183
179k
  }
184
178k
  isl_space_free(pw->dim);
185
178k
  free(pw);
186
178k
187
178k
  return NULL;
188
268k
}
isl_pw_multi_aff_free
Line
Count
Source
172
34.6k
{
173
34.6k
  int i;
174
34.6k
175
34.6k
  if (!pw)
176
0
    return NULL;
177
34.6k
  
if (34.6k
--pw->ref > 034.6k
)
178
17.5k
    return NULL;
179
34.6k
180
32.4k
  
for (i = 0; 17.1k
i < pw->n32.4k
;
++i15.3k
)
{15.3k
181
15.3k
    isl_set_free(pw->p[i].set);
182
15.3k
    
FN15.3k
(EL,free)(pw->p[i].
FIELD15.3k
);
183
15.3k
  }
184
17.1k
  isl_space_free(pw->dim);
185
17.1k
  free(pw);
186
17.1k
187
17.1k
  return NULL;
188
34.6k
}
189
190
const char *FN(PW,get_dim_name)(__isl_keep PW *pw, enum isl_dim_type type,
191
  unsigned pos)
192
{
193
  return pw ? isl_space_get_dim_name(pw->dim, type, pos) : NULL;
194
}
Unexecuted instantiation: isl_pw_qpolynomial_get_dim_name
Unexecuted instantiation: isl_pw_multi_aff_get_dim_name
Unexecuted instantiation: isl_pw_qpolynomial_fold_get_dim_name
Unexecuted instantiation: isl_pw_aff_get_dim_name
195
196
isl_bool FN(PW,has_dim_id)(__isl_keep PW *pw, enum isl_dim_type type,
197
  unsigned pos)
198
{
199
  return pw ? isl_space_has_dim_id(pw->dim, type, pos) : isl_bool_error;
200
}
Unexecuted instantiation: isl_pw_aff_has_dim_id
Unexecuted instantiation: isl_pw_qpolynomial_has_dim_id
Unexecuted instantiation: isl_pw_qpolynomial_fold_has_dim_id
Unexecuted instantiation: isl_pw_multi_aff_has_dim_id
201
202
__isl_give isl_id *FN(PW,get_dim_id)(__isl_keep PW *pw, enum isl_dim_type type,
203
  unsigned pos)
204
{
205
  return pw ? isl_space_get_dim_id(pw->dim, type, pos) : NULL;
206
}
Unexecuted instantiation: isl_pw_multi_aff_get_dim_id
Unexecuted instantiation: isl_pw_qpolynomial_get_dim_id
Unexecuted instantiation: isl_pw_aff_get_dim_id
Unexecuted instantiation: isl_pw_qpolynomial_fold_get_dim_id
207
208
isl_bool FN(PW,has_tuple_name)(__isl_keep PW *pw, enum isl_dim_type type)
209
{
210
  return pw ? isl_space_has_tuple_name(pw->dim, type) : isl_bool_error;
211
}
Unexecuted instantiation: isl_pw_multi_aff_has_tuple_name
Unexecuted instantiation: isl_pw_qpolynomial_has_tuple_name
Unexecuted instantiation: isl_pw_qpolynomial_fold_has_tuple_name
Unexecuted instantiation: isl_pw_aff_has_tuple_name
212
213
const char *FN(PW,get_tuple_name)(__isl_keep PW *pw, enum isl_dim_type type)
214
{
215
  return pw ? isl_space_get_tuple_name(pw->dim, type) : NULL;
216
}
Unexecuted instantiation: isl_pw_multi_aff_get_tuple_name
Unexecuted instantiation: isl_pw_qpolynomial_fold_get_tuple_name
Unexecuted instantiation: isl_pw_aff_get_tuple_name
Unexecuted instantiation: isl_pw_qpolynomial_get_tuple_name
217
218
isl_bool FN(PW,has_tuple_id)(__isl_keep PW *pw, enum isl_dim_type type)
219
{
220
  return pw ? isl_space_has_tuple_id(pw->dim, type) : isl_bool_error;
221
}
Unexecuted instantiation: isl_pw_qpolynomial_has_tuple_id
Unexecuted instantiation: isl_pw_aff_has_tuple_id
Unexecuted instantiation: isl_pw_qpolynomial_fold_has_tuple_id
Unexecuted instantiation: isl_pw_multi_aff_has_tuple_id
222
223
__isl_give isl_id *FN(PW,get_tuple_id)(__isl_keep PW *pw, enum isl_dim_type type)
224
{
225
  return pw ? isl_space_get_tuple_id(pw->dim, type) : NULL;
226
}
Unexecuted instantiation: isl_pw_qpolynomial_get_tuple_id
Unexecuted instantiation: isl_pw_aff_get_tuple_id
Unexecuted instantiation: isl_pw_qpolynomial_fold_get_tuple_id
Unexecuted instantiation: isl_pw_multi_aff_get_tuple_id
227
228
isl_bool FN(PW,IS_ZERO)(__isl_keep PW *pw)
229
{
230
  if (!pw)
231
    return isl_bool_error;
232
233
  return pw->n == 0;
234
}
isl_pw_multi_aff_is_empty
Line
Count
Source
229
13.2k
{
230
13.2k
  if (!pw)
231
0
    return isl_bool_error;
232
13.2k
233
13.2k
  return pw->n == 0;
234
13.2k
}
isl_pw_aff_is_empty
Line
Count
Source
229
28.5k
{
230
28.5k
  if (!pw)
231
0
    return isl_bool_error;
232
28.5k
233
28.5k
  return pw->n == 0;
234
28.5k
}
isl_pw_qpolynomial_is_zero
Line
Count
Source
229
102
{
230
102
  if (!pw)
231
0
    return isl_bool_error;
232
102
233
102
  return pw->n == 0;
234
102
}
isl_pw_qpolynomial_fold_is_zero
Line
Count
Source
229
26
{
230
26
  if (!pw)
231
0
    return isl_bool_error;
232
26
233
26
  return pw->n == 0;
234
26
}
235
236
#ifndef NO_REALIGN
237
__isl_give PW *FN(PW,realign_domain)(__isl_take PW *pw,
238
  __isl_take isl_reordering *exp)
239
{
240
  int i;
241
242
  pw = FN(PW,cow)(pw);
243
  if (!pw || !exp)
244
    goto error;
245
246
  for (i = 0; i < pw->n; ++i) {
247
    pw->p[i].set = isl_set_realign(pw->p[i].set,
248
                isl_reordering_copy(exp));
249
    if (!pw->p[i].set)
250
      goto error;
251
    pw->p[i].FIELD = FN(EL,realign_domain)(pw->p[i].FIELD,
252
                isl_reordering_copy(exp));
253
    if (!pw->p[i].FIELD)
254
      goto error;
255
  }
256
257
  pw = FN(PW,reset_domain_space)(pw, isl_space_copy(exp->dim));
258
259
  isl_reordering_free(exp);
260
  return pw;
261
error:
262
  isl_reordering_free(exp);
263
  FN(PW,free)(pw);
264
  return NULL;
265
}
isl_pw_aff_realign_domain
Line
Count
Source
239
7.26k
{
240
7.26k
  int i;
241
7.26k
242
7.26k
  pw = FN(PW,cow)(pw);
243
7.26k
  if (
!pw || 7.26k
!exp7.26k
)
244
0
    goto error;
245
7.26k
246
14.8k
  
for (i = 0; 7.26k
i < pw->n14.8k
;
++i7.63k
)
{7.63k
247
7.63k
    pw->p[i].set = isl_set_realign(pw->p[i].set,
248
7.63k
                isl_reordering_copy(exp));
249
7.63k
    if (!pw->p[i].set)
250
0
      goto error;
251
7.63k
    
pw->p[i].7.63k
FIELD7.63k
=
FN7.63k
(EL,realign_domain)(pw->p[i].
FIELD7.63k
,
252
7.63k
                isl_reordering_copy(exp));
253
7.63k
    if (
!pw->p[i].7.63k
FIELD7.63k
)
254
0
      goto error;
255
7.63k
  }
256
7.26k
257
7.26k
  
pw = 7.26k
FN7.26k
(PW,reset_domain_space)(pw, isl_space_copy(exp->dim));
258
7.26k
259
7.26k
  isl_reordering_free(exp);
260
7.26k
  return pw;
261
0
error:
262
0
  isl_reordering_free(exp);
263
0
  FN(PW,free)(pw);
264
0
  return NULL;
265
7.26k
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_realign_domain
Unexecuted instantiation: isl_pw_multi_aff_realign_domain
Unexecuted instantiation: isl_pw_qpolynomial_realign_domain
266
267
/* Align the parameters of "pw" to those of "model".
268
 */
269
__isl_give PW *FN(PW,align_params)(__isl_take PW *pw, __isl_take isl_space *model)
270
{
271
  isl_ctx *ctx;
272
  isl_bool equal_params;
273
274
  if (!pw || !model)
275
    goto error;
276
277
  ctx = isl_space_get_ctx(model);
278
  if (!isl_space_has_named_params(model))
279
    isl_die(ctx, isl_error_invalid,
280
      "model has unnamed parameters", goto error);
281
  if (!isl_space_has_named_params(pw->dim))
282
    isl_die(ctx, isl_error_invalid,
283
      "input has unnamed parameters", goto error);
284
  equal_params = isl_space_has_equal_params(pw->dim, model);
285
  if (equal_params < 0)
286
    goto error;
287
  if (!equal_params) {
288
    isl_reordering *exp;
289
290
    model = isl_space_drop_dims(model, isl_dim_in,
291
          0, isl_space_dim(model, isl_dim_in));
292
    model = isl_space_drop_dims(model, isl_dim_out,
293
          0, isl_space_dim(model, isl_dim_out));
294
    exp = isl_parameter_alignment_reordering(pw->dim, model);
295
    exp = isl_reordering_extend_space(exp,
296
          FN(PW,get_domain_space)(pw));
297
    pw = FN(PW,realign_domain)(pw, exp);
298
  }
299
300
  isl_space_free(model);
301
  return pw;
302
error:
303
  isl_space_free(model);
304
  FN(PW,free)(pw);
305
  return NULL;
306
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_align_params
isl_pw_qpolynomial_align_params
Line
Count
Source
270
5
{
271
5
  isl_ctx *ctx;
272
5
  isl_bool equal_params;
273
5
274
5
  if (
!pw || 5
!model5
)
275
0
    goto error;
276
5
277
5
  ctx = isl_space_get_ctx(model);
278
5
  if (!isl_space_has_named_params(model))
279
0
    isl_die(ctx, isl_error_invalid,
280
5
      "model has unnamed parameters", goto error);
281
5
  
if (5
!isl_space_has_named_params(pw->dim)5
)
282
0
    isl_die(ctx, isl_error_invalid,
283
5
      "input has unnamed parameters", goto error);
284
5
  equal_params = isl_space_has_equal_params(pw->dim, model);
285
5
  if (equal_params < 0)
286
0
    goto error;
287
5
  
if (5
!equal_params5
)
{0
288
0
    isl_reordering *exp;
289
0
290
0
    model = isl_space_drop_dims(model, isl_dim_in,
291
0
          0, isl_space_dim(model, isl_dim_in));
292
0
    model = isl_space_drop_dims(model, isl_dim_out,
293
0
          0, isl_space_dim(model, isl_dim_out));
294
0
    exp = isl_parameter_alignment_reordering(pw->dim, model);
295
0
    exp = isl_reordering_extend_space(exp,
296
0
          FN(PW,get_domain_space)(pw));
297
0
    pw = FN(PW,realign_domain)(pw, exp);
298
0
  }
299
5
300
5
  isl_space_free(model);
301
5
  return pw;
302
0
error:
303
0
  isl_space_free(model);
304
0
  FN(PW,free)(pw);
305
0
  return NULL;
306
5
}
isl_pw_aff_align_params
Line
Count
Source
270
12.4k
{
271
12.4k
  isl_ctx *ctx;
272
12.4k
  isl_bool equal_params;
273
12.4k
274
12.4k
  if (
!pw || 12.4k
!model12.4k
)
275
0
    goto error;
276
12.4k
277
12.4k
  ctx = isl_space_get_ctx(model);
278
12.4k
  if (!isl_space_has_named_params(model))
279
0
    isl_die(ctx, isl_error_invalid,
280
12.4k
      "model has unnamed parameters", goto error);
281
12.4k
  
if (12.4k
!isl_space_has_named_params(pw->dim)12.4k
)
282
0
    isl_die(ctx, isl_error_invalid,
283
12.4k
      "input has unnamed parameters", goto error);
284
12.4k
  equal_params = isl_space_has_equal_params(pw->dim, model);
285
12.4k
  if (equal_params < 0)
286
0
    goto error;
287
12.4k
  
if (12.4k
!equal_params12.4k
)
{7.10k
288
7.10k
    isl_reordering *exp;
289
7.10k
290
7.10k
    model = isl_space_drop_dims(model, isl_dim_in,
291
7.10k
          0, isl_space_dim(model, isl_dim_in));
292
7.10k
    model = isl_space_drop_dims(model, isl_dim_out,
293
7.10k
          0, isl_space_dim(model, isl_dim_out));
294
7.10k
    exp = isl_parameter_alignment_reordering(pw->dim, model);
295
7.10k
    exp = isl_reordering_extend_space(exp,
296
7.10k
          FN(PW,get_domain_space)(pw));
297
7.10k
    pw = FN(PW,realign_domain)(pw, exp);
298
7.10k
  }
299
12.4k
300
12.4k
  isl_space_free(model);
301
12.4k
  return pw;
302
0
error:
303
0
  isl_space_free(model);
304
0
  FN(PW,free)(pw);
305
0
  return NULL;
306
12.4k
}
isl_pw_multi_aff_align_params
Line
Count
Source
270
9.76k
{
271
9.76k
  isl_ctx *ctx;
272
9.76k
  isl_bool equal_params;
273
9.76k
274
9.76k
  if (
!pw || 9.76k
!model9.76k
)
275
0
    goto error;
276
9.76k
277
9.76k
  ctx = isl_space_get_ctx(model);
278
9.76k
  if (!isl_space_has_named_params(model))
279
0
    isl_die(ctx, isl_error_invalid,
280
9.76k
      "model has unnamed parameters", goto error);
281
9.76k
  
if (9.76k
!isl_space_has_named_params(pw->dim)9.76k
)
282
0
    isl_die(ctx, isl_error_invalid,
283
9.76k
      "input has unnamed parameters", goto error);
284
9.76k
  equal_params = isl_space_has_equal_params(pw->dim, model);
285
9.76k
  if (equal_params < 0)
286
0
    goto error;
287
9.76k
  
if (9.76k
!equal_params9.76k
)
{0
288
0
    isl_reordering *exp;
289
0
290
0
    model = isl_space_drop_dims(model, isl_dim_in,
291
0
          0, isl_space_dim(model, isl_dim_in));
292
0
    model = isl_space_drop_dims(model, isl_dim_out,
293
0
          0, isl_space_dim(model, isl_dim_out));
294
0
    exp = isl_parameter_alignment_reordering(pw->dim, model);
295
0
    exp = isl_reordering_extend_space(exp,
296
0
          FN(PW,get_domain_space)(pw));
297
0
    pw = FN(PW,realign_domain)(pw, exp);
298
0
  }
299
9.76k
300
9.76k
  isl_space_free(model);
301
9.76k
  return pw;
302
0
error:
303
0
  isl_space_free(model);
304
0
  FN(PW,free)(pw);
305
0
  return NULL;
306
9.76k
}
307
308
static __isl_give PW *FN(PW,align_params_pw_pw_and)(__isl_take PW *pw1,
309
  __isl_take PW *pw2,
310
  __isl_give PW *(*fn)(__isl_take PW *pw1, __isl_take PW *pw2))
311
{
312
  isl_ctx *ctx;
313
  isl_bool equal_params;
314
315
  if (!pw1 || !pw2)
316
    goto error;
317
  equal_params = isl_space_has_equal_params(pw1->dim, pw2->dim);
318
  if (equal_params < 0)
319
    goto error;
320
  if (equal_params)
321
    return fn(pw1, pw2);
322
  ctx = FN(PW,get_ctx)(pw1);
323
  if (!isl_space_has_named_params(pw1->dim) ||
324
      !isl_space_has_named_params(pw2->dim))
325
    isl_die(ctx, isl_error_invalid,
326
      "unaligned unnamed parameters", goto error);
327
  pw1 = FN(PW,align_params)(pw1, FN(PW,get_space)(pw2));
328
  pw2 = FN(PW,align_params)(pw2, FN(PW,get_space)(pw1));
329
  return fn(pw1, pw2);
330
error:
331
  FN(PW,free)(pw1);
332
  FN(PW,free)(pw2);
333
  return NULL;
334
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_align_params_pw_pw_and
isl_aff.c:isl_pw_multi_aff_align_params_pw_pw_and
Line
Count
Source
311
3.50k
{
312
3.50k
  isl_ctx *ctx;
313
3.50k
  isl_bool equal_params;
314
3.50k
315
3.50k
  if (
!pw1 || 3.50k
!pw23.50k
)
316
0
    goto error;
317
3.50k
  equal_params = isl_space_has_equal_params(pw1->dim, pw2->dim);
318
3.50k
  if (equal_params < 0)
319
0
    goto error;
320
3.50k
  
if (3.50k
equal_params3.50k
)
321
3.50k
    return fn(pw1, pw2);
322
0
  
ctx = 0
FN0
(PW,get_ctx)(pw1);
323
0
  if (!isl_space_has_named_params(pw1->dim) ||
324
0
      !isl_space_has_named_params(pw2->dim))
325
0
    isl_die(ctx, isl_error_invalid,
326
0
      "unaligned unnamed parameters", goto error);
327
0
  
pw1 = 0
FN0
(PW,align_params)(pw1,
FN0
(PW,get_space)(pw2));
328
0
  pw2 = 
FN0
(PW,align_params)(pw2,
FN0
(PW,get_space)(pw1));
329
0
  return fn(pw1, pw2);
330
0
error:
331
0
  FN(PW,free)(pw1);
332
0
  FN(PW,free)(pw2);
333
0
  return NULL;
334
0
}
isl_polynomial.c:isl_pw_qpolynomial_align_params_pw_pw_and
Line
Count
Source
311
26
{
312
26
  isl_ctx *ctx;
313
26
  isl_bool equal_params;
314
26
315
26
  if (
!pw1 || 26
!pw226
)
316
0
    goto error;
317
26
  equal_params = isl_space_has_equal_params(pw1->dim, pw2->dim);
318
26
  if (equal_params < 0)
319
0
    goto error;
320
26
  
if (26
equal_params26
)
321
26
    return fn(pw1, pw2);
322
0
  
ctx = 0
FN0
(PW,get_ctx)(pw1);
323
0
  if (!isl_space_has_named_params(pw1->dim) ||
324
0
      !isl_space_has_named_params(pw2->dim))
325
0
    isl_die(ctx, isl_error_invalid,
326
0
      "unaligned unnamed parameters", goto error);
327
0
  
pw1 = 0
FN0
(PW,align_params)(pw1,
FN0
(PW,get_space)(pw2));
328
0
  pw2 = 
FN0
(PW,align_params)(pw2,
FN0
(PW,get_space)(pw1));
329
0
  return fn(pw1, pw2);
330
0
error:
331
0
  FN(PW,free)(pw1);
332
0
  FN(PW,free)(pw2);
333
0
  return NULL;
334
0
}
isl_aff.c:isl_pw_aff_align_params_pw_pw_and
Line
Count
Source
311
67.8k
{
312
67.8k
  isl_ctx *ctx;
313
67.8k
  isl_bool equal_params;
314
67.8k
315
67.8k
  if (
!pw1 || 67.8k
!pw267.8k
)
316
1
    goto error;
317
67.8k
  equal_params = isl_space_has_equal_params(pw1->dim, pw2->dim);
318
67.8k
  if (equal_params < 0)
319
0
    goto error;
320
67.8k
  
if (67.8k
equal_params67.8k
)
321
65.1k
    return fn(pw1, pw2);
322
2.69k
  
ctx = 2.69k
FN2.69k
(PW,get_ctx)(pw1);
323
2.69k
  if (!isl_space_has_named_params(pw1->dim) ||
324
2.69k
      !isl_space_has_named_params(pw2->dim))
325
0
    isl_die(ctx, isl_error_invalid,
326
2.69k
      "unaligned unnamed parameters", goto error);
327
2.69k
  
pw1 = 2.69k
FN2.69k
(PW,align_params)(pw1,
FN2.69k
(PW,get_space)(pw2));
328
2.69k
  pw2 = 
FN2.69k
(PW,align_params)(pw2,
FN2.69k
(PW,get_space)(pw1));
329
2.69k
  return fn(pw1, pw2);
330
1
error:
331
1
  FN(PW,free)(pw1);
332
1
  FN(PW,free)(pw2);
333
1
  return NULL;
334
2.69k
}
335
336
static __isl_give PW *FN(PW,align_params_pw_set_and)(__isl_take PW *pw,
337
  __isl_take isl_set *set,
338
  __isl_give PW *(*fn)(__isl_take PW *pw, __isl_take isl_set *set))
339
{
340
  isl_ctx *ctx;
341
  isl_bool aligned;
342
343
  if (!pw || !set)
344
    goto error;
345
  aligned = isl_set_space_has_equal_params(set, pw->dim);
346
  if (aligned < 0)
347
    goto error;
348
  if (aligned)
349
    return fn(pw, set);
350
  ctx = FN(PW,get_ctx)(pw);
351
  if (!isl_space_has_named_params(pw->dim) ||
352
      !isl_space_has_named_params(set->dim))
353
    isl_die(ctx, isl_error_invalid,
354
      "unaligned unnamed parameters", goto error);
355
  pw = FN(PW,align_params)(pw, isl_set_get_space(set));
356
  set = isl_set_align_params(set, FN(PW,get_space)(pw));
357
  return fn(pw, set);
358
error:
359
  FN(PW,free)(pw);
360
  isl_set_free(set);
361
  return NULL;
362
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_align_params_pw_set_and
isl_aff.c:isl_pw_multi_aff_align_params_pw_set_and
Line
Count
Source
339
2.62k
{
340
2.62k
  isl_ctx *ctx;
341
2.62k
  isl_bool aligned;
342
2.62k
343
2.62k
  if (
!pw || 2.62k
!set2.62k
)
344
0
    goto error;
345
2.62k
  aligned = isl_set_space_has_equal_params(set, pw->dim);
346
2.62k
  if (aligned < 0)
347
0
    goto error;
348
2.62k
  
if (2.62k
aligned2.62k
)
349
2.62k
    return fn(pw, set);
350
0
  
ctx = 0
FN0
(PW,get_ctx)(pw);
351
0
  if (!isl_space_has_named_params(pw->dim) ||
352
0
      !isl_space_has_named_params(set->dim))
353
0
    isl_die(ctx, isl_error_invalid,
354
0
      "unaligned unnamed parameters", goto error);
355
0
  
pw = 0
FN0
(PW,align_params)(pw, isl_set_get_space(set));
356
0
  set = isl_set_align_params(set, FN(PW,get_space)(pw));
357
0
  return fn(pw, set);
358
0
error:
359
0
  FN(PW,free)(pw);
360
0
  isl_set_free(set);
361
0
  return NULL;
362
0
}
isl_aff.c:isl_pw_aff_align_params_pw_set_and
Line
Count
Source
339
36.4k
{
340
36.4k
  isl_ctx *ctx;
341
36.4k
  isl_bool aligned;
342
36.4k
343
36.4k
  if (
!pw || 36.4k
!set36.4k
)
344
0
    goto error;
345
36.4k
  aligned = isl_set_space_has_equal_params(set, pw->dim);
346
36.4k
  if (aligned < 0)
347
0
    goto error;
348
36.4k
  
if (36.4k
aligned36.4k
)
349
36.4k
    return fn(pw, set);
350
2
  
ctx = 2
FN2
(PW,get_ctx)(pw);
351
2
  if (!isl_space_has_named_params(pw->dim) ||
352
2
      !isl_space_has_named_params(set->dim))
353
0
    isl_die(ctx, isl_error_invalid,
354
2
      "unaligned unnamed parameters", goto error);
355
2
  
pw = 2
FN2
(PW,align_params)(pw, isl_set_get_space(set));
356
2
  set = isl_set_align_params(set, FN(PW,get_space)(pw));
357
2
  return fn(pw, set);
358
0
error:
359
0
  FN(PW,free)(pw);
360
0
  isl_set_free(set);
361
0
  return NULL;
362
2
}
isl_polynomial.c:isl_pw_qpolynomial_align_params_pw_set_and
Line
Count
Source
339
39
{
340
39
  isl_ctx *ctx;
341
39
  isl_bool aligned;
342
39
343
39
  if (
!pw || 39
!set39
)
344
0
    goto error;
345
39
  aligned = isl_set_space_has_equal_params(set, pw->dim);
346
39
  if (aligned < 0)
347
0
    goto error;
348
39
  
if (39
aligned39
)
349
39
    return fn(pw, set);
350
0
  
ctx = 0
FN0
(PW,get_ctx)(pw);
351
0
  if (!isl_space_has_named_params(pw->dim) ||
352
0
      !isl_space_has_named_params(set->dim))
353
0
    isl_die(ctx, isl_error_invalid,
354
0
      "unaligned unnamed parameters", goto error);
355
0
  
pw = 0
FN0
(PW,align_params)(pw, isl_set_get_space(set));
356
0
  set = isl_set_align_params(set, FN(PW,get_space)(pw));
357
0
  return fn(pw, set);
358
0
error:
359
0
  FN(PW,free)(pw);
360
0
  isl_set_free(set);
361
0
  return NULL;
362
0
}
363
#endif
364
365
static __isl_give PW *FN(PW,union_add_aligned)(__isl_take PW *pw1,
366
  __isl_take PW *pw2)
367
{
368
  int i, j, n;
369
  struct PW *res;
370
  isl_ctx *ctx;
371
  isl_set *set;
372
373
  if (!pw1 || !pw2)
374
    goto error;
375
376
  ctx = isl_space_get_ctx(pw1->dim);
377
#ifdef HAS_TYPE
378
  if (pw1->type != pw2->type)
379
    isl_die(ctx, isl_error_invalid,
380
      "fold types don't match", goto error);
381
#endif
382
  isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
383
384
  if (FN(PW,IS_ZERO)(pw1)) {
385
    FN(PW,free)(pw1);
386
    return pw2;
387
  }
388
389
  if (FN(PW,IS_ZERO)(pw2)) {
390
    FN(PW,free)(pw2);
391
    return pw1;
392
  }
393
394
  n = (pw1->n + 1) * (pw2->n + 1);
395
#ifdef HAS_TYPE
396
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), pw1->type, n);
397
#else
398
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), n);
399
#endif
400
401
  for (i = 0; i < pw1->n; ++i) {
402
    set = isl_set_copy(pw1->p[i].set);
403
    for (j = 0; j < pw2->n; ++j) {
404
      struct isl_set *common;
405
      EL *sum;
406
      common = isl_set_intersect(isl_set_copy(pw1->p[i].set),
407
            isl_set_copy(pw2->p[j].set));
408
      if (isl_set_plain_is_empty(common)) {
409
        isl_set_free(common);
410
        continue;
411
      }
412
      set = isl_set_subtract(set,
413
          isl_set_copy(pw2->p[j].set));
414
415
      sum = FN(EL,add_on_domain)(common,
416
               FN(EL,copy)(pw1->p[i].FIELD),
417
               FN(EL,copy)(pw2->p[j].FIELD));
418
419
      res = FN(PW,add_piece)(res, common, sum);
420
    }
421
    res = FN(PW,add_piece)(res, set, FN(EL,copy)(pw1->p[i].FIELD));
422
  }
423
424
  for (j = 0; j < pw2->n; ++j) {
425
    set = isl_set_copy(pw2->p[j].set);
426
    for (i = 0; i < pw1->n; ++i)
427
      set = isl_set_subtract(set,
428
          isl_set_copy(pw1->p[i].set));
429
    res = FN(PW,add_piece)(res, set, FN(EL,copy)(pw2->p[j].FIELD));
430
  }
431
432
  FN(PW,free)(pw1);
433
  FN(PW,free)(pw2);
434
435
  return res;
436
error:
437
  FN(PW,free)(pw1);
438
  FN(PW,free)(pw2);
439
  return NULL;
440
}
isl_polynomial.c:isl_pw_qpolynomial_union_add_aligned
Line
Count
Source
367
24
{
368
24
  int i, j, n;
369
24
  struct PW *res;
370
24
  isl_ctx *ctx;
371
24
  isl_set *set;
372
24
373
24
  if (
!pw1 || 24
!pw224
)
374
0
    goto error;
375
24
376
24
  ctx = isl_space_get_ctx(pw1->dim);
377
24
#ifdef HAS_TYPE
378
  if (pw1->type != pw2->type)
379
    isl_die(ctx, isl_error_invalid,
380
      "fold types don't match", goto error);
381
#endif
382
24
  isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
383
24
384
24
  
if (24
FN24
(PW,IS_ZERO)(pw1)24
)
{0
385
0
    FN(PW,free)(pw1);
386
0
    return pw2;
387
0
  }
388
24
389
24
  
if (24
FN24
(PW,IS_ZERO)(pw2)24
)
{0
390
0
    FN(PW,free)(pw2);
391
0
    return pw1;
392
0
  }
393
24
394
24
  n = (pw1->n + 1) * (pw2->n + 1);
395
24
#ifdef HAS_TYPE
396
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), pw1->type, n);
397
#else
398
24
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), n);
399
24
#endif
400
24
401
49
  for (i = 0; 
i < pw1->n49
;
++i25
)
{25
402
25
    set = isl_set_copy(pw1->p[i].set);
403
52
    for (j = 0; 
j < pw2->n52
;
++j27
)
{27
404
27
      struct isl_set *common;
405
27
      EL *sum;
406
27
      common = isl_set_intersect(isl_set_copy(pw1->p[i].set),
407
27
            isl_set_copy(pw2->p[j].set));
408
27
      if (
isl_set_plain_is_empty(common)27
)
{5
409
5
        isl_set_free(common);
410
5
        continue;
411
5
      }
412
22
      set = isl_set_subtract(set,
413
22
          isl_set_copy(pw2->p[j].set));
414
22
415
22
      sum = FN(EL,add_on_domain)(common,
416
22
               
FN22
(EL,copy)(pw1->p[i].
FIELD22
),
417
22
               
FN22
(EL,copy)(pw2->p[j].
FIELD22
));
418
22
419
22
      res = FN(PW,add_piece)(res, common, sum);
420
22
    }
421
25
    res = 
FN25
(PW,add_piece)(res, set,
FN25
(EL,copy)(pw1->p[i].
FIELD25
));
422
25
  }
423
24
424
49
  for (j = 0; 
j < pw2->n49
;
++j25
)
{25
425
25
    set = isl_set_copy(pw2->p[j].set);
426
52
    for (i = 0; 
i < pw1->n52
;
++i27
)
427
27
      set = isl_set_subtract(set,
428
27
          isl_set_copy(pw1->p[i].set));
429
25
    res = 
FN25
(PW,add_piece)(res, set,
FN25
(EL,copy)(pw2->p[j].
FIELD25
));
430
25
  }
431
24
432
24
  FN(PW,free)(pw1);
433
24
  FN(PW,free)(pw2);
434
24
435
24
  return res;
436
0
error:
437
0
  FN(PW,free)(pw1);
438
0
  FN(PW,free)(pw2);
439
0
  return NULL;
440
24
}
isl_aff.c:isl_pw_aff_union_add_aligned
Line
Count
Source
367
2.62k
{
368
2.62k
  int i, j, n;
369
2.62k
  struct PW *res;
370
2.62k
  isl_ctx *ctx;
371
2.62k
  isl_set *set;
372
2.62k
373
2.62k
  if (
!pw1 || 2.62k
!pw22.62k
)
374
0
    goto error;
375
2.62k
376
2.62k
  ctx = isl_space_get_ctx(pw1->dim);
377
2.62k
#ifdef HAS_TYPE
378
  if (pw1->type != pw2->type)
379
    isl_die(ctx, isl_error_invalid,
380
      "fold types don't match", goto error);
381
#endif
382
2.62k
  isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
383
2.62k
384
2.62k
  
if (2.62k
FN2.62k
(PW,IS_ZERO)(pw1)2.62k
)
{2.60k
385
2.60k
    FN(PW,free)(pw1);
386
2.60k
    return pw2;
387
2.60k
  }
388
2.62k
389
23
  
if (23
FN23
(PW,IS_ZERO)(pw2)23
)
{0
390
0
    FN(PW,free)(pw2);
391
0
    return pw1;
392
0
  }
393
23
394
23
  n = (pw1->n + 1) * (pw2->n + 1);
395
23
#ifdef HAS_TYPE
396
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), pw1->type, n);
397
#else
398
23
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), n);
399
23
#endif
400
23
401
46
  for (i = 0; 
i < pw1->n46
;
++i23
)
{23
402
23
    set = isl_set_copy(pw1->p[i].set);
403
46
    for (j = 0; 
j < pw2->n46
;
++j23
)
{23
404
23
      struct isl_set *common;
405
23
      EL *sum;
406
23
      common = isl_set_intersect(isl_set_copy(pw1->p[i].set),
407
23
            isl_set_copy(pw2->p[j].set));
408
23
      if (
isl_set_plain_is_empty(common)23
)
{23
409
23
        isl_set_free(common);
410
23
        continue;
411
23
      }
412
0
      set = isl_set_subtract(set,
413
0
          isl_set_copy(pw2->p[j].set));
414
0
415
0
      sum = FN(EL,add_on_domain)(common,
416
0
               
FN0
(EL,copy)(pw1->p[i].
FIELD0
),
417
0
               
FN0
(EL,copy)(pw2->p[j].
FIELD0
));
418
0
419
0
      res = FN(PW,add_piece)(res, common, sum);
420
0
    }
421
23
    res = 
FN23
(PW,add_piece)(res, set,
FN23
(EL,copy)(pw1->p[i].
FIELD23
));
422
23
  }
423
23
424
46
  for (j = 0; 
j < pw2->n46
;
++j23
)
{23
425
23
    set = isl_set_copy(pw2->p[j].set);
426
46
    for (i = 0; 
i < pw1->n46
;
++i23
)
427
23
      set = isl_set_subtract(set,
428
23
          isl_set_copy(pw1->p[i].set));
429
23
    res = 
FN23
(PW,add_piece)(res, set,
FN23
(EL,copy)(pw2->p[j].
FIELD23
));
430
23
  }
431
23
432
23
  FN(PW,free)(pw1);
433
23
  FN(PW,free)(pw2);
434
23
435
23
  return res;
436
0
error:
437
0
  FN(PW,free)(pw1);
438
0
  FN(PW,free)(pw2);
439
0
  return NULL;
440
23
}
isl_aff.c:isl_pw_multi_aff_union_add_aligned
Line
Count
Source
367
796
{
368
796
  int i, j, n;
369
796
  struct PW *res;
370
796
  isl_ctx *ctx;
371
796
  isl_set *set;
372
796
373
796
  if (
!pw1 || 796
!pw2796
)
374
0
    goto error;
375
796
376
796
  ctx = isl_space_get_ctx(pw1->dim);
377
796
#ifdef HAS_TYPE
378
  if (pw1->type != pw2->type)
379
    isl_die(ctx, isl_error_invalid,
380
      "fold types don't match", goto error);
381
#endif
382
796
  isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
383
796
384
796
  
if (796
FN796
(PW,IS_ZERO)(pw1)796
)
{71
385
71
    FN(PW,free)(pw1);
386
71
    return pw2;
387
71
  }
388
796
389
725
  
if (725
FN725
(PW,IS_ZERO)(pw2)725
)
{669
390
669
    FN(PW,free)(pw2);
391
669
    return pw1;
392
669
  }
393
725
394
56
  n = (pw1->n + 1) * (pw2->n + 1);
395
56
#ifdef HAS_TYPE
396
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), pw1->type, n);
397
#else
398
56
  res = FN(PW,alloc_size)(isl_space_copy(pw1->dim), n);
399
56
#endif
400
56
401
160
  for (i = 0; 
i < pw1->n160
;
++i104
)
{104
402
104
    set = isl_set_copy(pw1->p[i].set);
403
208
    for (j = 0; 
j < pw2->n208
;
++j104
)
{104
404
104
      struct isl_set *common;
405
104
      EL *sum;
406
104
      common = isl_set_intersect(isl_set_copy(pw1->p[i].set),
407
104
            isl_set_copy(pw2->p[j].set));
408
104
      if (
isl_set_plain_is_empty(common)104
)
{102
409
102
        isl_set_free(common);
410
102
        continue;
411
102
      }
412
2
      set = isl_set_subtract(set,
413
2
          isl_set_copy(pw2->p[j].set));
414
2
415
2
      sum = FN(EL,add_on_domain)(common,
416
2
               
FN2
(EL,copy)(pw1->p[i].
FIELD2
),
417
2
               
FN2
(EL,copy)(pw2->p[j].
FIELD2
));
418
2
419
2
      res = FN(PW,add_piece)(res, common, sum);
420
2
    }
421
104
    res = 
FN104
(PW,add_piece)(res, set,
FN104
(EL,copy)(pw1->p[i].
FIELD104
));
422
104
  }
423
56
424
112
  for (j = 0; 
j < pw2->n112
;
++j56
)
{56
425
56
    set = isl_set_copy(pw2->p[j].set);
426
160
    for (i = 0; 
i < pw1->n160
;
++i104
)
427
104
      set = isl_set_subtract(set,
428
104
          isl_set_copy(pw1->p[i].set));
429
56
    res = 
FN56
(PW,add_piece)(res, set,
FN56
(EL,copy)(pw2->p[j].
FIELD56
));
430
56
  }
431
56
432
56
  FN(PW,free)(pw1);
433
56
  FN(PW,free)(pw2);
434
56
435
56
  return res;
436
0
error:
437
0
  FN(PW,free)(pw1);
438
0
  FN(PW,free)(pw2);
439
0
  return NULL;
440
725
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_union_add_aligned
441
442
/* Private version of "union_add".  For isl_pw_qpolynomial and
443
 * isl_pw_qpolynomial_fold, we prefer to simply call it "add".
444
 */
445
static __isl_give PW *FN(PW,union_add_)(__isl_take PW *pw1, __isl_take PW *pw2)
446
{
447
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
448
            &FN(PW,union_add_aligned));
449
}
isl_aff.c:isl_pw_aff_union_add_
Line
Count
Source
446
2.62k
{
447
2.62k
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
448
2.62k
            &FN(PW,union_add_aligned));
449
2.62k
}
isl_aff.c:isl_pw_multi_aff_union_add_
Line
Count
Source
446
796
{
447
796
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
448
796
            &FN(PW,union_add_aligned));
449
796
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_union_add_
isl_polynomial.c:isl_pw_qpolynomial_union_add_
Line
Count
Source
446
24
{
447
24
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
448
24
            &FN(PW,union_add_aligned));
449
24
}
450
451
/* Make sure "pw" has room for at least "n" more pieces.
452
 *
453
 * If there is only one reference to pw, we extend it in place.
454
 * Otherwise, we create a new PW and copy the pieces.
455
 */
456
static __isl_give PW *FN(PW,grow)(__isl_take PW *pw, int n)
457
{
458
  int i;
459
  isl_ctx *ctx;
460
  PW *res;
461
462
  if (!pw)
463
    return NULL;
464
  if (pw->n + n <= pw->size)
465
    return pw;
466
  ctx = FN(PW,get_ctx)(pw);
467
  n += pw->n;
468
  if (pw->ref == 1) {
469
    res = isl_realloc(ctx, pw, struct PW,
470
          sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
471
    if (!res)
472
      return FN(PW,free)(pw);
473
    res->size = n;
474
    return res;
475
  }
476
#ifdef HAS_TYPE
477
  res = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, n);
478
#else
479
  res = FN(PW,alloc_size)(isl_space_copy(pw->dim), n);
480
#endif
481
  if (!res)
482
    return FN(PW,free)(pw);
483
  for (i = 0; i < pw->n; ++i)
484
    res = FN(PW,add_piece)(res, isl_set_copy(pw->p[i].set),
485
              FN(EL,copy)(pw->p[i].FIELD));
486
  FN(PW,free)(pw);
487
  return res;
488
}
isl_polynomial.c:isl_pw_qpolynomial_grow
Line
Count
Source
457
1
{
458
1
  int i;
459
1
  isl_ctx *ctx;
460
1
  PW *res;
461
1
462
1
  if (!pw)
463
0
    return NULL;
464
1
  
if (1
pw->n + n <= pw->size1
)
465
0
    return pw;
466
1
  
ctx = 1
FN1
(PW,get_ctx)(pw);
467
1
  n += pw->n;
468
1
  if (
pw->ref == 11
)
{1
469
1
    res = isl_realloc(ctx, pw, struct PW,
470
1
          sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
471
1
    if (!res)
472
0
      
return 0
FN0
(PW,free)(pw);
473
1
    res->size = n;
474
1
    return res;
475
1
  }
476
1
#ifdef HAS_TYPE
477
  res = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, n);
478
#else
479
0
  
res = 0
FN0
(PW,alloc_size)(isl_space_copy(pw->dim), n);
480
0
#endif
481
0
  if (!res)
482
0
    
return 0
FN0
(PW,free)(pw);
483
0
  
for (i = 0; 0
i < pw->n0
;
++i0
)
484
0
    
res = 0
FN0
(PW,add_piece)(res, isl_set_copy(pw->p[i].set),
485
0
              
FN0
(EL,copy)(pw->p[i].
FIELD0
));
486
0
  FN(PW,free)(pw);
487
0
  return res;
488
0
}
isl_aff.c:isl_pw_multi_aff_grow
Line
Count
Source
457
49
{
458
49
  int i;
459
49
  isl_ctx *ctx;
460
49
  PW *res;
461
49
462
49
  if (!pw)
463
0
    return NULL;
464
49
  
if (49
pw->n + n <= pw->size49
)
465
0
    return pw;
466
49
  
ctx = 49
FN49
(PW,get_ctx)(pw);
467
49
  n += pw->n;
468
49
  if (
pw->ref == 149
)
{49
469
49
    res = isl_realloc(ctx, pw, struct PW,
470
49
          sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
471
49
    if (!res)
472
0
      
return 0
FN0
(PW,free)(pw);
473
49
    res->size = n;
474
49
    return res;
475
49
  }
476
49
#ifdef HAS_TYPE
477
  res = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, n);
478
#else
479
0
  
res = 0
FN0
(PW,alloc_size)(isl_space_copy(pw->dim), n);
480
0
#endif
481
0
  if (!res)
482
0
    
return 0
FN0
(PW,free)(pw);
483
0
  
for (i = 0; 0
i < pw->n0
;
++i0
)
484
0
    
res = 0
FN0
(PW,add_piece)(res, isl_set_copy(pw->p[i].set),
485
0
              
FN0
(EL,copy)(pw->p[i].
FIELD0
));
486
0
  FN(PW,free)(pw);
487
0
  return res;
488
0
}
isl_aff.c:isl_pw_aff_grow
Line
Count
Source
457
168
{
458
168
  int i;
459
168
  isl_ctx *ctx;
460
168
  PW *res;
461
168
462
168
  if (!pw)
463
0
    return NULL;
464
168
  
if (168
pw->n + n <= pw->size168
)
465
0
    return pw;
466
168
  
ctx = 168
FN168
(PW,get_ctx)(pw);
467
168
  n += pw->n;
468
168
  if (
pw->ref == 1168
)
{168
469
168
    res = isl_realloc(ctx, pw, struct PW,
470
168
          sizeof(struct PW) + (n - 1) * sizeof(S(PW,piece)));
471
168
    if (!res)
472
0
      
return 0
FN0
(PW,free)(pw);
473
168
    res->size = n;
474
168
    return res;
475
168
  }
476
168
#ifdef HAS_TYPE
477
  res = FN(PW,alloc_size)(isl_space_copy(pw->dim), pw->type, n);
478
#else
479
0
  
res = 0
FN0
(PW,alloc_size)(isl_space_copy(pw->dim), n);
480
0
#endif
481
0
  if (!res)
482
0
    
return 0
FN0
(PW,free)(pw);
483
0
  
for (i = 0; 0
i < pw->n0
;
++i0
)
484
0
    
res = 0
FN0
(PW,add_piece)(res, isl_set_copy(pw->p[i].set),
485
0
              
FN0
(EL,copy)(pw->p[i].
FIELD0
));
486
0
  FN(PW,free)(pw);
487
0
  return res;
488
0
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_grow
489
490
static __isl_give PW *FN(PW,add_disjoint_aligned)(__isl_take PW *pw1,
491
  __isl_take PW *pw2)
492
{
493
  int i;
494
  isl_ctx *ctx;
495
496
  if (!pw1 || !pw2)
497
    goto error;
498
499
  if (pw1->size < pw1->n + pw2->n && pw1->n < pw2->n)
500
    return FN(PW,add_disjoint_aligned)(pw2, pw1);
501
502
  ctx = isl_space_get_ctx(pw1->dim);
503
#ifdef HAS_TYPE
504
  if (pw1->type != pw2->type)
505
    isl_die(ctx, isl_error_invalid,
506
      "fold types don't match", goto error);
507
#endif
508
  isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
509
510
  if (FN(PW,IS_ZERO)(pw1)) {
511
    FN(PW,free)(pw1);
512
    return pw2;
513
  }
514
515
  if (FN(PW,IS_ZERO)(pw2)) {
516
    FN(PW,free)(pw2);
517
    return pw1;
518
  }
519
520
  pw1 = FN(PW,grow)(pw1, pw2->n);
521
  if (!pw1)
522
    goto error;
523
524
  for (i = 0; i < pw2->n; ++i)
525
    pw1 = FN(PW,add_piece)(pw1,
526
        isl_set_copy(pw2->p[i].set),
527
        FN(EL,copy)(pw2->p[i].FIELD));
528
529
  FN(PW,free)(pw2);
530
531
  return pw1;
532
error:
533
  FN(PW,free)(pw1);
534
  FN(PW,free)(pw2);
535
  return NULL;
536
}
isl_aff.c:isl_pw_aff_add_disjoint_aligned
Line
Count
Source
492
596
{
493
596
  int i;
494
596
  isl_ctx *ctx;
495
596
496
596
  if (
!pw1 || 596
!pw2596
)
497
0
    goto error;
498
596
499
596
  
if (596
pw1->size < pw1->n + pw2->n && 596
pw1->n < pw2->n354
)
500
186
    
return 186
FN186
(PW,add_disjoint_aligned)(pw2, pw1);
501
596
502
410
  ctx = isl_space_get_ctx(pw1->dim);
503
410
#ifdef HAS_TYPE
504
  if (pw1->type != pw2->type)
505
    isl_die(ctx, isl_error_invalid,
506
      "fold types don't match", goto error);
507
#endif
508
410
  isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
509
410
510
410
  
if (410
FN410
(PW,IS_ZERO)(pw1)410
)
{34
511
34
    FN(PW,free)(pw1);
512
34
    return pw2;
513
34
  }
514
410
515
376
  
if (376
FN376
(PW,IS_ZERO)(pw2)376
)
{208
516
208
    FN(PW,free)(pw2);
517
208
    return pw1;
518
208
  }
519
376
520
168
  
pw1 = 168
FN168
(PW,grow)(pw1, pw2->n);
521
168
  if (!pw1)
522
0
    goto error;
523
168
524
336
  
for (i = 0; 168
i < pw2->n336
;
++i168
)
525
168
    
pw1 = 168
FN168
(PW,add_piece)(pw1,
526
168
        isl_set_copy(pw2->p[i].set),
527
168
        
FN168
(EL,copy)(pw2->p[i].
FIELD168
));
528
168
529
168
  FN(PW,free)(pw2);
530
168
531
168
  return pw1;
532
0
error:
533
0
  FN(PW,free)(pw1);
534
0
  FN(PW,free)(pw2);
535
0
  return NULL;
536
168
}
isl_polynomial.c:isl_pw_qpolynomial_add_disjoint_aligned
Line
Count
Source
492
3
{
493
3
  int i;
494
3
  isl_ctx *ctx;
495
3
496
3
  if (
!pw1 || 3
!pw23
)
497
0
    goto error;
498
3
499
3
  
if (3
pw1->size < pw1->n + pw2->n && 3
pw1->n < pw2->n2
)
500
1
    
return 1
FN1
(PW,add_disjoint_aligned)(pw2, pw1);
501
3
502
2
  ctx = isl_space_get_ctx(pw1->dim);
503
2
#ifdef HAS_TYPE
504
  if (pw1->type != pw2->type)
505
    isl_die(ctx, isl_error_invalid,
506
      "fold types don't match", goto error);
507
#endif
508
2
  isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
509
2
510
2
  
if (2
FN2
(PW,IS_ZERO)(pw1)2
)
{0
511
0
    FN(PW,free)(pw1);
512
0
    return pw2;
513
0
  }
514
2
515
2
  
if (2
FN2
(PW,IS_ZERO)(pw2)2
)
{1
516
1
    FN(PW,free)(pw2);
517
1
    return pw1;
518
1
  }
519
2
520
1
  
pw1 = 1
FN1
(PW,grow)(pw1, pw2->n);
521
1
  if (!pw1)
522
0
    goto error;
523
1
524
2
  
for (i = 0; 1
i < pw2->n2
;
++i1
)
525
1
    
pw1 = 1
FN1
(PW,add_piece)(pw1,
526
1
        isl_set_copy(pw2->p[i].set),
527
1
        
FN1
(EL,copy)(pw2->p[i].
FIELD1
));
528
1
529
1
  FN(PW,free)(pw2);
530
1
531
1
  return pw1;
532
0
error:
533
0
  FN(PW,free)(pw1);
534
0
  FN(PW,free)(pw2);
535
0
  return NULL;
536
1
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_add_disjoint_aligned
isl_aff.c:isl_pw_multi_aff_add_disjoint_aligned
Line
Count
Source
492
3.34k
{
493
3.34k
  int i;
494
3.34k
  isl_ctx *ctx;
495
3.34k
496
3.34k
  if (
!pw1 || 3.34k
!pw23.34k
)
497
0
    goto error;
498
3.34k
499
3.34k
  
if (3.34k
pw1->size < pw1->n + pw2->n && 3.34k
pw1->n < pw2->n1.69k
)
500
1.64k
    
return 1.64k
FN1.64k
(PW,add_disjoint_aligned)(pw2, pw1);
501
3.34k
502
1.69k
  ctx = isl_space_get_ctx(pw1->dim);
503
1.69k
#ifdef HAS_TYPE
504
  if (pw1->type != pw2->type)
505
    isl_die(ctx, isl_error_invalid,
506
      "fold types don't match", goto error);
507
#endif
508
1.69k
  isl_assert(ctx, isl_space_is_equal(pw1->dim, pw2->dim), goto error);
509
1.69k
510
1.69k
  
if (1.69k
FN1.69k
(PW,IS_ZERO)(pw1)1.69k
)
{0
511
0
    FN(PW,free)(pw1);
512
0
    return pw2;
513
0
  }
514
1.69k
515
1.69k
  
if (1.69k
FN1.69k
(PW,IS_ZERO)(pw2)1.69k
)
{1.64k
516
1.64k
    FN(PW,free)(pw2);
517
1.64k
    return pw1;
518
1.64k
  }
519
1.69k
520
49
  
pw1 = 49
FN49
(PW,grow)(pw1, pw2->n);
521
49
  if (!pw1)
522
0
    goto error;
523
49
524
98
  
for (i = 0; 49
i < pw2->n98
;
++i49
)
525
49
    
pw1 = 49
FN49
(PW,add_piece)(pw1,
526
49
        isl_set_copy(pw2->p[i].set),
527
49
        
FN49
(EL,copy)(pw2->p[i].
FIELD49
));
528
49
529
49
  FN(PW,free)(pw2);
530
49
531
49
  return pw1;
532
0
error:
533
0
  FN(PW,free)(pw1);
534
0
  FN(PW,free)(pw2);
535
0
  return NULL;
536
49
}
537
538
__isl_give PW *FN(PW,add_disjoint)(__isl_take PW *pw1, __isl_take PW *pw2)
539
{
540
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
541
            &FN(PW,add_disjoint_aligned));
542
}
isl_pw_aff_add_disjoint
Line
Count
Source
539
410
{
540
410
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
541
410
            &FN(PW,add_disjoint_aligned));
542
410
}
isl_pw_multi_aff_add_disjoint
Line
Count
Source
539
1.69k
{
540
1.69k
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
541
1.69k
            &FN(PW,add_disjoint_aligned));
542
1.69k
}
isl_pw_qpolynomial_add_disjoint
Line
Count
Source
539
2
{
540
2
  return FN(PW,align_params_pw_pw_and)(pw1, pw2,
541
2
            &FN(PW,add_disjoint_aligned));
542
2
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_add_disjoint
543
544
/* This function is currently only used from isl_aff.c
545
 */
546
static __isl_give PW *FN(PW,on_shared_domain_in)(__isl_take PW *pw1,
547
  __isl_take PW *pw2, __isl_take isl_space *space,
548
  __isl_give EL *(*fn)(__isl_take EL *el1, __isl_take EL *el2))
549
  __attribute__ ((unused));
550
551
/* Apply "fn" to pairs of elements from pw1 and pw2 on shared domains.
552
 * The result of "fn" (and therefore also of this function) lives in "space".
553
 */
554
static __isl_give PW *FN(PW,on_shared_domain_in)(__isl_take PW *pw1,
555
  __isl_take PW *pw2, __isl_take isl_space *space,
556
  __isl_give EL *(*fn)(__isl_take EL *el1, __isl_take EL *el2))
557
{
558
  int i, j, n;
559
  PW *res = NULL;
560
561
  if (!pw1 || !pw2)
562
    goto error;
563
564
  n = pw1->n * pw2->n;
565
#ifdef HAS_TYPE
566
  res = FN(PW,alloc_size)(isl_space_copy(space), pw1->type, n);
567
#else
568
  res = FN(PW,alloc_size)(isl_space_copy(space), n);
569
#endif
570
571
  for (i = 0; i < pw1->n; ++i) {
572
    for (j = 0; j < pw2->n; ++j) {
573
      isl_set *common;
574
      EL *res_ij;
575
      int empty;
576
577
      common = isl_set_intersect(
578
          isl_set_copy(pw1->p[i].set),
579
          isl_set_copy(pw2->p[j].set));
580
      empty = isl_set_plain_is_empty(common);
581
      if (empty < 0 || empty) {
582
        isl_set_free(common);
583
        if (empty < 0)
584
          goto error;
585
        continue;
586
      }
587
588
      res_ij = fn(FN(EL,copy)(pw1->p[i].FIELD),
589
            FN(EL,copy)(pw2->p[j].FIELD));
590
      res_ij = FN(EL,gist)(res_ij, isl_set_copy(common));
591
592
      res = FN(PW,add_piece)(res, common, res_ij);
593
    }
594
  }
595
596
  isl_space_free(space);
597
  FN(PW,free)(pw1);
598
  FN(PW,free)(pw2);
599
  return res;
600
error:
601
  isl_space_free(space);
602
  FN(PW,free)(pw1);
603
  FN(PW,free)(pw2);
604
  FN(PW,free)(res);
605
  return NULL;
606
}
isl_aff.c:isl_pw_multi_aff_on_shared_domain_in
Line
Count
Source
557
154
{
558
154
  int i, j, n;
559
154
  PW *res = NULL;
560
154
561
154
  if (
!pw1 || 154
!pw2154
)
562
0
    goto error;
563
154
564
154
  n = pw1->n * pw2->n;
565
154
#ifdef HAS_TYPE
566
  res = FN(PW,alloc_size)(isl_space_copy(space), pw1->type, n);
567
#else
568
154
  res = FN(PW,alloc_size)(isl_space_copy(space), n);
569
154
#endif
570
154
571
308
  for (i = 0; 
i < pw1->n308
;
++i154
)
{154
572
311
    for (j = 0; 
j < pw2->n311
;
++j157
)
{157
573
157
      isl_set *common;
574
157
      EL *res_ij;
575
157
      int empty;
576
157
577
157
      common = isl_set_intersect(
578
157
          isl_set_copy(pw1->p[i].set),
579
157
          isl_set_copy(pw2->p[j].set));
580
157
      empty = isl_set_plain_is_empty(common);
581
157
      if (
empty < 0 || 157
empty157
)
{0
582
0
        isl_set_free(common);
583
0
        if (empty < 0)
584
0
          goto error;
585
0
        continue;
586
0
      }
587
157
588
157
      
res_ij = fn(157
FN157
(EL,copy)(pw1->p[i].
FIELD157
),
589
157
            
FN157
(EL,copy)(pw2->p[j].
FIELD157
));
590
157
      res_ij = FN(EL,gist)(res_ij, isl_set_copy(common));
591
157
592
157
      res = FN(PW,add_piece)(res, common, res_ij);
593
157
    }
594
154
  }
595
154
596
154
  isl_space_free(space);
597
154
  FN(PW,free)(pw1);
598
154
  FN(PW,free)(pw2);
599
154
  return res;
600
0
error:
601
0
  isl_space_free(space);
602
0
  FN(PW,free)(pw1);
603
0
  FN(PW,free)(pw2);
604
0
  FN(PW,free)(res);
605
0
  return NULL;
606
154
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_on_shared_domain_in
isl_aff.c:isl_pw_aff_on_shared_domain_in
Line
Count
Source
557
64.7k
{
558
64.7k
  int i, j, n;
559
64.7k
  PW *res = NULL;
560
64.7k
561
64.7k
  if (
!pw1 || 64.7k
!pw264.7k
)
562
0
    goto error;
563
64.7k
564
64.7k
  n = pw1->n * pw2->n;
565
64.7k
#ifdef HAS_TYPE
566
  res = FN(PW,alloc_size)(isl_space_copy(space), pw1->type, n);
567
#else
568
64.7k
  res = FN(PW,alloc_size)(isl_space_copy(space), n);
569
64.7k
#endif
570
64.7k
571
131k
  for (i = 0; 
i < pw1->n131k
;
++i66.6k
)
{66.6k
572
136k
    for (j = 0; 
j < pw2->n136k
;
++j69.6k
)
{69.6k
573
69.6k
      isl_set *common;
574
69.6k
      EL *res_ij;
575
69.6k
      int empty;
576
69.6k
577
69.6k
      common = isl_set_intersect(
578
69.6k
          isl_set_copy(pw1->p[i].set),
579
69.6k
          isl_set_copy(pw2->p[j].set));
580
69.6k
      empty = isl_set_plain_is_empty(common);
581
69.6k
      if (
empty < 0 || 69.6k
empty69.6k
)
{2.78k
582
2.78k
        isl_set_free(common);
583
2.78k
        if (empty < 0)
584
0
          goto error;
585
2.78k
        continue;
586
2.78k
      }
587
69.6k
588
66.8k
      
res_ij = fn(66.8k
FN66.8k
(EL,copy)(pw1->p[i].
FIELD66.8k
),
589
66.8k
            
FN66.8k
(EL,copy)(pw2->p[j].
FIELD66.8k
));
590
66.8k
      res_ij = FN(EL,gist)(res_ij, isl_set_copy(common));
591
66.8k
592
66.8k
      res = FN(PW,add_piece)(res, common, res_ij);
593
66.8k
    }
594
66.6k
  }
595
64.7k
596
64.7k
  isl_space_free(space);
597
64.7k
  FN(PW,free)(pw1);
598
64.7k
  FN(PW,free)(pw2);
599
64.7k
  return res;
600
0
error:
601
0
  isl_space_free(space);
602
0
  FN(PW,free)(pw1);
603
0
  FN(PW,free)(pw2);
604
0
  FN(PW,free)(res);
605
0
  return NULL;
606
64.7k
}
Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_on_shared_domain_in
607
608
/* This function is currently only used from isl_aff.c
609
 */
610
static __isl_give PW *FN(PW,on_shared_domain)(__isl_take PW *pw1,
611
  __isl_take PW *pw2,
612
  __isl_give EL *(*fn)(__isl_take EL *el1, __isl_take EL *el2))
613
  __attribute__ ((unused));
614
615
/* Apply "fn" to pairs of elements from pw1 and pw2 on shared domains.
616
 * The result of "fn" is assumed to live in the same space as "pw1" and "pw2".
617
 */
618
static __isl_give PW *FN(PW,on_shared_domain)(__isl_take PW *pw1,
619
  __isl_take PW *pw2,
620
  __isl_give EL *(*fn)(__isl_take EL *el1, __isl_take EL *el2))
621
{
622
  isl_space *space;
623
624
  if (!pw1 || !pw2)
625
    goto error;
626
627
  space = isl_space_copy(pw1->dim);
628
  return FN(PW,on_shared_domain_in)(pw1, pw2, space, fn);
629
error:
630
  FN(PW,free)(pw1);
631
  FN(PW,free)(pw2);
632
  return NULL;
633
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_on_shared_domain
isl_aff.c:isl_pw_aff_on_shared_domain
Line
Count
Source
621
64.7k
{
622
64.7k
  isl_space *space;
623
64.7k
624
64.7k
  if (
!pw1 || 64.7k
!pw264.7k
)
625
0
    goto error;
626
64.7k
627
64.7k
  space = isl_space_copy(pw1->dim);
628
64.7k
  return FN(PW,on_shared_domain_in)(pw1, pw2, space, fn);
629
0
error:
630
0
  FN(PW,free)(pw1);
631
0
  FN(PW,free)(pw2);
632
0
  return NULL;
633
64.7k
}
isl_aff.c:isl_pw_multi_aff_on_shared_domain
Line
Count
Source
621
1
{
622
1
  isl_space *space;
623
1
624
1
  if (
!pw1 || 1
!pw21
)
625
0
    goto error;
626
1
627
1
  space = isl_space_copy(pw1->dim);
628
1
  return FN(PW,on_shared_domain_in)(pw1, pw2, space, fn);
629
0
error:
630
0
  FN(PW,free)(pw1);
631
0
  FN(PW,free)(pw2);
632
0
  return NULL;
633
1
}
Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_on_shared_domain
634
635
#ifndef NO_NEG
636
__isl_give PW *FN(PW,neg)(__isl_take PW *pw)
637
{
638
  int i;
639
640
  if (!pw)
641
    return NULL;
642
643
  if (FN(PW,IS_ZERO)(pw))
644
    return pw;
645
646
  pw = FN(PW,cow)(pw);
647
  if (!pw)
648
    return NULL;
649
650
  for (i = 0; i < pw->n; ++i) {
651
    pw->p[i].FIELD = FN(EL,neg)(pw->p[i].FIELD);
652
    if (!pw->p[i].FIELD)
653
      return FN(PW,free)(pw);
654
  }
655
656
  return pw;
657
}
Unexecuted instantiation: isl_pw_multi_aff_neg
isl_pw_aff_neg
Line
Count
Source
637
20.6k
{
638
20.6k
  int i;
639
20.6k
640
20.6k
  if (!pw)
641
0
    return NULL;
642
20.6k
643
20.6k
  
if (20.6k
FN20.6k
(PW,IS_ZERO)(pw)20.6k
)
644
0
    return pw;
645
20.6k
646
20.6k
  
pw = 20.6k
FN20.6k
(PW,cow)(pw);
647
20.6k
  if (!pw)
648
0
    return NULL;
649
20.6k
650
41.9k
  
for (i = 0; 20.6k
i < pw->n41.9k
;
++i21.3k
)
{21.3k
651
21.3k
    pw->p[i].
FIELD21.3k
=
FN21.3k
(EL,neg)(pw->p[i].
FIELD21.3k
);
652
21.3k
    if (
!pw->p[i].21.3k
FIELD21.3k
)
653
0
      
return 0
FN0
(PW,free)(pw);
654
21.3k
  }
655
20.6k
656
20.6k
  return pw;
657
20.6k
}
isl_pw_qpolynomial_neg
Line
Count
Source
637
11
{
638
11
  int i;
639
11
640
11
  if (!pw)
641
0
    return NULL;
642
11
643
11
  
if (11
FN11
(PW,IS_ZERO)(pw)11
)
644
0
    return pw;
645
11
646
11
  
pw = 11
FN11
(PW,cow)(pw);
647
11
  if (!pw)
648
0
    return NULL;
649
11
650
23
  
for (i = 0; 11
i < pw->n23
;
++i12
)
{12
651
12
    pw->p[i].
FIELD12
=
FN12
(EL,neg)(pw->p[i].
FIELD12
);
652
12
    if (
!pw->p[i].12
FIELD12
)
653
0
      
return 0
FN0
(PW,free)(pw);
654
12
  }
655
11
656
11
  return pw;
657
11
}
658
#endif
659
660
#ifndef NO_SUB
661
__isl_give PW *FN(PW,sub)(__isl_take PW *pw1, __isl_take PW *pw2)
662
{
663
  return FN(PW,add)(pw1, FN(PW,neg)(pw2));
664
}
isl_pw_aff_sub
Line
Count
Source
662
6.09k
{
663
6.09k
  return 
FN6.09k
(PW,add)(pw1,
FN6.09k
(PW,neg)(pw2));
664
6.09k
}
isl_pw_qpolynomial_sub
Line
Count
Source
662
9
{
663
9
  return 
FN9
(PW,add)(pw1,
FN9
(PW,neg)(pw2));
664
9
}
665
#endif
666
667
#ifndef NO_EVAL
668
__isl_give isl_val *FN(PW,eval)(__isl_take PW *pw, __isl_take isl_point *pnt)
669
{
670
  int i;
671
  int found = 0;
672
  isl_ctx *ctx;
673
  isl_space *pnt_dim = NULL;
674
  isl_val *v;
675
676
  if (!pw || !pnt)
677
    goto error;
678
  ctx = isl_point_get_ctx(pnt);
679
  pnt_dim = isl_point_get_space(pnt);
680
  isl_assert(ctx, isl_space_is_domain_internal(pnt_dim, pw->dim),
681
        goto error);
682
683
  for (i = 0; i < pw->n; ++i) {
684
    found = isl_set_contains_point(pw->p[i].set, pnt);
685
    if (found < 0)
686
      goto error;
687
    if (found)
688
      break;
689
  }
690
  if (found)
691
    v = FN(EL,eval)(FN(EL,copy)(pw->p[i].FIELD),
692
              isl_point_copy(pnt));
693
  else
694
    v = isl_val_zero(ctx);
695
  FN(PW,free)(pw);
696
  isl_space_free(pnt_dim);
697
  isl_point_free(pnt);
698
  return v;
699
error:
700
  FN(PW,free)(pw);
701
  isl_space_free(pnt_dim);
702
  isl_point_free(pnt);
703
  return NULL;
704
}
isl_pw_qpolynomial_eval
Line
Count
Source
669
1
{
670
1
  int i;
671
1
  int found = 0;
672
1
  isl_ctx *ctx;
673
1
  isl_space *pnt_dim = NULL;
674
1
  isl_val *v;
675
1
676
1
  if (
!pw || 1
!pnt1
)
677
0
    goto error;
678
1
  ctx = isl_point_get_ctx(pnt);
679
1
  pnt_dim = isl_point_get_space(pnt);
680
1
  isl_assert(ctx, isl_space_is_domain_internal(pnt_dim, pw->dim),
681
1
        goto error);
682
1
683
1
  
for (i = 0; 1
i < pw->n1
;
++i0
)
{1
684
1
    found = isl_set_contains_point(pw->p[i].set, pnt);
685
1
    if (found < 0)
686
0
      goto error;
687
1
    
if (1
found1
)
688
1
      break;
689
1
  }
690
1
  
if (1
found1
)
691
1
    
v = 1
FN1
(EL,eval)(
FN1
(EL,copy)(pw->p[i].
FIELD1
),
692
1
              isl_point_copy(pnt));
693
1
  else
694
0
    v = isl_val_zero(ctx);
695
1
  FN(PW,free)(pw);
696
1
  isl_space_free(pnt_dim);
697
1
  isl_point_free(pnt);
698
1
  return v;
699
0
error:
700
0
  FN(PW,free)(pw);
701
0
  isl_space_free(pnt_dim);
702
0
  isl_point_free(pnt);
703
0
  return NULL;
704
1
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_eval
705
#endif
706
707
/* Return the parameter domain of "pw".
708
 */
709
__isl_give isl_set *FN(PW,params)(__isl_take PW *pw)
710
{
711
  return isl_set_params(FN(PW,domain)(pw));
712
}
Unexecuted instantiation: isl_pw_aff_params
Unexecuted instantiation: isl_pw_multi_aff_params
Unexecuted instantiation: isl_pw_qpolynomial_fold_params
Unexecuted instantiation: isl_pw_qpolynomial_params
713
714
__isl_give isl_set *FN(PW,domain)(__isl_take PW *pw)
715
{
716
  int i;
717
  isl_set *dom;
718
719
  if (!pw)
720
    return NULL;
721
722
  dom = isl_set_empty(FN(PW,get_domain_space)(pw));
723
  for (i = 0; i < pw->n; ++i)
724
    dom = isl_set_union_disjoint(dom, isl_set_copy(pw->p[i].set));
725
726
  FN(PW,free)(pw);
727
728
  return dom;
729
}
isl_pw_multi_aff_domain
Line
Count
Source
715
15
{
716
15
  int i;
717
15
  isl_set *dom;
718
15
719
15
  if (!pw)
720
0
    return NULL;
721
15
722
15
  
dom = isl_set_empty(15
FN15
(PW,get_domain_space)(pw));
723
31
  for (i = 0; 
i < pw->n31
;
++i16
)
724
16
    dom = isl_set_union_disjoint(dom, isl_set_copy(pw->p[i].set));
725
15
726
15
  FN(PW,free)(pw);
727
15
728
15
  return dom;
729
15
}
isl_pw_aff_domain
Line
Count
Source
715
43.6k
{
716
43.6k
  int i;
717
43.6k
  isl_set *dom;
718
43.6k
719
43.6k
  if (!pw)
720
0
    return NULL;
721
43.6k
722
43.6k
  
dom = isl_set_empty(43.6k
FN43.6k
(PW,get_domain_space)(pw));
723
88.5k
  for (i = 0; 
i < pw->n88.5k
;
++i44.9k
)
724
44.9k
    dom = isl_set_union_disjoint(dom, isl_set_copy(pw->p[i].set));
725
43.6k
726
43.6k
  FN(PW,free)(pw);
727
43.6k
728
43.6k
  return dom;
729
43.6k
}
isl_pw_qpolynomial_domain
Line
Count
Source
715
1
{
716
1
  int i;
717
1
  isl_set *dom;
718
1
719
1
  if (!pw)
720
0
    return NULL;
721
1
722
1
  
dom = isl_set_empty(1
FN1
(PW,get_domain_space)(pw));
723
2
  for (i = 0; 
i < pw->n2
;
++i1
)
724
1
    dom = isl_set_union_disjoint(dom, isl_set_copy(pw->p[i].set));
725
1
726
1
  FN(PW,free)(pw);
727
1
728
1
  return dom;
729
1
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_domain
730
731
/* Exploit the equalities in the domain of piece "i" of "pw"
732
 * to simplify the associated function.
733
 * If the domain of piece "i" is empty, then remove it entirely,
734
 * replacing it with the final piece.
735
 */
736
static int FN(PW,exploit_equalities_and_remove_if_empty)(__isl_keep PW *pw,
737
  int i)
738
{
739
  isl_basic_set *aff;
740
  int empty = isl_set_plain_is_empty(pw->p[i].set);
741
742
  if (empty < 0)
743
    return -1;
744
  if (empty) {
745
    isl_set_free(pw->p[i].set);
746
    FN(EL,free)(pw->p[i].FIELD);
747
    if (i != pw->n - 1)
748
      pw->p[i] = pw->p[pw->n - 1];
749
    pw->n--;
750
751
    return 0;
752
  }
753
754
  aff = isl_set_affine_hull(isl_set_copy(pw->p[i].set));
755
  pw->p[i].FIELD = FN(EL,substitute_equalities)(pw->p[i].FIELD, aff);
756
  if (!pw->p[i].FIELD)
757
    return -1;
758
759
  return 0;
760
}
isl_polynomial.c:isl_pw_qpolynomial_exploit_equalities_and_remove_if_empty
Line
Count
Source
738
35
{
739
35
  isl_basic_set *aff;
740
35
  int empty = isl_set_plain_is_empty(pw->p[i].set);
741
35
742
35
  if (empty < 0)
743
0
    return -1;
744
35
  
if (35
empty35
)
{0
745
0
    isl_set_free(pw->p[i].set);
746
0
    
FN0
(EL,free)(pw->p[i].
FIELD0
);
747
0
    if (i != pw->n - 1)
748
0
      pw->p[i] = pw->p[pw->n - 1];
749
0
    pw->n--;
750
0
751
0
    return 0;
752
0
  }
753
35
754
35
  aff = isl_set_affine_hull(isl_set_copy(pw->p[i].set));
755
35
  pw->p[i].
FIELD35
=
FN35
(EL,substitute_equalities)(pw->p[i].
FIELD35
, aff);
756
35
  if (
!pw->p[i].35
FIELD35
)
757
0
    return -1;
758
35
759
35
  return 0;
760
35
}
isl_aff.c:isl_pw_multi_aff_exploit_equalities_and_remove_if_empty
Line
Count
Source
738
1.36k
{
739
1.36k
  isl_basic_set *aff;
740
1.36k
  int empty = isl_set_plain_is_empty(pw->p[i].set);
741
1.36k
742
1.36k
  if (empty < 0)
743
0
    return -1;
744
1.36k
  
if (1.36k
empty1.36k
)
{1
745
1
    isl_set_free(pw->p[i].set);
746
1
    
FN1
(EL,free)(pw->p[i].
FIELD1
);
747
1
    if (i != pw->n - 1)
748
0
      pw->p[i] = pw->p[pw->n - 1];
749
1
    pw->n--;
750
1
751
1
    return 0;
752
1
  }
753
1.36k
754
1.36k
  aff = isl_set_affine_hull(isl_set_copy(pw->p[i].set));
755
1.36k
  pw->p[i].
FIELD1.36k
=
FN1.36k
(EL,substitute_equalities)(pw->p[i].
FIELD1.36k
, aff);
756
1.36k
  if (
!pw->p[i].1.36k
FIELD1.36k
)
757
0
    return -1;
758
1.36k
759
1.36k
  return 0;
760
1.36k
}
isl_aff.c:isl_pw_aff_exploit_equalities_and_remove_if_empty
Line
Count
Source
738
30.9k
{
739
30.9k
  isl_basic_set *aff;
740
30.9k
  int empty = isl_set_plain_is_empty(pw->p[i].set);
741
30.9k
742
30.9k
  if (empty < 0)
743
0
    return -1;
744
30.9k
  
if (30.9k
empty30.9k
)
{20
745
20
    isl_set_free(pw->p[i].set);
746
20
    
FN20
(EL,free)(pw->p[i].
FIELD20
);
747
20
    if (i != pw->n - 1)
748
0
      pw->p[i] = pw->p[pw->n - 1];
749
20
    pw->n--;
750
20
751
20
    return 0;
752
20
  }
753
30.9k
754
30.9k
  aff = isl_set_affine_hull(isl_set_copy(pw->p[i].set));
755
30.9k
  pw->p[i].
FIELD30.9k
=
FN30.9k
(EL,substitute_equalities)(pw->p[i].
FIELD30.9k
, aff);
756
30.9k
  if (
!pw->p[i].30.9k
FIELD30.9k
)
757
0
    return -1;
758
30.9k
759
30.9k
  return 0;
760
30.9k
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_exploit_equalities_and_remove_if_empty
761
762
/* Convert a piecewise expression defined over a parameter domain
763
 * into one that is defined over a zero-dimensional set.
764
 */
765
__isl_give PW *FN(PW,from_range)(__isl_take PW *pw)
766
{
767
  isl_space *space;
768
769
  if (!pw)
770
    return NULL;
771
  if (!isl_space_is_set(pw->dim))
772
    isl_die(FN(PW,get_ctx)(pw), isl_error_invalid,
773
      "not living in a set space", return FN(PW,free)(pw));
774
775
  space = FN(PW,get_space)(pw);
776
  space = isl_space_from_range(space);
777
  pw = FN(PW,reset_space)(pw, space);
778
779
  return pw;
780
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_from_range
Unexecuted instantiation: isl_pw_aff_from_range
Unexecuted instantiation: isl_pw_qpolynomial_from_range
Unexecuted instantiation: isl_pw_multi_aff_from_range
781
782
/* Fix the value of the given parameter or domain dimension of "pw"
783
 * to be equal to "value".
784
 */
785
__isl_give PW *FN(PW,fix_si)(__isl_take PW *pw, enum isl_dim_type type,
786
  unsigned pos, int value)
787
{
788
  int i;
789
790
  if (!pw)
791
    return NULL;
792
793
  if (type == isl_dim_out)
794
    isl_die(FN(PW,get_ctx)(pw), isl_error_invalid,
795
      "cannot fix output dimension", return FN(PW,free)(pw));
796
797
  if (pw->n == 0)
798
    return pw;
799
800
  if (type == isl_dim_in)
801
    type = isl_dim_set;
802
803
  pw = FN(PW,cow)(pw);
804
  if (!pw)
805
    return FN(PW,free)(pw);
806
807
  for (i = pw->n - 1; i >= 0; --i) {
808
    pw->p[i].set = isl_set_fix_si(pw->p[i].set, type, pos, value);
809
    if (FN(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 0)
810
      return FN(PW,free)(pw);
811
  }
812
813
  return pw;
814
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_fix_si
Unexecuted instantiation: isl_pw_multi_aff_fix_si
Unexecuted instantiation: isl_pw_aff_fix_si
Unexecuted instantiation: isl_pw_qpolynomial_fix_si
815
816
/* Restrict the domain of "pw" by combining each cell
817
 * with "set" through a call to "fn", where "fn" may be
818
 * isl_set_intersect, isl_set_intersect_params or isl_set_subtract.
819
 */
820
static __isl_give PW *FN(PW,restrict_domain_aligned)(__isl_take PW *pw,
821
  __isl_take isl_set *set,
822
  __isl_give isl_set *(*fn)(__isl_take isl_set *set1,
823
            __isl_take isl_set *set2))
824
{
825
  int i;
826
827
  if (!pw || !set)
828
    goto error;
829
830
  if (pw->n == 0) {
831
    isl_set_free(set);
832
    return pw;
833
  }
834
835
  pw = FN(PW,cow)(pw);
836
  if (!pw)
837
    goto error;
838
839
  for (i = pw->n - 1; i >= 0; --i) {
840
    pw->p[i].set = fn(pw->p[i].set, isl_set_copy(set));
841
    if (FN(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 0)
842
      goto error;
843
  }
844
  
845
  isl_set_free(set);
846
  return pw;
847
error:
848
  isl_set_free(set);
849
  FN(PW,free)(pw);
850
  return NULL;
851
}
isl_polynomial.c:isl_pw_qpolynomial_restrict_domain_aligned
Line
Count
Source
824
35
{
825
35
  int i;
826
35
827
35
  if (
!pw || 35
!set35
)
828
0
    goto error;
829
35
830
35
  
if (35
pw->n == 035
)
{1
831
1
    isl_set_free(set);
832
1
    return pw;
833
1
  }
834
35
835
34
  
pw = 34
FN34
(PW,cow)(pw);
836
34
  if (!pw)
837
0
    goto error;
838
34
839
68
  
for (i = pw->n - 1; 34
i >= 068
;
--i34
)
{34
840
34
    pw->p[i].set = fn(pw->p[i].set, isl_set_copy(set));
841
34
    if (
FN34
(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 034
)
842
0
      goto error;
843
34
  }
844
34
  
845
34
  isl_set_free(set);
846
34
  return pw;
847
0
error:
848
0
  isl_set_free(set);
849
0
  FN(PW,free)(pw);
850
0
  return NULL;
851
34
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_restrict_domain_aligned
isl_aff.c:isl_pw_multi_aff_restrict_domain_aligned
Line
Count
Source
824
1.36k
{
825
1.36k
  int i;
826
1.36k
827
1.36k
  if (
!pw || 1.36k
!set1.36k
)
828
0
    goto error;
829
1.36k
830
1.36k
  
if (1.36k
pw->n == 01.36k
)
{0
831
0
    isl_set_free(set);
832
0
    return pw;
833
0
  }
834
1.36k
835
1.36k
  
pw = 1.36k
FN1.36k
(PW,cow)(pw);
836
1.36k
  if (!pw)
837
0
    goto error;
838
1.36k
839
2.72k
  
for (i = pw->n - 1; 1.36k
i >= 02.72k
;
--i1.36k
)
{1.36k
840
1.36k
    pw->p[i].set = fn(pw->p[i].set, isl_set_copy(set));
841
1.36k
    if (
FN1.36k
(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 01.36k
)
842
0
      goto error;
843
1.36k
  }
844
1.36k
  
845
1.36k
  isl_set_free(set);
846
1.36k
  return pw;
847
0
error:
848
0
  isl_set_free(set);
849
0
  FN(PW,free)(pw);
850
0
  return NULL;
851
1.36k
}
isl_aff.c:isl_pw_aff_restrict_domain_aligned
Line
Count
Source
824
29.8k
{
825
29.8k
  int i;
826
29.8k
827
29.8k
  if (
!pw || 29.8k
!set29.8k
)
828
0
    goto error;
829
29.8k
830
29.8k
  
if (29.8k
pw->n == 029.8k
)
{0
831
0
    isl_set_free(set);
832
0
    return pw;
833
0
  }
834
29.8k
835
29.8k
  
pw = 29.8k
FN29.8k
(PW,cow)(pw);
836
29.8k
  if (!pw)
837
0
    goto error;
838
29.8k
839
60.7k
  
for (i = pw->n - 1; 29.8k
i >= 060.7k
;
--i30.9k
)
{30.9k
840
30.9k
    pw->p[i].set = fn(pw->p[i].set, isl_set_copy(set));
841
30.9k
    if (
FN30.9k
(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 030.9k
)
842
0
      goto error;
843
30.9k
  }
844
29.8k
  
845
29.8k
  isl_set_free(set);
846
29.8k
  return pw;
847
0
error:
848
0
  isl_set_free(set);
849
0
  FN(PW,free)(pw);
850
0
  return NULL;
851
29.8k
}
852
853
static __isl_give PW *FN(PW,intersect_domain_aligned)(__isl_take PW *pw,
854
  __isl_take isl_set *set)
855
{
856
  return FN(PW,restrict_domain_aligned)(pw, set, &isl_set_intersect);
857
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_intersect_domain_aligned
isl_aff.c:isl_pw_multi_aff_intersect_domain_aligned
Line
Count
Source
855
1.35k
{
856
1.35k
  return FN(PW,restrict_domain_aligned)(pw, set, &isl_set_intersect);
857
1.35k
}
isl_aff.c:isl_pw_aff_intersect_domain_aligned
Line
Count
Source
855
29.8k
{
856
29.8k
  return FN(PW,restrict_domain_aligned)(pw, set, &isl_set_intersect);
857
29.8k
}
isl_polynomial.c:isl_pw_qpolynomial_intersect_domain_aligned
Line
Count
Source
855
35
{
856
35
  return FN(PW,restrict_domain_aligned)(pw, set, &isl_set_intersect);
857
35
}
858
859
__isl_give PW *FN(PW,intersect_domain)(__isl_take PW *pw,
860
  __isl_take isl_set *context)
861
{
862
  return FN(PW,align_params_pw_set_and)(pw, context,
863
          &FN(PW,intersect_domain_aligned));
864
}
isl_pw_multi_aff_intersect_domain
Line
Count
Source
861
1.35k
{
862
1.35k
  return FN(PW,align_params_pw_set_and)(pw, context,
863
1.35k
          &FN(PW,intersect_domain_aligned));
864
1.35k
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_intersect_domain
isl_pw_qpolynomial_intersect_domain
Line
Count
Source
861
35
{
862
35
  return FN(PW,align_params_pw_set_and)(pw, context,
863
35
          &FN(PW,intersect_domain_aligned));
864
35
}
isl_pw_aff_intersect_domain
Line
Count
Source
861
29.8k
{
862
29.8k
  return FN(PW,align_params_pw_set_and)(pw, context,
863
29.8k
          &FN(PW,intersect_domain_aligned));
864
29.8k
}
865
866
static __isl_give PW *FN(PW,intersect_params_aligned)(__isl_take PW *pw,
867
  __isl_take isl_set *set)
868
{
869
  return FN(PW,restrict_domain_aligned)(pw, set,
870
          &isl_set_intersect_params);
871
}
Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_intersect_params_aligned
Unexecuted instantiation: isl_aff.c:isl_pw_multi_aff_intersect_params_aligned
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_intersect_params_aligned
Unexecuted instantiation: isl_aff.c:isl_pw_aff_intersect_params_aligned
872
873
/* Intersect the domain of "pw" with the parameter domain "context".
874
 */
875
__isl_give PW *FN(PW,intersect_params)(__isl_take PW *pw,
876
  __isl_take isl_set *context)
877
{
878
  return FN(PW,align_params_pw_set_and)(pw, context,
879
          &FN(PW,intersect_params_aligned));
880
}
Unexecuted instantiation: isl_pw_qpolynomial_intersect_params
Unexecuted instantiation: isl_pw_qpolynomial_fold_intersect_params
Unexecuted instantiation: isl_pw_multi_aff_intersect_params
Unexecuted instantiation: isl_pw_aff_intersect_params
881
882
/* Subtract "domain' from the domain of "pw", assuming their
883
 * parameters have been aligned.
884
 */
885
static __isl_give PW *FN(PW,subtract_domain_aligned)(__isl_take PW *pw,
886
  __isl_take isl_set *domain)
887
{
888
  return FN(PW,restrict_domain_aligned)(pw, domain, &isl_set_subtract);
889
}
Unexecuted instantiation: isl_aff.c:isl_pw_aff_subtract_domain_aligned
Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_subtract_domain_aligned
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_subtract_domain_aligned
isl_aff.c:isl_pw_multi_aff_subtract_domain_aligned
Line
Count
Source
887
3
{
888
3
  return FN(PW,restrict_domain_aligned)(pw, domain, &isl_set_subtract);
889
3
}
890
891
/* Subtract "domain' from the domain of "pw".
892
 */
893
__isl_give PW *FN(PW,subtract_domain)(__isl_take PW *pw,
894
  __isl_take isl_set *domain)
895
{
896
  return FN(PW,align_params_pw_set_and)(pw, domain,
897
          &FN(PW,subtract_domain_aligned));
898
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_subtract_domain
isl_pw_multi_aff_subtract_domain
Line
Count
Source
895
3
{
896
3
  return FN(PW,align_params_pw_set_and)(pw, domain,
897
3
          &FN(PW,subtract_domain_aligned));
898
3
}
Unexecuted instantiation: isl_pw_qpolynomial_subtract_domain
Unexecuted instantiation: isl_pw_aff_subtract_domain
899
900
/* Compute the gist of "pw" with respect to the domain constraints
901
 * of "context" for the case where the domain of the last element
902
 * of "pw" is equal to "context".
903
 * Call "fn_el" to compute the gist of this element, replace
904
 * its domain by the universe and drop all other elements
905
 * as their domains are necessarily disjoint from "context".
906
 */
907
static __isl_give PW *FN(PW,gist_last)(__isl_take PW *pw,
908
  __isl_take isl_set *context,
909
  __isl_give EL *(*fn_el)(__isl_take EL *el, __isl_take isl_set *set))
910
{
911
  int i;
912
  isl_space *space;
913
914
  for (i = 0; i < pw->n - 1; ++i) {
915
    isl_set_free(pw->p[i].set);
916
    FN(EL,free)(pw->p[i].FIELD);
917
  }
918
  pw->p[0].FIELD = pw->p[pw->n - 1].FIELD;
919
  pw->p[0].set = pw->p[pw->n - 1].set;
920
  pw->n = 1;
921
922
  space = isl_set_get_space(context);
923
  pw->p[0].FIELD = fn_el(pw->p[0].FIELD, context);
924
  context = isl_set_universe(space);
925
  isl_set_free(pw->p[0].set);
926
  pw->p[0].set = context;
927
928
  if (!pw->p[0].FIELD || !pw->p[0].set)
929
    return FN(PW,free)(pw);
930
931
  return pw;
932
}
isl_aff.c:isl_pw_aff_gist_last
Line
Count
Source
910
4.00k
{
911
4.00k
  int i;
912
4.00k
  isl_space *space;
913
4.00k
914
4.00k
  for (i = 0; 
i < pw->n - 14.00k
;
++i0
)
{0
915
0
    isl_set_free(pw->p[i].set);
916
0
    
FN0
(EL,free)(pw->p[i].
FIELD0
);
917
0
  }
918
4.00k
  pw->p[0].
FIELD4.00k
= pw->p[pw->n - 1].
FIELD4.00k
;
919
4.00k
  pw->p[0].set = pw->p[pw->n - 1].set;
920
4.00k
  pw->n = 1;
921
4.00k
922
4.00k
  space = isl_set_get_space(context);
923
4.00k
  pw->p[0].
FIELD4.00k
= fn_el(pw->p[0].
FIELD4.00k
, context);
924
4.00k
  context = isl_set_universe(space);
925
4.00k
  isl_set_free(pw->p[0].set);
926
4.00k
  pw->p[0].set = context;
927
4.00k
928
4.00k
  if (
!pw->p[0].4.00k
FIELD4.00k
||
!pw->p[0].set4.00k
)
929
0
    
return 0
FN0
(PW,free)(pw);
930
4.00k
931
4.00k
  return pw;
932
4.00k
}
isl_aff.c:isl_pw_multi_aff_gist_last
Line
Count
Source
910
1.11k
{
911
1.11k
  int i;
912
1.11k
  isl_space *space;
913
1.11k
914
1.11k
  for (i = 0; 
i < pw->n - 11.11k
;
++i0
)
{0
915
0
    isl_set_free(pw->p[i].set);
916
0
    
FN0
(EL,free)(pw->p[i].
FIELD0
);
917
0
  }
918
1.11k
  pw->p[0].
FIELD1.11k
= pw->p[pw->n - 1].
FIELD1.11k
;
919
1.11k
  pw->p[0].set = pw->p[pw->n - 1].set;
920
1.11k
  pw->n = 1;
921
1.11k
922
1.11k
  space = isl_set_get_space(context);
923
1.11k
  pw->p[0].
FIELD1.11k
= fn_el(pw->p[0].
FIELD1.11k
, context);
924
1.11k
  context = isl_set_universe(space);
925
1.11k
  isl_set_free(pw->p[0].set);
926
1.11k
  pw->p[0].set = context;
927
1.11k
928
1.11k
  if (
!pw->p[0].1.11k
FIELD1.11k
||
!pw->p[0].set1.11k
)
929
0
    
return 0
FN0
(PW,free)(pw);
930
1.11k
931
1.11k
  return pw;
932
1.11k
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_gist_last
isl_polynomial.c:isl_pw_qpolynomial_gist_last
Line
Count
Source
910
1
{
911
1
  int i;
912
1
  isl_space *space;
913
1
914
1
  for (i = 0; 
i < pw->n - 11
;
++i0
)
{0
915
0
    isl_set_free(pw->p[i].set);
916
0
    
FN0
(EL,free)(pw->p[i].
FIELD0
);
917
0
  }
918
1
  pw->p[0].
FIELD1
= pw->p[pw->n - 1].
FIELD1
;
919
1
  pw->p[0].set = pw->p[pw->n - 1].set;
920
1
  pw->n = 1;
921
1
922
1
  space = isl_set_get_space(context);
923
1
  pw->p[0].
FIELD1
= fn_el(pw->p[0].
FIELD1
, context);
924
1
  context = isl_set_universe(space);
925
1
  isl_set_free(pw->p[0].set);
926
1
  pw->p[0].set = context;
927
1
928
1
  if (
!pw->p[0].1
FIELD1
||
!pw->p[0].set1
)
929
0
    
return 0
FN0
(PW,free)(pw);
930
1
931
1
  return pw;
932
1
}
933
934
/* Compute the gist of "pw" with respect to the domain constraints
935
 * of "context".  Call "fn_el" to compute the gist of the elements
936
 * and "fn_dom" to compute the gist of the domains.
937
 *
938
 * If the piecewise expression is empty or the context is the universe,
939
 * then nothing can be simplified.
940
 */
941
static __isl_give PW *FN(PW,gist_aligned)(__isl_take PW *pw,
942
  __isl_take isl_set *context,
943
  __isl_give EL *(*fn_el)(__isl_take EL *el,
944
            __isl_take isl_set *set),
945
  __isl_give isl_set *(*fn_dom)(__isl_take isl_set *set,
946
            __isl_take isl_basic_set *bset))
947
{
948
  int i;
949
  int is_universe;
950
  isl_bool aligned;
951
  isl_basic_set *hull = NULL;
952
953
  if (!pw || !context)
954
    goto error;
955
956
  if (pw->n == 0) {
957
    isl_set_free(context);
958
    return pw;
959
  }
960
961
  is_universe = isl_set_plain_is_universe(context);
962
  if (is_universe < 0)
963
    goto error;
964
  if (is_universe) {
965
    isl_set_free(context);
966
    return pw;
967
  }
968
969
  aligned = isl_set_space_has_equal_params(context, pw->dim);
970
  if (aligned < 0)
971
    goto error;
972
  if (!aligned) {
973
    pw = FN(PW,align_params)(pw, isl_set_get_space(context));
974
    context = isl_set_align_params(context, FN(PW,get_space)(pw));
975
  }
976
977
  pw = FN(PW,cow)(pw);
978
  if (!pw)
979
    goto error;
980
981
  if (pw->n == 1) {
982
    int equal;
983
984
    equal = isl_set_plain_is_equal(pw->p[0].set, context);
985
    if (equal < 0)
986
      goto error;
987
    if (equal)
988
      return FN(PW,gist_last)(pw, context, fn_el);
989
  }
990
991
  context = isl_set_compute_divs(context);
992
  hull = isl_set_simple_hull(isl_set_copy(context));
993
994
  for (i = pw->n - 1; i >= 0; --i) {
995
    isl_set *set_i;
996
    int empty;
997
998
    if (i == pw->n - 1) {
999
      int equal;
1000
      equal = isl_set_plain_is_equal(pw->p[i].set, context);
1001
      if (equal < 0)
1002
        goto error;
1003
      if (equal) {
1004
        isl_basic_set_free(hull);
1005
        return FN(PW,gist_last)(pw, context, fn_el);
1006
      }
1007
    }
1008
    set_i = isl_set_intersect(isl_set_copy(pw->p[i].set),
1009
             isl_set_copy(context));
1010
    empty = isl_set_plain_is_empty(set_i);
1011
    pw->p[i].FIELD = fn_el(pw->p[i].FIELD, set_i);
1012
    pw->p[i].set = fn_dom(pw->p[i].set, isl_basic_set_copy(hull));
1013
    if (empty < 0 || !pw->p[i].FIELD || !pw->p[i].set)
1014
      goto error;
1015
    if (empty) {
1016
      isl_set_free(pw->p[i].set);
1017
      FN(EL,free)(pw->p[i].FIELD);
1018
      if (i != pw->n - 1)
1019
        pw->p[i] = pw->p[pw->n - 1];
1020
      pw->n--;
1021
    }
1022
  }
1023
1024
  isl_basic_set_free(hull);
1025
  isl_set_free(context);
1026
1027
  return pw;
1028
error:
1029
  FN(PW,free)(pw);
1030
  isl_basic_set_free(hull);
1031
  isl_set_free(context);
1032
  return NULL;
1033
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_gist_aligned
isl_polynomial.c:isl_pw_qpolynomial_gist_aligned
Line
Count
Source
947
4
{
948
4
  int i;
949
4
  int is_universe;
950
4
  isl_bool aligned;
951
4
  isl_basic_set *hull = NULL;
952
4
953
4
  if (
!pw || 4
!context4
)
954
0
    goto error;
955
4
956
4
  
if (4
pw->n == 04
)
{0
957
0
    isl_set_free(context);
958
0
    return pw;
959
0
  }
960
4
961
4
  is_universe = isl_set_plain_is_universe(context);
962
4
  if (is_universe < 0)
963
0
    goto error;
964
4
  
if (4
is_universe4
)
{0
965
0
    isl_set_free(context);
966
0
    return pw;
967
0
  }
968
4
969
4
  aligned = isl_set_space_has_equal_params(context, pw->dim);
970
4
  if (aligned < 0)
971
0
    goto error;
972
4
  
if (4
!aligned4
)
{0
973
0
    pw = FN(PW,align_params)(pw, isl_set_get_space(context));
974
0
    context = isl_set_align_params(context, FN(PW,get_space)(pw));
975
0
  }
976
4
977
4
  pw = FN(PW,cow)(pw);
978
4
  if (!pw)
979
0
    goto error;
980
4
981
4
  
if (4
pw->n == 14
)
{4
982
4
    int equal;
983
4
984
4
    equal = isl_set_plain_is_equal(pw->p[0].set, context);
985
4
    if (equal < 0)
986
0
      goto error;
987
4
    
if (4
equal4
)
988
1
      
return 1
FN1
(PW,gist_last)(pw, context, fn_el);
989
4
  }
990
4
991
3
  context = isl_set_compute_divs(context);
992
3
  hull = isl_set_simple_hull(isl_set_copy(context));
993
3
994
6
  for (i = pw->n - 1; 
i >= 06
;
--i3
)
{3
995
3
    isl_set *set_i;
996
3
    int empty;
997
3
998
3
    if (
i == pw->n - 13
)
{3
999
3
      int equal;
1000
3
      equal = isl_set_plain_is_equal(pw->p[i].set, context);
1001
3
      if (equal < 0)
1002
0
        goto error;
1003
3
      
if (3
equal3
)
{0
1004
0
        isl_basic_set_free(hull);
1005
0
        return FN(PW,gist_last)(pw, context, fn_el);
1006
0
      }
1007
3
    }
1008
3
    set_i = isl_set_intersect(isl_set_copy(pw->p[i].set),
1009
3
             isl_set_copy(context));
1010
3
    empty = isl_set_plain_is_empty(set_i);
1011
3
    pw->p[i].
FIELD3
= fn_el(pw->p[i].
FIELD3
, set_i);
1012
3
    pw->p[i].set = fn_dom(pw->p[i].set, isl_basic_set_copy(hull));
1013
3
    if (
empty < 0 || 3
!pw->p[i].3
FIELD3
||
!pw->p[i].set3
)
1014
0
      goto error;
1015
3
    
if (3
empty3
)
{0
1016
0
      isl_set_free(pw->p[i].set);
1017
0
      
FN0
(EL,free)(pw->p[i].
FIELD0
);
1018
0
      if (i != pw->n - 1)
1019
0
        pw->p[i] = pw->p[pw->n - 1];
1020
0
      pw->n--;
1021
0
    }
1022
3
  }
1023
3
1024
3
  isl_basic_set_free(hull);
1025
3
  isl_set_free(context);
1026
3
1027
3
  return pw;
1028
0
error:
1029
0
  FN(PW,free)(pw);
1030
0
  isl_basic_set_free(hull);
1031
0
  isl_set_free(context);
1032
0
  return NULL;
1033
3
}
isl_aff.c:isl_pw_aff_gist_aligned
Line
Count
Source
947
6.63k
{
948
6.63k
  int i;
949
6.63k
  int is_universe;
950
6.63k
  isl_bool aligned;
951
6.63k
  isl_basic_set *hull = NULL;
952
6.63k
953
6.63k
  if (
!pw || 6.63k
!context6.63k
)
954
0
    goto error;
955
6.63k
956
6.63k
  
if (6.63k
pw->n == 06.63k
)
{0
957
0
    isl_set_free(context);
958
0
    return pw;
959
0
  }
960
6.63k
961
6.63k
  is_universe = isl_set_plain_is_universe(context);
962
6.63k
  if (is_universe < 0)
963
0
    goto error;
964
6.63k
  
if (6.63k
is_universe6.63k
)
{917
965
917
    isl_set_free(context);
966
917
    return pw;
967
917
  }
968
6.63k
969
5.72k
  aligned = isl_set_space_has_equal_params(context, pw->dim);
970
5.72k
  if (aligned < 0)
971
0
    goto error;
972
5.72k
  
if (5.72k
!aligned5.72k
)
{0
973
0
    pw = FN(PW,align_params)(pw, isl_set_get_space(context));
974
0
    context = isl_set_align_params(context, FN(PW,get_space)(pw));
975
0
  }
976
5.72k
977
5.72k
  pw = FN(PW,cow)(pw);
978
5.72k
  if (!pw)
979
0
    goto error;
980
5.72k
981
5.72k
  
if (5.72k
pw->n == 15.72k
)
{5.69k
982
5.69k
    int equal;
983
5.69k
984
5.69k
    equal = isl_set_plain_is_equal(pw->p[0].set, context);
985
5.69k
    if (equal < 0)
986
0
      goto error;
987
5.69k
    
if (5.69k
equal5.69k
)
988
4.00k
      
return 4.00k
FN4.00k
(PW,gist_last)(pw, context, fn_el);
989
5.69k
  }
990
5.72k
991
1.72k
  context = isl_set_compute_divs(context);
992
1.72k
  hull = isl_set_simple_hull(isl_set_copy(context));
993
1.72k
994
3.48k
  for (i = pw->n - 1; 
i >= 03.48k
;
--i1.76k
)
{1.76k
995
1.76k
    isl_set *set_i;
996
1.76k
    int empty;
997
1.76k
998
1.76k
    if (
i == pw->n - 11.76k
)
{1.72k
999
1.72k
      int equal;
1000
1.72k
      equal = isl_set_plain_is_equal(pw->p[i].set, context);
1001
1.72k
      if (equal < 0)
1002
0
        goto error;
1003
1.72k
      
if (1.72k
equal1.72k
)
{0
1004
0
        isl_basic_set_free(hull);
1005
0
        return FN(PW,gist_last)(pw, context, fn_el);
1006
0
      }
1007
1.72k
    }
1008
1.76k
    set_i = isl_set_intersect(isl_set_copy(pw->p[i].set),
1009
1.76k
             isl_set_copy(context));
1010
1.76k
    empty = isl_set_plain_is_empty(set_i);
1011
1.76k
    pw->p[i].
FIELD1.76k
= fn_el(pw->p[i].
FIELD1.76k
, set_i);
1012
1.76k
    pw->p[i].set = fn_dom(pw->p[i].set, isl_basic_set_copy(hull));
1013
1.76k
    if (
empty < 0 || 1.76k
!pw->p[i].1.76k
FIELD1.76k
||
!pw->p[i].set1.76k
)
1014
0
      goto error;
1015
1.76k
    
if (1.76k
empty1.76k
)
{0
1016
0
      isl_set_free(pw->p[i].set);
1017
0
      
FN0
(EL,free)(pw->p[i].
FIELD0
);
1018
0
      if (i != pw->n - 1)
1019
0
        pw->p[i] = pw->p[pw->n - 1];
1020
0
      pw->n--;
1021
0
    }
1022
1.76k
  }
1023
1.72k
1024
1.72k
  isl_basic_set_free(hull);
1025
1.72k
  isl_set_free(context);
1026
1.72k
1027
1.72k
  return pw;
1028
0
error:
1029
0
  FN(PW,free)(pw);
1030
0
  isl_basic_set_free(hull);
1031
0
  isl_set_free(context);
1032
0
  return NULL;
1033
1.72k
}
isl_aff.c:isl_pw_multi_aff_gist_aligned
Line
Count
Source
947
1.26k
{
948
1.26k
  int i;
949
1.26k
  int is_universe;
950
1.26k
  isl_bool aligned;
951
1.26k
  isl_basic_set *hull = NULL;
952
1.26k
953
1.26k
  if (
!pw || 1.26k
!context1.26k
)
954
0
    goto error;
955
1.26k
956
1.26k
  
if (1.26k
pw->n == 01.26k
)
{0
957
0
    isl_set_free(context);
958
0
    return pw;
959
0
  }
960
1.26k
961
1.26k
  is_universe = isl_set_plain_is_universe(context);
962
1.26k
  if (is_universe < 0)
963
0
    goto error;
964
1.26k
  
if (1.26k
is_universe1.26k
)
{68
965
68
    isl_set_free(context);
966
68
    return pw;
967
68
  }
968
1.26k
969
1.19k
  aligned = isl_set_space_has_equal_params(context, pw->dim);
970
1.19k
  if (aligned < 0)
971
0
    goto error;
972
1.19k
  
if (1.19k
!aligned1.19k
)
{0
973
0
    pw = FN(PW,align_params)(pw, isl_set_get_space(context));
974
0
    context = isl_set_align_params(context, FN(PW,get_space)(pw));
975
0
  }
976
1.19k
977
1.19k
  pw = FN(PW,cow)(pw);
978
1.19k
  if (!pw)
979
0
    goto error;
980
1.19k
981
1.19k
  
if (1.19k
pw->n == 11.19k
)
{1.19k
982
1.19k
    int equal;
983
1.19k
984
1.19k
    equal = isl_set_plain_is_equal(pw->p[0].set, context);
985
1.19k
    if (equal < 0)
986
0
      goto error;
987
1.19k
    
if (1.19k
equal1.19k
)
988
1.11k
      
return 1.11k
FN1.11k
(PW,gist_last)(pw, context, fn_el);
989
1.19k
  }
990
1.19k
991
87
  context = isl_set_compute_divs(context);
992
87
  hull = isl_set_simple_hull(isl_set_copy(context));
993
87
994
174
  for (i = pw->n - 1; 
i >= 0174
;
--i87
)
{87
995
87
    isl_set *set_i;
996
87
    int empty;
997
87
998
87
    if (
i == pw->n - 187
)
{87
999
87
      int equal;
1000
87
      equal = isl_set_plain_is_equal(pw->p[i].set, context);
1001
87
      if (equal < 0)
1002
0
        goto error;
1003
87
      
if (87
equal87
)
{0
1004
0
        isl_basic_set_free(hull);
1005
0
        return FN(PW,gist_last)(pw, context, fn_el);
1006
0
      }
1007
87
    }
1008
87
    set_i = isl_set_intersect(isl_set_copy(pw->p[i].set),
1009
87
             isl_set_copy(context));
1010
87
    empty = isl_set_plain_is_empty(set_i);
1011
87
    pw->p[i].
FIELD87
= fn_el(pw->p[i].
FIELD87
, set_i);
1012
87
    pw->p[i].set = fn_dom(pw->p[i].set, isl_basic_set_copy(hull));
1013
87
    if (
empty < 0 || 87
!pw->p[i].87
FIELD87
||
!pw->p[i].set87
)
1014
0
      goto error;
1015
87
    
if (87
empty87
)
{0
1016
0
      isl_set_free(pw->p[i].set);
1017
0
      
FN0
(EL,free)(pw->p[i].
FIELD0
);
1018
0
      if (i != pw->n - 1)
1019
0
        pw->p[i] = pw->p[pw->n - 1];
1020
0
      pw->n--;
1021
0
    }
1022
87
  }
1023
87
1024
87
  isl_basic_set_free(hull);
1025
87
  isl_set_free(context);
1026
87
1027
87
  return pw;
1028
0
error:
1029
0
  FN(PW,free)(pw);
1030
0
  isl_basic_set_free(hull);
1031
0
  isl_set_free(context);
1032
0
  return NULL;
1033
87
}
1034
1035
static __isl_give PW *FN(PW,gist_domain_aligned)(__isl_take PW *pw,
1036
  __isl_take isl_set *set)
1037
{
1038
  return FN(PW,gist_aligned)(pw, set, &FN(EL,gist),
1039
          &isl_set_gist_basic_set);
1040
}
isl_polynomial.c:isl_pw_qpolynomial_gist_domain_aligned
Line
Count
Source
1037
4
{
1038
4
  return 
FN4
(PW,gist_aligned)(pw, set, &
FN4
(EL,gist),
1039
4
          &isl_set_gist_basic_set);
1040
4
}
isl_aff.c:isl_pw_multi_aff_gist_domain_aligned
Line
Count
Source
1037
1.26k
{
1038
1.26k
  return 
FN1.26k
(PW,gist_aligned)(pw, set, &
FN1.26k
(EL,gist),
1039
1.26k
          &isl_set_gist_basic_set);
1040
1.26k
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_gist_domain_aligned
isl_aff.c:isl_pw_aff_gist_domain_aligned
Line
Count
Source
1037
6.63k
{
1038
6.63k
  return 
FN6.63k
(PW,gist_aligned)(pw, set, &
FN6.63k
(EL,gist),
1039
6.63k
          &isl_set_gist_basic_set);
1040
6.63k
}
1041
1042
__isl_give PW *FN(PW,gist)(__isl_take PW *pw, __isl_take isl_set *context)
1043
{
1044
  return FN(PW,align_params_pw_set_and)(pw, context,
1045
            &FN(PW,gist_domain_aligned));
1046
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_gist
isl_pw_qpolynomial_gist
Line
Count
Source
1043
4
{
1044
4
  return FN(PW,align_params_pw_set_and)(pw, context,
1045
4
            &FN(PW,gist_domain_aligned));
1046
4
}
isl_pw_multi_aff_gist
Line
Count
Source
1043
1.26k
{
1044
1.26k
  return FN(PW,align_params_pw_set_and)(pw, context,
1045
1.26k
            &FN(PW,gist_domain_aligned));
1046
1.26k
}
isl_pw_aff_gist
Line
Count
Source
1043
6.63k
{
1044
6.63k
  return FN(PW,align_params_pw_set_and)(pw, context,
1045
6.63k
            &FN(PW,gist_domain_aligned));
1046
6.63k
}
1047
1048
static __isl_give PW *FN(PW,gist_params_aligned)(__isl_take PW *pw,
1049
  __isl_take isl_set *set)
1050
{
1051
  return FN(PW,gist_aligned)(pw, set, &FN(EL,gist_params),
1052
          &isl_set_gist_params_basic_set);
1053
}
Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_gist_params_aligned
Unexecuted instantiation: isl_aff.c:isl_pw_multi_aff_gist_params_aligned
Unexecuted instantiation: isl_aff.c:isl_pw_aff_gist_params_aligned
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_gist_params_aligned
1054
1055
__isl_give PW *FN(PW,gist_params)(__isl_take PW *pw,
1056
  __isl_take isl_set *context)
1057
{
1058
  return FN(PW,align_params_pw_set_and)(pw, context,
1059
            &FN(PW,gist_params_aligned));
1060
}
Unexecuted instantiation: isl_pw_aff_gist_params
Unexecuted instantiation: isl_pw_qpolynomial_gist_params
Unexecuted instantiation: isl_pw_qpolynomial_fold_gist_params
Unexecuted instantiation: isl_pw_multi_aff_gist_params
1061
1062
/* Return -1 if the piece "p1" should be sorted before "p2"
1063
 * and 1 if it should be sorted after "p2".
1064
 * Return 0 if they do not need to be sorted in a specific order.
1065
 *
1066
 * The two pieces are compared on the basis of their function value expressions.
1067
 */
1068
static int FN(PW,sort_field_cmp)(const void *p1, const void *p2, void *arg)
1069
{
1070
  struct FN(PW,piece) const *pc1 = p1;
1071
  struct FN(PW,piece) const *pc2 = p2;
1072
1073
  return FN(EL,plain_cmp)(pc1->FIELD, pc2->FIELD);
1074
}
isl_polynomial.c:isl_pw_qpolynomial_sort_field_cmp
Line
Count
Source
1069
1
{
1070
1
  struct FN(PW,piece) const *pc1 = p1;
1071
1
  struct FN(PW,piece) const *pc2 = p2;
1072
1
1073
1
  return 
FN1
(EL,plain_cmp)(pc1->
FIELD1
, pc2->
FIELD1
);
1074
1
}
isl_aff.c:isl_pw_aff_sort_field_cmp
Line
Count
Source
1069
463
{
1070
463
  struct FN(PW,piece) const *pc1 = p1;
1071
463
  struct FN(PW,piece) const *pc2 = p2;
1072
463
1073
463
  return 
FN463
(EL,plain_cmp)(pc1->
FIELD463
, pc2->
FIELD463
);
1074
463
}
Unexecuted instantiation: isl_fold.c:isl_pw_qpolynomial_fold_sort_field_cmp
isl_aff.c:isl_pw_multi_aff_sort_field_cmp
Line
Count
Source
1069
1.14k
{
1070
1.14k
  struct FN(PW,piece) const *pc1 = p1;
1071
1.14k
  struct FN(PW,piece) const *pc2 = p2;
1072
1.14k
1073
1.14k
  return 
FN1.14k
(EL,plain_cmp)(pc1->
FIELD1.14k
, pc2->
FIELD1.14k
);
1074
1.14k
}
1075
1076
/* Sort the pieces of "pw" according to their function value
1077
 * expressions and then combine pairs of adjacent pieces with
1078
 * the same such expression.
1079
 *
1080
 * The sorting is performed in place because it does not
1081
 * change the meaning of "pw", but care needs to be
1082
 * taken not to change any possible other copies of "pw"
1083
 * in case anything goes wrong.
1084
 */
1085
__isl_give PW *FN(PW,sort)(__isl_take PW *pw)
1086
{
1087
  int i, j;
1088
  isl_set *set;
1089
1090
  if (!pw)
1091
    return NULL;
1092
  if (pw->n <= 1)
1093
    return pw;
1094
  if (isl_sort(pw->p, pw->n, sizeof(pw->p[0]),
1095
        &FN(PW,sort_field_cmp), NULL) < 0)
1096
    return FN(PW,free)(pw);
1097
  for (i = pw->n - 1; i >= 1; --i) {
1098
    if (!FN(EL,plain_is_equal)(pw->p[i - 1].FIELD, pw->p[i].FIELD))
1099
      continue;
1100
    set = isl_set_union(isl_set_copy(pw->p[i - 1].set),
1101
            isl_set_copy(pw->p[i].set));
1102
    if (!set)
1103
      return FN(PW,free)(pw);
1104
    isl_set_free(pw->p[i].set);
1105
    FN(EL,free)(pw->p[i].FIELD);
1106
    isl_set_free(pw->p[i - 1].set);
1107
    pw->p[i - 1].set = set;
1108
    for (j = i + 1; j < pw->n; ++j)
1109
      pw->p[j - 1] = pw->p[j];
1110
    pw->n--;
1111
  }
1112
1113
  return pw;
1114
}
isl_pw_multi_aff_sort
Line
Count
Source
1086
2.37k
{
1087
2.37k
  int i, j;
1088
2.37k
  isl_set *set;
1089
2.37k
1090
2.37k
  if (!pw)
1091
0
    return NULL;
1092
2.37k
  
if (2.37k
pw->n <= 12.37k
)
1093
2.07k
    return pw;
1094
306
  
if (306
isl_sort(pw->p, pw->n, sizeof(pw->p[0]),306
1095
306
        &FN(PW,sort_field_cmp), NULL) < 0)
1096
0
    
return 0
FN0
(PW,free)(pw);
1097
1.00k
  
for (i = pw->n - 1; 306
i >= 11.00k
;
--i701
)
{701
1098
701
    if (
!701
FN701
(EL,plain_is_equal)(pw->p[i - 1].
FIELD701
, pw->p[i].
FIELD701
))
1099
653
      continue;
1100
48
    set = isl_set_union(isl_set_copy(pw->p[i - 1].set),
1101
48
            isl_set_copy(pw->p[i].set));
1102
48
    if (!set)
1103
0
      
return 0
FN0
(PW,free)(pw);
1104
48
    isl_set_free(pw->p[i].set);
1105
48
    
FN48
(EL,free)(pw->p[i].
FIELD48
);
1106
48
    isl_set_free(pw->p[i - 1].set);
1107
48
    pw->p[i - 1].set = set;
1108
49
    for (j = i + 1; 
j < pw->n49
;
++j1
)
1109
1
      pw->p[j - 1] = pw->p[j];
1110
48
    pw->n--;
1111
48
  }
1112
306
1113
306
  return pw;
1114
306
}
isl_pw_qpolynomial_sort
Line
Count
Source
1086
7
{
1087
7
  int i, j;
1088
7
  isl_set *set;
1089
7
1090
7
  if (!pw)
1091
0
    return NULL;
1092
7
  
if (7
pw->n <= 17
)
1093
6
    return pw;
1094
1
  
if (1
isl_sort(pw->p, pw->n, sizeof(pw->p[0]),1
1095
1
        &FN(PW,sort_field_cmp), NULL) < 0)
1096
0
    
return 0
FN0
(PW,free)(pw);
1097
2
  
for (i = pw->n - 1; 1
i >= 12
;
--i1
)
{1
1098
1
    if (
!1
FN1
(EL,plain_is_equal)(pw->p[i - 1].
FIELD1
, pw->p[i].
FIELD1
))
1099
1
      continue;
1100
0
    set = isl_set_union(isl_set_copy(pw->p[i - 1].set),
1101
0
            isl_set_copy(pw->p[i].set));
1102
0
    if (!set)
1103
0
      
return 0
FN0
(PW,free)(pw);
1104
0
    isl_set_free(pw->p[i].set);
1105
0
    
FN0
(EL,free)(pw->p[i].
FIELD0
);
1106
0
    isl_set_free(pw->p[i - 1].set);
1107
0
    pw->p[i - 1].set = set;
1108
0
    for (j = i + 1; 
j < pw->n0
;
++j0
)
1109
0
      pw->p[j - 1] = pw->p[j];
1110
0
    pw->n--;
1111
0
  }
1112
1
1113
1
  return pw;
1114
1
}
isl_pw_aff_sort
Line
Count
Source
1086
16.5k
{
1087
16.5k
  int i, j;
1088
16.5k
  isl_set *set;
1089
16.5k
1090
16.5k
  if (!pw)
1091
1
    return NULL;
1092
16.5k
  
if (16.5k
pw->n <= 116.5k
)
1093
16.2k
    return pw;
1094
217
  
if (217
isl_sort(pw->p, pw->n, sizeof(pw->p[0]),217
1095
217
        &FN(PW,sort_field_cmp), NULL) < 0)
1096
0
    
return 0
FN0
(PW,free)(pw);
1097
555
  
for (i = pw->n - 1; 217
i >= 1555
;
--i338
)
{338
1098
338
    if (
!338
FN338
(EL,plain_is_equal)(pw->p[i - 1].
FIELD338
, pw->p[i].
FIELD338
))
1099
331
      continue;
1100
7
    set = isl_set_union(isl_set_copy(pw->p[i - 1].set),
1101
7
            isl_set_copy(pw->p[i].set));
1102
7
    if (!set)
1103
0
      
return 0
FN0
(PW,free)(pw);
1104
7
    isl_set_free(pw->p[i].set);
1105
7
    
FN7
(EL,free)(pw->p[i].
FIELD7
);
1106
7
    isl_set_free(pw->p[i - 1].set);
1107
7
    pw->p[i - 1].set = set;
1108
19
    for (j = i + 1; 
j < pw->n19
;
++j12
)
1109
12
      pw->p[j - 1] = pw->p[j];
1110
7
    pw->n--;
1111
7
  }
1112
217
1113
217
  return pw;
1114
217
}
isl_pw_qpolynomial_fold_sort
Line
Count
Source
1086
2
{
1087
2
  int i, j;
1088
2
  isl_set *set;
1089
2
1090
2
  if (!pw)
1091
0
    return NULL;
1092
2
  
if (2
pw->n <= 12
)
1093
2
    return pw;
1094
0
  
if (0
isl_sort(pw->p, pw->n, sizeof(pw->p[0]),0
1095
0
        &FN(PW,sort_field_cmp), NULL) < 0)
1096
0
    
return 0
FN0
(PW,free)(pw);
1097
0
  
for (i = pw->n - 1; 0
i >= 10
;
--i0
)
{0
1098
0
    if (
!0
FN0
(EL,plain_is_equal)(pw->p[i - 1].
FIELD0
, pw->p[i].
FIELD0
))
1099
0
      continue;
1100
0
    set = isl_set_union(isl_set_copy(pw->p[i - 1].set),
1101
0
            isl_set_copy(pw->p[i].set));
1102
0
    if (!set)
1103
0
      
return 0
FN0
(PW,free)(pw);
1104
0
    isl_set_free(pw->p[i].set);
1105
0
    
FN0
(EL,free)(pw->p[i].
FIELD0
);
1106
0
    isl_set_free(pw->p[i - 1].set);
1107
0
    pw->p[i - 1].set = set;
1108
0
    for (j = i + 1; 
j < pw->n0
;
++j0
)
1109
0
      pw->p[j - 1] = pw->p[j];
1110
0
    pw->n--;
1111
0
  }
1112
0
1113
0
  return pw;
1114
0
}
1115
1116
/* Coalesce the domains of "pw".
1117
 *
1118
 * Prior to the actual coalescing, first sort the pieces such that
1119
 * pieces with the same function value expression are combined
1120
 * into a single piece, the combined domain of which can then
1121
 * be coalesced.
1122
 */
1123
__isl_give PW *FN(PW,coalesce)(__isl_take PW *pw)
1124
{
1125
  int i;
1126
1127
  pw = FN(PW,sort)(pw);
1128
  if (!pw)
1129
    return NULL;
1130
1131
  for (i = 0; i < pw->n; ++i) {
1132
    pw->p[i].set = isl_set_coalesce(pw->p[i].set);
1133
    if (!pw->p[i].set)
1134
      goto error;
1135
  }
1136
1137
  return pw;
1138
error:
1139
  FN(PW,free)(pw);
1140
  return NULL;
1141
}
isl_pw_aff_coalesce
Line
Count
Source
1124
16.1k
{
1125
16.1k
  int i;
1126
16.1k
1127
16.1k
  pw = FN(PW,sort)(pw);
1128
16.1k
  if (!pw)
1129
1
    return NULL;
1130
16.1k
1131
32.6k
  
for (i = 0; 16.1k
i < pw->n32.6k
;
++i16.4k
)
{16.4k
1132
16.4k
    pw->p[i].set = isl_set_coalesce(pw->p[i].set);
1133
16.4k
    if (!pw->p[i].set)
1134
0
      goto error;
1135
16.4k
  }
1136
16.1k
1137
16.1k
  return pw;
1138
0
error:
1139
0
  FN(PW,free)(pw);
1140
0
  return NULL;
1141
16.1k
}
isl_pw_multi_aff_coalesce
Line
Count
Source
1124
796
{
1125
796
  int i;
1126
796
1127
796
  pw = FN(PW,sort)(pw);
1128
796
  if (!pw)
1129
0
    return NULL;
1130
796
1131
1.66k
  
for (i = 0; 796
i < pw->n1.66k
;
++i872
)
{872
1132
872
    pw->p[i].set = isl_set_coalesce(pw->p[i].set);
1133
872
    if (!pw->p[i].set)
1134
0
      goto error;
1135
872
  }
1136
796
1137
796
  return pw;
1138
0
error:
1139
0
  FN(PW,free)(pw);
1140
0
  return NULL;
1141
796
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_coalesce
isl_pw_qpolynomial_coalesce
Line
Count
Source
1124
1
{
1125
1
  int i;
1126
1
1127
1
  pw = FN(PW,sort)(pw);
1128
1
  if (!pw)
1129
0
    return NULL;
1130
1
1131
3
  
for (i = 0; 1
i < pw->n3
;
++i2
)
{2
1132
2
    pw->p[i].set = isl_set_coalesce(pw->p[i].set);
1133
2
    if (!pw->p[i].set)
1134
0
      goto error;
1135
2
  }
1136
1
1137
1
  return pw;
1138
0
error:
1139
0
  FN(PW,free)(pw);
1140
0
  return NULL;
1141
1
}
1142
1143
isl_ctx *FN(PW,get_ctx)(__isl_keep PW *pw)
1144
{
1145
  return pw ? isl_space_get_ctx(pw->dim) : NULL;
1146
}
isl_pw_multi_aff_get_ctx
Line
Count
Source
1144
1.61k
{
1145
1.61k
  return pw ? isl_space_get_ctx(pw->dim) : NULL;
1146
1.61k
}
isl_pw_qpolynomial_get_ctx
Line
Count
Source
1144
1
{
1145
1
  return pw ? isl_space_get_ctx(pw->dim) : NULL;
1146
1
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_get_ctx
isl_pw_aff_get_ctx
Line
Count
Source
1144
18.5k
{
1145
18.5k
  return pw ? isl_space_get_ctx(pw->dim) : NULL;
1146
18.5k
}
1147
1148
#ifndef NO_INVOLVES_DIMS
1149
isl_bool FN(PW,involves_dims)(__isl_keep PW *pw, enum isl_dim_type type,
1150
  unsigned first, unsigned n)
1151
{
1152
  int i;
1153
  enum isl_dim_type set_type;
1154
1155
  if (!pw)
1156
    return isl_bool_error;
1157
  if (pw->n == 0 || n == 0)
1158
    return isl_bool_false;
1159
1160
  set_type = type == isl_dim_in ? isl_dim_set : type;
1161
1162
  for (i = 0; i < pw->n; ++i) {
1163
    isl_bool involves = FN(EL,involves_dims)(pw->p[i].FIELD,
1164
              type, first, n);
1165
    if (involves < 0 || involves)
1166
      return involves;
1167
    involves = isl_set_involves_dims(pw->p[i].set,
1168
              set_type, first, n);
1169
    if (involves < 0 || involves)
1170
      return involves;
1171
  }
1172
  return isl_bool_false;
1173
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_involves_dims
Unexecuted instantiation: isl_pw_qpolynomial_involves_dims
isl_pw_aff_involves_dims
Line
Count
Source
1151
91
{
1152
91
  int i;
1153
91
  enum isl_dim_type set_type;
1154
91
1155
91
  if (!pw)
1156
0
    return isl_bool_error;
1157
91
  
if (91
pw->n == 0 || 91
n == 091
)
1158
0
    return isl_bool_false;
1159
91
1160
91
  
set_type = type == isl_dim_in ? 91
isl_dim_set91
:
type0
;
1161
91
1162
182
  for (i = 0; 
i < pw->n182
;
++i91
)
{91
1163
91
    isl_bool involves = 
FN91
(EL,involves_dims)(pw->p[i].
FIELD91
,
1164
91
              type, first, n);
1165
91
    if (
involves < 0 || 91
involves91
)
1166
0
      return involves;
1167
91
    involves = isl_set_involves_dims(pw->p[i].set,
1168
91
              set_type, first, n);
1169
91
    if (
involves < 0 || 91
involves91
)
1170
0
      return involves;
1171
91
  }
1172
91
  return isl_bool_false;
1173
91
}
1174
#endif
1175
1176
__isl_give PW *FN(PW,set_dim_name)(__isl_take PW *pw,
1177
  enum isl_dim_type type, unsigned pos, const char *s)
1178
{
1179
  int i;
1180
  enum isl_dim_type set_type;
1181
1182
  pw = FN(PW,cow)(pw);
1183
  if (!pw)
1184
    return NULL;
1185
1186
  set_type = type == isl_dim_in ? isl_dim_set : type;
1187
1188
  pw->dim = isl_space_set_dim_name(pw->dim, type, pos, s);
1189
  if (!pw->dim)
1190
    goto error;
1191
1192
  for (i = 0; i < pw->n; ++i) {
1193
    pw->p[i].set = isl_set_set_dim_name(pw->p[i].set,
1194
              set_type, pos, s);
1195
    if (!pw->p[i].set)
1196
      goto error;
1197
    pw->p[i].FIELD = FN(EL,set_dim_name)(pw->p[i].FIELD, type, pos, s);
1198
    if (!pw->p[i].FIELD)
1199
      goto error;
1200
  }
1201
1202
  return pw;
1203
error:
1204
  FN(PW,free)(pw);
1205
  return NULL;
1206
}
Unexecuted instantiation: isl_pw_multi_aff_set_dim_name
Unexecuted instantiation: isl_pw_aff_set_dim_name
Unexecuted instantiation: isl_pw_qpolynomial_set_dim_name
Unexecuted instantiation: isl_pw_qpolynomial_fold_set_dim_name
1207
1208
#ifndef NO_DROP_DIMS
1209
__isl_give PW *FN(PW,drop_dims)(__isl_take PW *pw,
1210
  enum isl_dim_type type, unsigned first, unsigned n)
1211
{
1212
  int i;
1213
  enum isl_dim_type set_type;
1214
1215
  if (!pw)
1216
    return NULL;
1217
  if (n == 0 && !isl_space_get_tuple_name(pw->dim, type))
1218
    return pw;
1219
1220
  set_type = type == isl_dim_in ? isl_dim_set : type;
1221
1222
  pw = FN(PW,cow)(pw);
1223
  if (!pw)
1224
    return NULL;
1225
  pw->dim = isl_space_drop_dims(pw->dim, type, first, n);
1226
  if (!pw->dim)
1227
    goto error;
1228
  for (i = 0; i < pw->n; ++i) {
1229
    pw->p[i].FIELD = FN(EL,drop_dims)(pw->p[i].FIELD, type, first, n);
1230
    if (!pw->p[i].FIELD)
1231
      goto error;
1232
    if (type == isl_dim_out)
1233
      continue;
1234
    pw->p[i].set = isl_set_drop(pw->p[i].set, set_type, first, n);
1235
    if (!pw->p[i].set)
1236
      goto error;
1237
  }
1238
1239
  return pw;
1240
error:
1241
  FN(PW,free)(pw);
1242
  return NULL;
1243
}
Unexecuted instantiation: isl_pw_qpolynomial_drop_dims
isl_pw_multi_aff_drop_dims
Line
Count
Source
1211
441
{
1212
441
  int i;
1213
441
  enum isl_dim_type set_type;
1214
441
1215
441
  if (!pw)
1216
0
    return NULL;
1217
441
  
if (441
n == 0 && 441
!isl_space_get_tuple_name(pw->dim, type)0
)
1218
0
    return pw;
1219
441
1220
441
  
set_type = type == isl_dim_in ? 441
isl_dim_set0
:
type441
;
1221
441
1222
441
  pw = FN(PW,cow)(pw);
1223
441
  if (!pw)
1224
0
    return NULL;
1225
441
  pw->dim = isl_space_drop_dims(pw->dim, type, first, n);
1226
441
  if (!pw->dim)
1227
0
    goto error;
1228
882
  
for (i = 0; 441
i < pw->n882
;
++i441
)
{441
1229
441
    pw->p[i].
FIELD441
=
FN441
(EL,drop_dims)(pw->p[i].
FIELD441
, type, first, n);
1230
441
    if (
!pw->p[i].441
FIELD441
)
1231
0
      goto error;
1232
441
    
if (441
type == isl_dim_out441
)
1233
441
      continue;
1234
0
    pw->p[i].set = isl_set_drop(pw->p[i].set, set_type, first, n);
1235
0
    if (!pw->p[i].set)
1236
0
      goto error;
1237
0
  }
1238
441
1239
441
  return pw;
1240
0
error:
1241
0
  FN(PW,free)(pw);
1242
0
  return NULL;
1243
441
}
isl_pw_aff_drop_dims
Line
Count
Source
1211
91
{
1212
91
  int i;
1213
91
  enum isl_dim_type set_type;
1214
91
1215
91
  if (!pw)
1216
0
    return NULL;
1217
91
  
if (91
n == 0 && 91
!isl_space_get_tuple_name(pw->dim, type)0
)
1218
0
    return pw;
1219
91
1220
91
  
set_type = type == isl_dim_in ? 91
isl_dim_set91
:
type0
;
1221
91
1222
91
  pw = FN(PW,cow)(pw);
1223
91
  if (!pw)
1224
0
    return NULL;
1225
91
  pw->dim = isl_space_drop_dims(pw->dim, type, first, n);
1226
91
  if (!pw->dim)
1227
0
    goto error;
1228
182
  
for (i = 0; 91
i < pw->n182
;
++i91
)
{91
1229
91
    pw->p[i].
FIELD91
=
FN91
(EL,drop_dims)(pw->p[i].
FIELD91
, type, first, n);
1230
91
    if (
!pw->p[i].91
FIELD91
)
1231
0
      goto error;
1232
91
    
if (91
type == isl_dim_out91
)
1233
0
      continue;
1234
91
    pw->p[i].set = isl_set_drop(pw->p[i].set, set_type, first, n);
1235
91
    if (!pw->p[i].set)
1236
0
      goto error;
1237
91
  }
1238
91
1239
91
  return pw;
1240
0
error:
1241
0
  FN(PW,free)(pw);
1242
0
  return NULL;
1243
91
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_drop_dims
1244
1245
/* This function is very similar to drop_dims.
1246
 * The only difference is that the cells may still involve
1247
 * the specified dimensions.  They are removed using
1248
 * isl_set_project_out instead of isl_set_drop.
1249
 */
1250
__isl_give PW *FN(PW,project_out)(__isl_take PW *pw,
1251
  enum isl_dim_type type, unsigned first, unsigned n)
1252
{
1253
  int i;
1254
  enum isl_dim_type set_type;
1255
1256
  if (!pw)
1257
    return NULL;
1258
  if (n == 0 && !isl_space_get_tuple_name(pw->dim, type))
1259
    return pw;
1260
1261
  set_type = type == isl_dim_in ? isl_dim_set : type;
1262
1263
  pw = FN(PW,cow)(pw);
1264
  if (!pw)
1265
    return NULL;
1266
  pw->dim = isl_space_drop_dims(pw->dim, type, first, n);
1267
  if (!pw->dim)
1268
    goto error;
1269
  for (i = 0; i < pw->n; ++i) {
1270
    pw->p[i].set = isl_set_project_out(pw->p[i].set,
1271
              set_type, first, n);
1272
    if (!pw->p[i].set)
1273
      goto error;
1274
    pw->p[i].FIELD = FN(EL,drop_dims)(pw->p[i].FIELD, type, first, n);
1275
    if (!pw->p[i].FIELD)
1276
      goto error;
1277
  }
1278
1279
  return pw;
1280
error:
1281
  FN(PW,free)(pw);
1282
  return NULL;
1283
}
isl_pw_qpolynomial_fold_project_out
Line
Count
Source
1252
1
{
1253
1
  int i;
1254
1
  enum isl_dim_type set_type;
1255
1
1256
1
  if (!pw)
1257
0
    return NULL;
1258
1
  
if (1
n == 0 && 1
!isl_space_get_tuple_name(pw->dim, type)1
)
1259
1
    return pw;
1260
1
1261
0
  
set_type = type == isl_dim_in ? 0
isl_dim_set0
:
type0
;
1262
0
1263
0
  pw = FN(PW,cow)(pw);
1264
0
  if (!pw)
1265
0
    return NULL;
1266
0
  pw->dim = isl_space_drop_dims(pw->dim, type, first, n);
1267
0
  if (!pw->dim)
1268
0
    goto error;
1269
0
  
for (i = 0; 0
i < pw->n0
;
++i0
)
{0
1270
0
    pw->p[i].set = isl_set_project_out(pw->p[i].set,
1271
0
              set_type, first, n);
1272
0
    if (!pw->p[i].set)
1273
0
      goto error;
1274
0
    
pw->p[i].0
FIELD0
=
FN0
(EL,drop_dims)(pw->p[i].
FIELD0
, type, first, n);
1275
0
    if (
!pw->p[i].0
FIELD0
)
1276
0
      goto error;
1277
0
  }
1278
0
1279
0
  return pw;
1280
0
error:
1281
0
  FN(PW,free)(pw);
1282
0
  return NULL;
1283
0
}
Unexecuted instantiation: isl_pw_aff_project_out
Unexecuted instantiation: isl_pw_qpolynomial_project_out
isl_pw_multi_aff_project_out
Line
Count
Source
1252
18
{
1253
18
  int i;
1254
18
  enum isl_dim_type set_type;
1255
18
1256
18
  if (!pw)
1257
0
    return NULL;
1258
18
  
if (18
n == 0 && 18
!isl_space_get_tuple_name(pw->dim, type)0
)
1259
0
    return pw;
1260
18
1261
18
  
set_type = type == isl_dim_in ? 18
isl_dim_set18
:
type0
;
1262
18
1263
18
  pw = FN(PW,cow)(pw);
1264
18
  if (!pw)
1265
0
    return NULL;
1266
18
  pw->dim = isl_space_drop_dims(pw->dim, type, first, n);
1267
18
  if (!pw->dim)
1268
0
    goto error;
1269
54
  
for (i = 0; 18
i < pw->n54
;
++i36
)
{36
1270
36
    pw->p[i].set = isl_set_project_out(pw->p[i].set,
1271
36
              set_type, first, n);
1272
36
    if (!pw->p[i].set)
1273
0
      goto error;
1274
36
    
pw->p[i].36
FIELD36
=
FN36
(EL,drop_dims)(pw->p[i].
FIELD36
, type, first, n);
1275
36
    if (
!pw->p[i].36
FIELD36
)
1276
0
      goto error;
1277
36
  }
1278
18
1279
18
  return pw;
1280
0
error:
1281
0
  FN(PW,free)(pw);
1282
0
  return NULL;
1283
18
}
1284
1285
/* Project the domain of pw onto its parameter space.
1286
 */
1287
__isl_give PW *FN(PW,project_domain_on_params)(__isl_take PW *pw)
1288
{
1289
  isl_space *space;
1290
  unsigned n;
1291
1292
  n = FN(PW,dim)(pw, isl_dim_in);
1293
  pw = FN(PW,project_out)(pw, isl_dim_in, 0, n);
1294
  space = FN(PW,get_domain_space)(pw);
1295
  space = isl_space_params(space);
1296
  pw = FN(PW,reset_domain_space)(pw, space);
1297
  return pw;
1298
}
Unexecuted instantiation: isl_pw_qpolynomial_project_domain_on_params
isl_pw_qpolynomial_fold_project_domain_on_params
Line
Count
Source
1288
1
{
1289
1
  isl_space *space;
1290
1
  unsigned n;
1291
1
1292
1
  n = FN(PW,dim)(pw, isl_dim_in);
1293
1
  pw = FN(PW,project_out)(pw, isl_dim_in, 0, n);
1294
1
  space = FN(PW,get_domain_space)(pw);
1295
1
  space = isl_space_params(space);
1296
1
  pw = FN(PW,reset_domain_space)(pw, space);
1297
1
  return pw;
1298
1
}
Unexecuted instantiation: isl_pw_multi_aff_project_domain_on_params
Unexecuted instantiation: isl_pw_aff_project_domain_on_params
1299
#endif
1300
1301
#ifndef NO_INSERT_DIMS
1302
__isl_give PW *FN(PW,insert_dims)(__isl_take PW *pw, enum isl_dim_type type,
1303
  unsigned first, unsigned n)
1304
{
1305
  int i;
1306
  enum isl_dim_type set_type;
1307
1308
  if (!pw)
1309
    return NULL;
1310
  if (n == 0 && !isl_space_is_named_or_nested(pw->dim, type))
1311
    return pw;
1312
1313
  set_type = type == isl_dim_in ? isl_dim_set : type;
1314
1315
  pw = FN(PW,cow)(pw);
1316
  if (!pw)
1317
    return NULL;
1318
1319
  pw->dim = isl_space_insert_dims(pw->dim, type, first, n);
1320
  if (!pw->dim)
1321
    goto error;
1322
1323
  for (i = 0; i < pw->n; ++i) {
1324
    pw->p[i].set = isl_set_insert_dims(pw->p[i].set,
1325
                  set_type, first, n);
1326
    if (!pw->p[i].set)
1327
      goto error;
1328
    pw->p[i].FIELD = FN(EL,insert_dims)(pw->p[i].FIELD,
1329
                type, first, n);
1330
    if (!pw->p[i].FIELD)
1331
      goto error;
1332
  }
1333
1334
  return pw;
1335
error:
1336
  FN(PW,free)(pw);
1337
  return NULL;
1338
}
isl_pw_aff_insert_dims
Line
Count
Source
1304
3.01k
{
1305
3.01k
  int i;
1306
3.01k
  enum isl_dim_type set_type;
1307
3.01k
1308
3.01k
  if (!pw)
1309
0
    return NULL;
1310
3.01k
  
if (3.01k
n == 0 && 3.01k
!isl_space_is_named_or_nested(pw->dim, type)0
)
1311
0
    return pw;
1312
3.01k
1313
3.01k
  
set_type = type == isl_dim_in ? 3.01k
isl_dim_set3.01k
:
type0
;
1314
3.01k
1315
3.01k
  pw = FN(PW,cow)(pw);
1316
3.01k
  if (!pw)
1317
0
    return NULL;
1318
3.01k
1319
3.01k
  pw->dim = isl_space_insert_dims(pw->dim, type, first, n);
1320
3.01k
  if (!pw->dim)
1321
0
    goto error;
1322
3.01k
1323
6.02k
  
for (i = 0; 3.01k
i < pw->n6.02k
;
++i3.01k
)
{3.01k
1324
3.01k
    pw->p[i].set = isl_set_insert_dims(pw->p[i].set,
1325
3.01k
                  set_type, first, n);
1326
3.01k
    if (!pw->p[i].set)
1327
0
      goto error;
1328
3.01k
    
pw->p[i].3.01k
FIELD3.01k
=
FN3.01k
(EL,insert_dims)(pw->p[i].
FIELD3.01k
,
1329
3.01k
                type, first, n);
1330
3.01k
    if (
!pw->p[i].3.01k
FIELD3.01k
)
1331
0
      goto error;
1332
3.01k
  }
1333
3.01k
1334
3.01k
  return pw;
1335
0
error:
1336
0
  FN(PW,free)(pw);
1337
0
  return NULL;
1338
3.01k
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_insert_dims
Unexecuted instantiation: isl_pw_qpolynomial_insert_dims
1339
#endif
1340
1341
__isl_give PW *FN(PW,fix_dim)(__isl_take PW *pw,
1342
  enum isl_dim_type type, unsigned pos, isl_int v)
1343
{
1344
  int i;
1345
1346
  if (!pw)
1347
    return NULL;
1348
1349
  if (type == isl_dim_in)
1350
    type = isl_dim_set;
1351
1352
  pw = FN(PW,cow)(pw);
1353
  if (!pw)
1354
    return NULL;
1355
  for (i = 0; i < pw->n; ++i) {
1356
    pw->p[i].set = isl_set_fix(pw->p[i].set, type, pos, v);
1357
    if (FN(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 0)
1358
      return FN(PW,free)(pw);
1359
  }
1360
1361
  return pw;
1362
}
Unexecuted instantiation: isl_pw_multi_aff_fix_dim
isl_pw_qpolynomial_fix_dim
Line
Count
Source
1343
1
{
1344
1
  int i;
1345
1
1346
1
  if (!pw)
1347
0
    return NULL;
1348
1
1349
1
  
if (1
type == isl_dim_in1
)
1350
0
    type = isl_dim_set;
1351
1
1352
1
  pw = FN(PW,cow)(pw);
1353
1
  if (!pw)
1354
0
    return NULL;
1355
2
  
for (i = 0; 1
i < pw->n2
;
++i1
)
{1
1356
1
    pw->p[i].set = isl_set_fix(pw->p[i].set, type, pos, v);
1357
1
    if (
FN1
(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 01
)
1358
0
      
return 0
FN0
(PW,free)(pw);
1359
1
  }
1360
1
1361
1
  return pw;
1362
1
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_fix_dim
Unexecuted instantiation: isl_pw_aff_fix_dim
1363
1364
/* Fix the value of the variable at position "pos" of type "type" of "pw"
1365
 * to be equal to "v".
1366
 */
1367
__isl_give PW *FN(PW,fix_val)(__isl_take PW *pw,
1368
  enum isl_dim_type type, unsigned pos, __isl_take isl_val *v)
1369
{
1370
  if (!v)
1371
    return FN(PW,free)(pw);
1372
  if (!isl_val_is_int(v))
1373
    isl_die(FN(PW,get_ctx)(pw), isl_error_invalid,
1374
      "expecting integer value", goto error);
1375
1376
  pw = FN(PW,fix_dim)(pw, type, pos, v->n);
1377
  isl_val_free(v);
1378
1379
  return pw;
1380
error:
1381
  isl_val_free(v);
1382
  return FN(PW,free)(pw);
1383
}
Unexecuted instantiation: isl_pw_aff_fix_val
isl_pw_qpolynomial_fix_val
Line
Count
Source
1369
1
{
1370
1
  if (!v)
1371
0
    
return 0
FN0
(PW,free)(pw);
1372
1
  
if (1
!isl_val_is_int(v)1
)
1373
0
    isl_die(FN(PW,get_ctx)(pw), isl_error_invalid,
1374
1
      "expecting integer value", goto error);
1375
1
1376
1
  
pw = 1
FN1
(PW,fix_dim)(pw, type, pos, v->n);
1377
1
  isl_val_free(v);
1378
1
1379
1
  return pw;
1380
0
error:
1381
0
  isl_val_free(v);
1382
0
  return FN(PW,free)(pw);
1383
1
}
Unexecuted instantiation: isl_pw_multi_aff_fix_val
Unexecuted instantiation: isl_pw_qpolynomial_fold_fix_val
1384
1385
unsigned FN(PW,dim)(__isl_keep PW *pw, enum isl_dim_type type)
1386
{
1387
  return pw ? isl_space_dim(pw->dim, type) : 0;
1388
}
isl_pw_aff_dim
Line
Count
Source
1386
3.01k
{
1387
3.01k
  return pw ? 
isl_space_dim(pw->dim, type)3.01k
:
00
;
1388
3.01k
}
isl_pw_multi_aff_dim
Line
Count
Source
1386
12.4k
{
1387
12.4k
  return pw ? 
isl_space_dim(pw->dim, type)12.4k
:
00
;
1388
12.4k
}
isl_pw_qpolynomial_fold_dim
Line
Count
Source
1386
3
{
1387
3
  return pw ? 
isl_space_dim(pw->dim, type)3
:
00
;
1388
3
}
Unexecuted instantiation: isl_pw_qpolynomial_dim
1389
1390
__isl_give PW *FN(PW,split_dims)(__isl_take PW *pw,
1391
  enum isl_dim_type type, unsigned first, unsigned n)
1392
{
1393
  int i;
1394
1395
  if (!pw)
1396
    return NULL;
1397
  if (n == 0)
1398
    return pw;
1399
1400
  if (type == isl_dim_in)
1401
    type = isl_dim_set;
1402
1403
  pw = FN(PW,cow)(pw);
1404
  if (!pw)
1405
    return NULL;
1406
  if (!pw->dim)
1407
    goto error;
1408
  for (i = 0; i < pw->n; ++i) {
1409
    pw->p[i].set = isl_set_split_dims(pw->p[i].set, type, first, n);
1410
    if (!pw->p[i].set)
1411
      goto error;
1412
  }
1413
1414
  return pw;
1415
error:
1416
  FN(PW,free)(pw);
1417
  return NULL;
1418
}
Unexecuted instantiation: isl_pw_aff_split_dims
Unexecuted instantiation: isl_pw_qpolynomial_split_dims
Unexecuted instantiation: isl_pw_multi_aff_split_dims
Unexecuted instantiation: isl_pw_qpolynomial_fold_split_dims
1419
1420
#ifndef NO_OPT
1421
/* Compute the maximal value attained by the piecewise quasipolynomial
1422
 * on its domain or zero if the domain is empty.
1423
 * In the worst case, the domain is scanned completely,
1424
 * so the domain is assumed to be bounded.
1425
 */
1426
__isl_give isl_val *FN(PW,opt)(__isl_take PW *pw, int max)
1427
{
1428
  int i;
1429
  isl_val *opt;
1430
1431
  if (!pw)
1432
    return NULL;
1433
1434
  if (pw->n == 0) {
1435
    opt = isl_val_zero(FN(PW,get_ctx)(pw));
1436
    FN(PW,free)(pw);
1437
    return opt;
1438
  }
1439
1440
  opt = FN(EL,opt_on_domain)(FN(EL,copy)(pw->p[0].FIELD),
1441
          isl_set_copy(pw->p[0].set), max);
1442
  for (i = 1; i < pw->n; ++i) {
1443
    isl_val *opt_i;
1444
    opt_i = FN(EL,opt_on_domain)(FN(EL,copy)(pw->p[i].FIELD),
1445
            isl_set_copy(pw->p[i].set), max);
1446
    if (max)
1447
      opt = isl_val_max(opt, opt_i);
1448
    else
1449
      opt = isl_val_min(opt, opt_i);
1450
  }
1451
1452
  FN(PW,free)(pw);
1453
  return opt;
1454
}
Unexecuted instantiation: isl_pw_qpolynomial_opt
isl_pw_qpolynomial_fold_opt
Line
Count
Source
1427
7
{
1428
7
  int i;
1429
7
  isl_val *opt;
1430
7
1431
7
  if (!pw)
1432
0
    return NULL;
1433
7
1434
7
  
if (7
pw->n == 07
)
{0
1435
0
    opt = isl_val_zero(FN(PW,get_ctx)(pw));
1436
0
    FN(PW,free)(pw);
1437
0
    return opt;
1438
0
  }
1439
7
1440
7
  
opt = 7
FN7
(EL,opt_on_domain)(
FN7
(EL,copy)(pw->p[0].
FIELD7
),
1441
7
          isl_set_copy(pw->p[0].set), max);
1442
7
  for (i = 1; 
i < pw->n7
;
++i0
)
{0
1443
0
    isl_val *opt_i;
1444
0
    opt_i = 
FN0
(EL,opt_on_domain)(
FN0
(EL,copy)(pw->p[i].
FIELD0
),
1445
0
            isl_set_copy(pw->p[i].set), max);
1446
0
    if (max)
1447
0
      opt = isl_val_max(opt, opt_i);
1448
0
    else
1449
0
      opt = isl_val_min(opt, opt_i);
1450
0
  }
1451
7
1452
7
  FN(PW,free)(pw);
1453
7
  return opt;
1454
7
}
1455
1456
__isl_give isl_val *FN(PW,max)(__isl_take PW *pw)
1457
{
1458
  return FN(PW,opt)(pw, 1);
1459
}
Unexecuted instantiation: isl_pw_qpolynomial_max
isl_pw_qpolynomial_fold_max
Line
Count
Source
1457
2
{
1458
2
  return FN(PW,opt)(pw, 1);
1459
2
}
1460
1461
__isl_give isl_val *FN(PW,min)(__isl_take PW *pw)
1462
{
1463
  return FN(PW,opt)(pw, 0);
1464
}
isl_pw_qpolynomial_fold_min
Line
Count
Source
1462
5
{
1463
5
  return FN(PW,opt)(pw, 0);
1464
5
}
Unexecuted instantiation: isl_pw_qpolynomial_min
1465
#endif
1466
1467
__isl_give isl_space *FN(PW,get_space)(__isl_keep PW *pw)
1468
{
1469
  return pw ? isl_space_copy(pw->dim) : NULL;
1470
}
isl_pw_qpolynomial_fold_get_space
Line
Count
Source
1468
1
{
1469
1
  return pw ? isl_space_copy(pw->dim) : NULL;
1470
1
}
isl_pw_aff_get_space
Line
Count
Source
1468
84.1k
{
1469
84.1k
  return pw ? isl_space_copy(pw->dim) : NULL;
1470
84.1k
}
isl_pw_multi_aff_get_space
Line
Count
Source
1468
31.5k
{
1469
31.5k
  return pw ? isl_space_copy(pw->dim) : NULL;
1470
31.5k
}
isl_pw_qpolynomial_get_space
Line
Count
Source
1468
9
{
1469
9
  return pw ? isl_space_copy(pw->dim) : NULL;
1470
9
}
1471
1472
__isl_give isl_space *FN(PW,get_domain_space)(__isl_keep PW *pw)
1473
{
1474
  return pw ? isl_space_domain(isl_space_copy(pw->dim)) : NULL;
1475
}
isl_pw_qpolynomial_fold_get_domain_space
Line
Count
Source
1473
5
{
1474
5
  return pw ? isl_space_domain(isl_space_copy(pw->dim)) : NULL;
1475
5
}
isl_pw_qpolynomial_get_domain_space
Line
Count
Source
1473
2
{
1474
2
  return pw ? isl_space_domain(isl_space_copy(pw->dim)) : NULL;
1475
2
}
isl_pw_multi_aff_get_domain_space
Line
Count
Source
1473
50
{
1474
50
  return pw ? isl_space_domain(isl_space_copy(pw->dim)) : NULL;
1475
50
}
isl_pw_aff_get_domain_space
Line
Count
Source
1473
88.0k
{
1474
88.0k
  return pw ? isl_space_domain(isl_space_copy(pw->dim)) : NULL;
1475
88.0k
}
1476
1477
/* Return the position of the dimension of the given type and name
1478
 * in "pw".
1479
 * Return -1 if no such dimension can be found.
1480
 */
1481
int FN(PW,find_dim_by_name)(__isl_keep PW *pw,
1482
  enum isl_dim_type type, const char *name)
1483
{
1484
  if (!pw)
1485
    return -1;
1486
  return isl_space_find_dim_by_name(pw->dim, type, name);
1487
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_find_dim_by_name
Unexecuted instantiation: isl_pw_multi_aff_find_dim_by_name
Unexecuted instantiation: isl_pw_qpolynomial_find_dim_by_name
Unexecuted instantiation: isl_pw_aff_find_dim_by_name
1488
1489
#ifndef NO_RESET_DIM
1490
/* Reset the space of "pw".  Since we don't know if the elements
1491
 * represent the spaces themselves or their domains, we pass along
1492
 * both when we call their reset_space_and_domain.
1493
 */
1494
static __isl_give PW *FN(PW,reset_space_and_domain)(__isl_take PW *pw,
1495
  __isl_take isl_space *space, __isl_take isl_space *domain)
1496
{
1497
  int i;
1498
1499
  pw = FN(PW,cow)(pw);
1500
  if (!pw || !space || !domain)
1501
    goto error;
1502
1503
  for (i = 0; i < pw->n; ++i) {
1504
    pw->p[i].set = isl_set_reset_space(pw->p[i].set,
1505
             isl_space_copy(domain));
1506
    if (!pw->p[i].set)
1507
      goto error;
1508
    pw->p[i].FIELD = FN(EL,reset_space_and_domain)(pw->p[i].FIELD,
1509
            isl_space_copy(space), isl_space_copy(domain));
1510
    if (!pw->p[i].FIELD)
1511
      goto error;
1512
  }
1513
1514
  isl_space_free(domain);
1515
1516
  isl_space_free(pw->dim);
1517
  pw->dim = space;
1518
1519
  return pw;
1520
error:
1521
  isl_space_free(domain);
1522
  isl_space_free(space);
1523
  FN(PW,free)(pw);
1524
  return NULL;
1525
}
isl_aff.c:isl_pw_aff_reset_space_and_domain
Line
Count
Source
1496
34.7k
{
1497
34.7k
  int i;
1498
34.7k
1499
34.7k
  pw = FN(PW,cow)(pw);
1500
34.7k
  if (
!pw || 34.7k
!space34.7k
||
!domain34.7k
)
1501
0
    goto error;
1502
34.7k
1503
69.8k
  
for (i = 0; 34.7k
i < pw->n69.8k
;
++i35.1k
)
{35.1k
1504
35.1k
    pw->p[i].set = isl_set_reset_space(pw->p[i].set,
1505
35.1k
             isl_space_copy(domain));
1506
35.1k
    if (!pw->p[i].set)
1507
0
      goto error;
1508
35.1k
    
pw->p[i].35.1k
FIELD35.1k
=
FN35.1k
(EL,reset_space_and_domain)(pw->p[i].
FIELD35.1k
,
1509
35.1k
            isl_space_copy(space), isl_space_copy(domain));
1510
35.1k
    if (
!pw->p[i].35.1k
FIELD35.1k
)
1511
0
      goto error;
1512
35.1k
  }
1513
34.7k
1514
34.7k
  isl_space_free(domain);
1515
34.7k
1516
34.7k
  isl_space_free(pw->dim);
1517
34.7k
  pw->dim = space;
1518
34.7k
1519
34.7k
  return pw;
1520
0
error:
1521
0
  isl_space_free(domain);
1522
0
  isl_space_free(space);
1523
0
  FN(PW,free)(pw);
1524
0
  return NULL;
1525
34.7k
}
Unexecuted instantiation: isl_polynomial.c:isl_pw_qpolynomial_reset_space_and_domain
isl_aff.c:isl_pw_multi_aff_reset_space_and_domain
Line
Count
Source
1496
1.37k
{
1497
1.37k
  int i;
1498
1.37k
1499
1.37k
  pw = FN(PW,cow)(pw);
1500
1.37k
  if (
!pw || 1.37k
!space1.37k
||
!domain1.37k
)
1501
0
    goto error;
1502
1.37k
1503
2.77k
  
for (i = 0; 1.37k
i < pw->n2.77k
;
++i1.39k
)
{1.39k
1504
1.39k
    pw->p[i].set = isl_set_reset_space(pw->p[i].set,
1505
1.39k
             isl_space_copy(domain));
1506
1.39k
    if (!pw->p[i].set)
1507
0
      goto error;
1508
1.39k
    
pw->p[i].1.39k
FIELD1.39k
=
FN1.39k
(EL,reset_space_and_domain)(pw->p[i].
FIELD1.39k
,
1509
1.39k
            isl_space_copy(space), isl_space_copy(domain));
1510
1.39k
    if (
!pw->p[i].1.39k
FIELD1.39k
)
1511
0
      goto error;
1512
1.39k
  }
1513
1.37k
1514
1.37k
  isl_space_free(domain);
1515
1.37k
1516
1.37k
  isl_space_free(pw->dim);
1517
1.37k
  pw->dim = space;
1518
1.37k
1519
1.37k
  return pw;
1520
0
error:
1521
0
  isl_space_free(domain);
1522
0
  isl_space_free(space);
1523
0
  FN(PW,free)(pw);
1524
0
  return NULL;
1525
1.37k
}
isl_fold.c:isl_pw_qpolynomial_fold_reset_space_and_domain
Line
Count
Source
1496
4
{
1497
4
  int i;
1498
4
1499
4
  pw = FN(PW,cow)(pw);
1500
4
  if (
!pw || 4
!space4
||
!domain4
)
1501
0
    goto error;
1502
4
1503
7
  
for (i = 0; 4
i < pw->n7
;
++i3
)
{3
1504
3
    pw->p[i].set = isl_set_reset_space(pw->p[i].set,
1505
3
             isl_space_copy(domain));
1506
3
    if (!pw->p[i].set)
1507
0
      goto error;
1508
3
    
pw->p[i].3
FIELD3
=
FN3
(EL,reset_space_and_domain)(pw->p[i].
FIELD3
,
1509
3
            isl_space_copy(space), isl_space_copy(domain));
1510
3
    if (
!pw->p[i].3
FIELD3
)
1511
0
      goto error;
1512
3
  }
1513
4
1514
4
  isl_space_free(domain);
1515
4
1516
4
  isl_space_free(pw->dim);
1517
4
  pw->dim = space;
1518
4
1519
4
  return pw;
1520
0
error:
1521
0
  isl_space_free(domain);
1522
0
  isl_space_free(space);
1523
0
  FN(PW,free)(pw);
1524
0
  return NULL;
1525
4
}
1526
1527
__isl_give PW *FN(PW,reset_domain_space)(__isl_take PW *pw,
1528
  __isl_take isl_space *domain)
1529
{
1530
  isl_space *space;
1531
1532
  space = isl_space_extend_domain_with_range(isl_space_copy(domain),
1533
               FN(PW,get_space)(pw));
1534
  return FN(PW,reset_space_and_domain)(pw, space, domain);
1535
}
isl_pw_qpolynomial_fold_reset_domain_space
Line
Count
Source
1529
1
{
1530
1
  isl_space *space;
1531
1
1532
1
  space = isl_space_extend_domain_with_range(isl_space_copy(domain),
1533
1
               FN(PW,get_space)(pw));
1534
1
  return FN(PW,reset_space_and_domain)(pw, space, domain);
1535
1
}
Unexecuted instantiation: isl_pw_multi_aff_reset_domain_space
isl_pw_aff_reset_domain_space
Line
Count
Source
1529
27.9k
{
1530
27.9k
  isl_space *space;
1531
27.9k
1532
27.9k
  space = isl_space_extend_domain_with_range(isl_space_copy(domain),
1533
27.9k
               FN(PW,get_space)(pw));
1534
27.9k
  return FN(PW,reset_space_and_domain)(pw, space, domain);
1535
27.9k
}
Unexecuted instantiation: isl_pw_qpolynomial_reset_domain_space
1536
1537
__isl_give PW *FN(PW,reset_space)(__isl_take PW *pw, __isl_take isl_space *dim)
1538
{
1539
  isl_space *domain;
1540
1541
  domain = isl_space_domain(isl_space_copy(dim));
1542
  return FN(PW,reset_space_and_domain)(pw, dim, domain);
1543
}
isl_pw_aff_reset_space
Line
Count
Source
1538
6.82k
{
1539
6.82k
  isl_space *domain;
1540
6.82k
1541
6.82k
  domain = isl_space_domain(isl_space_copy(dim));
1542
6.82k
  return FN(PW,reset_space_and_domain)(pw, dim, domain);
1543
6.82k
}
Unexecuted instantiation: isl_pw_qpolynomial_reset_space
isl_pw_multi_aff_reset_space
Line
Count
Source
1538
1.37k
{
1539
1.37k
  isl_space *domain;
1540
1.37k
1541
1.37k
  domain = isl_space_domain(isl_space_copy(dim));
1542
1.37k
  return FN(PW,reset_space_and_domain)(pw, dim, domain);
1543
1.37k
}
isl_pw_qpolynomial_fold_reset_space
Line
Count
Source
1538
3
{
1539
3
  isl_space *domain;
1540
3
1541
3
  domain = isl_space_domain(isl_space_copy(dim));
1542
3
  return FN(PW,reset_space_and_domain)(pw, dim, domain);
1543
3
}
1544
1545
__isl_give PW *FN(PW,set_tuple_id)(__isl_take PW *pw, enum isl_dim_type type,
1546
  __isl_take isl_id *id)
1547
{
1548
  isl_space *space;
1549
1550
  pw = FN(PW,cow)(pw);
1551
  if (!pw)
1552
    goto error;
1553
1554
  space = FN(PW,get_space)(pw);
1555
  space = isl_space_set_tuple_id(space, type, id);
1556
1557
  return FN(PW,reset_space)(pw, space);
1558
error:
1559
  isl_id_free(id);
1560
  return FN(PW,free)(pw);
1561
}
isl_pw_aff_set_tuple_id
Line
Count
Source
1547
471
{
1548
471
  isl_space *space;
1549
471
1550
471
  pw = FN(PW,cow)(pw);
1551
471
  if (!pw)
1552
0
    goto error;
1553
471
1554
471
  
space = 471
FN471
(PW,get_space)(pw);
1555
471
  space = isl_space_set_tuple_id(space, type, id);
1556
471
1557
471
  return FN(PW,reset_space)(pw, space);
1558
0
error:
1559
0
  isl_id_free(id);
1560
0
  return FN(PW,free)(pw);
1561
471
}
Unexecuted instantiation: isl_pw_qpolynomial_set_tuple_id
Unexecuted instantiation: isl_pw_qpolynomial_fold_set_tuple_id
Unexecuted instantiation: isl_pw_multi_aff_set_tuple_id
1562
1563
/* Drop the id on the specified tuple.
1564
 */
1565
__isl_give PW *FN(PW,reset_tuple_id)(__isl_take PW *pw, enum isl_dim_type type)
1566
{
1567
  isl_space *space;
1568
1569
  if (!pw)
1570
    return NULL;
1571
  if (!FN(PW,has_tuple_id)(pw, type))
1572
    return pw;
1573
1574
  pw = FN(PW,cow)(pw);
1575
  if (!pw)
1576
    return NULL;
1577
1578
  space = FN(PW,get_space)(pw);
1579
  space = isl_space_reset_tuple_id(space, type);
1580
1581
  return FN(PW,reset_space)(pw, space);
1582
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_reset_tuple_id
Unexecuted instantiation: isl_pw_multi_aff_reset_tuple_id
Unexecuted instantiation: isl_pw_aff_reset_tuple_id
Unexecuted instantiation: isl_pw_qpolynomial_reset_tuple_id
1583
1584
__isl_give PW *FN(PW,set_dim_id)(__isl_take PW *pw,
1585
  enum isl_dim_type type, unsigned pos, __isl_take isl_id *id)
1586
{
1587
  pw = FN(PW,cow)(pw);
1588
  if (!pw)
1589
    goto error;
1590
  pw->dim = isl_space_set_dim_id(pw->dim, type, pos, id);
1591
  return FN(PW,reset_space)(pw, isl_space_copy(pw->dim));
1592
error:
1593
  isl_id_free(id);
1594
  return FN(PW,free)(pw);
1595
}
Unexecuted instantiation: isl_pw_aff_set_dim_id
Unexecuted instantiation: isl_pw_qpolynomial_fold_set_dim_id
Unexecuted instantiation: isl_pw_qpolynomial_set_dim_id
Unexecuted instantiation: isl_pw_multi_aff_set_dim_id
1596
#endif
1597
1598
/* Reset the user pointer on all identifiers of parameters and tuples
1599
 * of the space of "pw".
1600
 */
1601
__isl_give PW *FN(PW,reset_user)(__isl_take PW *pw)
1602
{
1603
  isl_space *space;
1604
1605
  space = FN(PW,get_space)(pw);
1606
  space = isl_space_reset_user(space);
1607
1608
  return FN(PW,reset_space)(pw, space);
1609
}
Unexecuted instantiation: isl_pw_multi_aff_reset_user
Unexecuted instantiation: isl_pw_aff_reset_user
Unexecuted instantiation: isl_pw_qpolynomial_fold_reset_user
Unexecuted instantiation: isl_pw_qpolynomial_reset_user
1610
1611
isl_bool FN(PW,has_equal_space)(__isl_keep PW *pw1, __isl_keep PW *pw2)
1612
{
1613
  if (!pw1 || !pw2)
1614
    return isl_bool_error;
1615
1616
  return isl_space_is_equal(pw1->dim, pw2->dim);
1617
}
Unexecuted instantiation: isl_pw_multi_aff_has_equal_space
Unexecuted instantiation: isl_pw_aff_has_equal_space
Unexecuted instantiation: isl_pw_qpolynomial_fold_has_equal_space
isl_pw_qpolynomial_has_equal_space
Line
Count
Source
1612
4
{
1613
4
  if (
!pw1 || 4
!pw24
)
1614
0
    return isl_bool_error;
1615
4
1616
4
  return isl_space_is_equal(pw1->dim, pw2->dim);
1617
4
}
1618
1619
#ifndef NO_MORPH
1620
__isl_give PW *FN(PW,morph_domain)(__isl_take PW *pw,
1621
  __isl_take isl_morph *morph)
1622
{
1623
  int i;
1624
  isl_ctx *ctx;
1625
1626
  if (!pw || !morph)
1627
    goto error;
1628
1629
  ctx = isl_space_get_ctx(pw->dim);
1630
  isl_assert(ctx, isl_space_is_domain_internal(morph->dom->dim, pw->dim),
1631
    goto error);
1632
1633
  pw = FN(PW,cow)(pw);
1634
  if (!pw)
1635
    goto error;
1636
  pw->dim = isl_space_extend_domain_with_range(
1637
      isl_space_copy(morph->ran->dim), pw->dim);
1638
  if (!pw->dim)
1639
    goto error;
1640
1641
  for (i = 0; i < pw->n; ++i) {
1642
    pw->p[i].set = isl_morph_set(isl_morph_copy(morph), pw->p[i].set);
1643
    if (!pw->p[i].set)
1644
      goto error;
1645
    pw->p[i].FIELD = FN(EL,morph_domain)(pw->p[i].FIELD,
1646
            isl_morph_copy(morph));
1647
    if (!pw->p[i].FIELD)
1648
      goto error;
1649
  }
1650
1651
  isl_morph_free(morph);
1652
1653
  return pw;
1654
error:
1655
  FN(PW,free)(pw);
1656
  isl_morph_free(morph);
1657
  return NULL;
1658
}
isl_pw_qpolynomial_fold_morph_domain
Line
Count
Source
1622
2
{
1623
2
  int i;
1624
2
  isl_ctx *ctx;
1625
2
1626
2
  if (
!pw || 2
!morph2
)
1627
0
    goto error;
1628
2
1629
2
  ctx = isl_space_get_ctx(pw->dim);
1630
2
  isl_assert(ctx, isl_space_is_domain_internal(morph->dom->dim, pw->dim),
1631
2
    goto error);
1632
2
1633
2
  
pw = 2
FN2
(PW,cow)(pw);
1634
2
  if (!pw)
1635
0
    goto error;
1636
2
  pw->dim = isl_space_extend_domain_with_range(
1637
2
      isl_space_copy(morph->ran->dim), pw->dim);
1638
2
  if (!pw->dim)
1639
0
    goto error;
1640
2
1641
3
  
for (i = 0; 2
i < pw->n3
;
++i1
)
{1
1642
1
    pw->p[i].set = isl_morph_set(isl_morph_copy(morph), pw->p[i].set);
1643
1
    if (!pw->p[i].set)
1644
0
      goto error;
1645
1
    
pw->p[i].1
FIELD1
=
FN1
(EL,morph_domain)(pw->p[i].
FIELD1
,
1646
1
            isl_morph_copy(morph));
1647
1
    if (
!pw->p[i].1
FIELD1
)
1648
0
      goto error;
1649
1
  }
1650
2
1651
2
  isl_morph_free(morph);
1652
2
1653
2
  return pw;
1654
0
error:
1655
0
  FN(PW,free)(pw);
1656
0
  isl_morph_free(morph);
1657
0
  return NULL;
1658
2
}
Unexecuted instantiation: isl_pw_qpolynomial_morph_domain
1659
#endif
1660
1661
int FN(PW,n_piece)(__isl_keep PW *pw)
1662
{
1663
  return pw ? pw->n : 0;
1664
}
Unexecuted instantiation: isl_pw_qpolynomial_n_piece
isl_pw_aff_n_piece
Line
Count
Source
1662
6.44k
{
1663
6.44k
  return pw ? 
pw->n6.44k
:
00
;
1664
6.44k
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_n_piece
Unexecuted instantiation: isl_pw_multi_aff_n_piece
1665
1666
isl_stat FN(PW,foreach_piece)(__isl_keep PW *pw,
1667
  isl_stat (*fn)(__isl_take isl_set *set, __isl_take EL *el, void *user),
1668
  void *user)
1669
{
1670
  int i;
1671
1672
  if (!pw)
1673
    return isl_stat_error;
1674
1675
  for (i = 0; i < pw->n; ++i)
1676
    if (fn(isl_set_copy(pw->p[i].set),
1677
        FN(EL,copy)(pw->p[i].FIELD), user) < 0)
1678
      return isl_stat_error;
1679
1680
  return isl_stat_ok;
1681
}
isl_pw_qpolynomial_foreach_piece
Line
Count
Source
1669
1
{
1670
1
  int i;
1671
1
1672
1
  if (!pw)
1673
0
    return isl_stat_error;
1674
1
1675
3
  
for (i = 0; 1
i < pw->n3
;
++i2
)
1676
2
    
if (2
fn(isl_set_copy(pw->p[i].set),2
1677
2
        
FN2
(EL,copy)(pw->p[i].
FIELD2
), user) < 0)
1678
0
      return isl_stat_error;
1679
1
1680
1
  return isl_stat_ok;
1681
1
}
Unexecuted instantiation: isl_pw_qpolynomial_fold_foreach_piece
isl_pw_aff_foreach_piece
Line
Count
Source
1669
7.40k
{
1670
7.40k
  int i;
1671
7.40k
1672
7.40k
  if (!pw)
1673
0
    return isl_stat_error;
1674
7.40k
1675
13.0k
  
for (i = 0; 7.40k
i < pw->n13.0k
;
++i5.64k
)
1676
7.66k
    
if (7.66k
fn(isl_set_copy(pw->p[i].set),7.66k
1677
7.66k
        
FN7.66k
(EL,copy)(pw->p[i].
FIELD7.66k
), user) < 0)
1678
2.01k
      return isl_stat_error;
1679
7.40k
1680
5.38k
  return isl_stat_ok;
1681
7.40k
}
isl_pw_multi_aff_foreach_piece
Line
Count
Source
1669
2
{
1670
2
  int i;
1671
2
1672
2
  if (!pw)
1673
0
    return isl_stat_error;
1674
2
1675
4
  
for (i = 0; 2
i < pw->n4
;
++i2
)
1676
2
    
if (2
fn(isl_set_copy(pw->p[i].set),2
1677
2
        
FN2
(EL,copy)(pw->p[i].
FIELD2
), user) < 0)
1678
0
      return isl_stat_error;
1679
2
1680
2
  return isl_stat_ok;
1681
2
}
1682
1683
#ifndef NO_LIFT
1684
static isl_bool any_divs(__isl_keep isl_set *set)
1685
{
1686
  int i;
1687
1688
  if (!set)
1689
    return isl_bool_error;
1690
1691
  for (i = 0; i < set->n; ++i)
1692
    if (set->p[i]->n_div > 0)
1693
      return isl_bool_true;
1694
1695
  return isl_bool_false;
1696
}
Unexecuted instantiation: isl_polynomial.c:any_divs
isl_fold.c:any_divs
Line
Count
Source
1685
2
{
1686
2
  int i;
1687
2
1688
2
  if (!set)
1689
0
    return isl_bool_error;
1690
2
1691
3
  
for (i = 0; 2
i < set->n3
;
++i1
)
1692
2
    
if (2
set->p[i]->n_div > 02
)
1693
1
      return isl_bool_true;
1694
2
1695
1
  return isl_bool_false;
1696
2
}
1697
1698
static isl_stat foreach_lifted_subset(__isl_take isl_set *set,
1699
  __isl_take EL *el,
1700
  isl_stat (*fn)(__isl_take isl_set *set, __isl_take EL *el,
1701
    void *user), void *user)
1702
{
1703
  int i;
1704
1705
  if (!set || !el)
1706
    goto error;
1707
1708
  for (i = 0; i < set->n; ++i) {
1709
    isl_set *lift;
1710
    EL *copy;
1711
1712
    lift = isl_set_from_basic_set(isl_basic_set_copy(set->p[i]));
1713
    lift = isl_set_lift(lift);
1714
1715
    copy = FN(EL,copy)(el);
1716
    copy = FN(EL,lift)(copy, isl_set_get_space(lift));
1717
1718
    if (fn(lift, copy, user) < 0)
1719
      goto error;
1720
  }
1721
1722
  isl_set_free(set);
1723
  FN(EL,free)(el);
1724
1725
  return isl_stat_ok;
1726
error:
1727
  isl_set_free(set);
1728
  FN(EL,free)(el);
1729
  return isl_stat_error;
1730
}
Unexecuted instantiation: isl_polynomial.c:foreach_lifted_subset
isl_fold.c:foreach_lifted_subset
Line
Count
Source
1702
1
{
1703
1
  int i;
1704
1
1705
1
  if (
!set || 1
!el1
)
1706
0
    goto error;
1707
1
1708
2
  
for (i = 0; 1
i < set->n2
;
++i1
)
{1
1709
1
    isl_set *lift;
1710
1
    EL *copy;
1711
1
1712
1
    lift = isl_set_from_basic_set(isl_basic_set_copy(set->p[i]));
1713
1
    lift = isl_set_lift(lift);
1714
1
1715
1
    copy = FN(EL,copy)(el);
1716
1
    copy = FN(EL,lift)(copy, isl_set_get_space(lift));
1717
1
1718
1
    if (fn(lift, copy, user) < 0)
1719
0
      goto error;
1720
1
  }
1721
1
1722
1
  isl_set_free(set);
1723
1
  FN(EL,free)(el);
1724
1
1725
1
  return isl_stat_ok;
1726
0
error:
1727
0
  isl_set_free(set);
1728
0
  FN(EL,free)(el);
1729
0
  return isl_stat_error;
1730
1
}
1731
1732
isl_stat FN(PW,foreach_lifted_piece)(__isl_keep PW *pw,
1733
  isl_stat (*fn)(__isl_take isl_set *set, __isl_take EL *el,
1734
        void *user), void *user)
1735
{
1736
  int i;
1737
1738
  if (!pw)
1739
    return isl_stat_error;
1740
1741
  for (i = 0; i < pw->n; ++i) {
1742
    isl_bool any;
1743
    isl_set *set;
1744
    EL *el;
1745
1746
    any = any_divs(pw->p[i].set);
1747
    if (any < 0)
1748
      return isl_stat_error;
1749
    set = isl_set_copy(pw->p[i].set);
1750
    el = FN(EL,copy)(pw->p[i].FIELD);
1751
    if (!any) {
1752
      if (fn(set, el, user) < 0)
1753
        return isl_stat_error;
1754
      continue;
1755
    }
1756
    if (foreach_lifted_subset(set, el, fn, user) < 0)
1757
      return isl_stat_error;
1758
  }
1759
1760
  return isl_stat_ok;
1761
}
isl_pw_qpolynomial_fold_foreach_lifted_piece
Line
Count
Source
1735
2
{
1736
2
  int i;
1737
2
1738
2
  if (!pw)
1739
0
    return isl_stat_error