Polly 20.0.0git
isl_pw_scale_templ.c
Go to the documentation of this file.
1/*
2 * Copyright 2010 INRIA Saclay
3 *
4 * Use of this software is governed by the MIT license
5 *
6 * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France,
7 * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod,
8 * 91893 Orsay, France
9 */
10
11#include <isl_pw_macro.h>
12
14{
15 int i;
16 isl_size n;
17
18 if (isl_int_is_one(v))
19 return pw;
20 if (pw && DEFAULT_IS_ZERO && isl_int_is_zero(v)) {
21 PW *zero;
22 isl_space *space = FN(PW,get_space)(pw);
23 zero = FN(PW,ZERO)(space OPT_TYPE_ARG(pw->));
24 FN(PW,free)(pw);
25 return zero;
26 }
27 if (isl_int_is_neg(v))
28 pw = FN(PW,negate_type)(pw);
29
30 n = FN(PW,n_piece)(pw);
31 if (n < 0)
32 return FN(PW,free)(pw);
33 for (i = 0; i < n; ++i) {
34 EL *el;
35
36 el = FN(PW,take_base_at)(pw, i);
37 el = FN(EL,scale)(el, v);
38 pw = FN(PW,restore_base_at)(pw, i, el);
39 }
40
41 return pw;
42}
#define FN(TYPE, NAME)
#define __isl_take
Definition: ctx.h:22
#define __isl_give
Definition: ctx.h:19
int isl_size
Definition: ctx.h:96
#define DEFAULT_IS_ZERO
Definition: isl_aff.c:4594
#define PW
Definition: isl_aff.c:4582
#define ZERO
Definition: isl_aff.c:4588
#define EL
static __isl_give isl_ast_expr * scale(__isl_take isl_ast_expr *expr, __isl_take isl_val *v)
#define isl_int_is_zero(i)
Definition: isl_int.h:31
#define isl_int_is_one(i)
Definition: isl_int.h:32
#define isl_int_is_neg(i)
Definition: isl_int.h:35
#define OPT_TYPE_ARG(loc)
Definition: opt_type.h:12
n
Definition: youcefn.c:8