/* * Copyright 2010 INRIA Saclay * Copyright 2013 Ecole Normale Superieure * * Use of this software is governed by the MIT license * * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France, * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod, * 91893 Orsay, France * and Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France */ #include <isl/hash.h> #include <isl_union_macro.h> /* A union of expressions defined over different domain spaces. * "space" describes the parameters. * The entries of "table" are keyed on the domain space of the entry * (ignoring parameters). */ struct UNION { … }; /* Return the number of base expressions in "u". */ isl_size FN(FN(UNION,n),BASE)(__isl_keep UNION *u) { … } S(UNION,foreach_data) { … }; static isl_stat FN(UNION,call_on_copy)(void **entry, void *user) { … } isl_stat FN(FN(UNION,foreach),BASE)(__isl_keep UNION *u, isl_stat (*fn)(__isl_take PART *part, void *user), void *user) { … } /* Is the domain space of "entry" equal to the domain of "space", * ignoring parameters? */ static isl_bool FN(UNION,has_same_domain_space_tuples)(const void *entry, const void *val) { … } /* Return the entry, if any, in "u" that lives in "space". * If "reserve" is set, then an entry is created if it does not exist yet. * Return NULL on error and isl_hash_table_entry_none if no entry was found. * Note that when "reserve" is set, the function will never return * isl_hash_table_entry_none. * * First look for the entry (if any) with the same domain space. * If it exists, then check if the range space also matches. */ static struct isl_hash_table_entry *FN(UNION,find_part_entry)( __isl_keep UNION *u, __isl_keep isl_space *space, int reserve) { … } /* Remove "part_entry" from the hash table of "u". */ static __isl_give UNION *FN(UNION,remove_part_entry)(__isl_take UNION *u, struct isl_hash_table_entry *part_entry) { … } /* Check that the domain of "part" is disjoint from the domain of the entries * in "u" that are defined on the same domain space, but have a different * target space. * Since a UNION with a single entry per domain space is not allowed * to contain two entries with the same domain space, there cannot be * any such other entry. */ static isl_stat FN(UNION,check_disjoint_domain_other)(__isl_keep UNION *u, __isl_keep PART *part) { … } /* Check that the domain of "part1" is disjoint from the domain of "part2". * This check is performed before "part2" is added to a UNION to ensure * that the UNION expression remains a function. * Since a UNION with a single entry per domain space is not allowed * to contain two entries with the same domain space, fail unconditionally. */ static isl_stat FN(UNION,check_disjoint_domain)(__isl_keep PART *part1, __isl_keep PART *part2) { … } /* Call "fn" on each part entry of "u". */ static isl_stat FN(UNION,foreach_inplace)(__isl_keep UNION *u, isl_stat (*fn)(void **part, void *user), void *user) { … } static isl_bool FN(PART,has_domain_space_tuples)(__isl_keep PART *part, __isl_keep isl_space *space); /* Do the tuples of "space" correspond to those of the domain of "part"? * That is, is the domain space of "part" equal to "space", ignoring parameters? */ static isl_bool FN(UNION,has_domain_space_tuples)(const void *entry, const void *val) { … } /* Call "fn" on each part of "u" that has domain space "space". * * Since each entry is defined over a different domain space, * simply look for an entry with the given domain space and * call "fn" on the corresponding part if there is one. */ isl_stat FN(UNION,foreach_on_domain)(__isl_keep UNION *u, __isl_keep isl_space *space, isl_stat (*fn)(__isl_take PART *part, void *user), void *user) { … } static isl_stat FN(UNION,free_u_entry)(void **entry, void *user) { … } #include <isl_union_templ.c>