| 1 | /* Data structures for OpenMP context selectors. This is in a separate file |
| 2 | from omp-general.h so that it may also be used in the Fortran parser |
| 3 | without reference to tree data structures. |
| 4 | |
| 5 | Copyright (C) 2023-2025 Free Software Foundation, Inc. |
| 6 | |
| 7 | This file is part of GCC. |
| 8 | |
| 9 | GCC is free software; you can redistribute it and/or modify it under |
| 10 | the terms of the GNU General Public License as published by the Free |
| 11 | Software Foundation; either version 3, or (at your option) any later |
| 12 | version. |
| 13 | |
| 14 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
| 15 | WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 16 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 17 | for more details. |
| 18 | |
| 19 | You should have received a copy of the GNU General Public License |
| 20 | along with GCC; see the file COPYING3. If not see |
| 21 | <http://www.gnu.org/licenses/>. */ |
| 22 | |
| 23 | |
| 24 | #ifndef GCC_OMP_SELECTORS_H |
| 25 | #define GCC_OMP_SELECTORS_H |
| 26 | |
| 27 | /* Trait set selector keywords. */ |
| 28 | enum omp_tss_code { |
| 29 | OMP_TRAIT_SET_CONSTRUCT, |
| 30 | OMP_TRAIT_SET_DEVICE, |
| 31 | OMP_TRAIT_SET_TARGET_DEVICE, |
| 32 | OMP_TRAIT_SET_IMPLEMENTATION, |
| 33 | OMP_TRAIT_SET_USER, |
| 34 | OMP_TRAIT_SET_LAST, |
| 35 | OMP_TRAIT_SET_INVALID = -1 |
| 36 | }; |
| 37 | |
| 38 | /* Trait selector keywords. */ |
| 39 | enum omp_ts_code { |
| 40 | OMP_TRAIT_DEVICE_KIND, |
| 41 | OMP_TRAIT_DEVICE_ISA, |
| 42 | OMP_TRAIT_DEVICE_ARCH, |
| 43 | OMP_TRAIT_DEVICE_NUM, |
| 44 | OMP_TRAIT_IMPLEMENTATION_VENDOR, |
| 45 | OMP_TRAIT_IMPLEMENTATION_EXTENSION, |
| 46 | OMP_TRAIT_IMPLEMENTATION_ADMO, |
| 47 | OMP_TRAIT_IMPLEMENTATION_REQUIRES, |
| 48 | OMP_TRAIT_IMPLEMENTATION_UNIFIED_ADDRESS, |
| 49 | OMP_TRAIT_IMPLEMENTATION_UNIFIED_SHARED_MEMORY, |
| 50 | OMP_TRAIT_IMPLEMENTATION_SELF_MAPS, |
| 51 | OMP_TRAIT_IMPLEMENTATION_DYNAMIC_ALLOCATORS, |
| 52 | OMP_TRAIT_IMPLEMENTATION_REVERSE_OFFLOAD, |
| 53 | OMP_TRAIT_USER_CONDITION, |
| 54 | OMP_TRAIT_CONSTRUCT_TARGET, |
| 55 | OMP_TRAIT_CONSTRUCT_TEAMS, |
| 56 | OMP_TRAIT_CONSTRUCT_PARALLEL, |
| 57 | OMP_TRAIT_CONSTRUCT_FOR, |
| 58 | OMP_TRAIT_CONSTRUCT_SIMD, |
| 59 | OMP_TRAIT_CONSTRUCT_DISPATCH, |
| 60 | OMP_TRAIT_LAST, |
| 61 | OMP_TRAIT_INVALID = -1 |
| 62 | }; |
| 63 | |
| 64 | /* All trait property forms. */ |
| 65 | enum omp_tp_type { |
| 66 | OMP_TRAIT_PROPERTY_NONE, |
| 67 | OMP_TRAIT_PROPERTY_ID, |
| 68 | OMP_TRAIT_PROPERTY_NAME_LIST, |
| 69 | OMP_TRAIT_PROPERTY_DEV_NUM_EXPR, |
| 70 | OMP_TRAIT_PROPERTY_BOOL_EXPR, |
| 71 | OMP_TRAIT_PROPERTY_CLAUSE_LIST, |
| 72 | OMP_TRAIT_PROPERTY_EXTENSION |
| 73 | }; |
| 74 | |
| 75 | /* Map trait set selector name keywords onto strings. */ |
| 76 | extern const char *omp_tss_map []; |
| 77 | |
| 78 | /* Map trait selector keywords onto strings, allowed contexts, and |
| 79 | allowed property names for OMP_TRAIT_PROPERTY_NAME_LIST and |
| 80 | OMP_TRAIT_PROPERTY_ID properties. If valid_properties is null, |
| 81 | it means that any required checking has to be done explicitly |
| 82 | somewhere instead of being driven by the table. Otherwise it's a |
| 83 | null-terminated array of strings. */ |
| 84 | struct omp_ts_info { |
| 85 | const char *name; |
| 86 | unsigned int tss_mask; |
| 87 | enum omp_tp_type tp_type; |
| 88 | bool allow_score; |
| 89 | const char * const *valid_properties; |
| 90 | }; |
| 91 | extern struct omp_ts_info omp_ts_map[]; |
| 92 | |
| 93 | extern enum omp_tss_code omp_lookup_tss_code (const char *); |
| 94 | extern enum omp_ts_code omp_lookup_ts_code (enum omp_tss_code, const char *); |
| 95 | |
| 96 | #endif /* GCC_OMP_SELECTORS_H */ |
| 97 | |