diff options
Diffstat (limited to 'gcc/omp-general.h')
-rw-r--r-- | gcc/omp-general.h | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/gcc/omp-general.h b/gcc/omp-general.h index 5d44ff9..37e331b 100644 --- a/gcc/omp-general.h +++ b/gcc/omp-general.h @@ -254,6 +254,92 @@ get_openacc_privatization_dump_flags () extern tree omp_build_component_ref (tree obj, tree field); +template <typename T> +struct omp_name_type +{ + tree name; + T type; +}; + +template <> +struct default_hash_traits <omp_name_type<tree> > + : typed_noop_remove <omp_name_type<tree> > +{ + GTY((skip)) typedef omp_name_type<tree> value_type; + GTY((skip)) typedef omp_name_type<tree> compare_type; + + static hashval_t + hash (omp_name_type<tree> p) + { + return p.name ? iterative_hash_expr (p.name, TYPE_UID (p.type)) + : TYPE_UID (p.type); + } + + static const bool empty_zero_p = true; + + static bool + is_empty (omp_name_type<tree> p) + { + return p.type == NULL; + } + + static bool + is_deleted (omp_name_type<tree>) + { + return false; + } + + static bool + equal (const omp_name_type<tree> &a, const omp_name_type<tree> &b) + { + if (a.name == NULL_TREE && b.name == NULL_TREE) + return a.type == b.type; + else if (a.name == NULL_TREE || b.name == NULL_TREE) + return false; + else + return a.name == b.name && a.type == b.type; + } + + static void + mark_empty (omp_name_type<tree> &e) + { + e.type = NULL; + } +}; + +template <typename T> +struct omp_mapper_list +{ + hash_set<omp_name_type<T>> *seen_types; + vec<tree> *mappers; + + omp_mapper_list (hash_set<omp_name_type<T>> *s, vec<tree> *m) + : seen_types (s), mappers (m) { } + + void add_mapper (tree name, T type, tree mapperfn) + { + /* We can't hash a NULL_TREE... */ + if (!name) + name = void_node; + + omp_name_type<T> n_t = { name, type }; + + if (seen_types->contains (n_t)) + return; + + seen_types->add (n_t); + mappers->safe_push (mapperfn); + } + + bool contains (tree name, T type) + { + if (!name) + name = void_node; + + return seen_types->contains ({ name, type }); + } +}; + namespace omp_addr_tokenizer { /* These are the ways of accessing a variable that have special-case handling |