[X86] Move getGFNICtrlMask before CTLZ/CTTZ lowering. NFC.
[llvm-project.git] / polly / lib / External / isl / isl_ast_node_set_field_templ.c
blob6eed55bbdd4264ce5c69030b23be4665ad6b9cd2
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 #define xFN(TYPE,NAME) TYPE ## _ ## NAME
11 #define FN(TYPE,NAME) xFN(TYPE,NAME)
13 /* Replace the field FIELD of "node" by "field",
14 * where the field may or may not have already been set in "node".
15 * However, if the field has not already been set,
16 * then "node" is required to have a single reference.
17 * In this case the call to isl_ast_node_cow has no effect.
19 __isl_give isl_ast_node *FN(FN(FN(isl_ast_node,NODE_TYPE),set),FIELD_NAME)(
20 __isl_take isl_ast_node *node, __isl_take FIELD_TYPE *field)
22 if (FN(isl_ast_node_check,NODE_TYPE)(node) < 0 || !field)
23 goto error;
24 if (node->FIELD == field) {
25 FN(FIELD_TYPE,free)(field);
26 return node;
29 node = isl_ast_node_cow(node);
30 if (!node)
31 goto error;
33 FN(FIELD_TYPE,free)(node->FIELD);
34 node->FIELD = field;
36 return node;
37 error:
38 isl_ast_node_free(node);
39 FN(FIELD_TYPE,free)(field);
40 return NULL;