gpu backend: create single kernel for entire subtree without permutable bands
[ppcg.git] / util.c
blob85c1a0424c85cbfb6ffadc701b85900bceee9d1a
1 /*
2 * Copyright 2012 Ecole Normale Superieure
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege,
7 * Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
8 */
10 #include <isl/space.h>
11 #include <isl/val.h>
13 #include "util.h"
15 /* Construct an isl_multi_val living in "space" with all values equal to "val".
17 __isl_give isl_multi_val *ppcg_multi_val_from_int(__isl_take isl_space *space,
18 int val)
20 int i, n;
21 isl_ctx *ctx;
22 isl_val *v;
23 isl_multi_val *mv;
25 if (!space)
26 return NULL;
28 ctx = isl_space_get_ctx(space);
29 n = isl_space_dim(space, isl_dim_set);
30 mv = isl_multi_val_zero(space);
31 v = isl_val_int_from_si(ctx, val);
32 for (i = 0; i < n; ++i)
33 mv = isl_multi_val_set_val(mv, i, isl_val_copy(v));
34 isl_val_free(v);
36 return mv;