File: | build/gcc/omp-low.cc |
Warning: | line 3676, column 12 Although the value stored to 'oclause' is used in the enclosing expression, the value is never actually read from 'oclause' |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* Lowering pass for OMP directives. Converts OMP directives into explicit |
2 | calls to the runtime library (libgomp), data marshalling to implement data |
3 | sharing and copying clauses, offloading to accelerators, and more. |
4 | |
5 | Contributed by Diego Novillo <dnovillo@redhat.com> |
6 | |
7 | Copyright (C) 2005-2023 Free Software Foundation, Inc. |
8 | |
9 | This file is part of GCC. |
10 | |
11 | GCC is free software; you can redistribute it and/or modify it under |
12 | the terms of the GNU General Public License as published by the Free |
13 | Software Foundation; either version 3, or (at your option) any later |
14 | version. |
15 | |
16 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
17 | WARRANTY; without even the implied warranty of MERCHANTABILITY or |
18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
19 | for more details. |
20 | |
21 | You should have received a copy of the GNU General Public License |
22 | along with GCC; see the file COPYING3. If not see |
23 | <http://www.gnu.org/licenses/>. */ |
24 | |
25 | #include "config.h" |
26 | #include "system.h" |
27 | #include "coretypes.h" |
28 | #include "backend.h" |
29 | #include "target.h" |
30 | #include "tree.h" |
31 | #include "gimple.h" |
32 | #include "tree-pass.h" |
33 | #include "ssa.h" |
34 | #include "cgraph.h" |
35 | #include "pretty-print.h" |
36 | #include "diagnostic-core.h" |
37 | #include "fold-const.h" |
38 | #include "stor-layout.h" |
39 | #include "internal-fn.h" |
40 | #include "gimple-iterator.h" |
41 | #include "gimple-fold.h" |
42 | #include "gimplify.h" |
43 | #include "gimplify-me.h" |
44 | #include "gimple-walk.h" |
45 | #include "tree-iterator.h" |
46 | #include "tree-inline.h" |
47 | #include "langhooks.h" |
48 | #include "tree-dfa.h" |
49 | #include "tree-ssa.h" |
50 | #include "splay-tree.h" |
51 | #include "omp-general.h" |
52 | #include "omp-low.h" |
53 | #include "gimple-low.h" |
54 | #include "alloc-pool.h" |
55 | #include "symbol-summary.h" |
56 | #include "tree-nested.h" |
57 | #include "context.h" |
58 | #include "gomp-constants.h" |
59 | #include "gimple-pretty-print.h" |
60 | #include "stringpool.h" |
61 | #include "attribs.h" |
62 | #include "omp-offload.h" |
63 | |
64 | /* Lowering of OMP parallel and workshare constructs proceeds in two |
65 | phases. The first phase scans the function looking for OMP statements |
66 | and then for variables that must be replaced to satisfy data sharing |
67 | clauses. The second phase expands code for the constructs, as well as |
68 | re-gimplifying things when variables have been replaced with complex |
69 | expressions. |
70 | |
71 | Final code generation is done by pass_expand_omp. The flowgraph is |
72 | scanned for regions which are then moved to a new |
73 | function, to be invoked by the thread library, or offloaded. */ |
74 | |
75 | /* Context structure. Used to store information about each parallel |
76 | directive in the code. */ |
77 | |
78 | struct omp_context |
79 | { |
80 | /* This field must be at the beginning, as we do "inheritance": Some |
81 | callback functions for tree-inline.cc (e.g., omp_copy_decl) |
82 | receive a copy_body_data pointer that is up-casted to an |
83 | omp_context pointer. */ |
84 | copy_body_data cb; |
85 | |
86 | /* The tree of contexts corresponding to the encountered constructs. */ |
87 | struct omp_context *outer; |
88 | gimple *stmt; |
89 | |
90 | /* Map variables to fields in a structure that allows communication |
91 | between sending and receiving threads. */ |
92 | splay_tree field_map; |
93 | tree record_type; |
94 | tree sender_decl; |
95 | tree receiver_decl; |
96 | |
97 | /* These are used just by task contexts, if task firstprivate fn is |
98 | needed. srecord_type is used to communicate from the thread |
99 | that encountered the task construct to task firstprivate fn, |
100 | record_type is allocated by GOMP_task, initialized by task firstprivate |
101 | fn and passed to the task body fn. */ |
102 | splay_tree sfield_map; |
103 | tree srecord_type; |
104 | |
105 | /* A chain of variables to add to the top-level block surrounding the |
106 | construct. In the case of a parallel, this is in the child function. */ |
107 | tree block_vars; |
108 | |
109 | /* Label to which GOMP_cancel{,llation_point} and explicit and implicit |
110 | barriers should jump to during omplower pass. */ |
111 | tree cancel_label; |
112 | |
113 | /* The sibling GIMPLE_OMP_FOR simd with _simt_ clause or NULL |
114 | otherwise. */ |
115 | gimple *simt_stmt; |
116 | |
117 | /* For task reductions registered in this context, a vector containing |
118 | the length of the private copies block (if constant, otherwise NULL) |
119 | and then offsets (if constant, otherwise NULL) for each entry. */ |
120 | vec<tree> task_reductions; |
121 | |
122 | /* A hash map from the reduction clauses to the registered array |
123 | elts. */ |
124 | hash_map<tree, unsigned> *task_reduction_map; |
125 | |
126 | /* And a hash map from the lastprivate(conditional:) variables to their |
127 | corresponding tracking loop iteration variables. */ |
128 | hash_map<tree, tree> *lastprivate_conditional_map; |
129 | |
130 | /* And a hash map from the allocate variables to their corresponding |
131 | allocators. */ |
132 | hash_map<tree, tree> *allocate_map; |
133 | |
134 | /* A tree_list of the reduction clauses in this context. This is |
135 | only used for checking the consistency of OpenACC reduction |
136 | clauses in scan_omp_for and is not guaranteed to contain a valid |
137 | value outside of this function. */ |
138 | tree local_reduction_clauses; |
139 | |
140 | /* A tree_list of the reduction clauses in outer contexts. This is |
141 | only used for checking the consistency of OpenACC reduction |
142 | clauses in scan_omp_for and is not guaranteed to contain a valid |
143 | value outside of this function. */ |
144 | tree outer_reduction_clauses; |
145 | |
146 | /* Nesting depth of this context. Used to beautify error messages re |
147 | invalid gotos. The outermost ctx is depth 1, with depth 0 being |
148 | reserved for the main body of the function. */ |
149 | int depth; |
150 | |
151 | /* True if this parallel directive is nested within another. */ |
152 | bool is_nested; |
153 | |
154 | /* True if this construct can be cancelled. */ |
155 | bool cancellable; |
156 | |
157 | /* True if lower_omp_1 should look up lastprivate conditional in parent |
158 | context. */ |
159 | bool combined_into_simd_safelen1; |
160 | |
161 | /* True if there is nested scan context with inclusive clause. */ |
162 | bool scan_inclusive; |
163 | |
164 | /* True if there is nested scan context with exclusive clause. */ |
165 | bool scan_exclusive; |
166 | |
167 | /* True in the second simd loop of for simd with inscan reductions. */ |
168 | bool for_simd_scan_phase; |
169 | |
170 | /* True if there is order(concurrent) clause on the construct. */ |
171 | bool order_concurrent; |
172 | |
173 | /* True if there is bind clause on the construct (i.e. a loop construct). */ |
174 | bool loop_p; |
175 | |
176 | /* Only used for omp target contexts. True if a teams construct is |
177 | strictly nested in it. */ |
178 | bool teams_nested_p; |
179 | |
180 | /* Only used for omp target contexts. True if an OpenMP construct other |
181 | than teams is strictly nested in it. */ |
182 | bool nonteams_nested_p; |
183 | |
184 | /* Candidates for adjusting OpenACC privatization level. */ |
185 | vec<tree> oacc_privatization_candidates; |
186 | }; |
187 | |
188 | static splay_tree all_contexts; |
189 | static int taskreg_nesting_level; |
190 | static int target_nesting_level; |
191 | static bitmap make_addressable_vars; |
192 | static bitmap global_nonaddressable_vars; |
193 | static vec<omp_context *> taskreg_contexts; |
194 | static vec<gomp_task *> task_cpyfns; |
195 | |
196 | static void scan_omp (gimple_seq *, omp_context *); |
197 | static tree scan_omp_1_op (tree *, int *, void *); |
198 | static bool omp_maybe_offloaded_ctx (omp_context *ctx); |
199 | |
200 | #define WALK_SUBSTMTScase GIMPLE_BIND: case GIMPLE_TRY: case GIMPLE_CATCH: case GIMPLE_EH_FILTER : case GIMPLE_ASSUME: case GIMPLE_TRANSACTION: *handled_ops_p = false; break; \ |
201 | case GIMPLE_BIND: \ |
202 | case GIMPLE_TRY: \ |
203 | case GIMPLE_CATCH: \ |
204 | case GIMPLE_EH_FILTER: \ |
205 | case GIMPLE_ASSUME: \ |
206 | case GIMPLE_TRANSACTION: \ |
207 | /* The sub-statements for these should be walked. */ \ |
208 | *handled_ops_p = false; \ |
209 | break; |
210 | |
211 | /* Return whether CTX represents an OpenACC 'parallel' or 'serial' construct. |
212 | (This doesn't include OpenACC 'kernels' decomposed parts.) */ |
213 | |
214 | static bool |
215 | is_oacc_parallel_or_serial (omp_context *ctx) |
216 | { |
217 | enum gimple_code outer_type = gimple_code (ctx->stmt); |
218 | return ((outer_type == GIMPLE_OMP_TARGET) |
219 | && ((gimple_omp_target_kind (ctx->stmt) |
220 | == GF_OMP_TARGET_KIND_OACC_PARALLEL) |
221 | || (gimple_omp_target_kind (ctx->stmt) |
222 | == GF_OMP_TARGET_KIND_OACC_SERIAL))); |
223 | } |
224 | |
225 | /* Return whether CTX represents an OpenACC 'kernels' construct. |
226 | (This doesn't include OpenACC 'kernels' decomposed parts.) */ |
227 | |
228 | static bool |
229 | is_oacc_kernels (omp_context *ctx) |
230 | { |
231 | enum gimple_code outer_type = gimple_code (ctx->stmt); |
232 | return ((outer_type == GIMPLE_OMP_TARGET) |
233 | && (gimple_omp_target_kind (ctx->stmt) |
234 | == GF_OMP_TARGET_KIND_OACC_KERNELS)); |
235 | } |
236 | |
237 | /* Return whether CTX represents an OpenACC 'kernels' decomposed part. */ |
238 | |
239 | static bool |
240 | is_oacc_kernels_decomposed_part (omp_context *ctx) |
241 | { |
242 | enum gimple_code outer_type = gimple_code (ctx->stmt); |
243 | return ((outer_type == GIMPLE_OMP_TARGET) |
244 | && ((gimple_omp_target_kind (ctx->stmt) |
245 | == GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED) |
246 | || (gimple_omp_target_kind (ctx->stmt) |
247 | == GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE) |
248 | || (gimple_omp_target_kind (ctx->stmt) |
249 | == GF_OMP_TARGET_KIND_OACC_DATA_KERNELS))); |
250 | } |
251 | |
252 | /* Return true if STMT corresponds to an OpenMP target region. */ |
253 | static bool |
254 | is_omp_target (gimple *stmt) |
255 | { |
256 | if (gimple_code (stmt) == GIMPLE_OMP_TARGET) |
257 | { |
258 | int kind = gimple_omp_target_kind (stmt); |
259 | return (kind == GF_OMP_TARGET_KIND_REGION |
260 | || kind == GF_OMP_TARGET_KIND_DATA |
261 | || kind == GF_OMP_TARGET_KIND_ENTER_DATA |
262 | || kind == GF_OMP_TARGET_KIND_EXIT_DATA); |
263 | } |
264 | return false; |
265 | } |
266 | |
267 | /* If DECL is the artificial dummy VAR_DECL created for non-static |
268 | data member privatization, return the underlying "this" parameter, |
269 | otherwise return NULL. */ |
270 | |
271 | tree |
272 | omp_member_access_dummy_var (tree decl) |
273 | { |
274 | if (!VAR_P (decl)(((enum tree_code) (decl)->base.code) == VAR_DECL) |
275 | || !DECL_ARTIFICIAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 275, __FUNCTION__))->decl_common.artificial_flag) |
276 | || !DECL_IGNORED_P (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 276, __FUNCTION__))->decl_common.ignored_flag) |
277 | || !DECL_HAS_VALUE_EXPR_P (decl)((tree_check3 ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 277, __FUNCTION__, (VAR_DECL), (PARM_DECL), (RESULT_DECL))) ->decl_common.decl_flag_2) |
278 | || !lang_hooks.decls.omp_disregard_value_expr (decl, false)) |
279 | return NULL_TREE(tree) nullptr; |
280 | |
281 | tree v = DECL_VALUE_EXPR (decl)(decl_value_expr_lookup ((contains_struct_check ((decl), (TS_DECL_WRTL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 281, __FUNCTION__)))); |
282 | if (TREE_CODE (v)((enum tree_code) (v)->base.code) != COMPONENT_REF) |
283 | return NULL_TREE(tree) nullptr; |
284 | |
285 | while (1) |
286 | switch (TREE_CODE (v)((enum tree_code) (v)->base.code)) |
287 | { |
288 | case COMPONENT_REF: |
289 | case MEM_REF: |
290 | case INDIRECT_REF: |
291 | CASE_CONVERTcase NOP_EXPR: case CONVERT_EXPR: |
292 | case POINTER_PLUS_EXPR: |
293 | v = TREE_OPERAND (v, 0)(*((const_cast<tree*> (tree_operand_check ((v), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 293, __FUNCTION__))))); |
294 | continue; |
295 | case PARM_DECL: |
296 | if (DECL_CONTEXT (v)((contains_struct_check ((v), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 296, __FUNCTION__))->decl_minimal.context) == current_function_decl |
297 | && DECL_ARTIFICIAL (v)((contains_struct_check ((v), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 297, __FUNCTION__))->decl_common.artificial_flag) |
298 | && TREE_CODE (TREE_TYPE (v))((enum tree_code) (((contains_struct_check ((v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 298, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE) |
299 | return v; |
300 | return NULL_TREE(tree) nullptr; |
301 | default: |
302 | return NULL_TREE(tree) nullptr; |
303 | } |
304 | } |
305 | |
306 | /* Helper for unshare_and_remap, called through walk_tree. */ |
307 | |
308 | static tree |
309 | unshare_and_remap_1 (tree *tp, int *walk_subtrees, void *data) |
310 | { |
311 | tree *pair = (tree *) data; |
312 | if (*tp == pair[0]) |
313 | { |
314 | *tp = unshare_expr (pair[1]); |
315 | *walk_subtrees = 0; |
316 | } |
317 | else if (IS_TYPE_OR_DECL_P (*tp)((tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) (*tp)->base.code))] == tcc_type) || (tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) (*tp)-> base.code))] == tcc_declaration))) |
318 | *walk_subtrees = 0; |
319 | return NULL_TREE(tree) nullptr; |
320 | } |
321 | |
322 | /* Return unshare_expr (X) with all occurrences of FROM |
323 | replaced with TO. */ |
324 | |
325 | static tree |
326 | unshare_and_remap (tree x, tree from, tree to) |
327 | { |
328 | tree pair[2] = { from, to }; |
329 | x = unshare_expr (x); |
330 | walk_tree (&x, unshare_and_remap_1, pair, NULL)walk_tree_1 (&x, unshare_and_remap_1, pair, nullptr, nullptr ); |
331 | return x; |
332 | } |
333 | |
334 | /* Convenience function for calling scan_omp_1_op on tree operands. */ |
335 | |
336 | static inline tree |
337 | scan_omp_op (tree *tp, omp_context *ctx) |
338 | { |
339 | struct walk_stmt_info wi; |
340 | |
341 | memset (&wi, 0, sizeof (wi)); |
342 | wi.info = ctx; |
343 | wi.want_locations = true; |
344 | |
345 | return walk_tree (tp, scan_omp_1_op, &wi, NULL)walk_tree_1 (tp, scan_omp_1_op, &wi, nullptr, nullptr); |
346 | } |
347 | |
348 | static void lower_omp (gimple_seq *, omp_context *); |
349 | static tree lookup_decl_in_outer_ctx (tree, omp_context *); |
350 | static tree maybe_lookup_decl_in_outer_ctx (tree, omp_context *); |
351 | |
352 | /* Return true if CTX is for an omp parallel. */ |
353 | |
354 | static inline bool |
355 | is_parallel_ctx (omp_context *ctx) |
356 | { |
357 | return gimple_code (ctx->stmt) == GIMPLE_OMP_PARALLEL; |
358 | } |
359 | |
360 | |
361 | /* Return true if CTX is for an omp task. */ |
362 | |
363 | static inline bool |
364 | is_task_ctx (omp_context *ctx) |
365 | { |
366 | return gimple_code (ctx->stmt) == GIMPLE_OMP_TASK; |
367 | } |
368 | |
369 | |
370 | /* Return true if CTX is for an omp taskloop. */ |
371 | |
372 | static inline bool |
373 | is_taskloop_ctx (omp_context *ctx) |
374 | { |
375 | return gimple_code (ctx->stmt) == GIMPLE_OMP_FOR |
376 | && gimple_omp_for_kind (ctx->stmt) == GF_OMP_FOR_KIND_TASKLOOP; |
377 | } |
378 | |
379 | |
380 | /* Return true if CTX is for a host omp teams. */ |
381 | |
382 | static inline bool |
383 | is_host_teams_ctx (omp_context *ctx) |
384 | { |
385 | return gimple_code (ctx->stmt) == GIMPLE_OMP_TEAMS |
386 | && gimple_omp_teams_host (as_a <gomp_teams *> (ctx->stmt)); |
387 | } |
388 | |
389 | /* Return true if CTX is for an omp parallel or omp task or host omp teams |
390 | (the last one is strictly not a task region in OpenMP speak, but we |
391 | need to treat it similarly). */ |
392 | |
393 | static inline bool |
394 | is_taskreg_ctx (omp_context *ctx) |
395 | { |
396 | return is_parallel_ctx (ctx) || is_task_ctx (ctx) || is_host_teams_ctx (ctx); |
397 | } |
398 | |
399 | /* Return true if EXPR is variable sized. */ |
400 | |
401 | static inline bool |
402 | is_variable_sized (const_tree expr) |
403 | { |
404 | return !TREE_CONSTANT (TYPE_SIZE_UNIT (TREE_TYPE (expr)))((non_type_check ((((tree_class_check ((((contains_struct_check ((expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 404, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 404, __FUNCTION__))->type_common.size_unit)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 404, __FUNCTION__))->base.constant_flag); |
405 | } |
406 | |
407 | /* Lookup variables. The "maybe" form |
408 | allows for the variable form to not have been entered, otherwise we |
409 | assert that the variable must have been entered. */ |
410 | |
411 | static inline tree |
412 | lookup_decl (tree var, omp_context *ctx) |
413 | { |
414 | tree *n = ctx->cb.decl_map->get (var); |
415 | return *n; |
416 | } |
417 | |
418 | static inline tree |
419 | maybe_lookup_decl (const_tree var, omp_context *ctx) |
420 | { |
421 | tree *n = ctx->cb.decl_map->get (const_cast<tree> (var)); |
422 | return n ? *n : NULL_TREE(tree) nullptr; |
423 | } |
424 | |
425 | static inline tree |
426 | lookup_field (tree var, omp_context *ctx) |
427 | { |
428 | splay_tree_node n; |
429 | n = splay_tree_lookup (ctx->field_map, (splay_tree_key) var); |
430 | return (tree) n->value; |
431 | } |
432 | |
433 | static inline tree |
434 | lookup_sfield (splay_tree_key key, omp_context *ctx) |
435 | { |
436 | splay_tree_node n; |
437 | n = splay_tree_lookup (ctx->sfield_map |
438 | ? ctx->sfield_map : ctx->field_map, key); |
439 | return (tree) n->value; |
440 | } |
441 | |
442 | static inline tree |
443 | lookup_sfield (tree var, omp_context *ctx) |
444 | { |
445 | return lookup_sfield ((splay_tree_key) var, ctx); |
446 | } |
447 | |
448 | static inline tree |
449 | maybe_lookup_field (splay_tree_key key, omp_context *ctx) |
450 | { |
451 | splay_tree_node n; |
452 | n = splay_tree_lookup (ctx->field_map, key); |
453 | return n ? (tree) n->value : NULL_TREE(tree) nullptr; |
454 | } |
455 | |
456 | static inline tree |
457 | maybe_lookup_field (tree var, omp_context *ctx) |
458 | { |
459 | return maybe_lookup_field ((splay_tree_key) var, ctx); |
460 | } |
461 | |
462 | /* Return true if DECL should be copied by pointer. SHARED_CTX is |
463 | the parallel context if DECL is to be shared. */ |
464 | |
465 | static bool |
466 | use_pointer_for_field (tree decl, omp_context *shared_ctx) |
467 | { |
468 | if (AGGREGATE_TYPE_P (TREE_TYPE (decl))(((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 468, __FUNCTION__))->typed.type))->base.code) == ARRAY_TYPE || (((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 468, __FUNCTION__))->typed.type))->base.code) == RECORD_TYPE || ((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 468, __FUNCTION__))->typed.type))->base.code) == UNION_TYPE || ((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 468, __FUNCTION__))->typed.type))->base.code) == QUAL_UNION_TYPE )) |
469 | || TYPE_ATOMIC (TREE_TYPE (decl))((tree_class_check ((((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 469, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 469, __FUNCTION__))->base.u.bits.atomic_flag)) |
470 | return true; |
471 | |
472 | /* We can only use copy-in/copy-out semantics for shared variables |
473 | when we know the value is not accessible from an outer scope. */ |
474 | if (shared_ctx) |
475 | { |
476 | gcc_assert (!is_gimple_omp_oacc (shared_ctx->stmt))((void)(!(!is_gimple_omp_oacc (shared_ctx->stmt)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 476, __FUNCTION__), 0 : 0)); |
477 | |
478 | /* ??? Trivially accessible from anywhere. But why would we even |
479 | be passing an address in this case? Should we simply assert |
480 | this to be false, or should we have a cleanup pass that removes |
481 | these from the list of mappings? */ |
482 | if (is_global_var (maybe_lookup_decl_in_outer_ctx (decl, shared_ctx))) |
483 | return true; |
484 | |
485 | /* For variables with DECL_HAS_VALUE_EXPR_P set, we cannot tell |
486 | without analyzing the expression whether or not its location |
487 | is accessible to anyone else. In the case of nested parallel |
488 | regions it certainly may be. */ |
489 | if (TREE_CODE (decl)((enum tree_code) (decl)->base.code) != RESULT_DECL && DECL_HAS_VALUE_EXPR_P (decl)((tree_check3 ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 489, __FUNCTION__, (VAR_DECL), (PARM_DECL), (RESULT_DECL))) ->decl_common.decl_flag_2)) |
490 | return true; |
491 | |
492 | /* Do not use copy-in/copy-out for variables that have their |
493 | address taken. */ |
494 | if (is_global_var (decl)) |
495 | { |
496 | /* For file scope vars, track whether we've seen them as |
497 | non-addressable initially and in that case, keep the same |
498 | answer for the duration of the pass, even when they are made |
499 | addressable later on e.g. through reduction expansion. Global |
500 | variables which weren't addressable before the pass will not |
501 | have their privatized copies address taken. See PR91216. */ |
502 | if (!TREE_ADDRESSABLE (decl)((decl)->base.addressable_flag)) |
503 | { |
504 | if (!global_nonaddressable_vars) |
505 | global_nonaddressable_vars = BITMAP_ALLOCbitmap_alloc (NULLnullptr); |
506 | bitmap_set_bit (global_nonaddressable_vars, DECL_UID (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 506, __FUNCTION__))->decl_minimal.uid)); |
507 | } |
508 | else if (!global_nonaddressable_vars |
509 | || !bitmap_bit_p (global_nonaddressable_vars, |
510 | DECL_UID (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 510, __FUNCTION__))->decl_minimal.uid))) |
511 | return true; |
512 | } |
513 | else if (TREE_ADDRESSABLE (decl)((decl)->base.addressable_flag)) |
514 | return true; |
515 | |
516 | /* lower_send_shared_vars only uses copy-in, but not copy-out |
517 | for these. */ |
518 | if (TREE_READONLY (decl)((non_type_check ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 518, __FUNCTION__))->base.readonly_flag) |
519 | || ((TREE_CODE (decl)((enum tree_code) (decl)->base.code) == RESULT_DECL |
520 | || TREE_CODE (decl)((enum tree_code) (decl)->base.code) == PARM_DECL) |
521 | && DECL_BY_REFERENCE (decl)((tree_check3 ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 521, __FUNCTION__, (VAR_DECL), (PARM_DECL), (RESULT_DECL))) ->decl_common.decl_by_reference_flag))) |
522 | return false; |
523 | |
524 | /* Disallow copy-in/out in nested parallel if |
525 | decl is shared in outer parallel, otherwise |
526 | each thread could store the shared variable |
527 | in its own copy-in location, making the |
528 | variable no longer really shared. */ |
529 | if (shared_ctx->is_nested) |
530 | { |
531 | omp_context *up; |
532 | |
533 | for (up = shared_ctx->outer; up; up = up->outer) |
534 | if ((is_taskreg_ctx (up) |
535 | || (gimple_code (up->stmt) == GIMPLE_OMP_TARGET |
536 | && is_gimple_omp_offloaded (up->stmt))) |
537 | && maybe_lookup_decl (decl, up)) |
538 | break; |
539 | |
540 | if (up) |
541 | { |
542 | tree c; |
543 | |
544 | if (gimple_code (up->stmt) == GIMPLE_OMP_TARGET) |
545 | { |
546 | for (c = gimple_omp_target_clauses (up->stmt); |
547 | c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 547, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 547, __FUNCTION__))->common.chain)) |
548 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 548, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_MAP |
549 | && OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 549, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 549, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 549, __FUNCTION__))) == decl) |
550 | break; |
551 | } |
552 | else |
553 | for (c = gimple_omp_taskreg_clauses (up->stmt); |
554 | c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 554, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 554, __FUNCTION__))->common.chain)) |
555 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 555, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_SHARED |
556 | && OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 556, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 556, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 556, __FUNCTION__))) == decl) |
557 | break; |
558 | |
559 | if (c) |
560 | goto maybe_mark_addressable_and_ret; |
561 | } |
562 | } |
563 | |
564 | /* For tasks avoid using copy-in/out. As tasks can be |
565 | deferred or executed in different thread, when GOMP_task |
566 | returns, the task hasn't necessarily terminated. */ |
567 | if (is_task_ctx (shared_ctx)) |
568 | { |
569 | tree outer; |
570 | maybe_mark_addressable_and_ret: |
571 | outer = maybe_lookup_decl_in_outer_ctx (decl, shared_ctx); |
572 | if (is_gimple_reg (outer) && !omp_member_access_dummy_var (outer)) |
573 | { |
574 | /* Taking address of OUTER in lower_send_shared_vars |
575 | might need regimplification of everything that uses the |
576 | variable. */ |
577 | if (!make_addressable_vars) |
578 | make_addressable_vars = BITMAP_ALLOCbitmap_alloc (NULLnullptr); |
579 | bitmap_set_bit (make_addressable_vars, DECL_UID (outer)((contains_struct_check ((outer), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 579, __FUNCTION__))->decl_minimal.uid)); |
580 | TREE_ADDRESSABLE (outer)((outer)->base.addressable_flag) = 1; |
581 | } |
582 | return true; |
583 | } |
584 | } |
585 | |
586 | return false; |
587 | } |
588 | |
589 | /* Construct a new automatic decl similar to VAR. */ |
590 | |
591 | static tree |
592 | omp_copy_decl_2 (tree var, tree name, tree type, omp_context *ctx) |
593 | { |
594 | tree copy = copy_var_decl (var, name, type); |
595 | |
596 | DECL_CONTEXT (copy)((contains_struct_check ((copy), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 596, __FUNCTION__))->decl_minimal.context) = current_function_decl; |
597 | |
598 | if (ctx) |
599 | { |
600 | DECL_CHAIN (copy)(((contains_struct_check (((contains_struct_check ((copy), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 600, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 600, __FUNCTION__))->common.chain)) = ctx->block_vars; |
601 | ctx->block_vars = copy; |
602 | } |
603 | else |
604 | record_vars (copy); |
605 | |
606 | /* If VAR is listed in make_addressable_vars, it wasn't |
607 | originally addressable, but was only later made so. |
608 | We don't need to take address of privatizations |
609 | from that var. */ |
610 | if (TREE_ADDRESSABLE (var)((var)->base.addressable_flag) |
611 | && ((make_addressable_vars |
612 | && bitmap_bit_p (make_addressable_vars, DECL_UID (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 612, __FUNCTION__))->decl_minimal.uid))) |
613 | || (global_nonaddressable_vars |
614 | && bitmap_bit_p (global_nonaddressable_vars, DECL_UID (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 614, __FUNCTION__))->decl_minimal.uid))))) |
615 | TREE_ADDRESSABLE (copy)((copy)->base.addressable_flag) = 0; |
616 | |
617 | return copy; |
618 | } |
619 | |
620 | static tree |
621 | omp_copy_decl_1 (tree var, omp_context *ctx) |
622 | { |
623 | return omp_copy_decl_2 (var, DECL_NAME (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 623, __FUNCTION__))->decl_minimal.name), TREE_TYPE (var)((contains_struct_check ((var), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 623, __FUNCTION__))->typed.type), ctx); |
624 | } |
625 | |
626 | /* Build tree nodes to access the field for VAR on the receiver side. */ |
627 | |
628 | static tree |
629 | build_receiver_ref (tree var, bool by_ref, omp_context *ctx) |
630 | { |
631 | tree x, field = lookup_field (var, ctx); |
632 | |
633 | /* If the receiver record type was remapped in the child function, |
634 | remap the field into the new record type. */ |
635 | x = maybe_lookup_field (field, ctx); |
636 | if (x != NULLnullptr) |
637 | field = x; |
638 | |
639 | x = build_simple_mem_ref (ctx->receiver_decl)build_simple_mem_ref_loc (((location_t) 0), ctx->receiver_decl ); |
640 | TREE_THIS_NOTRAP (x)((tree_check5 ((x), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 640, __FUNCTION__, (INDIRECT_REF), (MEM_REF), (TARGET_MEM_REF ), (ARRAY_REF), (ARRAY_RANGE_REF)))->base.nothrow_flag) = 1; |
641 | x = omp_build_component_ref (x, field); |
642 | if (by_ref) |
643 | { |
644 | x = build_simple_mem_ref (x)build_simple_mem_ref_loc (((location_t) 0), x); |
645 | TREE_THIS_NOTRAP (x)((tree_check5 ((x), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 645, __FUNCTION__, (INDIRECT_REF), (MEM_REF), (TARGET_MEM_REF ), (ARRAY_REF), (ARRAY_RANGE_REF)))->base.nothrow_flag) = 1; |
646 | } |
647 | |
648 | return x; |
649 | } |
650 | |
651 | /* Build tree nodes to access VAR in the scope outer to CTX. In the case |
652 | of a parallel, this is a component reference; for workshare constructs |
653 | this is some variable. */ |
654 | |
655 | static tree |
656 | build_outer_var_ref (tree var, omp_context *ctx, |
657 | enum omp_clause_code code = OMP_CLAUSE_ERROR) |
658 | { |
659 | tree x; |
660 | omp_context *outer = ctx->outer; |
661 | for (; outer; outer = outer->outer) |
662 | { |
663 | if (gimple_code (outer->stmt) == GIMPLE_OMP_TASKGROUP) |
664 | continue; |
665 | if (gimple_code (outer->stmt) == GIMPLE_OMP_SCOPE |
666 | && !maybe_lookup_decl (var, outer)) |
667 | continue; |
668 | break; |
669 | } |
670 | |
671 | if (is_global_var (maybe_lookup_decl_in_outer_ctx (var, ctx))) |
672 | x = var; |
673 | else if (is_variable_sized (var)) |
674 | { |
675 | x = TREE_OPERAND (DECL_VALUE_EXPR (var), 0)(*((const_cast<tree*> (tree_operand_check (((decl_value_expr_lookup ((contains_struct_check ((var), (TS_DECL_WRTL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 675, __FUNCTION__))))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 675, __FUNCTION__))))); |
676 | x = build_outer_var_ref (x, ctx, code); |
677 | x = build_simple_mem_ref (x)build_simple_mem_ref_loc (((location_t) 0), x); |
678 | } |
679 | else if (is_taskreg_ctx (ctx)) |
680 | { |
681 | bool by_ref = use_pointer_for_field (var, NULLnullptr); |
682 | x = build_receiver_ref (var, by_ref, ctx); |
683 | } |
684 | else if ((gimple_code (ctx->stmt) == GIMPLE_OMP_FOR |
685 | && gimple_omp_for_kind (ctx->stmt) == GF_OMP_FOR_KIND_SIMD) |
686 | || ctx->loop_p |
687 | || code == OMP_CLAUSE_ALLOCATE |
688 | || (code == OMP_CLAUSE_PRIVATE |
689 | && (gimple_code (ctx->stmt) == GIMPLE_OMP_FOR |
690 | || gimple_code (ctx->stmt) == GIMPLE_OMP_SECTIONS |
691 | || gimple_code (ctx->stmt) == GIMPLE_OMP_SINGLE))) |
692 | { |
693 | /* #pragma omp simd isn't a worksharing construct, and can reference |
694 | even private vars in its linear etc. clauses. |
695 | Similarly for OMP_CLAUSE_PRIVATE with outer ref, that can refer |
696 | to private vars in all worksharing constructs. */ |
697 | x = NULL_TREE(tree) nullptr; |
698 | if (outer && is_taskreg_ctx (outer)) |
699 | x = lookup_decl (var, outer); |
700 | else if (outer) |
701 | x = maybe_lookup_decl_in_outer_ctx (var, ctx); |
702 | if (x == NULL_TREE(tree) nullptr) |
703 | x = var; |
704 | } |
705 | else if (code == OMP_CLAUSE_LASTPRIVATE && is_taskloop_ctx (ctx)) |
706 | { |
707 | gcc_assert (outer)((void)(!(outer) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 707, __FUNCTION__), 0 : 0)); |
708 | splay_tree_node n |
709 | = splay_tree_lookup (outer->field_map, |
710 | (splay_tree_key) &DECL_UID (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 710, __FUNCTION__))->decl_minimal.uid)); |
711 | if (n == NULLnullptr) |
712 | { |
713 | if (is_global_var (maybe_lookup_decl_in_outer_ctx (var, outer))) |
714 | x = var; |
715 | else |
716 | x = lookup_decl (var, outer); |
717 | } |
718 | else |
719 | { |
720 | tree field = (tree) n->value; |
721 | /* If the receiver record type was remapped in the child function, |
722 | remap the field into the new record type. */ |
723 | x = maybe_lookup_field (field, outer); |
724 | if (x != NULLnullptr) |
725 | field = x; |
726 | |
727 | x = build_simple_mem_ref (outer->receiver_decl)build_simple_mem_ref_loc (((location_t) 0), outer->receiver_decl ); |
728 | x = omp_build_component_ref (x, field); |
729 | if (use_pointer_for_field (var, outer)) |
730 | x = build_simple_mem_ref (x)build_simple_mem_ref_loc (((location_t) 0), x); |
731 | } |
732 | } |
733 | else if (outer) |
734 | x = lookup_decl (var, outer); |
735 | else if (omp_privatize_by_reference (var)) |
736 | /* This can happen with orphaned constructs. If var is reference, it is |
737 | possible it is shared and as such valid. */ |
738 | x = var; |
739 | else if (omp_member_access_dummy_var (var)) |
740 | x = var; |
741 | else |
742 | gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 742, __FUNCTION__)); |
743 | |
744 | if (x == var) |
745 | { |
746 | tree t = omp_member_access_dummy_var (var); |
747 | if (t) |
748 | { |
749 | x = DECL_VALUE_EXPR (var)(decl_value_expr_lookup ((contains_struct_check ((var), (TS_DECL_WRTL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 749, __FUNCTION__)))); |
750 | tree o = maybe_lookup_decl_in_outer_ctx (t, ctx); |
751 | if (o != t) |
752 | x = unshare_and_remap (x, t, o); |
753 | else |
754 | x = unshare_expr (x); |
755 | } |
756 | } |
757 | |
758 | if (omp_privatize_by_reference (var)) |
759 | x = build_simple_mem_ref (x)build_simple_mem_ref_loc (((location_t) 0), x); |
760 | |
761 | return x; |
762 | } |
763 | |
764 | /* Build tree nodes to access the field for VAR on the sender side. */ |
765 | |
766 | static tree |
767 | build_sender_ref (splay_tree_key key, omp_context *ctx) |
768 | { |
769 | tree field = lookup_sfield (key, ctx); |
770 | return omp_build_component_ref (ctx->sender_decl, field); |
771 | } |
772 | |
773 | static tree |
774 | build_sender_ref (tree var, omp_context *ctx) |
775 | { |
776 | return build_sender_ref ((splay_tree_key) var, ctx); |
777 | } |
778 | |
779 | /* Add a new field for VAR inside the structure CTX->SENDER_DECL. If |
780 | BASE_POINTERS_RESTRICT, declare the field with restrict. */ |
781 | |
782 | static void |
783 | install_var_field (tree var, bool by_ref, int mask, omp_context *ctx) |
784 | { |
785 | tree field, type, sfield = NULL_TREE(tree) nullptr; |
786 | splay_tree_key key = (splay_tree_key) var; |
787 | |
788 | if ((mask & 16) != 0) |
789 | { |
790 | key = (splay_tree_key) &DECL_NAME (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 790, __FUNCTION__))->decl_minimal.name); |
791 | gcc_checking_assert (key != (splay_tree_key) var)((void)(!(key != (splay_tree_key) var) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 791, __FUNCTION__), 0 : 0)); |
792 | } |
793 | if ((mask & 8) != 0) |
794 | { |
795 | key = (splay_tree_key) &DECL_UID (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 795, __FUNCTION__))->decl_minimal.uid); |
796 | gcc_checking_assert (key != (splay_tree_key) var)((void)(!(key != (splay_tree_key) var) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 796, __FUNCTION__), 0 : 0)); |
797 | } |
798 | gcc_assert ((mask & 1) == 0((void)(!((mask & 1) == 0 || !splay_tree_lookup (ctx-> field_map, key)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 799, __FUNCTION__), 0 : 0)) |
799 | || !splay_tree_lookup (ctx->field_map, key))((void)(!((mask & 1) == 0 || !splay_tree_lookup (ctx-> field_map, key)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 799, __FUNCTION__), 0 : 0)); |
800 | gcc_assert ((mask & 2) == 0 || !ctx->sfield_map((void)(!((mask & 2) == 0 || !ctx->sfield_map || !splay_tree_lookup (ctx->sfield_map, key)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 801, __FUNCTION__), 0 : 0)) |
801 | || !splay_tree_lookup (ctx->sfield_map, key))((void)(!((mask & 2) == 0 || !ctx->sfield_map || !splay_tree_lookup (ctx->sfield_map, key)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 801, __FUNCTION__), 0 : 0)); |
802 | gcc_assert ((mask & 3) == 3((void)(!((mask & 3) == 3 || !is_gimple_omp_oacc (ctx-> stmt)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 803, __FUNCTION__), 0 : 0)) |
803 | || !is_gimple_omp_oacc (ctx->stmt))((void)(!((mask & 3) == 3 || !is_gimple_omp_oacc (ctx-> stmt)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 803, __FUNCTION__), 0 : 0)); |
804 | |
805 | type = TREE_TYPE (var)((contains_struct_check ((var), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 805, __FUNCTION__))->typed.type); |
806 | if ((mask & 16) != 0) |
807 | type = lang_hooks.decls.omp_array_data (var, true); |
808 | |
809 | /* Prevent redeclaring the var in the split-off function with a restrict |
810 | pointer type. Note that we only clear type itself, restrict qualifiers in |
811 | the pointed-to type will be ignored by points-to analysis. */ |
812 | if (POINTER_TYPE_P (type)(((enum tree_code) (type)->base.code) == POINTER_TYPE || ( (enum tree_code) (type)->base.code) == REFERENCE_TYPE) |
813 | && TYPE_RESTRICT (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 813, __FUNCTION__))->type_common.restrict_flag)) |
814 | type = build_qualified_type (type, TYPE_QUALS (type)((int) ((((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 814, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST ) | (((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 814, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE ) | (((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 814, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC ) | (((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 814, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT ) | (((((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 814, __FUNCTION__))->base.u.bits.address_space) & 0xFF ) << 8)))) & ~TYPE_QUAL_RESTRICT); |
815 | |
816 | if (mask & 4) |
817 | { |
818 | gcc_assert (TREE_CODE (type) == ARRAY_TYPE)((void)(!(((enum tree_code) (type)->base.code) == ARRAY_TYPE ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 818, __FUNCTION__), 0 : 0)); |
819 | type = build_pointer_type (build_pointer_type (type)); |
820 | } |
821 | else if (by_ref) |
822 | type = build_pointer_type (type); |
823 | else if ((mask & (32 | 3)) == 1 |
824 | && omp_privatize_by_reference (var)) |
825 | type = TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 825, __FUNCTION__))->typed.type); |
826 | |
827 | field = build_decl (DECL_SOURCE_LOCATION (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 827, __FUNCTION__))->decl_minimal.locus), |
828 | FIELD_DECL, DECL_NAME (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 828, __FUNCTION__))->decl_minimal.name), type); |
829 | |
830 | /* Remember what variable this field was created for. This does have a |
831 | side effect of making dwarf2out ignore this member, so for helpful |
832 | debugging we clear it later in delete_omp_context. */ |
833 | DECL_ABSTRACT_ORIGIN (field)((contains_struct_check ((field), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 833, __FUNCTION__))->decl_common.abstract_origin) = var; |
834 | if ((mask & 16) == 0 && type == TREE_TYPE (var)((contains_struct_check ((var), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 834, __FUNCTION__))->typed.type)) |
835 | { |
836 | SET_DECL_ALIGN (field, DECL_ALIGN (var))(((contains_struct_check ((field), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 836, __FUNCTION__))->decl_common.align) = ffs_hwi ((((contains_struct_check ((var), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 836, __FUNCTION__))->decl_common.align) ? ((unsigned)1) << (((contains_struct_check ((var), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 836, __FUNCTION__))->decl_common.align) - 1) : 0))); |
837 | DECL_USER_ALIGN (field)((contains_struct_check ((field), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 837, __FUNCTION__))->base.u.bits.user_align) = DECL_USER_ALIGN (var)((contains_struct_check ((var), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 837, __FUNCTION__))->base.u.bits.user_align); |
838 | TREE_THIS_VOLATILE (field)((field)->base.volatile_flag) = TREE_THIS_VOLATILE (var)((var)->base.volatile_flag); |
839 | } |
840 | else |
841 | SET_DECL_ALIGN (field, TYPE_ALIGN (type))(((contains_struct_check ((field), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 841, __FUNCTION__))->decl_common.align) = ffs_hwi ((((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 841, __FUNCTION__))->type_common.align) ? ((unsigned)1) << (((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 841, __FUNCTION__))->type_common.align) - 1) : 0))); |
842 | |
843 | if ((mask & 3) == 3) |
844 | { |
845 | insert_field_into_struct (ctx->record_type, field); |
846 | if (ctx->srecord_type) |
847 | { |
848 | sfield = build_decl (DECL_SOURCE_LOCATION (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 848, __FUNCTION__))->decl_minimal.locus), |
849 | FIELD_DECL, DECL_NAME (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 849, __FUNCTION__))->decl_minimal.name), type); |
850 | DECL_ABSTRACT_ORIGIN (sfield)((contains_struct_check ((sfield), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 850, __FUNCTION__))->decl_common.abstract_origin) = var; |
851 | SET_DECL_ALIGN (sfield, DECL_ALIGN (field))(((contains_struct_check ((sfield), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 851, __FUNCTION__))->decl_common.align) = ffs_hwi ((((contains_struct_check ((field), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 851, __FUNCTION__))->decl_common.align) ? ((unsigned)1) << (((contains_struct_check ((field), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 851, __FUNCTION__))->decl_common.align) - 1) : 0))); |
852 | DECL_USER_ALIGN (sfield)((contains_struct_check ((sfield), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 852, __FUNCTION__))->base.u.bits.user_align) = DECL_USER_ALIGN (field)((contains_struct_check ((field), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 852, __FUNCTION__))->base.u.bits.user_align); |
853 | TREE_THIS_VOLATILE (sfield)((sfield)->base.volatile_flag) = TREE_THIS_VOLATILE (field)((field)->base.volatile_flag); |
854 | insert_field_into_struct (ctx->srecord_type, sfield); |
855 | } |
856 | } |
857 | else |
858 | { |
859 | if (ctx->srecord_type == NULL_TREE(tree) nullptr) |
860 | { |
861 | tree t; |
862 | |
863 | ctx->srecord_type = lang_hooks.types.make_type (RECORD_TYPE); |
864 | ctx->sfield_map = splay_tree_new (splay_tree_compare_pointers, 0, 0); |
865 | for (t = TYPE_FIELDS (ctx->record_type)((tree_check3 ((ctx->record_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 865, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); t ; t = TREE_CHAIN (t)((contains_struct_check ((t), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 865, __FUNCTION__))->common.chain)) |
866 | { |
867 | sfield = build_decl (DECL_SOURCE_LOCATION (t)((contains_struct_check ((t), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 867, __FUNCTION__))->decl_minimal.locus), |
868 | FIELD_DECL, DECL_NAME (t)((contains_struct_check ((t), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 868, __FUNCTION__))->decl_minimal.name), TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 868, __FUNCTION__))->typed.type)); |
869 | DECL_ABSTRACT_ORIGIN (sfield)((contains_struct_check ((sfield), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 869, __FUNCTION__))->decl_common.abstract_origin) = DECL_ABSTRACT_ORIGIN (t)((contains_struct_check ((t), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 869, __FUNCTION__))->decl_common.abstract_origin); |
870 | insert_field_into_struct (ctx->srecord_type, sfield); |
871 | splay_tree_insert (ctx->sfield_map, |
872 | (splay_tree_key) DECL_ABSTRACT_ORIGIN (t)((contains_struct_check ((t), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 872, __FUNCTION__))->decl_common.abstract_origin), |
873 | (splay_tree_value) sfield); |
874 | } |
875 | } |
876 | sfield = field; |
877 | insert_field_into_struct ((mask & 1) ? ctx->record_type |
878 | : ctx->srecord_type, field); |
879 | } |
880 | |
881 | if (mask & 1) |
882 | splay_tree_insert (ctx->field_map, key, (splay_tree_value) field); |
883 | if ((mask & 2) && ctx->sfield_map) |
884 | splay_tree_insert (ctx->sfield_map, key, (splay_tree_value) sfield); |
885 | } |
886 | |
887 | static tree |
888 | install_var_local (tree var, omp_context *ctx) |
889 | { |
890 | tree new_var = omp_copy_decl_1 (var, ctx); |
891 | insert_decl_map (&ctx->cb, var, new_var); |
892 | return new_var; |
893 | } |
894 | |
895 | /* Adjust the replacement for DECL in CTX for the new context. This means |
896 | copying the DECL_VALUE_EXPR, and fixing up the type. */ |
897 | |
898 | static void |
899 | fixup_remapped_decl (tree decl, omp_context *ctx, bool private_debug) |
900 | { |
901 | tree new_decl, size; |
902 | |
903 | new_decl = lookup_decl (decl, ctx); |
904 | |
905 | TREE_TYPE (new_decl)((contains_struct_check ((new_decl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 905, __FUNCTION__))->typed.type) = remap_type (TREE_TYPE (decl)((contains_struct_check ((decl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 905, __FUNCTION__))->typed.type), &ctx->cb); |
906 | |
907 | if ((!TREE_CONSTANT (DECL_SIZE (new_decl))((non_type_check ((((contains_struct_check ((new_decl), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 907, __FUNCTION__))->decl_common.size)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 907, __FUNCTION__))->base.constant_flag) || private_debug) |
908 | && DECL_HAS_VALUE_EXPR_P (decl)((tree_check3 ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 908, __FUNCTION__, (VAR_DECL), (PARM_DECL), (RESULT_DECL))) ->decl_common.decl_flag_2)) |
909 | { |
910 | tree ve = DECL_VALUE_EXPR (decl)(decl_value_expr_lookup ((contains_struct_check ((decl), (TS_DECL_WRTL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 910, __FUNCTION__)))); |
911 | walk_tree (&ve, copy_tree_body_r, &ctx->cb, NULL)walk_tree_1 (&ve, copy_tree_body_r, &ctx->cb, nullptr , nullptr); |
912 | SET_DECL_VALUE_EXPR (new_decl, ve)(decl_value_expr_insert ((contains_struct_check ((new_decl), ( TS_DECL_WRTL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 912, __FUNCTION__)), ve)); |
913 | DECL_HAS_VALUE_EXPR_P (new_decl)((tree_check3 ((new_decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 913, __FUNCTION__, (VAR_DECL), (PARM_DECL), (RESULT_DECL))) ->decl_common.decl_flag_2) = 1; |
914 | } |
915 | |
916 | if (!TREE_CONSTANT (DECL_SIZE (new_decl))((non_type_check ((((contains_struct_check ((new_decl), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 916, __FUNCTION__))->decl_common.size)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 916, __FUNCTION__))->base.constant_flag)) |
917 | { |
918 | size = remap_decl (DECL_SIZE (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 918, __FUNCTION__))->decl_common.size), &ctx->cb); |
919 | if (size == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
920 | size = TYPE_SIZE (TREE_TYPE (new_decl))((tree_class_check ((((contains_struct_check ((new_decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 920, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 920, __FUNCTION__))->type_common.size); |
921 | DECL_SIZE (new_decl)((contains_struct_check ((new_decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 921, __FUNCTION__))->decl_common.size) = size; |
922 | |
923 | size = remap_decl (DECL_SIZE_UNIT (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 923, __FUNCTION__))->decl_common.size_unit), &ctx->cb); |
924 | if (size == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
925 | size = TYPE_SIZE_UNIT (TREE_TYPE (new_decl))((tree_class_check ((((contains_struct_check ((new_decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 925, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 925, __FUNCTION__))->type_common.size_unit); |
926 | DECL_SIZE_UNIT (new_decl)((contains_struct_check ((new_decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 926, __FUNCTION__))->decl_common.size_unit) = size; |
927 | } |
928 | } |
929 | |
930 | /* The callback for remap_decl. Search all containing contexts for a |
931 | mapping of the variable; this avoids having to duplicate the splay |
932 | tree ahead of time. We know a mapping doesn't already exist in the |
933 | given context. Create new mappings to implement default semantics. */ |
934 | |
935 | static tree |
936 | omp_copy_decl (tree var, copy_body_data *cb) |
937 | { |
938 | omp_context *ctx = (omp_context *) cb; |
939 | tree new_var; |
940 | |
941 | if (TREE_CODE (var)((enum tree_code) (var)->base.code) == LABEL_DECL) |
942 | { |
943 | if (FORCED_LABEL (var)((tree_check ((var), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 943, __FUNCTION__, (LABEL_DECL)))->base.side_effects_flag ) || DECL_NONLOCAL (var)((contains_struct_check ((var), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 943, __FUNCTION__))->decl_common.nonlocal_flag)) |
944 | return var; |
945 | new_var = create_artificial_label (DECL_SOURCE_LOCATION (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 945, __FUNCTION__))->decl_minimal.locus)); |
946 | DECL_CONTEXT (new_var)((contains_struct_check ((new_var), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 946, __FUNCTION__))->decl_minimal.context) = current_function_decl; |
947 | insert_decl_map (&ctx->cb, var, new_var); |
948 | return new_var; |
949 | } |
950 | |
951 | while (!is_taskreg_ctx (ctx)) |
952 | { |
953 | ctx = ctx->outer; |
954 | if (ctx == NULLnullptr) |
955 | return var; |
956 | new_var = maybe_lookup_decl (var, ctx); |
957 | if (new_var) |
958 | return new_var; |
959 | } |
960 | |
961 | if (is_global_var (var) || decl_function_context (var) != ctx->cb.src_fn) |
962 | return var; |
963 | |
964 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
965 | } |
966 | |
967 | /* Create a new context, with OUTER_CTX being the surrounding context. */ |
968 | |
969 | static omp_context * |
970 | new_omp_context (gimple *stmt, omp_context *outer_ctx) |
971 | { |
972 | omp_context *ctx = XCNEW (omp_context)((omp_context *) xcalloc (1, sizeof (omp_context))); |
973 | |
974 | splay_tree_insert (all_contexts, (splay_tree_key) stmt, |
975 | (splay_tree_value) ctx); |
976 | ctx->stmt = stmt; |
977 | |
978 | if (outer_ctx) |
979 | { |
980 | ctx->outer = outer_ctx; |
981 | ctx->cb = outer_ctx->cb; |
982 | ctx->cb.block = NULLnullptr; |
983 | ctx->depth = outer_ctx->depth + 1; |
984 | } |
985 | else |
986 | { |
987 | ctx->cb.src_fn = current_function_decl; |
988 | ctx->cb.dst_fn = current_function_decl; |
989 | ctx->cb.src_node = cgraph_node::get (current_function_decl); |
990 | gcc_checking_assert (ctx->cb.src_node)((void)(!(ctx->cb.src_node) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 990, __FUNCTION__), 0 : 0)); |
991 | ctx->cb.dst_node = ctx->cb.src_node; |
992 | ctx->cb.src_cfun = cfun(cfun + 0); |
993 | ctx->cb.copy_decl = omp_copy_decl; |
994 | ctx->cb.eh_lp_nr = 0; |
995 | ctx->cb.transform_call_graph_edges = CB_CGE_MOVE; |
996 | ctx->cb.adjust_array_error_bounds = true; |
997 | ctx->cb.dont_remap_vla_if_no_change = true; |
998 | ctx->depth = 1; |
999 | } |
1000 | |
1001 | ctx->cb.decl_map = new hash_map<tree, tree>; |
1002 | |
1003 | return ctx; |
1004 | } |
1005 | |
1006 | static gimple_seq maybe_catch_exception (gimple_seq); |
1007 | |
1008 | /* Finalize task copyfn. */ |
1009 | |
1010 | static void |
1011 | finalize_task_copyfn (gomp_task *task_stmt) |
1012 | { |
1013 | struct function *child_cfun; |
1014 | tree child_fn; |
1015 | gimple_seq seq = NULLnullptr, new_seq; |
1016 | gbind *bind; |
1017 | |
1018 | child_fn = gimple_omp_task_copy_fn (task_stmt); |
1019 | if (child_fn == NULL_TREE(tree) nullptr) |
1020 | return; |
1021 | |
1022 | child_cfun = DECL_STRUCT_FUNCTION (child_fn)((tree_check ((child_fn), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1022, __FUNCTION__, (FUNCTION_DECL)))->function_decl.f); |
1023 | DECL_STRUCT_FUNCTION (child_fn)((tree_check ((child_fn), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1023, __FUNCTION__, (FUNCTION_DECL)))->function_decl.f)->curr_properties = cfun(cfun + 0)->curr_properties; |
1024 | |
1025 | push_cfun (child_cfun); |
1026 | bind = gimplify_body (child_fn, false); |
1027 | gimple_seq_add_stmt (&seq, bind); |
1028 | new_seq = maybe_catch_exception (seq); |
1029 | if (new_seq != seq) |
1030 | { |
1031 | bind = gimple_build_bind (NULLnullptr, new_seq, NULLnullptr); |
1032 | seq = NULLnullptr; |
1033 | gimple_seq_add_stmt (&seq, bind); |
1034 | } |
1035 | gimple_set_body (child_fn, seq); |
1036 | pop_cfun (); |
1037 | |
1038 | /* Inform the callgraph about the new function. */ |
1039 | cgraph_node *node = cgraph_node::get_create (child_fn); |
1040 | node->parallelized_function = 1; |
1041 | cgraph_node::add_new_function (child_fn, false); |
1042 | } |
1043 | |
1044 | /* Destroy a omp_context data structures. Called through the splay tree |
1045 | value delete callback. */ |
1046 | |
1047 | static void |
1048 | delete_omp_context (splay_tree_value value) |
1049 | { |
1050 | omp_context *ctx = (omp_context *) value; |
1051 | |
1052 | delete ctx->cb.decl_map; |
1053 | |
1054 | if (ctx->field_map) |
1055 | splay_tree_delete (ctx->field_map); |
1056 | if (ctx->sfield_map) |
1057 | splay_tree_delete (ctx->sfield_map); |
1058 | |
1059 | /* We hijacked DECL_ABSTRACT_ORIGIN earlier. We need to clear it before |
1060 | it produces corrupt debug information. */ |
1061 | if (ctx->record_type) |
1062 | { |
1063 | tree t; |
1064 | for (t = TYPE_FIELDS (ctx->record_type)((tree_check3 ((ctx->record_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1064, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); t ; t = DECL_CHAIN (t)(((contains_struct_check (((contains_struct_check ((t), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1064, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1064, __FUNCTION__))->common.chain))) |
1065 | DECL_ABSTRACT_ORIGIN (t)((contains_struct_check ((t), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1065, __FUNCTION__))->decl_common.abstract_origin) = NULLnullptr; |
1066 | } |
1067 | if (ctx->srecord_type) |
1068 | { |
1069 | tree t; |
1070 | for (t = TYPE_FIELDS (ctx->srecord_type)((tree_check3 ((ctx->srecord_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1070, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); t ; t = DECL_CHAIN (t)(((contains_struct_check (((contains_struct_check ((t), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1070, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1070, __FUNCTION__))->common.chain))) |
1071 | DECL_ABSTRACT_ORIGIN (t)((contains_struct_check ((t), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1071, __FUNCTION__))->decl_common.abstract_origin) = NULLnullptr; |
1072 | } |
1073 | |
1074 | if (ctx->task_reduction_map) |
1075 | { |
1076 | ctx->task_reductions.release (); |
1077 | delete ctx->task_reduction_map; |
1078 | } |
1079 | |
1080 | delete ctx->lastprivate_conditional_map; |
1081 | delete ctx->allocate_map; |
1082 | |
1083 | XDELETE (ctx)free ((void*) (ctx)); |
1084 | } |
1085 | |
1086 | /* Fix up RECEIVER_DECL with a type that has been remapped to the child |
1087 | context. */ |
1088 | |
1089 | static void |
1090 | fixup_child_record_type (omp_context *ctx) |
1091 | { |
1092 | tree f, type = ctx->record_type; |
1093 | |
1094 | if (!ctx->receiver_decl) |
1095 | return; |
1096 | /* ??? It isn't sufficient to just call remap_type here, because |
1097 | variably_modified_type_p doesn't work the way we expect for |
1098 | record types. Testing each field for whether it needs remapping |
1099 | and creating a new record by hand works, however. */ |
1100 | for (f = TYPE_FIELDS (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1100, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); f ; f = DECL_CHAIN (f)(((contains_struct_check (((contains_struct_check ((f), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1100, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1100, __FUNCTION__))->common.chain))) |
1101 | if (variably_modified_type_p (TREE_TYPE (f)((contains_struct_check ((f), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1101, __FUNCTION__))->typed.type), ctx->cb.src_fn)) |
1102 | break; |
1103 | if (f) |
1104 | { |
1105 | tree name, new_fields = NULLnullptr; |
1106 | |
1107 | type = lang_hooks.types.make_type (RECORD_TYPE); |
1108 | name = DECL_NAME (TYPE_NAME (ctx->record_type))((contains_struct_check ((((tree_class_check ((ctx->record_type ), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1108, __FUNCTION__))->type_common.name)), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1108, __FUNCTION__))->decl_minimal.name); |
1109 | name = build_decl (DECL_SOURCE_LOCATION (ctx->receiver_decl)((contains_struct_check ((ctx->receiver_decl), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1109, __FUNCTION__))->decl_minimal.locus), |
1110 | TYPE_DECL, name, type); |
1111 | TYPE_NAME (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1111, __FUNCTION__))->type_common.name) = name; |
1112 | |
1113 | for (f = TYPE_FIELDS (ctx->record_type)((tree_check3 ((ctx->record_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1113, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); f ; f = DECL_CHAIN (f)(((contains_struct_check (((contains_struct_check ((f), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1113, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1113, __FUNCTION__))->common.chain))) |
1114 | { |
1115 | tree new_f = copy_node (f); |
1116 | DECL_CONTEXT (new_f)((contains_struct_check ((new_f), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1116, __FUNCTION__))->decl_minimal.context) = type; |
1117 | TREE_TYPE (new_f)((contains_struct_check ((new_f), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1117, __FUNCTION__))->typed.type) = remap_type (TREE_TYPE (f)((contains_struct_check ((f), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1117, __FUNCTION__))->typed.type), &ctx->cb); |
1118 | DECL_CHAIN (new_f)(((contains_struct_check (((contains_struct_check ((new_f), ( TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1118, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1118, __FUNCTION__))->common.chain)) = new_fields; |
1119 | walk_tree (&DECL_SIZE (new_f), copy_tree_body_r, &ctx->cb, NULL)walk_tree_1 (&((contains_struct_check ((new_f), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1119, __FUNCTION__))->decl_common.size), copy_tree_body_r , &ctx->cb, nullptr, nullptr); |
1120 | walk_tree (&DECL_SIZE_UNIT (new_f), copy_tree_body_r,walk_tree_1 (&((contains_struct_check ((new_f), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1120, __FUNCTION__))->decl_common.size_unit), copy_tree_body_r , &ctx->cb, nullptr, nullptr) |
1121 | &ctx->cb, NULL)walk_tree_1 (&((contains_struct_check ((new_f), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1120, __FUNCTION__))->decl_common.size_unit), copy_tree_body_r , &ctx->cb, nullptr, nullptr); |
1122 | walk_tree (&DECL_FIELD_OFFSET (new_f), copy_tree_body_r,walk_tree_1 (&((tree_check ((new_f), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1122, __FUNCTION__, (FIELD_DECL)))->field_decl.offset), copy_tree_body_r , &ctx->cb, nullptr, nullptr) |
1123 | &ctx->cb, NULL)walk_tree_1 (&((tree_check ((new_f), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1122, __FUNCTION__, (FIELD_DECL)))->field_decl.offset), copy_tree_body_r , &ctx->cb, nullptr, nullptr); |
1124 | new_fields = new_f; |
1125 | |
1126 | /* Arrange to be able to look up the receiver field |
1127 | given the sender field. */ |
1128 | splay_tree_insert (ctx->field_map, (splay_tree_key) f, |
1129 | (splay_tree_value) new_f); |
1130 | } |
1131 | TYPE_FIELDS (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1131, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values) = nreverse (new_fields); |
1132 | layout_type (type); |
1133 | } |
1134 | |
1135 | /* In a target region we never modify any of the pointers in *.omp_data_i, |
1136 | so attempt to help the optimizers. */ |
1137 | if (is_gimple_omp_offloaded (ctx->stmt)) |
1138 | type = build_qualified_type (type, TYPE_QUAL_CONST); |
1139 | |
1140 | TREE_TYPE (ctx->receiver_decl)((contains_struct_check ((ctx->receiver_decl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1140, __FUNCTION__))->typed.type) |
1141 | = build_qualified_type (build_reference_type (type), TYPE_QUAL_RESTRICT); |
1142 | } |
1143 | |
1144 | /* Instantiate decls as necessary in CTX to satisfy the data sharing |
1145 | specified by CLAUSES. */ |
1146 | |
1147 | static void |
1148 | scan_sharing_clauses (tree clauses, omp_context *ctx) |
1149 | { |
1150 | tree c, decl; |
1151 | bool scan_array_reductions = false; |
1152 | |
1153 | for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1153, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1153, __FUNCTION__))->common.chain)) |
1154 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1154, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_ALLOCATE |
1155 | && (OMP_CLAUSE_ALLOCATE_ALLOCATOR (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_ALLOCATE ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1155, __FUNCTION__))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1155, __FUNCTION__))) == NULL_TREE(tree) nullptr |
1156 | /* omp_default_mem_alloc is 1 */ |
1157 | || !integer_onep (OMP_CLAUSE_ALLOCATE_ALLOCATOR (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_ALLOCATE ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1157, __FUNCTION__))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1157, __FUNCTION__)))) |
1158 | || OMP_CLAUSE_ALLOCATE_ALIGN (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_ALLOCATE ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1158, __FUNCTION__))), (2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1158, __FUNCTION__))) != NULL_TREE(tree) nullptr)) |
1159 | { |
1160 | /* The allocate clauses that appear on a target construct or on |
1161 | constructs in a target region must specify an allocator expression |
1162 | unless a requires directive with the dynamic_allocators clause |
1163 | is present in the same compilation unit. */ |
1164 | if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_ALLOCATE ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1164, __FUNCTION__))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1164, __FUNCTION__))) == NULL_TREE(tree) nullptr |
1165 | && ((omp_requires_mask & OMP_REQUIRES_DYNAMIC_ALLOCATORS) == 0) |
1166 | && omp_maybe_offloaded_ctx (ctx)) |
1167 | error_at (OMP_CLAUSE_LOCATION (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1167, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, "%<allocate%> clause must" |
1168 | " specify an allocator here"); |
1169 | if (ctx->allocate_map == NULLnullptr) |
1170 | ctx->allocate_map = new hash_map<tree, tree>; |
1171 | tree val = integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]; |
1172 | if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_ALLOCATE ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1172, __FUNCTION__))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1172, __FUNCTION__)))) |
1173 | val = OMP_CLAUSE_ALLOCATE_ALLOCATOR (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_ALLOCATE ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1173, __FUNCTION__))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1173, __FUNCTION__))); |
1174 | if (OMP_CLAUSE_ALLOCATE_ALIGN (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_ALLOCATE ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1174, __FUNCTION__))), (2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1174, __FUNCTION__)))) |
1175 | val = build_tree_list (val, OMP_CLAUSE_ALLOCATE_ALIGN (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_ALLOCATE ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1175, __FUNCTION__))), (2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1175, __FUNCTION__)))); |
1176 | ctx->allocate_map->put (OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1176, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1176, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1176, __FUNCTION__))), val); |
1177 | } |
1178 | |
1179 | for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1179, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1179, __FUNCTION__))->common.chain)) |
1180 | { |
1181 | bool by_ref; |
1182 | |
1183 | switch (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1183, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code) |
1184 | { |
1185 | case OMP_CLAUSE_PRIVATE: |
1186 | decl = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1186, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1186, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1186, __FUNCTION__))); |
1187 | if (OMP_CLAUSE_PRIVATE_OUTER_REF (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_PRIVATE), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1187, __FUNCTION__)))->base.private_flag)) |
1188 | goto do_private; |
1189 | else if (!is_variable_sized (decl)) |
1190 | install_var_local (decl, ctx); |
1191 | break; |
1192 | |
1193 | case OMP_CLAUSE_SHARED: |
1194 | decl = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1194, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1194, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1194, __FUNCTION__))); |
1195 | if (ctx->allocate_map && ctx->allocate_map->get (decl)) |
1196 | ctx->allocate_map->remove (decl); |
1197 | /* Ignore shared directives in teams construct inside of |
1198 | target construct. */ |
1199 | if (gimple_code (ctx->stmt) == GIMPLE_OMP_TEAMS |
1200 | && !is_host_teams_ctx (ctx)) |
1201 | { |
1202 | /* Global variables don't need to be copied, |
1203 | the receiver side will use them directly. */ |
1204 | tree odecl = maybe_lookup_decl_in_outer_ctx (decl, ctx); |
1205 | if (is_global_var (odecl)) |
1206 | break; |
1207 | insert_decl_map (&ctx->cb, decl, odecl); |
1208 | break; |
1209 | } |
1210 | gcc_assert (is_taskreg_ctx (ctx))((void)(!(is_taskreg_ctx (ctx)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1210, __FUNCTION__), 0 : 0)); |
1211 | gcc_assert (!COMPLETE_TYPE_P (TREE_TYPE (decl))((void)(!(!(((tree_class_check ((((contains_struct_check ((decl ), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1211, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1211, __FUNCTION__))->type_common.size) != (tree) nullptr ) || !is_variable_sized (decl)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1212, __FUNCTION__), 0 : 0)) |
1212 | || !is_variable_sized (decl))((void)(!(!(((tree_class_check ((((contains_struct_check ((decl ), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1211, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1211, __FUNCTION__))->type_common.size) != (tree) nullptr ) || !is_variable_sized (decl)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1212, __FUNCTION__), 0 : 0)); |
1213 | /* Global variables don't need to be copied, |
1214 | the receiver side will use them directly. */ |
1215 | if (is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx))) |
1216 | break; |
1217 | if (OMP_CLAUSE_SHARED_FIRSTPRIVATE (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_SHARED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1217, __FUNCTION__))->base.public_flag)) |
1218 | { |
1219 | use_pointer_for_field (decl, ctx); |
1220 | break; |
1221 | } |
1222 | by_ref = use_pointer_for_field (decl, NULLnullptr); |
1223 | if ((! TREE_READONLY (decl)((non_type_check ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1223, __FUNCTION__))->base.readonly_flag) && !OMP_CLAUSE_SHARED_READONLY (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_SHARED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1223, __FUNCTION__)))->base.private_flag)) |
1224 | || TREE_ADDRESSABLE (decl)((decl)->base.addressable_flag) |
1225 | || by_ref |
1226 | || omp_privatize_by_reference (decl)) |
1227 | { |
1228 | by_ref = use_pointer_for_field (decl, ctx); |
1229 | install_var_field (decl, by_ref, 3, ctx); |
1230 | install_var_local (decl, ctx); |
1231 | break; |
1232 | } |
1233 | /* We don't need to copy const scalar vars back. */ |
1234 | OMP_CLAUSE_SET_CODE (c, OMP_CLAUSE_FIRSTPRIVATE)(((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1234, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code = ( OMP_CLAUSE_FIRSTPRIVATE)); |
1235 | goto do_private; |
1236 | |
1237 | case OMP_CLAUSE_REDUCTION: |
1238 | /* Collect 'reduction' clauses on OpenACC compute construct. */ |
1239 | if (is_gimple_omp_oacc (ctx->stmt) |
1240 | && is_gimple_omp_offloaded (ctx->stmt)) |
1241 | { |
1242 | /* No 'reduction' clauses on OpenACC 'kernels'. */ |
1243 | gcc_checking_assert (!is_oacc_kernels (ctx))((void)(!(!is_oacc_kernels (ctx)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1243, __FUNCTION__), 0 : 0)); |
1244 | /* Likewise, on OpenACC 'kernels' decomposed parts. */ |
1245 | gcc_checking_assert (!is_oacc_kernels_decomposed_part (ctx))((void)(!(!is_oacc_kernels_decomposed_part (ctx)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1245, __FUNCTION__), 0 : 0)); |
1246 | |
1247 | ctx->local_reduction_clauses |
1248 | = tree_cons (NULLnullptr, c, ctx->local_reduction_clauses); |
1249 | } |
1250 | /* FALLTHRU */ |
1251 | |
1252 | case OMP_CLAUSE_IN_REDUCTION: |
1253 | decl = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1253, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1253, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1253, __FUNCTION__))); |
1254 | if (ctx->allocate_map |
1255 | && ((OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1255, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_REDUCTION |
1256 | && (OMP_CLAUSE_REDUCTION_INSCAN (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1256, __FUNCTION__)))->base.private_flag) |
1257 | || OMP_CLAUSE_REDUCTION_TASK (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1257, __FUNCTION__)))->base.protected_flag))) |
1258 | || OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1258, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_IN_REDUCTION |
1259 | || is_task_ctx (ctx))) |
1260 | { |
1261 | /* For now. */ |
1262 | if (ctx->allocate_map->get (decl)) |
1263 | ctx->allocate_map->remove (decl); |
1264 | } |
1265 | if (TREE_CODE (decl)((enum tree_code) (decl)->base.code) == MEM_REF) |
1266 | { |
1267 | tree t = TREE_OPERAND (decl, 0)(*((const_cast<tree*> (tree_operand_check ((decl), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1267, __FUNCTION__))))); |
1268 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) == POINTER_PLUS_EXPR) |
1269 | t = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1269, __FUNCTION__))))); |
1270 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) == INDIRECT_REF |
1271 | || TREE_CODE (t)((enum tree_code) (t)->base.code) == ADDR_EXPR) |
1272 | t = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1272, __FUNCTION__))))); |
1273 | if (is_omp_target (ctx->stmt)) |
1274 | { |
1275 | if (is_variable_sized (t)) |
1276 | { |
1277 | gcc_assert (DECL_HAS_VALUE_EXPR_P (t))((void)(!(((tree_check3 ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1277, __FUNCTION__, (VAR_DECL), (PARM_DECL), (RESULT_DECL)) ) ->decl_common.decl_flag_2)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1277, __FUNCTION__), 0 : 0)); |
1278 | t = DECL_VALUE_EXPR (t)(decl_value_expr_lookup ((contains_struct_check ((t), (TS_DECL_WRTL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1278, __FUNCTION__)))); |
1279 | gcc_assert (TREE_CODE (t) == INDIRECT_REF)((void)(!(((enum tree_code) (t)->base.code) == INDIRECT_REF ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1279, __FUNCTION__), 0 : 0)); |
1280 | t = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1280, __FUNCTION__))))); |
1281 | gcc_assert (DECL_P (t))((void)(!((tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) (t)->base.code))] == tcc_declaration) ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1281, __FUNCTION__), 0 : 0)); |
1282 | } |
1283 | tree at = t; |
1284 | if (ctx->outer) |
1285 | scan_omp_op (&at, ctx->outer); |
1286 | tree nt = omp_copy_decl_1 (at, ctx->outer); |
1287 | splay_tree_insert (ctx->field_map, |
1288 | (splay_tree_key) &DECL_CONTEXT (t)((contains_struct_check ((t), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1288, __FUNCTION__))->decl_minimal.context), |
1289 | (splay_tree_value) nt); |
1290 | if (at != t) |
1291 | splay_tree_insert (ctx->field_map, |
1292 | (splay_tree_key) &DECL_CONTEXT (at)((contains_struct_check ((at), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1292, __FUNCTION__))->decl_minimal.context), |
1293 | (splay_tree_value) nt); |
1294 | break; |
1295 | } |
1296 | install_var_local (t, ctx); |
1297 | if (is_taskreg_ctx (ctx) |
1298 | && (!is_global_var (maybe_lookup_decl_in_outer_ctx (t, ctx)) |
1299 | || (is_task_ctx (ctx) |
1300 | && (TREE_CODE (TREE_TYPE (t))((enum tree_code) (((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1300, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE |
1301 | || (TREE_CODE (TREE_TYPE (t))((enum tree_code) (((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1301, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE |
1302 | && (TREE_CODE (TREE_TYPE (TREE_TYPE (t)))((enum tree_code) (((contains_struct_check ((((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1302, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1302, __FUNCTION__))->typed.type))->base.code) |
1303 | == POINTER_TYPE))))) |
1304 | && !is_variable_sized (t) |
1305 | && (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1305, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code != OMP_CLAUSE_REDUCTION |
1306 | || (!OMP_CLAUSE_REDUCTION_TASK (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1306, __FUNCTION__)))->base.protected_flag) |
1307 | && !is_task_ctx (ctx)))) |
1308 | { |
1309 | by_ref = use_pointer_for_field (t, NULLnullptr); |
1310 | if (is_task_ctx (ctx) |
1311 | && TREE_CODE (TREE_TYPE (t))((enum tree_code) (((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1311, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE |
1312 | && TREE_CODE (TREE_TYPE (TREE_TYPE (t)))((enum tree_code) (((contains_struct_check ((((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1312, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1312, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE) |
1313 | { |
1314 | install_var_field (t, false, 1, ctx); |
1315 | install_var_field (t, by_ref, 2, ctx); |
1316 | } |
1317 | else |
1318 | install_var_field (t, by_ref, 3, ctx); |
1319 | } |
1320 | break; |
1321 | } |
1322 | if (is_omp_target (ctx->stmt)) |
1323 | { |
1324 | tree at = decl; |
1325 | if (ctx->outer) |
1326 | scan_omp_op (&at, ctx->outer); |
1327 | tree nt = omp_copy_decl_1 (at, ctx->outer); |
1328 | splay_tree_insert (ctx->field_map, |
1329 | (splay_tree_key) &DECL_CONTEXT (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1329, __FUNCTION__))->decl_minimal.context), |
1330 | (splay_tree_value) nt); |
1331 | if (at != decl) |
1332 | splay_tree_insert (ctx->field_map, |
1333 | (splay_tree_key) &DECL_CONTEXT (at)((contains_struct_check ((at), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1333, __FUNCTION__))->decl_minimal.context), |
1334 | (splay_tree_value) nt); |
1335 | break; |
1336 | } |
1337 | if (is_task_ctx (ctx) |
1338 | || (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1338, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_REDUCTION |
1339 | && OMP_CLAUSE_REDUCTION_TASK (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1339, __FUNCTION__)))->base.protected_flag) |
1340 | && is_parallel_ctx (ctx))) |
1341 | { |
1342 | /* Global variables don't need to be copied, |
1343 | the receiver side will use them directly. */ |
1344 | if (!is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx))) |
1345 | { |
1346 | by_ref = use_pointer_for_field (decl, ctx); |
1347 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1347, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_IN_REDUCTION) |
1348 | install_var_field (decl, by_ref, 3, ctx); |
1349 | } |
1350 | install_var_local (decl, ctx); |
1351 | break; |
1352 | } |
1353 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1353, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_REDUCTION |
1354 | && OMP_CLAUSE_REDUCTION_TASK (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1354, __FUNCTION__)))->base.protected_flag)) |
1355 | { |
1356 | install_var_local (decl, ctx); |
1357 | break; |
1358 | } |
1359 | goto do_private; |
1360 | |
1361 | case OMP_CLAUSE_LASTPRIVATE: |
1362 | /* Let the corresponding firstprivate clause create |
1363 | the variable. */ |
1364 | if (OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_LASTPRIVATE), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1364, __FUNCTION__))->base.public_flag)) |
1365 | break; |
1366 | /* FALLTHRU */ |
1367 | |
1368 | case OMP_CLAUSE_FIRSTPRIVATE: |
1369 | case OMP_CLAUSE_LINEAR: |
1370 | decl = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1370, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1370, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1370, __FUNCTION__))); |
1371 | do_private: |
1372 | if ((OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1372, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_FIRSTPRIVATE |
1373 | || OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1373, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_IS_DEVICE_PTR |
1374 | || OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1374, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_HAS_DEVICE_ADDR) |
1375 | && is_gimple_omp_offloaded (ctx->stmt)) |
1376 | { |
1377 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1377, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_FIRSTPRIVATE |
1378 | || (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1378, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_HAS_DEVICE_ADDR |
1379 | && lang_hooks.decls.omp_array_data (decl, true))) |
1380 | { |
1381 | by_ref = !omp_privatize_by_reference (decl); |
1382 | install_var_field (decl, by_ref, 3, ctx); |
1383 | } |
1384 | else if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1384, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_HAS_DEVICE_ADDR) |
1385 | { |
1386 | if (TREE_CODE (decl)((enum tree_code) (decl)->base.code) == INDIRECT_REF) |
1387 | decl = TREE_OPERAND (decl, 0)(*((const_cast<tree*> (tree_operand_check ((decl), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1387, __FUNCTION__))))); |
1388 | install_var_field (decl, true, 3, ctx); |
1389 | } |
1390 | else if (TREE_CODE (TREE_TYPE (decl))((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1390, __FUNCTION__))->typed.type))->base.code) == ARRAY_TYPE) |
1391 | install_var_field (decl, true, 3, ctx); |
1392 | else |
1393 | install_var_field (decl, false, 3, ctx); |
1394 | } |
1395 | if (is_variable_sized (decl)) |
1396 | { |
1397 | if (is_task_ctx (ctx)) |
1398 | { |
1399 | if (ctx->allocate_map |
1400 | && OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1400, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_FIRSTPRIVATE) |
1401 | { |
1402 | /* For now. */ |
1403 | if (ctx->allocate_map->get (decl)) |
1404 | ctx->allocate_map->remove (decl); |
1405 | } |
1406 | install_var_field (decl, false, 1, ctx); |
1407 | } |
1408 | break; |
1409 | } |
1410 | else if (is_taskreg_ctx (ctx)) |
1411 | { |
1412 | bool global |
1413 | = is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx)); |
1414 | by_ref = use_pointer_for_field (decl, NULLnullptr); |
1415 | |
1416 | if (is_task_ctx (ctx) |
1417 | && (global || by_ref || omp_privatize_by_reference (decl))) |
1418 | { |
1419 | if (ctx->allocate_map |
1420 | && ctx->allocate_map->get (decl)) |
1421 | install_var_field (decl, by_ref, 32 | 1, ctx); |
1422 | else |
1423 | install_var_field (decl, false, 1, ctx); |
1424 | if (!global) |
1425 | install_var_field (decl, by_ref, 2, ctx); |
1426 | } |
1427 | else if (!global) |
1428 | install_var_field (decl, by_ref, 3, ctx); |
1429 | } |
1430 | install_var_local (decl, ctx); |
1431 | /* For descr arrays on target: firstprivatize data + attach ptr. */ |
1432 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1432, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_FIRSTPRIVATE |
1433 | && is_gimple_omp_offloaded (ctx->stmt) |
1434 | && !is_gimple_omp_oacc (ctx->stmt) |
1435 | && lang_hooks.decls.omp_array_data (decl, true)) |
1436 | { |
1437 | install_var_field (decl, false, 16 | 3, ctx); |
1438 | install_var_field (decl, true, 8 | 3, ctx); |
1439 | } |
1440 | break; |
1441 | |
1442 | case OMP_CLAUSE_USE_DEVICE_PTR: |
1443 | case OMP_CLAUSE_USE_DEVICE_ADDR: |
1444 | decl = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1444, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1444, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1444, __FUNCTION__))); |
1445 | |
1446 | /* Fortran array descriptors. */ |
1447 | if (lang_hooks.decls.omp_array_data (decl, true)) |
1448 | install_var_field (decl, false, 19, ctx); |
1449 | else if ((OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1449, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_USE_DEVICE_ADDR |
1450 | && !omp_privatize_by_reference (decl) |
1451 | && !omp_is_allocatable_or_ptr (decl)) |
1452 | || TREE_CODE (TREE_TYPE (decl))((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1452, __FUNCTION__))->typed.type))->base.code) == ARRAY_TYPE) |
1453 | install_var_field (decl, true, 11, ctx); |
1454 | else |
1455 | install_var_field (decl, false, 11, ctx); |
1456 | if (DECL_SIZE (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1456, __FUNCTION__))->decl_common.size) |
1457 | && TREE_CODE (DECL_SIZE (decl))((enum tree_code) (((contains_struct_check ((decl), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1457, __FUNCTION__))->decl_common.size))->base.code) != INTEGER_CST) |
1458 | { |
1459 | tree decl2 = DECL_VALUE_EXPR (decl)(decl_value_expr_lookup ((contains_struct_check ((decl), (TS_DECL_WRTL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1459, __FUNCTION__)))); |
1460 | gcc_assert (TREE_CODE (decl2) == INDIRECT_REF)((void)(!(((enum tree_code) (decl2)->base.code) == INDIRECT_REF ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1460, __FUNCTION__), 0 : 0)); |
1461 | decl2 = TREE_OPERAND (decl2, 0)(*((const_cast<tree*> (tree_operand_check ((decl2), (0) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1461, __FUNCTION__))))); |
1462 | gcc_assert (DECL_P (decl2))((void)(!((tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) (decl2)->base.code))] == tcc_declaration )) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1462, __FUNCTION__), 0 : 0)); |
1463 | install_var_local (decl2, ctx); |
1464 | } |
1465 | install_var_local (decl, ctx); |
1466 | break; |
1467 | |
1468 | case OMP_CLAUSE_HAS_DEVICE_ADDR: |
1469 | decl = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1469, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1469, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1469, __FUNCTION__))); |
1470 | while (TREE_CODE (decl)((enum tree_code) (decl)->base.code) == INDIRECT_REF |
1471 | || TREE_CODE (decl)((enum tree_code) (decl)->base.code) == ARRAY_REF) |
1472 | decl = TREE_OPERAND (decl, 0)(*((const_cast<tree*> (tree_operand_check ((decl), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1472, __FUNCTION__))))); |
1473 | goto do_private; |
1474 | |
1475 | case OMP_CLAUSE_IS_DEVICE_PTR: |
1476 | decl = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1476, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1476, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1476, __FUNCTION__))); |
1477 | goto do_private; |
1478 | |
1479 | case OMP_CLAUSE__LOOPTEMP_: |
1480 | case OMP_CLAUSE__REDUCTEMP_: |
1481 | gcc_assert (is_taskreg_ctx (ctx))((void)(!(is_taskreg_ctx (ctx)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1481, __FUNCTION__), 0 : 0)); |
1482 | decl = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1482, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1482, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1482, __FUNCTION__))); |
1483 | install_var_field (decl, false, 3, ctx); |
1484 | install_var_local (decl, ctx); |
1485 | break; |
1486 | |
1487 | case OMP_CLAUSE_COPYPRIVATE: |
1488 | case OMP_CLAUSE_COPYIN: |
1489 | decl = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1489, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1489, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1489, __FUNCTION__))); |
1490 | by_ref = use_pointer_for_field (decl, NULLnullptr); |
1491 | install_var_field (decl, by_ref, 3, ctx); |
1492 | break; |
1493 | |
1494 | case OMP_CLAUSE_FINAL: |
1495 | case OMP_CLAUSE_IF: |
1496 | case OMP_CLAUSE_NUM_THREADS: |
1497 | case OMP_CLAUSE_NUM_TEAMS: |
1498 | case OMP_CLAUSE_THREAD_LIMIT: |
1499 | case OMP_CLAUSE_DEVICE: |
1500 | case OMP_CLAUSE_SCHEDULE: |
1501 | case OMP_CLAUSE_DIST_SCHEDULE: |
1502 | case OMP_CLAUSE_DEPEND: |
1503 | case OMP_CLAUSE_PRIORITY: |
1504 | case OMP_CLAUSE_GRAINSIZE: |
1505 | case OMP_CLAUSE_NUM_TASKS: |
1506 | case OMP_CLAUSE_NUM_GANGS: |
1507 | case OMP_CLAUSE_NUM_WORKERS: |
1508 | case OMP_CLAUSE_VECTOR_LENGTH: |
1509 | case OMP_CLAUSE_DETACH: |
1510 | case OMP_CLAUSE_FILTER: |
1511 | if (ctx->outer) |
1512 | scan_omp_op (&OMP_CLAUSE_OPERAND (c, 0)(*(omp_clause_elt_check ((c), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1512, __FUNCTION__))), ctx->outer); |
1513 | break; |
1514 | |
1515 | case OMP_CLAUSE_TO: |
1516 | case OMP_CLAUSE_FROM: |
1517 | case OMP_CLAUSE_MAP: |
1518 | if (ctx->outer) |
1519 | scan_omp_op (&OMP_CLAUSE_SIZE (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1519, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_FROM), (OMP_CLAUSE__CACHE_ ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1519, __FUNCTION__))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1519, __FUNCTION__))), ctx->outer); |
1520 | decl = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1520, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1520, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1520, __FUNCTION__))); |
1521 | /* If requested, make 'decl' addressable. */ |
1522 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1522, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_MAP |
1523 | && OMP_CLAUSE_MAP_DECL_MAKE_ADDRESSABLE (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1523, __FUNCTION__))->base.addressable_flag)) |
1524 | { |
1525 | gcc_checking_assert (DECL_P (decl))((void)(!((tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) (decl)->base.code))] == tcc_declaration )) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1525, __FUNCTION__), 0 : 0)); |
1526 | |
1527 | bool decl_addressable = TREE_ADDRESSABLE (decl)((decl)->base.addressable_flag); |
1528 | if (!decl_addressable) |
1529 | { |
1530 | if (!make_addressable_vars) |
1531 | make_addressable_vars = BITMAP_ALLOCbitmap_alloc (NULLnullptr); |
1532 | bitmap_set_bit (make_addressable_vars, DECL_UID (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1532, __FUNCTION__))->decl_minimal.uid)); |
1533 | TREE_ADDRESSABLE (decl)((decl)->base.addressable_flag) = 1; |
1534 | } |
1535 | |
1536 | if (dump_enabled_p ()) |
1537 | { |
1538 | location_t loc = OMP_CLAUSE_LOCATION (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1538, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus; |
1539 | const dump_user_location_t d_u_loc |
1540 | = dump_user_location_t::from_location_t (loc); |
1541 | /* PR100695 "Format decoder, quoting in 'dump_printf' etc." */ |
1542 | #if __GNUC__4 >= 10 |
1543 | # pragma GCC diagnostic push |
1544 | # pragma GCC diagnostic ignored "-Wformat" |
1545 | #endif |
1546 | if (!decl_addressable) |
1547 | dump_printf_loc (MSG_NOTE, d_u_loc, |
1548 | "variable %<%T%>" |
1549 | " made addressable\n", |
1550 | decl); |
1551 | else |
1552 | dump_printf_loc (MSG_NOTE, d_u_loc, |
1553 | "variable %<%T%>" |
1554 | " already made addressable\n", |
1555 | decl); |
1556 | #if __GNUC__4 >= 10 |
1557 | # pragma GCC diagnostic pop |
1558 | #endif |
1559 | } |
1560 | |
1561 | /* Done. */ |
1562 | OMP_CLAUSE_MAP_DECL_MAKE_ADDRESSABLE (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1562, __FUNCTION__))->base.addressable_flag) = 0; |
1563 | } |
1564 | /* Global variables with "omp declare target" attribute |
1565 | don't need to be copied, the receiver side will use them |
1566 | directly. However, global variables with "omp declare target link" |
1567 | attribute need to be copied. Or when ALWAYS modifier is used. */ |
1568 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1568, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_MAP |
1569 | && DECL_P (decl)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (decl)->base.code))] == tcc_declaration) |
1570 | && ((OMP_CLAUSE_MAP_KIND (c)((enum gomp_map_kind) (omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1570, __FUNCTION__))->omp_clause.subcode.map_kind) != GOMP_MAP_FIRSTPRIVATE_POINTER |
1571 | && (OMP_CLAUSE_MAP_KIND (c)((enum gomp_map_kind) (omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1571, __FUNCTION__))->omp_clause.subcode.map_kind) |
1572 | != GOMP_MAP_FIRSTPRIVATE_REFERENCE) |
1573 | && OMP_CLAUSE_MAP_KIND (c)((enum gomp_map_kind) (omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1573, __FUNCTION__))->omp_clause.subcode.map_kind) != GOMP_MAP_ATTACH |
1574 | && OMP_CLAUSE_MAP_KIND (c)((enum gomp_map_kind) (omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1574, __FUNCTION__))->omp_clause.subcode.map_kind) != GOMP_MAP_DETACH) |
1575 | || TREE_CODE (TREE_TYPE (decl))((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1575, __FUNCTION__))->typed.type))->base.code) == ARRAY_TYPE) |
1576 | && OMP_CLAUSE_MAP_KIND (c)((enum gomp_map_kind) (omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1576, __FUNCTION__))->omp_clause.subcode.map_kind) != GOMP_MAP_ALWAYS_TO |
1577 | && OMP_CLAUSE_MAP_KIND (c)((enum gomp_map_kind) (omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1577, __FUNCTION__))->omp_clause.subcode.map_kind) != GOMP_MAP_ALWAYS_FROM |
1578 | && OMP_CLAUSE_MAP_KIND (c)((enum gomp_map_kind) (omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1578, __FUNCTION__))->omp_clause.subcode.map_kind) != GOMP_MAP_ALWAYS_TOFROM |
1579 | && OMP_CLAUSE_MAP_KIND (c)((enum gomp_map_kind) (omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1579, __FUNCTION__))->omp_clause.subcode.map_kind) != GOMP_MAP_TO_PSET |
1580 | && is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx)) |
1581 | && varpool_node::get_create (decl)->offloadable |
1582 | && !lookup_attribute ("omp declare target link", |
1583 | DECL_ATTRIBUTES (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1583, __FUNCTION__))->decl_common.attributes))) |
1584 | break; |
1585 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1585, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_MAP |
1586 | && OMP_CLAUSE_MAP_KIND (c)((enum gomp_map_kind) (omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1586, __FUNCTION__))->omp_clause.subcode.map_kind) == GOMP_MAP_POINTER) |
1587 | { |
1588 | /* Ignore GOMP_MAP_POINTER kind for arrays in regions that are |
1589 | not offloaded; there is nothing to map for those. */ |
1590 | if (!is_gimple_omp_offloaded (ctx->stmt) |
1591 | && !POINTER_TYPE_P (TREE_TYPE (decl))(((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1591, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1591, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE ) |
1592 | && !OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1592, __FUNCTION__))->base.public_flag)) |
1593 | break; |
1594 | } |
1595 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1595, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_MAP |
1596 | && DECL_P (decl)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (decl)->base.code))] == tcc_declaration) |
1597 | && (OMP_CLAUSE_MAP_KIND (c)((enum gomp_map_kind) (omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1597, __FUNCTION__))->omp_clause.subcode.map_kind) == GOMP_MAP_ATTACH |
1598 | || OMP_CLAUSE_MAP_KIND (c)((enum gomp_map_kind) (omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1598, __FUNCTION__))->omp_clause.subcode.map_kind) == GOMP_MAP_DETACH) |
1599 | && is_omp_target (ctx->stmt)) |
1600 | { |
1601 | /* If this is an offloaded region, an attach operation should |
1602 | only exist when the pointer variable is mapped in a prior |
1603 | clause. |
1604 | If we had an error, we may not have attempted to sort clauses |
1605 | properly, so avoid the test. */ |
1606 | if (is_gimple_omp_offloaded (ctx->stmt) |
1607 | && !seen_error ()) |
1608 | gcc_assert((void)(!(maybe_lookup_decl (decl, ctx) || (is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx)) && lookup_attribute ("omp declare target" , ((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1612, __FUNCTION__))->decl_common.attributes)))) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1612, __FUNCTION__), 0 : 0)) |
1609 | (maybe_lookup_decl (decl, ctx)((void)(!(maybe_lookup_decl (decl, ctx) || (is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx)) && lookup_attribute ("omp declare target" , ((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1612, __FUNCTION__))->decl_common.attributes)))) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1612, __FUNCTION__), 0 : 0)) |
1610 | || (is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx))((void)(!(maybe_lookup_decl (decl, ctx) || (is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx)) && lookup_attribute ("omp declare target" , ((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1612, __FUNCTION__))->decl_common.attributes)))) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1612, __FUNCTION__), 0 : 0)) |
1611 | && lookup_attribute ("omp declare target",((void)(!(maybe_lookup_decl (decl, ctx) || (is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx)) && lookup_attribute ("omp declare target" , ((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1612, __FUNCTION__))->decl_common.attributes)))) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1612, __FUNCTION__), 0 : 0)) |
1612 | DECL_ATTRIBUTES (decl))))((void)(!(maybe_lookup_decl (decl, ctx) || (is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx)) && lookup_attribute ("omp declare target" , ((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1612, __FUNCTION__))->decl_common.attributes)))) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1612, __FUNCTION__), 0 : 0)); |
1613 | |
1614 | /* By itself, attach/detach is generated as part of pointer |
1615 | variable mapping and should not create new variables in the |
1616 | offloaded region, however sender refs for it must be created |
1617 | for its address to be passed to the runtime. */ |
1618 | tree field |
1619 | = build_decl (OMP_CLAUSE_LOCATION (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1619, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, |
1620 | FIELD_DECL, NULL_TREE(tree) nullptr, ptr_type_nodeglobal_trees[TI_PTR_TYPE]); |
1621 | SET_DECL_ALIGN (field, TYPE_ALIGN (ptr_type_node))(((contains_struct_check ((field), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1621, __FUNCTION__))->decl_common.align) = ffs_hwi ((((tree_class_check ((global_trees[TI_PTR_TYPE]), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1621, __FUNCTION__))->type_common.align) ? ((unsigned)1) << (((tree_class_check ((global_trees[TI_PTR_TYPE]), ( tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1621, __FUNCTION__))->type_common.align) - 1) : 0))); |
1622 | insert_field_into_struct (ctx->record_type, field); |
1623 | /* To not clash with a map of the pointer variable itself, |
1624 | attach/detach maps have their field looked up by the *clause* |
1625 | tree expression, not the decl. */ |
1626 | gcc_assert (!splay_tree_lookup (ctx->field_map,((void)(!(!splay_tree_lookup (ctx->field_map, (splay_tree_key ) c)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1627, __FUNCTION__), 0 : 0)) |
1627 | (splay_tree_key) c))((void)(!(!splay_tree_lookup (ctx->field_map, (splay_tree_key ) c)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1627, __FUNCTION__), 0 : 0)); |
1628 | splay_tree_insert (ctx->field_map, (splay_tree_key) c, |
1629 | (splay_tree_value) field); |
1630 | break; |
1631 | } |
1632 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1632, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_MAP |
1633 | && (OMP_CLAUSE_MAP_KIND (c)((enum gomp_map_kind) (omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1633, __FUNCTION__))->omp_clause.subcode.map_kind) == GOMP_MAP_FIRSTPRIVATE_POINTER |
1634 | || (OMP_CLAUSE_MAP_KIND (c)((enum gomp_map_kind) (omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1634, __FUNCTION__))->omp_clause.subcode.map_kind) |
1635 | == GOMP_MAP_FIRSTPRIVATE_REFERENCE))) |
1636 | { |
1637 | if (TREE_CODE (decl)((enum tree_code) (decl)->base.code) == COMPONENT_REF |
1638 | || (TREE_CODE (decl)((enum tree_code) (decl)->base.code) == INDIRECT_REF |
1639 | && TREE_CODE (TREE_OPERAND (decl, 0))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check ((decl), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1639, __FUNCTION__))))))->base.code) == COMPONENT_REF |
1640 | && (((TREE_CODE (TREE_TYPE (TREE_OPERAND (decl, 0)))((enum tree_code) (((contains_struct_check (((*((const_cast< tree*> (tree_operand_check ((decl), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1640, __FUNCTION__)))))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1640, __FUNCTION__))->typed.type))->base.code) |
1641 | == REFERENCE_TYPE) |
1642 | || (TREE_CODE (TREE_TYPE (TREE_OPERAND (decl, 0)))((enum tree_code) (((contains_struct_check (((*((const_cast< tree*> (tree_operand_check ((decl), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1642, __FUNCTION__)))))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1642, __FUNCTION__))->typed.type))->base.code) |
1643 | == POINTER_TYPE))))) |
1644 | break; |
1645 | if (DECL_SIZE (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1645, __FUNCTION__))->decl_common.size) |
1646 | && TREE_CODE (DECL_SIZE (decl))((enum tree_code) (((contains_struct_check ((decl), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1646, __FUNCTION__))->decl_common.size))->base.code) != INTEGER_CST) |
1647 | { |
1648 | tree decl2 = DECL_VALUE_EXPR (decl)(decl_value_expr_lookup ((contains_struct_check ((decl), (TS_DECL_WRTL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1648, __FUNCTION__)))); |
1649 | gcc_assert (TREE_CODE (decl2) == INDIRECT_REF)((void)(!(((enum tree_code) (decl2)->base.code) == INDIRECT_REF ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1649, __FUNCTION__), 0 : 0)); |
1650 | decl2 = TREE_OPERAND (decl2, 0)(*((const_cast<tree*> (tree_operand_check ((decl2), (0) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1650, __FUNCTION__))))); |
1651 | gcc_assert (DECL_P (decl2))((void)(!((tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) (decl2)->base.code))] == tcc_declaration )) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1651, __FUNCTION__), 0 : 0)); |
1652 | install_var_local (decl2, ctx); |
1653 | } |
1654 | install_var_local (decl, ctx); |
1655 | break; |
1656 | } |
1657 | if (DECL_P (decl)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (decl)->base.code))] == tcc_declaration)) |
1658 | { |
1659 | if (DECL_SIZE (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1659, __FUNCTION__))->decl_common.size) |
1660 | && TREE_CODE (DECL_SIZE (decl))((enum tree_code) (((contains_struct_check ((decl), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1660, __FUNCTION__))->decl_common.size))->base.code) != INTEGER_CST) |
1661 | { |
1662 | tree decl2 = DECL_VALUE_EXPR (decl)(decl_value_expr_lookup ((contains_struct_check ((decl), (TS_DECL_WRTL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1662, __FUNCTION__)))); |
1663 | gcc_assert (TREE_CODE (decl2) == INDIRECT_REF)((void)(!(((enum tree_code) (decl2)->base.code) == INDIRECT_REF ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1663, __FUNCTION__), 0 : 0)); |
1664 | decl2 = TREE_OPERAND (decl2, 0)(*((const_cast<tree*> (tree_operand_check ((decl2), (0) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1664, __FUNCTION__))))); |
1665 | gcc_assert (DECL_P (decl2))((void)(!((tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) (decl2)->base.code))] == tcc_declaration )) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1665, __FUNCTION__), 0 : 0)); |
1666 | install_var_field (decl2, true, 3, ctx); |
1667 | install_var_local (decl2, ctx); |
1668 | install_var_local (decl, ctx); |
1669 | } |
1670 | else |
1671 | { |
1672 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1672, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_MAP |
1673 | && OMP_CLAUSE_MAP_KIND (c)((enum gomp_map_kind) (omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1673, __FUNCTION__))->omp_clause.subcode.map_kind) == GOMP_MAP_POINTER |
1674 | && !OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1674, __FUNCTION__))->base.public_flag) |
1675 | && TREE_CODE (TREE_TYPE (decl))((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1675, __FUNCTION__))->typed.type))->base.code) == ARRAY_TYPE) |
1676 | install_var_field (decl, true, 7, ctx); |
1677 | else |
1678 | install_var_field (decl, true, 3, ctx); |
1679 | if (is_gimple_omp_offloaded (ctx->stmt) |
1680 | && !(is_gimple_omp_oacc (ctx->stmt) |
1681 | && OMP_CLAUSE_MAP_IN_REDUCTION (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1681, __FUNCTION__)))->base.private_flag))) |
1682 | install_var_local (decl, ctx); |
1683 | } |
1684 | } |
1685 | else |
1686 | { |
1687 | tree base = get_base_address (decl); |
1688 | tree nc = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1688, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1688, __FUNCTION__))->common.chain); |
1689 | if (DECL_P (base)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (base)->base.code))] == tcc_declaration) |
1690 | && nc != NULL_TREE(tree) nullptr |
1691 | && OMP_CLAUSE_CODE (nc)((tree_check ((nc), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1691, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_MAP |
1692 | && OMP_CLAUSE_DECL (nc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((nc), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1692, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1692, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1692, __FUNCTION__))) == base |
1693 | && OMP_CLAUSE_MAP_KIND (nc)((enum gomp_map_kind) (omp_clause_subcode_check ((nc), (OMP_CLAUSE_MAP ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1693, __FUNCTION__))->omp_clause.subcode.map_kind) == GOMP_MAP_POINTER |
1694 | && integer_zerop (OMP_CLAUSE_SIZE (nc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((nc), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1694, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_FROM), (OMP_CLAUSE__CACHE_ ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1694, __FUNCTION__))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1694, __FUNCTION__))))) |
1695 | { |
1696 | OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1696, __FUNCTION__))->base.public_flag) = 1; |
1697 | OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION (nc)((omp_clause_subcode_check ((nc), (OMP_CLAUSE_MAP), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1697, __FUNCTION__))->base.public_flag) = 1; |
1698 | } |
1699 | else |
1700 | { |
1701 | if (ctx->outer) |
1702 | { |
1703 | scan_omp_op (&OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1703, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1703, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1703, __FUNCTION__))), ctx->outer); |
1704 | decl = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1704, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1704, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1704, __FUNCTION__))); |
1705 | } |
1706 | gcc_assert (!splay_tree_lookup (ctx->field_map,((void)(!(!splay_tree_lookup (ctx->field_map, (splay_tree_key ) decl)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1707, __FUNCTION__), 0 : 0)) |
1707 | (splay_tree_key) decl))((void)(!(!splay_tree_lookup (ctx->field_map, (splay_tree_key ) decl)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1707, __FUNCTION__), 0 : 0)); |
1708 | tree field |
1709 | = build_decl (OMP_CLAUSE_LOCATION (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1709, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, |
1710 | FIELD_DECL, NULL_TREE(tree) nullptr, ptr_type_nodeglobal_trees[TI_PTR_TYPE]); |
1711 | SET_DECL_ALIGN (field, TYPE_ALIGN (ptr_type_node))(((contains_struct_check ((field), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1711, __FUNCTION__))->decl_common.align) = ffs_hwi ((((tree_class_check ((global_trees[TI_PTR_TYPE]), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1711, __FUNCTION__))->type_common.align) ? ((unsigned)1) << (((tree_class_check ((global_trees[TI_PTR_TYPE]), ( tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1711, __FUNCTION__))->type_common.align) - 1) : 0))); |
1712 | insert_field_into_struct (ctx->record_type, field); |
1713 | splay_tree_insert (ctx->field_map, (splay_tree_key) decl, |
1714 | (splay_tree_value) field); |
1715 | } |
1716 | } |
1717 | break; |
1718 | |
1719 | case OMP_CLAUSE_ORDER: |
1720 | ctx->order_concurrent = true; |
1721 | break; |
1722 | |
1723 | case OMP_CLAUSE_BIND: |
1724 | ctx->loop_p = true; |
1725 | break; |
1726 | |
1727 | case OMP_CLAUSE_NOWAIT: |
1728 | case OMP_CLAUSE_ORDERED: |
1729 | case OMP_CLAUSE_COLLAPSE: |
1730 | case OMP_CLAUSE_UNTIED: |
1731 | case OMP_CLAUSE_MERGEABLE: |
1732 | case OMP_CLAUSE_PROC_BIND: |
1733 | case OMP_CLAUSE_SAFELEN: |
1734 | case OMP_CLAUSE_SIMDLEN: |
1735 | case OMP_CLAUSE_THREADS: |
1736 | case OMP_CLAUSE_SIMD: |
1737 | case OMP_CLAUSE_NOGROUP: |
1738 | case OMP_CLAUSE_DEFAULTMAP: |
1739 | case OMP_CLAUSE_ASYNC: |
1740 | case OMP_CLAUSE_WAIT: |
1741 | case OMP_CLAUSE_GANG: |
1742 | case OMP_CLAUSE_WORKER: |
1743 | case OMP_CLAUSE_VECTOR: |
1744 | case OMP_CLAUSE_INDEPENDENT: |
1745 | case OMP_CLAUSE_AUTO: |
1746 | case OMP_CLAUSE_SEQ: |
1747 | case OMP_CLAUSE_TILE: |
1748 | case OMP_CLAUSE__SIMT_: |
1749 | case OMP_CLAUSE_DEFAULT: |
1750 | case OMP_CLAUSE_NONTEMPORAL: |
1751 | case OMP_CLAUSE_IF_PRESENT: |
1752 | case OMP_CLAUSE_FINALIZE: |
1753 | case OMP_CLAUSE_TASK_REDUCTION: |
1754 | case OMP_CLAUSE_ALLOCATE: |
1755 | break; |
1756 | |
1757 | case OMP_CLAUSE_ALIGNED: |
1758 | decl = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1758, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1758, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1758, __FUNCTION__))); |
1759 | if (is_global_var (decl) |
1760 | && TREE_CODE (TREE_TYPE (decl))((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1760, __FUNCTION__))->typed.type))->base.code) == ARRAY_TYPE) |
1761 | install_var_local (decl, ctx); |
1762 | break; |
1763 | |
1764 | case OMP_CLAUSE__CONDTEMP_: |
1765 | decl = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1765, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1765, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1765, __FUNCTION__))); |
1766 | if (is_parallel_ctx (ctx)) |
1767 | { |
1768 | install_var_field (decl, false, 3, ctx); |
1769 | install_var_local (decl, ctx); |
1770 | } |
1771 | else if (gimple_code (ctx->stmt) == GIMPLE_OMP_FOR |
1772 | && gimple_omp_for_kind (ctx->stmt) == GF_OMP_FOR_KIND_SIMD |
1773 | && !OMP_CLAUSE__CONDTEMP__ITER (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE__CONDTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1773, __FUNCTION__))->base.public_flag)) |
1774 | install_var_local (decl, ctx); |
1775 | break; |
1776 | |
1777 | case OMP_CLAUSE__CACHE_: |
1778 | case OMP_CLAUSE_NOHOST: |
1779 | default: |
1780 | gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1780, __FUNCTION__)); |
1781 | } |
1782 | } |
1783 | |
1784 | for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1784, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1784, __FUNCTION__))->common.chain)) |
1785 | { |
1786 | switch (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1786, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code) |
1787 | { |
1788 | case OMP_CLAUSE_LASTPRIVATE: |
1789 | /* Let the corresponding firstprivate clause create |
1790 | the variable. */ |
1791 | if (OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1791, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.gimple_reduction_init) |
1792 | scan_array_reductions = true; |
1793 | if (OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_LASTPRIVATE), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1793, __FUNCTION__))->base.public_flag)) |
1794 | break; |
1795 | /* FALLTHRU */ |
1796 | |
1797 | case OMP_CLAUSE_FIRSTPRIVATE: |
1798 | case OMP_CLAUSE_PRIVATE: |
1799 | case OMP_CLAUSE_LINEAR: |
1800 | case OMP_CLAUSE_HAS_DEVICE_ADDR: |
1801 | case OMP_CLAUSE_IS_DEVICE_PTR: |
1802 | decl = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1802, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1802, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1802, __FUNCTION__))); |
1803 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1803, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_HAS_DEVICE_ADDR) |
1804 | { |
1805 | while (TREE_CODE (decl)((enum tree_code) (decl)->base.code) == INDIRECT_REF |
1806 | || TREE_CODE (decl)((enum tree_code) (decl)->base.code) == ARRAY_REF) |
1807 | decl = TREE_OPERAND (decl, 0)(*((const_cast<tree*> (tree_operand_check ((decl), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1807, __FUNCTION__))))); |
1808 | } |
1809 | |
1810 | if (is_variable_sized (decl)) |
1811 | { |
1812 | if ((OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1812, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_FIRSTPRIVATE |
1813 | || OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1813, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_IS_DEVICE_PTR |
1814 | || OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1814, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_HAS_DEVICE_ADDR) |
1815 | && is_gimple_omp_offloaded (ctx->stmt)) |
1816 | { |
1817 | tree decl2 = DECL_VALUE_EXPR (decl)(decl_value_expr_lookup ((contains_struct_check ((decl), (TS_DECL_WRTL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1817, __FUNCTION__)))); |
1818 | gcc_assert (TREE_CODE (decl2) == INDIRECT_REF)((void)(!(((enum tree_code) (decl2)->base.code) == INDIRECT_REF ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1818, __FUNCTION__), 0 : 0)); |
1819 | decl2 = TREE_OPERAND (decl2, 0)(*((const_cast<tree*> (tree_operand_check ((decl2), (0) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1819, __FUNCTION__))))); |
1820 | gcc_assert (DECL_P (decl2))((void)(!((tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) (decl2)->base.code))] == tcc_declaration )) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1820, __FUNCTION__), 0 : 0)); |
1821 | install_var_local (decl2, ctx); |
1822 | fixup_remapped_decl (decl2, ctx, false); |
1823 | } |
1824 | install_var_local (decl, ctx); |
1825 | } |
1826 | fixup_remapped_decl (decl, ctx, |
1827 | OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1827, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_PRIVATE |
1828 | && OMP_CLAUSE_PRIVATE_DEBUG (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_PRIVATE), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1828, __FUNCTION__))->base.public_flag)); |
1829 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1829, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_LINEAR |
1830 | && OMP_CLAUSE_LINEAR_GIMPLE_SEQ (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1830, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.gimple_reduction_init) |
1831 | scan_array_reductions = true; |
1832 | break; |
1833 | |
1834 | case OMP_CLAUSE_REDUCTION: |
1835 | case OMP_CLAUSE_IN_REDUCTION: |
1836 | decl = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1836, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1836, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1836, __FUNCTION__))); |
1837 | if (TREE_CODE (decl)((enum tree_code) (decl)->base.code) != MEM_REF && !is_omp_target (ctx->stmt)) |
1838 | { |
1839 | if (is_variable_sized (decl)) |
1840 | install_var_local (decl, ctx); |
1841 | fixup_remapped_decl (decl, ctx, false); |
1842 | } |
1843 | if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (c)(*(omp_clause_elt_check (((omp_clause_range_check ((c), (OMP_CLAUSE_REDUCTION ), (OMP_CLAUSE_IN_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1843, __FUNCTION__))), (3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1843, __FUNCTION__)))) |
1844 | scan_array_reductions = true; |
1845 | break; |
1846 | |
1847 | case OMP_CLAUSE_TASK_REDUCTION: |
1848 | if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (c)(*(omp_clause_elt_check (((omp_clause_range_check ((c), (OMP_CLAUSE_REDUCTION ), (OMP_CLAUSE_IN_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1848, __FUNCTION__))), (3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1848, __FUNCTION__)))) |
1849 | scan_array_reductions = true; |
1850 | break; |
1851 | |
1852 | case OMP_CLAUSE_SHARED: |
1853 | /* Ignore shared directives in teams construct inside of |
1854 | target construct. */ |
1855 | if (gimple_code (ctx->stmt) == GIMPLE_OMP_TEAMS |
1856 | && !is_host_teams_ctx (ctx)) |
1857 | break; |
1858 | decl = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1858, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1858, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1858, __FUNCTION__))); |
1859 | if (is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx))) |
1860 | break; |
1861 | if (OMP_CLAUSE_SHARED_FIRSTPRIVATE (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_SHARED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1861, __FUNCTION__))->base.public_flag)) |
1862 | { |
1863 | if (is_global_var (maybe_lookup_decl_in_outer_ctx (decl, |
1864 | ctx->outer))) |
1865 | break; |
1866 | bool by_ref = use_pointer_for_field (decl, ctx); |
1867 | install_var_field (decl, by_ref, 11, ctx); |
1868 | break; |
1869 | } |
1870 | fixup_remapped_decl (decl, ctx, false); |
1871 | break; |
1872 | |
1873 | case OMP_CLAUSE_MAP: |
1874 | if (!is_gimple_omp_offloaded (ctx->stmt)) |
1875 | break; |
1876 | decl = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1876, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1876, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1876, __FUNCTION__))); |
1877 | if (DECL_P (decl)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (decl)->base.code))] == tcc_declaration) |
1878 | && ((OMP_CLAUSE_MAP_KIND (c)((enum gomp_map_kind) (omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1878, __FUNCTION__))->omp_clause.subcode.map_kind) != GOMP_MAP_FIRSTPRIVATE_POINTER |
1879 | && (OMP_CLAUSE_MAP_KIND (c)((enum gomp_map_kind) (omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1879, __FUNCTION__))->omp_clause.subcode.map_kind) |
1880 | != GOMP_MAP_FIRSTPRIVATE_REFERENCE)) |
1881 | || TREE_CODE (TREE_TYPE (decl))((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1881, __FUNCTION__))->typed.type))->base.code) == ARRAY_TYPE) |
1882 | && is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx)) |
1883 | && varpool_node::get_create (decl)->offloadable) |
1884 | break; |
1885 | if ((OMP_CLAUSE_MAP_KIND (c)((enum gomp_map_kind) (omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1885, __FUNCTION__))->omp_clause.subcode.map_kind) == GOMP_MAP_ATTACH |
1886 | || OMP_CLAUSE_MAP_KIND (c)((enum gomp_map_kind) (omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1886, __FUNCTION__))->omp_clause.subcode.map_kind) == GOMP_MAP_DETACH) |
1887 | && is_omp_target (ctx->stmt) |
1888 | && !is_gimple_omp_offloaded (ctx->stmt)) |
1889 | break; |
1890 | if (DECL_P (decl)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (decl)->base.code))] == tcc_declaration)) |
1891 | { |
1892 | if ((OMP_CLAUSE_MAP_KIND (c)((enum gomp_map_kind) (omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1892, __FUNCTION__))->omp_clause.subcode.map_kind) == GOMP_MAP_POINTER |
1893 | || OMP_CLAUSE_MAP_KIND (c)((enum gomp_map_kind) (omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1893, __FUNCTION__))->omp_clause.subcode.map_kind) == GOMP_MAP_FIRSTPRIVATE_POINTER) |
1894 | && TREE_CODE (TREE_TYPE (decl))((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1894, __FUNCTION__))->typed.type))->base.code) == ARRAY_TYPE |
1895 | && !COMPLETE_TYPE_P (TREE_TYPE (decl))(((tree_class_check ((((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1895, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1895, __FUNCTION__))->type_common.size) != (tree) nullptr )) |
1896 | { |
1897 | tree new_decl = lookup_decl (decl, ctx); |
1898 | TREE_TYPE (new_decl)((contains_struct_check ((new_decl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1898, __FUNCTION__))->typed.type) |
1899 | = remap_type (TREE_TYPE (decl)((contains_struct_check ((decl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1899, __FUNCTION__))->typed.type), &ctx->cb); |
1900 | } |
1901 | else if (DECL_SIZE (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1901, __FUNCTION__))->decl_common.size) |
1902 | && TREE_CODE (DECL_SIZE (decl))((enum tree_code) (((contains_struct_check ((decl), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1902, __FUNCTION__))->decl_common.size))->base.code) != INTEGER_CST) |
1903 | { |
1904 | tree decl2 = DECL_VALUE_EXPR (decl)(decl_value_expr_lookup ((contains_struct_check ((decl), (TS_DECL_WRTL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1904, __FUNCTION__)))); |
1905 | gcc_assert (TREE_CODE (decl2) == INDIRECT_REF)((void)(!(((enum tree_code) (decl2)->base.code) == INDIRECT_REF ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1905, __FUNCTION__), 0 : 0)); |
1906 | decl2 = TREE_OPERAND (decl2, 0)(*((const_cast<tree*> (tree_operand_check ((decl2), (0) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1906, __FUNCTION__))))); |
1907 | gcc_assert (DECL_P (decl2))((void)(!((tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) (decl2)->base.code))] == tcc_declaration )) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1907, __FUNCTION__), 0 : 0)); |
1908 | fixup_remapped_decl (decl2, ctx, false); |
1909 | fixup_remapped_decl (decl, ctx, true); |
1910 | } |
1911 | else |
1912 | fixup_remapped_decl (decl, ctx, false); |
1913 | } |
1914 | break; |
1915 | |
1916 | case OMP_CLAUSE_COPYPRIVATE: |
1917 | case OMP_CLAUSE_COPYIN: |
1918 | case OMP_CLAUSE_DEFAULT: |
1919 | case OMP_CLAUSE_IF: |
1920 | case OMP_CLAUSE_NUM_THREADS: |
1921 | case OMP_CLAUSE_NUM_TEAMS: |
1922 | case OMP_CLAUSE_THREAD_LIMIT: |
1923 | case OMP_CLAUSE_DEVICE: |
1924 | case OMP_CLAUSE_SCHEDULE: |
1925 | case OMP_CLAUSE_DIST_SCHEDULE: |
1926 | case OMP_CLAUSE_NOWAIT: |
1927 | case OMP_CLAUSE_ORDERED: |
1928 | case OMP_CLAUSE_COLLAPSE: |
1929 | case OMP_CLAUSE_UNTIED: |
1930 | case OMP_CLAUSE_FINAL: |
1931 | case OMP_CLAUSE_MERGEABLE: |
1932 | case OMP_CLAUSE_PROC_BIND: |
1933 | case OMP_CLAUSE_SAFELEN: |
1934 | case OMP_CLAUSE_SIMDLEN: |
1935 | case OMP_CLAUSE_ALIGNED: |
1936 | case OMP_CLAUSE_DEPEND: |
1937 | case OMP_CLAUSE_DETACH: |
1938 | case OMP_CLAUSE_ALLOCATE: |
1939 | case OMP_CLAUSE__LOOPTEMP_: |
1940 | case OMP_CLAUSE__REDUCTEMP_: |
1941 | case OMP_CLAUSE_TO: |
1942 | case OMP_CLAUSE_FROM: |
1943 | case OMP_CLAUSE_PRIORITY: |
1944 | case OMP_CLAUSE_GRAINSIZE: |
1945 | case OMP_CLAUSE_NUM_TASKS: |
1946 | case OMP_CLAUSE_THREADS: |
1947 | case OMP_CLAUSE_SIMD: |
1948 | case OMP_CLAUSE_NOGROUP: |
1949 | case OMP_CLAUSE_DEFAULTMAP: |
1950 | case OMP_CLAUSE_ORDER: |
1951 | case OMP_CLAUSE_BIND: |
1952 | case OMP_CLAUSE_USE_DEVICE_PTR: |
1953 | case OMP_CLAUSE_USE_DEVICE_ADDR: |
1954 | case OMP_CLAUSE_NONTEMPORAL: |
1955 | case OMP_CLAUSE_ASYNC: |
1956 | case OMP_CLAUSE_WAIT: |
1957 | case OMP_CLAUSE_NUM_GANGS: |
1958 | case OMP_CLAUSE_NUM_WORKERS: |
1959 | case OMP_CLAUSE_VECTOR_LENGTH: |
1960 | case OMP_CLAUSE_GANG: |
1961 | case OMP_CLAUSE_WORKER: |
1962 | case OMP_CLAUSE_VECTOR: |
1963 | case OMP_CLAUSE_INDEPENDENT: |
1964 | case OMP_CLAUSE_AUTO: |
1965 | case OMP_CLAUSE_SEQ: |
1966 | case OMP_CLAUSE_TILE: |
1967 | case OMP_CLAUSE__SIMT_: |
1968 | case OMP_CLAUSE_IF_PRESENT: |
1969 | case OMP_CLAUSE_FINALIZE: |
1970 | case OMP_CLAUSE_FILTER: |
1971 | case OMP_CLAUSE__CONDTEMP_: |
1972 | break; |
1973 | |
1974 | case OMP_CLAUSE__CACHE_: |
1975 | case OMP_CLAUSE_NOHOST: |
1976 | default: |
1977 | gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1977, __FUNCTION__)); |
1978 | } |
1979 | } |
1980 | |
1981 | gcc_checking_assert (!scan_array_reductions((void)(!(!scan_array_reductions || !is_gimple_omp_oacc (ctx-> stmt)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1982, __FUNCTION__), 0 : 0)) |
1982 | || !is_gimple_omp_oacc (ctx->stmt))((void)(!(!scan_array_reductions || !is_gimple_omp_oacc (ctx-> stmt)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1982, __FUNCTION__), 0 : 0)); |
1983 | if (scan_array_reductions) |
1984 | { |
1985 | for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1985, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1985, __FUNCTION__))->common.chain)) |
1986 | if ((OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1986, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_REDUCTION |
1987 | || OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1987, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_IN_REDUCTION |
1988 | || OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1988, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_TASK_REDUCTION) |
1989 | && OMP_CLAUSE_REDUCTION_PLACEHOLDER (c)(*(omp_clause_elt_check (((omp_clause_range_check ((c), (OMP_CLAUSE_REDUCTION ), (OMP_CLAUSE_IN_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1989, __FUNCTION__))), (3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1989, __FUNCTION__)))) |
1990 | { |
1991 | omp_context *rctx = ctx; |
1992 | if (is_omp_target (ctx->stmt)) |
1993 | rctx = ctx->outer; |
1994 | scan_omp (&OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1994, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.gimple_reduction_init, rctx); |
1995 | scan_omp (&OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1995, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.gimple_reduction_merge, rctx); |
1996 | } |
1997 | else if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1997, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_LASTPRIVATE |
1998 | && OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1998, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.gimple_reduction_init) |
1999 | scan_omp (&OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 1999, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.gimple_reduction_init, ctx); |
2000 | else if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2000, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_LINEAR |
2001 | && OMP_CLAUSE_LINEAR_GIMPLE_SEQ (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2001, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.gimple_reduction_init) |
2002 | scan_omp (&OMP_CLAUSE_LINEAR_GIMPLE_SEQ (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2002, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.gimple_reduction_init, ctx); |
2003 | } |
2004 | } |
2005 | |
2006 | /* Create a new name for omp child function. Returns an identifier. */ |
2007 | |
2008 | static tree |
2009 | create_omp_child_function_name (bool task_copy) |
2010 | { |
2011 | return clone_function_name_numbered (current_function_decl, |
2012 | task_copy ? "_omp_cpyfn" : "_omp_fn"); |
2013 | } |
2014 | |
2015 | /* Return true if CTX may belong to offloaded code: either if current function |
2016 | is offloaded, or any enclosing context corresponds to a target region. */ |
2017 | |
2018 | static bool |
2019 | omp_maybe_offloaded_ctx (omp_context *ctx) |
2020 | { |
2021 | if (cgraph_node::get (current_function_decl)->offloadable) |
2022 | return true; |
2023 | for (; ctx; ctx = ctx->outer) |
2024 | if (is_gimple_omp_offloaded (ctx->stmt)) |
2025 | return true; |
2026 | return false; |
2027 | } |
2028 | |
2029 | /* Build a decl for the omp child function. It'll not contain a body |
2030 | yet, just the bare decl. */ |
2031 | |
2032 | static void |
2033 | create_omp_child_function (omp_context *ctx, bool task_copy) |
2034 | { |
2035 | tree decl, type, name, t; |
2036 | |
2037 | name = create_omp_child_function_name (task_copy); |
2038 | if (task_copy) |
2039 | type = build_function_type_list (void_type_nodeglobal_trees[TI_VOID_TYPE], ptr_type_nodeglobal_trees[TI_PTR_TYPE], |
2040 | ptr_type_nodeglobal_trees[TI_PTR_TYPE], NULL_TREE(tree) nullptr); |
2041 | else |
2042 | type = build_function_type_list (void_type_nodeglobal_trees[TI_VOID_TYPE], ptr_type_nodeglobal_trees[TI_PTR_TYPE], NULL_TREE(tree) nullptr); |
2043 | |
2044 | decl = build_decl (gimple_location (ctx->stmt), FUNCTION_DECL, name, type); |
2045 | |
2046 | gcc_checking_assert (!is_gimple_omp_oacc (ctx->stmt)((void)(!(!is_gimple_omp_oacc (ctx->stmt) || !task_copy) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2047, __FUNCTION__), 0 : 0)) |
2047 | || !task_copy)((void)(!(!is_gimple_omp_oacc (ctx->stmt) || !task_copy) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2047, __FUNCTION__), 0 : 0)); |
2048 | if (!task_copy) |
2049 | ctx->cb.dst_fn = decl; |
2050 | else |
2051 | gimple_omp_task_set_copy_fn (ctx->stmt, decl); |
2052 | |
2053 | TREE_STATIC (decl)((decl)->base.static_flag) = 1; |
2054 | TREE_USED (decl)((decl)->base.used_flag) = 1; |
2055 | DECL_ARTIFICIAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2055, __FUNCTION__))->decl_common.artificial_flag) = 1; |
2056 | DECL_IGNORED_P (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2056, __FUNCTION__))->decl_common.ignored_flag) = 0; |
2057 | TREE_PUBLIC (decl)((decl)->base.public_flag) = 0; |
2058 | DECL_UNINLINABLE (decl)((tree_check ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2058, __FUNCTION__, (FUNCTION_DECL)))->function_decl.uninlinable ) = 1; |
2059 | DECL_EXTERNAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2059, __FUNCTION__))->decl_common.decl_flag_1) = 0; |
2060 | DECL_CONTEXT (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2060, __FUNCTION__))->decl_minimal.context) = NULL_TREE(tree) nullptr; |
2061 | DECL_INITIAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2061, __FUNCTION__))->decl_common.initial) = make_node (BLOCK); |
2062 | BLOCK_SUPERCONTEXT (DECL_INITIAL (decl))((tree_check ((((contains_struct_check ((decl), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2062, __FUNCTION__))->decl_common.initial)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2062, __FUNCTION__, (BLOCK)))->block.supercontext) = decl; |
2063 | DECL_ATTRIBUTES (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2063, __FUNCTION__))->decl_common.attributes) = DECL_ATTRIBUTES (current_function_decl)((contains_struct_check ((current_function_decl), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2063, __FUNCTION__))->decl_common.attributes); |
2064 | /* Remove omp declare simd attribute from the new attributes. */ |
2065 | if (tree a = lookup_attribute ("omp declare simd", DECL_ATTRIBUTES (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2065, __FUNCTION__))->decl_common.attributes))) |
2066 | { |
2067 | while (tree a2 = lookup_attribute ("omp declare simd", TREE_CHAIN (a)((contains_struct_check ((a), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2067, __FUNCTION__))->common.chain))) |
2068 | a = a2; |
2069 | a = TREE_CHAIN (a)((contains_struct_check ((a), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2069, __FUNCTION__))->common.chain); |
2070 | for (tree *p = &DECL_ATTRIBUTES (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2070, __FUNCTION__))->decl_common.attributes); *p != a;) |
2071 | if (is_attribute_p ("omp declare simd", get_attribute_name (*p))) |
2072 | *p = TREE_CHAIN (*p)((contains_struct_check ((*p), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2072, __FUNCTION__))->common.chain); |
2073 | else |
2074 | { |
2075 | tree chain = TREE_CHAIN (*p)((contains_struct_check ((*p), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2075, __FUNCTION__))->common.chain); |
2076 | *p = copy_node (*p); |
2077 | p = &TREE_CHAIN (*p)((contains_struct_check ((*p), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2077, __FUNCTION__))->common.chain); |
2078 | *p = chain; |
2079 | } |
2080 | } |
2081 | DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl)((tree_check ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2081, __FUNCTION__, (FUNCTION_DECL)))->function_decl.function_specific_optimization ) |
2082 | = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (current_function_decl)((tree_check ((current_function_decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2082, __FUNCTION__, (FUNCTION_DECL)))->function_decl.function_specific_optimization ); |
2083 | DECL_FUNCTION_SPECIFIC_TARGET (decl)((tree_check ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2083, __FUNCTION__, (FUNCTION_DECL)))->function_decl.function_specific_target ) |
2084 | = DECL_FUNCTION_SPECIFIC_TARGET (current_function_decl)((tree_check ((current_function_decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2084, __FUNCTION__, (FUNCTION_DECL)))->function_decl.function_specific_target ); |
2085 | DECL_FUNCTION_VERSIONED (decl)((tree_check ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2085, __FUNCTION__, (FUNCTION_DECL)))->function_decl.versioned_function ) |
2086 | = DECL_FUNCTION_VERSIONED (current_function_decl)((tree_check ((current_function_decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2086, __FUNCTION__, (FUNCTION_DECL)))->function_decl.versioned_function ); |
2087 | |
2088 | if (omp_maybe_offloaded_ctx (ctx)) |
2089 | { |
2090 | cgraph_node::get_create (decl)->offloadable = 1; |
2091 | if (ENABLE_OFFLOADING0) |
2092 | g->have_offload = true; |
2093 | } |
2094 | |
2095 | if (cgraph_node::get_create (decl)->offloadable) |
2096 | { |
2097 | const char *target_attr = (is_gimple_omp_offloaded (ctx->stmt) |
2098 | ? "omp target entrypoint" |
2099 | : "omp declare target"); |
2100 | if (lookup_attribute ("omp declare target", |
2101 | DECL_ATTRIBUTES (current_function_decl)((contains_struct_check ((current_function_decl), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2101, __FUNCTION__))->decl_common.attributes))) |
2102 | { |
2103 | if (is_gimple_omp_offloaded (ctx->stmt)) |
2104 | DECL_ATTRIBUTES (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2104, __FUNCTION__))->decl_common.attributes) |
2105 | = remove_attribute ("omp declare target", |
2106 | copy_list (DECL_ATTRIBUTES (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2106, __FUNCTION__))->decl_common.attributes))); |
2107 | else |
2108 | target_attr = NULLnullptr; |
2109 | } |
2110 | if (target_attr |
2111 | && is_gimple_omp_offloaded (ctx->stmt) |
2112 | && lookup_attribute ("noclone", DECL_ATTRIBUTES (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2112, __FUNCTION__))->decl_common.attributes)) == NULL_TREE(tree) nullptr) |
2113 | DECL_ATTRIBUTES (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2113, __FUNCTION__))->decl_common.attributes) = tree_cons (get_identifier ("noclone")(__builtin_constant_p ("noclone") ? get_identifier_with_length (("noclone"), strlen ("noclone")) : get_identifier ("noclone" )), |
2114 | NULL_TREE(tree) nullptr, DECL_ATTRIBUTES (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2114, __FUNCTION__))->decl_common.attributes)); |
2115 | if (target_attr) |
2116 | DECL_ATTRIBUTES (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2116, __FUNCTION__))->decl_common.attributes) |
2117 | = tree_cons (get_identifier (target_attr)(__builtin_constant_p (target_attr) ? get_identifier_with_length ((target_attr), strlen (target_attr)) : get_identifier (target_attr )), |
2118 | NULL_TREE(tree) nullptr, DECL_ATTRIBUTES (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2118, __FUNCTION__))->decl_common.attributes)); |
2119 | } |
2120 | |
2121 | t = build_decl (DECL_SOURCE_LOCATION (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2121, __FUNCTION__))->decl_minimal.locus), |
2122 | RESULT_DECL, NULL_TREE(tree) nullptr, void_type_nodeglobal_trees[TI_VOID_TYPE]); |
2123 | DECL_ARTIFICIAL (t)((contains_struct_check ((t), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2123, __FUNCTION__))->decl_common.artificial_flag) = 1; |
2124 | DECL_IGNORED_P (t)((contains_struct_check ((t), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2124, __FUNCTION__))->decl_common.ignored_flag) = 1; |
2125 | DECL_CONTEXT (t)((contains_struct_check ((t), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2125, __FUNCTION__))->decl_minimal.context) = decl; |
2126 | DECL_RESULT (decl)((tree_check ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2126, __FUNCTION__, (FUNCTION_DECL)))->decl_non_common.result ) = t; |
2127 | |
2128 | tree data_name = get_identifier (".omp_data_i")(__builtin_constant_p (".omp_data_i") ? get_identifier_with_length ((".omp_data_i"), strlen (".omp_data_i")) : get_identifier ( ".omp_data_i")); |
2129 | t = build_decl (DECL_SOURCE_LOCATION (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2129, __FUNCTION__))->decl_minimal.locus), PARM_DECL, data_name, |
2130 | ptr_type_nodeglobal_trees[TI_PTR_TYPE]); |
2131 | DECL_ARTIFICIAL (t)((contains_struct_check ((t), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2131, __FUNCTION__))->decl_common.artificial_flag) = 1; |
2132 | DECL_NAMELESS (t)((contains_struct_check ((t), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2132, __FUNCTION__))->base.u.bits.nameless_flag) = 1; |
2133 | DECL_ARG_TYPE (t)((tree_check ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2133, __FUNCTION__, (PARM_DECL)))->decl_common.initial) = ptr_type_nodeglobal_trees[TI_PTR_TYPE]; |
2134 | DECL_CONTEXT (t)((contains_struct_check ((t), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2134, __FUNCTION__))->decl_minimal.context) = current_function_decl; |
2135 | TREE_USED (t)((t)->base.used_flag) = 1; |
2136 | TREE_READONLY (t)((non_type_check ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2136, __FUNCTION__))->base.readonly_flag) = 1; |
2137 | DECL_ARGUMENTS (decl)((tree_check ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2137, __FUNCTION__, (FUNCTION_DECL)))->function_decl.arguments ) = t; |
2138 | if (!task_copy) |
2139 | ctx->receiver_decl = t; |
2140 | else |
2141 | { |
2142 | t = build_decl (DECL_SOURCE_LOCATION (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2142, __FUNCTION__))->decl_minimal.locus), |
2143 | PARM_DECL, get_identifier (".omp_data_o")(__builtin_constant_p (".omp_data_o") ? get_identifier_with_length ((".omp_data_o"), strlen (".omp_data_o")) : get_identifier ( ".omp_data_o")), |
2144 | ptr_type_nodeglobal_trees[TI_PTR_TYPE]); |
2145 | DECL_ARTIFICIAL (t)((contains_struct_check ((t), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2145, __FUNCTION__))->decl_common.artificial_flag) = 1; |
2146 | DECL_NAMELESS (t)((contains_struct_check ((t), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2146, __FUNCTION__))->base.u.bits.nameless_flag) = 1; |
2147 | DECL_ARG_TYPE (t)((tree_check ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2147, __FUNCTION__, (PARM_DECL)))->decl_common.initial) = ptr_type_nodeglobal_trees[TI_PTR_TYPE]; |
2148 | DECL_CONTEXT (t)((contains_struct_check ((t), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2148, __FUNCTION__))->decl_minimal.context) = current_function_decl; |
2149 | TREE_USED (t)((t)->base.used_flag) = 1; |
2150 | TREE_ADDRESSABLE (t)((t)->base.addressable_flag) = 1; |
2151 | DECL_CHAIN (t)(((contains_struct_check (((contains_struct_check ((t), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2151, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2151, __FUNCTION__))->common.chain)) = DECL_ARGUMENTS (decl)((tree_check ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2151, __FUNCTION__, (FUNCTION_DECL)))->function_decl.arguments ); |
2152 | DECL_ARGUMENTS (decl)((tree_check ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2152, __FUNCTION__, (FUNCTION_DECL)))->function_decl.arguments ) = t; |
2153 | } |
2154 | |
2155 | /* Allocate memory for the function structure. The call to |
2156 | allocate_struct_function clobbers CFUN, so we need to restore |
2157 | it afterward. */ |
2158 | push_struct_function (decl); |
2159 | cfun(cfun + 0)->function_end_locus = gimple_location (ctx->stmt); |
2160 | init_tree_ssa (cfun(cfun + 0)); |
2161 | pop_cfun (); |
2162 | } |
2163 | |
2164 | /* Callback for walk_gimple_seq. Check if combined parallel |
2165 | contains gimple_omp_for_combined_into_p OMP_FOR. */ |
2166 | |
2167 | tree |
2168 | omp_find_combined_for (gimple_stmt_iterator *gsi_p, |
2169 | bool *handled_ops_p, |
2170 | struct walk_stmt_info *wi) |
2171 | { |
2172 | gimple *stmt = gsi_stmt (*gsi_p); |
2173 | |
2174 | *handled_ops_p = true; |
2175 | switch (gimple_code (stmt)) |
2176 | { |
2177 | WALK_SUBSTMTScase GIMPLE_BIND: case GIMPLE_TRY: case GIMPLE_CATCH: case GIMPLE_EH_FILTER : case GIMPLE_ASSUME: case GIMPLE_TRANSACTION: *handled_ops_p = false; break;; |
2178 | |
2179 | case GIMPLE_OMP_FOR: |
2180 | if (gimple_omp_for_combined_into_p (stmt) |
2181 | && gimple_omp_for_kind (stmt) |
2182 | == *(const enum gf_mask *) (wi->info)) |
2183 | { |
2184 | wi->info = stmt; |
2185 | return integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]; |
2186 | } |
2187 | break; |
2188 | default: |
2189 | break; |
2190 | } |
2191 | return NULLnullptr; |
2192 | } |
2193 | |
2194 | /* Add _LOOPTEMP_/_REDUCTEMP_ clauses on OpenMP parallel or task. */ |
2195 | |
2196 | static void |
2197 | add_taskreg_looptemp_clauses (enum gf_mask msk, gimple *stmt, |
2198 | omp_context *outer_ctx) |
2199 | { |
2200 | struct walk_stmt_info wi; |
2201 | |
2202 | memset (&wi, 0, sizeof (wi)); |
2203 | wi.val_only = true; |
2204 | wi.info = (void *) &msk; |
2205 | walk_gimple_seq (gimple_omp_body (stmt), omp_find_combined_for, NULLnullptr, &wi); |
2206 | if (wi.info != (void *) &msk) |
2207 | { |
2208 | gomp_for *for_stmt = as_a <gomp_for *> ((gimple *) wi.info); |
2209 | struct omp_for_data fd; |
2210 | omp_extract_for_data (for_stmt, &fd, NULLnullptr); |
2211 | /* We need two temporaries with fd.loop.v type (istart/iend) |
2212 | and then (fd.collapse - 1) temporaries with the same |
2213 | type for count2 ... countN-1 vars if not constant. */ |
2214 | size_t count = 2, i; |
2215 | tree type = fd.iter_type; |
2216 | if (fd.collapse > 1 |
2217 | && TREE_CODE (fd.loop.n2)((enum tree_code) (fd.loop.n2)->base.code) != INTEGER_CST) |
2218 | { |
2219 | count += fd.collapse - 1; |
2220 | /* If there are lastprivate clauses on the inner |
2221 | GIMPLE_OMP_FOR, add one more temporaries for the total number |
2222 | of iterations (product of count1 ... countN-1). */ |
2223 | if (omp_find_clause (gimple_omp_for_clauses (for_stmt), |
2224 | OMP_CLAUSE_LASTPRIVATE) |
2225 | || (msk == GF_OMP_FOR_KIND_FOR |
2226 | && omp_find_clause (gimple_omp_parallel_clauses (stmt), |
2227 | OMP_CLAUSE_LASTPRIVATE))) |
2228 | { |
2229 | tree temp = create_tmp_var (type); |
2230 | tree c = build_omp_clause (UNKNOWN_LOCATION((location_t) 0), |
2231 | OMP_CLAUSE__LOOPTEMP_); |
2232 | insert_decl_map (&outer_ctx->cb, temp, temp); |
2233 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2233, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2233, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2233, __FUNCTION__))) = temp; |
2234 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2234, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2234, __FUNCTION__))->common.chain) = gimple_omp_taskreg_clauses (stmt); |
2235 | gimple_omp_taskreg_set_clauses (stmt, c); |
2236 | } |
2237 | if (fd.non_rect |
2238 | && fd.last_nonrect == fd.first_nonrect + 1) |
2239 | if (tree v = gimple_omp_for_index (for_stmt, fd.last_nonrect)) |
2240 | if (!TYPE_UNSIGNED (TREE_TYPE (v))((tree_class_check ((((contains_struct_check ((v), (TS_TYPED) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2240, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2240, __FUNCTION__))->base.u.bits.unsigned_flag)) |
2241 | { |
2242 | v = gimple_omp_for_index (for_stmt, fd.first_nonrect); |
2243 | tree type2 = TREE_TYPE (v)((contains_struct_check ((v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2243, __FUNCTION__))->typed.type); |
2244 | count++; |
2245 | for (i = 0; i < 3; i++) |
2246 | { |
2247 | tree temp = create_tmp_var (type2); |
2248 | tree c = build_omp_clause (UNKNOWN_LOCATION((location_t) 0), |
2249 | OMP_CLAUSE__LOOPTEMP_); |
2250 | insert_decl_map (&outer_ctx->cb, temp, temp); |
2251 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2251, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2251, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2251, __FUNCTION__))) = temp; |
2252 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2252, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2252, __FUNCTION__))->common.chain) = gimple_omp_taskreg_clauses (stmt); |
2253 | gimple_omp_taskreg_set_clauses (stmt, c); |
2254 | } |
2255 | } |
2256 | } |
2257 | for (i = 0; i < count; i++) |
2258 | { |
2259 | tree temp = create_tmp_var (type); |
2260 | tree c = build_omp_clause (UNKNOWN_LOCATION((location_t) 0), OMP_CLAUSE__LOOPTEMP_); |
2261 | insert_decl_map (&outer_ctx->cb, temp, temp); |
2262 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2262, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2262, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2262, __FUNCTION__))) = temp; |
2263 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2263, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2263, __FUNCTION__))->common.chain) = gimple_omp_taskreg_clauses (stmt); |
2264 | gimple_omp_taskreg_set_clauses (stmt, c); |
2265 | } |
2266 | } |
2267 | if (msk == GF_OMP_FOR_KIND_TASKLOOP |
2268 | && omp_find_clause (gimple_omp_task_clauses (stmt), |
2269 | OMP_CLAUSE_REDUCTION)) |
2270 | { |
2271 | tree type = build_pointer_type (pointer_sized_int_nodeglobal_trees[TI_POINTER_SIZED_TYPE]); |
2272 | tree temp = create_tmp_var (type); |
2273 | tree c = build_omp_clause (UNKNOWN_LOCATION((location_t) 0), OMP_CLAUSE__REDUCTEMP_); |
2274 | insert_decl_map (&outer_ctx->cb, temp, temp); |
2275 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2275, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2275, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2275, __FUNCTION__))) = temp; |
2276 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2276, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2276, __FUNCTION__))->common.chain) = gimple_omp_task_clauses (stmt); |
2277 | gimple_omp_task_set_clauses (stmt, c); |
2278 | } |
2279 | } |
2280 | |
2281 | /* Scan an OpenMP parallel directive. */ |
2282 | |
2283 | static void |
2284 | scan_omp_parallel (gimple_stmt_iterator *gsi, omp_context *outer_ctx) |
2285 | { |
2286 | omp_context *ctx; |
2287 | tree name; |
2288 | gomp_parallel *stmt = as_a <gomp_parallel *> (gsi_stmt (*gsi)); |
2289 | |
2290 | /* Ignore parallel directives with empty bodies, unless there |
2291 | are copyin clauses. */ |
2292 | if (optimizeglobal_options.x_optimize > 0 |
2293 | && empty_body_p (gimple_omp_body (stmt)) |
2294 | && omp_find_clause (gimple_omp_parallel_clauses (stmt), |
2295 | OMP_CLAUSE_COPYIN) == NULLnullptr) |
2296 | { |
2297 | gsi_replace (gsi, gimple_build_nop (), false); |
2298 | return; |
2299 | } |
2300 | |
2301 | if (gimple_omp_parallel_combined_p (stmt)) |
2302 | add_taskreg_looptemp_clauses (GF_OMP_FOR_KIND_FOR, stmt, outer_ctx); |
2303 | for (tree c = omp_find_clause (gimple_omp_parallel_clauses (stmt), |
2304 | OMP_CLAUSE_REDUCTION); |
2305 | c; c = omp_find_clause (OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2305, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2305, __FUNCTION__))->common.chain), OMP_CLAUSE_REDUCTION)) |
2306 | if (OMP_CLAUSE_REDUCTION_TASK (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2306, __FUNCTION__)))->base.protected_flag)) |
2307 | { |
2308 | tree type = build_pointer_type (pointer_sized_int_nodeglobal_trees[TI_POINTER_SIZED_TYPE]); |
2309 | tree temp = create_tmp_var (type); |
2310 | tree c = build_omp_clause (UNKNOWN_LOCATION((location_t) 0), OMP_CLAUSE__REDUCTEMP_); |
2311 | if (outer_ctx) |
2312 | insert_decl_map (&outer_ctx->cb, temp, temp); |
2313 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2313, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2313, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2313, __FUNCTION__))) = temp; |
2314 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2314, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2314, __FUNCTION__))->common.chain) = gimple_omp_parallel_clauses (stmt); |
2315 | gimple_omp_parallel_set_clauses (stmt, c); |
2316 | break; |
2317 | } |
2318 | else if (OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2318, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2318, __FUNCTION__))->common.chain) == NULL_TREE(tree) nullptr) |
2319 | break; |
2320 | |
2321 | ctx = new_omp_context (stmt, outer_ctx); |
2322 | taskreg_contexts.safe_push (ctx); |
2323 | if (taskreg_nesting_level > 1) |
2324 | ctx->is_nested = true; |
2325 | ctx->field_map = splay_tree_new (splay_tree_compare_pointers, 0, 0); |
2326 | ctx->record_type = lang_hooks.types.make_type (RECORD_TYPE); |
2327 | name = create_tmp_var_name (".omp_data_s"); |
2328 | name = build_decl (gimple_location (stmt), |
2329 | TYPE_DECL, name, ctx->record_type); |
2330 | DECL_ARTIFICIAL (name)((contains_struct_check ((name), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2330, __FUNCTION__))->decl_common.artificial_flag) = 1; |
2331 | DECL_NAMELESS (name)((contains_struct_check ((name), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2331, __FUNCTION__))->base.u.bits.nameless_flag) = 1; |
2332 | TYPE_NAME (ctx->record_type)((tree_class_check ((ctx->record_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2332, __FUNCTION__))->type_common.name) = name; |
2333 | TYPE_ARTIFICIAL (ctx->record_type)((tree_class_check ((ctx->record_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2333, __FUNCTION__))->base.nowarning_flag) = 1; |
2334 | create_omp_child_function (ctx, false); |
2335 | gimple_omp_parallel_set_child_fn (stmt, ctx->cb.dst_fn); |
2336 | |
2337 | scan_sharing_clauses (gimple_omp_parallel_clauses (stmt), ctx); |
2338 | scan_omp (gimple_omp_body_ptr (stmt), ctx); |
2339 | |
2340 | if (TYPE_FIELDS (ctx->record_type)((tree_check3 ((ctx->record_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2340, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values) == NULLnullptr) |
2341 | ctx->record_type = ctx->receiver_decl = NULLnullptr; |
2342 | } |
2343 | |
2344 | /* Scan an OpenMP task directive. */ |
2345 | |
2346 | static void |
2347 | scan_omp_task (gimple_stmt_iterator *gsi, omp_context *outer_ctx) |
2348 | { |
2349 | omp_context *ctx; |
2350 | tree name, t; |
2351 | gomp_task *stmt = as_a <gomp_task *> (gsi_stmt (*gsi)); |
2352 | |
2353 | /* Ignore task directives with empty bodies, unless they have depend |
2354 | clause. */ |
2355 | if (optimizeglobal_options.x_optimize > 0 |
2356 | && gimple_omp_body (stmt) |
2357 | && empty_body_p (gimple_omp_body (stmt)) |
2358 | && !omp_find_clause (gimple_omp_task_clauses (stmt), OMP_CLAUSE_DEPEND)) |
2359 | { |
2360 | gsi_replace (gsi, gimple_build_nop (), false); |
2361 | return; |
2362 | } |
2363 | |
2364 | if (gimple_omp_task_taskloop_p (stmt)) |
2365 | add_taskreg_looptemp_clauses (GF_OMP_FOR_KIND_TASKLOOP, stmt, outer_ctx); |
2366 | |
2367 | ctx = new_omp_context (stmt, outer_ctx); |
2368 | |
2369 | if (gimple_omp_task_taskwait_p (stmt)) |
2370 | { |
2371 | scan_sharing_clauses (gimple_omp_task_clauses (stmt), ctx); |
2372 | return; |
2373 | } |
2374 | |
2375 | taskreg_contexts.safe_push (ctx); |
2376 | if (taskreg_nesting_level > 1) |
2377 | ctx->is_nested = true; |
2378 | ctx->field_map = splay_tree_new (splay_tree_compare_pointers, 0, 0); |
2379 | ctx->record_type = lang_hooks.types.make_type (RECORD_TYPE); |
2380 | name = create_tmp_var_name (".omp_data_s"); |
2381 | name = build_decl (gimple_location (stmt), |
2382 | TYPE_DECL, name, ctx->record_type); |
2383 | DECL_ARTIFICIAL (name)((contains_struct_check ((name), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2383, __FUNCTION__))->decl_common.artificial_flag) = 1; |
2384 | DECL_NAMELESS (name)((contains_struct_check ((name), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2384, __FUNCTION__))->base.u.bits.nameless_flag) = 1; |
2385 | TYPE_NAME (ctx->record_type)((tree_class_check ((ctx->record_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2385, __FUNCTION__))->type_common.name) = name; |
2386 | TYPE_ARTIFICIAL (ctx->record_type)((tree_class_check ((ctx->record_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2386, __FUNCTION__))->base.nowarning_flag) = 1; |
2387 | create_omp_child_function (ctx, false); |
2388 | gimple_omp_task_set_child_fn (stmt, ctx->cb.dst_fn); |
2389 | |
2390 | scan_sharing_clauses (gimple_omp_task_clauses (stmt), ctx); |
2391 | |
2392 | if (ctx->srecord_type) |
2393 | { |
2394 | name = create_tmp_var_name (".omp_data_a"); |
2395 | name = build_decl (gimple_location (stmt), |
2396 | TYPE_DECL, name, ctx->srecord_type); |
2397 | DECL_ARTIFICIAL (name)((contains_struct_check ((name), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2397, __FUNCTION__))->decl_common.artificial_flag) = 1; |
2398 | DECL_NAMELESS (name)((contains_struct_check ((name), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2398, __FUNCTION__))->base.u.bits.nameless_flag) = 1; |
2399 | TYPE_NAME (ctx->srecord_type)((tree_class_check ((ctx->srecord_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2399, __FUNCTION__))->type_common.name) = name; |
2400 | TYPE_ARTIFICIAL (ctx->srecord_type)((tree_class_check ((ctx->srecord_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2400, __FUNCTION__))->base.nowarning_flag) = 1; |
2401 | create_omp_child_function (ctx, true); |
2402 | } |
2403 | |
2404 | scan_omp (gimple_omp_body_ptr (stmt), ctx); |
2405 | |
2406 | if (TYPE_FIELDS (ctx->record_type)((tree_check3 ((ctx->record_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2406, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values) == NULLnullptr) |
2407 | { |
2408 | ctx->record_type = ctx->receiver_decl = NULLnullptr; |
2409 | t = build_int_cst (long_integer_type_nodeinteger_types[itk_long], 0); |
2410 | gimple_omp_task_set_arg_size (stmt, t); |
2411 | t = build_int_cst (long_integer_type_nodeinteger_types[itk_long], 1); |
2412 | gimple_omp_task_set_arg_align (stmt, t); |
2413 | } |
2414 | } |
2415 | |
2416 | /* Helper function for finish_taskreg_scan, called through walk_tree. |
2417 | If maybe_lookup_decl_in_outer_context returns non-NULL for some |
2418 | tree, replace it in the expression. */ |
2419 | |
2420 | static tree |
2421 | finish_taskreg_remap (tree *tp, int *walk_subtrees, void *data) |
2422 | { |
2423 | if (VAR_P (*tp)(((enum tree_code) (*tp)->base.code) == VAR_DECL)) |
2424 | { |
2425 | omp_context *ctx = (omp_context *) data; |
2426 | tree t = maybe_lookup_decl_in_outer_ctx (*tp, ctx); |
2427 | if (t != *tp) |
2428 | { |
2429 | if (DECL_HAS_VALUE_EXPR_P (t)((tree_check3 ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2429, __FUNCTION__, (VAR_DECL), (PARM_DECL), (RESULT_DECL)) ) ->decl_common.decl_flag_2)) |
2430 | t = unshare_expr (DECL_VALUE_EXPR (t)(decl_value_expr_lookup ((contains_struct_check ((t), (TS_DECL_WRTL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2430, __FUNCTION__))))); |
2431 | *tp = t; |
2432 | } |
2433 | *walk_subtrees = 0; |
2434 | } |
2435 | else if (IS_TYPE_OR_DECL_P (*tp)((tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) (*tp)->base.code))] == tcc_type) || (tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) (*tp)-> base.code))] == tcc_declaration))) |
2436 | *walk_subtrees = 0; |
2437 | return NULL_TREE(tree) nullptr; |
2438 | } |
2439 | |
2440 | /* If any decls have been made addressable during scan_omp, |
2441 | adjust their fields if needed, and layout record types |
2442 | of parallel/task constructs. */ |
2443 | |
2444 | static void |
2445 | finish_taskreg_scan (omp_context *ctx) |
2446 | { |
2447 | if (ctx->record_type == NULL_TREE(tree) nullptr) |
2448 | return; |
2449 | |
2450 | /* If any make_addressable_vars were needed, verify all |
2451 | OMP_CLAUSE_SHARED clauses on GIMPLE_OMP_{PARALLEL,TASK,TEAMS} |
2452 | statements if use_pointer_for_field hasn't changed |
2453 | because of that. If it did, update field types now. */ |
2454 | if (make_addressable_vars) |
2455 | { |
2456 | tree c; |
2457 | |
2458 | for (c = gimple_omp_taskreg_clauses (ctx->stmt); |
2459 | c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2459, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2459, __FUNCTION__))->common.chain)) |
2460 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2460, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_SHARED |
2461 | && !OMP_CLAUSE_SHARED_FIRSTPRIVATE (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_SHARED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2461, __FUNCTION__))->base.public_flag)) |
2462 | { |
2463 | tree decl = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2463, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2463, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2463, __FUNCTION__))); |
2464 | |
2465 | /* Global variables don't need to be copied, |
2466 | the receiver side will use them directly. */ |
2467 | if (is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx))) |
2468 | continue; |
2469 | if (!bitmap_bit_p (make_addressable_vars, DECL_UID (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2469, __FUNCTION__))->decl_minimal.uid)) |
2470 | || !use_pointer_for_field (decl, ctx)) |
2471 | continue; |
2472 | tree field = lookup_field (decl, ctx); |
2473 | if (TREE_CODE (TREE_TYPE (field))((enum tree_code) (((contains_struct_check ((field), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2473, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE |
2474 | && TREE_TYPE (TREE_TYPE (field))((contains_struct_check ((((contains_struct_check ((field), ( TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2474, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2474, __FUNCTION__))->typed.type) == TREE_TYPE (decl)((contains_struct_check ((decl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2474, __FUNCTION__))->typed.type)) |
2475 | continue; |
2476 | TREE_TYPE (field)((contains_struct_check ((field), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2476, __FUNCTION__))->typed.type) = build_pointer_type (TREE_TYPE (decl)((contains_struct_check ((decl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2476, __FUNCTION__))->typed.type)); |
2477 | TREE_THIS_VOLATILE (field)((field)->base.volatile_flag) = 0; |
2478 | DECL_USER_ALIGN (field)((contains_struct_check ((field), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2478, __FUNCTION__))->base.u.bits.user_align) = 0; |
2479 | SET_DECL_ALIGN (field, TYPE_ALIGN (TREE_TYPE (field)))(((contains_struct_check ((field), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2479, __FUNCTION__))->decl_common.align) = ffs_hwi ((((tree_class_check ((((contains_struct_check ((field), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2479, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2479, __FUNCTION__))->type_common.align) ? ((unsigned)1) << (((tree_class_check ((((contains_struct_check ((field ), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2479, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2479, __FUNCTION__))->type_common.align) - 1) : 0))); |
2480 | if (TYPE_ALIGN (ctx->record_type)(((tree_class_check ((ctx->record_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2480, __FUNCTION__))->type_common.align) ? ((unsigned)1) << (((tree_class_check ((ctx->record_type), (tcc_type ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2480, __FUNCTION__))->type_common.align) - 1) : 0) < DECL_ALIGN (field)(((contains_struct_check ((field), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2480, __FUNCTION__))->decl_common.align) ? ((unsigned)1) << (((contains_struct_check ((field), (TS_DECL_COMMON) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2480, __FUNCTION__))->decl_common.align) - 1) : 0)) |
2481 | SET_TYPE_ALIGN (ctx->record_type, DECL_ALIGN (field))((tree_class_check ((ctx->record_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2481, __FUNCTION__))->type_common.align = ffs_hwi ((((contains_struct_check ((field), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2481, __FUNCTION__))->decl_common.align) ? ((unsigned)1) << (((contains_struct_check ((field), (TS_DECL_COMMON) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2481, __FUNCTION__))->decl_common.align) - 1) : 0))); |
2482 | if (ctx->srecord_type) |
2483 | { |
2484 | tree sfield = lookup_sfield (decl, ctx); |
2485 | TREE_TYPE (sfield)((contains_struct_check ((sfield), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2485, __FUNCTION__))->typed.type) = TREE_TYPE (field)((contains_struct_check ((field), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2485, __FUNCTION__))->typed.type); |
2486 | TREE_THIS_VOLATILE (sfield)((sfield)->base.volatile_flag) = 0; |
2487 | DECL_USER_ALIGN (sfield)((contains_struct_check ((sfield), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2487, __FUNCTION__))->base.u.bits.user_align) = 0; |
2488 | SET_DECL_ALIGN (sfield, DECL_ALIGN (field))(((contains_struct_check ((sfield), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2488, __FUNCTION__))->decl_common.align) = ffs_hwi ((((contains_struct_check ((field), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2488, __FUNCTION__))->decl_common.align) ? ((unsigned)1) << (((contains_struct_check ((field), (TS_DECL_COMMON) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2488, __FUNCTION__))->decl_common.align) - 1) : 0))); |
2489 | if (TYPE_ALIGN (ctx->srecord_type)(((tree_class_check ((ctx->srecord_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2489, __FUNCTION__))->type_common.align) ? ((unsigned)1) << (((tree_class_check ((ctx->srecord_type), (tcc_type ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2489, __FUNCTION__))->type_common.align) - 1) : 0) < DECL_ALIGN (sfield)(((contains_struct_check ((sfield), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2489, __FUNCTION__))->decl_common.align) ? ((unsigned)1) << (((contains_struct_check ((sfield), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2489, __FUNCTION__))->decl_common.align) - 1) : 0)) |
2490 | SET_TYPE_ALIGN (ctx->srecord_type, DECL_ALIGN (sfield))((tree_class_check ((ctx->srecord_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2490, __FUNCTION__))->type_common.align = ffs_hwi ((((contains_struct_check ((sfield), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2490, __FUNCTION__))->decl_common.align) ? ((unsigned)1) << (((contains_struct_check ((sfield), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2490, __FUNCTION__))->decl_common.align) - 1) : 0))); |
2491 | } |
2492 | } |
2493 | } |
2494 | |
2495 | if (gimple_code (ctx->stmt) == GIMPLE_OMP_PARALLEL) |
2496 | { |
2497 | tree clauses = gimple_omp_parallel_clauses (ctx->stmt); |
2498 | tree c = omp_find_clause (clauses, OMP_CLAUSE__REDUCTEMP_); |
2499 | if (c) |
2500 | { |
2501 | /* Move the _reductemp_ clause first. GOMP_parallel_reductions |
2502 | expects to find it at the start of data. */ |
2503 | tree f = lookup_field (OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2503, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2503, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2503, __FUNCTION__))), ctx); |
2504 | tree *p = &TYPE_FIELDS (ctx->record_type)((tree_check3 ((ctx->record_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2504, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); |
2505 | while (*p) |
2506 | if (*p == f) |
2507 | { |
2508 | *p = DECL_CHAIN (*p)(((contains_struct_check (((contains_struct_check ((*p), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2508, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2508, __FUNCTION__))->common.chain)); |
2509 | break; |
2510 | } |
2511 | else |
2512 | p = &DECL_CHAIN (*p)(((contains_struct_check (((contains_struct_check ((*p), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2512, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2512, __FUNCTION__))->common.chain)); |
2513 | DECL_CHAIN (f)(((contains_struct_check (((contains_struct_check ((f), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2513, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2513, __FUNCTION__))->common.chain)) = TYPE_FIELDS (ctx->record_type)((tree_check3 ((ctx->record_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2513, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); |
2514 | TYPE_FIELDS (ctx->record_type)((tree_check3 ((ctx->record_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2514, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values) = f; |
2515 | } |
2516 | layout_type (ctx->record_type); |
2517 | fixup_child_record_type (ctx); |
2518 | } |
2519 | else if (gimple_code (ctx->stmt) == GIMPLE_OMP_TEAMS) |
2520 | { |
2521 | layout_type (ctx->record_type); |
2522 | fixup_child_record_type (ctx); |
2523 | } |
2524 | else |
2525 | { |
2526 | location_t loc = gimple_location (ctx->stmt); |
2527 | tree *p, vla_fields = NULL_TREE(tree) nullptr, *q = &vla_fields; |
2528 | tree detach_clause |
2529 | = omp_find_clause (gimple_omp_task_clauses (ctx->stmt), |
2530 | OMP_CLAUSE_DETACH); |
2531 | /* Move VLA fields to the end. */ |
2532 | p = &TYPE_FIELDS (ctx->record_type)((tree_check3 ((ctx->record_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2532, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); |
2533 | while (*p) |
2534 | if (!TYPE_SIZE_UNIT (TREE_TYPE (*p))((tree_class_check ((((contains_struct_check ((*p), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2534, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2534, __FUNCTION__))->type_common.size_unit) |
2535 | || ! TREE_CONSTANT (TYPE_SIZE_UNIT (TREE_TYPE (*p)))((non_type_check ((((tree_class_check ((((contains_struct_check ((*p), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2535, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2535, __FUNCTION__))->type_common.size_unit)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2535, __FUNCTION__))->base.constant_flag)) |
2536 | { |
2537 | *q = *p; |
2538 | *p = TREE_CHAIN (*p)((contains_struct_check ((*p), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2538, __FUNCTION__))->common.chain); |
2539 | TREE_CHAIN (*q)((contains_struct_check ((*q), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2539, __FUNCTION__))->common.chain) = NULL_TREE(tree) nullptr; |
2540 | q = &TREE_CHAIN (*q)((contains_struct_check ((*q), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2540, __FUNCTION__))->common.chain); |
2541 | } |
2542 | else |
2543 | p = &DECL_CHAIN (*p)(((contains_struct_check (((contains_struct_check ((*p), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2543, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2543, __FUNCTION__))->common.chain)); |
2544 | *p = vla_fields; |
2545 | if (gimple_omp_task_taskloop_p (ctx->stmt)) |
2546 | { |
2547 | /* Move fields corresponding to first and second _looptemp_ |
2548 | clause first. There are filled by GOMP_taskloop |
2549 | and thus need to be in specific positions. */ |
2550 | tree clauses = gimple_omp_task_clauses (ctx->stmt); |
2551 | tree c1 = omp_find_clause (clauses, OMP_CLAUSE__LOOPTEMP_); |
2552 | tree c2 = omp_find_clause (OMP_CLAUSE_CHAIN (c1)((contains_struct_check (((tree_check ((c1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2552, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2552, __FUNCTION__))->common.chain), |
2553 | OMP_CLAUSE__LOOPTEMP_); |
2554 | tree c3 = omp_find_clause (clauses, OMP_CLAUSE__REDUCTEMP_); |
2555 | tree f1 = lookup_field (OMP_CLAUSE_DECL (c1)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2555, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2555, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2555, __FUNCTION__))), ctx); |
2556 | tree f2 = lookup_field (OMP_CLAUSE_DECL (c2)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2556, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2556, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2556, __FUNCTION__))), ctx); |
2557 | tree f3 = c3 ? lookup_field (OMP_CLAUSE_DECL (c3)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2557, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2557, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2557, __FUNCTION__))), ctx) : NULL_TREE(tree) nullptr; |
2558 | p = &TYPE_FIELDS (ctx->record_type)((tree_check3 ((ctx->record_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2558, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); |
2559 | while (*p) |
2560 | if (*p == f1 || *p == f2 || *p == f3) |
2561 | *p = DECL_CHAIN (*p)(((contains_struct_check (((contains_struct_check ((*p), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2561, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2561, __FUNCTION__))->common.chain)); |
2562 | else |
2563 | p = &DECL_CHAIN (*p)(((contains_struct_check (((contains_struct_check ((*p), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2563, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2563, __FUNCTION__))->common.chain)); |
2564 | DECL_CHAIN (f1)(((contains_struct_check (((contains_struct_check ((f1), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2564, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2564, __FUNCTION__))->common.chain)) = f2; |
2565 | if (c3) |
2566 | { |
2567 | DECL_CHAIN (f2)(((contains_struct_check (((contains_struct_check ((f2), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2567, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2567, __FUNCTION__))->common.chain)) = f3; |
2568 | DECL_CHAIN (f3)(((contains_struct_check (((contains_struct_check ((f3), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2568, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2568, __FUNCTION__))->common.chain)) = TYPE_FIELDS (ctx->record_type)((tree_check3 ((ctx->record_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2568, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); |
2569 | } |
2570 | else |
2571 | DECL_CHAIN (f2)(((contains_struct_check (((contains_struct_check ((f2), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2571, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2571, __FUNCTION__))->common.chain)) = TYPE_FIELDS (ctx->record_type)((tree_check3 ((ctx->record_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2571, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); |
2572 | TYPE_FIELDS (ctx->record_type)((tree_check3 ((ctx->record_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2572, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values) = f1; |
2573 | if (ctx->srecord_type) |
2574 | { |
2575 | f1 = lookup_sfield (OMP_CLAUSE_DECL (c1)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2575, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2575, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2575, __FUNCTION__))), ctx); |
2576 | f2 = lookup_sfield (OMP_CLAUSE_DECL (c2)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2576, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2576, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2576, __FUNCTION__))), ctx); |
2577 | if (c3) |
2578 | f3 = lookup_sfield (OMP_CLAUSE_DECL (c3)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2578, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2578, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2578, __FUNCTION__))), ctx); |
2579 | p = &TYPE_FIELDS (ctx->srecord_type)((tree_check3 ((ctx->srecord_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2579, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); |
2580 | while (*p) |
2581 | if (*p == f1 || *p == f2 || *p == f3) |
2582 | *p = DECL_CHAIN (*p)(((contains_struct_check (((contains_struct_check ((*p), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2582, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2582, __FUNCTION__))->common.chain)); |
2583 | else |
2584 | p = &DECL_CHAIN (*p)(((contains_struct_check (((contains_struct_check ((*p), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2584, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2584, __FUNCTION__))->common.chain)); |
2585 | DECL_CHAIN (f1)(((contains_struct_check (((contains_struct_check ((f1), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2585, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2585, __FUNCTION__))->common.chain)) = f2; |
2586 | DECL_CHAIN (f2)(((contains_struct_check (((contains_struct_check ((f2), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2586, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2586, __FUNCTION__))->common.chain)) = TYPE_FIELDS (ctx->srecord_type)((tree_check3 ((ctx->srecord_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2586, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); |
2587 | if (c3) |
2588 | { |
2589 | DECL_CHAIN (f2)(((contains_struct_check (((contains_struct_check ((f2), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2589, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2589, __FUNCTION__))->common.chain)) = f3; |
2590 | DECL_CHAIN (f3)(((contains_struct_check (((contains_struct_check ((f3), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2590, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2590, __FUNCTION__))->common.chain)) = TYPE_FIELDS (ctx->srecord_type)((tree_check3 ((ctx->srecord_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2590, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); |
2591 | } |
2592 | else |
2593 | DECL_CHAIN (f2)(((contains_struct_check (((contains_struct_check ((f2), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2593, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2593, __FUNCTION__))->common.chain)) = TYPE_FIELDS (ctx->srecord_type)((tree_check3 ((ctx->srecord_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2593, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); |
2594 | TYPE_FIELDS (ctx->srecord_type)((tree_check3 ((ctx->srecord_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2594, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values) = f1; |
2595 | } |
2596 | } |
2597 | if (detach_clause) |
2598 | { |
2599 | tree c, field; |
2600 | |
2601 | /* Look for a firstprivate clause with the detach event handle. */ |
2602 | for (c = gimple_omp_taskreg_clauses (ctx->stmt); |
2603 | c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2603, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2603, __FUNCTION__))->common.chain)) |
2604 | { |
2605 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2605, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code != OMP_CLAUSE_FIRSTPRIVATE) |
2606 | continue; |
2607 | if (maybe_lookup_decl_in_outer_ctx (OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2607, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2607, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2607, __FUNCTION__))), ctx) |
2608 | == OMP_CLAUSE_DECL (detach_clause)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((detach_clause), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2608, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2608, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2608, __FUNCTION__)))) |
2609 | break; |
2610 | } |
2611 | |
2612 | gcc_assert (c)((void)(!(c) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2612, __FUNCTION__), 0 : 0)); |
2613 | field = lookup_field (OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2613, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2613, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2613, __FUNCTION__))), ctx); |
2614 | |
2615 | /* Move field corresponding to the detach clause first. |
2616 | This is filled by GOMP_task and needs to be in a |
2617 | specific position. */ |
2618 | p = &TYPE_FIELDS (ctx->record_type)((tree_check3 ((ctx->record_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2618, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); |
2619 | while (*p) |
2620 | if (*p == field) |
2621 | *p = DECL_CHAIN (*p)(((contains_struct_check (((contains_struct_check ((*p), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2621, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2621, __FUNCTION__))->common.chain)); |
2622 | else |
2623 | p = &DECL_CHAIN (*p)(((contains_struct_check (((contains_struct_check ((*p), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2623, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2623, __FUNCTION__))->common.chain)); |
2624 | DECL_CHAIN (field)(((contains_struct_check (((contains_struct_check ((field), ( TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2624, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2624, __FUNCTION__))->common.chain)) = TYPE_FIELDS (ctx->record_type)((tree_check3 ((ctx->record_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2624, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); |
2625 | TYPE_FIELDS (ctx->record_type)((tree_check3 ((ctx->record_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2625, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values) = field; |
2626 | if (ctx->srecord_type) |
2627 | { |
2628 | field = lookup_sfield (OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2628, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2628, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2628, __FUNCTION__))), ctx); |
2629 | p = &TYPE_FIELDS (ctx->srecord_type)((tree_check3 ((ctx->srecord_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2629, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); |
2630 | while (*p) |
2631 | if (*p == field) |
2632 | *p = DECL_CHAIN (*p)(((contains_struct_check (((contains_struct_check ((*p), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2632, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2632, __FUNCTION__))->common.chain)); |
2633 | else |
2634 | p = &DECL_CHAIN (*p)(((contains_struct_check (((contains_struct_check ((*p), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2634, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2634, __FUNCTION__))->common.chain)); |
2635 | DECL_CHAIN (field)(((contains_struct_check (((contains_struct_check ((field), ( TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2635, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2635, __FUNCTION__))->common.chain)) = TYPE_FIELDS (ctx->srecord_type)((tree_check3 ((ctx->srecord_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2635, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); |
2636 | TYPE_FIELDS (ctx->srecord_type)((tree_check3 ((ctx->srecord_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2636, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values) = field; |
2637 | } |
2638 | } |
2639 | layout_type (ctx->record_type); |
2640 | fixup_child_record_type (ctx); |
2641 | if (ctx->srecord_type) |
2642 | layout_type (ctx->srecord_type); |
2643 | tree t = fold_convert_loc (loc, long_integer_type_nodeinteger_types[itk_long], |
2644 | TYPE_SIZE_UNIT (ctx->record_type)((tree_class_check ((ctx->record_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2644, __FUNCTION__))->type_common.size_unit)); |
2645 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) != INTEGER_CST) |
2646 | { |
2647 | t = unshare_expr (t); |
2648 | walk_tree (&t, finish_taskreg_remap, ctx, NULL)walk_tree_1 (&t, finish_taskreg_remap, ctx, nullptr, nullptr ); |
2649 | } |
2650 | gimple_omp_task_set_arg_size (ctx->stmt, t); |
2651 | t = build_int_cst (long_integer_type_nodeinteger_types[itk_long], |
2652 | TYPE_ALIGN_UNIT (ctx->record_type)((((tree_class_check ((ctx->record_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2652, __FUNCTION__))->type_common.align) ? ((unsigned)1) << (((tree_class_check ((ctx->record_type), (tcc_type ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2652, __FUNCTION__))->type_common.align) - 1) : 0) / (8) )); |
2653 | gimple_omp_task_set_arg_align (ctx->stmt, t); |
2654 | } |
2655 | } |
2656 | |
2657 | /* Find the enclosing offload context. */ |
2658 | |
2659 | static omp_context * |
2660 | enclosing_target_ctx (omp_context *ctx) |
2661 | { |
2662 | for (; ctx; ctx = ctx->outer) |
2663 | if (gimple_code (ctx->stmt) == GIMPLE_OMP_TARGET) |
2664 | break; |
2665 | |
2666 | return ctx; |
2667 | } |
2668 | |
2669 | /* Return whether CTX's parent compute construct is an OpenACC 'kernels' |
2670 | construct. |
2671 | (This doesn't include OpenACC 'kernels' decomposed parts.) */ |
2672 | |
2673 | static bool |
2674 | ctx_in_oacc_kernels_region (omp_context *ctx) |
2675 | { |
2676 | for (;ctx != NULLnullptr; ctx = ctx->outer) |
2677 | { |
2678 | gimple *stmt = ctx->stmt; |
2679 | if (gimple_code (stmt) == GIMPLE_OMP_TARGET |
2680 | && gimple_omp_target_kind (stmt) == GF_OMP_TARGET_KIND_OACC_KERNELS) |
2681 | return true; |
2682 | } |
2683 | |
2684 | return false; |
2685 | } |
2686 | |
2687 | /* Check the parallelism clauses inside a OpenACC 'kernels' region. |
2688 | (This doesn't include OpenACC 'kernels' decomposed parts.) |
2689 | Until kernels handling moves to use the same loop indirection |
2690 | scheme as parallel, we need to do this checking early. */ |
2691 | |
2692 | static unsigned |
2693 | check_oacc_kernel_gwv (gomp_for *stmt, omp_context *ctx) |
2694 | { |
2695 | bool checking = true; |
2696 | unsigned outer_mask = 0; |
2697 | unsigned this_mask = 0; |
2698 | bool has_seq = false, has_auto = false; |
2699 | |
2700 | if (ctx->outer) |
2701 | outer_mask = check_oacc_kernel_gwv (NULLnullptr, ctx->outer); |
2702 | if (!stmt) |
2703 | { |
2704 | checking = false; |
2705 | if (gimple_code (ctx->stmt) != GIMPLE_OMP_FOR) |
2706 | return outer_mask; |
2707 | stmt = as_a <gomp_for *> (ctx->stmt); |
2708 | } |
2709 | |
2710 | for (tree c = gimple_omp_for_clauses (stmt); c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2710, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2710, __FUNCTION__))->common.chain)) |
2711 | { |
2712 | switch (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2712, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code) |
2713 | { |
2714 | case OMP_CLAUSE_GANG: |
2715 | this_mask |= GOMP_DIM_MASK (GOMP_DIM_GANG)(1u << (0)); |
2716 | break; |
2717 | case OMP_CLAUSE_WORKER: |
2718 | this_mask |= GOMP_DIM_MASK (GOMP_DIM_WORKER)(1u << (1)); |
2719 | break; |
2720 | case OMP_CLAUSE_VECTOR: |
2721 | this_mask |= GOMP_DIM_MASK (GOMP_DIM_VECTOR)(1u << (2)); |
2722 | break; |
2723 | case OMP_CLAUSE_SEQ: |
2724 | has_seq = true; |
2725 | break; |
2726 | case OMP_CLAUSE_AUTO: |
2727 | has_auto = true; |
2728 | break; |
2729 | default: |
2730 | break; |
2731 | } |
2732 | } |
2733 | |
2734 | if (checking) |
2735 | { |
2736 | if (has_seq && (this_mask || has_auto)) |
2737 | error_at (gimple_location (stmt), "%<seq%> overrides other" |
2738 | " OpenACC loop specifiers"); |
2739 | else if (has_auto && this_mask) |
2740 | error_at (gimple_location (stmt), "%<auto%> conflicts with other" |
2741 | " OpenACC loop specifiers"); |
2742 | |
2743 | if (this_mask & outer_mask) |
2744 | error_at (gimple_location (stmt), "inner loop uses same" |
2745 | " OpenACC parallelism as containing loop"); |
2746 | } |
2747 | |
2748 | return outer_mask | this_mask; |
2749 | } |
2750 | |
2751 | /* Scan a GIMPLE_OMP_FOR. */ |
2752 | |
2753 | static omp_context * |
2754 | scan_omp_for (gomp_for *stmt, omp_context *outer_ctx) |
2755 | { |
2756 | omp_context *ctx; |
2757 | size_t i; |
2758 | tree clauses = gimple_omp_for_clauses (stmt); |
2759 | |
2760 | ctx = new_omp_context (stmt, outer_ctx); |
2761 | |
2762 | if (is_gimple_omp_oacc (stmt)) |
2763 | { |
2764 | omp_context *tgt = enclosing_target_ctx (outer_ctx); |
2765 | |
2766 | if (!(tgt && is_oacc_kernels (tgt))) |
2767 | for (tree c = clauses; c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2767, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2767, __FUNCTION__))->common.chain)) |
2768 | { |
2769 | tree c_op0; |
2770 | switch (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2770, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code) |
2771 | { |
2772 | case OMP_CLAUSE_GANG: |
2773 | c_op0 = OMP_CLAUSE_GANG_EXPR (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_GANG ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2773, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2773, __FUNCTION__))); |
2774 | break; |
2775 | |
2776 | case OMP_CLAUSE_WORKER: |
2777 | c_op0 = OMP_CLAUSE_WORKER_EXPR (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_WORKER ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2777, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2777, __FUNCTION__))); |
2778 | break; |
2779 | |
2780 | case OMP_CLAUSE_VECTOR: |
2781 | c_op0 = OMP_CLAUSE_VECTOR_EXPR (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_VECTOR ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2781, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2781, __FUNCTION__))); |
2782 | break; |
2783 | |
2784 | default: |
2785 | continue; |
2786 | } |
2787 | |
2788 | if (c_op0) |
2789 | { |
2790 | /* By construction, this is impossible for OpenACC 'kernels' |
2791 | decomposed parts. */ |
2792 | gcc_assert (!(tgt && is_oacc_kernels_decomposed_part (tgt)))((void)(!(!(tgt && is_oacc_kernels_decomposed_part (tgt ))) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2792, __FUNCTION__), 0 : 0)); |
2793 | |
2794 | error_at (OMP_CLAUSE_LOCATION (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2794, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, |
2795 | "argument not permitted on %qs clause", |
2796 | omp_clause_code_name[OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2796, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code]); |
2797 | if (tgt) |
2798 | inform (gimple_location (tgt->stmt), |
2799 | "enclosing parent compute construct"); |
2800 | else if (oacc_get_fn_attrib (current_function_decl)) |
2801 | inform (DECL_SOURCE_LOCATION (current_function_decl)((contains_struct_check ((current_function_decl), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2801, __FUNCTION__))->decl_minimal.locus), |
2802 | "enclosing routine"); |
2803 | else |
2804 | gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2804, __FUNCTION__)); |
2805 | } |
2806 | } |
2807 | |
2808 | if (tgt && is_oacc_kernels (tgt)) |
2809 | check_oacc_kernel_gwv (stmt, ctx); |
2810 | |
2811 | /* Collect all variables named in reductions on this loop. Ensure |
2812 | that, if this loop has a reduction on some variable v, and there is |
2813 | a reduction on v somewhere in an outer context, then there is a |
2814 | reduction on v on all intervening loops as well. */ |
2815 | tree local_reduction_clauses = NULLnullptr; |
2816 | for (tree c = gimple_omp_for_clauses (stmt); c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2816, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2816, __FUNCTION__))->common.chain)) |
2817 | { |
2818 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2818, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_REDUCTION) |
2819 | local_reduction_clauses |
2820 | = tree_cons (NULLnullptr, c, local_reduction_clauses); |
2821 | } |
2822 | if (ctx->outer_reduction_clauses == NULLnullptr && ctx->outer != NULLnullptr) |
2823 | ctx->outer_reduction_clauses |
2824 | = chainon (unshare_expr (ctx->outer->local_reduction_clauses), |
2825 | ctx->outer->outer_reduction_clauses); |
2826 | tree outer_reduction_clauses = ctx->outer_reduction_clauses; |
2827 | tree local_iter = local_reduction_clauses; |
2828 | for (; local_iter; local_iter = TREE_CHAIN (local_iter)((contains_struct_check ((local_iter), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2828, __FUNCTION__))->common.chain)) |
2829 | { |
2830 | tree local_clause = TREE_VALUE (local_iter)((tree_check ((local_iter), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2830, __FUNCTION__, (TREE_LIST)))->list.value); |
2831 | tree local_var = OMP_CLAUSE_DECL (local_clause)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((local_clause), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2831, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2831, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2831, __FUNCTION__))); |
2832 | tree_code local_op = OMP_CLAUSE_REDUCTION_CODE (local_clause)((omp_clause_range_check ((local_clause), (OMP_CLAUSE_REDUCTION ), (OMP_CLAUSE_IN_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2832, __FUNCTION__))->omp_clause.subcode.reduction_code); |
2833 | bool have_outer_reduction = false; |
2834 | tree ctx_iter = outer_reduction_clauses; |
2835 | for (; ctx_iter; ctx_iter = TREE_CHAIN (ctx_iter)((contains_struct_check ((ctx_iter), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2835, __FUNCTION__))->common.chain)) |
2836 | { |
2837 | tree outer_clause = TREE_VALUE (ctx_iter)((tree_check ((ctx_iter), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2837, __FUNCTION__, (TREE_LIST)))->list.value); |
2838 | tree outer_var = OMP_CLAUSE_DECL (outer_clause)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((outer_clause), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2838, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2838, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2838, __FUNCTION__))); |
2839 | tree_code outer_op = OMP_CLAUSE_REDUCTION_CODE (outer_clause)((omp_clause_range_check ((outer_clause), (OMP_CLAUSE_REDUCTION ), (OMP_CLAUSE_IN_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2839, __FUNCTION__))->omp_clause.subcode.reduction_code); |
2840 | if (outer_var == local_var && outer_op != local_op) |
2841 | { |
2842 | warning_at (OMP_CLAUSE_LOCATION (local_clause)((tree_check ((local_clause), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2842, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, 0, |
2843 | "conflicting reduction operations for %qE", |
2844 | local_var); |
2845 | inform (OMP_CLAUSE_LOCATION (outer_clause)((tree_check ((outer_clause), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2845, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, |
2846 | "location of the previous reduction for %qE", |
2847 | outer_var); |
2848 | } |
2849 | if (outer_var == local_var) |
2850 | { |
2851 | have_outer_reduction = true; |
2852 | break; |
2853 | } |
2854 | } |
2855 | if (have_outer_reduction) |
2856 | { |
2857 | /* There is a reduction on outer_var both on this loop and on |
2858 | some enclosing loop. Walk up the context tree until such a |
2859 | loop with a reduction on outer_var is found, and complain |
2860 | about all intervening loops that do not have such a |
2861 | reduction. */ |
2862 | struct omp_context *curr_loop = ctx->outer; |
2863 | bool found = false; |
2864 | while (curr_loop != NULLnullptr) |
2865 | { |
2866 | tree curr_iter = curr_loop->local_reduction_clauses; |
2867 | for (; curr_iter; curr_iter = TREE_CHAIN (curr_iter)((contains_struct_check ((curr_iter), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2867, __FUNCTION__))->common.chain)) |
2868 | { |
2869 | tree curr_clause = TREE_VALUE (curr_iter)((tree_check ((curr_iter), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2869, __FUNCTION__, (TREE_LIST)))->list.value); |
2870 | tree curr_var = OMP_CLAUSE_DECL (curr_clause)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((curr_clause), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2870, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2870, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2870, __FUNCTION__))); |
2871 | if (curr_var == local_var) |
2872 | { |
2873 | found = true; |
2874 | break; |
2875 | } |
2876 | } |
2877 | if (!found) |
2878 | warning_at (gimple_location (curr_loop->stmt), 0, |
2879 | "nested loop in reduction needs " |
2880 | "reduction clause for %qE", |
2881 | local_var); |
2882 | else |
2883 | break; |
2884 | curr_loop = curr_loop->outer; |
2885 | } |
2886 | } |
2887 | } |
2888 | ctx->local_reduction_clauses = local_reduction_clauses; |
2889 | ctx->outer_reduction_clauses |
2890 | = chainon (unshare_expr (ctx->local_reduction_clauses), |
2891 | ctx->outer_reduction_clauses); |
2892 | |
2893 | if (tgt && is_oacc_kernels (tgt)) |
2894 | { |
2895 | /* Strip out reductions, as they are not handled yet. */ |
2896 | tree *prev_ptr = &clauses; |
2897 | |
2898 | while (tree probe = *prev_ptr) |
2899 | { |
2900 | tree *next_ptr = &OMP_CLAUSE_CHAIN (probe)((contains_struct_check (((tree_check ((probe), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2900, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2900, __FUNCTION__))->common.chain); |
2901 | |
2902 | if (OMP_CLAUSE_CODE (probe)((tree_check ((probe), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2902, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_REDUCTION) |
2903 | *prev_ptr = *next_ptr; |
2904 | else |
2905 | prev_ptr = next_ptr; |
2906 | } |
2907 | |
2908 | gimple_omp_for_set_clauses (stmt, clauses); |
2909 | } |
2910 | } |
2911 | |
2912 | scan_sharing_clauses (clauses, ctx); |
2913 | |
2914 | scan_omp (gimple_omp_for_pre_body_ptr (stmt), ctx); |
2915 | for (i = 0; i < gimple_omp_for_collapse (stmt); i++) |
2916 | { |
2917 | scan_omp_op (gimple_omp_for_index_ptr (stmt, i), ctx); |
2918 | scan_omp_op (gimple_omp_for_initial_ptr (stmt, i), ctx); |
2919 | scan_omp_op (gimple_omp_for_final_ptr (stmt, i), ctx); |
2920 | scan_omp_op (gimple_omp_for_incr_ptr (stmt, i), ctx); |
2921 | } |
2922 | scan_omp (gimple_omp_body_ptr (stmt), ctx); |
2923 | return ctx; |
2924 | } |
2925 | |
2926 | /* Duplicate #pragma omp simd, one for SIMT, another one for SIMD. */ |
2927 | |
2928 | static void |
2929 | scan_omp_simd (gimple_stmt_iterator *gsi, gomp_for *stmt, |
2930 | omp_context *outer_ctx) |
2931 | { |
2932 | gbind *bind = gimple_build_bind (NULLnullptr, NULLnullptr, NULLnullptr); |
2933 | gsi_replace (gsi, bind, false); |
2934 | gimple_seq seq = NULLnullptr; |
2935 | gimple *g = gimple_build_call_internal (IFN_GOMP_USE_SIMT, 0); |
2936 | tree cond = create_tmp_var_raw (integer_type_nodeinteger_types[itk_int]); |
2937 | DECL_CONTEXT (cond)((contains_struct_check ((cond), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2937, __FUNCTION__))->decl_minimal.context) = current_function_decl; |
2938 | DECL_SEEN_IN_BIND_EXPR_P (cond)((contains_struct_check ((cond), (TS_DECL_WITH_VIS), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2938, __FUNCTION__))->decl_with_vis.seen_in_bind_expr) = 1; |
2939 | gimple_bind_set_vars (bind, cond); |
2940 | gimple_call_set_lhs (g, cond); |
2941 | gimple_seq_add_stmt (&seq, g); |
2942 | tree lab1 = create_artificial_label (UNKNOWN_LOCATION((location_t) 0)); |
2943 | tree lab2 = create_artificial_label (UNKNOWN_LOCATION((location_t) 0)); |
2944 | tree lab3 = create_artificial_label (UNKNOWN_LOCATION((location_t) 0)); |
2945 | g = gimple_build_cond (NE_EXPR, cond, integer_zero_nodeglobal_trees[TI_INTEGER_ZERO], lab1, lab2); |
2946 | gimple_seq_add_stmt (&seq, g); |
2947 | g = gimple_build_label (lab1); |
2948 | gimple_seq_add_stmt (&seq, g); |
2949 | gimple_seq new_seq = copy_gimple_seq_and_replace_locals (stmt); |
2950 | gomp_for *new_stmt = as_a <gomp_for *> (new_seq); |
2951 | tree clause = build_omp_clause (gimple_location (stmt), OMP_CLAUSE__SIMT_); |
2952 | OMP_CLAUSE_CHAIN (clause)((contains_struct_check (((tree_check ((clause), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2952, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2952, __FUNCTION__))->common.chain) = gimple_omp_for_clauses (new_stmt); |
2953 | gimple_omp_for_set_clauses (new_stmt, clause); |
2954 | gimple_seq_add_stmt (&seq, new_stmt); |
2955 | g = gimple_build_goto (lab3); |
2956 | gimple_seq_add_stmt (&seq, g); |
2957 | g = gimple_build_label (lab2); |
2958 | gimple_seq_add_stmt (&seq, g); |
2959 | gimple_seq_add_stmt (&seq, stmt); |
2960 | g = gimple_build_label (lab3); |
2961 | gimple_seq_add_stmt (&seq, g); |
2962 | gimple_bind_set_body (bind, seq); |
2963 | update_stmt (bind); |
2964 | scan_omp_for (new_stmt, outer_ctx); |
2965 | scan_omp_for (stmt, outer_ctx)->simt_stmt = new_stmt; |
2966 | } |
2967 | |
2968 | static tree omp_find_scan (gimple_stmt_iterator *, bool *, |
2969 | struct walk_stmt_info *); |
2970 | static omp_context *maybe_lookup_ctx (gimple *); |
2971 | |
2972 | /* Duplicate #pragma omp simd, one for the scan input phase loop and one |
2973 | for scan phase loop. */ |
2974 | |
2975 | static void |
2976 | scan_omp_simd_scan (gimple_stmt_iterator *gsi, gomp_for *stmt, |
2977 | omp_context *outer_ctx) |
2978 | { |
2979 | /* The only change between inclusive and exclusive scan will be |
2980 | within the first simd loop, so just use inclusive in the |
2981 | worksharing loop. */ |
2982 | outer_ctx->scan_inclusive = true; |
2983 | tree c = build_omp_clause (UNKNOWN_LOCATION((location_t) 0), OMP_CLAUSE_INCLUSIVE); |
2984 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2984, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2984, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2984, __FUNCTION__))) = integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]; |
2985 | |
2986 | gomp_scan *input_stmt = gimple_build_omp_scan (NULLnullptr, NULL_TREE(tree) nullptr); |
2987 | gomp_scan *scan_stmt = gimple_build_omp_scan (NULLnullptr, c); |
2988 | gsi_replace (gsi, input_stmt, false); |
2989 | gimple_seq input_body = NULLnullptr; |
2990 | gimple_seq_add_stmt (&input_body, stmt); |
2991 | gsi_insert_after (gsi, scan_stmt, GSI_NEW_STMT); |
2992 | |
2993 | gimple_stmt_iterator input1_gsi = gsi_none (); |
2994 | struct walk_stmt_info wi; |
2995 | memset (&wi, 0, sizeof (wi)); |
2996 | wi.val_only = true; |
2997 | wi.info = (void *) &input1_gsi; |
2998 | walk_gimple_seq_mod (gimple_omp_body_ptr (stmt), omp_find_scan, NULLnullptr, &wi); |
2999 | gcc_assert (!gsi_end_p (input1_gsi))((void)(!(!gsi_end_p (input1_gsi)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 2999, __FUNCTION__), 0 : 0)); |
3000 | |
3001 | gimple *input_stmt1 = gsi_stmt (input1_gsi); |
3002 | gsi_next (&input1_gsi); |
3003 | gimple *scan_stmt1 = gsi_stmt (input1_gsi); |
3004 | gcc_assert (scan_stmt1 && gimple_code (scan_stmt1) == GIMPLE_OMP_SCAN)((void)(!(scan_stmt1 && gimple_code (scan_stmt1) == GIMPLE_OMP_SCAN ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3004, __FUNCTION__), 0 : 0)); |
3005 | c = gimple_omp_scan_clauses (as_a <gomp_scan *> (scan_stmt1)); |
3006 | if (c && OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3006, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_EXCLUSIVE) |
3007 | std::swap (input_stmt1, scan_stmt1); |
3008 | |
3009 | gimple_seq input_body1 = gimple_omp_body (input_stmt1); |
3010 | gimple_omp_set_body (input_stmt1, NULLnullptr); |
3011 | |
3012 | gimple_seq scan_body = copy_gimple_seq_and_replace_locals (stmt); |
3013 | gomp_for *new_stmt = as_a <gomp_for *> (scan_body); |
3014 | |
3015 | gimple_omp_set_body (input_stmt1, input_body1); |
3016 | gimple_omp_set_body (scan_stmt1, NULLnullptr); |
3017 | |
3018 | gimple_stmt_iterator input2_gsi = gsi_none (); |
3019 | memset (&wi, 0, sizeof (wi)); |
3020 | wi.val_only = true; |
3021 | wi.info = (void *) &input2_gsi; |
3022 | walk_gimple_seq_mod (gimple_omp_body_ptr (new_stmt), omp_find_scan, |
3023 | NULLnullptr, &wi); |
3024 | gcc_assert (!gsi_end_p (input2_gsi))((void)(!(!gsi_end_p (input2_gsi)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3024, __FUNCTION__), 0 : 0)); |
3025 | |
3026 | gimple *input_stmt2 = gsi_stmt (input2_gsi); |
3027 | gsi_next (&input2_gsi); |
3028 | gimple *scan_stmt2 = gsi_stmt (input2_gsi); |
3029 | gcc_assert (scan_stmt2 && gimple_code (scan_stmt2) == GIMPLE_OMP_SCAN)((void)(!(scan_stmt2 && gimple_code (scan_stmt2) == GIMPLE_OMP_SCAN ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3029, __FUNCTION__), 0 : 0)); |
3030 | if (c && OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3030, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_EXCLUSIVE) |
3031 | std::swap (input_stmt2, scan_stmt2); |
3032 | |
3033 | gimple_omp_set_body (input_stmt2, NULLnullptr); |
3034 | |
3035 | gimple_omp_set_body (input_stmt, input_body); |
3036 | gimple_omp_set_body (scan_stmt, scan_body); |
3037 | |
3038 | omp_context *ctx = new_omp_context (input_stmt, outer_ctx); |
3039 | scan_omp (gimple_omp_body_ptr (input_stmt), ctx); |
3040 | |
3041 | ctx = new_omp_context (scan_stmt, outer_ctx); |
3042 | scan_omp (gimple_omp_body_ptr (scan_stmt), ctx); |
3043 | |
3044 | maybe_lookup_ctx (new_stmt)->for_simd_scan_phase = true; |
3045 | } |
3046 | |
3047 | /* Scan an OpenMP sections directive. */ |
3048 | |
3049 | static void |
3050 | scan_omp_sections (gomp_sections *stmt, omp_context *outer_ctx) |
3051 | { |
3052 | omp_context *ctx; |
3053 | |
3054 | ctx = new_omp_context (stmt, outer_ctx); |
3055 | scan_sharing_clauses (gimple_omp_sections_clauses (stmt), ctx); |
3056 | scan_omp (gimple_omp_body_ptr (stmt), ctx); |
3057 | } |
3058 | |
3059 | /* Scan an OpenMP single directive. */ |
3060 | |
3061 | static void |
3062 | scan_omp_single (gomp_single *stmt, omp_context *outer_ctx) |
3063 | { |
3064 | omp_context *ctx; |
3065 | tree name; |
3066 | |
3067 | ctx = new_omp_context (stmt, outer_ctx); |
3068 | ctx->field_map = splay_tree_new (splay_tree_compare_pointers, 0, 0); |
3069 | ctx->record_type = lang_hooks.types.make_type (RECORD_TYPE); |
3070 | name = create_tmp_var_name (".omp_copy_s"); |
3071 | name = build_decl (gimple_location (stmt), |
3072 | TYPE_DECL, name, ctx->record_type); |
3073 | TYPE_NAME (ctx->record_type)((tree_class_check ((ctx->record_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3073, __FUNCTION__))->type_common.name) = name; |
3074 | |
3075 | scan_sharing_clauses (gimple_omp_single_clauses (stmt), ctx); |
3076 | scan_omp (gimple_omp_body_ptr (stmt), ctx); |
3077 | |
3078 | if (TYPE_FIELDS (ctx->record_type)((tree_check3 ((ctx->record_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3078, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values) == NULLnullptr) |
3079 | ctx->record_type = NULLnullptr; |
3080 | else |
3081 | layout_type (ctx->record_type); |
3082 | } |
3083 | |
3084 | /* Scan a GIMPLE_OMP_TARGET. */ |
3085 | |
3086 | static void |
3087 | scan_omp_target (gomp_target *stmt, omp_context *outer_ctx) |
3088 | { |
3089 | omp_context *ctx; |
3090 | tree name; |
3091 | bool offloaded = is_gimple_omp_offloaded (stmt); |
3092 | tree clauses = gimple_omp_target_clauses (stmt); |
3093 | |
3094 | ctx = new_omp_context (stmt, outer_ctx); |
3095 | ctx->field_map = splay_tree_new (splay_tree_compare_pointers, 0, 0); |
3096 | ctx->record_type = lang_hooks.types.make_type (RECORD_TYPE); |
3097 | name = create_tmp_var_name (".omp_data_t"); |
3098 | name = build_decl (gimple_location (stmt), |
3099 | TYPE_DECL, name, ctx->record_type); |
3100 | DECL_ARTIFICIAL (name)((contains_struct_check ((name), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3100, __FUNCTION__))->decl_common.artificial_flag) = 1; |
3101 | DECL_NAMELESS (name)((contains_struct_check ((name), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3101, __FUNCTION__))->base.u.bits.nameless_flag) = 1; |
3102 | TYPE_NAME (ctx->record_type)((tree_class_check ((ctx->record_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3102, __FUNCTION__))->type_common.name) = name; |
3103 | TYPE_ARTIFICIAL (ctx->record_type)((tree_class_check ((ctx->record_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3103, __FUNCTION__))->base.nowarning_flag) = 1; |
3104 | |
3105 | if (offloaded) |
3106 | { |
3107 | create_omp_child_function (ctx, false); |
3108 | gimple_omp_target_set_child_fn (stmt, ctx->cb.dst_fn); |
3109 | } |
3110 | |
3111 | scan_sharing_clauses (clauses, ctx); |
3112 | scan_omp (gimple_omp_body_ptr (stmt), ctx); |
3113 | |
3114 | if (TYPE_FIELDS (ctx->record_type)((tree_check3 ((ctx->record_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3114, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values) == NULLnullptr) |
3115 | ctx->record_type = ctx->receiver_decl = NULLnullptr; |
3116 | else |
3117 | { |
3118 | TYPE_FIELDS (ctx->record_type)((tree_check3 ((ctx->record_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3118, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values) |
3119 | = nreverse (TYPE_FIELDS (ctx->record_type)((tree_check3 ((ctx->record_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3119, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values)); |
3120 | if (flag_checkingglobal_options.x_flag_checking) |
3121 | { |
3122 | unsigned int align = DECL_ALIGN (TYPE_FIELDS (ctx->record_type))(((contains_struct_check ((((tree_check3 ((ctx->record_type ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3122, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values)), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3122, __FUNCTION__))->decl_common.align) ? ((unsigned)1) << (((contains_struct_check ((((tree_check3 ((ctx-> record_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3122, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values)), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3122, __FUNCTION__))->decl_common.align) - 1) : 0); |
3123 | for (tree field = TYPE_FIELDS (ctx->record_type)((tree_check3 ((ctx->record_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3123, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); |
3124 | field; |
3125 | field = DECL_CHAIN (field)(((contains_struct_check (((contains_struct_check ((field), ( TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3125, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3125, __FUNCTION__))->common.chain))) |
3126 | gcc_assert (DECL_ALIGN (field) == align)((void)(!((((contains_struct_check ((field), (TS_DECL_COMMON) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3126, __FUNCTION__))->decl_common.align) ? ((unsigned)1) << (((contains_struct_check ((field), (TS_DECL_COMMON) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3126, __FUNCTION__))->decl_common.align) - 1) : 0) == align ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3126, __FUNCTION__), 0 : 0)); |
3127 | } |
3128 | layout_type (ctx->record_type); |
3129 | if (offloaded) |
3130 | fixup_child_record_type (ctx); |
3131 | } |
3132 | |
3133 | if (ctx->teams_nested_p && ctx->nonteams_nested_p) |
3134 | { |
3135 | error_at (gimple_location (stmt), |
3136 | "%<target%> construct with nested %<teams%> construct " |
3137 | "contains directives outside of the %<teams%> construct"); |
3138 | gimple_omp_set_body (stmt, gimple_build_bind (NULLnullptr, NULLnullptr, NULLnullptr)); |
3139 | } |
3140 | } |
3141 | |
3142 | /* Scan an OpenMP teams directive. */ |
3143 | |
3144 | static void |
3145 | scan_omp_teams (gomp_teams *stmt, omp_context *outer_ctx) |
3146 | { |
3147 | omp_context *ctx = new_omp_context (stmt, outer_ctx); |
3148 | |
3149 | if (!gimple_omp_teams_host (stmt)) |
3150 | { |
3151 | scan_sharing_clauses (gimple_omp_teams_clauses (stmt), ctx); |
3152 | scan_omp (gimple_omp_body_ptr (stmt), ctx); |
3153 | return; |
3154 | } |
3155 | taskreg_contexts.safe_push (ctx); |
3156 | gcc_assert (taskreg_nesting_level == 1)((void)(!(taskreg_nesting_level == 1) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3156, __FUNCTION__), 0 : 0)); |
3157 | ctx->field_map = splay_tree_new (splay_tree_compare_pointers, 0, 0); |
3158 | ctx->record_type = lang_hooks.types.make_type (RECORD_TYPE); |
3159 | tree name = create_tmp_var_name (".omp_data_s"); |
3160 | name = build_decl (gimple_location (stmt), |
3161 | TYPE_DECL, name, ctx->record_type); |
3162 | DECL_ARTIFICIAL (name)((contains_struct_check ((name), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3162, __FUNCTION__))->decl_common.artificial_flag) = 1; |
3163 | DECL_NAMELESS (name)((contains_struct_check ((name), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3163, __FUNCTION__))->base.u.bits.nameless_flag) = 1; |
3164 | TYPE_NAME (ctx->record_type)((tree_class_check ((ctx->record_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3164, __FUNCTION__))->type_common.name) = name; |
3165 | TYPE_ARTIFICIAL (ctx->record_type)((tree_class_check ((ctx->record_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3165, __FUNCTION__))->base.nowarning_flag) = 1; |
3166 | create_omp_child_function (ctx, false); |
3167 | gimple_omp_teams_set_child_fn (stmt, ctx->cb.dst_fn); |
3168 | |
3169 | scan_sharing_clauses (gimple_omp_teams_clauses (stmt), ctx); |
3170 | scan_omp (gimple_omp_body_ptr (stmt), ctx); |
3171 | |
3172 | if (TYPE_FIELDS (ctx->record_type)((tree_check3 ((ctx->record_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3172, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values) == NULLnullptr) |
3173 | ctx->record_type = ctx->receiver_decl = NULLnullptr; |
3174 | } |
3175 | |
3176 | /* Check nesting restrictions. */ |
3177 | static bool |
3178 | check_omp_nesting_restrictions (gimple *stmt, omp_context *ctx) |
3179 | { |
3180 | tree c; |
3181 | |
3182 | /* No nesting of non-OpenACC STMT (that is, an OpenMP one, or a GOMP builtin) |
3183 | inside an OpenACC CTX. */ |
3184 | if (gimple_code (stmt) == GIMPLE_OMP_ATOMIC_LOAD |
3185 | || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_STORE) |
3186 | /* ..., except for the atomic codes that OpenACC shares with OpenMP. */ |
3187 | ; |
3188 | else if (!(is_gimple_omp (stmt) |
3189 | && is_gimple_omp_oacc (stmt))) |
3190 | { |
3191 | if (oacc_get_fn_attrib (cfun(cfun + 0)->decl) != NULLnullptr) |
3192 | { |
3193 | error_at (gimple_location (stmt), |
3194 | "non-OpenACC construct inside of OpenACC routine"); |
3195 | return false; |
3196 | } |
3197 | else |
3198 | for (omp_context *octx = ctx; octx != NULLnullptr; octx = octx->outer) |
3199 | if (is_gimple_omp (octx->stmt) |
3200 | && is_gimple_omp_oacc (octx->stmt)) |
3201 | { |
3202 | error_at (gimple_location (stmt), |
3203 | "non-OpenACC construct inside of OpenACC region"); |
3204 | return false; |
3205 | } |
3206 | } |
3207 | |
3208 | if (ctx != NULLnullptr) |
3209 | { |
3210 | if (gimple_code (ctx->stmt) == GIMPLE_OMP_TARGET |
3211 | && gimple_omp_target_kind (ctx->stmt) == GF_OMP_TARGET_KIND_REGION) |
3212 | { |
3213 | c = omp_find_clause (gimple_omp_target_clauses (ctx->stmt), |
3214 | OMP_CLAUSE_DEVICE); |
3215 | if (c && OMP_CLAUSE_DEVICE_ANCESTOR (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_DEVICE), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3215, __FUNCTION__))->base.public_flag)) |
3216 | { |
3217 | error_at (gimple_location (stmt), |
3218 | "OpenMP constructs are not allowed in target region " |
3219 | "with %<ancestor%>"); |
3220 | return false; |
3221 | } |
3222 | |
3223 | if (gimple_code (stmt) == GIMPLE_OMP_TEAMS && !ctx->teams_nested_p) |
3224 | ctx->teams_nested_p = true; |
3225 | else |
3226 | ctx->nonteams_nested_p = true; |
3227 | } |
3228 | if (gimple_code (ctx->stmt) == GIMPLE_OMP_SCAN |
3229 | && ctx->outer |
3230 | && gimple_code (ctx->outer->stmt) == GIMPLE_OMP_FOR) |
3231 | ctx = ctx->outer; |
3232 | if (gimple_code (ctx->stmt) == GIMPLE_OMP_FOR |
3233 | && gimple_omp_for_kind (ctx->stmt) == GF_OMP_FOR_KIND_SIMD |
3234 | && !ctx->loop_p) |
3235 | { |
3236 | c = NULL_TREE(tree) nullptr; |
3237 | if (ctx->order_concurrent |
3238 | && (gimple_code (stmt) == GIMPLE_OMP_ORDERED |
3239 | || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_LOAD |
3240 | || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_STORE)) |
3241 | { |
3242 | error_at (gimple_location (stmt), |
3243 | "OpenMP constructs other than %<parallel%>, %<loop%>" |
3244 | " or %<simd%> may not be nested inside a region with" |
3245 | " the %<order(concurrent)%> clause"); |
3246 | return false; |
3247 | } |
3248 | if (gimple_code (stmt) == GIMPLE_OMP_ORDERED) |
3249 | { |
3250 | c = gimple_omp_ordered_clauses (as_a <gomp_ordered *> (stmt)); |
3251 | if (omp_find_clause (c, OMP_CLAUSE_SIMD)) |
3252 | { |
3253 | if (omp_find_clause (c, OMP_CLAUSE_THREADS) |
3254 | && (ctx->outer == NULLnullptr |
3255 | || !gimple_omp_for_combined_into_p (ctx->stmt) |
3256 | || gimple_code (ctx->outer->stmt) != GIMPLE_OMP_FOR |
3257 | || (gimple_omp_for_kind (ctx->outer->stmt) |
3258 | != GF_OMP_FOR_KIND_FOR) |
3259 | || !gimple_omp_for_combined_p (ctx->outer->stmt))) |
3260 | { |
3261 | error_at (gimple_location (stmt), |
3262 | "%<ordered simd threads%> must be closely " |
3263 | "nested inside of %<%s simd%> region", |
3264 | lang_GNU_Fortran () ? "do" : "for"); |
3265 | return false; |
3266 | } |
3267 | return true; |
3268 | } |
3269 | } |
3270 | else if (gimple_code (stmt) == GIMPLE_OMP_ATOMIC_LOAD |
3271 | || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_STORE |
3272 | || gimple_code (stmt) == GIMPLE_OMP_SCAN) |
3273 | return true; |
3274 | else if (gimple_code (stmt) == GIMPLE_OMP_FOR |
3275 | && gimple_omp_for_kind (ctx->stmt) == GF_OMP_FOR_KIND_SIMD) |
3276 | return true; |
3277 | error_at (gimple_location (stmt), |
3278 | "OpenMP constructs other than " |
3279 | "%<ordered simd%>, %<simd%>, %<loop%> or %<atomic%> may " |
3280 | "not be nested inside %<simd%> region"); |
3281 | return false; |
3282 | } |
3283 | else if (gimple_code (ctx->stmt) == GIMPLE_OMP_TEAMS) |
3284 | { |
3285 | if ((gimple_code (stmt) != GIMPLE_OMP_FOR |
3286 | || (gimple_omp_for_kind (stmt) != GF_OMP_FOR_KIND_DISTRIBUTE |
3287 | && omp_find_clause (gimple_omp_for_clauses (stmt), |
3288 | OMP_CLAUSE_BIND) == NULL_TREE(tree) nullptr)) |
3289 | && gimple_code (stmt) != GIMPLE_OMP_PARALLEL) |
3290 | { |
3291 | error_at (gimple_location (stmt), |
3292 | "only %<distribute%>, %<parallel%> or %<loop%> " |
3293 | "regions are allowed to be strictly nested inside " |
3294 | "%<teams%> region"); |
3295 | return false; |
3296 | } |
3297 | } |
3298 | else if (ctx->order_concurrent |
3299 | && gimple_code (stmt) != GIMPLE_OMP_PARALLEL |
3300 | && (gimple_code (stmt) != GIMPLE_OMP_FOR |
3301 | || gimple_omp_for_kind (stmt) != GF_OMP_FOR_KIND_SIMD) |
3302 | && gimple_code (stmt) != GIMPLE_OMP_SCAN) |
3303 | { |
3304 | if (ctx->loop_p) |
3305 | error_at (gimple_location (stmt), |
3306 | "OpenMP constructs other than %<parallel%>, %<loop%> or " |
3307 | "%<simd%> may not be nested inside a %<loop%> region"); |
3308 | else |
3309 | error_at (gimple_location (stmt), |
3310 | "OpenMP constructs other than %<parallel%>, %<loop%> or " |
3311 | "%<simd%> may not be nested inside a region with " |
3312 | "the %<order(concurrent)%> clause"); |
3313 | return false; |
3314 | } |
3315 | } |
3316 | switch (gimple_code (stmt)) |
3317 | { |
3318 | case GIMPLE_OMP_FOR: |
3319 | if (gimple_omp_for_kind (stmt) == GF_OMP_FOR_KIND_SIMD) |
3320 | return true; |
3321 | if (gimple_omp_for_kind (stmt) == GF_OMP_FOR_KIND_DISTRIBUTE) |
3322 | { |
3323 | if (ctx != NULLnullptr && gimple_code (ctx->stmt) != GIMPLE_OMP_TEAMS) |
3324 | { |
3325 | error_at (gimple_location (stmt), |
3326 | "%<distribute%> region must be strictly nested " |
3327 | "inside %<teams%> construct"); |
3328 | return false; |
3329 | } |
3330 | return true; |
3331 | } |
3332 | /* We split taskloop into task and nested taskloop in it. */ |
3333 | if (gimple_omp_for_kind (stmt) == GF_OMP_FOR_KIND_TASKLOOP) |
3334 | return true; |
3335 | /* For now, hope this will change and loop bind(parallel) will not |
3336 | be allowed in lots of contexts. */ |
3337 | if (gimple_omp_for_kind (stmt) == GF_OMP_FOR_KIND_FOR |
3338 | && omp_find_clause (gimple_omp_for_clauses (stmt), OMP_CLAUSE_BIND)) |
3339 | return true; |
3340 | if (gimple_omp_for_kind (stmt) == GF_OMP_FOR_KIND_OACC_LOOP) |
3341 | { |
3342 | bool ok = false; |
3343 | |
3344 | if (ctx) |
3345 | switch (gimple_code (ctx->stmt)) |
3346 | { |
3347 | case GIMPLE_OMP_FOR: |
3348 | ok = (gimple_omp_for_kind (ctx->stmt) |
3349 | == GF_OMP_FOR_KIND_OACC_LOOP); |
3350 | break; |
3351 | |
3352 | case GIMPLE_OMP_TARGET: |
3353 | switch (gimple_omp_target_kind (ctx->stmt)) |
3354 | { |
3355 | case GF_OMP_TARGET_KIND_OACC_PARALLEL: |
3356 | case GF_OMP_TARGET_KIND_OACC_KERNELS: |
3357 | case GF_OMP_TARGET_KIND_OACC_SERIAL: |
3358 | case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED: |
3359 | case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE: |
3360 | ok = true; |
3361 | break; |
3362 | |
3363 | default: |
3364 | break; |
3365 | } |
3366 | |
3367 | default: |
3368 | break; |
3369 | } |
3370 | else if (oacc_get_fn_attrib (current_function_decl)) |
3371 | ok = true; |
3372 | if (!ok) |
3373 | { |
3374 | error_at (gimple_location (stmt), |
3375 | "OpenACC loop directive must be associated with" |
3376 | " an OpenACC compute region"); |
3377 | return false; |
3378 | } |
3379 | } |
3380 | /* FALLTHRU */ |
3381 | case GIMPLE_CALL: |
3382 | if (is_gimple_call (stmt) |
3383 | && (DECL_FUNCTION_CODE (gimple_call_fndecl (stmt)) |
3384 | == BUILT_IN_GOMP_CANCEL |
3385 | || DECL_FUNCTION_CODE (gimple_call_fndecl (stmt)) |
3386 | == BUILT_IN_GOMP_CANCELLATION_POINT)) |
3387 | { |
3388 | const char *bad = NULLnullptr; |
3389 | const char *kind = NULLnullptr; |
3390 | const char *construct |
3391 | = (DECL_FUNCTION_CODE (gimple_call_fndecl (stmt)) |
3392 | == BUILT_IN_GOMP_CANCEL) |
3393 | ? "cancel" |
3394 | : "cancellation point"; |
3395 | if (ctx == NULLnullptr) |
3396 | { |
3397 | error_at (gimple_location (stmt), "orphaned %qs construct", |
3398 | construct); |
3399 | return false; |
3400 | } |
3401 | switch (tree_fits_shwi_p (gimple_call_arg (stmt, 0)) |
3402 | ? tree_to_shwi (gimple_call_arg (stmt, 0)) |
3403 | : 0) |
3404 | { |
3405 | case 1: |
3406 | if (gimple_code (ctx->stmt) != GIMPLE_OMP_PARALLEL) |
3407 | bad = "parallel"; |
3408 | else if (DECL_FUNCTION_CODE (gimple_call_fndecl (stmt)) |
3409 | == BUILT_IN_GOMP_CANCEL |
3410 | && !integer_zerop (gimple_call_arg (stmt, 1))) |
3411 | ctx->cancellable = true; |
3412 | kind = "parallel"; |
3413 | break; |
3414 | case 2: |
3415 | if (gimple_code (ctx->stmt) != GIMPLE_OMP_FOR |
3416 | || gimple_omp_for_kind (ctx->stmt) != GF_OMP_FOR_KIND_FOR) |
3417 | bad = "for"; |
3418 | else if (DECL_FUNCTION_CODE (gimple_call_fndecl (stmt)) |
3419 | == BUILT_IN_GOMP_CANCEL |
3420 | && !integer_zerop (gimple_call_arg (stmt, 1))) |
3421 | { |
3422 | ctx->cancellable = true; |
3423 | if (omp_find_clause (gimple_omp_for_clauses (ctx->stmt), |
3424 | OMP_CLAUSE_NOWAIT)) |
3425 | warning_at (gimple_location (stmt), 0, |
3426 | "%<cancel for%> inside " |
3427 | "%<nowait%> for construct"); |
3428 | if (omp_find_clause (gimple_omp_for_clauses (ctx->stmt), |
3429 | OMP_CLAUSE_ORDERED)) |
3430 | warning_at (gimple_location (stmt), 0, |
3431 | "%<cancel for%> inside " |
3432 | "%<ordered%> for construct"); |
3433 | } |
3434 | kind = "for"; |
3435 | break; |
3436 | case 4: |
3437 | if (gimple_code (ctx->stmt) != GIMPLE_OMP_SECTIONS |
3438 | && gimple_code (ctx->stmt) != GIMPLE_OMP_SECTION) |
3439 | bad = "sections"; |
3440 | else if (DECL_FUNCTION_CODE (gimple_call_fndecl (stmt)) |
3441 | == BUILT_IN_GOMP_CANCEL |
3442 | && !integer_zerop (gimple_call_arg (stmt, 1))) |
3443 | { |
3444 | if (gimple_code (ctx->stmt) == GIMPLE_OMP_SECTIONS) |
3445 | { |
3446 | ctx->cancellable = true; |
3447 | if (omp_find_clause (gimple_omp_sections_clauses |
3448 | (ctx->stmt), |
3449 | OMP_CLAUSE_NOWAIT)) |
3450 | warning_at (gimple_location (stmt), 0, |
3451 | "%<cancel sections%> inside " |
3452 | "%<nowait%> sections construct"); |
3453 | } |
3454 | else |
3455 | { |
3456 | gcc_assert (ctx->outer((void)(!(ctx->outer && gimple_code (ctx->outer ->stmt) == GIMPLE_OMP_SECTIONS) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3458, __FUNCTION__), 0 : 0)) |
3457 | && gimple_code (ctx->outer->stmt)((void)(!(ctx->outer && gimple_code (ctx->outer ->stmt) == GIMPLE_OMP_SECTIONS) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3458, __FUNCTION__), 0 : 0)) |
3458 | == GIMPLE_OMP_SECTIONS)((void)(!(ctx->outer && gimple_code (ctx->outer ->stmt) == GIMPLE_OMP_SECTIONS) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3458, __FUNCTION__), 0 : 0)); |
3459 | ctx->outer->cancellable = true; |
3460 | if (omp_find_clause (gimple_omp_sections_clauses |
3461 | (ctx->outer->stmt), |
3462 | OMP_CLAUSE_NOWAIT)) |
3463 | warning_at (gimple_location (stmt), 0, |
3464 | "%<cancel sections%> inside " |
3465 | "%<nowait%> sections construct"); |
3466 | } |
3467 | } |
3468 | kind = "sections"; |
3469 | break; |
3470 | case 8: |
3471 | if (!is_task_ctx (ctx) |
3472 | && (!is_taskloop_ctx (ctx) |
3473 | || ctx->outer == NULLnullptr |
3474 | || !is_task_ctx (ctx->outer))) |
3475 | bad = "task"; |
3476 | else |
3477 | { |
3478 | for (omp_context *octx = ctx->outer; |
3479 | octx; octx = octx->outer) |
3480 | { |
3481 | switch (gimple_code (octx->stmt)) |
3482 | { |
3483 | case GIMPLE_OMP_TASKGROUP: |
3484 | break; |
3485 | case GIMPLE_OMP_TARGET: |
3486 | if (gimple_omp_target_kind (octx->stmt) |
3487 | != GF_OMP_TARGET_KIND_REGION) |
3488 | continue; |
3489 | /* FALLTHRU */ |
3490 | case GIMPLE_OMP_PARALLEL: |
3491 | case GIMPLE_OMP_TEAMS: |
3492 | error_at (gimple_location (stmt), |
3493 | "%<%s taskgroup%> construct not closely " |
3494 | "nested inside of %<taskgroup%> region", |
3495 | construct); |
3496 | return false; |
3497 | case GIMPLE_OMP_TASK: |
3498 | if (gimple_omp_task_taskloop_p (octx->stmt) |
3499 | && octx->outer |
3500 | && is_taskloop_ctx (octx->outer)) |
3501 | { |
3502 | tree clauses |
3503 | = gimple_omp_for_clauses (octx->outer->stmt); |
3504 | if (!omp_find_clause (clauses, OMP_CLAUSE_NOGROUP)) |
3505 | break; |
3506 | } |
3507 | continue; |
3508 | default: |
3509 | continue; |
3510 | } |
3511 | break; |
3512 | } |
3513 | ctx->cancellable = true; |
3514 | } |
3515 | kind = "taskgroup"; |
3516 | break; |
3517 | default: |
3518 | error_at (gimple_location (stmt), "invalid arguments"); |
3519 | return false; |
3520 | } |
3521 | if (bad) |
3522 | { |
3523 | error_at (gimple_location (stmt), |
3524 | "%<%s %s%> construct not closely nested inside of %qs", |
3525 | construct, kind, bad); |
3526 | return false; |
3527 | } |
3528 | } |
3529 | /* FALLTHRU */ |
3530 | case GIMPLE_OMP_SECTIONS: |
3531 | case GIMPLE_OMP_SINGLE: |
3532 | for (; ctx != NULLnullptr; ctx = ctx->outer) |
3533 | switch (gimple_code (ctx->stmt)) |
3534 | { |
3535 | case GIMPLE_OMP_FOR: |
3536 | if (gimple_omp_for_kind (ctx->stmt) != GF_OMP_FOR_KIND_FOR |
3537 | && gimple_omp_for_kind (ctx->stmt) != GF_OMP_FOR_KIND_TASKLOOP) |
3538 | break; |
3539 | /* FALLTHRU */ |
3540 | case GIMPLE_OMP_SECTIONS: |
3541 | case GIMPLE_OMP_SINGLE: |
3542 | case GIMPLE_OMP_ORDERED: |
3543 | case GIMPLE_OMP_MASTER: |
3544 | case GIMPLE_OMP_MASKED: |
3545 | case GIMPLE_OMP_TASK: |
3546 | case GIMPLE_OMP_CRITICAL: |
3547 | if (is_gimple_call (stmt)) |
3548 | { |
3549 | if (DECL_FUNCTION_CODE (gimple_call_fndecl (stmt)) |
3550 | != BUILT_IN_GOMP_BARRIER) |
3551 | return true; |
3552 | error_at (gimple_location (stmt), |
3553 | "barrier region may not be closely nested inside " |
3554 | "of work-sharing, %<loop%>, %<critical%>, " |
3555 | "%<ordered%>, %<master%>, %<masked%>, explicit " |
3556 | "%<task%> or %<taskloop%> region"); |
3557 | return false; |
3558 | } |
3559 | error_at (gimple_location (stmt), |
3560 | "work-sharing region may not be closely nested inside " |
3561 | "of work-sharing, %<loop%>, %<critical%>, %<ordered%>, " |
3562 | "%<master%>, %<masked%>, explicit %<task%> or " |
3563 | "%<taskloop%> region"); |
3564 | return false; |
3565 | case GIMPLE_OMP_PARALLEL: |
3566 | case GIMPLE_OMP_TEAMS: |
3567 | return true; |
3568 | case GIMPLE_OMP_TARGET: |
3569 | if (gimple_omp_target_kind (ctx->stmt) |
3570 | == GF_OMP_TARGET_KIND_REGION) |
3571 | return true; |
3572 | break; |
3573 | default: |
3574 | break; |
3575 | } |
3576 | break; |
3577 | case GIMPLE_OMP_MASTER: |
3578 | case GIMPLE_OMP_MASKED: |
3579 | for (; ctx != NULLnullptr; ctx = ctx->outer) |
3580 | switch (gimple_code (ctx->stmt)) |
3581 | { |
3582 | case GIMPLE_OMP_FOR: |
3583 | if (gimple_omp_for_kind (ctx->stmt) != GF_OMP_FOR_KIND_FOR |
3584 | && gimple_omp_for_kind (ctx->stmt) != GF_OMP_FOR_KIND_TASKLOOP) |
3585 | break; |
3586 | /* FALLTHRU */ |
3587 | case GIMPLE_OMP_SECTIONS: |
3588 | case GIMPLE_OMP_SINGLE: |
3589 | case GIMPLE_OMP_TASK: |
3590 | error_at (gimple_location (stmt), |
3591 | "%qs region may not be closely nested inside " |
3592 | "of work-sharing, %<loop%>, explicit %<task%> or " |
3593 | "%<taskloop%> region", |
3594 | gimple_code (stmt) == GIMPLE_OMP_MASTER |
3595 | ? "master" : "masked"); |
3596 | return false; |
3597 | case GIMPLE_OMP_PARALLEL: |
3598 | case GIMPLE_OMP_TEAMS: |
3599 | return true; |
3600 | case GIMPLE_OMP_TARGET: |
3601 | if (gimple_omp_target_kind (ctx->stmt) |
3602 | == GF_OMP_TARGET_KIND_REGION) |
3603 | return true; |
3604 | break; |
3605 | default: |
3606 | break; |
3607 | } |
3608 | break; |
3609 | case GIMPLE_OMP_SCOPE: |
3610 | for (; ctx != NULLnullptr; ctx = ctx->outer) |
3611 | switch (gimple_code (ctx->stmt)) |
3612 | { |
3613 | case GIMPLE_OMP_FOR: |
3614 | if (gimple_omp_for_kind (ctx->stmt) != GF_OMP_FOR_KIND_FOR |
3615 | && gimple_omp_for_kind (ctx->stmt) != GF_OMP_FOR_KIND_TASKLOOP) |
3616 | break; |
3617 | /* FALLTHRU */ |
3618 | case GIMPLE_OMP_SECTIONS: |
3619 | case GIMPLE_OMP_SINGLE: |
3620 | case GIMPLE_OMP_TASK: |
3621 | case GIMPLE_OMP_CRITICAL: |
3622 | case GIMPLE_OMP_ORDERED: |
3623 | case GIMPLE_OMP_MASTER: |
3624 | case GIMPLE_OMP_MASKED: |
3625 | error_at (gimple_location (stmt), |
3626 | "%<scope%> region may not be closely nested inside " |
3627 | "of work-sharing, %<loop%>, explicit %<task%>, " |
3628 | "%<taskloop%>, %<critical%>, %<ordered%>, %<master%>, " |
3629 | "or %<masked%> region"); |
3630 | return false; |
3631 | case GIMPLE_OMP_PARALLEL: |
3632 | case GIMPLE_OMP_TEAMS: |
3633 | return true; |
3634 | case GIMPLE_OMP_TARGET: |
3635 | if (gimple_omp_target_kind (ctx->stmt) |
3636 | == GF_OMP_TARGET_KIND_REGION) |
3637 | return true; |
3638 | break; |
3639 | default: |
3640 | break; |
3641 | } |
3642 | break; |
3643 | case GIMPLE_OMP_TASK: |
3644 | for (c = gimple_omp_task_clauses (stmt); c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3644, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3644, __FUNCTION__))->common.chain)) |
3645 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3645, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_DOACROSS) |
3646 | { |
3647 | enum omp_clause_doacross_kind kind = OMP_CLAUSE_DOACROSS_KIND (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_DOACROSS), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3647, __FUNCTION__))->omp_clause.subcode.doacross_kind); |
3648 | error_at (OMP_CLAUSE_LOCATION (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3648, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, |
3649 | "%<%s(%s)%> is only allowed in %<omp ordered%>", |
3650 | OMP_CLAUSE_DOACROSS_DEPEND (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_DOACROSS), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3650, __FUNCTION__)))->base.protected_flag) ? "depend" : "doacross", |
3651 | kind == OMP_CLAUSE_DOACROSS_SOURCE ? "source" : "sink"); |
3652 | return false; |
3653 | } |
3654 | break; |
3655 | case GIMPLE_OMP_ORDERED: |
3656 | for (c = gimple_omp_ordered_clauses (as_a <gomp_ordered *> (stmt)); |
3657 | c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3657, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3657, __FUNCTION__))->common.chain)) |
3658 | { |
3659 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3659, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code != OMP_CLAUSE_DOACROSS) |
3660 | { |
3661 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3661, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_DEPEND) |
3662 | { |
3663 | error_at (OMP_CLAUSE_LOCATION (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3663, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, |
3664 | "invalid depend kind in omp %<ordered%> %<depend%>"); |
3665 | return false; |
3666 | } |
3667 | gcc_assert (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_THREADS((void)(!(((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3667, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_THREADS || ((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3668, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_SIMD ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3668, __FUNCTION__), 0 : 0)) |
3668 | || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_SIMD)((void)(!(((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3667, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_THREADS || ((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3668, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_SIMD ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3668, __FUNCTION__), 0 : 0)); |
3669 | continue; |
3670 | } |
3671 | |
3672 | tree oclause; |
3673 | /* Look for containing ordered(N) loop. */ |
3674 | if (ctx == NULLnullptr |
3675 | || gimple_code (ctx->stmt) != GIMPLE_OMP_FOR |
3676 | || (oclause |
Although the value stored to 'oclause' is used in the enclosing expression, the value is never actually read from 'oclause' | |
3677 | = omp_find_clause (gimple_omp_for_clauses (ctx->stmt), |
3678 | OMP_CLAUSE_ORDERED)) == NULL_TREE(tree) nullptr) |
3679 | { |
3680 | error_at (OMP_CLAUSE_LOCATION (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3680, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, |
3681 | "%<ordered%> construct with %<depend%> clause " |
3682 | "must be closely nested inside an %<ordered%> loop"); |
3683 | return false; |
3684 | } |
3685 | } |
3686 | c = gimple_omp_ordered_clauses (as_a <gomp_ordered *> (stmt)); |
3687 | if (omp_find_clause (c, OMP_CLAUSE_SIMD)) |
3688 | { |
3689 | /* ordered simd must be closely nested inside of simd region, |
3690 | and simd region must not encounter constructs other than |
3691 | ordered simd, therefore ordered simd may be either orphaned, |
3692 | or ctx->stmt must be simd. The latter case is handled already |
3693 | earlier. */ |
3694 | if (ctx != NULLnullptr) |
3695 | { |
3696 | error_at (gimple_location (stmt), |
3697 | "%<ordered%> %<simd%> must be closely nested inside " |
3698 | "%<simd%> region"); |
3699 | return false; |
3700 | } |
3701 | } |
3702 | for (; ctx != NULLnullptr; ctx = ctx->outer) |
3703 | switch (gimple_code (ctx->stmt)) |
3704 | { |
3705 | case GIMPLE_OMP_CRITICAL: |
3706 | case GIMPLE_OMP_TASK: |
3707 | case GIMPLE_OMP_ORDERED: |
3708 | ordered_in_taskloop: |
3709 | error_at (gimple_location (stmt), |
3710 | "%<ordered%> region may not be closely nested inside " |
3711 | "of %<critical%>, %<ordered%>, explicit %<task%> or " |
3712 | "%<taskloop%> region"); |
3713 | return false; |
3714 | case GIMPLE_OMP_FOR: |
3715 | if (gimple_omp_for_kind (ctx->stmt) == GF_OMP_FOR_KIND_TASKLOOP) |
3716 | goto ordered_in_taskloop; |
3717 | tree o; |
3718 | o = omp_find_clause (gimple_omp_for_clauses (ctx->stmt), |
3719 | OMP_CLAUSE_ORDERED); |
3720 | if (o == NULLnullptr) |
3721 | { |
3722 | error_at (gimple_location (stmt), |
3723 | "%<ordered%> region must be closely nested inside " |
3724 | "a loop region with an %<ordered%> clause"); |
3725 | return false; |
3726 | } |
3727 | if (!gimple_omp_ordered_standalone_p (stmt)) |
3728 | { |
3729 | if (OMP_CLAUSE_ORDERED_DOACROSS (o)((omp_clause_subcode_check ((o), (OMP_CLAUSE_ORDERED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3729, __FUNCTION__))->base.public_flag)) |
3730 | { |
3731 | error_at (gimple_location (stmt), |
3732 | "%<ordered%> construct without %<doacross%> or " |
3733 | "%<depend%> clauses must not have the same " |
3734 | "binding region as %<ordered%> construct with " |
3735 | "those clauses"); |
3736 | return false; |
3737 | } |
3738 | else if (OMP_CLAUSE_ORDERED_EXPR (o)(*(omp_clause_elt_check (((omp_clause_subcode_check ((o), (OMP_CLAUSE_ORDERED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3738, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3738, __FUNCTION__)))) |
3739 | { |
3740 | tree co |
3741 | = omp_find_clause (gimple_omp_for_clauses (ctx->stmt), |
3742 | OMP_CLAUSE_COLLAPSE); |
3743 | HOST_WIDE_INTlong |
3744 | o_n = tree_to_shwi (OMP_CLAUSE_ORDERED_EXPR (o)(*(omp_clause_elt_check (((omp_clause_subcode_check ((o), (OMP_CLAUSE_ORDERED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3744, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3744, __FUNCTION__)))); |
3745 | HOST_WIDE_INTlong c_n = 1; |
3746 | if (co) |
3747 | c_n = tree_to_shwi (OMP_CLAUSE_COLLAPSE_EXPR (co)(*(omp_clause_elt_check (((omp_clause_subcode_check ((co), (OMP_CLAUSE_COLLAPSE ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3747, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3747, __FUNCTION__)))); |
3748 | if (o_n != c_n) |
3749 | { |
3750 | error_at (gimple_location (stmt), |
3751 | "%<ordered%> construct without %<doacross%> " |
3752 | "or %<depend%> clauses binds to loop where " |
3753 | "%<collapse%> argument %wd is different from " |
3754 | "%<ordered%> argument %wd", c_n, o_n); |
3755 | return false; |
3756 | } |
3757 | } |
3758 | } |
3759 | return true; |
3760 | case GIMPLE_OMP_TARGET: |
3761 | if (gimple_omp_target_kind (ctx->stmt) |
3762 | != GF_OMP_TARGET_KIND_REGION) |
3763 | break; |
3764 | /* FALLTHRU */ |
3765 | case GIMPLE_OMP_PARALLEL: |
3766 | case GIMPLE_OMP_TEAMS: |
3767 | error_at (gimple_location (stmt), |
3768 | "%<ordered%> region must be closely nested inside " |
3769 | "a loop region with an %<ordered%> clause"); |
3770 | return false; |
3771 | default: |
3772 | break; |
3773 | } |
3774 | break; |
3775 | case GIMPLE_OMP_CRITICAL: |
3776 | { |
3777 | tree this_stmt_name |
3778 | = gimple_omp_critical_name (as_a <gomp_critical *> (stmt)); |
3779 | for (; ctx != NULLnullptr; ctx = ctx->outer) |
3780 | if (gomp_critical *other_crit |
3781 | = dyn_cast <gomp_critical *> (ctx->stmt)) |
3782 | if (this_stmt_name == gimple_omp_critical_name (other_crit)) |
3783 | { |
3784 | error_at (gimple_location (stmt), |
3785 | "%<critical%> region may not be nested inside " |
3786 | "a %<critical%> region with the same name"); |
3787 | return false; |
3788 | } |
3789 | } |
3790 | break; |
3791 | case GIMPLE_OMP_TEAMS: |
3792 | if (ctx == NULLnullptr) |
3793 | break; |
3794 | else if (gimple_code (ctx->stmt) != GIMPLE_OMP_TARGET |
3795 | || (gimple_omp_target_kind (ctx->stmt) |
3796 | != GF_OMP_TARGET_KIND_REGION)) |
3797 | { |
3798 | /* Teams construct can appear either strictly nested inside of |
3799 | target construct with no intervening stmts, or can be encountered |
3800 | only by initial task (so must not appear inside any OpenMP |
3801 | construct. */ |
3802 | error_at (gimple_location (stmt), |
3803 | "%<teams%> construct must be closely nested inside of " |
3804 | "%<target%> construct or not nested in any OpenMP " |
3805 | "construct"); |
3806 | return false; |
3807 | } |
3808 | break; |
3809 | case GIMPLE_OMP_TARGET: |
3810 | for (c = gimple_omp_target_clauses (stmt); c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3810, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3810, __FUNCTION__))->common.chain)) |
3811 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3811, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_DOACROSS) |
3812 | { |
3813 | enum omp_clause_doacross_kind kind = OMP_CLAUSE_DOACROSS_KIND (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_DOACROSS), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3813, __FUNCTION__))->omp_clause.subcode.doacross_kind); |
3814 | error_at (OMP_CLAUSE_LOCATION (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3814, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, |
3815 | "%<depend(%s)%> is only allowed in %<omp ordered%>", |
3816 | kind == OMP_CLAUSE_DOACROSS_SOURCE ? "source" : "sink"); |
3817 | return false; |
3818 | } |
3819 | if (is_gimple_omp_offloaded (stmt) |
3820 | && oacc_get_fn_attrib (cfun(cfun + 0)->decl) != NULLnullptr) |
3821 | { |
3822 | error_at (gimple_location (stmt), |
3823 | "OpenACC region inside of OpenACC routine, nested " |
3824 | "parallelism not supported yet"); |
3825 | return false; |
3826 | } |
3827 | for (; ctx != NULLnullptr; ctx = ctx->outer) |
3828 | { |
3829 | if (gimple_code (ctx->stmt) != GIMPLE_OMP_TARGET) |
3830 | { |
3831 | if (is_gimple_omp (stmt) |
3832 | && is_gimple_omp_oacc (stmt) |
3833 | && is_gimple_omp (ctx->stmt)) |
3834 | { |
3835 | error_at (gimple_location (stmt), |
3836 | "OpenACC construct inside of non-OpenACC region"); |
3837 | return false; |
3838 | } |
3839 | continue; |
3840 | } |
3841 | |
3842 | const char *stmt_name, *ctx_stmt_name; |
3843 | switch (gimple_omp_target_kind (stmt)) |
3844 | { |
3845 | case GF_OMP_TARGET_KIND_REGION: stmt_name = "target"; break; |
3846 | case GF_OMP_TARGET_KIND_DATA: stmt_name = "target data"; break; |
3847 | case GF_OMP_TARGET_KIND_UPDATE: stmt_name = "target update"; break; |
3848 | case GF_OMP_TARGET_KIND_ENTER_DATA: |
3849 | stmt_name = "target enter data"; break; |
3850 | case GF_OMP_TARGET_KIND_EXIT_DATA: |
3851 | stmt_name = "target exit data"; break; |
3852 | case GF_OMP_TARGET_KIND_OACC_PARALLEL: stmt_name = "parallel"; break; |
3853 | case GF_OMP_TARGET_KIND_OACC_KERNELS: stmt_name = "kernels"; break; |
3854 | case GF_OMP_TARGET_KIND_OACC_SERIAL: stmt_name = "serial"; break; |
3855 | case GF_OMP_TARGET_KIND_OACC_DATA: stmt_name = "data"; break; |
3856 | case GF_OMP_TARGET_KIND_OACC_UPDATE: stmt_name = "update"; break; |
3857 | case GF_OMP_TARGET_KIND_OACC_ENTER_DATA: |
3858 | stmt_name = "enter data"; break; |
3859 | case GF_OMP_TARGET_KIND_OACC_EXIT_DATA: |
3860 | stmt_name = "exit data"; break; |
3861 | case GF_OMP_TARGET_KIND_OACC_DECLARE: stmt_name = "declare"; break; |
3862 | case GF_OMP_TARGET_KIND_OACC_HOST_DATA: stmt_name = "host_data"; |
3863 | break; |
3864 | case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED: |
3865 | case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE: |
3866 | case GF_OMP_TARGET_KIND_OACC_DATA_KERNELS: |
3867 | /* OpenACC 'kernels' decomposed parts. */ |
3868 | stmt_name = "kernels"; break; |
3869 | default: gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3869, __FUNCTION__)); |
3870 | } |
3871 | switch (gimple_omp_target_kind (ctx->stmt)) |
3872 | { |
3873 | case GF_OMP_TARGET_KIND_REGION: ctx_stmt_name = "target"; break; |
3874 | case GF_OMP_TARGET_KIND_DATA: ctx_stmt_name = "target data"; break; |
3875 | case GF_OMP_TARGET_KIND_OACC_PARALLEL: |
3876 | ctx_stmt_name = "parallel"; break; |
3877 | case GF_OMP_TARGET_KIND_OACC_KERNELS: |
3878 | ctx_stmt_name = "kernels"; break; |
3879 | case GF_OMP_TARGET_KIND_OACC_SERIAL: |
3880 | ctx_stmt_name = "serial"; break; |
3881 | case GF_OMP_TARGET_KIND_OACC_DATA: ctx_stmt_name = "data"; break; |
3882 | case GF_OMP_TARGET_KIND_OACC_HOST_DATA: |
3883 | ctx_stmt_name = "host_data"; break; |
3884 | case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED: |
3885 | case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE: |
3886 | case GF_OMP_TARGET_KIND_OACC_DATA_KERNELS: |
3887 | /* OpenACC 'kernels' decomposed parts. */ |
3888 | ctx_stmt_name = "kernels"; break; |
3889 | default: gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3889, __FUNCTION__)); |
3890 | } |
3891 | |
3892 | /* OpenACC/OpenMP mismatch? */ |
3893 | if (is_gimple_omp_oacc (stmt) |
3894 | != is_gimple_omp_oacc (ctx->stmt)) |
3895 | { |
3896 | error_at (gimple_location (stmt), |
3897 | "%s %qs construct inside of %s %qs region", |
3898 | (is_gimple_omp_oacc (stmt) |
3899 | ? "OpenACC" : "OpenMP"), stmt_name, |
3900 | (is_gimple_omp_oacc (ctx->stmt) |
3901 | ? "OpenACC" : "OpenMP"), ctx_stmt_name); |
3902 | return false; |
3903 | } |
3904 | if (is_gimple_omp_offloaded (ctx->stmt)) |
3905 | { |
3906 | /* No GIMPLE_OMP_TARGET inside offloaded OpenACC CTX. */ |
3907 | if (is_gimple_omp_oacc (ctx->stmt)) |
3908 | { |
3909 | error_at (gimple_location (stmt), |
3910 | "%qs construct inside of %qs region", |
3911 | stmt_name, ctx_stmt_name); |
3912 | return false; |
3913 | } |
3914 | else |
3915 | { |
3916 | if ((gimple_omp_target_kind (ctx->stmt) |
3917 | == GF_OMP_TARGET_KIND_REGION) |
3918 | && (gimple_omp_target_kind (stmt) |
3919 | == GF_OMP_TARGET_KIND_REGION)) |
3920 | { |
3921 | c = omp_find_clause (gimple_omp_target_clauses (stmt), |
3922 | OMP_CLAUSE_DEVICE); |
3923 | if (c && OMP_CLAUSE_DEVICE_ANCESTOR (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_DEVICE), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3923, __FUNCTION__))->base.public_flag)) |
3924 | break; |
3925 | } |
3926 | warning_at (gimple_location (stmt), 0, |
3927 | "%qs construct inside of %qs region", |
3928 | stmt_name, ctx_stmt_name); |
3929 | } |
3930 | } |
3931 | } |
3932 | break; |
3933 | default: |
3934 | break; |
3935 | } |
3936 | return true; |
3937 | } |
3938 | |
3939 | |
3940 | /* Helper function scan_omp. |
3941 | |
3942 | Callback for walk_tree or operators in walk_gimple_stmt used to |
3943 | scan for OMP directives in TP. */ |
3944 | |
3945 | static tree |
3946 | scan_omp_1_op (tree *tp, int *walk_subtrees, void *data) |
3947 | { |
3948 | struct walk_stmt_info *wi = (struct walk_stmt_info *) data; |
3949 | omp_context *ctx = (omp_context *) wi->info; |
3950 | tree t = *tp; |
3951 | |
3952 | switch (TREE_CODE (t)((enum tree_code) (t)->base.code)) |
3953 | { |
3954 | case VAR_DECL: |
3955 | case PARM_DECL: |
3956 | case LABEL_DECL: |
3957 | case RESULT_DECL: |
3958 | if (ctx) |
3959 | { |
3960 | tree repl = remap_decl (t, &ctx->cb); |
3961 | gcc_checking_assert (TREE_CODE (repl) != ERROR_MARK)((void)(!(((enum tree_code) (repl)->base.code) != ERROR_MARK ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3961, __FUNCTION__), 0 : 0)); |
3962 | *tp = repl; |
3963 | } |
3964 | break; |
3965 | |
3966 | default: |
3967 | if (ctx && TYPE_P (t)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (t)->base.code))] == tcc_type)) |
3968 | *tp = remap_type (t, &ctx->cb); |
3969 | else if (!DECL_P (t)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (t)->base.code))] == tcc_declaration)) |
3970 | { |
3971 | *walk_subtrees = 1; |
3972 | if (ctx) |
3973 | { |
3974 | tree tem = remap_type (TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3974, __FUNCTION__))->typed.type), &ctx->cb); |
3975 | if (tem != TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3975, __FUNCTION__))->typed.type)) |
3976 | { |
3977 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) == INTEGER_CST) |
3978 | *tp = wide_int_to_tree (tem, wi::to_wide (t)); |
3979 | else |
3980 | TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3980, __FUNCTION__))->typed.type) = tem; |
3981 | } |
3982 | } |
3983 | } |
3984 | break; |
3985 | } |
3986 | |
3987 | return NULL_TREE(tree) nullptr; |
3988 | } |
3989 | |
3990 | /* Return true if FNDECL is a setjmp or a longjmp. */ |
3991 | |
3992 | static bool |
3993 | setjmp_or_longjmp_p (const_tree fndecl) |
3994 | { |
3995 | if (fndecl_built_in_p (fndecl, BUILT_IN_SETJMP) |
3996 | || fndecl_built_in_p (fndecl, BUILT_IN_LONGJMP)) |
3997 | return true; |
3998 | |
3999 | tree declname = DECL_NAME (fndecl)((contains_struct_check ((fndecl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 3999, __FUNCTION__))->decl_minimal.name); |
4000 | if (!declname |
4001 | || (DECL_CONTEXT (fndecl)((contains_struct_check ((fndecl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4001, __FUNCTION__))->decl_minimal.context) != NULL_TREE(tree) nullptr |
4002 | && TREE_CODE (DECL_CONTEXT (fndecl))((enum tree_code) (((contains_struct_check ((fndecl), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4002, __FUNCTION__))->decl_minimal.context))->base.code ) != TRANSLATION_UNIT_DECL) |
4003 | || !TREE_PUBLIC (fndecl)((fndecl)->base.public_flag)) |
4004 | return false; |
4005 | |
4006 | const char *name = IDENTIFIER_POINTER (declname)((const char *) (tree_check ((declname), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4006, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.str ); |
4007 | return !strcmp (name, "setjmp") || !strcmp (name, "longjmp"); |
4008 | } |
4009 | |
4010 | /* Return true if FNDECL is an omp_* runtime API call. */ |
4011 | |
4012 | static bool |
4013 | omp_runtime_api_call (const_tree fndecl) |
4014 | { |
4015 | tree declname = DECL_NAME (fndecl)((contains_struct_check ((fndecl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4015, __FUNCTION__))->decl_minimal.name); |
4016 | if (!declname |
4017 | || (DECL_CONTEXT (fndecl)((contains_struct_check ((fndecl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4017, __FUNCTION__))->decl_minimal.context) != NULL_TREE(tree) nullptr |
4018 | && TREE_CODE (DECL_CONTEXT (fndecl))((enum tree_code) (((contains_struct_check ((fndecl), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4018, __FUNCTION__))->decl_minimal.context))->base.code ) != TRANSLATION_UNIT_DECL) |
4019 | || !TREE_PUBLIC (fndecl)((fndecl)->base.public_flag)) |
4020 | return false; |
4021 | |
4022 | const char *name = IDENTIFIER_POINTER (declname)((const char *) (tree_check ((declname), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4022, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.str ); |
4023 | if (!startswith (name, "omp_")) |
4024 | return false; |
4025 | |
4026 | static const char *omp_runtime_apis[] = |
4027 | { |
4028 | /* This array has 3 sections. First omp_* calls that don't |
4029 | have any suffixes. */ |
4030 | "aligned_alloc", |
4031 | "aligned_calloc", |
4032 | "alloc", |
4033 | "calloc", |
4034 | "free", |
4035 | "get_mapped_ptr", |
4036 | "realloc", |
4037 | "target_alloc", |
4038 | "target_associate_ptr", |
4039 | "target_disassociate_ptr", |
4040 | "target_free", |
4041 | "target_is_accessible", |
4042 | "target_is_present", |
4043 | "target_memcpy", |
4044 | "target_memcpy_async", |
4045 | "target_memcpy_rect", |
4046 | "target_memcpy_rect_async", |
4047 | NULLnullptr, |
4048 | /* Now omp_* calls that are available as omp_* and omp_*_; however, the |
4049 | DECL_NAME is always omp_* without tailing underscore. */ |
4050 | "capture_affinity", |
4051 | "destroy_allocator", |
4052 | "destroy_lock", |
4053 | "destroy_nest_lock", |
4054 | "display_affinity", |
4055 | "fulfill_event", |
4056 | "get_active_level", |
4057 | "get_affinity_format", |
4058 | "get_cancellation", |
4059 | "get_default_allocator", |
4060 | "get_default_device", |
4061 | "get_device_num", |
4062 | "get_dynamic", |
4063 | "get_initial_device", |
4064 | "get_level", |
4065 | "get_max_active_levels", |
4066 | "get_max_task_priority", |
4067 | "get_max_teams", |
4068 | "get_max_threads", |
4069 | "get_nested", |
4070 | "get_num_devices", |
4071 | "get_num_places", |
4072 | "get_num_procs", |
4073 | "get_num_teams", |
4074 | "get_num_threads", |
4075 | "get_partition_num_places", |
4076 | "get_place_num", |
4077 | "get_proc_bind", |
4078 | "get_supported_active_levels", |
4079 | "get_team_num", |
4080 | "get_teams_thread_limit", |
4081 | "get_thread_limit", |
4082 | "get_thread_num", |
4083 | "get_wtick", |
4084 | "get_wtime", |
4085 | "in_explicit_task", |
4086 | "in_final", |
4087 | "in_parallel", |
4088 | "init_lock", |
4089 | "init_nest_lock", |
4090 | "is_initial_device", |
4091 | "pause_resource", |
4092 | "pause_resource_all", |
4093 | "set_affinity_format", |
4094 | "set_default_allocator", |
4095 | "set_lock", |
4096 | "set_nest_lock", |
4097 | "test_lock", |
4098 | "test_nest_lock", |
4099 | "unset_lock", |
4100 | "unset_nest_lock", |
4101 | NULLnullptr, |
4102 | /* And finally calls available as omp_*, omp_*_ and omp_*_8_; however, |
4103 | as DECL_NAME only omp_* and omp_*_8 appear. */ |
4104 | "display_env", |
4105 | "get_ancestor_thread_num", |
4106 | "init_allocator", |
4107 | "get_partition_place_nums", |
4108 | "get_place_num_procs", |
4109 | "get_place_proc_ids", |
4110 | "get_schedule", |
4111 | "get_team_size", |
4112 | "set_default_device", |
4113 | "set_dynamic", |
4114 | "set_max_active_levels", |
4115 | "set_nested", |
4116 | "set_num_teams", |
4117 | "set_num_threads", |
4118 | "set_schedule", |
4119 | "set_teams_thread_limit" |
4120 | }; |
4121 | |
4122 | int mode = 0; |
4123 | for (unsigned i = 0; i < ARRAY_SIZE (omp_runtime_apis)(sizeof (omp_runtime_apis) / sizeof ((omp_runtime_apis)[0])); i++) |
4124 | { |
4125 | if (omp_runtime_apis[i] == NULLnullptr) |
4126 | { |
4127 | mode++; |
4128 | continue; |
4129 | } |
4130 | size_t len = strlen (omp_runtime_apis[i]); |
4131 | if (strncmp (name + 4, omp_runtime_apis[i], len) == 0 |
4132 | && (name[4 + len] == '\0' |
4133 | || (mode > 1 && strcmp (name + 4 + len, "_8") == 0))) |
4134 | return true; |
4135 | } |
4136 | return false; |
4137 | } |
4138 | |
4139 | /* Helper function for scan_omp. |
4140 | |
4141 | Callback for walk_gimple_stmt used to scan for OMP directives in |
4142 | the current statement in GSI. */ |
4143 | |
4144 | static tree |
4145 | scan_omp_1_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p, |
4146 | struct walk_stmt_info *wi) |
4147 | { |
4148 | gimple *stmt = gsi_stmt (*gsi); |
4149 | omp_context *ctx = (omp_context *) wi->info; |
4150 | |
4151 | if (gimple_has_location (stmt)) |
4152 | input_location = gimple_location (stmt); |
4153 | |
4154 | /* Check the nesting restrictions. */ |
4155 | bool remove = false; |
4156 | if (is_gimple_omp (stmt)) |
4157 | remove = !check_omp_nesting_restrictions (stmt, ctx); |
4158 | else if (is_gimple_call (stmt)) |
4159 | { |
4160 | tree fndecl = gimple_call_fndecl (stmt); |
4161 | if (fndecl) |
4162 | { |
4163 | if (ctx |
4164 | && gimple_code (ctx->stmt) == GIMPLE_OMP_FOR |
4165 | && gimple_omp_for_kind (ctx->stmt) == GF_OMP_FOR_KIND_SIMD |
4166 | && setjmp_or_longjmp_p (fndecl) |
4167 | && !ctx->loop_p) |
4168 | { |
4169 | remove = true; |
4170 | error_at (gimple_location (stmt), |
4171 | "setjmp/longjmp inside %<simd%> construct"); |
4172 | } |
4173 | else if (DECL_BUILT_IN_CLASS (fndecl)((built_in_class) (tree_check ((fndecl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4173, __FUNCTION__, (FUNCTION_DECL)))->function_decl.built_in_class ) == BUILT_IN_NORMAL) |
4174 | switch (DECL_FUNCTION_CODE (fndecl)) |
4175 | { |
4176 | case BUILT_IN_GOMP_BARRIER: |
4177 | case BUILT_IN_GOMP_CANCEL: |
4178 | case BUILT_IN_GOMP_CANCELLATION_POINT: |
4179 | case BUILT_IN_GOMP_TASKYIELD: |
4180 | case BUILT_IN_GOMP_TASKWAIT: |
4181 | case BUILT_IN_GOMP_TASKGROUP_START: |
4182 | case BUILT_IN_GOMP_TASKGROUP_END: |
4183 | remove = !check_omp_nesting_restrictions (stmt, ctx); |
4184 | break; |
4185 | default: |
4186 | break; |
4187 | } |
4188 | else if (ctx) |
4189 | { |
4190 | omp_context *octx = ctx; |
4191 | if (gimple_code (ctx->stmt) == GIMPLE_OMP_SCAN && ctx->outer) |
4192 | octx = ctx->outer; |
4193 | if (octx->order_concurrent && omp_runtime_api_call (fndecl)) |
4194 | { |
4195 | remove = true; |
4196 | error_at (gimple_location (stmt), |
4197 | "OpenMP runtime API call %qD in a region with " |
4198 | "%<order(concurrent)%> clause", fndecl); |
4199 | } |
4200 | if (gimple_code (ctx->stmt) == GIMPLE_OMP_TEAMS |
4201 | && omp_runtime_api_call (fndecl) |
4202 | && ((IDENTIFIER_LENGTH (DECL_NAME (fndecl))((tree_check ((((contains_struct_check ((fndecl), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4202, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4202, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.len ) |
4203 | != strlen ("omp_get_num_teams")) |
4204 | || strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl))((const char *) (tree_check ((((contains_struct_check ((fndecl ), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4204, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4204, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.str ), |
4205 | "omp_get_num_teams") != 0) |
4206 | && ((IDENTIFIER_LENGTH (DECL_NAME (fndecl))((tree_check ((((contains_struct_check ((fndecl), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4206, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4206, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.len ) |
4207 | != strlen ("omp_get_team_num")) |
4208 | || strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl))((const char *) (tree_check ((((contains_struct_check ((fndecl ), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4208, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4208, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.str ), |
4209 | "omp_get_team_num") != 0)) |
4210 | { |
4211 | remove = true; |
4212 | error_at (gimple_location (stmt), |
4213 | "OpenMP runtime API call %qD strictly nested in a " |
4214 | "%<teams%> region", fndecl); |
4215 | } |
4216 | if (gimple_code (ctx->stmt) == GIMPLE_OMP_TARGET |
4217 | && (gimple_omp_target_kind (ctx->stmt) |
4218 | == GF_OMP_TARGET_KIND_REGION) |
4219 | && omp_runtime_api_call (fndecl)) |
4220 | { |
4221 | tree tgt_clauses = gimple_omp_target_clauses (ctx->stmt); |
4222 | tree c = omp_find_clause (tgt_clauses, OMP_CLAUSE_DEVICE); |
4223 | if (c && OMP_CLAUSE_DEVICE_ANCESTOR (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_DEVICE), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4223, __FUNCTION__))->base.public_flag)) |
4224 | error_at (gimple_location (stmt), |
4225 | "OpenMP runtime API call %qD in a region with " |
4226 | "%<device(ancestor)%> clause", fndecl); |
4227 | } |
4228 | } |
4229 | } |
4230 | } |
4231 | if (remove) |
4232 | { |
4233 | stmt = gimple_build_nop (); |
4234 | gsi_replace (gsi, stmt, false); |
4235 | } |
4236 | |
4237 | *handled_ops_p = true; |
4238 | |
4239 | switch (gimple_code (stmt)) |
4240 | { |
4241 | case GIMPLE_OMP_PARALLEL: |
4242 | taskreg_nesting_level++; |
4243 | scan_omp_parallel (gsi, ctx); |
4244 | taskreg_nesting_level--; |
4245 | break; |
4246 | |
4247 | case GIMPLE_OMP_TASK: |
4248 | taskreg_nesting_level++; |
4249 | scan_omp_task (gsi, ctx); |
4250 | taskreg_nesting_level--; |
4251 | break; |
4252 | |
4253 | case GIMPLE_OMP_FOR: |
4254 | if ((gimple_omp_for_kind (as_a <gomp_for *> (stmt)) |
4255 | == GF_OMP_FOR_KIND_SIMD) |
4256 | && gimple_omp_for_combined_into_p (stmt) |
4257 | && gimple_code (ctx->stmt) != GIMPLE_OMP_SCAN) |
4258 | { |
4259 | tree clauses = gimple_omp_for_clauses (as_a <gomp_for *> (stmt)); |
4260 | tree c = omp_find_clause (clauses, OMP_CLAUSE_REDUCTION); |
4261 | if (c && OMP_CLAUSE_REDUCTION_INSCAN (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4261, __FUNCTION__)))->base.private_flag) && !seen_error ()) |
4262 | { |
4263 | scan_omp_simd_scan (gsi, as_a <gomp_for *> (stmt), ctx); |
4264 | break; |
4265 | } |
4266 | } |
4267 | if ((gimple_omp_for_kind (as_a <gomp_for *> (stmt)) |
4268 | == GF_OMP_FOR_KIND_SIMD) |
4269 | && omp_maybe_offloaded_ctx (ctx) |
4270 | && omp_max_simt_vf () |
4271 | && gimple_omp_for_collapse (stmt) == 1) |
4272 | scan_omp_simd (gsi, as_a <gomp_for *> (stmt), ctx); |
4273 | else |
4274 | scan_omp_for (as_a <gomp_for *> (stmt), ctx); |
4275 | break; |
4276 | |
4277 | case GIMPLE_OMP_SCOPE: |
4278 | ctx = new_omp_context (stmt, ctx); |
4279 | scan_sharing_clauses (gimple_omp_scope_clauses (stmt), ctx); |
4280 | scan_omp (gimple_omp_body_ptr (stmt), ctx); |
4281 | break; |
4282 | |
4283 | case GIMPLE_OMP_SECTIONS: |
4284 | scan_omp_sections (as_a <gomp_sections *> (stmt), ctx); |
4285 | break; |
4286 | |
4287 | case GIMPLE_OMP_SINGLE: |
4288 | scan_omp_single (as_a <gomp_single *> (stmt), ctx); |
4289 | break; |
4290 | |
4291 | case GIMPLE_OMP_SCAN: |
4292 | if (tree clauses = gimple_omp_scan_clauses (as_a <gomp_scan *> (stmt))) |
4293 | { |
4294 | if (OMP_CLAUSE_CODE (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4294, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_INCLUSIVE) |
4295 | ctx->scan_inclusive = true; |
4296 | else if (OMP_CLAUSE_CODE (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4296, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_EXCLUSIVE) |
4297 | ctx->scan_exclusive = true; |
4298 | } |
4299 | /* FALLTHRU */ |
4300 | case GIMPLE_OMP_SECTION: |
4301 | case GIMPLE_OMP_MASTER: |
4302 | case GIMPLE_OMP_ORDERED: |
4303 | case GIMPLE_OMP_CRITICAL: |
4304 | ctx = new_omp_context (stmt, ctx); |
4305 | scan_omp (gimple_omp_body_ptr (stmt), ctx); |
4306 | break; |
4307 | |
4308 | case GIMPLE_OMP_MASKED: |
4309 | ctx = new_omp_context (stmt, ctx); |
4310 | scan_sharing_clauses (gimple_omp_masked_clauses (stmt), ctx); |
4311 | scan_omp (gimple_omp_body_ptr (stmt), ctx); |
4312 | break; |
4313 | |
4314 | case GIMPLE_OMP_TASKGROUP: |
4315 | ctx = new_omp_context (stmt, ctx); |
4316 | scan_sharing_clauses (gimple_omp_taskgroup_clauses (stmt), ctx); |
4317 | scan_omp (gimple_omp_body_ptr (stmt), ctx); |
4318 | break; |
4319 | |
4320 | case GIMPLE_OMP_TARGET: |
4321 | if (is_gimple_omp_offloaded (stmt)) |
4322 | { |
4323 | taskreg_nesting_level++; |
4324 | scan_omp_target (as_a <gomp_target *> (stmt), ctx); |
4325 | taskreg_nesting_level--; |
4326 | } |
4327 | else |
4328 | scan_omp_target (as_a <gomp_target *> (stmt), ctx); |
4329 | break; |
4330 | |
4331 | case GIMPLE_OMP_TEAMS: |
4332 | if (gimple_omp_teams_host (as_a <gomp_teams *> (stmt))) |
4333 | { |
4334 | taskreg_nesting_level++; |
4335 | scan_omp_teams (as_a <gomp_teams *> (stmt), ctx); |
4336 | taskreg_nesting_level--; |
4337 | } |
4338 | else |
4339 | scan_omp_teams (as_a <gomp_teams *> (stmt), ctx); |
4340 | break; |
4341 | |
4342 | case GIMPLE_BIND: |
4343 | { |
4344 | tree var; |
4345 | |
4346 | *handled_ops_p = false; |
4347 | if (ctx) |
4348 | for (var = gimple_bind_vars (as_a <gbind *> (stmt)); |
4349 | var ; |
4350 | var = DECL_CHAIN (var)(((contains_struct_check (((contains_struct_check ((var), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4350, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4350, __FUNCTION__))->common.chain))) |
4351 | insert_decl_map (&ctx->cb, var, var); |
4352 | } |
4353 | break; |
4354 | default: |
4355 | *handled_ops_p = false; |
4356 | break; |
4357 | } |
4358 | |
4359 | return NULL_TREE(tree) nullptr; |
4360 | } |
4361 | |
4362 | |
4363 | /* Scan all the statements starting at the current statement. CTX |
4364 | contains context information about the OMP directives and |
4365 | clauses found during the scan. */ |
4366 | |
4367 | static void |
4368 | scan_omp (gimple_seq *body_p, omp_context *ctx) |
4369 | { |
4370 | location_t saved_location; |
4371 | struct walk_stmt_info wi; |
4372 | |
4373 | memset (&wi, 0, sizeof (wi)); |
4374 | wi.info = ctx; |
4375 | wi.want_locations = true; |
4376 | |
4377 | saved_location = input_location; |
4378 | walk_gimple_seq_mod (body_p, scan_omp_1_stmt, scan_omp_1_op, &wi); |
4379 | input_location = saved_location; |
4380 | } |
4381 | |
4382 | /* Re-gimplification and code generation routines. */ |
4383 | |
4384 | /* Remove omp_member_access_dummy_var variables from gimple_bind_vars |
4385 | of BIND if in a method. */ |
4386 | |
4387 | static void |
4388 | maybe_remove_omp_member_access_dummy_vars (gbind *bind) |
4389 | { |
4390 | if (DECL_ARGUMENTS (current_function_decl)((tree_check ((current_function_decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4390, __FUNCTION__, (FUNCTION_DECL)))->function_decl.arguments ) |
4391 | && DECL_ARTIFICIAL (DECL_ARGUMENTS (current_function_decl))((contains_struct_check ((((tree_check ((current_function_decl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4391, __FUNCTION__, (FUNCTION_DECL)))->function_decl.arguments )), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4391, __FUNCTION__))->decl_common.artificial_flag) |
4392 | && (TREE_CODE (TREE_TYPE (DECL_ARGUMENTS (current_function_decl)))((enum tree_code) (((contains_struct_check ((((tree_check ((current_function_decl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4392, __FUNCTION__, (FUNCTION_DECL)))->function_decl.arguments )), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4392, __FUNCTION__))->typed.type))->base.code) |
4393 | == POINTER_TYPE)) |
4394 | { |
4395 | tree vars = gimple_bind_vars (bind); |
4396 | for (tree *pvar = &vars; *pvar; ) |
4397 | if (omp_member_access_dummy_var (*pvar)) |
4398 | *pvar = DECL_CHAIN (*pvar)(((contains_struct_check (((contains_struct_check ((*pvar), ( TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4398, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4398, __FUNCTION__))->common.chain)); |
4399 | else |
4400 | pvar = &DECL_CHAIN (*pvar)(((contains_struct_check (((contains_struct_check ((*pvar), ( TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4400, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4400, __FUNCTION__))->common.chain)); |
4401 | gimple_bind_set_vars (bind, vars); |
4402 | } |
4403 | } |
4404 | |
4405 | /* Remove omp_member_access_dummy_var variables from BLOCK_VARS of |
4406 | block and its subblocks. */ |
4407 | |
4408 | static void |
4409 | remove_member_access_dummy_vars (tree block) |
4410 | { |
4411 | for (tree *pvar = &BLOCK_VARS (block)((tree_check ((block), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4411, __FUNCTION__, (BLOCK)))->block.vars); *pvar; ) |
4412 | if (omp_member_access_dummy_var (*pvar)) |
4413 | *pvar = DECL_CHAIN (*pvar)(((contains_struct_check (((contains_struct_check ((*pvar), ( TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4413, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4413, __FUNCTION__))->common.chain)); |
4414 | else |
4415 | pvar = &DECL_CHAIN (*pvar)(((contains_struct_check (((contains_struct_check ((*pvar), ( TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4415, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4415, __FUNCTION__))->common.chain)); |
4416 | |
4417 | for (block = BLOCK_SUBBLOCKS (block)((tree_check ((block), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4417, __FUNCTION__, (BLOCK)))->block.subblocks); block; block = BLOCK_CHAIN (block)((tree_check ((block), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4417, __FUNCTION__, (BLOCK)))->block.chain)) |
4418 | remove_member_access_dummy_vars (block); |
4419 | } |
4420 | |
4421 | /* If a context was created for STMT when it was scanned, return it. */ |
4422 | |
4423 | static omp_context * |
4424 | maybe_lookup_ctx (gimple *stmt) |
4425 | { |
4426 | splay_tree_node n; |
4427 | n = splay_tree_lookup (all_contexts, (splay_tree_key) stmt); |
4428 | return n ? (omp_context *) n->value : NULLnullptr; |
4429 | } |
4430 | |
4431 | |
4432 | /* Find the mapping for DECL in CTX or the immediately enclosing |
4433 | context that has a mapping for DECL. |
4434 | |
4435 | If CTX is a nested parallel directive, we may have to use the decl |
4436 | mappings created in CTX's parent context. Suppose that we have the |
4437 | following parallel nesting (variable UIDs showed for clarity): |
4438 | |
4439 | iD.1562 = 0; |
4440 | #omp parallel shared(iD.1562) -> outer parallel |
4441 | iD.1562 = iD.1562 + 1; |
4442 | |
4443 | #omp parallel shared (iD.1562) -> inner parallel |
4444 | iD.1562 = iD.1562 - 1; |
4445 | |
4446 | Each parallel structure will create a distinct .omp_data_s structure |
4447 | for copying iD.1562 in/out of the directive: |
4448 | |
4449 | outer parallel .omp_data_s.1.i -> iD.1562 |
4450 | inner parallel .omp_data_s.2.i -> iD.1562 |
4451 | |
4452 | A shared variable mapping will produce a copy-out operation before |
4453 | the parallel directive and a copy-in operation after it. So, in |
4454 | this case we would have: |
4455 | |
4456 | iD.1562 = 0; |
4457 | .omp_data_o.1.i = iD.1562; |
4458 | #omp parallel shared(iD.1562) -> outer parallel |
4459 | .omp_data_i.1 = &.omp_data_o.1 |
4460 | .omp_data_i.1->i = .omp_data_i.1->i + 1; |
4461 | |
4462 | .omp_data_o.2.i = iD.1562; -> ** |
4463 | #omp parallel shared(iD.1562) -> inner parallel |
4464 | .omp_data_i.2 = &.omp_data_o.2 |
4465 | .omp_data_i.2->i = .omp_data_i.2->i - 1; |
4466 | |
4467 | |
4468 | ** This is a problem. The symbol iD.1562 cannot be referenced |
4469 | inside the body of the outer parallel region. But since we are |
4470 | emitting this copy operation while expanding the inner parallel |
4471 | directive, we need to access the CTX structure of the outer |
4472 | parallel directive to get the correct mapping: |
4473 | |
4474 | .omp_data_o.2.i = .omp_data_i.1->i |
4475 | |
4476 | Since there may be other workshare or parallel directives enclosing |
4477 | the parallel directive, it may be necessary to walk up the context |
4478 | parent chain. This is not a problem in general because nested |
4479 | parallelism happens only rarely. */ |
4480 | |
4481 | static tree |
4482 | lookup_decl_in_outer_ctx (tree decl, omp_context *ctx) |
4483 | { |
4484 | tree t; |
4485 | omp_context *up; |
4486 | |
4487 | for (up = ctx->outer, t = NULLnullptr; up && t == NULLnullptr; up = up->outer) |
4488 | t = maybe_lookup_decl (decl, up); |
4489 | |
4490 | gcc_assert (!ctx->is_nested || t || is_global_var (decl))((void)(!(!ctx->is_nested || t || is_global_var (decl)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4490, __FUNCTION__), 0 : 0)); |
4491 | |
4492 | return t ? t : decl; |
4493 | } |
4494 | |
4495 | |
4496 | /* Similar to lookup_decl_in_outer_ctx, but return DECL if not found |
4497 | in outer contexts. */ |
4498 | |
4499 | static tree |
4500 | maybe_lookup_decl_in_outer_ctx (tree decl, omp_context *ctx) |
4501 | { |
4502 | tree t = NULLnullptr; |
4503 | omp_context *up; |
4504 | |
4505 | for (up = ctx->outer, t = NULLnullptr; up && t == NULLnullptr; up = up->outer) |
4506 | t = maybe_lookup_decl (decl, up); |
4507 | |
4508 | return t ? t : decl; |
4509 | } |
4510 | |
4511 | |
4512 | /* Construct the initialization value for reduction operation OP. */ |
4513 | |
4514 | tree |
4515 | omp_reduction_init_op (location_t loc, enum tree_code op, tree type) |
4516 | { |
4517 | switch (op) |
4518 | { |
4519 | case PLUS_EXPR: |
4520 | case MINUS_EXPR: |
4521 | case BIT_IOR_EXPR: |
4522 | case BIT_XOR_EXPR: |
4523 | case TRUTH_OR_EXPR: |
4524 | case TRUTH_ORIF_EXPR: |
4525 | case TRUTH_XOR_EXPR: |
4526 | case NE_EXPR: |
4527 | return build_zero_cst (type); |
4528 | |
4529 | case MULT_EXPR: |
4530 | case TRUTH_AND_EXPR: |
4531 | case TRUTH_ANDIF_EXPR: |
4532 | case EQ_EXPR: |
4533 | return fold_convert_loc (loc, type, integer_one_nodeglobal_trees[TI_INTEGER_ONE]); |
4534 | |
4535 | case BIT_AND_EXPR: |
4536 | return fold_convert_loc (loc, type, integer_minus_one_nodeglobal_trees[TI_INTEGER_MINUS_ONE]); |
4537 | |
4538 | case MAX_EXPR: |
4539 | if (SCALAR_FLOAT_TYPE_P (type)(((enum tree_code) (type)->base.code) == REAL_TYPE)) |
4540 | { |
4541 | REAL_VALUE_TYPEstruct real_value min; |
4542 | if (HONOR_INFINITIES (type)) |
4543 | real_arithmetic (&min, NEGATE_EXPR, &dconstinf, NULLnullptr); |
4544 | else |
4545 | real_maxval (&min, 1, TYPE_MODE (type)((((enum tree_code) ((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4545, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (type) : (type)->type_common.mode)); |
4546 | return build_real (type, min); |
4547 | } |
4548 | else if (POINTER_TYPE_P (type)(((enum tree_code) (type)->base.code) == POINTER_TYPE || ( (enum tree_code) (type)->base.code) == REFERENCE_TYPE)) |
4549 | { |
4550 | wide_int min |
4551 | = wi::min_value (TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4551, __FUNCTION__))->type_common.precision), TYPE_SIGN (type)((signop) ((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4551, __FUNCTION__))->base.u.bits.unsigned_flag))); |
4552 | return wide_int_to_tree (type, min); |
4553 | } |
4554 | else |
4555 | { |
4556 | gcc_assert (INTEGRAL_TYPE_P (type))((void)(!((((enum tree_code) (type)->base.code) == ENUMERAL_TYPE || ((enum tree_code) (type)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type)->base.code) == INTEGER_TYPE)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4556, __FUNCTION__), 0 : 0)); |
4557 | return TYPE_MIN_VALUE (type)((tree_check5 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4557, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.minval ); |
4558 | } |
4559 | |
4560 | case MIN_EXPR: |
4561 | if (SCALAR_FLOAT_TYPE_P (type)(((enum tree_code) (type)->base.code) == REAL_TYPE)) |
4562 | { |
4563 | REAL_VALUE_TYPEstruct real_value max; |
4564 | if (HONOR_INFINITIES (type)) |
4565 | max = dconstinf; |
4566 | else |
4567 | real_maxval (&max, 0, TYPE_MODE (type)((((enum tree_code) ((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4567, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (type) : (type)->type_common.mode)); |
4568 | return build_real (type, max); |
4569 | } |
4570 | else if (POINTER_TYPE_P (type)(((enum tree_code) (type)->base.code) == POINTER_TYPE || ( (enum tree_code) (type)->base.code) == REFERENCE_TYPE)) |
4571 | { |
4572 | wide_int max |
4573 | = wi::max_value (TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4573, __FUNCTION__))->type_common.precision), TYPE_SIGN (type)((signop) ((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4573, __FUNCTION__))->base.u.bits.unsigned_flag))); |
4574 | return wide_int_to_tree (type, max); |
4575 | } |
4576 | else |
4577 | { |
4578 | gcc_assert (INTEGRAL_TYPE_P (type))((void)(!((((enum tree_code) (type)->base.code) == ENUMERAL_TYPE || ((enum tree_code) (type)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type)->base.code) == INTEGER_TYPE)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4578, __FUNCTION__), 0 : 0)); |
4579 | return TYPE_MAX_VALUE (type)((tree_check5 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4579, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ); |
4580 | } |
4581 | |
4582 | default: |
4583 | gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4583, __FUNCTION__)); |
4584 | } |
4585 | } |
4586 | |
4587 | /* Construct the initialization value for reduction CLAUSE. */ |
4588 | |
4589 | tree |
4590 | omp_reduction_init (tree clause, tree type) |
4591 | { |
4592 | return omp_reduction_init_op (OMP_CLAUSE_LOCATION (clause)((tree_check ((clause), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4592, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, |
4593 | OMP_CLAUSE_REDUCTION_CODE (clause)((omp_clause_range_check ((clause), (OMP_CLAUSE_REDUCTION), ( OMP_CLAUSE_IN_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4593, __FUNCTION__))->omp_clause.subcode.reduction_code), type); |
4594 | } |
4595 | |
4596 | /* Return alignment to be assumed for var in CLAUSE, which should be |
4597 | OMP_CLAUSE_ALIGNED. */ |
4598 | |
4599 | static tree |
4600 | omp_clause_aligned_alignment (tree clause) |
4601 | { |
4602 | if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause)(*(omp_clause_elt_check (((omp_clause_subcode_check ((clause) , (OMP_CLAUSE_ALIGNED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4602, __FUNCTION__))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4602, __FUNCTION__)))) |
4603 | return OMP_CLAUSE_ALIGNED_ALIGNMENT (clause)(*(omp_clause_elt_check (((omp_clause_subcode_check ((clause) , (OMP_CLAUSE_ALIGNED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4603, __FUNCTION__))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4603, __FUNCTION__))); |
4604 | |
4605 | /* Otherwise return implementation defined alignment. */ |
4606 | unsigned int al = 1; |
4607 | opt_scalar_mode mode_iter; |
4608 | auto_vector_modes modes; |
4609 | targetm.vectorize.autovectorize_vector_modes (&modes, true); |
4610 | static enum mode_class classes[] |
4611 | = { MODE_INT, MODE_VECTOR_INT, MODE_FLOAT, MODE_VECTOR_FLOAT }; |
4612 | for (int i = 0; i < 4; i += 2) |
4613 | /* The for loop above dictates that we only walk through scalar classes. */ |
4614 | FOR_EACH_MODE_IN_CLASS (mode_iter, classes[i])for (mode_iterator::start (&(mode_iter), classes[i]); mode_iterator ::iterate_p (&(mode_iter)); mode_iterator::get_next (& (mode_iter))) |
4615 | { |
4616 | scalar_mode mode = mode_iter.require (); |
4617 | machine_mode vmode = targetm.vectorize.preferred_simd_mode (mode); |
4618 | if (GET_MODE_CLASS (vmode)((enum mode_class) mode_class[vmode]) != classes[i + 1]) |
4619 | continue; |
4620 | machine_mode alt_vmode; |
4621 | for (unsigned int j = 0; j < modes.length (); ++j) |
4622 | if (related_vector_mode (modes[j], mode).exists (&alt_vmode) |
4623 | && known_ge (GET_MODE_SIZE (alt_vmode), GET_MODE_SIZE (vmode))(!maybe_lt (GET_MODE_SIZE (alt_vmode), GET_MODE_SIZE (vmode)) )) |
4624 | vmode = alt_vmode; |
4625 | |
4626 | tree type = lang_hooks.types.type_for_mode (mode, 1); |
4627 | if (type == NULL_TREE(tree) nullptr || TYPE_MODE (type)((((enum tree_code) ((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4627, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (type) : (type)->type_common.mode) != mode) |
4628 | continue; |
4629 | type = build_vector_type_for_mode (type, vmode); |
4630 | if (TYPE_MODE (type)((((enum tree_code) ((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4630, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (type) : (type)->type_common.mode) != vmode) |
4631 | continue; |
4632 | if (TYPE_ALIGN_UNIT (type)((((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4632, __FUNCTION__))->type_common.align) ? ((unsigned)1) << (((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4632, __FUNCTION__))->type_common.align) - 1) : 0) / (8) ) > al) |
4633 | al = TYPE_ALIGN_UNIT (type)((((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4633, __FUNCTION__))->type_common.align) ? ((unsigned)1) << (((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4633, __FUNCTION__))->type_common.align) - 1) : 0) / (8) ); |
4634 | } |
4635 | return build_int_cst (integer_type_nodeinteger_types[itk_int], al); |
4636 | } |
4637 | |
4638 | |
4639 | /* This structure is part of the interface between lower_rec_simd_input_clauses |
4640 | and lower_rec_input_clauses. */ |
4641 | |
4642 | class omplow_simd_context { |
4643 | public: |
4644 | omplow_simd_context () { memset (this, 0, sizeof (*this)); } |
4645 | tree idx; |
4646 | tree lane; |
4647 | tree lastlane; |
4648 | vec<tree, va_heap> simt_eargs; |
4649 | gimple_seq simt_dlist; |
4650 | poly_uint64_pod max_vf; |
4651 | bool is_simt; |
4652 | }; |
4653 | |
4654 | /* Helper function of lower_rec_input_clauses, used for #pragma omp simd |
4655 | privatization. */ |
4656 | |
4657 | static bool |
4658 | lower_rec_simd_input_clauses (tree new_var, omp_context *ctx, |
4659 | omplow_simd_context *sctx, tree &ivar, |
4660 | tree &lvar, tree *rvar = NULLnullptr, |
4661 | tree *rvar2 = NULLnullptr) |
4662 | { |
4663 | if (known_eq (sctx->max_vf, 0U)(!maybe_ne (sctx->max_vf, 0U))) |
4664 | { |
4665 | sctx->max_vf = sctx->is_simt ? omp_max_simt_vf () : omp_max_vf (); |
4666 | if (maybe_gt (sctx->max_vf, 1U)maybe_lt (1U, sctx->max_vf)) |
4667 | { |
4668 | tree c = omp_find_clause (gimple_omp_for_clauses (ctx->stmt), |
4669 | OMP_CLAUSE_SAFELEN); |
4670 | if (c) |
4671 | { |
4672 | poly_uint64 safe_len; |
4673 | if (!poly_int_tree_p (OMP_CLAUSE_SAFELEN_EXPR (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_SAFELEN ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4673, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4673, __FUNCTION__))), &safe_len) |
4674 | || maybe_lt (safe_len, 1U)) |
4675 | sctx->max_vf = 1; |
4676 | else |
4677 | sctx->max_vf = lower_bound (sctx->max_vf, safe_len); |
4678 | } |
4679 | } |
4680 | if (sctx->is_simt && !known_eq (sctx->max_vf, 1U)(!maybe_ne (sctx->max_vf, 1U))) |
4681 | { |
4682 | for (tree c = gimple_omp_for_clauses (ctx->stmt); c; |
4683 | c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4683, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4683, __FUNCTION__))->common.chain)) |
4684 | { |
4685 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4685, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code != OMP_CLAUSE_REDUCTION) |
4686 | continue; |
4687 | |
4688 | if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (c)(*(omp_clause_elt_check (((omp_clause_range_check ((c), (OMP_CLAUSE_REDUCTION ), (OMP_CLAUSE_IN_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4688, __FUNCTION__))), (3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4688, __FUNCTION__)))) |
4689 | { |
4690 | /* UDR reductions are not supported yet for SIMT, disable |
4691 | SIMT. */ |
4692 | sctx->max_vf = 1; |
4693 | break; |
4694 | } |
4695 | |
4696 | if (truth_value_p (OMP_CLAUSE_REDUCTION_CODE (c)((omp_clause_range_check ((c), (OMP_CLAUSE_REDUCTION), (OMP_CLAUSE_IN_REDUCTION ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4696, __FUNCTION__))->omp_clause.subcode.reduction_code)) |
4697 | && !INTEGRAL_TYPE_P (TREE_TYPE (new_var))(((enum tree_code) (((contains_struct_check ((new_var), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4697, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE || ((enum tree_code) (((contains_struct_check ((new_var), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4697, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE || ((enum tree_code) (((contains_struct_check ((new_var), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4697, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE )) |
4698 | { |
4699 | /* Doing boolean operations on non-integral types is |
4700 | for conformance only, it's not worth supporting this |
4701 | for SIMT. */ |
4702 | sctx->max_vf = 1; |
4703 | break; |
4704 | } |
4705 | } |
4706 | } |
4707 | if (maybe_gt (sctx->max_vf, 1U)maybe_lt (1U, sctx->max_vf)) |
4708 | { |
4709 | sctx->idx = create_tmp_var (unsigned_type_nodeinteger_types[itk_unsigned_int]); |
4710 | sctx->lane = create_tmp_var (unsigned_type_nodeinteger_types[itk_unsigned_int]); |
4711 | } |
4712 | } |
4713 | if (known_eq (sctx->max_vf, 1U)(!maybe_ne (sctx->max_vf, 1U))) |
4714 | return false; |
4715 | |
4716 | if (sctx->is_simt) |
4717 | { |
4718 | if (is_gimple_reg (new_var)) |
4719 | { |
4720 | ivar = lvar = new_var; |
4721 | return true; |
4722 | } |
4723 | tree type = TREE_TYPE (new_var)((contains_struct_check ((new_var), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4723, __FUNCTION__))->typed.type), ptype = build_pointer_type (type); |
4724 | ivar = lvar = create_tmp_var (type); |
4725 | TREE_ADDRESSABLE (ivar)((ivar)->base.addressable_flag) = 1; |
4726 | DECL_ATTRIBUTES (ivar)((contains_struct_check ((ivar), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4726, __FUNCTION__))->decl_common.attributes) = tree_cons (get_identifier ("omp simt private")(__builtin_constant_p ("omp simt private") ? get_identifier_with_length (("omp simt private"), strlen ("omp simt private")) : get_identifier ("omp simt private")), |
4727 | NULLnullptr, DECL_ATTRIBUTES (ivar)((contains_struct_check ((ivar), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4727, __FUNCTION__))->decl_common.attributes)); |
4728 | sctx->simt_eargs.safe_push (build1 (ADDR_EXPR, ptype, ivar)); |
4729 | tree clobber = build_clobber (type); |
4730 | gimple *g = gimple_build_assign (ivar, clobber); |
4731 | gimple_seq_add_stmt (&sctx->simt_dlist, g); |
4732 | } |
4733 | else |
4734 | { |
4735 | tree atype = build_array_type_nelts (TREE_TYPE (new_var)((contains_struct_check ((new_var), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4735, __FUNCTION__))->typed.type), sctx->max_vf); |
4736 | tree avar = create_tmp_var_raw (atype); |
4737 | if (TREE_ADDRESSABLE (new_var)((new_var)->base.addressable_flag)) |
4738 | TREE_ADDRESSABLE (avar)((avar)->base.addressable_flag) = 1; |
4739 | DECL_ATTRIBUTES (avar)((contains_struct_check ((avar), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4739, __FUNCTION__))->decl_common.attributes) |
4740 | = tree_cons (get_identifier ("omp simd array")(__builtin_constant_p ("omp simd array") ? get_identifier_with_length (("omp simd array"), strlen ("omp simd array")) : get_identifier ("omp simd array")), NULLnullptr, |
4741 | DECL_ATTRIBUTES (avar)((contains_struct_check ((avar), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4741, __FUNCTION__))->decl_common.attributes)); |
4742 | gimple_add_tmp_var (avar); |
4743 | tree iavar = avar; |
4744 | if (rvar && !ctx->for_simd_scan_phase) |
4745 | { |
4746 | /* For inscan reductions, create another array temporary, |
4747 | which will hold the reduced value. */ |
4748 | iavar = create_tmp_var_raw (atype); |
4749 | if (TREE_ADDRESSABLE (new_var)((new_var)->base.addressable_flag)) |
4750 | TREE_ADDRESSABLE (iavar)((iavar)->base.addressable_flag) = 1; |
4751 | DECL_ATTRIBUTES (iavar)((contains_struct_check ((iavar), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4751, __FUNCTION__))->decl_common.attributes) |
4752 | = tree_cons (get_identifier ("omp simd array")(__builtin_constant_p ("omp simd array") ? get_identifier_with_length (("omp simd array"), strlen ("omp simd array")) : get_identifier ("omp simd array")), NULLnullptr, |
4753 | tree_cons (get_identifier ("omp simd inscan")(__builtin_constant_p ("omp simd inscan") ? get_identifier_with_length (("omp simd inscan"), strlen ("omp simd inscan")) : get_identifier ("omp simd inscan")), NULLnullptr, |
4754 | DECL_ATTRIBUTES (iavar)((contains_struct_check ((iavar), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4754, __FUNCTION__))->decl_common.attributes))); |
4755 | gimple_add_tmp_var (iavar); |
4756 | ctx->cb.decl_map->put (avar, iavar); |
4757 | if (sctx->lastlane == NULL_TREE(tree) nullptr) |
4758 | sctx->lastlane = create_tmp_var (unsigned_type_nodeinteger_types[itk_unsigned_int]); |
4759 | *rvar = build4 (ARRAY_REF, TREE_TYPE (new_var)((contains_struct_check ((new_var), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4759, __FUNCTION__))->typed.type), iavar, |
4760 | sctx->lastlane, NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
4761 | TREE_THIS_NOTRAP (*rvar)((tree_check5 ((*rvar), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4761, __FUNCTION__, (INDIRECT_REF), (MEM_REF), (TARGET_MEM_REF ), (ARRAY_REF), (ARRAY_RANGE_REF)))->base.nothrow_flag) = 1; |
4762 | |
4763 | if (ctx->scan_exclusive) |
4764 | { |
4765 | /* And for exclusive scan yet another one, which will |
4766 | hold the value during the scan phase. */ |
4767 | tree savar = create_tmp_var_raw (atype); |
4768 | if (TREE_ADDRESSABLE (new_var)((new_var)->base.addressable_flag)) |
4769 | TREE_ADDRESSABLE (savar)((savar)->base.addressable_flag) = 1; |
4770 | DECL_ATTRIBUTES (savar)((contains_struct_check ((savar), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4770, __FUNCTION__))->decl_common.attributes) |
4771 | = tree_cons (get_identifier ("omp simd array")(__builtin_constant_p ("omp simd array") ? get_identifier_with_length (("omp simd array"), strlen ("omp simd array")) : get_identifier ("omp simd array")), NULLnullptr, |
4772 | tree_cons (get_identifier ("omp simd inscan "(__builtin_constant_p ("omp simd inscan " "exclusive") ? get_identifier_with_length (("omp simd inscan " "exclusive"), strlen ("omp simd inscan " "exclusive")) : get_identifier ("omp simd inscan " "exclusive" )) |
4773 | "exclusive")(__builtin_constant_p ("omp simd inscan " "exclusive") ? get_identifier_with_length (("omp simd inscan " "exclusive"), strlen ("omp simd inscan " "exclusive")) : get_identifier ("omp simd inscan " "exclusive" )), NULLnullptr, |
4774 | DECL_ATTRIBUTES (savar)((contains_struct_check ((savar), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4774, __FUNCTION__))->decl_common.attributes))); |
4775 | gimple_add_tmp_var (savar); |
4776 | ctx->cb.decl_map->put (iavar, savar); |
4777 | *rvar2 = build4 (ARRAY_REF, TREE_TYPE (new_var)((contains_struct_check ((new_var), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4777, __FUNCTION__))->typed.type), savar, |
4778 | sctx->idx, NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
4779 | TREE_THIS_NOTRAP (*rvar2)((tree_check5 ((*rvar2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4779, __FUNCTION__, (INDIRECT_REF), (MEM_REF), (TARGET_MEM_REF ), (ARRAY_REF), (ARRAY_RANGE_REF)))->base.nothrow_flag) = 1; |
4780 | } |
4781 | } |
4782 | ivar = build4 (ARRAY_REF, TREE_TYPE (new_var)((contains_struct_check ((new_var), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4782, __FUNCTION__))->typed.type), iavar, sctx->idx, |
4783 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
4784 | lvar = build4 (ARRAY_REF, TREE_TYPE (new_var)((contains_struct_check ((new_var), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4784, __FUNCTION__))->typed.type), avar, sctx->lane, |
4785 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
4786 | TREE_THIS_NOTRAP (ivar)((tree_check5 ((ivar), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4786, __FUNCTION__, (INDIRECT_REF), (MEM_REF), (TARGET_MEM_REF ), (ARRAY_REF), (ARRAY_RANGE_REF)))->base.nothrow_flag) = 1; |
4787 | TREE_THIS_NOTRAP (lvar)((tree_check5 ((lvar), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4787, __FUNCTION__, (INDIRECT_REF), (MEM_REF), (TARGET_MEM_REF ), (ARRAY_REF), (ARRAY_RANGE_REF)))->base.nothrow_flag) = 1; |
4788 | } |
4789 | if (DECL_P (new_var)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (new_var)->base.code))] == tcc_declaration)) |
4790 | { |
4791 | SET_DECL_VALUE_EXPR (new_var, lvar)(decl_value_expr_insert ((contains_struct_check ((new_var), ( TS_DECL_WRTL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4791, __FUNCTION__)), lvar)); |
4792 | DECL_HAS_VALUE_EXPR_P (new_var)((tree_check3 ((new_var), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4792, __FUNCTION__, (VAR_DECL), (PARM_DECL), (RESULT_DECL)) ) ->decl_common.decl_flag_2) = 1; |
4793 | } |
4794 | return true; |
4795 | } |
4796 | |
4797 | /* Helper function of lower_rec_input_clauses. For a reference |
4798 | in simd reduction, add an underlying variable it will reference. */ |
4799 | |
4800 | static void |
4801 | handle_simd_reference (location_t loc, tree new_vard, gimple_seq *ilist) |
4802 | { |
4803 | tree z = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (new_vard)))((tree_class_check ((((contains_struct_check ((((contains_struct_check ((new_vard), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4803, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4803, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4803, __FUNCTION__))->type_common.size_unit); |
4804 | if (TREE_CONSTANT (z)((non_type_check ((z), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4804, __FUNCTION__))->base.constant_flag)) |
4805 | { |
4806 | z = create_tmp_var_raw (TREE_TYPE (TREE_TYPE (new_vard))((contains_struct_check ((((contains_struct_check ((new_vard) , (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4806, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4806, __FUNCTION__))->typed.type), |
4807 | get_name (new_vard)); |
4808 | gimple_add_tmp_var (z); |
4809 | TREE_ADDRESSABLE (z)((z)->base.addressable_flag) = 1; |
4810 | z = build_fold_addr_expr_loc (loc, z); |
4811 | gimplify_assign (new_vard, z, ilist); |
4812 | } |
4813 | } |
4814 | |
4815 | /* Helper function for lower_rec_input_clauses. Emit into ilist sequence |
4816 | code to emit (type) (tskred_temp[idx]). */ |
4817 | |
4818 | static tree |
4819 | task_reduction_read (gimple_seq *ilist, tree tskred_temp, tree type, |
4820 | unsigned idx) |
4821 | { |
4822 | unsigned HOST_WIDE_INTlong sz |
4823 | = tree_to_uhwi (TYPE_SIZE_UNIT (pointer_sized_int_node)((tree_class_check ((global_trees[TI_POINTER_SIZED_TYPE]), (tcc_type ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4823, __FUNCTION__))->type_common.size_unit)); |
4824 | tree r = build2 (MEM_REF, pointer_sized_int_nodeglobal_trees[TI_POINTER_SIZED_TYPE], |
4825 | tskred_temp, build_int_cst (TREE_TYPE (tskred_temp)((contains_struct_check ((tskred_temp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4825, __FUNCTION__))->typed.type), |
4826 | idx * sz)); |
4827 | tree v = create_tmp_var (pointer_sized_int_nodeglobal_trees[TI_POINTER_SIZED_TYPE]); |
4828 | gimple *g = gimple_build_assign (v, r); |
4829 | gimple_seq_add_stmt (ilist, g); |
4830 | if (!useless_type_conversion_p (type, pointer_sized_int_nodeglobal_trees[TI_POINTER_SIZED_TYPE])) |
4831 | { |
4832 | v = create_tmp_var (type); |
4833 | g = gimple_build_assign (v, NOP_EXPR, gimple_assign_lhs (g)); |
4834 | gimple_seq_add_stmt (ilist, g); |
4835 | } |
4836 | return v; |
4837 | } |
4838 | |
4839 | /* Lower early initialization of privatized variable NEW_VAR |
4840 | if it needs an allocator (has allocate clause). */ |
4841 | |
4842 | static bool |
4843 | lower_private_allocate (tree var, tree new_var, tree &allocator, |
4844 | tree &allocate_ptr, gimple_seq *ilist, |
4845 | omp_context *ctx, bool is_ref, tree size) |
4846 | { |
4847 | if (allocator) |
4848 | return false; |
4849 | gcc_assert (allocate_ptr == NULL_TREE)((void)(!(allocate_ptr == (tree) nullptr) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4849, __FUNCTION__), 0 : 0)); |
4850 | if (ctx->allocate_map |
4851 | && (DECL_P (new_var)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (new_var)->base.code))] == tcc_declaration) || (TYPE_P (new_var)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (new_var)->base.code))] == tcc_type) && size))) |
4852 | if (tree *allocatorp = ctx->allocate_map->get (var)) |
4853 | allocator = *allocatorp; |
4854 | if (allocator == NULL_TREE(tree) nullptr) |
4855 | return false; |
4856 | if (!is_ref && omp_privatize_by_reference (var)) |
4857 | { |
4858 | allocator = NULL_TREE(tree) nullptr; |
4859 | return false; |
4860 | } |
4861 | |
4862 | unsigned HOST_WIDE_INTlong ialign = 0; |
4863 | if (TREE_CODE (allocator)((enum tree_code) (allocator)->base.code) == TREE_LIST) |
4864 | { |
4865 | ialign = tree_to_uhwi (TREE_VALUE (allocator)((tree_check ((allocator), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4865, __FUNCTION__, (TREE_LIST)))->list.value)); |
4866 | allocator = TREE_PURPOSE (allocator)((tree_check ((allocator), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4866, __FUNCTION__, (TREE_LIST)))->list.purpose); |
4867 | } |
4868 | if (TREE_CODE (allocator)((enum tree_code) (allocator)->base.code) != INTEGER_CST) |
4869 | allocator = build_outer_var_ref (allocator, ctx, OMP_CLAUSE_ALLOCATE); |
4870 | allocator = fold_convert (pointer_sized_int_node, allocator)fold_convert_loc (((location_t) 0), global_trees[TI_POINTER_SIZED_TYPE ], allocator); |
4871 | if (TREE_CODE (allocator)((enum tree_code) (allocator)->base.code) != INTEGER_CST) |
4872 | { |
4873 | tree var = create_tmp_var (TREE_TYPE (allocator)((contains_struct_check ((allocator), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4873, __FUNCTION__))->typed.type)); |
4874 | gimplify_assign (var, allocator, ilist); |
4875 | allocator = var; |
4876 | } |
4877 | |
4878 | tree ptr_type, align, sz = size; |
4879 | if (TYPE_P (new_var)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (new_var)->base.code))] == tcc_type)) |
4880 | { |
4881 | ptr_type = build_pointer_type (new_var); |
4882 | ialign = MAX (ialign, TYPE_ALIGN_UNIT (new_var))((ialign) > (((((tree_class_check ((new_var), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4882, __FUNCTION__))->type_common.align) ? ((unsigned)1) << (((tree_class_check ((new_var), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4882, __FUNCTION__))->type_common.align) - 1) : 0) / (8) )) ? (ialign) : (((((tree_class_check ((new_var), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4882, __FUNCTION__))->type_common.align) ? ((unsigned)1) << (((tree_class_check ((new_var), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4882, __FUNCTION__))->type_common.align) - 1) : 0) / (8) ))); |
4883 | } |
4884 | else if (is_ref) |
4885 | { |
4886 | ptr_type = build_pointer_type (TREE_TYPE (TREE_TYPE (new_var))((contains_struct_check ((((contains_struct_check ((new_var), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4886, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4886, __FUNCTION__))->typed.type)); |
4887 | ialign = MAX (ialign, TYPE_ALIGN_UNIT (TREE_TYPE (ptr_type)))((ialign) > (((((tree_class_check ((((contains_struct_check ((ptr_type), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4887, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4887, __FUNCTION__))->type_common.align) ? ((unsigned)1) << (((tree_class_check ((((contains_struct_check ((ptr_type ), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4887, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4887, __FUNCTION__))->type_common.align) - 1) : 0) / (8) )) ? (ialign) : (((((tree_class_check ((((contains_struct_check ((ptr_type), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4887, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4887, __FUNCTION__))->type_common.align) ? ((unsigned)1) << (((tree_class_check ((((contains_struct_check ((ptr_type ), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4887, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4887, __FUNCTION__))->type_common.align) - 1) : 0) / (8) ))); |
4888 | } |
4889 | else |
4890 | { |
4891 | ptr_type = build_pointer_type (TREE_TYPE (new_var)((contains_struct_check ((new_var), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4891, __FUNCTION__))->typed.type)); |
4892 | ialign = MAX (ialign, DECL_ALIGN_UNIT (new_var))((ialign) > (((((contains_struct_check ((new_var), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4892, __FUNCTION__))->decl_common.align) ? ((unsigned)1) << (((contains_struct_check ((new_var), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4892, __FUNCTION__))->decl_common.align) - 1) : 0) / (8) )) ? (ialign) : (((((contains_struct_check ((new_var), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4892, __FUNCTION__))->decl_common.align) ? ((unsigned)1) << (((contains_struct_check ((new_var), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4892, __FUNCTION__))->decl_common.align) - 1) : 0) / (8) ))); |
4893 | if (sz == NULL_TREE(tree) nullptr) |
4894 | sz = fold_convert (size_type_node, DECL_SIZE_UNIT (new_var))fold_convert_loc (((location_t) 0), global_trees[TI_SIZE_TYPE ], ((contains_struct_check ((new_var), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4894, __FUNCTION__))->decl_common.size_unit)); |
4895 | } |
4896 | align = build_int_cst (size_type_nodeglobal_trees[TI_SIZE_TYPE], ialign); |
4897 | if (TREE_CODE (sz)((enum tree_code) (sz)->base.code) != INTEGER_CST) |
4898 | { |
4899 | tree szvar = create_tmp_var (size_type_nodeglobal_trees[TI_SIZE_TYPE]); |
4900 | gimplify_assign (szvar, sz, ilist); |
4901 | sz = szvar; |
4902 | } |
4903 | allocate_ptr = create_tmp_var (ptr_type); |
4904 | tree a = builtin_decl_explicit (BUILT_IN_GOMP_ALLOC); |
4905 | gimple *g = gimple_build_call (a, 3, align, sz, allocator); |
4906 | gimple_call_set_lhs (g, allocate_ptr); |
4907 | gimple_seq_add_stmt (ilist, g); |
4908 | if (!is_ref) |
4909 | { |
4910 | tree x = build_simple_mem_ref (allocate_ptr)build_simple_mem_ref_loc (((location_t) 0), allocate_ptr); |
4911 | TREE_THIS_NOTRAP (x)((tree_check5 ((x), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4911, __FUNCTION__, (INDIRECT_REF), (MEM_REF), (TARGET_MEM_REF ), (ARRAY_REF), (ARRAY_RANGE_REF)))->base.nothrow_flag) = 1; |
4912 | SET_DECL_VALUE_EXPR (new_var, x)(decl_value_expr_insert ((contains_struct_check ((new_var), ( TS_DECL_WRTL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4912, __FUNCTION__)), x)); |
4913 | DECL_HAS_VALUE_EXPR_P (new_var)((tree_check3 ((new_var), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4913, __FUNCTION__, (VAR_DECL), (PARM_DECL), (RESULT_DECL)) ) ->decl_common.decl_flag_2) = 1; |
4914 | } |
4915 | return true; |
4916 | } |
4917 | |
4918 | /* Generate code to implement the input clauses, FIRSTPRIVATE and COPYIN, |
4919 | from the receiver (aka child) side and initializers for REFERENCE_TYPE |
4920 | private variables. Initialization statements go in ILIST, while calls |
4921 | to destructors go in DLIST. */ |
4922 | |
4923 | static void |
4924 | lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, |
4925 | omp_context *ctx, struct omp_for_data *fd) |
4926 | { |
4927 | tree c, copyin_seq, x, ptr; |
4928 | bool copyin_by_ref = false; |
4929 | bool lastprivate_firstprivate = false; |
4930 | bool reduction_omp_orig_ref = false; |
4931 | int pass; |
4932 | bool is_simd = (gimple_code (ctx->stmt) == GIMPLE_OMP_FOR |
4933 | && gimple_omp_for_kind (ctx->stmt) == GF_OMP_FOR_KIND_SIMD); |
4934 | omplow_simd_context sctx = omplow_simd_context (); |
4935 | tree simt_lane = NULL_TREE(tree) nullptr, simtrec = NULL_TREE(tree) nullptr; |
4936 | tree ivar = NULL_TREE(tree) nullptr, lvar = NULL_TREE(tree) nullptr, uid = NULL_TREE(tree) nullptr; |
4937 | gimple_seq llist[4] = { }; |
4938 | tree nonconst_simd_if = NULL_TREE(tree) nullptr; |
4939 | |
4940 | copyin_seq = NULLnullptr; |
4941 | sctx.is_simt = is_simd && omp_find_clause (clauses, OMP_CLAUSE__SIMT_); |
4942 | |
4943 | /* Set max_vf=1 (which will later enforce safelen=1) in simd loops |
4944 | with data sharing clauses referencing variable sized vars. That |
4945 | is unnecessarily hard to support and very unlikely to result in |
4946 | vectorized code anyway. */ |
4947 | if (is_simd) |
4948 | for (c = clauses; c ; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4948, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4948, __FUNCTION__))->common.chain)) |
4949 | switch (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4949, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code) |
4950 | { |
4951 | case OMP_CLAUSE_LINEAR: |
4952 | if (OMP_CLAUSE_LINEAR_ARRAY (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_LINEAR), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4952, __FUNCTION__))->base.deprecated_flag)) |
4953 | sctx.max_vf = 1; |
4954 | /* FALLTHRU */ |
4955 | case OMP_CLAUSE_PRIVATE: |
4956 | case OMP_CLAUSE_FIRSTPRIVATE: |
4957 | case OMP_CLAUSE_LASTPRIVATE: |
4958 | if (is_variable_sized (OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4958, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4958, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4958, __FUNCTION__))))) |
4959 | sctx.max_vf = 1; |
4960 | else if (omp_privatize_by_reference (OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4960, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4960, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4960, __FUNCTION__))))) |
4961 | { |
4962 | tree rtype = TREE_TYPE (TREE_TYPE (OMP_CLAUSE_DECL (c)))((contains_struct_check ((((contains_struct_check (((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4962, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4962, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4962, __FUNCTION__)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4962, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4962, __FUNCTION__))->typed.type); |
4963 | if (!TREE_CONSTANT (TYPE_SIZE_UNIT (rtype))((non_type_check ((((tree_class_check ((rtype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4963, __FUNCTION__))->type_common.size_unit)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4963, __FUNCTION__))->base.constant_flag)) |
4964 | sctx.max_vf = 1; |
4965 | } |
4966 | break; |
4967 | case OMP_CLAUSE_REDUCTION: |
4968 | case OMP_CLAUSE_IN_REDUCTION: |
4969 | if (TREE_CODE (OMP_CLAUSE_DECL (c))((enum tree_code) ((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4969, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4969, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4969, __FUNCTION__))))->base.code) == MEM_REF |
4970 | || is_variable_sized (OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4970, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4970, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4970, __FUNCTION__))))) |
4971 | sctx.max_vf = 1; |
4972 | else if (omp_privatize_by_reference (OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4972, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4972, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4972, __FUNCTION__))))) |
4973 | { |
4974 | tree rtype = TREE_TYPE (TREE_TYPE (OMP_CLAUSE_DECL (c)))((contains_struct_check ((((contains_struct_check (((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4974, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4974, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4974, __FUNCTION__)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4974, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4974, __FUNCTION__))->typed.type); |
4975 | if (!TREE_CONSTANT (TYPE_SIZE_UNIT (rtype))((non_type_check ((((tree_class_check ((rtype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4975, __FUNCTION__))->type_common.size_unit)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4975, __FUNCTION__))->base.constant_flag)) |
4976 | sctx.max_vf = 1; |
4977 | } |
4978 | break; |
4979 | case OMP_CLAUSE_IF: |
4980 | if (integer_zerop (OMP_CLAUSE_IF_EXPR (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_IF ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4980, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4980, __FUNCTION__))))) |
4981 | sctx.max_vf = 1; |
4982 | else if (TREE_CODE (OMP_CLAUSE_IF_EXPR (c))((enum tree_code) ((*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_IF), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4982, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4982, __FUNCTION__))))->base.code) != INTEGER_CST) |
4983 | nonconst_simd_if = OMP_CLAUSE_IF_EXPR (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_IF ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4983, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4983, __FUNCTION__))); |
4984 | break; |
4985 | case OMP_CLAUSE_SIMDLEN: |
4986 | if (integer_onep (OMP_CLAUSE_SIMDLEN_EXPR (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_SIMDLEN ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4986, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 4986, __FUNCTION__))))) |
4987 | sctx.max_vf = 1; |
4988 | break; |
4989 | case OMP_CLAUSE__CONDTEMP_: |
4990 | /* FIXME: lastprivate(conditional:) not handled for SIMT yet. */ |
4991 | if (sctx.is_simt) |
4992 | sctx.max_vf = 1; |
4993 | break; |
4994 | default: |
4995 | continue; |
4996 | } |
4997 | |
4998 | /* Add a placeholder for simduid. */ |
4999 | if (sctx.is_simt && maybe_ne (sctx.max_vf, 1U)) |
5000 | sctx.simt_eargs.safe_push (NULL_TREE(tree) nullptr); |
5001 | |
5002 | unsigned task_reduction_cnt = 0; |
5003 | unsigned task_reduction_cntorig = 0; |
5004 | unsigned task_reduction_cnt_full = 0; |
5005 | unsigned task_reduction_cntorig_full = 0; |
5006 | unsigned task_reduction_other_cnt = 0; |
5007 | tree tskred_atype = NULL_TREE(tree) nullptr, tskred_avar = NULL_TREE(tree) nullptr; |
5008 | tree tskred_base = NULL_TREE(tree) nullptr, tskred_temp = NULL_TREE(tree) nullptr; |
5009 | /* Do all the fixed sized types in the first pass, and the variable sized |
5010 | types in the second pass. This makes sure that the scalar arguments to |
5011 | the variable sized types are processed before we use them in the |
5012 | variable sized operations. For task reductions we use 4 passes, in the |
5013 | first two we ignore them, in the third one gather arguments for |
5014 | GOMP_task_reduction_remap call and in the last pass actually handle |
5015 | the task reductions. */ |
5016 | for (pass = 0; pass < ((task_reduction_cnt || task_reduction_other_cnt) |
5017 | ? 4 : 2); ++pass) |
5018 | { |
5019 | if (pass == 2 && task_reduction_cnt) |
5020 | { |
5021 | tskred_atype |
5022 | = build_array_type_nelts (ptr_type_nodeglobal_trees[TI_PTR_TYPE], task_reduction_cnt |
5023 | + task_reduction_cntorig); |
5024 | tskred_avar = create_tmp_var_raw (tskred_atype); |
5025 | gimple_add_tmp_var (tskred_avar); |
5026 | TREE_ADDRESSABLE (tskred_avar)((tskred_avar)->base.addressable_flag) = 1; |
5027 | task_reduction_cnt_full = task_reduction_cnt; |
5028 | task_reduction_cntorig_full = task_reduction_cntorig; |
5029 | } |
5030 | else if (pass == 3 && task_reduction_cnt) |
5031 | { |
5032 | x = builtin_decl_explicit (BUILT_IN_GOMP_TASK_REDUCTION_REMAP); |
5033 | gimple *g |
5034 | = gimple_build_call (x, 3, size_int (task_reduction_cnt)size_int_kind (task_reduction_cnt, stk_sizetype), |
5035 | size_int (task_reduction_cntorig)size_int_kind (task_reduction_cntorig, stk_sizetype), |
5036 | build_fold_addr_expr (tskred_avar)build_fold_addr_expr_loc (((location_t) 0), (tskred_avar))); |
5037 | gimple_seq_add_stmt (ilist, g); |
5038 | } |
5039 | if (pass == 3 && task_reduction_other_cnt) |
5040 | { |
5041 | /* For reduction clauses, build |
5042 | tskred_base = (void *) tskred_temp[2] |
5043 | + omp_get_thread_num () * tskred_temp[1] |
5044 | or if tskred_temp[1] is known to be constant, that constant |
5045 | directly. This is the start of the private reduction copy block |
5046 | for the current thread. */ |
5047 | tree v = create_tmp_var (integer_type_nodeinteger_types[itk_int]); |
5048 | x = builtin_decl_explicit (BUILT_IN_OMP_GET_THREAD_NUM); |
5049 | gimple *g = gimple_build_call (x, 0); |
5050 | gimple_call_set_lhs (g, v); |
5051 | gimple_seq_add_stmt (ilist, g); |
5052 | c = omp_find_clause (clauses, OMP_CLAUSE__REDUCTEMP_); |
5053 | tskred_temp = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 5053, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 5053, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-low.cc" , 5053, __FUNCTION__))); |
5054 | if (is_taskreg_ctx (ctx)) |
5055 | tskred_temp = lookup_decl (tskred_temp, ctx); |
5056 | tree v2 = create_tmp_var (sizetypesizetype_tab[(int) stk_sizetype]); |
5057 | g = gimple_build_assign (v2, NOP_EXPR, v); |
5058 | gimple_seq_add_stmt (ilist, g); |
5059 | if (ctx->task_reductions[0]) |
5060 | v = fold_convert (sizetype, ctx->task_reductions[0])fold_convert_loc (((location_t) 0), sizetype_tab[(int) stk_sizetype ], ctx->task_reductions[0]); |
5061 |