]>
Commit | Line | Data |
---|---|---|
629b3d75 MJ |
1 | /* General types and functions that are uselful for processing of OpenMP, |
2 | OpenACC and similar directivers at various stages of compilation. | |
3 | ||
aeee4812 | 4 | Copyright (C) 2005-2023 Free Software Foundation, Inc. |
629b3d75 MJ |
5 | |
6 | This file is part of GCC. | |
7 | ||
8 | GCC is free software; you can redistribute it and/or modify it under | |
9 | the terms of the GNU General Public License as published by the Free | |
10 | Software Foundation; either version 3, or (at your option) any later | |
11 | version. | |
12 | ||
13 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
14 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 | for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with GCC; see the file COPYING3. If not see | |
20 | <http://www.gnu.org/licenses/>. */ | |
21 | ||
22 | #ifndef GCC_OMP_GENERAL_H | |
23 | #define GCC_OMP_GENERAL_H | |
24 | ||
25 | #include "gomp-constants.h" | |
26 | ||
27 | /* Flags for an OpenACC loop. */ | |
28 | ||
29 | enum oacc_loop_flags { | |
30 | OLF_SEQ = 1u << 0, /* Explicitly sequential */ | |
31 | OLF_AUTO = 1u << 1, /* Compiler chooses axes. */ | |
32 | OLF_INDEPENDENT = 1u << 2, /* Iterations are known independent. */ | |
33 | OLF_GANG_STATIC = 1u << 3, /* Gang partitioning is static (has op). */ | |
02889d23 | 34 | OLF_TILE = 1u << 4, /* Tiled loop. */ |
2b7dac2c | 35 | OLF_REDUCTION = 1u << 5, /* Reduction loop. */ |
02889d23 | 36 | |
629b3d75 | 37 | /* Explicitly specified loop axes. */ |
2b7dac2c | 38 | OLF_DIM_BASE = 6, |
629b3d75 MJ |
39 | OLF_DIM_GANG = 1u << (OLF_DIM_BASE + GOMP_DIM_GANG), |
40 | OLF_DIM_WORKER = 1u << (OLF_DIM_BASE + GOMP_DIM_WORKER), | |
41 | OLF_DIM_VECTOR = 1u << (OLF_DIM_BASE + GOMP_DIM_VECTOR), | |
42 | ||
43 | OLF_MAX = OLF_DIM_BASE + GOMP_DIM_MAX | |
44 | }; | |
45 | ||
46 | /* A structure holding the elements of: | |
1160ec9a JJ |
47 | for (V = N1; V cond N2; V += STEP) [...] |
48 | or for non-rectangular loops: | |
49 | for (V = M1 * W + N1; V cond M2 * W + N2; V += STEP; | |
50 | where W is V of the OUTER-th loop (e.g. for OUTER 1 it is the | |
aed3ab25 JJ |
51 | the index of the immediately surrounding loop). |
52 | NON_RECT_REFERENCED is true for loops referenced by loops | |
53 | with non-NULL M1 or M2. */ | |
629b3d75 MJ |
54 | |
55 | struct omp_for_data_loop | |
56 | { | |
1160ec9a | 57 | tree v, n1, n2, step, m1, m2; |
629b3d75 | 58 | enum tree_code cond_code; |
aed3ab25 JJ |
59 | int outer; |
60 | bool non_rect_referenced; | |
629b3d75 MJ |
61 | }; |
62 | ||
63 | /* A structure describing the main elements of a parallel loop. */ | |
64 | ||
65 | struct omp_for_data | |
66 | { | |
67 | struct omp_for_data_loop loop; | |
68 | tree chunk_size; | |
69 | gomp_for *for_stmt; | |
70 | tree pre, iter_type; | |
02889d23 CLT |
71 | tree tiling; /* Tiling values (if non null). */ |
72 | int collapse; /* Collapsed loops, 1 for a non-collapsed loop. */ | |
629b3d75 | 73 | int ordered; |
aed3ab25 | 74 | int first_nonrect, last_nonrect; |
28567c40 | 75 | bool have_nowait, have_ordered, simd_schedule, have_reductemp; |
2f6bb511 | 76 | bool have_pointer_condtemp, have_scantemp, have_nonctrl_scantemp; |
1160ec9a | 77 | bool non_rect; |
6c7ae8c5 | 78 | int lastprivate_conditional; |
629b3d75 MJ |
79 | unsigned char sched_modifiers; |
80 | enum omp_clause_schedule_kind sched_kind; | |
81 | struct omp_for_data_loop *loops; | |
5acef69f JJ |
82 | /* The following are relevant only for non-rectangular loops |
83 | where only a single loop depends on an outer loop iterator. */ | |
79c12969 JJ |
84 | tree first_inner_iterations; /* Number of iterations of the inner |
85 | loop with the first outer iterator | |
86 | (or adjn1, if that is non-NULL). */ | |
5acef69f | 87 | tree factor; /* (m2 - m1) * outer_step / inner_step. */ |
f418bd4b JJ |
88 | /* Adjusted n1 of the outer loop in such loop nests (if needed). */ |
89 | tree adjn1; | |
629b3d75 MJ |
90 | }; |
91 | ||
92 | #define OACC_FN_ATTRIB "oacc function" | |
93 | ||
94 | extern tree omp_find_clause (tree clauses, enum omp_clause_code kind); | |
08c14aaa | 95 | extern bool omp_is_allocatable_or_ptr (tree decl); |
a2c26c50 | 96 | extern tree omp_check_optional_argument (tree decl, bool for_present_check); |
92a5de3d | 97 | extern bool omp_mappable_type (tree type); |
22e6b327 | 98 | extern bool omp_privatize_by_reference (tree decl); |
629b3d75 | 99 | extern void omp_adjust_for_condition (location_t loc, enum tree_code *cond_code, |
031c5c8b | 100 | tree *n2, tree v, tree step); |
629b3d75 MJ |
101 | extern tree omp_get_for_step_from_incr (location_t loc, tree incr); |
102 | extern void omp_extract_for_data (gomp_for *for_stmt, struct omp_for_data *fd, | |
103 | struct omp_for_data_loop *loops); | |
104 | extern gimple *omp_build_barrier (tree lhs); | |
f1f862ae | 105 | extern tree find_combined_omp_for (tree *, int *, void *); |
9d2f08ab | 106 | extern poly_uint64 omp_max_vf (void); |
629b3d75 | 107 | extern int omp_max_simt_vf (void); |
135df52c | 108 | extern int omp_constructor_traits_to_codes (tree, enum tree_code *); |
724ee5a0 KCY |
109 | extern tree omp_check_context_selector (location_t loc, tree ctx); |
110 | extern void omp_mark_declare_variant (location_t loc, tree variant, | |
111 | tree construct); | |
135df52c | 112 | extern int omp_context_selector_matches (tree); |
917dd789 | 113 | extern int omp_context_selector_set_compare (const char *, tree, tree); |
d0c464d2 | 114 | extern tree omp_get_context_selector (tree, const char *, const char *); |
135df52c | 115 | extern tree omp_resolve_declare_variant (tree); |
629b3d75 | 116 | extern tree oacc_launch_pack (unsigned code, tree device, unsigned op); |
68034b1b | 117 | extern tree oacc_replace_fn_attrib_attr (tree attribs, tree dims); |
629b3d75 | 118 | extern void oacc_replace_fn_attrib (tree fn, tree dims); |
25651634 | 119 | extern void oacc_set_fn_attrib (tree fn, tree clauses, vec<tree> *args); |
b48f44bf TS |
120 | extern int oacc_verify_routine_clauses (tree, tree *, location_t, |
121 | const char *); | |
629b3d75 MJ |
122 | extern tree oacc_build_routine_dims (tree clauses); |
123 | extern tree oacc_get_fn_attrib (tree fn); | |
46dbeb40 | 124 | extern bool offloading_function_p (tree fn); |
629b3d75 MJ |
125 | extern int oacc_get_fn_dim_size (tree fn, int axis); |
126 | extern int oacc_get_ifn_dim_arg (const gimple *stmt); | |
127 | ||
28567c40 JJ |
128 | enum omp_requires { |
129 | OMP_REQUIRES_ATOMIC_DEFAULT_MEM_ORDER = 0xf, | |
2f0d819a TS |
130 | OMP_REQUIRES_UNIFIED_ADDRESS = GOMP_REQUIRES_UNIFIED_ADDRESS, |
131 | OMP_REQUIRES_UNIFIED_SHARED_MEMORY = GOMP_REQUIRES_UNIFIED_SHARED_MEMORY, | |
28567c40 | 132 | OMP_REQUIRES_DYNAMIC_ALLOCATORS = 0x40, |
2f0d819a | 133 | OMP_REQUIRES_REVERSE_OFFLOAD = GOMP_REQUIRES_REVERSE_OFFLOAD, |
28567c40 | 134 | OMP_REQUIRES_ATOMIC_DEFAULT_MEM_ORDER_USED = 0x100, |
2f0d819a | 135 | OMP_REQUIRES_TARGET_USED = GOMP_REQUIRES_TARGET_USED, |
28567c40 JJ |
136 | }; |
137 | ||
138 | extern GTY(()) enum omp_requires omp_requires_mask; | |
139 | ||
cb3e0eac | 140 | inline dump_flags_t |
11b8286a TS |
141 | get_openacc_privatization_dump_flags () |
142 | { | |
143 | dump_flags_t l_dump_flags = MSG_NOTE; | |
144 | ||
145 | /* For '--param=openacc-privatization=quiet', diagnostics only go to dump | |
146 | files. */ | |
147 | if (param_openacc_privatization == OPENACC_PRIVATIZATION_QUIET) | |
148 | l_dump_flags |= MSG_PRIORITY_INTERNALS; | |
149 | ||
150 | return l_dump_flags; | |
151 | } | |
152 | ||
54f74502 TS |
153 | extern tree omp_build_component_ref (tree obj, tree field); |
154 | ||
629b3d75 | 155 | #endif /* GCC_OMP_GENERAL_H */ |