Polly 20.0.0git
isl_project_out_param_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#define xFN(TYPE,NAME) TYPE ## _ ## NAME
11#define FN(TYPE,NAME) xFN(TYPE,NAME)
12
13/* If "obj" involves a parameter with identifier "id",
14 * then turn it into an existentially quantified variable.
15 */
16__isl_give TYPE *FN(TYPE,project_out_param_id)(__isl_take TYPE *obj,
18{
19 int pos;
20
21 if (!obj || !id)
22 goto error;
23 pos = FN(TYPE,find_dim_by_id)(obj, isl_dim_param, id);
24 isl_id_free(id);
25 if (pos < 0)
26 return obj;
27 return FN(TYPE,project_out)(obj, isl_dim_param, pos, 1);
28error:
29 FN(TYPE,free)(obj);
30 isl_id_free(id);
31 return NULL;
32}
33
34/* If "obj" involves any of the parameters with identifiers in "list",
35 * then turn them into existentially quantified variables.
36 */
37__isl_give TYPE *FN(TYPE,project_out_param_id_list)(__isl_take TYPE *obj,
38 __isl_take isl_id_list *list)
39{
40 int i;
41 isl_size n;
42
43 n = isl_id_list_size(list);
44 if (n < 0)
45 goto error;
46 for (i = 0; i < n; ++i) {
47 isl_id *id;
48
49 id = isl_id_list_get_at(list, i);
50 obj = FN(TYPE,project_out_param_id)(obj, id);
51 }
52
53 isl_id_list_free(list);
54 return obj;
55error:
56 isl_id_list_free(list);
57 FN(TYPE,free)(obj);
58 return NULL;
59}
#define TYPE
#define __isl_take
Definition: ctx.h:22
#define __isl_give
Definition: ctx.h:19
int isl_size
Definition: ctx.h:96
__isl_null isl_id * isl_id_free(__isl_take isl_id *id)
Definition: isl_id.c:207
static unsigned pos(__isl_keep isl_space *space, enum isl_dim_type type)
Definition: isl_map.c:70
#define FN(TYPE, NAME)
const char * obj
Definition: isl_test.c:3316
const char * id
Definition: isl_test.c:7279
static isl_stat project_out(__isl_take isl_map *map, void *user)
@ isl_dim_param
Definition: space_type.h:15
n
Definition: youcefn.c:8