[clang-repl] [codegen] Reduce the state in TBAA. NFC for static compilation. (#98138)
[llvm-project.git] / polly / lib / External / isl / isl_project_out_param_templ.c
blobf277b7c6c15fdd02755b9f6d934369898243179f
1 /*
2 * Copyright 2019 Cerebras Systems
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege,
7 * Cerebras Systems, 175 S San Antonio Rd, Los Altos, CA, USA
8 */
10 #define xFN(TYPE,NAME) TYPE ## _ ## NAME
11 #define FN(TYPE,NAME) xFN(TYPE,NAME)
13 /* If "obj" involves a parameter with identifier "id",
14 * then turn it into an existentially quantified variable.
16 __isl_give TYPE *FN(TYPE,project_out_param_id)(__isl_take TYPE *obj,
17 __isl_take isl_id *id)
19 int pos;
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);
28 error:
29 FN(TYPE,free)(obj);
30 isl_id_free(id);
31 return NULL;
34 /* If "obj" involves any of the parameters with identifiers in "list",
35 * then turn them into existentially quantified variables.
37 __isl_give TYPE *FN(TYPE,project_out_param_id_list)(__isl_take TYPE *obj,
38 __isl_take isl_id_list *list)
40 int i;
41 isl_size n;
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;
49 id = isl_id_list_get_at(list, i);
50 obj = FN(TYPE,project_out_param_id)(obj, id);
53 isl_id_list_free(list);
54 return obj;
55 error:
56 isl_id_list_free(list);
57 FN(TYPE,free)(obj);
58 return NULL;