Polly
20.0.0git
llvm-project
polly
lib
External
isl
isl_pw_add_constant_templ.c
Go to the documentation of this file.
1
/*
2
* Copyright 2019 Cerebras Systems
3
*
4
* Use of this software is governed by the MIT license
5
*
6
* Written by Sven Verdoolaege,
7
* Cerebras Systems, 175 S San Antonio Rd, Los Altos, CA, USA
8
*/
9
10
#include <
isl_pw_macro.h
>
11
12
#undef VAL
13
#define VAL CAT(isl_,VAL_BASE)
14
15
/* Add "v" to the constant term of "pw" over its entire definition domain.
16
*/
17
__isl_give
PW
*
FN
(
FN
(
PW
,add_constant),
VAL_BASE
)(
__isl_take
PW
*pw,
18
__isl_take
VAL
*v)
19
{
20
isl_bool
zero;
21
isl_size
n
;
22
int
i;
23
24
zero =
FN
(
VAL
,is_zero)(v);
25
n
=
FN
(
PW
,n_piece)(pw);
26
if
(zero < 0 ||
n
< 0)
27
goto
error;
28
if
(zero ||
n
== 0) {
29
FN
(
VAL
,free)(v);
30
return
pw;
31
}
32
33
for
(i = 0; i <
n
; ++i) {
34
EL
*el;
35
36
el =
FN
(
PW
,take_base_at)(pw, i);
37
el =
FN
(
FN
(
EL
,add_constant),
VAL_BASE
)(el,
FN
(
VAL
,copy)(v));
38
pw =
FN
(
PW
,restore_base_at)(pw, i, el);
39
}
40
41
FN
(
VAL
,free)(v);
42
return
pw;
43
error:
44
FN
(
PW
,free)(pw);
45
FN
(
VAL
,free)(v);
46
return
NULL;
47
}
FN
#define FN(TYPE, NAME)
Definition:
check_parse_fail_test_templ.c:15
__isl_take
#define __isl_take
Definition:
ctx.h:22
__isl_give
#define __isl_give
Definition:
ctx.h:19
isl_size
int isl_size
Definition:
ctx.h:96
isl_bool
isl_bool
Definition:
ctx.h:89
PW
#define PW
Definition:
isl_aff.c:4582
EL
#define EL
Definition:
isl_aff_private.h:238
VAL_BASE
#define VAL_BASE
Definition:
isl_pw_add_constant_multi_val_templ.c:11
VAL
#define VAL
Definition:
isl_pw_add_constant_templ.c:13
isl_pw_macro.h
n
n
Definition:
youcefn.c:8
Generated on Wed Nov 13 2024 03:17:26 for Polly by
1.9.6