File: | build/gcc/c-family/c-omp.cc |
Warning: | line 59, column 3 Called C++ object pointer is null |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* This file contains routines to construct OpenACC and OpenMP constructs, | |||
2 | called from parsing in the C and C++ front ends. | |||
3 | ||||
4 | Copyright (C) 2005-2023 Free Software Foundation, Inc. | |||
5 | Contributed by Richard Henderson <rth@redhat.com>, | |||
6 | Diego Novillo <dnovillo@redhat.com>. | |||
7 | ||||
8 | This file is part of GCC. | |||
9 | ||||
10 | GCC is free software; you can redistribute it and/or modify it under | |||
11 | the terms of the GNU General Public License as published by the Free | |||
12 | Software Foundation; either version 3, or (at your option) any later | |||
13 | version. | |||
14 | ||||
15 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |||
16 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
17 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
18 | for more details. | |||
19 | ||||
20 | You should have received a copy of the GNU General Public License | |||
21 | along with GCC; see the file COPYING3. If not see | |||
22 | <http://www.gnu.org/licenses/>. */ | |||
23 | ||||
24 | #include "config.h" | |||
25 | #include "system.h" | |||
26 | #include "coretypes.h" | |||
27 | #include "options.h" | |||
28 | #include "c-common.h" | |||
29 | #include "gimple-expr.h" | |||
30 | #include "c-pragma.h" | |||
31 | #include "stringpool.h" | |||
32 | #include "omp-general.h" | |||
33 | #include "gomp-constants.h" | |||
34 | #include "memmodel.h" | |||
35 | #include "attribs.h" | |||
36 | #include "gimplify.h" | |||
37 | #include "langhooks.h" | |||
38 | #include "bitmap.h" | |||
39 | ||||
40 | ||||
41 | /* Complete a #pragma oacc wait construct. LOC is the location of | |||
42 | the #pragma. */ | |||
43 | ||||
44 | tree | |||
45 | c_finish_oacc_wait (location_t loc, tree parms, tree clauses) | |||
46 | { | |||
47 | const int nparms = list_length (parms); | |||
48 | tree stmt, t; | |||
49 | vec<tree, va_gc> *args; | |||
50 | ||||
51 | vec_alloc (args, nparms + 2); | |||
| ||||
52 | stmt = builtin_decl_explicit (BUILT_IN_GOACC_WAIT); | |||
53 | ||||
54 | if (omp_find_clause (clauses, OMP_CLAUSE_ASYNC)) | |||
55 | t = OMP_CLAUSE_ASYNC_EXPR (clauses)(*(omp_clause_elt_check (((omp_clause_subcode_check ((clauses ), (OMP_CLAUSE_ASYNC), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 55, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 55, __FUNCTION__))); | |||
56 | else | |||
57 | t = build_int_cst (integer_type_nodeinteger_types[itk_int], GOMP_ASYNC_SYNC-2); | |||
58 | ||||
59 | args->quick_push (t); | |||
| ||||
60 | args->quick_push (build_int_cst (integer_type_nodeinteger_types[itk_int], nparms)); | |||
61 | ||||
62 | for (t = parms; t; t = TREE_CHAIN (t)((contains_struct_check ((t), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 62, __FUNCTION__))->common.chain)) | |||
63 | { | |||
64 | if (TREE_CODE (OMP_CLAUSE_WAIT_EXPR (t))((enum tree_code) ((*(omp_clause_elt_check (((omp_clause_subcode_check ((t), (OMP_CLAUSE_WAIT), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 64, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 64, __FUNCTION__))))->base.code) == INTEGER_CST) | |||
65 | args->quick_push (build_int_cst (integer_type_nodeinteger_types[itk_int], | |||
66 | TREE_INT_CST_LOW (OMP_CLAUSE_WAIT_EXPR (t))((unsigned long) (*tree_int_cst_elt_check (((*(omp_clause_elt_check (((omp_clause_subcode_check ((t), (OMP_CLAUSE_WAIT), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 66, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 66, __FUNCTION__)))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 66, __FUNCTION__))))); | |||
67 | else | |||
68 | args->quick_push (OMP_CLAUSE_WAIT_EXPR (t)(*(omp_clause_elt_check (((omp_clause_subcode_check ((t), (OMP_CLAUSE_WAIT ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 68, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 68, __FUNCTION__)))); | |||
69 | } | |||
70 | ||||
71 | stmt = build_call_expr_loc_vec (loc, stmt, args); | |||
72 | ||||
73 | vec_free (args); | |||
74 | ||||
75 | return stmt; | |||
76 | } | |||
77 | ||||
78 | /* Complete a #pragma omp master construct. STMT is the structured-block | |||
79 | that follows the pragma. LOC is the location of the #pragma. */ | |||
80 | ||||
81 | tree | |||
82 | c_finish_omp_master (location_t loc, tree stmt) | |||
83 | { | |||
84 | tree t = add_stmt (build1 (OMP_MASTER, void_type_nodeglobal_trees[TI_VOID_TYPE], stmt)); | |||
85 | SET_EXPR_LOCATION (t, loc)(expr_check (((t)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 85, __FUNCTION__))->exp.locus = (loc); | |||
86 | return t; | |||
87 | } | |||
88 | ||||
89 | /* Complete a #pragma omp masked construct. BODY is the structured-block | |||
90 | that follows the pragma. LOC is the location of the #pragma. */ | |||
91 | ||||
92 | tree | |||
93 | c_finish_omp_masked (location_t loc, tree body, tree clauses) | |||
94 | { | |||
95 | tree stmt = make_node (OMP_MASKED); | |||
96 | TREE_TYPE (stmt)((contains_struct_check ((stmt), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 96, __FUNCTION__))->typed.type) = void_type_nodeglobal_trees[TI_VOID_TYPE]; | |||
97 | OMP_MASKED_BODY (stmt)(*((const_cast<tree*> (tree_operand_check (((tree_check ((stmt), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 97, __FUNCTION__, (OMP_MASKED)))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 97, __FUNCTION__))))) = body; | |||
98 | OMP_MASKED_CLAUSES (stmt)(*((const_cast<tree*> (tree_operand_check (((tree_check ((stmt), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 98, __FUNCTION__, (OMP_MASKED)))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 98, __FUNCTION__))))) = clauses; | |||
99 | SET_EXPR_LOCATION (stmt, loc)(expr_check (((stmt)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 99, __FUNCTION__))->exp.locus = (loc); | |||
100 | return add_stmt (stmt); | |||
101 | } | |||
102 | ||||
103 | /* Complete a #pragma omp taskgroup construct. BODY is the structured-block | |||
104 | that follows the pragma. LOC is the location of the #pragma. */ | |||
105 | ||||
106 | tree | |||
107 | c_finish_omp_taskgroup (location_t loc, tree body, tree clauses) | |||
108 | { | |||
109 | tree stmt = make_node (OMP_TASKGROUP); | |||
110 | TREE_TYPE (stmt)((contains_struct_check ((stmt), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 110, __FUNCTION__))->typed.type) = void_type_nodeglobal_trees[TI_VOID_TYPE]; | |||
111 | OMP_TASKGROUP_BODY (stmt)(*((const_cast<tree*> (tree_operand_check (((tree_check ((stmt), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 111, __FUNCTION__, (OMP_TASKGROUP)))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 111, __FUNCTION__))))) = body; | |||
112 | OMP_TASKGROUP_CLAUSES (stmt)(*((const_cast<tree*> (tree_operand_check (((tree_check ((stmt), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 112, __FUNCTION__, (OMP_TASKGROUP)))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 112, __FUNCTION__))))) = clauses; | |||
113 | SET_EXPR_LOCATION (stmt, loc)(expr_check (((stmt)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 113, __FUNCTION__))->exp.locus = (loc); | |||
114 | return add_stmt (stmt); | |||
115 | } | |||
116 | ||||
117 | /* Complete a #pragma omp critical construct. BODY is the structured-block | |||
118 | that follows the pragma, NAME is the identifier in the pragma, or null | |||
119 | if it was omitted. LOC is the location of the #pragma. */ | |||
120 | ||||
121 | tree | |||
122 | c_finish_omp_critical (location_t loc, tree body, tree name, tree clauses) | |||
123 | { | |||
124 | gcc_assert (!clauses || OMP_CLAUSE_CODE (clauses) == OMP_CLAUSE_HINT)((void)(!(!clauses || ((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 124, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_HINT ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 124, __FUNCTION__), 0 : 0)); | |||
125 | if (name == NULL_TREE(tree) nullptr | |||
126 | && clauses != NULL_TREE(tree) nullptr | |||
127 | && integer_nonzerop (OMP_CLAUSE_HINT_EXPR (clauses)(*(omp_clause_elt_check (((omp_clause_subcode_check ((clauses ), (OMP_CLAUSE_HINT), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 127, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 127, __FUNCTION__))))) | |||
128 | { | |||
129 | error_at (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 129, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
130 | "%<#pragma omp critical%> with %<hint%> clause requires " | |||
131 | "a name, except when %<omp_sync_hint_none%> is used"); | |||
132 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
133 | } | |||
134 | ||||
135 | tree stmt = make_node (OMP_CRITICAL); | |||
136 | TREE_TYPE (stmt)((contains_struct_check ((stmt), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 136, __FUNCTION__))->typed.type) = void_type_nodeglobal_trees[TI_VOID_TYPE]; | |||
137 | OMP_CRITICAL_BODY (stmt)(*((const_cast<tree*> (tree_operand_check (((tree_check ((stmt), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 137, __FUNCTION__, (OMP_CRITICAL)))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 137, __FUNCTION__))))) = body; | |||
138 | OMP_CRITICAL_NAME (stmt)(*((const_cast<tree*> (tree_operand_check (((tree_check ((stmt), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 138, __FUNCTION__, (OMP_CRITICAL)))), (2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 138, __FUNCTION__))))) = name; | |||
139 | OMP_CRITICAL_CLAUSES (stmt)(*((const_cast<tree*> (tree_operand_check (((tree_check ((stmt), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 139, __FUNCTION__, (OMP_CRITICAL)))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 139, __FUNCTION__))))) = clauses; | |||
140 | SET_EXPR_LOCATION (stmt, loc)(expr_check (((stmt)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 140, __FUNCTION__))->exp.locus = (loc); | |||
141 | return add_stmt (stmt); | |||
142 | } | |||
143 | ||||
144 | /* Complete a #pragma omp ordered construct. STMT is the structured-block | |||
145 | that follows the pragma. LOC is the location of the #pragma. */ | |||
146 | ||||
147 | tree | |||
148 | c_finish_omp_ordered (location_t loc, tree clauses, tree stmt) | |||
149 | { | |||
150 | tree t = make_node (OMP_ORDERED); | |||
151 | TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 151, __FUNCTION__))->typed.type) = void_type_nodeglobal_trees[TI_VOID_TYPE]; | |||
152 | OMP_ORDERED_BODY (t)(*((const_cast<tree*> (tree_operand_check (((tree_check ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 152, __FUNCTION__, (OMP_ORDERED)))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 152, __FUNCTION__))))) = stmt; | |||
153 | if (!flag_openmpglobal_options.x_flag_openmp /* flag_openmp_simd */ | |||
154 | && (OMP_CLAUSE_CODE (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 154, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code != OMP_CLAUSE_SIMD | |||
155 | || OMP_CLAUSE_CHAIN (clauses)((contains_struct_check (((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 155, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 155, __FUNCTION__))->common.chain))) | |||
156 | clauses = build_omp_clause (loc, OMP_CLAUSE_SIMD); | |||
157 | OMP_ORDERED_CLAUSES (t)(*((const_cast<tree*> (tree_operand_check (((tree_check ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 157, __FUNCTION__, (OMP_ORDERED)))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 157, __FUNCTION__))))) = clauses; | |||
158 | SET_EXPR_LOCATION (t, loc)(expr_check (((t)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 158, __FUNCTION__))->exp.locus = (loc); | |||
159 | return add_stmt (t); | |||
160 | } | |||
161 | ||||
162 | ||||
163 | /* Complete a #pragma omp barrier construct. LOC is the location of | |||
164 | the #pragma. */ | |||
165 | ||||
166 | void | |||
167 | c_finish_omp_barrier (location_t loc) | |||
168 | { | |||
169 | tree x; | |||
170 | ||||
171 | x = builtin_decl_explicit (BUILT_IN_GOMP_BARRIER); | |||
172 | x = build_call_expr_loc (loc, x, 0); | |||
173 | add_stmt (x); | |||
174 | } | |||
175 | ||||
176 | ||||
177 | /* Complete a #pragma omp taskwait construct. LOC is the location of the | |||
178 | pragma. */ | |||
179 | ||||
180 | void | |||
181 | c_finish_omp_taskwait (location_t loc) | |||
182 | { | |||
183 | tree x; | |||
184 | ||||
185 | x = builtin_decl_explicit (BUILT_IN_GOMP_TASKWAIT); | |||
186 | x = build_call_expr_loc (loc, x, 0); | |||
187 | add_stmt (x); | |||
188 | } | |||
189 | ||||
190 | ||||
191 | /* Complete a #pragma omp taskyield construct. LOC is the location of the | |||
192 | pragma. */ | |||
193 | ||||
194 | void | |||
195 | c_finish_omp_taskyield (location_t loc) | |||
196 | { | |||
197 | tree x; | |||
198 | ||||
199 | x = builtin_decl_explicit (BUILT_IN_GOMP_TASKYIELD); | |||
200 | x = build_call_expr_loc (loc, x, 0); | |||
201 | add_stmt (x); | |||
202 | } | |||
203 | ||||
204 | ||||
205 | /* Complete a #pragma omp atomic construct. For CODE OMP_ATOMIC | |||
206 | the expression to be implemented atomically is LHS opcode= RHS. | |||
207 | For OMP_ATOMIC_READ V = LHS, for OMP_ATOMIC_CAPTURE_{NEW,OLD} LHS | |||
208 | opcode= RHS with the new or old content of LHS returned. | |||
209 | LOC is the location of the atomic statement. The value returned | |||
210 | is either error_mark_node (if the construct was erroneous) or an | |||
211 | OMP_ATOMIC* node which should be added to the current statement | |||
212 | tree with add_stmt. If TEST is set, avoid calling save_expr | |||
213 | or create_tmp_var*. */ | |||
214 | ||||
215 | tree | |||
216 | c_finish_omp_atomic (location_t loc, enum tree_code code, | |||
217 | enum tree_code opcode, tree lhs, tree rhs, | |||
218 | tree v, tree lhs1, tree rhs1, tree r, bool swapped, | |||
219 | enum omp_memory_order memory_order, bool weak, | |||
220 | bool test) | |||
221 | { | |||
222 | tree x, type, addr, pre = NULL_TREE(tree) nullptr, rtmp = NULL_TREE(tree) nullptr, vtmp = NULL_TREE(tree) nullptr; | |||
223 | HOST_WIDE_INTlong bitpos = 0, bitsize = 0; | |||
224 | enum tree_code orig_opcode = opcode; | |||
225 | ||||
226 | if (lhs == error_mark_nodeglobal_trees[TI_ERROR_MARK] || rhs == error_mark_nodeglobal_trees[TI_ERROR_MARK] | |||
227 | || v == error_mark_nodeglobal_trees[TI_ERROR_MARK] || lhs1 == error_mark_nodeglobal_trees[TI_ERROR_MARK] | |||
228 | || rhs1 == error_mark_nodeglobal_trees[TI_ERROR_MARK] || r == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
229 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
230 | ||||
231 | /* ??? According to one reading of the OpenMP spec, complex type are | |||
232 | supported, but there are no atomic stores for any architecture. | |||
233 | But at least icc 9.0 doesn't support complex types here either. | |||
234 | And lets not even talk about vector types... */ | |||
235 | type = TREE_TYPE (lhs)((contains_struct_check ((lhs), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 235, __FUNCTION__))->typed.type); | |||
236 | if (!INTEGRAL_TYPE_P (type)(((enum tree_code) (type)->base.code) == ENUMERAL_TYPE || ( (enum tree_code) (type)->base.code) == BOOLEAN_TYPE || ((enum tree_code) (type)->base.code) == INTEGER_TYPE) | |||
237 | && !POINTER_TYPE_P (type)(((enum tree_code) (type)->base.code) == POINTER_TYPE || ( (enum tree_code) (type)->base.code) == REFERENCE_TYPE) | |||
238 | && !SCALAR_FLOAT_TYPE_P (type)(((enum tree_code) (type)->base.code) == REAL_TYPE)) | |||
239 | { | |||
240 | error_at (loc, "invalid expression type for %<#pragma omp atomic%>"); | |||
241 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
242 | } | |||
243 | if (TYPE_ATOMIC (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 243, __FUNCTION__))->base.u.bits.atomic_flag)) | |||
244 | { | |||
245 | error_at (loc, "%<_Atomic%> expression in %<#pragma omp atomic%>"); | |||
246 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
247 | } | |||
248 | if (r && r != void_list_nodeglobal_trees[TI_VOID_LIST_NODE] && !INTEGRAL_TYPE_P (TREE_TYPE (r))(((enum tree_code) (((contains_struct_check ((r), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 248, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE || ((enum tree_code) (((contains_struct_check ((r), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 248, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE || ((enum tree_code) (((contains_struct_check ((r), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 248, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE )) | |||
249 | { | |||
250 | error_at (loc, "%<#pragma omp atomic compare capture%> with non-integral " | |||
251 | "comparison result"); | |||
252 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
253 | } | |||
254 | ||||
255 | if (opcode == RDIV_EXPR) | |||
256 | opcode = TRUNC_DIV_EXPR; | |||
257 | ||||
258 | /* ??? Validate that rhs does not overlap lhs. */ | |||
259 | tree blhs = NULLnullptr; | |||
260 | if (TREE_CODE (lhs)((enum tree_code) (lhs)->base.code) == COMPONENT_REF | |||
261 | && TREE_CODE (TREE_OPERAND (lhs, 1))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check ((lhs), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 261, __FUNCTION__))))))->base.code) == FIELD_DECL | |||
262 | && DECL_C_BIT_FIELD (TREE_OPERAND (lhs, 1))(((contains_struct_check (((tree_check (((*((const_cast<tree *> (tree_operand_check ((lhs), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 262, __FUNCTION__)))))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 262, __FUNCTION__, (FIELD_DECL)))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 262, __FUNCTION__))->decl_common.lang_flag_4) == 1) | |||
263 | && DECL_BIT_FIELD_REPRESENTATIVE (TREE_OPERAND (lhs, 1))((tree_check (((*((const_cast<tree*> (tree_operand_check ((lhs), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 263, __FUNCTION__)))))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 263, __FUNCTION__, (FIELD_DECL)))->field_decl.qualifier)) | |||
264 | { | |||
265 | tree field = TREE_OPERAND (lhs, 1)(*((const_cast<tree*> (tree_operand_check ((lhs), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 265, __FUNCTION__))))); | |||
266 | tree repr = DECL_BIT_FIELD_REPRESENTATIVE (field)((tree_check ((field), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 266, __FUNCTION__, (FIELD_DECL)))->field_decl.qualifier); | |||
267 | if (tree_fits_uhwi_p (DECL_FIELD_OFFSET (field)((tree_check ((field), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 267, __FUNCTION__, (FIELD_DECL)))->field_decl.offset)) | |||
268 | && tree_fits_uhwi_p (DECL_FIELD_OFFSET (repr)((tree_check ((repr), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 268, __FUNCTION__, (FIELD_DECL)))->field_decl.offset))) | |||
269 | bitpos = (tree_to_uhwi (DECL_FIELD_OFFSET (field)((tree_check ((field), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 269, __FUNCTION__, (FIELD_DECL)))->field_decl.offset)) | |||
270 | - tree_to_uhwi (DECL_FIELD_OFFSET (repr)((tree_check ((repr), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 270, __FUNCTION__, (FIELD_DECL)))->field_decl.offset))) * BITS_PER_UNIT(8); | |||
271 | else | |||
272 | bitpos = 0; | |||
273 | bitpos += (tree_to_uhwi (DECL_FIELD_BIT_OFFSET (field)((tree_check ((field), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 273, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_offset )) | |||
274 | - tree_to_uhwi (DECL_FIELD_BIT_OFFSET (repr)((tree_check ((repr), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 274, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_offset ))); | |||
275 | gcc_assert (tree_fits_shwi_p (DECL_SIZE (field)))((void)(!(tree_fits_shwi_p (((contains_struct_check ((field), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 275, __FUNCTION__))->decl_common.size))) ? fancy_abort ( "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 275, __FUNCTION__), 0 : 0)); | |||
276 | bitsize = tree_to_shwi (DECL_SIZE (field)((contains_struct_check ((field), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 276, __FUNCTION__))->decl_common.size)); | |||
277 | blhs = lhs; | |||
278 | type = TREE_TYPE (repr)((contains_struct_check ((repr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 278, __FUNCTION__))->typed.type); | |||
279 | lhs = build3 (COMPONENT_REF, TREE_TYPE (repr)((contains_struct_check ((repr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 279, __FUNCTION__))->typed.type), TREE_OPERAND (lhs, 0)(*((const_cast<tree*> (tree_operand_check ((lhs), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 279, __FUNCTION__))))), | |||
280 | repr, TREE_OPERAND (lhs, 2)(*((const_cast<tree*> (tree_operand_check ((lhs), (2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 280, __FUNCTION__)))))); | |||
281 | } | |||
282 | ||||
283 | /* Take and save the address of the lhs. From then on we'll reference it | |||
284 | via indirection. */ | |||
285 | addr = build_unary_op (loc, ADDR_EXPR, lhs, false); | |||
286 | if (addr == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
287 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
288 | if (!test) | |||
289 | addr = save_expr (addr); | |||
290 | if (!test | |||
291 | && TREE_CODE (addr)((enum tree_code) (addr)->base.code) != SAVE_EXPR | |||
292 | && (TREE_CODE (addr)((enum tree_code) (addr)->base.code) != ADDR_EXPR | |||
293 | || !VAR_P (TREE_OPERAND (addr, 0))(((enum tree_code) ((*((const_cast<tree*> (tree_operand_check ((addr), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 293, __FUNCTION__))))))->base.code) == VAR_DECL))) | |||
294 | { | |||
295 | /* Make sure LHS is simple enough so that goa_lhs_expr_p can recognize | |||
296 | it even after unsharing function body. */ | |||
297 | tree var = create_tmp_var_raw (TREE_TYPE (addr)((contains_struct_check ((addr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 297, __FUNCTION__))->typed.type)); | |||
298 | DECL_CONTEXT (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 298, __FUNCTION__))->decl_minimal.context) = current_function_decl; | |||
299 | addr = build4 (TARGET_EXPR, TREE_TYPE (addr)((contains_struct_check ((addr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 299, __FUNCTION__))->typed.type), var, addr, NULLnullptr, NULLnullptr); | |||
300 | } | |||
301 | tree orig_lhs = lhs; | |||
302 | lhs = build_indirect_ref (loc, addr, RO_NULL); | |||
303 | tree new_lhs = lhs; | |||
304 | ||||
305 | if (code == OMP_ATOMIC_READ) | |||
306 | { | |||
307 | x = build1 (OMP_ATOMIC_READ, type, addr); | |||
308 | SET_EXPR_LOCATION (x, loc)(expr_check (((x)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 308, __FUNCTION__))->exp.locus = (loc); | |||
309 | OMP_ATOMIC_MEMORY_ORDER (x)((tree_range_check ((x), (OMP_ATOMIC), (OMP_ATOMIC_CAPTURE_NEW ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 309, __FUNCTION__))->base.u.omp_atomic_memory_order) = memory_order; | |||
310 | gcc_assert (!weak)((void)(!(!weak) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 310, __FUNCTION__), 0 : 0)); | |||
311 | if (blhs) | |||
312 | x = build3_loc (loc, BIT_FIELD_REF, TREE_TYPE (blhs)((contains_struct_check ((blhs), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 312, __FUNCTION__))->typed.type), x, | |||
313 | bitsize_int (bitsize)size_int_kind (bitsize, stk_bitsizetype), bitsize_int (bitpos)size_int_kind (bitpos, stk_bitsizetype)); | |||
314 | return build_modify_expr (loc, v, NULL_TREE(tree) nullptr, NOP_EXPR, | |||
315 | loc, x, NULL_TREE(tree) nullptr); | |||
316 | } | |||
317 | ||||
318 | /* There are lots of warnings, errors, and conversions that need to happen | |||
319 | in the course of interpreting a statement. Use the normal mechanisms | |||
320 | to do this, and then take it apart again. */ | |||
321 | if (blhs) | |||
322 | { | |||
323 | lhs = build3_loc (loc, BIT_FIELD_REF, TREE_TYPE (blhs)((contains_struct_check ((blhs), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 323, __FUNCTION__))->typed.type), lhs, | |||
324 | bitsize_int (bitsize)size_int_kind (bitsize, stk_bitsizetype), bitsize_int (bitpos)size_int_kind (bitpos, stk_bitsizetype)); | |||
325 | if (opcode == COND_EXPR) | |||
326 | { | |||
327 | bool save = in_late_binary_op; | |||
328 | in_late_binary_op = true; | |||
329 | std::swap (rhs, rhs1); | |||
330 | rhs1 = build_binary_op (loc, EQ_EXPR, lhs, rhs1, true); | |||
331 | in_late_binary_op = save; | |||
332 | } | |||
333 | else if (swapped) | |||
334 | rhs = build_binary_op (loc, opcode, rhs, lhs, true); | |||
335 | else if (opcode != NOP_EXPR) | |||
336 | rhs = build_binary_op (loc, opcode, lhs, rhs, true); | |||
337 | opcode = NOP_EXPR; | |||
338 | } | |||
339 | else if (opcode == COND_EXPR) | |||
340 | { | |||
341 | bool save = in_late_binary_op; | |||
342 | in_late_binary_op = true; | |||
343 | std::swap (rhs, rhs1); | |||
344 | rhs1 = build_binary_op (loc, EQ_EXPR, lhs, rhs1, true); | |||
345 | in_late_binary_op = save; | |||
346 | opcode = NOP_EXPR; | |||
347 | } | |||
348 | else if (swapped) | |||
349 | { | |||
350 | rhs = build_binary_op (loc, opcode, rhs, lhs, true); | |||
351 | opcode = NOP_EXPR; | |||
352 | } | |||
353 | bool save = in_late_binary_op; | |||
354 | in_late_binary_op = true; | |||
355 | if ((opcode == MIN_EXPR || opcode == MAX_EXPR) | |||
356 | && build_binary_op (loc, LT_EXPR, blhs ? blhs : lhs, rhs, | |||
357 | true) == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
358 | x = error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
359 | else | |||
360 | x = build_modify_expr (loc, blhs ? blhs : lhs, NULL_TREE(tree) nullptr, opcode, | |||
361 | loc, rhs, NULL_TREE(tree) nullptr); | |||
362 | in_late_binary_op = save; | |||
363 | if (x == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
364 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
365 | if (TREE_CODE (x)((enum tree_code) (x)->base.code) == COMPOUND_EXPR) | |||
366 | { | |||
367 | pre = TREE_OPERAND (x, 0)(*((const_cast<tree*> (tree_operand_check ((x), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 367, __FUNCTION__))))); | |||
368 | gcc_assert (TREE_CODE (pre) == SAVE_EXPR || tree_invariant_p (pre))((void)(!(((enum tree_code) (pre)->base.code) == SAVE_EXPR || tree_invariant_p (pre)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 368, __FUNCTION__), 0 : 0)); | |||
369 | x = TREE_OPERAND (x, 1)(*((const_cast<tree*> (tree_operand_check ((x), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 369, __FUNCTION__))))); | |||
370 | } | |||
371 | gcc_assert (TREE_CODE (x) == MODIFY_EXPR)((void)(!(((enum tree_code) (x)->base.code) == MODIFY_EXPR ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 371, __FUNCTION__), 0 : 0)); | |||
372 | rhs = TREE_OPERAND (x, 1)(*((const_cast<tree*> (tree_operand_check ((x), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 372, __FUNCTION__))))); | |||
373 | ||||
374 | if (blhs) | |||
375 | rhs = build3_loc (loc, BIT_INSERT_EXPR, type, new_lhs, | |||
376 | rhs, bitsize_int (bitpos)size_int_kind (bitpos, stk_bitsizetype)); | |||
377 | if (orig_opcode == COND_EXPR) | |||
378 | { | |||
379 | if (error_operand_p (rhs1)) | |||
380 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
381 | gcc_assert (TREE_CODE (rhs1) == EQ_EXPR)((void)(!(((enum tree_code) (rhs1)->base.code) == EQ_EXPR) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 381, __FUNCTION__), 0 : 0)); | |||
382 | tree cmptype = TREE_TYPE (TREE_OPERAND (rhs1, 0))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((rhs1), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 382, __FUNCTION__)))))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 382, __FUNCTION__))->typed.type); | |||
383 | if (SCALAR_FLOAT_TYPE_P (cmptype)(((enum tree_code) (cmptype)->base.code) == REAL_TYPE) && !test) | |||
384 | { | |||
385 | bool clear_padding = false; | |||
386 | HOST_WIDE_INTlong non_padding_start = 0; | |||
387 | HOST_WIDE_INTlong non_padding_end = 0; | |||
388 | if (BITS_PER_UNIT(8) == 8 | |||
389 | && CHAR_BIT8 == 8 | |||
390 | && clear_padding_type_may_have_padding_p (cmptype)) | |||
391 | { | |||
392 | HOST_WIDE_INTlong sz = int_size_in_bytes (cmptype), i; | |||
393 | gcc_assert (sz > 0)((void)(!(sz > 0) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 393, __FUNCTION__), 0 : 0)); | |||
394 | unsigned char *buf = XALLOCAVEC (unsigned char, sz)((unsigned char *) __builtin_alloca(sizeof (unsigned char) * ( sz))); | |||
395 | memset (buf, ~0, sz); | |||
396 | clear_type_padding_in_mask (cmptype, buf); | |||
397 | for (i = 0; i < sz; i++) | |||
398 | if (buf[i] != (unsigned char) ~0) | |||
399 | { | |||
400 | clear_padding = true; | |||
401 | break; | |||
402 | } | |||
403 | if (clear_padding && buf[i] == 0) | |||
404 | { | |||
405 | /* Try to optimize. In the common case where | |||
406 | non-padding bits are all continuous and start | |||
407 | and end at a byte boundary, we can just adjust | |||
408 | the memcmp call arguments and don't need to | |||
409 | emit __builtin_clear_padding calls. */ | |||
410 | if (i == 0) | |||
411 | { | |||
412 | for (i = 0; i < sz; i++) | |||
413 | if (buf[i] != 0) | |||
414 | break; | |||
415 | if (i < sz && buf[i] == (unsigned char) ~0) | |||
416 | { | |||
417 | non_padding_start = i; | |||
418 | for (; i < sz; i++) | |||
419 | if (buf[i] != (unsigned char) ~0) | |||
420 | break; | |||
421 | } | |||
422 | else | |||
423 | i = 0; | |||
424 | } | |||
425 | if (i != 0) | |||
426 | { | |||
427 | non_padding_end = i; | |||
428 | for (; i < sz; i++) | |||
429 | if (buf[i] != 0) | |||
430 | { | |||
431 | non_padding_start = 0; | |||
432 | non_padding_end = 0; | |||
433 | break; | |||
434 | } | |||
435 | } | |||
436 | } | |||
437 | } | |||
438 | tree inttype = NULL_TREE(tree) nullptr; | |||
439 | if (!clear_padding && tree_fits_uhwi_p (TYPE_SIZE (cmptype)((tree_class_check ((cmptype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 439, __FUNCTION__))->type_common.size))) | |||
440 | { | |||
441 | HOST_WIDE_INTlong prec = tree_to_uhwi (TYPE_SIZE (cmptype)((tree_class_check ((cmptype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 441, __FUNCTION__))->type_common.size)); | |||
442 | inttype = c_common_type_for_size (prec, 1); | |||
443 | if (inttype | |||
444 | && (!tree_int_cst_equal (TYPE_SIZE (cmptype)((tree_class_check ((cmptype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 444, __FUNCTION__))->type_common.size), | |||
445 | TYPE_SIZE (inttype)((tree_class_check ((inttype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 445, __FUNCTION__))->type_common.size)) | |||
446 | || TYPE_PRECISION (inttype)((tree_class_check ((inttype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 446, __FUNCTION__))->type_common.precision) != prec)) | |||
447 | inttype = NULL_TREE(tree) nullptr; | |||
448 | } | |||
449 | if (inttype) | |||
450 | { | |||
451 | TREE_OPERAND (rhs1, 0)(*((const_cast<tree*> (tree_operand_check ((rhs1), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 451, __FUNCTION__))))) | |||
452 | = build1_loc (loc, VIEW_CONVERT_EXPR, inttype, | |||
453 | TREE_OPERAND (rhs1, 0)(*((const_cast<tree*> (tree_operand_check ((rhs1), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 453, __FUNCTION__)))))); | |||
454 | TREE_OPERAND (rhs1, 1)(*((const_cast<tree*> (tree_operand_check ((rhs1), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 454, __FUNCTION__))))) | |||
455 | = build1_loc (loc, VIEW_CONVERT_EXPR, inttype, | |||
456 | TREE_OPERAND (rhs1, 1)(*((const_cast<tree*> (tree_operand_check ((rhs1), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 456, __FUNCTION__)))))); | |||
457 | } | |||
458 | else | |||
459 | { | |||
460 | tree pcmptype = build_pointer_type (cmptype); | |||
461 | tree tmp1 = create_tmp_var_raw (cmptype); | |||
462 | TREE_ADDRESSABLE (tmp1)((tmp1)->base.addressable_flag) = 1; | |||
463 | DECL_CONTEXT (tmp1)((contains_struct_check ((tmp1), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 463, __FUNCTION__))->decl_minimal.context) = current_function_decl; | |||
464 | tmp1 = build4 (TARGET_EXPR, cmptype, tmp1, | |||
465 | TREE_OPERAND (rhs1, 0)(*((const_cast<tree*> (tree_operand_check ((rhs1), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 465, __FUNCTION__))))), NULLnullptr, NULLnullptr); | |||
466 | tmp1 = build1 (ADDR_EXPR, pcmptype, tmp1); | |||
467 | tree tmp2 = create_tmp_var_raw (cmptype); | |||
468 | TREE_ADDRESSABLE (tmp2)((tmp2)->base.addressable_flag) = 1; | |||
469 | DECL_CONTEXT (tmp2)((contains_struct_check ((tmp2), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 469, __FUNCTION__))->decl_minimal.context) = current_function_decl; | |||
470 | tmp2 = build4 (TARGET_EXPR, cmptype, tmp2, | |||
471 | TREE_OPERAND (rhs1, 1)(*((const_cast<tree*> (tree_operand_check ((rhs1), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 471, __FUNCTION__))))), NULLnullptr, NULLnullptr); | |||
472 | tmp2 = build1 (ADDR_EXPR, pcmptype, tmp2); | |||
473 | if (non_padding_start) | |||
474 | { | |||
475 | tmp1 = build2 (POINTER_PLUS_EXPR, pcmptype, tmp1, | |||
476 | size_int (non_padding_start)size_int_kind (non_padding_start, stk_sizetype)); | |||
477 | tmp2 = build2 (POINTER_PLUS_EXPR, pcmptype, tmp2, | |||
478 | size_int (non_padding_start)size_int_kind (non_padding_start, stk_sizetype)); | |||
479 | } | |||
480 | tree fndecl = builtin_decl_explicit (BUILT_IN_MEMCMP); | |||
481 | rhs1 = build_call_expr_loc (loc, fndecl, 3, tmp1, tmp2, | |||
482 | non_padding_end | |||
483 | ? size_int (non_padding_endsize_int_kind (non_padding_end - non_padding_start, stk_sizetype ) | |||
484 | - non_padding_start)size_int_kind (non_padding_end - non_padding_start, stk_sizetype ) | |||
485 | : TYPE_SIZE_UNIT (cmptype)((tree_class_check ((cmptype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 485, __FUNCTION__))->type_common.size_unit)); | |||
486 | rhs1 = build2 (EQ_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], rhs1, | |||
487 | integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]); | |||
488 | if (clear_padding && non_padding_end == 0) | |||
489 | { | |||
490 | fndecl = builtin_decl_explicit (BUILT_IN_CLEAR_PADDING); | |||
491 | tree cp1 = build_call_expr_loc (loc, fndecl, 1, tmp1); | |||
492 | tree cp2 = build_call_expr_loc (loc, fndecl, 1, tmp2); | |||
493 | rhs1 = omit_two_operands_loc (loc, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], | |||
494 | rhs1, cp2, cp1); | |||
495 | } | |||
496 | } | |||
497 | } | |||
498 | if (r && test) | |||
499 | rtmp = rhs1; | |||
500 | else if (r) | |||
501 | { | |||
502 | tree var = create_tmp_var_raw (boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE]); | |||
503 | DECL_CONTEXT (var)((contains_struct_check ((var), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 503, __FUNCTION__))->decl_minimal.context) = current_function_decl; | |||
504 | rtmp = build4 (TARGET_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], var, | |||
505 | boolean_false_nodeglobal_trees[TI_BOOLEAN_FALSE], NULLnullptr, NULLnullptr); | |||
506 | save = in_late_binary_op; | |||
507 | in_late_binary_op = true; | |||
508 | x = build_modify_expr (loc, var, NULL_TREE(tree) nullptr, NOP_EXPR, | |||
509 | loc, rhs1, NULL_TREE(tree) nullptr); | |||
510 | in_late_binary_op = save; | |||
511 | if (x == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
512 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
513 | gcc_assert (TREE_CODE (x) == MODIFY_EXPR((void)(!(((enum tree_code) (x)->base.code) == MODIFY_EXPR && (*((const_cast<tree*> (tree_operand_check ( (x), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 514, __FUNCTION__))))) == var) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 514, __FUNCTION__), 0 : 0)) | |||
514 | && TREE_OPERAND (x, 0) == var)((void)(!(((enum tree_code) (x)->base.code) == MODIFY_EXPR && (*((const_cast<tree*> (tree_operand_check ( (x), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 514, __FUNCTION__))))) == var) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 514, __FUNCTION__), 0 : 0)); | |||
515 | TREE_OPERAND (x, 0)(*((const_cast<tree*> (tree_operand_check ((x), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 515, __FUNCTION__))))) = rtmp; | |||
516 | rhs1 = omit_one_operand_loc (loc, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], x, rtmp); | |||
517 | } | |||
518 | rhs = build3_loc (loc, COND_EXPR, type, rhs1, rhs, new_lhs); | |||
519 | rhs1 = NULL_TREE(tree) nullptr; | |||
520 | } | |||
521 | ||||
522 | /* Punt the actual generation of atomic operations to common code. */ | |||
523 | if (code == OMP_ATOMIC) | |||
524 | type = void_type_nodeglobal_trees[TI_VOID_TYPE]; | |||
525 | x = build2 (code, type, addr, rhs); | |||
526 | SET_EXPR_LOCATION (x, loc)(expr_check (((x)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 526, __FUNCTION__))->exp.locus = (loc); | |||
527 | OMP_ATOMIC_MEMORY_ORDER (x)((tree_range_check ((x), (OMP_ATOMIC), (OMP_ATOMIC_CAPTURE_NEW ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 527, __FUNCTION__))->base.u.omp_atomic_memory_order) = memory_order; | |||
528 | OMP_ATOMIC_WEAK (x)((tree_range_check ((x), (OMP_ATOMIC), (OMP_ATOMIC_CAPTURE_NEW ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 528, __FUNCTION__))->base.public_flag) = weak; | |||
529 | ||||
530 | /* Generally it is hard to prove lhs1 and lhs are the same memory | |||
531 | location, just diagnose different variables. */ | |||
532 | if (rhs1 | |||
533 | && VAR_P (rhs1)(((enum tree_code) (rhs1)->base.code) == VAR_DECL) | |||
534 | && VAR_P (orig_lhs)(((enum tree_code) (orig_lhs)->base.code) == VAR_DECL) | |||
535 | && rhs1 != orig_lhs | |||
536 | && !test) | |||
537 | { | |||
538 | if (code == OMP_ATOMIC) | |||
539 | error_at (loc, "%<#pragma omp atomic update%> uses two different " | |||
540 | "variables for memory"); | |||
541 | else | |||
542 | error_at (loc, "%<#pragma omp atomic capture%> uses two different " | |||
543 | "variables for memory"); | |||
544 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
545 | } | |||
546 | ||||
547 | if (lhs1 | |||
548 | && lhs1 != orig_lhs | |||
549 | && TREE_CODE (lhs1)((enum tree_code) (lhs1)->base.code) == COMPONENT_REF | |||
550 | && TREE_CODE (TREE_OPERAND (lhs1, 1))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check ((lhs1), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 550, __FUNCTION__))))))->base.code) == FIELD_DECL | |||
551 | && DECL_C_BIT_FIELD (TREE_OPERAND (lhs1, 1))(((contains_struct_check (((tree_check (((*((const_cast<tree *> (tree_operand_check ((lhs1), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 551, __FUNCTION__)))))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 551, __FUNCTION__, (FIELD_DECL)))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 551, __FUNCTION__))->decl_common.lang_flag_4) == 1) | |||
552 | && DECL_BIT_FIELD_REPRESENTATIVE (TREE_OPERAND (lhs1, 1))((tree_check (((*((const_cast<tree*> (tree_operand_check ((lhs1), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 552, __FUNCTION__)))))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 552, __FUNCTION__, (FIELD_DECL)))->field_decl.qualifier)) | |||
553 | { | |||
554 | tree field = TREE_OPERAND (lhs1, 1)(*((const_cast<tree*> (tree_operand_check ((lhs1), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 554, __FUNCTION__))))); | |||
555 | tree repr = DECL_BIT_FIELD_REPRESENTATIVE (field)((tree_check ((field), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 555, __FUNCTION__, (FIELD_DECL)))->field_decl.qualifier); | |||
556 | lhs1 = build3 (COMPONENT_REF, TREE_TYPE (repr)((contains_struct_check ((repr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 556, __FUNCTION__))->typed.type), TREE_OPERAND (lhs1, 0)(*((const_cast<tree*> (tree_operand_check ((lhs1), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 556, __FUNCTION__))))), | |||
557 | repr, TREE_OPERAND (lhs1, 2)(*((const_cast<tree*> (tree_operand_check ((lhs1), (2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 557, __FUNCTION__)))))); | |||
558 | } | |||
559 | if (rhs1 | |||
560 | && rhs1 != orig_lhs | |||
561 | && TREE_CODE (rhs1)((enum tree_code) (rhs1)->base.code) == COMPONENT_REF | |||
562 | && TREE_CODE (TREE_OPERAND (rhs1, 1))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check ((rhs1), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 562, __FUNCTION__))))))->base.code) == FIELD_DECL | |||
563 | && DECL_C_BIT_FIELD (TREE_OPERAND (rhs1, 1))(((contains_struct_check (((tree_check (((*((const_cast<tree *> (tree_operand_check ((rhs1), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 563, __FUNCTION__)))))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 563, __FUNCTION__, (FIELD_DECL)))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 563, __FUNCTION__))->decl_common.lang_flag_4) == 1) | |||
564 | && DECL_BIT_FIELD_REPRESENTATIVE (TREE_OPERAND (rhs1, 1))((tree_check (((*((const_cast<tree*> (tree_operand_check ((rhs1), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 564, __FUNCTION__)))))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 564, __FUNCTION__, (FIELD_DECL)))->field_decl.qualifier)) | |||
565 | { | |||
566 | tree field = TREE_OPERAND (rhs1, 1)(*((const_cast<tree*> (tree_operand_check ((rhs1), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 566, __FUNCTION__))))); | |||
567 | tree repr = DECL_BIT_FIELD_REPRESENTATIVE (field)((tree_check ((field), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 567, __FUNCTION__, (FIELD_DECL)))->field_decl.qualifier); | |||
568 | rhs1 = build3 (COMPONENT_REF, TREE_TYPE (repr)((contains_struct_check ((repr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 568, __FUNCTION__))->typed.type), TREE_OPERAND (rhs1, 0)(*((const_cast<tree*> (tree_operand_check ((rhs1), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 568, __FUNCTION__))))), | |||
569 | repr, TREE_OPERAND (rhs1, 2)(*((const_cast<tree*> (tree_operand_check ((rhs1), (2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 569, __FUNCTION__)))))); | |||
570 | } | |||
571 | ||||
572 | if (code != OMP_ATOMIC) | |||
573 | { | |||
574 | /* Generally it is hard to prove lhs1 and lhs are the same memory | |||
575 | location, just diagnose different variables. */ | |||
576 | if (lhs1 && VAR_P (lhs1)(((enum tree_code) (lhs1)->base.code) == VAR_DECL) && VAR_P (orig_lhs)(((enum tree_code) (orig_lhs)->base.code) == VAR_DECL)) | |||
577 | { | |||
578 | if (lhs1 != orig_lhs && !test) | |||
579 | { | |||
580 | error_at (loc, "%<#pragma omp atomic capture%> uses two " | |||
581 | "different variables for memory"); | |||
582 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
583 | } | |||
584 | } | |||
585 | if (blhs) | |||
586 | x = build3_loc (loc, BIT_FIELD_REF, TREE_TYPE (blhs)((contains_struct_check ((blhs), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 586, __FUNCTION__))->typed.type), x, | |||
587 | bitsize_int (bitsize)size_int_kind (bitsize, stk_bitsizetype), bitsize_int (bitpos)size_int_kind (bitpos, stk_bitsizetype)); | |||
588 | if (r && !test) | |||
589 | { | |||
590 | vtmp = create_tmp_var_raw (TREE_TYPE (x)((contains_struct_check ((x), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 590, __FUNCTION__))->typed.type)); | |||
591 | DECL_CONTEXT (vtmp)((contains_struct_check ((vtmp), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 591, __FUNCTION__))->decl_minimal.context) = current_function_decl; | |||
592 | } | |||
593 | else | |||
594 | vtmp = v; | |||
595 | x = build_modify_expr (loc, vtmp, NULL_TREE(tree) nullptr, NOP_EXPR, | |||
596 | loc, x, NULL_TREE(tree) nullptr); | |||
597 | if (x == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
598 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
599 | type = TREE_TYPE (x)((contains_struct_check ((x), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 599, __FUNCTION__))->typed.type); | |||
600 | if (r && !test) | |||
601 | { | |||
602 | vtmp = build4 (TARGET_EXPR, TREE_TYPE (vtmp)((contains_struct_check ((vtmp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 602, __FUNCTION__))->typed.type), vtmp, | |||
603 | build_zero_cst (TREE_TYPE (vtmp)((contains_struct_check ((vtmp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 603, __FUNCTION__))->typed.type)), NULLnullptr, NULLnullptr); | |||
604 | gcc_assert (TREE_CODE (x) == MODIFY_EXPR((void)(!(((enum tree_code) (x)->base.code) == MODIFY_EXPR && (*((const_cast<tree*> (tree_operand_check ( (x), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 605, __FUNCTION__))))) == (*(tree_operand_check_code ((vtmp ), (TARGET_EXPR), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 605, __FUNCTION__)))) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 605, __FUNCTION__), 0 : 0)) | |||
605 | && TREE_OPERAND (x, 0) == TARGET_EXPR_SLOT (vtmp))((void)(!(((enum tree_code) (x)->base.code) == MODIFY_EXPR && (*((const_cast<tree*> (tree_operand_check ( (x), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 605, __FUNCTION__))))) == (*(tree_operand_check_code ((vtmp ), (TARGET_EXPR), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 605, __FUNCTION__)))) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 605, __FUNCTION__), 0 : 0)); | |||
606 | TREE_OPERAND (x, 0)(*((const_cast<tree*> (tree_operand_check ((x), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 606, __FUNCTION__))))) = vtmp; | |||
607 | } | |||
608 | if (rhs1 && rhs1 != orig_lhs) | |||
609 | { | |||
610 | tree rhs1addr = build_unary_op (loc, ADDR_EXPR, rhs1, false); | |||
611 | if (rhs1addr == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
612 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
613 | x = omit_one_operand_loc (loc, type, x, rhs1addr); | |||
614 | } | |||
615 | if (lhs1 && lhs1 != orig_lhs) | |||
616 | { | |||
617 | tree lhs1addr = build_unary_op (loc, ADDR_EXPR, lhs1, false); | |||
618 | if (lhs1addr == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
619 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
620 | if (code == OMP_ATOMIC_CAPTURE_OLD) | |||
621 | x = omit_one_operand_loc (loc, type, x, lhs1addr); | |||
622 | else | |||
623 | { | |||
624 | if (!test) | |||
625 | x = save_expr (x); | |||
626 | x = omit_two_operands_loc (loc, type, x, x, lhs1addr); | |||
627 | } | |||
628 | } | |||
629 | } | |||
630 | else if (rhs1 && rhs1 != orig_lhs) | |||
631 | { | |||
632 | tree rhs1addr = build_unary_op (loc, ADDR_EXPR, rhs1, false); | |||
633 | if (rhs1addr == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
634 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
635 | x = omit_one_operand_loc (loc, type, x, rhs1addr); | |||
636 | } | |||
637 | ||||
638 | if (pre) | |||
639 | x = omit_one_operand_loc (loc, type, x, pre); | |||
640 | if (r && r != void_list_nodeglobal_trees[TI_VOID_LIST_NODE]) | |||
641 | { | |||
642 | in_late_binary_op = true; | |||
643 | tree x2 = build_modify_expr (loc, r, NULL_TREE(tree) nullptr, NOP_EXPR, | |||
644 | loc, rtmp, NULL_TREE(tree) nullptr); | |||
645 | in_late_binary_op = save; | |||
646 | if (x2 == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
647 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
648 | x = omit_one_operand_loc (loc, TREE_TYPE (x2)((contains_struct_check ((x2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 648, __FUNCTION__))->typed.type), x2, x); | |||
649 | } | |||
650 | if (v && vtmp != v) | |||
651 | { | |||
652 | in_late_binary_op = true; | |||
653 | tree x2 = build_modify_expr (loc, v, NULL_TREE(tree) nullptr, NOP_EXPR, | |||
654 | loc, vtmp, NULL_TREE(tree) nullptr); | |||
655 | in_late_binary_op = save; | |||
656 | if (x2 == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
657 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
658 | x2 = build3_loc (loc, COND_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], rtmp, | |||
659 | void_nodeglobal_trees[TI_VOID], x2); | |||
660 | x = omit_one_operand_loc (loc, TREE_TYPE (x2)((contains_struct_check ((x2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 660, __FUNCTION__))->typed.type), x2, x); | |||
661 | } | |||
662 | return x; | |||
663 | } | |||
664 | ||||
665 | ||||
666 | /* Return true if TYPE is the implementation's omp_depend_t. */ | |||
667 | ||||
668 | bool | |||
669 | c_omp_depend_t_p (tree type) | |||
670 | { | |||
671 | type = TYPE_MAIN_VARIANT (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 671, __FUNCTION__))->type_common.main_variant); | |||
672 | return (TREE_CODE (type)((enum tree_code) (type)->base.code) == RECORD_TYPE | |||
673 | && TYPE_NAME (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 673, __FUNCTION__))->type_common.name) | |||
674 | && ((TREE_CODE (TYPE_NAME (type))((enum tree_code) (((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 674, __FUNCTION__))->type_common.name))->base.code) == TYPE_DECL | |||
675 | ? DECL_NAME (TYPE_NAME (type))((contains_struct_check ((((tree_class_check ((type), (tcc_type ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 675, __FUNCTION__))->type_common.name)), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 675, __FUNCTION__))->decl_minimal.name) : TYPE_NAME (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 675, __FUNCTION__))->type_common.name)) | |||
676 | == get_identifier ("omp_depend_t")(__builtin_constant_p ("omp_depend_t") ? get_identifier_with_length (("omp_depend_t"), strlen ("omp_depend_t")) : get_identifier ("omp_depend_t"))) | |||
677 | && (!TYPE_CONTEXT (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 677, __FUNCTION__))->type_common.context) | |||
678 | || TREE_CODE (TYPE_CONTEXT (type))((enum tree_code) (((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 678, __FUNCTION__))->type_common.context))->base.code ) == TRANSLATION_UNIT_DECL) | |||
679 | && COMPLETE_TYPE_P (type)(((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 679, __FUNCTION__))->type_common.size) != (tree) nullptr ) | |||
680 | && TREE_CODE (TYPE_SIZE (type))((enum tree_code) (((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 680, __FUNCTION__))->type_common.size))->base.code) == INTEGER_CST | |||
681 | && !compare_tree_int (TYPE_SIZE (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 681, __FUNCTION__))->type_common.size), | |||
682 | 2 * tree_to_uhwi (TYPE_SIZE (ptr_type_node)((tree_class_check ((global_trees[TI_PTR_TYPE]), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 682, __FUNCTION__))->type_common.size)))); | |||
683 | } | |||
684 | ||||
685 | ||||
686 | /* Complete a #pragma omp depobj construct. LOC is the location of the | |||
687 | #pragma. */ | |||
688 | ||||
689 | void | |||
690 | c_finish_omp_depobj (location_t loc, tree depobj, | |||
691 | enum omp_clause_depend_kind kind, tree clause) | |||
692 | { | |||
693 | tree t = NULL_TREE(tree) nullptr; | |||
694 | if (!error_operand_p (depobj)) | |||
695 | { | |||
696 | if (!c_omp_depend_t_p (TREE_TYPE (depobj)((contains_struct_check ((depobj), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 696, __FUNCTION__))->typed.type))) | |||
697 | { | |||
698 | error_at (EXPR_LOC_OR_LOC (depobj, loc)((((IS_ADHOC_LOC (((((depobj)) && ((tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((depobj) )->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((depobj) )->base.code))]) <= tcc_expression)) ? (depobj)->exp .locus : ((location_t) 0)))) ? get_location_from_adhoc_loc (line_table , ((((depobj)) && ((tree_code_type_tmpl <0>::tree_code_type [(int) (((enum tree_code) ((depobj))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) ((depobj))->base.code))]) <= tcc_expression )) ? (depobj)->exp.locus : ((location_t) 0))) : (((((depobj )) && ((tree_code_type_tmpl <0>::tree_code_type [(int) (((enum tree_code) ((depobj))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) ((depobj))->base.code))]) <= tcc_expression )) ? (depobj)->exp.locus : ((location_t) 0)))) != ((location_t ) 0)) ? (depobj)->exp.locus : (loc)), | |||
699 | "type of %<depobj%> expression is not %<omp_depend_t%>"); | |||
700 | depobj = error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
701 | } | |||
702 | else if (TYPE_READONLY (TREE_TYPE (depobj))((tree_class_check ((((contains_struct_check ((depobj), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 702, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 702, __FUNCTION__))->base.readonly_flag)) | |||
703 | { | |||
704 | error_at (EXPR_LOC_OR_LOC (depobj, loc)((((IS_ADHOC_LOC (((((depobj)) && ((tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((depobj) )->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((depobj) )->base.code))]) <= tcc_expression)) ? (depobj)->exp .locus : ((location_t) 0)))) ? get_location_from_adhoc_loc (line_table , ((((depobj)) && ((tree_code_type_tmpl <0>::tree_code_type [(int) (((enum tree_code) ((depobj))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) ((depobj))->base.code))]) <= tcc_expression )) ? (depobj)->exp.locus : ((location_t) 0))) : (((((depobj )) && ((tree_code_type_tmpl <0>::tree_code_type [(int) (((enum tree_code) ((depobj))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) ((depobj))->base.code))]) <= tcc_expression )) ? (depobj)->exp.locus : ((location_t) 0)))) != ((location_t ) 0)) ? (depobj)->exp.locus : (loc)), | |||
705 | "%<const%> qualified %<depobj%> expression"); | |||
706 | depobj = error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
707 | } | |||
708 | } | |||
709 | else | |||
710 | depobj = error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
711 | ||||
712 | if (clause == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
713 | return; | |||
714 | ||||
715 | if (clause) | |||
716 | { | |||
717 | gcc_assert (TREE_CODE (clause) == OMP_CLAUSE)((void)(!(((enum tree_code) (clause)->base.code) == OMP_CLAUSE ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 717, __FUNCTION__), 0 : 0)); | |||
718 | if (OMP_CLAUSE_CODE (clause)((tree_check ((clause), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 718, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_DOACROSS) | |||
719 | { | |||
720 | error_at (OMP_CLAUSE_LOCATION (clause)((tree_check ((clause), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 720, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
721 | "%<depend(%s)%> is only allowed in %<omp ordered%>", | |||
722 | OMP_CLAUSE_DOACROSS_KIND (clause)((omp_clause_subcode_check ((clause), (OMP_CLAUSE_DOACROSS), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 722, __FUNCTION__))->omp_clause.subcode.doacross_kind) | |||
723 | == OMP_CLAUSE_DOACROSS_SOURCE | |||
724 | ? "source" : "sink"); | |||
725 | return; | |||
726 | } | |||
727 | gcc_assert (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_DEPEND)((void)(!(((tree_check ((clause), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 727, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_DEPEND ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 727, __FUNCTION__), 0 : 0)); | |||
728 | if (OMP_CLAUSE_CHAIN (clause)((contains_struct_check (((tree_check ((clause), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 728, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 728, __FUNCTION__))->common.chain)) | |||
729 | error_at (OMP_CLAUSE_LOCATION (clause)((tree_check ((clause), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 729, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
730 | "more than one locator in %<depend%> clause on %<depobj%> " | |||
731 | "construct"); | |||
732 | switch (OMP_CLAUSE_DEPEND_KIND (clause)((omp_clause_subcode_check ((clause), (OMP_CLAUSE_DEPEND), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 732, __FUNCTION__))->omp_clause.subcode.depend_kind)) | |||
733 | { | |||
734 | case OMP_CLAUSE_DEPEND_DEPOBJ: | |||
735 | error_at (OMP_CLAUSE_LOCATION (clause)((tree_check ((clause), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 735, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
736 | "%<depobj%> dependence type specified in %<depend%> " | |||
737 | "clause on %<depobj%> construct"); | |||
738 | return; | |||
739 | case OMP_CLAUSE_DEPEND_IN: | |||
740 | case OMP_CLAUSE_DEPEND_OUT: | |||
741 | case OMP_CLAUSE_DEPEND_INOUT: | |||
742 | case OMP_CLAUSE_DEPEND_MUTEXINOUTSET: | |||
743 | case OMP_CLAUSE_DEPEND_INOUTSET: | |||
744 | kind = OMP_CLAUSE_DEPEND_KIND (clause)((omp_clause_subcode_check ((clause), (OMP_CLAUSE_DEPEND), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 744, __FUNCTION__))->omp_clause.subcode.depend_kind); | |||
745 | t = OMP_CLAUSE_DECL (clause)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((clause), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 745, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 745, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 745, __FUNCTION__))); | |||
746 | gcc_assert (t)((void)(!(t) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 746, __FUNCTION__), 0 : 0)); | |||
747 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) == TREE_LIST | |||
748 | && TREE_PURPOSE (t)((tree_check ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 748, __FUNCTION__, (TREE_LIST)))->list.purpose) | |||
749 | && TREE_CODE (TREE_PURPOSE (t))((enum tree_code) (((tree_check ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 749, __FUNCTION__, (TREE_LIST)))->list.purpose))->base .code) == TREE_VEC) | |||
750 | { | |||
751 | error_at (OMP_CLAUSE_LOCATION (clause)((tree_check ((clause), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 751, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
752 | "%<iterator%> modifier may not be specified on " | |||
753 | "%<depobj%> construct"); | |||
754 | return; | |||
755 | } | |||
756 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) == COMPOUND_EXPR) | |||
757 | { | |||
758 | tree t1 = build_fold_addr_expr (TREE_OPERAND (t, 1))build_fold_addr_expr_loc (((location_t) 0), ((*((const_cast< tree*> (tree_operand_check ((t), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 758, __FUNCTION__))))))); | |||
759 | t = build2 (COMPOUND_EXPR, TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 759, __FUNCTION__))->typed.type), TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 759, __FUNCTION__))))), | |||
760 | t1); | |||
761 | } | |||
762 | else if (t != null_pointer_nodeglobal_trees[TI_NULL_POINTER]) | |||
763 | t = build_fold_addr_expr (t)build_fold_addr_expr_loc (((location_t) 0), (t)); | |||
764 | break; | |||
765 | default: | |||
766 | gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 766, __FUNCTION__)); | |||
767 | } | |||
768 | } | |||
769 | else | |||
770 | gcc_assert (kind != OMP_CLAUSE_DEPEND_INVALID)((void)(!(kind != OMP_CLAUSE_DEPEND_INVALID) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 770, __FUNCTION__), 0 : 0)); | |||
771 | ||||
772 | if (depobj == error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
773 | return; | |||
774 | ||||
775 | depobj = build_fold_addr_expr_loc (EXPR_LOC_OR_LOC (depobj, loc)((((IS_ADHOC_LOC (((((depobj)) && ((tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((depobj) )->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((depobj) )->base.code))]) <= tcc_expression)) ? (depobj)->exp .locus : ((location_t) 0)))) ? get_location_from_adhoc_loc (line_table , ((((depobj)) && ((tree_code_type_tmpl <0>::tree_code_type [(int) (((enum tree_code) ((depobj))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) ((depobj))->base.code))]) <= tcc_expression )) ? (depobj)->exp.locus : ((location_t) 0))) : (((((depobj )) && ((tree_code_type_tmpl <0>::tree_code_type [(int) (((enum tree_code) ((depobj))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) ((depobj))->base.code))]) <= tcc_expression )) ? (depobj)->exp.locus : ((location_t) 0)))) != ((location_t ) 0)) ? (depobj)->exp.locus : (loc)), depobj); | |||
776 | tree dtype | |||
777 | = build_pointer_type_for_mode (ptr_type_nodeglobal_trees[TI_PTR_TYPE], TYPE_MODE (ptr_type_node)((((enum tree_code) ((tree_class_check ((global_trees[TI_PTR_TYPE ]), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 777, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (global_trees[TI_PTR_TYPE]) : (global_trees[TI_PTR_TYPE])-> type_common.mode), | |||
778 | true); | |||
779 | depobj = fold_convert (dtype, depobj)fold_convert_loc (((location_t) 0), dtype, depobj); | |||
780 | tree r; | |||
781 | if (clause) | |||
782 | { | |||
783 | depobj = save_expr (depobj); | |||
784 | r = build_indirect_ref (loc, depobj, RO_UNARY_STAR); | |||
785 | add_stmt (build2 (MODIFY_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], r, t)); | |||
786 | } | |||
787 | int k; | |||
788 | switch (kind) | |||
789 | { | |||
790 | case OMP_CLAUSE_DEPEND_IN: | |||
791 | k = GOMP_DEPEND_IN1; | |||
792 | break; | |||
793 | case OMP_CLAUSE_DEPEND_OUT: | |||
794 | k = GOMP_DEPEND_OUT2; | |||
795 | break; | |||
796 | case OMP_CLAUSE_DEPEND_INOUT: | |||
797 | k = GOMP_DEPEND_INOUT3; | |||
798 | break; | |||
799 | case OMP_CLAUSE_DEPEND_MUTEXINOUTSET: | |||
800 | k = GOMP_DEPEND_MUTEXINOUTSET4; | |||
801 | break; | |||
802 | case OMP_CLAUSE_DEPEND_INOUTSET: | |||
803 | k = GOMP_DEPEND_INOUTSET5; | |||
804 | break; | |||
805 | case OMP_CLAUSE_DEPEND_LAST: | |||
806 | k = -1; | |||
807 | break; | |||
808 | default: | |||
809 | gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 809, __FUNCTION__)); | |||
810 | } | |||
811 | t = build_int_cst (ptr_type_nodeglobal_trees[TI_PTR_TYPE], k); | |||
812 | depobj = build2_loc (loc, POINTER_PLUS_EXPR, TREE_TYPE (depobj)((contains_struct_check ((depobj), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 812, __FUNCTION__))->typed.type), depobj, | |||
813 | TYPE_SIZE_UNIT (ptr_type_node)((tree_class_check ((global_trees[TI_PTR_TYPE]), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 813, __FUNCTION__))->type_common.size_unit)); | |||
814 | r = build_indirect_ref (loc, depobj, RO_UNARY_STAR); | |||
815 | add_stmt (build2 (MODIFY_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], r, t)); | |||
816 | } | |||
817 | ||||
818 | ||||
819 | /* Complete a #pragma omp flush construct. We don't do anything with | |||
820 | the variable list that the syntax allows. LOC is the location of | |||
821 | the #pragma. */ | |||
822 | ||||
823 | void | |||
824 | c_finish_omp_flush (location_t loc, int mo) | |||
825 | { | |||
826 | tree x; | |||
827 | ||||
828 | if (mo == MEMMODEL_LAST || mo == MEMMODEL_SEQ_CST) | |||
829 | { | |||
830 | x = builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE); | |||
831 | x = build_call_expr_loc (loc, x, 0); | |||
832 | } | |||
833 | else | |||
834 | { | |||
835 | x = builtin_decl_explicit (BUILT_IN_ATOMIC_THREAD_FENCE); | |||
836 | x = build_call_expr_loc (loc, x, 1, | |||
837 | build_int_cst (integer_type_nodeinteger_types[itk_int], mo)); | |||
838 | } | |||
839 | add_stmt (x); | |||
840 | } | |||
841 | ||||
842 | ||||
843 | /* Check and canonicalize OMP_FOR increment expression. | |||
844 | Helper function for c_finish_omp_for. */ | |||
845 | ||||
846 | static tree | |||
847 | check_omp_for_incr_expr (location_t loc, tree exp, tree decl) | |||
848 | { | |||
849 | tree t; | |||
850 | ||||
851 | if (!INTEGRAL_TYPE_P (TREE_TYPE (exp))(((enum tree_code) (((contains_struct_check ((exp), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 851, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE || ((enum tree_code) (((contains_struct_check ((exp), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 851, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE || ((enum tree_code) (((contains_struct_check ((exp), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 851, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE ) | |||
852 | || TYPE_PRECISION (TREE_TYPE (exp))((tree_class_check ((((contains_struct_check ((exp), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 852, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 852, __FUNCTION__))->type_common.precision) < TYPE_PRECISION (TREE_TYPE (decl))((tree_class_check ((((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 852, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 852, __FUNCTION__))->type_common.precision)) | |||
853 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
854 | ||||
855 | if (exp == decl) | |||
856 | return build_int_cst (TREE_TYPE (exp)((contains_struct_check ((exp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 856, __FUNCTION__))->typed.type), 0); | |||
857 | ||||
858 | switch (TREE_CODE (exp)((enum tree_code) (exp)->base.code)) | |||
859 | { | |||
860 | CASE_CONVERTcase NOP_EXPR: case CONVERT_EXPR: | |||
861 | t = check_omp_for_incr_expr (loc, TREE_OPERAND (exp, 0)(*((const_cast<tree*> (tree_operand_check ((exp), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 861, __FUNCTION__))))), decl); | |||
862 | if (t != error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
863 | return fold_convert_loc (loc, TREE_TYPE (exp)((contains_struct_check ((exp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 863, __FUNCTION__))->typed.type), t); | |||
864 | break; | |||
865 | case MINUS_EXPR: | |||
866 | t = check_omp_for_incr_expr (loc, TREE_OPERAND (exp, 0)(*((const_cast<tree*> (tree_operand_check ((exp), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 866, __FUNCTION__))))), decl); | |||
867 | if (t != error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
868 | return fold_build2_loc (loc, MINUS_EXPR, | |||
869 | TREE_TYPE (exp)((contains_struct_check ((exp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 869, __FUNCTION__))->typed.type), t, TREE_OPERAND (exp, 1)(*((const_cast<tree*> (tree_operand_check ((exp), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 869, __FUNCTION__)))))); | |||
870 | break; | |||
871 | case PLUS_EXPR: | |||
872 | t = check_omp_for_incr_expr (loc, TREE_OPERAND (exp, 0)(*((const_cast<tree*> (tree_operand_check ((exp), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 872, __FUNCTION__))))), decl); | |||
873 | if (t != error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
874 | return fold_build2_loc (loc, PLUS_EXPR, | |||
875 | TREE_TYPE (exp)((contains_struct_check ((exp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 875, __FUNCTION__))->typed.type), t, TREE_OPERAND (exp, 1)(*((const_cast<tree*> (tree_operand_check ((exp), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 875, __FUNCTION__)))))); | |||
876 | t = check_omp_for_incr_expr (loc, TREE_OPERAND (exp, 1)(*((const_cast<tree*> (tree_operand_check ((exp), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 876, __FUNCTION__))))), decl); | |||
877 | if (t != error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
878 | return fold_build2_loc (loc, PLUS_EXPR, | |||
879 | TREE_TYPE (exp)((contains_struct_check ((exp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 879, __FUNCTION__))->typed.type), TREE_OPERAND (exp, 0)(*((const_cast<tree*> (tree_operand_check ((exp), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 879, __FUNCTION__))))), t); | |||
880 | break; | |||
881 | case COMPOUND_EXPR: | |||
882 | { | |||
883 | /* cp_build_modify_expr forces preevaluation of the RHS to make | |||
884 | sure that it is evaluated before the lvalue-rvalue conversion | |||
885 | is applied to the LHS. Reconstruct the original expression. */ | |||
886 | tree op0 = TREE_OPERAND (exp, 0)(*((const_cast<tree*> (tree_operand_check ((exp), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 886, __FUNCTION__))))); | |||
887 | if (TREE_CODE (op0)((enum tree_code) (op0)->base.code) == TARGET_EXPR | |||
888 | && !VOID_TYPE_P (TREE_TYPE (op0))(((enum tree_code) (((contains_struct_check ((op0), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 888, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE )) | |||
889 | { | |||
890 | tree op1 = TREE_OPERAND (exp, 1)(*((const_cast<tree*> (tree_operand_check ((exp), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 890, __FUNCTION__))))); | |||
891 | tree temp = TARGET_EXPR_SLOT (op0)(*(tree_operand_check_code ((op0), (TARGET_EXPR), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 891, __FUNCTION__))); | |||
892 | if (BINARY_CLASS_P (op1)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (op1)->base.code))] == tcc_binary) | |||
893 | && TREE_OPERAND (op1, 1)(*((const_cast<tree*> (tree_operand_check ((op1), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 893, __FUNCTION__))))) == temp) | |||
894 | { | |||
895 | op1 = copy_node (op1); | |||
896 | TREE_OPERAND (op1, 1)(*((const_cast<tree*> (tree_operand_check ((op1), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 896, __FUNCTION__))))) = TARGET_EXPR_INITIAL (op0)(*(tree_operand_check_code ((op0), (TARGET_EXPR), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 896, __FUNCTION__))); | |||
897 | return check_omp_for_incr_expr (loc, op1, decl); | |||
898 | } | |||
899 | } | |||
900 | break; | |||
901 | } | |||
902 | default: | |||
903 | break; | |||
904 | } | |||
905 | ||||
906 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; | |||
907 | } | |||
908 | ||||
909 | /* If the OMP_FOR increment expression in INCR is of pointer type, | |||
910 | canonicalize it into an expression handled by gimplify_omp_for() | |||
911 | and return it. DECL is the iteration variable. */ | |||
912 | ||||
913 | static tree | |||
914 | c_omp_for_incr_canonicalize_ptr (location_t loc, tree decl, tree incr) | |||
915 | { | |||
916 | if (POINTER_TYPE_P (TREE_TYPE (decl))(((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 916, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 916, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE ) | |||
917 | && TREE_OPERAND (incr, 1)(*((const_cast<tree*> (tree_operand_check ((incr), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 917, __FUNCTION__)))))) | |||
918 | { | |||
919 | tree t = fold_convert_loc (loc, | |||
920 | sizetypesizetype_tab[(int) stk_sizetype], TREE_OPERAND (incr, 1)(*((const_cast<tree*> (tree_operand_check ((incr), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 920, __FUNCTION__)))))); | |||
921 | ||||
922 | if (TREE_CODE (incr)((enum tree_code) (incr)->base.code) == POSTDECREMENT_EXPR | |||
923 | || TREE_CODE (incr)((enum tree_code) (incr)->base.code) == PREDECREMENT_EXPR) | |||
924 | t = fold_build1_loc (loc, NEGATE_EXPR, sizetypesizetype_tab[(int) stk_sizetype], t); | |||
925 | t = fold_build_pointer_plus (decl, t)fold_build_pointer_plus_loc (((location_t) 0), decl, t); | |||
926 | incr = build2 (MODIFY_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], decl, t); | |||
927 | } | |||
928 | return incr; | |||
929 | } | |||
930 | ||||
931 | /* Validate and generate OMP_FOR. | |||
932 | DECLV is a vector of iteration variables, for each collapsed loop. | |||
933 | ||||
934 | ORIG_DECLV, if non-NULL, is a vector with the original iteration | |||
935 | variables (prior to any transformations, by say, C++ iterators). | |||
936 | ||||
937 | INITV, CONDV and INCRV are vectors containing initialization | |||
938 | expressions, controlling predicates and increment expressions. | |||
939 | BODY is the body of the loop and PRE_BODY statements that go before | |||
940 | the loop. */ | |||
941 | ||||
942 | tree | |||
943 | c_finish_omp_for (location_t locus, enum tree_code code, tree declv, | |||
944 | tree orig_declv, tree initv, tree condv, tree incrv, | |||
945 | tree body, tree pre_body, bool final_p) | |||
946 | { | |||
947 | location_t elocus; | |||
948 | bool fail = false; | |||
949 | int i; | |||
950 | ||||
951 | gcc_assert (TREE_VEC_LENGTH (declv) == TREE_VEC_LENGTH (initv))((void)(!(((tree_check ((declv), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 951, __FUNCTION__, (TREE_VEC)))->base.u.length) == ((tree_check ((initv), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 951, __FUNCTION__, (TREE_VEC)))->base.u.length)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 951, __FUNCTION__), 0 : 0)); | |||
952 | gcc_assert (TREE_VEC_LENGTH (declv) == TREE_VEC_LENGTH (condv))((void)(!(((tree_check ((declv), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 952, __FUNCTION__, (TREE_VEC)))->base.u.length) == ((tree_check ((condv), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 952, __FUNCTION__, (TREE_VEC)))->base.u.length)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 952, __FUNCTION__), 0 : 0)); | |||
953 | gcc_assert (TREE_VEC_LENGTH (declv) == TREE_VEC_LENGTH (incrv))((void)(!(((tree_check ((declv), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 953, __FUNCTION__, (TREE_VEC)))->base.u.length) == ((tree_check ((incrv), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 953, __FUNCTION__, (TREE_VEC)))->base.u.length)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 953, __FUNCTION__), 0 : 0)); | |||
954 | for (i = 0; i < TREE_VEC_LENGTH (declv)((tree_check ((declv), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 954, __FUNCTION__, (TREE_VEC)))->base.u.length); i++) | |||
955 | { | |||
956 | tree decl = TREE_VEC_ELT (declv, i)(*((const_cast<tree *> (tree_vec_elt_check ((declv), (i ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 956, __FUNCTION__))))); | |||
957 | tree init = TREE_VEC_ELT (initv, i)(*((const_cast<tree *> (tree_vec_elt_check ((initv), (i ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 957, __FUNCTION__))))); | |||
958 | tree cond = TREE_VEC_ELT (condv, i)(*((const_cast<tree *> (tree_vec_elt_check ((condv), (i ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 958, __FUNCTION__))))); | |||
959 | tree incr = TREE_VEC_ELT (incrv, i)(*((const_cast<tree *> (tree_vec_elt_check ((incrv), (i ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 959, __FUNCTION__))))); | |||
960 | ||||
961 | elocus = locus; | |||
962 | if (EXPR_HAS_LOCATION (init)(((IS_ADHOC_LOC (((((init)) && ((tree_code_type_tmpl < 0>::tree_code_type[(int) (((enum tree_code) ((init))->base .code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((init))-> base.code))]) <= tcc_expression)) ? (init)->exp.locus : ((location_t) 0)))) ? get_location_from_adhoc_loc (line_table , ((((init)) && ((tree_code_type_tmpl <0>::tree_code_type [(int) (((enum tree_code) ((init))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) ((init))->base.code))]) <= tcc_expression )) ? (init)->exp.locus : ((location_t) 0))) : (((((init)) && ((tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((init))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((init))->base.code))]) <= tcc_expression)) ? (init)->exp.locus : ((location_t) 0)))) != ((location_t ) 0))) | |||
963 | elocus = EXPR_LOCATION (init)((((init)) && ((tree_code_type_tmpl <0>::tree_code_type [(int) (((enum tree_code) ((init))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) ((init))->base.code))]) <= tcc_expression )) ? (init)->exp.locus : ((location_t) 0)); | |||
964 | ||||
965 | /* Validate the iteration variable. */ | |||
966 | if (!INTEGRAL_TYPE_P (TREE_TYPE (decl))(((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 966, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE || ((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 966, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE || ((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 966, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE ) | |||
967 | && TREE_CODE (TREE_TYPE (decl))((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 967, __FUNCTION__))->typed.type))->base.code) != POINTER_TYPE) | |||
968 | { | |||
969 | error_at (elocus, "invalid type for iteration variable %qE", decl); | |||
970 | fail = true; | |||
971 | } | |||
972 | else if (TYPE_ATOMIC (TREE_TYPE (decl))((tree_class_check ((((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 972, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 972, __FUNCTION__))->base.u.bits.atomic_flag)) | |||
973 | { | |||
974 | error_at (elocus, "%<_Atomic%> iteration variable %qE", decl); | |||
975 | fail = true; | |||
976 | /* _Atomic iterator confuses stuff too much, so we risk ICE | |||
977 | trying to diagnose it further. */ | |||
978 | continue; | |||
979 | } | |||
980 | ||||
981 | /* In the case of "for (int i = 0...)", init will be a decl. It should | |||
982 | have a DECL_INITIAL that we can turn into an assignment. */ | |||
983 | if (init == decl) | |||
984 | { | |||
985 | elocus = DECL_SOURCE_LOCATION (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 985, __FUNCTION__))->decl_minimal.locus); | |||
986 | ||||
987 | init = DECL_INITIAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 987, __FUNCTION__))->decl_common.initial); | |||
988 | if (init == NULLnullptr) | |||
989 | { | |||
990 | error_at (elocus, "%qE is not initialized", decl); | |||
991 | init = integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]; | |||
992 | fail = true; | |||
993 | } | |||
994 | DECL_INITIAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 994, __FUNCTION__))->decl_common.initial) = NULL_TREE(tree) nullptr; | |||
995 | ||||
996 | init = build_modify_expr (elocus, decl, NULL_TREE(tree) nullptr, NOP_EXPR, | |||
997 | /* FIXME diagnostics: This should | |||
998 | be the location of the INIT. */ | |||
999 | elocus, | |||
1000 | init, | |||
1001 | NULL_TREE(tree) nullptr); | |||
1002 | } | |||
1003 | if (init != error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
1004 | { | |||
1005 | gcc_assert (TREE_CODE (init) == MODIFY_EXPR)((void)(!(((enum tree_code) (init)->base.code) == MODIFY_EXPR ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1005, __FUNCTION__), 0 : 0)); | |||
1006 | gcc_assert (TREE_OPERAND (init, 0) == decl)((void)(!((*((const_cast<tree*> (tree_operand_check ((init ), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1006, __FUNCTION__))))) == decl) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1006, __FUNCTION__), 0 : 0)); | |||
1007 | } | |||
1008 | ||||
1009 | if (cond == NULL_TREE(tree) nullptr) | |||
1010 | { | |||
1011 | error_at (elocus, "missing controlling predicate"); | |||
1012 | fail = true; | |||
1013 | } | |||
1014 | else | |||
1015 | { | |||
1016 | bool cond_ok = false; | |||
1017 | ||||
1018 | /* E.g. C sizeof (vla) could add COMPOUND_EXPRs with | |||
1019 | evaluation of the vla VAR_DECL. We need to readd | |||
1020 | them to the non-decl operand. See PR45784. */ | |||
1021 | while (TREE_CODE (cond)((enum tree_code) (cond)->base.code) == COMPOUND_EXPR) | |||
1022 | cond = TREE_OPERAND (cond, 1)(*((const_cast<tree*> (tree_operand_check ((cond), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1022, __FUNCTION__))))); | |||
1023 | ||||
1024 | if (EXPR_HAS_LOCATION (cond)(((IS_ADHOC_LOC (((((cond)) && ((tree_code_type_tmpl < 0>::tree_code_type[(int) (((enum tree_code) ((cond))->base .code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((cond))-> base.code))]) <= tcc_expression)) ? (cond)->exp.locus : ((location_t) 0)))) ? get_location_from_adhoc_loc (line_table , ((((cond)) && ((tree_code_type_tmpl <0>::tree_code_type [(int) (((enum tree_code) ((cond))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) ((cond))->base.code))]) <= tcc_expression )) ? (cond)->exp.locus : ((location_t) 0))) : (((((cond)) && ((tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((cond))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((cond))->base.code))]) <= tcc_expression)) ? (cond)->exp.locus : ((location_t) 0)))) != ((location_t ) 0))) | |||
1025 | elocus = EXPR_LOCATION (cond)((((cond)) && ((tree_code_type_tmpl <0>::tree_code_type [(int) (((enum tree_code) ((cond))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) ((cond))->base.code))]) <= tcc_expression )) ? (cond)->exp.locus : ((location_t) 0)); | |||
1026 | ||||
1027 | if (TREE_CODE (cond)((enum tree_code) (cond)->base.code) == LT_EXPR | |||
1028 | || TREE_CODE (cond)((enum tree_code) (cond)->base.code) == LE_EXPR | |||
1029 | || TREE_CODE (cond)((enum tree_code) (cond)->base.code) == GT_EXPR | |||
1030 | || TREE_CODE (cond)((enum tree_code) (cond)->base.code) == GE_EXPR | |||
1031 | || TREE_CODE (cond)((enum tree_code) (cond)->base.code) == NE_EXPR | |||
1032 | || TREE_CODE (cond)((enum tree_code) (cond)->base.code) == EQ_EXPR) | |||
1033 | { | |||
1034 | tree op0 = TREE_OPERAND (cond, 0)(*((const_cast<tree*> (tree_operand_check ((cond), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1034, __FUNCTION__))))); | |||
1035 | tree op1 = TREE_OPERAND (cond, 1)(*((const_cast<tree*> (tree_operand_check ((cond), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1035, __FUNCTION__))))); | |||
1036 | ||||
1037 | /* 2.5.1. The comparison in the condition is computed in | |||
1038 | the type of DECL, otherwise the behavior is undefined. | |||
1039 | ||||
1040 | For example: | |||
1041 | long n; int i; | |||
1042 | i < n; | |||
1043 | ||||
1044 | according to ISO will be evaluated as: | |||
1045 | (long)i < n; | |||
1046 | ||||
1047 | We want to force: | |||
1048 | i < (int)n; */ | |||
1049 | if (TREE_CODE (op0)((enum tree_code) (op0)->base.code) == NOP_EXPR | |||
1050 | && decl == TREE_OPERAND (op0, 0)(*((const_cast<tree*> (tree_operand_check ((op0), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1050, __FUNCTION__)))))) | |||
1051 | { | |||
1052 | TREE_OPERAND (cond, 0)(*((const_cast<tree*> (tree_operand_check ((cond), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1052, __FUNCTION__))))) = TREE_OPERAND (op0, 0)(*((const_cast<tree*> (tree_operand_check ((op0), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1052, __FUNCTION__))))); | |||
1053 | TREE_OPERAND (cond, 1)(*((const_cast<tree*> (tree_operand_check ((cond), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1053, __FUNCTION__))))) | |||
1054 | = fold_build1_loc (elocus, NOP_EXPR, TREE_TYPE (decl)((contains_struct_check ((decl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1054, __FUNCTION__))->typed.type), | |||
1055 | TREE_OPERAND (cond, 1)(*((const_cast<tree*> (tree_operand_check ((cond), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1055, __FUNCTION__)))))); | |||
1056 | } | |||
1057 | else if (TREE_CODE (op1)((enum tree_code) (op1)->base.code) == NOP_EXPR | |||
1058 | && decl == TREE_OPERAND (op1, 0)(*((const_cast<tree*> (tree_operand_check ((op1), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1058, __FUNCTION__)))))) | |||
1059 | { | |||
1060 | TREE_OPERAND (cond, 1)(*((const_cast<tree*> (tree_operand_check ((cond), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1060, __FUNCTION__))))) = TREE_OPERAND (op1, 0)(*((const_cast<tree*> (tree_operand_check ((op1), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1060, __FUNCTION__))))); | |||
1061 | TREE_OPERAND (cond, 0)(*((const_cast<tree*> (tree_operand_check ((cond), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1061, __FUNCTION__))))) | |||
1062 | = fold_build1_loc (elocus, NOP_EXPR, TREE_TYPE (decl)((contains_struct_check ((decl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1062, __FUNCTION__))->typed.type), | |||
1063 | TREE_OPERAND (cond, 0)(*((const_cast<tree*> (tree_operand_check ((cond), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1063, __FUNCTION__)))))); | |||
1064 | } | |||
1065 | ||||
1066 | if (decl == TREE_OPERAND (cond, 0)(*((const_cast<tree*> (tree_operand_check ((cond), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1066, __FUNCTION__)))))) | |||
1067 | cond_ok = true; | |||
1068 | else if (decl == TREE_OPERAND (cond, 1)(*((const_cast<tree*> (tree_operand_check ((cond), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1068, __FUNCTION__)))))) | |||
1069 | { | |||
1070 | TREE_SET_CODE (cond,((cond)->base.code = (swap_tree_comparison (((enum tree_code ) (cond)->base.code)))) | |||
1071 | swap_tree_comparison (TREE_CODE (cond)))((cond)->base.code = (swap_tree_comparison (((enum tree_code ) (cond)->base.code)))); | |||
1072 | TREE_OPERAND (cond, 1)(*((const_cast<tree*> (tree_operand_check ((cond), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1072, __FUNCTION__))))) = TREE_OPERAND (cond, 0)(*((const_cast<tree*> (tree_operand_check ((cond), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1072, __FUNCTION__))))); | |||
1073 | TREE_OPERAND (cond, 0)(*((const_cast<tree*> (tree_operand_check ((cond), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1073, __FUNCTION__))))) = decl; | |||
1074 | cond_ok = true; | |||
1075 | } | |||
1076 | ||||
1077 | if (TREE_CODE (cond)((enum tree_code) (cond)->base.code) == NE_EXPR | |||
1078 | || TREE_CODE (cond)((enum tree_code) (cond)->base.code) == EQ_EXPR) | |||
1079 | { | |||
1080 | if (!INTEGRAL_TYPE_P (TREE_TYPE (decl))(((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1080, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE || ((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1080, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE || ((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1080, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE )) | |||
1081 | { | |||
1082 | if (code == OACC_LOOP || TREE_CODE (cond)((enum tree_code) (cond)->base.code) == EQ_EXPR) | |||
1083 | cond_ok = false; | |||
1084 | } | |||
1085 | else if (operand_equal_p (TREE_OPERAND (cond, 1)(*((const_cast<tree*> (tree_operand_check ((cond), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1085, __FUNCTION__))))), | |||
1086 | TYPE_MIN_VALUE (TREE_TYPE (decl))((tree_check5 ((((contains_struct_check ((decl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1086, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1086, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.minval ), | |||
1087 | 0)) | |||
1088 | TREE_SET_CODE (cond, TREE_CODE (cond) == NE_EXPR((cond)->base.code = (((enum tree_code) (cond)->base.code ) == NE_EXPR ? GT_EXPR : LE_EXPR)) | |||
1089 | ? GT_EXPR : LE_EXPR)((cond)->base.code = (((enum tree_code) (cond)->base.code ) == NE_EXPR ? GT_EXPR : LE_EXPR)); | |||
1090 | else if (operand_equal_p (TREE_OPERAND (cond, 1)(*((const_cast<tree*> (tree_operand_check ((cond), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1090, __FUNCTION__))))), | |||
1091 | TYPE_MAX_VALUE (TREE_TYPE (decl))((tree_check5 ((((contains_struct_check ((decl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1091, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1091, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval ), | |||
1092 | 0)) | |||
1093 | TREE_SET_CODE (cond, TREE_CODE (cond) == NE_EXPR((cond)->base.code = (((enum tree_code) (cond)->base.code ) == NE_EXPR ? LT_EXPR : GE_EXPR)) | |||
1094 | ? LT_EXPR : GE_EXPR)((cond)->base.code = (((enum tree_code) (cond)->base.code ) == NE_EXPR ? LT_EXPR : GE_EXPR)); | |||
1095 | else if (code == OACC_LOOP || TREE_CODE (cond)((enum tree_code) (cond)->base.code) == EQ_EXPR) | |||
1096 | cond_ok = false; | |||
1097 | } | |||
1098 | ||||
1099 | if (cond_ok && TREE_VEC_ELT (condv, i)(*((const_cast<tree *> (tree_vec_elt_check ((condv), (i ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1099, __FUNCTION__))))) != cond) | |||
1100 | { | |||
1101 | tree ce = NULL_TREE(tree) nullptr, *pce = &ce; | |||
1102 | tree type = TREE_TYPE (TREE_OPERAND (cond, 1))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check ((cond), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1102, __FUNCTION__)))))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1102, __FUNCTION__))->typed.type); | |||
1103 | for (tree c = TREE_VEC_ELT (condv, i)(*((const_cast<tree *> (tree_vec_elt_check ((condv), (i ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1103, __FUNCTION__))))); c != cond; | |||
1104 | c = TREE_OPERAND (c, 1)(*((const_cast<tree*> (tree_operand_check ((c), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1104, __FUNCTION__)))))) | |||
1105 | { | |||
1106 | *pce = build2 (COMPOUND_EXPR, type, TREE_OPERAND (c, 0)(*((const_cast<tree*> (tree_operand_check ((c), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1106, __FUNCTION__))))), | |||
1107 | TREE_OPERAND (cond, 1)(*((const_cast<tree*> (tree_operand_check ((cond), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1107, __FUNCTION__)))))); | |||
1108 | pce = &TREE_OPERAND (*pce, 1)(*((const_cast<tree*> (tree_operand_check ((*pce), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1108, __FUNCTION__))))); | |||
1109 | } | |||
1110 | TREE_OPERAND (cond, 1)(*((const_cast<tree*> (tree_operand_check ((cond), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1110, __FUNCTION__))))) = ce; | |||
1111 | TREE_VEC_ELT (condv, i)(*((const_cast<tree *> (tree_vec_elt_check ((condv), (i ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1111, __FUNCTION__))))) = cond; | |||
1112 | } | |||
1113 | } | |||
1114 | ||||
1115 | if (!cond_ok) | |||
1116 | { | |||
1117 | error_at (elocus, "invalid controlling predicate"); | |||
1118 | fail = true; | |||
1119 | } | |||
1120 | } | |||
1121 | ||||
1122 | if (incr == NULL_TREE(tree) nullptr) | |||
1123 | { | |||
1124 | error_at (elocus, "missing increment expression"); | |||
1125 | fail = true; | |||
1126 | } | |||
1127 | else | |||
1128 | { | |||
1129 | bool incr_ok = false; | |||
1130 | ||||
1131 | if (EXPR_HAS_LOCATION (incr)(((IS_ADHOC_LOC (((((incr)) && ((tree_code_type_tmpl < 0>::tree_code_type[(int) (((enum tree_code) ((incr))->base .code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((incr))-> base.code))]) <= tcc_expression)) ? (incr)->exp.locus : ((location_t) 0)))) ? get_location_from_adhoc_loc (line_table , ((((incr)) && ((tree_code_type_tmpl <0>::tree_code_type [(int) (((enum tree_code) ((incr))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) ((incr))->base.code))]) <= tcc_expression )) ? (incr)->exp.locus : ((location_t) 0))) : (((((incr)) && ((tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((incr))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) ((incr))->base.code))]) <= tcc_expression)) ? (incr)->exp.locus : ((location_t) 0)))) != ((location_t ) 0))) | |||
1132 | elocus = EXPR_LOCATION (incr)((((incr)) && ((tree_code_type_tmpl <0>::tree_code_type [(int) (((enum tree_code) ((incr))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) ((incr))->base.code))]) <= tcc_expression )) ? (incr)->exp.locus : ((location_t) 0)); | |||
1133 | ||||
1134 | /* Check all the valid increment expressions: v++, v--, ++v, --v, | |||
1135 | v = v + incr, v = incr + v and v = v - incr. */ | |||
1136 | switch (TREE_CODE (incr)((enum tree_code) (incr)->base.code)) | |||
1137 | { | |||
1138 | case POSTINCREMENT_EXPR: | |||
1139 | case PREINCREMENT_EXPR: | |||
1140 | case POSTDECREMENT_EXPR: | |||
1141 | case PREDECREMENT_EXPR: | |||
1142 | if (TREE_OPERAND (incr, 0)(*((const_cast<tree*> (tree_operand_check ((incr), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1142, __FUNCTION__))))) != decl) | |||
1143 | break; | |||
1144 | ||||
1145 | incr_ok = true; | |||
1146 | if (!fail | |||
1147 | && TREE_CODE (cond)((enum tree_code) (cond)->base.code) == NE_EXPR | |||
1148 | && TREE_CODE (TREE_TYPE (decl))((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1148, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE | |||
1149 | && TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (decl)))((tree_class_check ((((contains_struct_check ((((contains_struct_check ((decl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1149, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1149, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1149, __FUNCTION__))->type_common.size_unit) | |||
1150 | && (TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (decl))))((enum tree_code) (((tree_class_check ((((contains_struct_check ((((contains_struct_check ((decl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1150, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1150, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1150, __FUNCTION__))->type_common.size_unit))->base.code ) | |||
1151 | != INTEGER_CST)) | |||
1152 | { | |||
1153 | /* For pointer to VLA, transform != into < or > | |||
1154 | depending on whether incr is increment or decrement. */ | |||
1155 | if (TREE_CODE (incr)((enum tree_code) (incr)->base.code) == PREINCREMENT_EXPR | |||
1156 | || TREE_CODE (incr)((enum tree_code) (incr)->base.code) == POSTINCREMENT_EXPR) | |||
1157 | TREE_SET_CODE (cond, LT_EXPR)((cond)->base.code = (LT_EXPR)); | |||
1158 | else | |||
1159 | TREE_SET_CODE (cond, GT_EXPR)((cond)->base.code = (GT_EXPR)); | |||
1160 | } | |||
1161 | incr = c_omp_for_incr_canonicalize_ptr (elocus, decl, incr); | |||
1162 | break; | |||
1163 | ||||
1164 | case COMPOUND_EXPR: | |||
1165 | if (TREE_CODE (TREE_OPERAND (incr, 0))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check ((incr), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1165, __FUNCTION__))))))->base.code) != SAVE_EXPR | |||
1166 | || TREE_CODE (TREE_OPERAND (incr, 1))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check ((incr), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1166, __FUNCTION__))))))->base.code) != MODIFY_EXPR) | |||
1167 | break; | |||
1168 | incr = TREE_OPERAND (incr, 1)(*((const_cast<tree*> (tree_operand_check ((incr), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1168, __FUNCTION__))))); | |||
1169 | /* FALLTHRU */ | |||
1170 | case MODIFY_EXPR: | |||
1171 | if (TREE_OPERAND (incr, 0)(*((const_cast<tree*> (tree_operand_check ((incr), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1171, __FUNCTION__))))) != decl) | |||
1172 | break; | |||
1173 | if (TREE_OPERAND (incr, 1)(*((const_cast<tree*> (tree_operand_check ((incr), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1173, __FUNCTION__))))) == decl) | |||
1174 | break; | |||
1175 | if (TREE_CODE (TREE_OPERAND (incr, 1))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check ((incr), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1175, __FUNCTION__))))))->base.code) == PLUS_EXPR | |||
1176 | && (TREE_OPERAND (TREE_OPERAND (incr, 1), 0)(*((const_cast<tree*> (tree_operand_check (((*((const_cast <tree*> (tree_operand_check ((incr), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1176, __FUNCTION__)))))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1176, __FUNCTION__))))) == decl | |||
1177 | || TREE_OPERAND (TREE_OPERAND (incr, 1), 1)(*((const_cast<tree*> (tree_operand_check (((*((const_cast <tree*> (tree_operand_check ((incr), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1177, __FUNCTION__)))))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1177, __FUNCTION__))))) == decl)) | |||
1178 | incr_ok = true; | |||
1179 | else if ((TREE_CODE (TREE_OPERAND (incr, 1))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check ((incr), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1179, __FUNCTION__))))))->base.code) == MINUS_EXPR | |||
1180 | || (TREE_CODE (TREE_OPERAND (incr, 1))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check ((incr), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1180, __FUNCTION__))))))->base.code) | |||
1181 | == POINTER_PLUS_EXPR)) | |||
1182 | && TREE_OPERAND (TREE_OPERAND (incr, 1), 0)(*((const_cast<tree*> (tree_operand_check (((*((const_cast <tree*> (tree_operand_check ((incr), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1182, __FUNCTION__)))))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1182, __FUNCTION__))))) == decl) | |||
1183 | incr_ok = true; | |||
1184 | else | |||
1185 | { | |||
1186 | tree t = check_omp_for_incr_expr (elocus, | |||
1187 | TREE_OPERAND (incr, 1)(*((const_cast<tree*> (tree_operand_check ((incr), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1187, __FUNCTION__))))), | |||
1188 | decl); | |||
1189 | if (t != error_mark_nodeglobal_trees[TI_ERROR_MARK]) | |||
1190 | { | |||
1191 | incr_ok = true; | |||
1192 | t = build2 (PLUS_EXPR, TREE_TYPE (decl)((contains_struct_check ((decl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1192, __FUNCTION__))->typed.type), decl, t); | |||
1193 | incr = build2 (MODIFY_EXPR, void_type_nodeglobal_trees[TI_VOID_TYPE], decl, t); | |||
1194 | } | |||
1195 | } | |||
1196 | if (!fail | |||
1197 | && incr_ok | |||
1198 | && TREE_CODE (cond)((enum tree_code) (cond)->base.code) == NE_EXPR) | |||
1199 | { | |||
1200 | tree i = TREE_OPERAND (incr, 1)(*((const_cast<tree*> (tree_operand_check ((incr), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1200, __FUNCTION__))))); | |||
1201 | i = TREE_OPERAND (i, TREE_OPERAND (i, 0) == decl)(*((const_cast<tree*> (tree_operand_check ((i), ((*((const_cast <tree*> (tree_operand_check ((i), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1201, __FUNCTION__))))) == decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1201, __FUNCTION__))))); | |||
1202 | i = c_fully_fold (i, false, NULLnullptr); | |||
1203 | if (!final_p | |||
1204 | && TREE_CODE (i)((enum tree_code) (i)->base.code) != INTEGER_CST) | |||
1205 | ; | |||
1206 | else if (TREE_CODE (TREE_TYPE (decl))((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1206, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE) | |||
1207 | { | |||
1208 | tree unit | |||
1209 | = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (decl)))((tree_class_check ((((contains_struct_check ((((contains_struct_check ((decl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1209, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1209, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1209, __FUNCTION__))->type_common.size_unit); | |||
1210 | if (unit) | |||
1211 | { | |||
1212 | enum tree_code ccode = GT_EXPR; | |||
1213 | unit = c_fully_fold (unit, false, NULLnullptr); | |||
1214 | i = fold_convert (TREE_TYPE (unit), i)fold_convert_loc (((location_t) 0), ((contains_struct_check ( (unit), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1214, __FUNCTION__))->typed.type), i); | |||
1215 | if (operand_equal_p (unit, i, 0)) | |||
1216 | ccode = LT_EXPR; | |||
1217 | if (ccode == GT_EXPR) | |||
1218 | { | |||
1219 | i = fold_unary (NEGATE_EXPR, TREE_TYPE (i), i)fold_unary_loc (((location_t) 0), NEGATE_EXPR, ((contains_struct_check ((i), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1219, __FUNCTION__))->typed.type), i); | |||
1220 | if (i == NULL_TREE(tree) nullptr | |||
1221 | || !operand_equal_p (unit, i, 0)) | |||
1222 | { | |||
1223 | error_at (elocus, | |||
1224 | "increment is not constant 1 or " | |||
1225 | "-1 for %<!=%> condition"); | |||
1226 | fail = true; | |||
1227 | } | |||
1228 | } | |||
1229 | if (TREE_CODE (unit)((enum tree_code) (unit)->base.code) != INTEGER_CST) | |||
1230 | /* For pointer to VLA, transform != into < or > | |||
1231 | depending on whether the pointer is | |||
1232 | incremented or decremented in each | |||
1233 | iteration. */ | |||
1234 | TREE_SET_CODE (cond, ccode)((cond)->base.code = (ccode)); | |||
1235 | } | |||
1236 | } | |||
1237 | else | |||
1238 | { | |||
1239 | if (!integer_onep (i) && !integer_minus_onep (i)) | |||
1240 | { | |||
1241 | error_at (elocus, | |||
1242 | "increment is not constant 1 or -1 for" | |||
1243 | " %<!=%> condition"); | |||
1244 | fail = true; | |||
1245 | } | |||
1246 | } | |||
1247 | } | |||
1248 | break; | |||
1249 | ||||
1250 | default: | |||
1251 | break; | |||
1252 | } | |||
1253 | if (!incr_ok) | |||
1254 | { | |||
1255 | error_at (elocus, "invalid increment expression"); | |||
1256 | fail = true; | |||
1257 | } | |||
1258 | } | |||
1259 | ||||
1260 | TREE_VEC_ELT (initv, i)(*((const_cast<tree *> (tree_vec_elt_check ((initv), (i ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1260, __FUNCTION__))))) = init; | |||
1261 | TREE_VEC_ELT (incrv, i)(*((const_cast<tree *> (tree_vec_elt_check ((incrv), (i ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1261, __FUNCTION__))))) = incr; | |||
1262 | } | |||
1263 | ||||
1264 | if (fail) | |||
1265 | return NULLnullptr; | |||
1266 | else | |||
1267 | { | |||
1268 | tree t = make_node (code); | |||
1269 | ||||
1270 | TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1270, __FUNCTION__))->typed.type) = void_type_nodeglobal_trees[TI_VOID_TYPE]; | |||
1271 | OMP_FOR_INIT (t)(*((const_cast<tree*> (tree_operand_check (((tree_range_check ((t), (OMP_FOR), (OACC_LOOP), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1271, __FUNCTION__))), (2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1271, __FUNCTION__))))) = initv; | |||
1272 | OMP_FOR_COND (t)(*((const_cast<tree*> (tree_operand_check (((tree_range_check ((t), (OMP_FOR), (OACC_LOOP), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1272, __FUNCTION__))), (3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1272, __FUNCTION__))))) = condv; | |||
1273 | OMP_FOR_INCR (t)(*((const_cast<tree*> (tree_operand_check (((tree_range_check ((t), (OMP_FOR), (OACC_LOOP), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1273, __FUNCTION__))), (4), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1273, __FUNCTION__))))) = incrv; | |||
1274 | OMP_FOR_BODY (t)(*((const_cast<tree*> (tree_operand_check (((tree_range_check ((t), (OMP_FOR), (OACC_LOOP), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1274, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1274, __FUNCTION__))))) = body; | |||
1275 | OMP_FOR_PRE_BODY (t)(*((const_cast<tree*> (tree_operand_check (((tree_range_check ((t), (OMP_FOR), (OACC_LOOP), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1275, __FUNCTION__))), (5), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1275, __FUNCTION__))))) = pre_body; | |||
1276 | OMP_FOR_ORIG_DECLS (t)(*((const_cast<tree*> (tree_operand_check (((tree_range_check ((t), (OMP_FOR), (OACC_LOOP), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1276, __FUNCTION__))), (6), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1276, __FUNCTION__))))) = orig_declv; | |||
1277 | ||||
1278 | SET_EXPR_LOCATION (t, locus)(expr_check (((t)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1278, __FUNCTION__))->exp.locus = (locus); | |||
1279 | return t; | |||
1280 | } | |||
1281 | } | |||
1282 | ||||
1283 | /* Type for passing data in between c_omp_check_loop_iv and | |||
1284 | c_omp_check_loop_iv_r. */ | |||
1285 | ||||
1286 | struct c_omp_check_loop_iv_data | |||
1287 | { | |||
1288 | tree declv; | |||
1289 | bool fail; | |||
1290 | bool maybe_nonrect; | |||
1291 | location_t stmt_loc; | |||
1292 | location_t expr_loc; | |||
1293 | int kind; | |||
1294 | int idx; | |||
1295 | walk_tree_lh lh; | |||
1296 | hash_set<tree> *ppset; | |||
1297 | }; | |||
1298 | ||||
1299 | /* Return -1 if DECL is not a loop iterator in loop nest D, otherwise | |||
1300 | return the index of the loop in which it is an iterator. | |||
1301 | Return TREE_VEC_LENGTH (d->declv) if it is a C++ range for iterator. */ | |||
1302 | ||||
1303 | static int | |||
1304 | c_omp_is_loop_iterator (tree decl, struct c_omp_check_loop_iv_data *d) | |||
1305 | { | |||
1306 | for (int i = 0; i < TREE_VEC_LENGTH (d->declv)((tree_check ((d->declv), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1306, __FUNCTION__, (TREE_VEC)))->base.u.length); i++) | |||
1307 | if (decl == TREE_VEC_ELT (d->declv, i)(*((const_cast<tree *> (tree_vec_elt_check ((d->declv ), (i), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1307, __FUNCTION__))))) | |||
1308 | || (TREE_CODE (TREE_VEC_ELT (d->declv, i))((enum tree_code) ((*((const_cast<tree *> (tree_vec_elt_check ((d->declv), (i), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1308, __FUNCTION__))))))->base.code) == TREE_LIST | |||
1309 | && decl == TREE_PURPOSE (TREE_VEC_ELT (d->declv, i))((tree_check (((*((const_cast<tree *> (tree_vec_elt_check ((d->declv), (i), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1309, __FUNCTION__)))))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1309, __FUNCTION__, (TREE_LIST)))->list.purpose))) | |||
1310 | return i; | |||
1311 | else if (TREE_CODE (TREE_VEC_ELT (d->declv, i))((enum tree_code) ((*((const_cast<tree *> (tree_vec_elt_check ((d->declv), (i), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1311, __FUNCTION__))))))->base.code) == TREE_LIST | |||
1312 | && TREE_CHAIN (TREE_VEC_ELT (d->declv, i))((contains_struct_check (((*((const_cast<tree *> (tree_vec_elt_check ((d->declv), (i), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1312, __FUNCTION__)))))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1312, __FUNCTION__))->common.chain) | |||
1313 | && (TREE_CODE (TREE_CHAIN (TREE_VEC_ELT (d->declv, i)))((enum tree_code) (((contains_struct_check (((*((const_cast< tree *> (tree_vec_elt_check ((d->declv), (i), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1313, __FUNCTION__)))))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1313, __FUNCTION__))->common.chain))->base.code) | |||
1314 | == TREE_VEC)) | |||
1315 | for (int j = 2; | |||
1316 | j < TREE_VEC_LENGTH (TREE_CHAIN (TREE_VEC_ELT (d->declv, i)))((tree_check ((((contains_struct_check (((*((const_cast<tree *> (tree_vec_elt_check ((d->declv), (i), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1316, __FUNCTION__)))))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1316, __FUNCTION__))->common.chain)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1316, __FUNCTION__, (TREE_VEC)))->base.u.length); j++) | |||
1317 | if (decl == TREE_VEC_ELT (TREE_CHAIN (TREE_VEC_ELT (d->declv, i)), j)(*((const_cast<tree *> (tree_vec_elt_check ((((contains_struct_check (((*((const_cast<tree *> (tree_vec_elt_check ((d->declv ), (i), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1317, __FUNCTION__)))))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1317, __FUNCTION__))->common.chain)), (j), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1317, __FUNCTION__)))))) | |||
1318 | return TREE_VEC_LENGTH (d->declv)((tree_check ((d->declv), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1318, __FUNCTION__, (TREE_VEC)))->base.u.length); | |||
1319 | return -1; | |||
1320 | } | |||
1321 | ||||
1322 | /* Helper function called via walk_tree, to diagnose uses | |||
1323 | of associated loop IVs inside of lb, b and incr expressions | |||
1324 | of OpenMP loops. */ | |||
1325 | ||||
1326 | static tree | |||
1327 | c_omp_check_loop_iv_r (tree *tp, int *walk_subtrees, void *data) | |||
1328 | { | |||
1329 | struct c_omp_check_loop_iv_data *d | |||
1330 | = (struct c_omp_check_loop_iv_data *) data; | |||
1331 | if (DECL_P (*tp)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (*tp)->base.code))] == tcc_declaration)) | |||
1332 | { | |||
1333 | int idx = c_omp_is_loop_iterator (*tp, d); | |||
1334 | if (idx == -1) | |||
1335 | return NULL_TREE(tree) nullptr; | |||
1336 | ||||
1337 | if ((d->kind & 4) && idx < d->idx) | |||
1338 | { | |||
1339 | d->maybe_nonrect = true; | |||
1340 | return NULL_TREE(tree) nullptr; | |||
1341 | } | |||
1342 | ||||
1343 | if (d->ppset->add (*tp)) | |||
1344 | return NULL_TREE(tree) nullptr; | |||
1345 | ||||
1346 | location_t loc = d->expr_loc; | |||
1347 | if (loc == UNKNOWN_LOCATION((location_t) 0)) | |||
1348 | loc = d->stmt_loc; | |||
1349 | ||||
1350 | switch (d->kind & 3) | |||
1351 | { | |||
1352 | case 0: | |||
1353 | error_at (loc, "initializer expression refers to " | |||
1354 | "iteration variable %qD", *tp); | |||
1355 | break; | |||
1356 | case 1: | |||
1357 | error_at (loc, "condition expression refers to " | |||
1358 | "iteration variable %qD", *tp); | |||
1359 | break; | |||
1360 | case 2: | |||
1361 | error_at (loc, "increment expression refers to " | |||
1362 | "iteration variable %qD", *tp); | |||
1363 | break; | |||
1364 | } | |||
1365 | d->fail = true; | |||
1366 | } | |||
1367 | else if ((d->kind & 4) | |||
1368 | && TREE_CODE (*tp)((enum tree_code) (*tp)->base.code) != TREE_VEC | |||
1369 | && TREE_CODE (*tp)((enum tree_code) (*tp)->base.code) != PLUS_EXPR | |||
1370 | && TREE_CODE (*tp)((enum tree_code) (*tp)->base.code) != MINUS_EXPR | |||
1371 | && TREE_CODE (*tp)((enum tree_code) (*tp)->base.code) != MULT_EXPR | |||
1372 | && TREE_CODE (*tp)((enum tree_code) (*tp)->base.code) != POINTER_PLUS_EXPR | |||
1373 | && !CONVERT_EXPR_P (*tp)((((enum tree_code) (*tp)->base.code)) == NOP_EXPR || (((enum tree_code) (*tp)->base.code)) == CONVERT_EXPR)) | |||
1374 | { | |||
1375 | *walk_subtrees = 0; | |||
1376 | d->kind &= 3; | |||
1377 | walk_tree_1 (tp, c_omp_check_loop_iv_r, data, NULLnullptr, d->lh); | |||
1378 | d->kind |= 4; | |||
1379 | return NULL_TREE(tree) nullptr; | |||
1380 | } | |||
1381 | else if (d->ppset->add (*tp)) | |||
1382 | *walk_subtrees = 0; | |||
1383 | /* Don't walk dtors added by C++ wrap_cleanups_r. */ | |||
1384 | else if (TREE_CODE (*tp)((enum tree_code) (*tp)->base.code) == TRY_CATCH_EXPR | |||
1385 | && TRY_CATCH_IS_CLEANUP (*tp)((tree_check ((*tp), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1385, __FUNCTION__, (TRY_CATCH_EXPR)))->base.static_flag )) | |||
1386 | { | |||
1387 | *walk_subtrees = 0; | |||
1388 | return walk_tree_1 (&TREE_OPERAND (*tp, 0)(*((const_cast<tree*> (tree_operand_check ((*tp), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1388, __FUNCTION__))))), c_omp_check_loop_iv_r, data, | |||
1389 | NULLnullptr, d->lh); | |||
1390 | } | |||
1391 | ||||
1392 | return NULL_TREE(tree) nullptr; | |||
1393 | } | |||
1394 | ||||
1395 | /* Check the allowed expressions for non-rectangular loop nest lb and b | |||
1396 | expressions. Return the outer var decl referenced in the expression. */ | |||
1397 | ||||
1398 | static tree | |||
1399 | c_omp_check_nonrect_loop_iv (tree *tp, struct c_omp_check_loop_iv_data *d, | |||
1400 | walk_tree_lh lh) | |||
1401 | { | |||
1402 | d->maybe_nonrect = false; | |||
1403 | if (d->fail) | |||
1404 | return NULL_TREE(tree) nullptr; | |||
1405 | ||||
1406 | hash_set<tree> pset; | |||
1407 | hash_set<tree> *ppset = d->ppset; | |||
1408 | d->ppset = &pset; | |||
1409 | ||||
1410 | tree t = *tp; | |||
1411 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) == TREE_VEC | |||
1412 | && TREE_VEC_LENGTH (t)((tree_check ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1412, __FUNCTION__, (TREE_VEC)))->base.u.length) == 3 | |||
1413 | && DECL_P (TREE_VEC_ELT (t, 0))(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) ((*((const_cast<tree *> (tree_vec_elt_check ((t), (0) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1413, __FUNCTION__))))))->base.code))] == tcc_declaration ) | |||
1414 | && c_omp_is_loop_iterator (TREE_VEC_ELT (t, 0)(*((const_cast<tree *> (tree_vec_elt_check ((t), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1414, __FUNCTION__))))), d) >= 0) | |||
1415 | { | |||
1416 | d->kind &= 3; | |||
1417 | walk_tree_1 (&TREE_VEC_ELT (t, 1)(*((const_cast<tree *> (tree_vec_elt_check ((t), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1417, __FUNCTION__))))), c_omp_check_loop_iv_r, d, NULLnullptr, lh); | |||
1418 | walk_tree_1 (&TREE_VEC_ELT (t, 1)(*((const_cast<tree *> (tree_vec_elt_check ((t), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1418, __FUNCTION__))))), c_omp_check_loop_iv_r, d, NULLnullptr, lh); | |||
1419 | d->ppset = ppset; | |||
1420 | return d->fail ? NULL_TREE(tree) nullptr : TREE_VEC_ELT (t, 0)(*((const_cast<tree *> (tree_vec_elt_check ((t), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1420, __FUNCTION__))))); | |||
1421 | } | |||
1422 | ||||
1423 | while (CONVERT_EXPR_P (t)((((enum tree_code) (t)->base.code)) == NOP_EXPR || (((enum tree_code) (t)->base.code)) == CONVERT_EXPR)) | |||
1424 | t = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1424, __FUNCTION__))))); | |||
1425 | ||||
1426 | tree a1 = t, a2 = integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]; | |||
1427 | bool neg_a1 = false, neg_a2 = false; | |||
1428 | switch (TREE_CODE (t)((enum tree_code) (t)->base.code)) | |||
1429 | { | |||
1430 | case PLUS_EXPR: | |||
1431 | case MINUS_EXPR: | |||
1432 | a1 = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1432, __FUNCTION__))))); | |||
1433 | a2 = TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1433, __FUNCTION__))))); | |||
1434 | while (CONVERT_EXPR_P (a1)((((enum tree_code) (a1)->base.code)) == NOP_EXPR || (((enum tree_code) (a1)->base.code)) == CONVERT_EXPR)) | |||
1435 | a1 = TREE_OPERAND (a1, 0)(*((const_cast<tree*> (tree_operand_check ((a1), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1435, __FUNCTION__))))); | |||
1436 | while (CONVERT_EXPR_P (a2)((((enum tree_code) (a2)->base.code)) == NOP_EXPR || (((enum tree_code) (a2)->base.code)) == CONVERT_EXPR)) | |||
1437 | a2 = TREE_OPERAND (a2, 0)(*((const_cast<tree*> (tree_operand_check ((a2), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1437, __FUNCTION__))))); | |||
1438 | if (DECL_P (a1)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (a1)->base.code))] == tcc_declaration) && c_omp_is_loop_iterator (a1, d) >= 0) | |||
1439 | { | |||
1440 | a2 = TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1440, __FUNCTION__))))); | |||
1441 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) == MINUS_EXPR) | |||
1442 | neg_a2 = true; | |||
1443 | t = a1; | |||
1444 | break; | |||
1445 | } | |||
1446 | if (DECL_P (a2)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (a2)->base.code))] == tcc_declaration) && c_omp_is_loop_iterator (a2, d) >= 0) | |||
1447 | { | |||
1448 | a1 = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1448, __FUNCTION__))))); | |||
1449 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) == MINUS_EXPR) | |||
1450 | neg_a1 = true; | |||
1451 | t = a2; | |||
1452 | a2 = a1; | |||
1453 | break; | |||
1454 | } | |||
1455 | if (TREE_CODE (a1)((enum tree_code) (a1)->base.code) == MULT_EXPR && TREE_CODE (a2)((enum tree_code) (a2)->base.code) == MULT_EXPR) | |||
1456 | { | |||
1457 | tree o1 = TREE_OPERAND (a1, 0)(*((const_cast<tree*> (tree_operand_check ((a1), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1457, __FUNCTION__))))); | |||
1458 | tree o2 = TREE_OPERAND (a1, 1)(*((const_cast<tree*> (tree_operand_check ((a1), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1458, __FUNCTION__))))); | |||
1459 | while (CONVERT_EXPR_P (o1)((((enum tree_code) (o1)->base.code)) == NOP_EXPR || (((enum tree_code) (o1)->base.code)) == CONVERT_EXPR)) | |||
1460 | o1 = TREE_OPERAND (o1, 0)(*((const_cast<tree*> (tree_operand_check ((o1), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1460, __FUNCTION__))))); | |||
1461 | while (CONVERT_EXPR_P (o2)((((enum tree_code) (o2)->base.code)) == NOP_EXPR || (((enum tree_code) (o2)->base.code)) == CONVERT_EXPR)) | |||
1462 | o2 = TREE_OPERAND (o2, 0)(*((const_cast<tree*> (tree_operand_check ((o2), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1462, __FUNCTION__))))); | |||
1463 | if ((DECL_P (o1)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (o1)->base.code))] == tcc_declaration) && c_omp_is_loop_iterator (o1, d) >= 0) | |||
1464 | || (DECL_P (o2)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (o2)->base.code))] == tcc_declaration) && c_omp_is_loop_iterator (o2, d) >= 0)) | |||
1465 | { | |||
1466 | a2 = TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1466, __FUNCTION__))))); | |||
1467 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) == MINUS_EXPR) | |||
1468 | neg_a2 = true; | |||
1469 | t = a1; | |||
1470 | break; | |||
1471 | } | |||
1472 | } | |||
1473 | if (TREE_CODE (a2)((enum tree_code) (a2)->base.code) == MULT_EXPR) | |||
1474 | { | |||
1475 | a1 = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1475, __FUNCTION__))))); | |||
1476 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) == MINUS_EXPR) | |||
1477 | neg_a1 = true; | |||
1478 | t = a2; | |||
1479 | a2 = a1; | |||
1480 | break; | |||
1481 | } | |||
1482 | if (TREE_CODE (a1)((enum tree_code) (a1)->base.code) == MULT_EXPR) | |||
1483 | { | |||
1484 | a2 = TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1484, __FUNCTION__))))); | |||
1485 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) == MINUS_EXPR) | |||
1486 | neg_a2 = true; | |||
1487 | t = a1; | |||
1488 | break; | |||
1489 | } | |||
1490 | a2 = integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]; | |||
1491 | break; | |||
1492 | case POINTER_PLUS_EXPR: | |||
1493 | a1 = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1493, __FUNCTION__))))); | |||
1494 | a2 = TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1494, __FUNCTION__))))); | |||
1495 | while (CONVERT_EXPR_P (a1)((((enum tree_code) (a1)->base.code)) == NOP_EXPR || (((enum tree_code) (a1)->base.code)) == CONVERT_EXPR)) | |||
1496 | a1 = TREE_OPERAND (a1, 0)(*((const_cast<tree*> (tree_operand_check ((a1), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1496, __FUNCTION__))))); | |||
1497 | if (DECL_P (a1)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (a1)->base.code))] == tcc_declaration) && c_omp_is_loop_iterator (a1, d) >= 0) | |||
1498 | { | |||
1499 | a2 = TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1499, __FUNCTION__))))); | |||
1500 | t = a1; | |||
1501 | break; | |||
1502 | } | |||
1503 | break; | |||
1504 | default: | |||
1505 | break; | |||
1506 | } | |||
1507 | ||||
1508 | a1 = integer_one_nodeglobal_trees[TI_INTEGER_ONE]; | |||
1509 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) == MULT_EXPR) | |||
1510 | { | |||
1511 | tree o1 = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1511, __FUNCTION__))))); | |||
1512 | tree o2 = TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1512, __FUNCTION__))))); | |||
1513 | while (CONVERT_EXPR_P (o1)((((enum tree_code) (o1)->base.code)) == NOP_EXPR || (((enum tree_code) (o1)->base.code)) == CONVERT_EXPR)) | |||
1514 | o1 = TREE_OPERAND (o1, 0)(*((const_cast<tree*> (tree_operand_check ((o1), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1514, __FUNCTION__))))); | |||
1515 | while (CONVERT_EXPR_P (o2)((((enum tree_code) (o2)->base.code)) == NOP_EXPR || (((enum tree_code) (o2)->base.code)) == CONVERT_EXPR)) | |||
1516 | o2 = TREE_OPERAND (o2, 0)(*((const_cast<tree*> (tree_operand_check ((o2), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1516, __FUNCTION__))))); | |||
1517 | if (DECL_P (o1)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (o1)->base.code))] == tcc_declaration) && c_omp_is_loop_iterator (o1, d) >= 0) | |||
1518 | { | |||
1519 | a1 = TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1519, __FUNCTION__))))); | |||
1520 | t = o1; | |||
1521 | } | |||
1522 | else if (DECL_P (o2)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (o2)->base.code))] == tcc_declaration) && c_omp_is_loop_iterator (o2, d) >= 0) | |||
1523 | { | |||
1524 | a1 = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1524, __FUNCTION__))))); | |||
1525 | t = o2; | |||
1526 | } | |||
1527 | } | |||
1528 | ||||
1529 | d->kind &= 3; | |||
1530 | tree ret = NULL_TREE(tree) nullptr; | |||
1531 | if (DECL_P (t)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (t)->base.code))] == tcc_declaration) && c_omp_is_loop_iterator (t, d) >= 0) | |||
1532 | { | |||
1533 | location_t loc = d->expr_loc; | |||
1534 | if (loc == UNKNOWN_LOCATION((location_t) 0)) | |||
1535 | loc = d->stmt_loc; | |||
1536 | if (!lang_hooks.types_compatible_p (TREE_TYPE (*tp)((contains_struct_check ((*tp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1536, __FUNCTION__))->typed.type), TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1536, __FUNCTION__))->typed.type))) | |||
1537 | { | |||
1538 | if (d->kind == 0) | |||
1539 | error_at (loc, "outer iteration variable %qD used in initializer" | |||
1540 | " expression has type other than %qT", | |||
1541 | t, TREE_TYPE (*tp)((contains_struct_check ((*tp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1541, __FUNCTION__))->typed.type)); | |||
1542 | else | |||
1543 | error_at (loc, "outer iteration variable %qD used in condition" | |||
1544 | " expression has type other than %qT", | |||
1545 | t, TREE_TYPE (*tp)((contains_struct_check ((*tp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1545, __FUNCTION__))->typed.type)); | |||
1546 | d->fail = true; | |||
1547 | } | |||
1548 | else if (!INTEGRAL_TYPE_P (TREE_TYPE (a1))(((enum tree_code) (((contains_struct_check ((a1), (TS_TYPED) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1548, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE || ((enum tree_code) (((contains_struct_check ((a1), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1548, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE || ((enum tree_code) (((contains_struct_check ((a1), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1548, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE )) | |||
1549 | { | |||
1550 | error_at (loc, "outer iteration variable %qD multiplier expression" | |||
1551 | " %qE is not integral", t, a1); | |||
1552 | d->fail = true; | |||
1553 | } | |||
1554 | else if (!INTEGRAL_TYPE_P (TREE_TYPE (a2))(((enum tree_code) (((contains_struct_check ((a2), (TS_TYPED) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1554, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE || ((enum tree_code) (((contains_struct_check ((a2), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1554, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE || ((enum tree_code) (((contains_struct_check ((a2), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1554, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE )) | |||
1555 | { | |||
1556 | error_at (loc, "outer iteration variable %qD addend expression" | |||
1557 | " %qE is not integral", t, a2); | |||
1558 | d->fail = true; | |||
1559 | } | |||
1560 | else | |||
1561 | { | |||
1562 | walk_tree_1 (&a1, c_omp_check_loop_iv_r, d, NULLnullptr, lh); | |||
1563 | walk_tree_1 (&a2, c_omp_check_loop_iv_r, d, NULLnullptr, lh); | |||
1564 | } | |||
1565 | if (!d->fail) | |||
1566 | { | |||
1567 | a1 = fold_convert (TREE_TYPE (*tp), a1)fold_convert_loc (((location_t) 0), ((contains_struct_check ( (*tp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1567, __FUNCTION__))->typed.type), a1); | |||
1568 | a2 = fold_convert (TREE_TYPE (*tp), a2)fold_convert_loc (((location_t) 0), ((contains_struct_check ( (*tp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1568, __FUNCTION__))->typed.type), a2); | |||
1569 | if (neg_a1) | |||
1570 | a1 = fold_build1 (NEGATE_EXPR, TREE_TYPE (a1), a1)fold_build1_loc (((location_t) 0), NEGATE_EXPR, ((contains_struct_check ((a1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1570, __FUNCTION__))->typed.type), a1 ); | |||
1571 | if (neg_a2) | |||
1572 | a2 = fold_build1 (NEGATE_EXPR, TREE_TYPE (a2), a2)fold_build1_loc (((location_t) 0), NEGATE_EXPR, ((contains_struct_check ((a2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1572, __FUNCTION__))->typed.type), a2 ); | |||
1573 | ret = t; | |||
1574 | *tp = make_tree_vec (3); | |||
1575 | TREE_VEC_ELT (*tp, 0)(*((const_cast<tree *> (tree_vec_elt_check ((*tp), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1575, __FUNCTION__))))) = t; | |||
1576 | TREE_VEC_ELT (*tp, 1)(*((const_cast<tree *> (tree_vec_elt_check ((*tp), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1576, __FUNCTION__))))) = a1; | |||
1577 | TREE_VEC_ELT (*tp, 2)(*((const_cast<tree *> (tree_vec_elt_check ((*tp), (2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1577, __FUNCTION__))))) = a2; | |||
1578 | } | |||
1579 | } | |||
1580 | else | |||
1581 | walk_tree_1 (&t, c_omp_check_loop_iv_r, d, NULLnullptr, lh); | |||
1582 | ||||
1583 | d->ppset = ppset; | |||
1584 | return ret; | |||
1585 | } | |||
1586 | ||||
1587 | /* Diagnose invalid references to loop iterators in lb, b and incr | |||
1588 | expressions. */ | |||
1589 | ||||
1590 | bool | |||
1591 | c_omp_check_loop_iv (tree stmt, tree declv, walk_tree_lh lh) | |||
1592 | { | |||
1593 | hash_set<tree> pset; | |||
1594 | struct c_omp_check_loop_iv_data data; | |||
1595 | int i; | |||
1596 | ||||
1597 | data.declv = declv; | |||
1598 | data.fail = false; | |||
1599 | data.maybe_nonrect = false; | |||
1600 | data.stmt_loc = EXPR_LOCATION (stmt)((((stmt)) && ((tree_code_type_tmpl <0>::tree_code_type [(int) (((enum tree_code) ((stmt))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) ((stmt))->base.code))]) <= tcc_expression )) ? (stmt)->exp.locus : ((location_t) 0)); | |||
1601 | data.lh = lh; | |||
1602 | data.ppset = &pset; | |||
1603 | for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (stmt))((tree_check (((*((const_cast<tree*> (tree_operand_check (((tree_range_check ((stmt), (OMP_FOR), (OACC_LOOP), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1603, __FUNCTION__))), (2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1603, __FUNCTION__)))))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1603, __FUNCTION__, (TREE_VEC)))->base.u.length); i++) | |||
1604 | { | |||
1605 | tree init = TREE_VEC_ELT (OMP_FOR_INIT (stmt), i)(*((const_cast<tree *> (tree_vec_elt_check (((*((const_cast <tree*> (tree_operand_check (((tree_range_check ((stmt) , (OMP_FOR), (OACC_LOOP), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1605, __FUNCTION__))), (2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1605, __FUNCTION__)))))), (i), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1605, __FUNCTION__))))); | |||
1606 | gcc_assert (TREE_CODE (init) == MODIFY_EXPR)((void)(!(((enum tree_code) (init)->base.code) == MODIFY_EXPR ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1606, __FUNCTION__), 0 : 0)); | |||
1607 | tree decl = TREE_OPERAND (init, 0)(*((const_cast<tree*> (tree_operand_check ((init), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1607, __FUNCTION__))))); | |||
1608 | tree cond = TREE_VEC_ELT (OMP_FOR_COND (stmt), i)(*((const_cast<tree *> (tree_vec_elt_check (((*((const_cast <tree*> (tree_operand_check (((tree_range_check ((stmt) , (OMP_FOR), (OACC_LOOP), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1608, __FUNCTION__))), (3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1608, __FUNCTION__)))))), (i), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1608, __FUNCTION__))))); | |||
1609 | gcc_assert (COMPARISON_CLASS_P (cond))((void)(!((tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) (cond)->base.code))] == tcc_comparison )) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1609, __FUNCTION__), 0 : 0)); | |||
1610 | gcc_assert (TREE_OPERAND (cond, 0) == decl)((void)(!((*((const_cast<tree*> (tree_operand_check ((cond ), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1610, __FUNCTION__))))) == decl) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1610, __FUNCTION__), 0 : 0)); | |||
1611 | tree incr = TREE_VEC_ELT (OMP_FOR_INCR (stmt), i)(*((const_cast<tree *> (tree_vec_elt_check (((*((const_cast <tree*> (tree_operand_check (((tree_range_check ((stmt) , (OMP_FOR), (OACC_LOOP), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1611, __FUNCTION__))), (4), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1611, __FUNCTION__)))))), (i), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1611, __FUNCTION__))))); | |||
1612 | data.expr_loc = EXPR_LOCATION (TREE_OPERAND (init, 1))(((((*((const_cast<tree*> (tree_operand_check ((init), ( 1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1612, __FUNCTION__))))))) && ((tree_code_type_tmpl < 0>::tree_code_type[(int) (((enum tree_code) (((*((const_cast <tree*> (tree_operand_check ((init), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1612, __FUNCTION__)))))))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) (((*((const_cast<tree*> (tree_operand_check ((init), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1612, __FUNCTION__)))))))->base.code))]) <= tcc_expression )) ? ((*((const_cast<tree*> (tree_operand_check ((init) , (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1612, __FUNCTION__))))))->exp.locus : ((location_t) 0)); | |||
1613 | tree vec_outer1 = NULL_TREE(tree) nullptr, vec_outer2 = NULL_TREE(tree) nullptr; | |||
1614 | int kind = 0; | |||
1615 | if (i > 0 | |||
1616 | && (unsigned) c_omp_is_loop_iterator (decl, &data) < (unsigned) i) | |||
1617 | { | |||
1618 | location_t loc = data.expr_loc; | |||
1619 | if (loc == UNKNOWN_LOCATION((location_t) 0)) | |||
1620 | loc = data.stmt_loc; | |||
1621 | error_at (loc, "the same loop iteration variables %qD used in " | |||
1622 | "multiple associated loops", decl); | |||
1623 | data.fail = true; | |||
1624 | } | |||
1625 | /* Handle non-rectangular loop nests. */ | |||
1626 | if (TREE_CODE (stmt)((enum tree_code) (stmt)->base.code) != OACC_LOOP && i > 0) | |||
1627 | kind = 4; | |||
1628 | data.kind = kind; | |||
1629 | data.idx = i; | |||
1630 | walk_tree_1 (&TREE_OPERAND (init, 1)(*((const_cast<tree*> (tree_operand_check ((init), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1630, __FUNCTION__))))), | |||
1631 | c_omp_check_loop_iv_r, &data, NULLnullptr, lh); | |||
1632 | if (data.maybe_nonrect) | |||
1633 | vec_outer1 = c_omp_check_nonrect_loop_iv (&TREE_OPERAND (init, 1)(*((const_cast<tree*> (tree_operand_check ((init), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1633, __FUNCTION__))))), | |||
1634 | &data, lh); | |||
1635 | /* Don't warn for C++ random access iterators here, the | |||
1636 | expression then involves the subtraction and always refers | |||
1637 | to the original value. The C++ FE needs to warn on those | |||
1638 | earlier. */ | |||
1639 | if (decl == TREE_VEC_ELT (declv, i)(*((const_cast<tree *> (tree_vec_elt_check ((declv), (i ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1639, __FUNCTION__))))) | |||
1640 | || (TREE_CODE (TREE_VEC_ELT (declv, i))((enum tree_code) ((*((const_cast<tree *> (tree_vec_elt_check ((declv), (i), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1640, __FUNCTION__))))))->base.code) == TREE_LIST | |||
1641 | && decl == TREE_PURPOSE (TREE_VEC_ELT (declv, i))((tree_check (((*((const_cast<tree *> (tree_vec_elt_check ((declv), (i), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1641, __FUNCTION__)))))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1641, __FUNCTION__, (TREE_LIST)))->list.purpose))) | |||
1642 | { | |||
1643 | data.expr_loc = EXPR_LOCATION (cond)((((cond)) && ((tree_code_type_tmpl <0>::tree_code_type [(int) (((enum tree_code) ((cond))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) ((cond))->base.code))]) <= tcc_expression )) ? (cond)->exp.locus : ((location_t) 0)); | |||
1644 | data.kind = kind | 1; | |||
1645 | walk_tree_1 (&TREE_OPERAND (cond, 1)(*((const_cast<tree*> (tree_operand_check ((cond), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1645, __FUNCTION__))))), | |||
1646 | c_omp_check_loop_iv_r, &data, NULLnullptr, lh); | |||
1647 | if (data.maybe_nonrect) | |||
1648 | vec_outer2 = c_omp_check_nonrect_loop_iv (&TREE_OPERAND (cond, 1)(*((const_cast<tree*> (tree_operand_check ((cond), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1648, __FUNCTION__))))), | |||
1649 | &data, lh); | |||
1650 | } | |||
1651 | if (vec_outer1 && vec_outer2 && vec_outer1 != vec_outer2) | |||
1652 | { | |||
1653 | location_t loc = data.expr_loc; | |||
1654 | if (loc == UNKNOWN_LOCATION((location_t) 0)) | |||
1655 | loc = data.stmt_loc; | |||
1656 | error_at (loc, "two different outer iteration variables %qD and %qD" | |||
1657 | " used in a single loop", vec_outer1, vec_outer2); | |||
1658 | data.fail = true; | |||
1659 | } | |||
1660 | if (vec_outer1 || vec_outer2) | |||
1661 | OMP_FOR_NON_RECTANGULAR (stmt)((tree_range_check ((stmt), (OMP_FOR), (OACC_LOOP), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1661, __FUNCTION__))->base.private_flag) = 1; | |||
1662 | if (TREE_CODE (incr)((enum tree_code) (incr)->base.code) == MODIFY_EXPR) | |||
1663 | { | |||
1664 | gcc_assert (TREE_OPERAND (incr, 0) == decl)((void)(!((*((const_cast<tree*> (tree_operand_check ((incr ), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1664, __FUNCTION__))))) == decl) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1664, __FUNCTION__), 0 : 0)); | |||
1665 | incr = TREE_OPERAND (incr, 1)(*((const_cast<tree*> (tree_operand_check ((incr), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1665, __FUNCTION__))))); | |||
1666 | data.kind = 2; | |||
1667 | if (TREE_CODE (incr)((enum tree_code) (incr)->base.code) == PLUS_EXPR | |||
1668 | && TREE_OPERAND (incr, 1)(*((const_cast<tree*> (tree_operand_check ((incr), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1668, __FUNCTION__))))) == decl) | |||
1669 | { | |||
1670 | data.expr_loc = EXPR_LOCATION (TREE_OPERAND (incr, 0))(((((*((const_cast<tree*> (tree_operand_check ((incr), ( 0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1670, __FUNCTION__))))))) && ((tree_code_type_tmpl < 0>::tree_code_type[(int) (((enum tree_code) (((*((const_cast <tree*> (tree_operand_check ((incr), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1670, __FUNCTION__)))))))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) (((*((const_cast<tree*> (tree_operand_check ((incr), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1670, __FUNCTION__)))))))->base.code))]) <= tcc_expression )) ? ((*((const_cast<tree*> (tree_operand_check ((incr) , (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1670, __FUNCTION__))))))->exp.locus : ((location_t) 0)); | |||
1671 | walk_tree_1 (&TREE_OPERAND (incr, 0)(*((const_cast<tree*> (tree_operand_check ((incr), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1671, __FUNCTION__))))), | |||
1672 | c_omp_check_loop_iv_r, &data, NULLnullptr, lh); | |||
1673 | } | |||
1674 | else | |||
1675 | { | |||
1676 | data.expr_loc = EXPR_LOCATION (TREE_OPERAND (incr, 1))(((((*((const_cast<tree*> (tree_operand_check ((incr), ( 1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1676, __FUNCTION__))))))) && ((tree_code_type_tmpl < 0>::tree_code_type[(int) (((enum tree_code) (((*((const_cast <tree*> (tree_operand_check ((incr), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1676, __FUNCTION__)))))))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) (((*((const_cast<tree*> (tree_operand_check ((incr), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1676, __FUNCTION__)))))))->base.code))]) <= tcc_expression )) ? ((*((const_cast<tree*> (tree_operand_check ((incr) , (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1676, __FUNCTION__))))))->exp.locus : ((location_t) 0)); | |||
1677 | walk_tree_1 (&TREE_OPERAND (incr, 1)(*((const_cast<tree*> (tree_operand_check ((incr), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1677, __FUNCTION__))))), | |||
1678 | c_omp_check_loop_iv_r, &data, NULLnullptr, lh); | |||
1679 | } | |||
1680 | } | |||
1681 | } | |||
1682 | return !data.fail; | |||
1683 | } | |||
1684 | ||||
1685 | /* Similar, but allows to check the init or cond expressions individually. */ | |||
1686 | ||||
1687 | bool | |||
1688 | c_omp_check_loop_iv_exprs (location_t stmt_loc, enum tree_code code, | |||
1689 | tree declv, int i, tree decl, tree init, tree cond, | |||
1690 | walk_tree_lh lh) | |||
1691 | { | |||
1692 | hash_set<tree> pset; | |||
1693 | struct c_omp_check_loop_iv_data data; | |||
1694 | int kind = (code != OACC_LOOP && i > 0) ? 4 : 0; | |||
1695 | ||||
1696 | data.declv = declv; | |||
1697 | data.fail = false; | |||
1698 | data.maybe_nonrect = false; | |||
1699 | data.stmt_loc = stmt_loc; | |||
1700 | data.lh = lh; | |||
1701 | data.ppset = &pset; | |||
1702 | data.idx = i; | |||
1703 | if (i > 0 | |||
1704 | && (unsigned) c_omp_is_loop_iterator (decl, &data) < (unsigned) i) | |||
1705 | { | |||
1706 | error_at (stmt_loc, "the same loop iteration variables %qD used in " | |||
1707 | "multiple associated loops", decl); | |||
1708 | data.fail = true; | |||
1709 | } | |||
1710 | if (init) | |||
1711 | { | |||
1712 | data.expr_loc = EXPR_LOCATION (init)((((init)) && ((tree_code_type_tmpl <0>::tree_code_type [(int) (((enum tree_code) ((init))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) ((init))->base.code))]) <= tcc_expression )) ? (init)->exp.locus : ((location_t) 0)); | |||
1713 | data.kind = kind; | |||
1714 | walk_tree_1 (&init, | |||
1715 | c_omp_check_loop_iv_r, &data, NULLnullptr, lh); | |||
1716 | } | |||
1717 | if (cond) | |||
1718 | { | |||
1719 | gcc_assert (COMPARISON_CLASS_P (cond))((void)(!((tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) (cond)->base.code))] == tcc_comparison )) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1719, __FUNCTION__), 0 : 0)); | |||
1720 | data.expr_loc = EXPR_LOCATION (init)((((init)) && ((tree_code_type_tmpl <0>::tree_code_type [(int) (((enum tree_code) ((init))->base.code))]) >= tcc_reference && (tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) ((init))->base.code))]) <= tcc_expression )) ? (init)->exp.locus : ((location_t) 0)); | |||
1721 | data.kind = kind | 1; | |||
1722 | if (TREE_OPERAND (cond, 0)(*((const_cast<tree*> (tree_operand_check ((cond), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1722, __FUNCTION__))))) == decl) | |||
1723 | walk_tree_1 (&TREE_OPERAND (cond, 1)(*((const_cast<tree*> (tree_operand_check ((cond), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1723, __FUNCTION__))))), | |||
1724 | c_omp_check_loop_iv_r, &data, NULLnullptr, lh); | |||
1725 | else | |||
1726 | walk_tree_1 (&TREE_OPERAND (cond, 0)(*((const_cast<tree*> (tree_operand_check ((cond), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1726, __FUNCTION__))))), | |||
1727 | c_omp_check_loop_iv_r, &data, NULLnullptr, lh); | |||
1728 | } | |||
1729 | return !data.fail; | |||
1730 | } | |||
1731 | ||||
1732 | /* This function splits clauses for OpenACC combined loop | |||
1733 | constructs. OpenACC combined loop constructs are: | |||
1734 | #pragma acc kernels loop | |||
1735 | #pragma acc parallel loop */ | |||
1736 | ||||
1737 | tree | |||
1738 | c_oacc_split_loop_clauses (tree clauses, tree *not_loop_clauses, | |||
1739 | bool is_parallel) | |||
1740 | { | |||
1741 | tree next, loop_clauses, nc; | |||
1742 | ||||
1743 | loop_clauses = *not_loop_clauses = NULL_TREE(tree) nullptr; | |||
1744 | for (; clauses ; clauses = next) | |||
1745 | { | |||
1746 | next = OMP_CLAUSE_CHAIN (clauses)((contains_struct_check (((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1746, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1746, __FUNCTION__))->common.chain); | |||
1747 | ||||
1748 | switch (OMP_CLAUSE_CODE (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1748, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code) | |||
1749 | { | |||
1750 | /* Loop clauses. */ | |||
1751 | case OMP_CLAUSE_COLLAPSE: | |||
1752 | case OMP_CLAUSE_TILE: | |||
1753 | case OMP_CLAUSE_GANG: | |||
1754 | case OMP_CLAUSE_WORKER: | |||
1755 | case OMP_CLAUSE_VECTOR: | |||
1756 | case OMP_CLAUSE_AUTO: | |||
1757 | case OMP_CLAUSE_SEQ: | |||
1758 | case OMP_CLAUSE_INDEPENDENT: | |||
1759 | case OMP_CLAUSE_PRIVATE: | |||
1760 | OMP_CLAUSE_CHAIN (clauses)((contains_struct_check (((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1760, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1760, __FUNCTION__))->common.chain) = loop_clauses; | |||
1761 | loop_clauses = clauses; | |||
1762 | break; | |||
1763 | ||||
1764 | /* Reductions must be duplicated on both constructs. */ | |||
1765 | case OMP_CLAUSE_REDUCTION: | |||
1766 | if (is_parallel) | |||
1767 | { | |||
1768 | nc = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1768, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
1769 | OMP_CLAUSE_REDUCTION); | |||
1770 | OMP_CLAUSE_DECL (nc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((nc), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1770, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1770, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1770, __FUNCTION__))) = OMP_CLAUSE_DECL (clauses)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1770, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1770, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1770, __FUNCTION__))); | |||
1771 | OMP_CLAUSE_REDUCTION_CODE (nc)((omp_clause_range_check ((nc), (OMP_CLAUSE_REDUCTION), (OMP_CLAUSE_IN_REDUCTION ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1771, __FUNCTION__))->omp_clause.subcode.reduction_code) | |||
1772 | = OMP_CLAUSE_REDUCTION_CODE (clauses)((omp_clause_range_check ((clauses), (OMP_CLAUSE_REDUCTION), ( OMP_CLAUSE_IN_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1772, __FUNCTION__))->omp_clause.subcode.reduction_code); | |||
1773 | OMP_CLAUSE_CHAIN (nc)((contains_struct_check (((tree_check ((nc), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1773, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1773, __FUNCTION__))->common.chain) = *not_loop_clauses; | |||
1774 | *not_loop_clauses = nc; | |||
1775 | } | |||
1776 | ||||
1777 | OMP_CLAUSE_CHAIN (clauses)((contains_struct_check (((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1777, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1777, __FUNCTION__))->common.chain) = loop_clauses; | |||
1778 | loop_clauses = clauses; | |||
1779 | break; | |||
1780 | ||||
1781 | /* Parallel/kernels clauses. */ | |||
1782 | default: | |||
1783 | OMP_CLAUSE_CHAIN (clauses)((contains_struct_check (((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1783, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1783, __FUNCTION__))->common.chain) = *not_loop_clauses; | |||
1784 | *not_loop_clauses = clauses; | |||
1785 | break; | |||
1786 | } | |||
1787 | } | |||
1788 | ||||
1789 | return loop_clauses; | |||
1790 | } | |||
1791 | ||||
1792 | /* This function attempts to split or duplicate clauses for OpenMP | |||
1793 | combined/composite constructs. Right now there are 30 different | |||
1794 | constructs. CODE is the innermost construct in the combined construct, | |||
1795 | and MASK allows to determine which constructs are combined together, | |||
1796 | as every construct has at least one clause that no other construct | |||
1797 | has (except for OMP_SECTIONS, but that can be only combined with parallel, | |||
1798 | and OMP_MASTER, which doesn't have any clauses at all). | |||
1799 | OpenMP combined/composite constructs are: | |||
1800 | #pragma omp distribute parallel for | |||
1801 | #pragma omp distribute parallel for simd | |||
1802 | #pragma omp distribute simd | |||
1803 | #pragma omp for simd | |||
1804 | #pragma omp masked taskloop | |||
1805 | #pragma omp masked taskloop simd | |||
1806 | #pragma omp master taskloop | |||
1807 | #pragma omp master taskloop simd | |||
1808 | #pragma omp parallel for | |||
1809 | #pragma omp parallel for simd | |||
1810 | #pragma omp parallel loop | |||
1811 | #pragma omp parallel masked | |||
1812 | #pragma omp parallel masked taskloop | |||
1813 | #pragma omp parallel masked taskloop simd | |||
1814 | #pragma omp parallel master | |||
1815 | #pragma omp parallel master taskloop | |||
1816 | #pragma omp parallel master taskloop simd | |||
1817 | #pragma omp parallel sections | |||
1818 | #pragma omp target parallel | |||
1819 | #pragma omp target parallel for | |||
1820 | #pragma omp target parallel for simd | |||
1821 | #pragma omp target parallel loop | |||
1822 | #pragma omp target teams | |||
1823 | #pragma omp target teams distribute | |||
1824 | #pragma omp target teams distribute parallel for | |||
1825 | #pragma omp target teams distribute parallel for simd | |||
1826 | #pragma omp target teams distribute simd | |||
1827 | #pragma omp target teams loop | |||
1828 | #pragma omp target simd | |||
1829 | #pragma omp taskloop simd | |||
1830 | #pragma omp teams distribute | |||
1831 | #pragma omp teams distribute parallel for | |||
1832 | #pragma omp teams distribute parallel for simd | |||
1833 | #pragma omp teams distribute simd | |||
1834 | #pragma omp teams loop */ | |||
1835 | ||||
1836 | void | |||
1837 | c_omp_split_clauses (location_t loc, enum tree_code code, | |||
1838 | omp_clause_mask mask, tree clauses, tree *cclauses) | |||
1839 | { | |||
1840 | tree next, c; | |||
1841 | enum c_omp_clause_split s; | |||
1842 | int i; | |||
1843 | bool has_dup_allocate = false; | |||
1844 | ||||
1845 | for (i = 0; i < C_OMP_CLAUSE_SPLIT_COUNT; i++) | |||
1846 | cclauses[i] = NULLnullptr; | |||
1847 | /* Add implicit nowait clause on | |||
1848 | #pragma omp parallel {for,for simd,sections}. */ | |||
1849 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_NUM_THREADS)) != 0) | |||
1850 | switch (code) | |||
1851 | { | |||
1852 | case OMP_FOR: | |||
1853 | case OMP_SIMD: | |||
1854 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_SCHEDULE)) != 0) | |||
1855 | cclauses[C_OMP_CLAUSE_SPLIT_FOR] | |||
1856 | = build_omp_clause (loc, OMP_CLAUSE_NOWAIT); | |||
1857 | break; | |||
1858 | case OMP_SECTIONS: | |||
1859 | cclauses[C_OMP_CLAUSE_SPLIT_SECTIONS] | |||
1860 | = build_omp_clause (loc, OMP_CLAUSE_NOWAIT); | |||
1861 | break; | |||
1862 | default: | |||
1863 | break; | |||
1864 | } | |||
1865 | ||||
1866 | for (; clauses ; clauses = next) | |||
1867 | { | |||
1868 | next = OMP_CLAUSE_CHAIN (clauses)((contains_struct_check (((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1868, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1868, __FUNCTION__))->common.chain); | |||
1869 | ||||
1870 | switch (OMP_CLAUSE_CODE (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1870, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code) | |||
1871 | { | |||
1872 | /* First the clauses that are unique to some constructs. */ | |||
1873 | case OMP_CLAUSE_DEVICE: | |||
1874 | case OMP_CLAUSE_MAP: | |||
1875 | case OMP_CLAUSE_IS_DEVICE_PTR: | |||
1876 | case OMP_CLAUSE_HAS_DEVICE_ADDR: | |||
1877 | case OMP_CLAUSE_DEFAULTMAP: | |||
1878 | case OMP_CLAUSE_DEPEND: | |||
1879 | s = C_OMP_CLAUSE_SPLIT_TARGET; | |||
1880 | break; | |||
1881 | case OMP_CLAUSE_DOACROSS: | |||
1882 | /* This can happen with invalid depend(source) or | |||
1883 | depend(sink:vec) on target combined with other constructs. */ | |||
1884 | gcc_assert (OMP_CLAUSE_DOACROSS_DEPEND (clauses))((void)(!((((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_DOACROSS ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1884, __FUNCTION__)))->base.protected_flag)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1884, __FUNCTION__), 0 : 0)); | |||
1885 | s = C_OMP_CLAUSE_SPLIT_TARGET; | |||
1886 | break; | |||
1887 | case OMP_CLAUSE_NUM_TEAMS: | |||
1888 | s = C_OMP_CLAUSE_SPLIT_TEAMS; | |||
1889 | break; | |||
1890 | case OMP_CLAUSE_DIST_SCHEDULE: | |||
1891 | s = C_OMP_CLAUSE_SPLIT_DISTRIBUTE; | |||
1892 | break; | |||
1893 | case OMP_CLAUSE_COPYIN: | |||
1894 | case OMP_CLAUSE_NUM_THREADS: | |||
1895 | case OMP_CLAUSE_PROC_BIND: | |||
1896 | s = C_OMP_CLAUSE_SPLIT_PARALLEL; | |||
1897 | break; | |||
1898 | case OMP_CLAUSE_ORDERED: | |||
1899 | s = C_OMP_CLAUSE_SPLIT_FOR; | |||
1900 | break; | |||
1901 | case OMP_CLAUSE_SCHEDULE: | |||
1902 | s = C_OMP_CLAUSE_SPLIT_FOR; | |||
1903 | if (code != OMP_SIMD) | |||
1904 | OMP_CLAUSE_SCHEDULE_SIMD (clauses)((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_SCHEDULE), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1904, __FUNCTION__))->base.public_flag) = 0; | |||
1905 | break; | |||
1906 | case OMP_CLAUSE_SAFELEN: | |||
1907 | case OMP_CLAUSE_SIMDLEN: | |||
1908 | case OMP_CLAUSE_ALIGNED: | |||
1909 | case OMP_CLAUSE_NONTEMPORAL: | |||
1910 | s = C_OMP_CLAUSE_SPLIT_SIMD; | |||
1911 | break; | |||
1912 | case OMP_CLAUSE_GRAINSIZE: | |||
1913 | case OMP_CLAUSE_NUM_TASKS: | |||
1914 | case OMP_CLAUSE_FINAL: | |||
1915 | case OMP_CLAUSE_UNTIED: | |||
1916 | case OMP_CLAUSE_MERGEABLE: | |||
1917 | case OMP_CLAUSE_NOGROUP: | |||
1918 | case OMP_CLAUSE_PRIORITY: | |||
1919 | s = C_OMP_CLAUSE_SPLIT_TASKLOOP; | |||
1920 | break; | |||
1921 | case OMP_CLAUSE_BIND: | |||
1922 | s = C_OMP_CLAUSE_SPLIT_LOOP; | |||
1923 | break; | |||
1924 | case OMP_CLAUSE_FILTER: | |||
1925 | s = C_OMP_CLAUSE_SPLIT_MASKED; | |||
1926 | break; | |||
1927 | /* Duplicate this to all of taskloop, distribute, for, simd and | |||
1928 | loop. */ | |||
1929 | case OMP_CLAUSE_COLLAPSE: | |||
1930 | if (code == OMP_SIMD) | |||
1931 | { | |||
1932 | if ((mask & ((OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_SCHEDULE) | |||
1933 | | (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
1934 | << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE) | |||
1935 | | (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
1936 | << PRAGMA_OMP_CLAUSE_NOGROUP))) != 0) | |||
1937 | { | |||
1938 | c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1938, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
1939 | OMP_CLAUSE_COLLAPSE); | |||
1940 | OMP_CLAUSE_COLLAPSE_EXPR (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_COLLAPSE ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1940, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1940, __FUNCTION__))) | |||
1941 | = OMP_CLAUSE_COLLAPSE_EXPR (clauses)(*(omp_clause_elt_check (((omp_clause_subcode_check ((clauses ), (OMP_CLAUSE_COLLAPSE), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1941, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1941, __FUNCTION__))); | |||
1942 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1942, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1942, __FUNCTION__))->common.chain) = cclauses[C_OMP_CLAUSE_SPLIT_SIMD]; | |||
1943 | cclauses[C_OMP_CLAUSE_SPLIT_SIMD] = c; | |||
1944 | } | |||
1945 | else | |||
1946 | { | |||
1947 | /* This must be #pragma omp target simd */ | |||
1948 | s = C_OMP_CLAUSE_SPLIT_SIMD; | |||
1949 | break; | |||
1950 | } | |||
1951 | } | |||
1952 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_SCHEDULE)) != 0) | |||
1953 | { | |||
1954 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
1955 | << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE)) != 0) | |||
1956 | { | |||
1957 | c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1957, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
1958 | OMP_CLAUSE_COLLAPSE); | |||
1959 | OMP_CLAUSE_COLLAPSE_EXPR (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_COLLAPSE ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1959, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1959, __FUNCTION__))) | |||
1960 | = OMP_CLAUSE_COLLAPSE_EXPR (clauses)(*(omp_clause_elt_check (((omp_clause_subcode_check ((clauses ), (OMP_CLAUSE_COLLAPSE), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1960, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1960, __FUNCTION__))); | |||
1961 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1961, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1961, __FUNCTION__))->common.chain) = cclauses[C_OMP_CLAUSE_SPLIT_FOR]; | |||
1962 | cclauses[C_OMP_CLAUSE_SPLIT_FOR] = c; | |||
1963 | s = C_OMP_CLAUSE_SPLIT_DISTRIBUTE; | |||
1964 | } | |||
1965 | else | |||
1966 | s = C_OMP_CLAUSE_SPLIT_FOR; | |||
1967 | } | |||
1968 | else if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_NOGROUP)) | |||
1969 | != 0) | |||
1970 | s = C_OMP_CLAUSE_SPLIT_TASKLOOP; | |||
1971 | else if (code == OMP_LOOP) | |||
1972 | s = C_OMP_CLAUSE_SPLIT_LOOP; | |||
1973 | else | |||
1974 | s = C_OMP_CLAUSE_SPLIT_DISTRIBUTE; | |||
1975 | break; | |||
1976 | /* Private clause is supported on all constructs but master/masked, | |||
1977 | it is enough to put it on the innermost one other than | |||
1978 | master/masked. For #pragma omp {for,sections} put it on parallel | |||
1979 | though, as that's what we did for OpenMP 3.1. */ | |||
1980 | case OMP_CLAUSE_PRIVATE: | |||
1981 | switch (code) | |||
1982 | { | |||
1983 | case OMP_SIMD: s = C_OMP_CLAUSE_SPLIT_SIMD; break; | |||
1984 | case OMP_FOR: case OMP_SECTIONS: | |||
1985 | case OMP_PARALLEL: s = C_OMP_CLAUSE_SPLIT_PARALLEL; break; | |||
1986 | case OMP_DISTRIBUTE: s = C_OMP_CLAUSE_SPLIT_DISTRIBUTE; break; | |||
1987 | case OMP_TEAMS: s = C_OMP_CLAUSE_SPLIT_TEAMS; break; | |||
1988 | case OMP_MASTER: s = C_OMP_CLAUSE_SPLIT_PARALLEL; break; | |||
1989 | case OMP_MASKED: s = C_OMP_CLAUSE_SPLIT_PARALLEL; break; | |||
1990 | case OMP_TASKLOOP: s = C_OMP_CLAUSE_SPLIT_TASKLOOP; break; | |||
1991 | case OMP_LOOP: s = C_OMP_CLAUSE_SPLIT_LOOP; break; | |||
1992 | default: gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 1992, __FUNCTION__)); | |||
1993 | } | |||
1994 | break; | |||
1995 | /* Firstprivate clause is supported on all constructs but | |||
1996 | simd, master, masked and loop. Put it on the outermost of those | |||
1997 | and duplicate on teams and parallel. */ | |||
1998 | case OMP_CLAUSE_FIRSTPRIVATE: | |||
1999 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_MAP)) | |||
2000 | != 0) | |||
2001 | { | |||
2002 | if (code == OMP_SIMD | |||
2003 | && (mask & ((OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2004 | << PRAGMA_OMP_CLAUSE_NUM_THREADS) | |||
2005 | | (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2006 | << PRAGMA_OMP_CLAUSE_NUM_TEAMS))) == 0) | |||
2007 | { | |||
2008 | /* This must be #pragma omp target simd. */ | |||
2009 | s = C_OMP_CLAUSE_SPLIT_TARGET; | |||
2010 | OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (clauses)((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_FIRSTPRIVATE ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2010, __FUNCTION__))->base.public_flag) = 1; | |||
2011 | OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET (clauses)(((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_FIRSTPRIVATE ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2011, __FUNCTION__)))->base.protected_flag) = 1; | |||
2012 | break; | |||
2013 | } | |||
2014 | c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2014, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2015 | OMP_CLAUSE_FIRSTPRIVATE); | |||
2016 | /* firstprivate should not be applied to target if it is | |||
2017 | also lastprivate or on the combined/composite construct, | |||
2018 | or if it is mentioned in map clause. OMP_CLAUSE_DECLs | |||
2019 | may need to go through FE handling though (instantiation, | |||
2020 | C++ non-static data members, array section lowering), so | |||
2021 | add the clause with OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT and | |||
2022 | let *finish_omp_clauses and the gimplifier handle it | |||
2023 | right. */ | |||
2024 | OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_FIRSTPRIVATE), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2024, __FUNCTION__))->base.public_flag) = 1; | |||
2025 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2025, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2025, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2025, __FUNCTION__))) = OMP_CLAUSE_DECL (clauses)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2025, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2025, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2025, __FUNCTION__))); | |||
2026 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2026, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2026, __FUNCTION__))->common.chain) = cclauses[C_OMP_CLAUSE_SPLIT_TARGET]; | |||
2027 | cclauses[C_OMP_CLAUSE_SPLIT_TARGET] = c; | |||
2028 | } | |||
2029 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_NUM_THREADS)) | |||
2030 | != 0) | |||
2031 | { | |||
2032 | if ((mask & ((OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_NUM_TEAMS) | |||
2033 | | (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2034 | << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE))) != 0) | |||
2035 | { | |||
2036 | c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2036, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2037 | OMP_CLAUSE_FIRSTPRIVATE); | |||
2038 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2038, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2038, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2038, __FUNCTION__))) = OMP_CLAUSE_DECL (clauses)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2038, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2038, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2038, __FUNCTION__))); | |||
2039 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2039, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2039, __FUNCTION__))->common.chain) = cclauses[C_OMP_CLAUSE_SPLIT_PARALLEL]; | |||
2040 | cclauses[C_OMP_CLAUSE_SPLIT_PARALLEL] = c; | |||
2041 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2042 | << PRAGMA_OMP_CLAUSE_NUM_TEAMS)) != 0) | |||
2043 | s = C_OMP_CLAUSE_SPLIT_TEAMS; | |||
2044 | else | |||
2045 | s = C_OMP_CLAUSE_SPLIT_DISTRIBUTE; | |||
2046 | } | |||
2047 | else if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2048 | << PRAGMA_OMP_CLAUSE_NOGROUP)) != 0) | |||
2049 | /* This must be | |||
2050 | #pragma omp parallel mas{ked,ter} taskloop{, simd}. */ | |||
2051 | s = C_OMP_CLAUSE_SPLIT_TASKLOOP; | |||
2052 | else | |||
2053 | /* This must be | |||
2054 | #pragma omp parallel{, for{, simd}, sections,loop} | |||
2055 | or | |||
2056 | #pragma omp target parallel. */ | |||
2057 | s = C_OMP_CLAUSE_SPLIT_PARALLEL; | |||
2058 | } | |||
2059 | else if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_NUM_TEAMS)) | |||
2060 | != 0) | |||
2061 | { | |||
2062 | /* This must be one of | |||
2063 | #pragma omp {,target }teams {distribute,loop} | |||
2064 | #pragma omp target teams | |||
2065 | #pragma omp {,target }teams distribute simd. */ | |||
2066 | gcc_assert (code == OMP_DISTRIBUTE((void)(!(code == OMP_DISTRIBUTE || code == OMP_LOOP || code == OMP_TEAMS || code == OMP_SIMD) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2069, __FUNCTION__), 0 : 0)) | |||
2067 | || code == OMP_LOOP((void)(!(code == OMP_DISTRIBUTE || code == OMP_LOOP || code == OMP_TEAMS || code == OMP_SIMD) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2069, __FUNCTION__), 0 : 0)) | |||
2068 | || code == OMP_TEAMS((void)(!(code == OMP_DISTRIBUTE || code == OMP_LOOP || code == OMP_TEAMS || code == OMP_SIMD) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2069, __FUNCTION__), 0 : 0)) | |||
2069 | || code == OMP_SIMD)((void)(!(code == OMP_DISTRIBUTE || code == OMP_LOOP || code == OMP_TEAMS || code == OMP_SIMD) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2069, __FUNCTION__), 0 : 0)); | |||
2070 | s = C_OMP_CLAUSE_SPLIT_TEAMS; | |||
2071 | } | |||
2072 | else if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2073 | << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE)) != 0) | |||
2074 | { | |||
2075 | /* This must be #pragma omp distribute simd. */ | |||
2076 | gcc_assert (code == OMP_SIMD)((void)(!(code == OMP_SIMD) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2076, __FUNCTION__), 0 : 0)); | |||
2077 | s = C_OMP_CLAUSE_SPLIT_DISTRIBUTE; | |||
2078 | } | |||
2079 | else if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2080 | << PRAGMA_OMP_CLAUSE_NOGROUP)) != 0) | |||
2081 | { | |||
2082 | /* This must be | |||
2083 | #pragma omp {,{,parallel }mas{ked,ter} }taskloop simd | |||
2084 | or | |||
2085 | #pragma omp {,parallel }mas{ked,ter} taskloop. */ | |||
2086 | gcc_assert (code == OMP_SIMD || code == OMP_TASKLOOP)((void)(!(code == OMP_SIMD || code == OMP_TASKLOOP) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2086, __FUNCTION__), 0 : 0)); | |||
2087 | s = C_OMP_CLAUSE_SPLIT_TASKLOOP; | |||
2088 | } | |||
2089 | else | |||
2090 | { | |||
2091 | /* This must be #pragma omp for simd. */ | |||
2092 | gcc_assert (code == OMP_SIMD)((void)(!(code == OMP_SIMD) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2092, __FUNCTION__), 0 : 0)); | |||
2093 | s = C_OMP_CLAUSE_SPLIT_FOR; | |||
2094 | } | |||
2095 | break; | |||
2096 | /* Lastprivate is allowed on distribute, for, sections, taskloop, loop | |||
2097 | and simd. In parallel {for{, simd},sections} we actually want to | |||
2098 | put it on parallel rather than for or sections. */ | |||
2099 | case OMP_CLAUSE_LASTPRIVATE: | |||
2100 | if (code == OMP_DISTRIBUTE) | |||
2101 | { | |||
2102 | s = C_OMP_CLAUSE_SPLIT_DISTRIBUTE; | |||
2103 | break; | |||
2104 | } | |||
2105 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2106 | << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE)) != 0) | |||
2107 | { | |||
2108 | c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2108, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2109 | OMP_CLAUSE_LASTPRIVATE); | |||
2110 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2110, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2110, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2110, __FUNCTION__))) = OMP_CLAUSE_DECL (clauses)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2110, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2110, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2110, __FUNCTION__))); | |||
2111 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2111, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2111, __FUNCTION__))->common.chain) = cclauses[C_OMP_CLAUSE_SPLIT_DISTRIBUTE]; | |||
2112 | OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_LASTPRIVATE), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2112, __FUNCTION__)))->base.private_flag) | |||
2113 | = OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (clauses)(((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_LASTPRIVATE ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2113, __FUNCTION__)))->base.private_flag); | |||
2114 | cclauses[C_OMP_CLAUSE_SPLIT_DISTRIBUTE] = c; | |||
2115 | } | |||
2116 | if (code == OMP_FOR || code == OMP_SECTIONS) | |||
2117 | { | |||
2118 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_NUM_THREADS)) | |||
2119 | != 0) | |||
2120 | s = C_OMP_CLAUSE_SPLIT_PARALLEL; | |||
2121 | else | |||
2122 | s = C_OMP_CLAUSE_SPLIT_FOR; | |||
2123 | break; | |||
2124 | } | |||
2125 | if (code == OMP_TASKLOOP) | |||
2126 | { | |||
2127 | s = C_OMP_CLAUSE_SPLIT_TASKLOOP; | |||
2128 | break; | |||
2129 | } | |||
2130 | if (code == OMP_LOOP) | |||
2131 | { | |||
2132 | s = C_OMP_CLAUSE_SPLIT_LOOP; | |||
2133 | break; | |||
2134 | } | |||
2135 | gcc_assert (code == OMP_SIMD)((void)(!(code == OMP_SIMD) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2135, __FUNCTION__), 0 : 0)); | |||
2136 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_SCHEDULE)) != 0) | |||
2137 | { | |||
2138 | c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2138, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2139 | OMP_CLAUSE_LASTPRIVATE); | |||
2140 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2140, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2140, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2140, __FUNCTION__))) = OMP_CLAUSE_DECL (clauses)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2140, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2140, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2140, __FUNCTION__))); | |||
2141 | OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_LASTPRIVATE), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2141, __FUNCTION__)))->base.private_flag) | |||
2142 | = OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (clauses)(((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_LASTPRIVATE ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2142, __FUNCTION__)))->base.private_flag); | |||
2143 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_NUM_THREADS)) | |||
2144 | != 0) | |||
2145 | s = C_OMP_CLAUSE_SPLIT_PARALLEL; | |||
2146 | else | |||
2147 | s = C_OMP_CLAUSE_SPLIT_FOR; | |||
2148 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2148, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2148, __FUNCTION__))->common.chain) = cclauses[s]; | |||
2149 | cclauses[s] = c; | |||
2150 | } | |||
2151 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_NOGROUP)) != 0) | |||
2152 | { | |||
2153 | c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2153, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2154 | OMP_CLAUSE_LASTPRIVATE); | |||
2155 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2155, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2155, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2155, __FUNCTION__))) = OMP_CLAUSE_DECL (clauses)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2155, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2155, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2155, __FUNCTION__))); | |||
2156 | OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_LASTPRIVATE), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2156, __FUNCTION__)))->base.private_flag) | |||
2157 | = OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (clauses)(((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_LASTPRIVATE ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2157, __FUNCTION__)))->base.private_flag); | |||
2158 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2158, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2158, __FUNCTION__))->common.chain) = cclauses[C_OMP_CLAUSE_SPLIT_TASKLOOP]; | |||
2159 | cclauses[C_OMP_CLAUSE_SPLIT_TASKLOOP] = c; | |||
2160 | } | |||
2161 | s = C_OMP_CLAUSE_SPLIT_SIMD; | |||
2162 | break; | |||
2163 | /* Shared and default clauses are allowed on parallel, teams and | |||
2164 | taskloop. */ | |||
2165 | case OMP_CLAUSE_SHARED: | |||
2166 | case OMP_CLAUSE_DEFAULT: | |||
2167 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_NOGROUP)) | |||
2168 | != 0) | |||
2169 | { | |||
2170 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_NUM_THREADS)) | |||
2171 | != 0) | |||
2172 | { | |||
2173 | c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2173, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2174 | OMP_CLAUSE_CODE (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2174, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code); | |||
2175 | if (OMP_CLAUSE_CODE (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2175, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_SHARED) | |||
2176 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2176, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2176, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2176, __FUNCTION__))) = OMP_CLAUSE_DECL (clauses)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2176, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2176, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2176, __FUNCTION__))); | |||
2177 | else | |||
2178 | OMP_CLAUSE_DEFAULT_KIND (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_DEFAULT), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2178, __FUNCTION__))->omp_clause.subcode.default_kind) | |||
2179 | = OMP_CLAUSE_DEFAULT_KIND (clauses)((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_DEFAULT), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2179, __FUNCTION__))->omp_clause.subcode.default_kind); | |||
2180 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2180, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2180, __FUNCTION__))->common.chain) = cclauses[C_OMP_CLAUSE_SPLIT_PARALLEL]; | |||
2181 | cclauses[C_OMP_CLAUSE_SPLIT_PARALLEL] = c; | |||
2182 | } | |||
2183 | s = C_OMP_CLAUSE_SPLIT_TASKLOOP; | |||
2184 | break; | |||
2185 | } | |||
2186 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_NUM_TEAMS)) | |||
2187 | != 0) | |||
2188 | { | |||
2189 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_NUM_THREADS)) | |||
2190 | == 0) | |||
2191 | { | |||
2192 | s = C_OMP_CLAUSE_SPLIT_TEAMS; | |||
2193 | break; | |||
2194 | } | |||
2195 | c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2195, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2196 | OMP_CLAUSE_CODE (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2196, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code); | |||
2197 | if (OMP_CLAUSE_CODE (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2197, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_SHARED) | |||
2198 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2198, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2198, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2198, __FUNCTION__))) = OMP_CLAUSE_DECL (clauses)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2198, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2198, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2198, __FUNCTION__))); | |||
2199 | else | |||
2200 | OMP_CLAUSE_DEFAULT_KIND (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_DEFAULT), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2200, __FUNCTION__))->omp_clause.subcode.default_kind) | |||
2201 | = OMP_CLAUSE_DEFAULT_KIND (clauses)((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_DEFAULT), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2201, __FUNCTION__))->omp_clause.subcode.default_kind); | |||
2202 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2202, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2202, __FUNCTION__))->common.chain) = cclauses[C_OMP_CLAUSE_SPLIT_TEAMS]; | |||
2203 | cclauses[C_OMP_CLAUSE_SPLIT_TEAMS] = c; | |||
2204 | } | |||
2205 | s = C_OMP_CLAUSE_SPLIT_PARALLEL; | |||
2206 | break; | |||
2207 | /* order clauses are allowed on distribute, for, simd and loop. */ | |||
2208 | case OMP_CLAUSE_ORDER: | |||
2209 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2210 | << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE)) != 0) | |||
2211 | { | |||
2212 | if (code == OMP_DISTRIBUTE) | |||
2213 | { | |||
2214 | s = C_OMP_CLAUSE_SPLIT_DISTRIBUTE; | |||
2215 | break; | |||
2216 | } | |||
2217 | c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2217, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2218 | OMP_CLAUSE_ORDER); | |||
2219 | OMP_CLAUSE_ORDER_UNCONSTRAINED (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_ORDER), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2219, __FUNCTION__))->base.public_flag) | |||
2220 | = OMP_CLAUSE_ORDER_UNCONSTRAINED (clauses)((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_ORDER), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2220, __FUNCTION__))->base.public_flag); | |||
2221 | OMP_CLAUSE_ORDER_REPRODUCIBLE (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_ORDER), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2221, __FUNCTION__)))->base.protected_flag) | |||
2222 | = OMP_CLAUSE_ORDER_REPRODUCIBLE (clauses)(((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_ORDER), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2222, __FUNCTION__)))->base.protected_flag); | |||
2223 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2223, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2223, __FUNCTION__))->common.chain) = cclauses[C_OMP_CLAUSE_SPLIT_DISTRIBUTE]; | |||
2224 | cclauses[C_OMP_CLAUSE_SPLIT_DISTRIBUTE] = c; | |||
2225 | } | |||
2226 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_SCHEDULE)) != 0) | |||
2227 | { | |||
2228 | if (code == OMP_SIMD) | |||
2229 | { | |||
2230 | c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2230, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2231 | OMP_CLAUSE_ORDER); | |||
2232 | OMP_CLAUSE_ORDER_UNCONSTRAINED (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_ORDER), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2232, __FUNCTION__))->base.public_flag) | |||
2233 | = OMP_CLAUSE_ORDER_UNCONSTRAINED (clauses)((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_ORDER), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2233, __FUNCTION__))->base.public_flag); | |||
2234 | OMP_CLAUSE_ORDER_REPRODUCIBLE (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_ORDER), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2234, __FUNCTION__)))->base.protected_flag) | |||
2235 | = OMP_CLAUSE_ORDER_REPRODUCIBLE (clauses)(((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_ORDER), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2235, __FUNCTION__)))->base.protected_flag); | |||
2236 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2236, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2236, __FUNCTION__))->common.chain) = cclauses[C_OMP_CLAUSE_SPLIT_FOR]; | |||
2237 | cclauses[C_OMP_CLAUSE_SPLIT_FOR] = c; | |||
2238 | s = C_OMP_CLAUSE_SPLIT_SIMD; | |||
2239 | } | |||
2240 | else | |||
2241 | s = C_OMP_CLAUSE_SPLIT_FOR; | |||
2242 | } | |||
2243 | else if (code == OMP_LOOP) | |||
2244 | s = C_OMP_CLAUSE_SPLIT_LOOP; | |||
2245 | else | |||
2246 | s = C_OMP_CLAUSE_SPLIT_SIMD; | |||
2247 | break; | |||
2248 | /* Reduction is allowed on simd, for, parallel, sections, taskloop, | |||
2249 | teams and loop. Duplicate it on all of them, but omit on for or | |||
2250 | sections if parallel is present (unless inscan, in that case | |||
2251 | omit on parallel). If taskloop or loop is combined with | |||
2252 | parallel, omit it on parallel. */ | |||
2253 | case OMP_CLAUSE_REDUCTION: | |||
2254 | if (OMP_CLAUSE_REDUCTION_TASK (clauses)(((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_REDUCTION ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2254, __FUNCTION__)))->base.protected_flag)) | |||
2255 | { | |||
2256 | if (code == OMP_SIMD || code == OMP_LOOP) | |||
2257 | { | |||
2258 | error_at (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2258, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2259 | "invalid %<task%> reduction modifier on construct " | |||
2260 | "combined with %<simd%> or %<loop%>"); | |||
2261 | OMP_CLAUSE_REDUCTION_TASK (clauses)(((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_REDUCTION ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2261, __FUNCTION__)))->base.protected_flag) = 0; | |||
2262 | } | |||
2263 | else if (code != OMP_SECTIONS | |||
2264 | && (mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2265 | << PRAGMA_OMP_CLAUSE_NUM_THREADS)) == 0 | |||
2266 | && (mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2267 | << PRAGMA_OMP_CLAUSE_SCHEDULE)) == 0) | |||
2268 | { | |||
2269 | error_at (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2269, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2270 | "invalid %<task%> reduction modifier on construct " | |||
2271 | "not combined with %<parallel%>, %<for%> or " | |||
2272 | "%<sections%>"); | |||
2273 | OMP_CLAUSE_REDUCTION_TASK (clauses)(((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_REDUCTION ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2273, __FUNCTION__)))->base.protected_flag) = 0; | |||
2274 | } | |||
2275 | } | |||
2276 | if (OMP_CLAUSE_REDUCTION_INSCAN (clauses)(((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_REDUCTION ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2276, __FUNCTION__)))->base.private_flag) | |||
2277 | && ((mask & ((OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2278 | << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE) | |||
2279 | | (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_MAP))) | |||
2280 | != 0)) | |||
2281 | { | |||
2282 | error_at (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2282, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2283 | "%<inscan%> %<reduction%> clause on construct other " | |||
2284 | "than %<for%>, %<simd%>, %<for simd%>, " | |||
2285 | "%<parallel for%>, %<parallel for simd%>"); | |||
2286 | OMP_CLAUSE_REDUCTION_INSCAN (clauses)(((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_REDUCTION ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2286, __FUNCTION__)))->base.private_flag) = 0; | |||
2287 | } | |||
2288 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_MAP)) != 0) | |||
2289 | { | |||
2290 | c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2290, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2291 | OMP_CLAUSE_MAP); | |||
2292 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2292, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2292, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2292, __FUNCTION__))) = OMP_CLAUSE_DECL (clauses)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2292, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2292, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2292, __FUNCTION__))); | |||
2293 | OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_TOFROM)((omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2293, __FUNCTION__))->omp_clause.subcode.map_kind = (unsigned int) (GOMP_MAP_TOFROM)); | |||
2294 | OMP_CLAUSE_MAP_IMPLICIT (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2294, __FUNCTION__))->base.default_def_flag) = 1; | |||
2295 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2295, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2295, __FUNCTION__))->common.chain) = cclauses[C_OMP_CLAUSE_SPLIT_TARGET]; | |||
2296 | cclauses[C_OMP_CLAUSE_SPLIT_TARGET] = c; | |||
2297 | } | |||
2298 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_SCHEDULE)) != 0) | |||
2299 | { | |||
2300 | if (code == OMP_SIMD) | |||
2301 | { | |||
2302 | c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2302, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2303 | OMP_CLAUSE_REDUCTION); | |||
2304 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2304, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2304, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2304, __FUNCTION__))) = OMP_CLAUSE_DECL (clauses)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2304, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2304, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2304, __FUNCTION__))); | |||
2305 | 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/c-family/c-omp.cc" , 2305, __FUNCTION__))->omp_clause.subcode.reduction_code) | |||
2306 | = OMP_CLAUSE_REDUCTION_CODE (clauses)((omp_clause_range_check ((clauses), (OMP_CLAUSE_REDUCTION), ( OMP_CLAUSE_IN_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2306, __FUNCTION__))->omp_clause.subcode.reduction_code); | |||
2307 | 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/c-family/c-omp.cc" , 2307, __FUNCTION__))), (3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2307, __FUNCTION__))) | |||
2308 | = OMP_CLAUSE_REDUCTION_PLACEHOLDER (clauses)(*(omp_clause_elt_check (((omp_clause_range_check ((clauses), (OMP_CLAUSE_REDUCTION), (OMP_CLAUSE_IN_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2308, __FUNCTION__))), (3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2308, __FUNCTION__))); | |||
2309 | OMP_CLAUSE_REDUCTION_DECL_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/c-family/c-omp.cc" , 2309, __FUNCTION__))), (4), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2309, __FUNCTION__))) | |||
2310 | = OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER (clauses)(*(omp_clause_elt_check (((omp_clause_range_check ((clauses), (OMP_CLAUSE_REDUCTION), (OMP_CLAUSE_IN_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2310, __FUNCTION__))), (4), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2310, __FUNCTION__))); | |||
2311 | OMP_CLAUSE_REDUCTION_INSCAN (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2311, __FUNCTION__)))->base.private_flag) | |||
2312 | = OMP_CLAUSE_REDUCTION_INSCAN (clauses)(((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_REDUCTION ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2312, __FUNCTION__)))->base.private_flag); | |||
2313 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2313, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2313, __FUNCTION__))->common.chain) = cclauses[C_OMP_CLAUSE_SPLIT_SIMD]; | |||
2314 | cclauses[C_OMP_CLAUSE_SPLIT_SIMD] = c; | |||
2315 | } | |||
2316 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_NUM_TEAMS)) | |||
2317 | != 0) | |||
2318 | { | |||
2319 | c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2319, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2320 | OMP_CLAUSE_REDUCTION); | |||
2321 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2321, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2321, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2321, __FUNCTION__))) = OMP_CLAUSE_DECL (clauses)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2321, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2321, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2321, __FUNCTION__))); | |||
2322 | 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/c-family/c-omp.cc" , 2322, __FUNCTION__))->omp_clause.subcode.reduction_code) | |||
2323 | = OMP_CLAUSE_REDUCTION_CODE (clauses)((omp_clause_range_check ((clauses), (OMP_CLAUSE_REDUCTION), ( OMP_CLAUSE_IN_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2323, __FUNCTION__))->omp_clause.subcode.reduction_code); | |||
2324 | 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/c-family/c-omp.cc" , 2324, __FUNCTION__))), (3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2324, __FUNCTION__))) | |||
2325 | = OMP_CLAUSE_REDUCTION_PLACEHOLDER (clauses)(*(omp_clause_elt_check (((omp_clause_range_check ((clauses), (OMP_CLAUSE_REDUCTION), (OMP_CLAUSE_IN_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2325, __FUNCTION__))), (3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2325, __FUNCTION__))); | |||
2326 | OMP_CLAUSE_REDUCTION_DECL_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/c-family/c-omp.cc" , 2326, __FUNCTION__))), (4), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2326, __FUNCTION__))) | |||
2327 | = OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER (clauses)(*(omp_clause_elt_check (((omp_clause_range_check ((clauses), (OMP_CLAUSE_REDUCTION), (OMP_CLAUSE_IN_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2327, __FUNCTION__))), (4), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2327, __FUNCTION__))); | |||
2328 | OMP_CLAUSE_REDUCTION_INSCAN (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2328, __FUNCTION__)))->base.private_flag) | |||
2329 | = OMP_CLAUSE_REDUCTION_INSCAN (clauses)(((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_REDUCTION ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2329, __FUNCTION__)))->base.private_flag); | |||
2330 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2330, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2330, __FUNCTION__))->common.chain) = cclauses[C_OMP_CLAUSE_SPLIT_TEAMS]; | |||
2331 | cclauses[C_OMP_CLAUSE_SPLIT_TEAMS] = c; | |||
2332 | s = C_OMP_CLAUSE_SPLIT_PARALLEL; | |||
2333 | } | |||
2334 | else if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2335 | << PRAGMA_OMP_CLAUSE_NUM_THREADS)) != 0 | |||
2336 | && !OMP_CLAUSE_REDUCTION_INSCAN (clauses)(((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_REDUCTION ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2336, __FUNCTION__)))->base.private_flag)) | |||
2337 | s = C_OMP_CLAUSE_SPLIT_PARALLEL; | |||
2338 | else | |||
2339 | s = C_OMP_CLAUSE_SPLIT_FOR; | |||
2340 | } | |||
2341 | else if (code == OMP_SECTIONS | |||
2342 | || code == OMP_PARALLEL | |||
2343 | || code == OMP_MASTER | |||
2344 | || code == OMP_MASKED) | |||
2345 | s = C_OMP_CLAUSE_SPLIT_PARALLEL; | |||
2346 | else if (code == OMP_TASKLOOP) | |||
2347 | s = C_OMP_CLAUSE_SPLIT_TASKLOOP; | |||
2348 | else if (code == OMP_LOOP) | |||
2349 | s = C_OMP_CLAUSE_SPLIT_LOOP; | |||
2350 | else if (code == OMP_SIMD) | |||
2351 | { | |||
2352 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_NOGROUP)) | |||
2353 | != 0) | |||
2354 | { | |||
2355 | c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2355, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2356 | OMP_CLAUSE_REDUCTION); | |||
2357 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2357, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2357, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2357, __FUNCTION__))) = OMP_CLAUSE_DECL (clauses)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2357, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2357, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2357, __FUNCTION__))); | |||
2358 | 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/c-family/c-omp.cc" , 2358, __FUNCTION__))->omp_clause.subcode.reduction_code) | |||
2359 | = OMP_CLAUSE_REDUCTION_CODE (clauses)((omp_clause_range_check ((clauses), (OMP_CLAUSE_REDUCTION), ( OMP_CLAUSE_IN_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2359, __FUNCTION__))->omp_clause.subcode.reduction_code); | |||
2360 | 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/c-family/c-omp.cc" , 2360, __FUNCTION__))), (3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2360, __FUNCTION__))) | |||
2361 | = OMP_CLAUSE_REDUCTION_PLACEHOLDER (clauses)(*(omp_clause_elt_check (((omp_clause_range_check ((clauses), (OMP_CLAUSE_REDUCTION), (OMP_CLAUSE_IN_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2361, __FUNCTION__))), (3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2361, __FUNCTION__))); | |||
2362 | OMP_CLAUSE_REDUCTION_DECL_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/c-family/c-omp.cc" , 2362, __FUNCTION__))), (4), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2362, __FUNCTION__))) | |||
2363 | = OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER (clauses)(*(omp_clause_elt_check (((omp_clause_range_check ((clauses), (OMP_CLAUSE_REDUCTION), (OMP_CLAUSE_IN_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2363, __FUNCTION__))), (4), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2363, __FUNCTION__))); | |||
2364 | OMP_CLAUSE_REDUCTION_INSCAN (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2364, __FUNCTION__)))->base.private_flag) | |||
2365 | = OMP_CLAUSE_REDUCTION_INSCAN (clauses)(((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_REDUCTION ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2365, __FUNCTION__)))->base.private_flag); | |||
2366 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2366, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2366, __FUNCTION__))->common.chain) = cclauses[C_OMP_CLAUSE_SPLIT_TASKLOOP]; | |||
2367 | cclauses[C_OMP_CLAUSE_SPLIT_TASKLOOP] = c; | |||
2368 | } | |||
2369 | else if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2370 | << PRAGMA_OMP_CLAUSE_NUM_TEAMS)) != 0) | |||
2371 | { | |||
2372 | c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2372, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2373 | OMP_CLAUSE_REDUCTION); | |||
2374 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2374, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2374, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2374, __FUNCTION__))) = OMP_CLAUSE_DECL (clauses)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2374, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2374, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2374, __FUNCTION__))); | |||
2375 | 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/c-family/c-omp.cc" , 2375, __FUNCTION__))->omp_clause.subcode.reduction_code) | |||
2376 | = OMP_CLAUSE_REDUCTION_CODE (clauses)((omp_clause_range_check ((clauses), (OMP_CLAUSE_REDUCTION), ( OMP_CLAUSE_IN_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2376, __FUNCTION__))->omp_clause.subcode.reduction_code); | |||
2377 | 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/c-family/c-omp.cc" , 2377, __FUNCTION__))), (3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2377, __FUNCTION__))) | |||
2378 | = OMP_CLAUSE_REDUCTION_PLACEHOLDER (clauses)(*(omp_clause_elt_check (((omp_clause_range_check ((clauses), (OMP_CLAUSE_REDUCTION), (OMP_CLAUSE_IN_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2378, __FUNCTION__))), (3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2378, __FUNCTION__))); | |||
2379 | OMP_CLAUSE_REDUCTION_DECL_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/c-family/c-omp.cc" , 2379, __FUNCTION__))), (4), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2379, __FUNCTION__))) | |||
2380 | = OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER (clauses)(*(omp_clause_elt_check (((omp_clause_range_check ((clauses), (OMP_CLAUSE_REDUCTION), (OMP_CLAUSE_IN_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2380, __FUNCTION__))), (4), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2380, __FUNCTION__))); | |||
2381 | OMP_CLAUSE_REDUCTION_INSCAN (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2381, __FUNCTION__)))->base.private_flag) | |||
2382 | = OMP_CLAUSE_REDUCTION_INSCAN (clauses)(((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_REDUCTION ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2382, __FUNCTION__)))->base.private_flag); | |||
2383 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2383, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2383, __FUNCTION__))->common.chain) = cclauses[C_OMP_CLAUSE_SPLIT_TEAMS]; | |||
2384 | cclauses[C_OMP_CLAUSE_SPLIT_TEAMS] = c; | |||
2385 | } | |||
2386 | s = C_OMP_CLAUSE_SPLIT_SIMD; | |||
2387 | } | |||
2388 | else | |||
2389 | s = C_OMP_CLAUSE_SPLIT_TEAMS; | |||
2390 | break; | |||
2391 | case OMP_CLAUSE_IN_REDUCTION: | |||
2392 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_MAP)) != 0) | |||
2393 | { | |||
2394 | /* When on target, map(always, tofrom: item) is added as | |||
2395 | well. For non-combined target it is added in the FEs. */ | |||
2396 | c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2396, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2397 | OMP_CLAUSE_MAP); | |||
2398 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2398, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2398, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2398, __FUNCTION__))) = OMP_CLAUSE_DECL (clauses)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2398, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2398, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2398, __FUNCTION__))); | |||
2399 | OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_ALWAYS_TOFROM)((omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2399, __FUNCTION__))->omp_clause.subcode.map_kind = (unsigned int) (GOMP_MAP_ALWAYS_TOFROM)); | |||
2400 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2400, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2400, __FUNCTION__))->common.chain) = cclauses[C_OMP_CLAUSE_SPLIT_TARGET]; | |||
2401 | cclauses[C_OMP_CLAUSE_SPLIT_TARGET] = c; | |||
2402 | s = C_OMP_CLAUSE_SPLIT_TARGET; | |||
2403 | break; | |||
2404 | } | |||
2405 | /* in_reduction on taskloop simd becomes reduction on the simd | |||
2406 | and keeps being in_reduction on taskloop. */ | |||
2407 | if (code == OMP_SIMD) | |||
2408 | { | |||
2409 | c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2409, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2410 | OMP_CLAUSE_REDUCTION); | |||
2411 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2411, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2411, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2411, __FUNCTION__))) = OMP_CLAUSE_DECL (clauses)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2411, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2411, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2411, __FUNCTION__))); | |||
2412 | 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/c-family/c-omp.cc" , 2412, __FUNCTION__))->omp_clause.subcode.reduction_code) | |||
2413 | = OMP_CLAUSE_REDUCTION_CODE (clauses)((omp_clause_range_check ((clauses), (OMP_CLAUSE_REDUCTION), ( OMP_CLAUSE_IN_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2413, __FUNCTION__))->omp_clause.subcode.reduction_code); | |||
2414 | 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/c-family/c-omp.cc" , 2414, __FUNCTION__))), (3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2414, __FUNCTION__))) | |||
2415 | = OMP_CLAUSE_REDUCTION_PLACEHOLDER (clauses)(*(omp_clause_elt_check (((omp_clause_range_check ((clauses), (OMP_CLAUSE_REDUCTION), (OMP_CLAUSE_IN_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2415, __FUNCTION__))), (3), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2415, __FUNCTION__))); | |||
2416 | OMP_CLAUSE_REDUCTION_DECL_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/c-family/c-omp.cc" , 2416, __FUNCTION__))), (4), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2416, __FUNCTION__))) | |||
2417 | = OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER (clauses)(*(omp_clause_elt_check (((omp_clause_range_check ((clauses), (OMP_CLAUSE_REDUCTION), (OMP_CLAUSE_IN_REDUCTION), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2417, __FUNCTION__))), (4), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2417, __FUNCTION__))); | |||
2418 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2418, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2418, __FUNCTION__))->common.chain) = cclauses[C_OMP_CLAUSE_SPLIT_SIMD]; | |||
2419 | cclauses[C_OMP_CLAUSE_SPLIT_SIMD] = c; | |||
2420 | } | |||
2421 | s = C_OMP_CLAUSE_SPLIT_TASKLOOP; | |||
2422 | break; | |||
2423 | case OMP_CLAUSE_IF: | |||
2424 | if (OMP_CLAUSE_IF_MODIFIER (clauses)((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_IF), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2424, __FUNCTION__))->omp_clause.subcode.if_modifier) != ERROR_MARK) | |||
2425 | { | |||
2426 | s = C_OMP_CLAUSE_SPLIT_COUNT; | |||
2427 | switch (OMP_CLAUSE_IF_MODIFIER (clauses)((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_IF), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2427, __FUNCTION__))->omp_clause.subcode.if_modifier)) | |||
2428 | { | |||
2429 | case OMP_PARALLEL: | |||
2430 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2431 | << PRAGMA_OMP_CLAUSE_NUM_THREADS)) != 0) | |||
2432 | s = C_OMP_CLAUSE_SPLIT_PARALLEL; | |||
2433 | break; | |||
2434 | case OMP_SIMD: | |||
2435 | if (code == OMP_SIMD) | |||
2436 | s = C_OMP_CLAUSE_SPLIT_SIMD; | |||
2437 | break; | |||
2438 | case OMP_TASKLOOP: | |||
2439 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_NOGROUP)) | |||
2440 | != 0) | |||
2441 | s = C_OMP_CLAUSE_SPLIT_TASKLOOP; | |||
2442 | break; | |||
2443 | case OMP_TARGET: | |||
2444 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_MAP)) | |||
2445 | != 0) | |||
2446 | s = C_OMP_CLAUSE_SPLIT_TARGET; | |||
2447 | break; | |||
2448 | default: | |||
2449 | break; | |||
2450 | } | |||
2451 | if (s != C_OMP_CLAUSE_SPLIT_COUNT) | |||
2452 | break; | |||
2453 | /* Error-recovery here, invalid if-modifier specified, add the | |||
2454 | clause to just one construct. */ | |||
2455 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_MAP)) != 0) | |||
2456 | s = C_OMP_CLAUSE_SPLIT_TARGET; | |||
2457 | else if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2458 | << PRAGMA_OMP_CLAUSE_NUM_THREADS)) != 0) | |||
2459 | s = C_OMP_CLAUSE_SPLIT_PARALLEL; | |||
2460 | else if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2461 | << PRAGMA_OMP_CLAUSE_NOGROUP)) != 0) | |||
2462 | s = C_OMP_CLAUSE_SPLIT_TASKLOOP; | |||
2463 | else if (code == OMP_SIMD) | |||
2464 | s = C_OMP_CLAUSE_SPLIT_SIMD; | |||
2465 | else | |||
2466 | gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2466, __FUNCTION__)); | |||
2467 | break; | |||
2468 | } | |||
2469 | /* Otherwise, duplicate if clause to all constructs. */ | |||
2470 | if (code == OMP_SIMD) | |||
2471 | { | |||
2472 | if ((mask & ((OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_MAP) | |||
2473 | | (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2474 | << PRAGMA_OMP_CLAUSE_NUM_THREADS) | |||
2475 | | (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_NOGROUP))) | |||
2476 | != 0) | |||
2477 | { | |||
2478 | c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2478, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2479 | OMP_CLAUSE_IF); | |||
2480 | OMP_CLAUSE_IF_MODIFIER (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_IF), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2480, __FUNCTION__))->omp_clause.subcode.if_modifier) | |||
2481 | = OMP_CLAUSE_IF_MODIFIER (clauses)((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_IF), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2481, __FUNCTION__))->omp_clause.subcode.if_modifier); | |||
2482 | 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/c-family/c-omp.cc" , 2482, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2482, __FUNCTION__))) = OMP_CLAUSE_IF_EXPR (clauses)(*(omp_clause_elt_check (((omp_clause_subcode_check ((clauses ), (OMP_CLAUSE_IF), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2482, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2482, __FUNCTION__))); | |||
2483 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2483, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2483, __FUNCTION__))->common.chain) = cclauses[C_OMP_CLAUSE_SPLIT_SIMD]; | |||
2484 | cclauses[C_OMP_CLAUSE_SPLIT_SIMD] = c; | |||
2485 | } | |||
2486 | else | |||
2487 | { | |||
2488 | s = C_OMP_CLAUSE_SPLIT_SIMD; | |||
2489 | break; | |||
2490 | } | |||
2491 | } | |||
2492 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_NOGROUP)) | |||
2493 | != 0) | |||
2494 | { | |||
2495 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2496 | << PRAGMA_OMP_CLAUSE_NUM_THREADS)) != 0) | |||
2497 | { | |||
2498 | c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2498, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2499 | OMP_CLAUSE_IF); | |||
2500 | OMP_CLAUSE_IF_MODIFIER (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_IF), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2500, __FUNCTION__))->omp_clause.subcode.if_modifier) | |||
2501 | = OMP_CLAUSE_IF_MODIFIER (clauses)((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_IF), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2501, __FUNCTION__))->omp_clause.subcode.if_modifier); | |||
2502 | 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/c-family/c-omp.cc" , 2502, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2502, __FUNCTION__))) = OMP_CLAUSE_IF_EXPR (clauses)(*(omp_clause_elt_check (((omp_clause_subcode_check ((clauses ), (OMP_CLAUSE_IF), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2502, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2502, __FUNCTION__))); | |||
2503 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2503, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2503, __FUNCTION__))->common.chain) = cclauses[C_OMP_CLAUSE_SPLIT_TASKLOOP]; | |||
2504 | cclauses[C_OMP_CLAUSE_SPLIT_TASKLOOP] = c; | |||
2505 | s = C_OMP_CLAUSE_SPLIT_PARALLEL; | |||
2506 | } | |||
2507 | else | |||
2508 | s = C_OMP_CLAUSE_SPLIT_TASKLOOP; | |||
2509 | } | |||
2510 | else if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2511 | << PRAGMA_OMP_CLAUSE_NUM_THREADS)) != 0) | |||
2512 | { | |||
2513 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2514 | << PRAGMA_OMP_CLAUSE_MAP)) != 0) | |||
2515 | { | |||
2516 | c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2516, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2517 | OMP_CLAUSE_IF); | |||
2518 | OMP_CLAUSE_IF_MODIFIER (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_IF), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2518, __FUNCTION__))->omp_clause.subcode.if_modifier) | |||
2519 | = OMP_CLAUSE_IF_MODIFIER (clauses)((omp_clause_subcode_check ((clauses), (OMP_CLAUSE_IF), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2519, __FUNCTION__))->omp_clause.subcode.if_modifier); | |||
2520 | 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/c-family/c-omp.cc" , 2520, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2520, __FUNCTION__))) = OMP_CLAUSE_IF_EXPR (clauses)(*(omp_clause_elt_check (((omp_clause_subcode_check ((clauses ), (OMP_CLAUSE_IF), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2520, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2520, __FUNCTION__))); | |||
2521 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2521, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2521, __FUNCTION__))->common.chain) = cclauses[C_OMP_CLAUSE_SPLIT_TARGET]; | |||
2522 | cclauses[C_OMP_CLAUSE_SPLIT_TARGET] = c; | |||
2523 | s = C_OMP_CLAUSE_SPLIT_PARALLEL; | |||
2524 | } | |||
2525 | else | |||
2526 | s = C_OMP_CLAUSE_SPLIT_PARALLEL; | |||
2527 | } | |||
2528 | else | |||
2529 | s = C_OMP_CLAUSE_SPLIT_TARGET; | |||
2530 | break; | |||
2531 | case OMP_CLAUSE_LINEAR: | |||
2532 | /* Linear clause is allowed on simd and for. Put it on the | |||
2533 | innermost construct. */ | |||
2534 | if (code == OMP_SIMD) | |||
2535 | s = C_OMP_CLAUSE_SPLIT_SIMD; | |||
2536 | else | |||
2537 | s = C_OMP_CLAUSE_SPLIT_FOR; | |||
2538 | break; | |||
2539 | case OMP_CLAUSE_NOWAIT: | |||
2540 | /* Nowait clause is allowed on target, for and sections, but | |||
2541 | is not allowed on parallel for or parallel sections. Therefore, | |||
2542 | put it on target construct if present, because that can only | |||
2543 | be combined with parallel for{, simd} and not with for{, simd}, | |||
2544 | otherwise to the worksharing construct. */ | |||
2545 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_MAP)) | |||
2546 | != 0) | |||
2547 | s = C_OMP_CLAUSE_SPLIT_TARGET; | |||
2548 | else | |||
2549 | s = C_OMP_CLAUSE_SPLIT_FOR; | |||
2550 | break; | |||
2551 | /* thread_limit is allowed on target and teams. Distribute it | |||
2552 | to all. */ | |||
2553 | case OMP_CLAUSE_THREAD_LIMIT: | |||
2554 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_MAP)) | |||
2555 | != 0) | |||
2556 | { | |||
2557 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_NUM_TEAMS)) | |||
2558 | != 0) | |||
2559 | { | |||
2560 | c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2560, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2561 | OMP_CLAUSE_THREAD_LIMIT); | |||
2562 | OMP_CLAUSE_THREAD_LIMIT_EXPR (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_THREAD_LIMIT ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2562, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2562, __FUNCTION__))) | |||
2563 | = OMP_CLAUSE_THREAD_LIMIT_EXPR (clauses)(*(omp_clause_elt_check (((omp_clause_subcode_check ((clauses ), (OMP_CLAUSE_THREAD_LIMIT), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2563, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2563, __FUNCTION__))); | |||
2564 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2564, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2564, __FUNCTION__))->common.chain) = cclauses[C_OMP_CLAUSE_SPLIT_TARGET]; | |||
2565 | cclauses[C_OMP_CLAUSE_SPLIT_TARGET] = c; | |||
2566 | } | |||
2567 | else | |||
2568 | { | |||
2569 | s = C_OMP_CLAUSE_SPLIT_TARGET; | |||
2570 | break; | |||
2571 | } | |||
2572 | } | |||
2573 | s = C_OMP_CLAUSE_SPLIT_TEAMS; | |||
2574 | break; | |||
2575 | /* Allocate clause is allowed on target, teams, distribute, parallel, | |||
2576 | for, sections and taskloop. Distribute it to all. */ | |||
2577 | case OMP_CLAUSE_ALLOCATE: | |||
2578 | s = C_OMP_CLAUSE_SPLIT_COUNT; | |||
2579 | for (i = 0; i < C_OMP_CLAUSE_SPLIT_COUNT; i++) | |||
2580 | { | |||
2581 | switch (i) | |||
2582 | { | |||
2583 | case C_OMP_CLAUSE_SPLIT_TARGET: | |||
2584 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2585 | << PRAGMA_OMP_CLAUSE_MAP)) == 0) | |||
2586 | continue; | |||
2587 | break; | |||
2588 | case C_OMP_CLAUSE_SPLIT_TEAMS: | |||
2589 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2590 | << PRAGMA_OMP_CLAUSE_NUM_TEAMS)) == 0) | |||
2591 | continue; | |||
2592 | break; | |||
2593 | case C_OMP_CLAUSE_SPLIT_DISTRIBUTE: | |||
2594 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2595 | << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE)) == 0) | |||
2596 | continue; | |||
2597 | break; | |||
2598 | case C_OMP_CLAUSE_SPLIT_PARALLEL: | |||
2599 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2600 | << PRAGMA_OMP_CLAUSE_NUM_THREADS)) == 0) | |||
2601 | continue; | |||
2602 | break; | |||
2603 | case C_OMP_CLAUSE_SPLIT_FOR: | |||
2604 | STATIC_ASSERT (C_OMP_CLAUSE_SPLIT_SECTIONSstatic_assert ((C_OMP_CLAUSE_SPLIT_SECTIONS == C_OMP_CLAUSE_SPLIT_FOR && (C_OMP_CLAUSE_SPLIT_TASKLOOP == C_OMP_CLAUSE_SPLIT_FOR ) && (C_OMP_CLAUSE_SPLIT_LOOP == C_OMP_CLAUSE_SPLIT_FOR )), "C_OMP_CLAUSE_SPLIT_SECTIONS == C_OMP_CLAUSE_SPLIT_FOR && (C_OMP_CLAUSE_SPLIT_TASKLOOP == C_OMP_CLAUSE_SPLIT_FOR) && (C_OMP_CLAUSE_SPLIT_LOOP == C_OMP_CLAUSE_SPLIT_FOR)" ) | |||
2605 | == C_OMP_CLAUSE_SPLIT_FORstatic_assert ((C_OMP_CLAUSE_SPLIT_SECTIONS == C_OMP_CLAUSE_SPLIT_FOR && (C_OMP_CLAUSE_SPLIT_TASKLOOP == C_OMP_CLAUSE_SPLIT_FOR ) && (C_OMP_CLAUSE_SPLIT_LOOP == C_OMP_CLAUSE_SPLIT_FOR )), "C_OMP_CLAUSE_SPLIT_SECTIONS == C_OMP_CLAUSE_SPLIT_FOR && (C_OMP_CLAUSE_SPLIT_TASKLOOP == C_OMP_CLAUSE_SPLIT_FOR) && (C_OMP_CLAUSE_SPLIT_LOOP == C_OMP_CLAUSE_SPLIT_FOR)" ) | |||
2606 | && (C_OMP_CLAUSE_SPLIT_TASKLOOPstatic_assert ((C_OMP_CLAUSE_SPLIT_SECTIONS == C_OMP_CLAUSE_SPLIT_FOR && (C_OMP_CLAUSE_SPLIT_TASKLOOP == C_OMP_CLAUSE_SPLIT_FOR ) && (C_OMP_CLAUSE_SPLIT_LOOP == C_OMP_CLAUSE_SPLIT_FOR )), "C_OMP_CLAUSE_SPLIT_SECTIONS == C_OMP_CLAUSE_SPLIT_FOR && (C_OMP_CLAUSE_SPLIT_TASKLOOP == C_OMP_CLAUSE_SPLIT_FOR) && (C_OMP_CLAUSE_SPLIT_LOOP == C_OMP_CLAUSE_SPLIT_FOR)" ) | |||
2607 | == C_OMP_CLAUSE_SPLIT_FOR)static_assert ((C_OMP_CLAUSE_SPLIT_SECTIONS == C_OMP_CLAUSE_SPLIT_FOR && (C_OMP_CLAUSE_SPLIT_TASKLOOP == C_OMP_CLAUSE_SPLIT_FOR ) && (C_OMP_CLAUSE_SPLIT_LOOP == C_OMP_CLAUSE_SPLIT_FOR )), "C_OMP_CLAUSE_SPLIT_SECTIONS == C_OMP_CLAUSE_SPLIT_FOR && (C_OMP_CLAUSE_SPLIT_TASKLOOP == C_OMP_CLAUSE_SPLIT_FOR) && (C_OMP_CLAUSE_SPLIT_LOOP == C_OMP_CLAUSE_SPLIT_FOR)" ) | |||
2608 | && (C_OMP_CLAUSE_SPLIT_LOOPstatic_assert ((C_OMP_CLAUSE_SPLIT_SECTIONS == C_OMP_CLAUSE_SPLIT_FOR && (C_OMP_CLAUSE_SPLIT_TASKLOOP == C_OMP_CLAUSE_SPLIT_FOR ) && (C_OMP_CLAUSE_SPLIT_LOOP == C_OMP_CLAUSE_SPLIT_FOR )), "C_OMP_CLAUSE_SPLIT_SECTIONS == C_OMP_CLAUSE_SPLIT_FOR && (C_OMP_CLAUSE_SPLIT_TASKLOOP == C_OMP_CLAUSE_SPLIT_FOR) && (C_OMP_CLAUSE_SPLIT_LOOP == C_OMP_CLAUSE_SPLIT_FOR)" ) | |||
2609 | == C_OMP_CLAUSE_SPLIT_FOR))static_assert ((C_OMP_CLAUSE_SPLIT_SECTIONS == C_OMP_CLAUSE_SPLIT_FOR && (C_OMP_CLAUSE_SPLIT_TASKLOOP == C_OMP_CLAUSE_SPLIT_FOR ) && (C_OMP_CLAUSE_SPLIT_LOOP == C_OMP_CLAUSE_SPLIT_FOR )), "C_OMP_CLAUSE_SPLIT_SECTIONS == C_OMP_CLAUSE_SPLIT_FOR && (C_OMP_CLAUSE_SPLIT_TASKLOOP == C_OMP_CLAUSE_SPLIT_FOR) && (C_OMP_CLAUSE_SPLIT_LOOP == C_OMP_CLAUSE_SPLIT_FOR)" ); | |||
2610 | if (code == OMP_SECTIONS) | |||
2611 | break; | |||
2612 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2613 | << PRAGMA_OMP_CLAUSE_SCHEDULE)) != 0) | |||
2614 | break; | |||
2615 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) | |||
2616 | << PRAGMA_OMP_CLAUSE_NOGROUP)) != 0) | |||
2617 | break; | |||
2618 | continue; | |||
2619 | case C_OMP_CLAUSE_SPLIT_SIMD: | |||
2620 | continue; | |||
2621 | default: | |||
2622 | gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2622, __FUNCTION__)); | |||
2623 | } | |||
2624 | if (s != C_OMP_CLAUSE_SPLIT_COUNT) | |||
2625 | { | |||
2626 | c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses)((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2626, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2627 | OMP_CLAUSE_ALLOCATE); | |||
2628 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2628, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2628, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2628, __FUNCTION__))) | |||
2629 | = OMP_CLAUSE_DECL (clauses)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2629, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2629, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2629, __FUNCTION__))); | |||
2630 | 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/c-family/c-omp.cc" , 2630, __FUNCTION__))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2630, __FUNCTION__))) | |||
2631 | = OMP_CLAUSE_ALLOCATE_ALLOCATOR (clauses)(*(omp_clause_elt_check (((omp_clause_subcode_check ((clauses ), (OMP_CLAUSE_ALLOCATE), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2631, __FUNCTION__))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2631, __FUNCTION__))); | |||
2632 | 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/c-family/c-omp.cc" , 2632, __FUNCTION__))), (2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2632, __FUNCTION__))) | |||
2633 | = OMP_CLAUSE_ALLOCATE_ALIGN (clauses)(*(omp_clause_elt_check (((omp_clause_subcode_check ((clauses ), (OMP_CLAUSE_ALLOCATE), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2633, __FUNCTION__))), (2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2633, __FUNCTION__))); | |||
2634 | OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2634, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2634, __FUNCTION__))->common.chain) = cclauses[s]; | |||
2635 | cclauses[s] = c; | |||
2636 | has_dup_allocate = true; | |||
2637 | } | |||
2638 | s = (enum c_omp_clause_split) i; | |||
2639 | } | |||
2640 | gcc_assert (s != C_OMP_CLAUSE_SPLIT_COUNT)((void)(!(s != C_OMP_CLAUSE_SPLIT_COUNT) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2640, __FUNCTION__), 0 : 0)); | |||
2641 | break; | |||
2642 | default: | |||
2643 | gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2643, __FUNCTION__)); | |||
2644 | } | |||
2645 | OMP_CLAUSE_CHAIN (clauses)((contains_struct_check (((tree_check ((clauses), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2645, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2645, __FUNCTION__))->common.chain) = cclauses[s]; | |||
2646 | cclauses[s] = clauses; | |||
2647 | } | |||
2648 | ||||
2649 | if (has_dup_allocate) | |||
2650 | { | |||
2651 | bool need_prune = false; | |||
2652 | bitmap_obstack_initialize (NULLnullptr); | |||
2653 | for (i = 0; i < C_OMP_CLAUSE_SPLIT_SIMD - (code == OMP_LOOP); i++) | |||
2654 | if (cclauses[i]) | |||
2655 | { | |||
2656 | bitmap_head allocate_head; | |||
2657 | bitmap_initialize (&allocate_head, &bitmap_default_obstack); | |||
2658 | for (c = cclauses[i]; c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2658, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2658, __FUNCTION__))->common.chain)) | |||
2659 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2659, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_ALLOCATE | |||
2660 | && DECL_P (OMP_CLAUSE_DECL (c))(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) ((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2660, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2660, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2660, __FUNCTION__))))->base.code))] == tcc_declaration)) | |||
2661 | bitmap_set_bit (&allocate_head, | |||
2662 | DECL_UID (OMP_CLAUSE_DECL (c))((contains_struct_check (((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2662, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2662, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2662, __FUNCTION__)))), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2662, __FUNCTION__))->decl_minimal.uid)); | |||
2663 | for (c = cclauses[i]; c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2663, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2663, __FUNCTION__))->common.chain)) | |||
2664 | switch (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2664, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code) | |||
2665 | { | |||
2666 | case OMP_CLAUSE_REDUCTION: | |||
2667 | case OMP_CLAUSE_IN_REDUCTION: | |||
2668 | case OMP_CLAUSE_TASK_REDUCTION: | |||
2669 | 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/c-family/c-omp.cc" , 2669, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2669, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2669, __FUNCTION__))))->base.code) == MEM_REF) | |||
2670 | { | |||
2671 | tree t = TREE_OPERAND (OMP_CLAUSE_DECL (c), 0)(*((const_cast<tree*> (tree_operand_check (((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2671, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2671, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2671, __FUNCTION__)))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2671, __FUNCTION__))))); | |||
2672 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) == POINTER_PLUS_EXPR) | |||
2673 | t = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2673, __FUNCTION__))))); | |||
2674 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) == ADDR_EXPR | |||
2675 | || TREE_CODE (t)((enum tree_code) (t)->base.code) == INDIRECT_REF) | |||
2676 | t = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2676, __FUNCTION__))))); | |||
2677 | if (DECL_P (t)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (t)->base.code))] == tcc_declaration)) | |||
2678 | bitmap_clear_bit (&allocate_head, DECL_UID (t)((contains_struct_check ((t), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2678, __FUNCTION__))->decl_minimal.uid)); | |||
2679 | break; | |||
2680 | } | |||
2681 | else 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/c-family/c-omp.cc" , 2681, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2681, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2681, __FUNCTION__))))->base.code) == TREE_LIST) | |||
2682 | { | |||
2683 | tree t; | |||
2684 | for (t = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2684, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2684, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2684, __FUNCTION__))); | |||
2685 | TREE_CODE (t)((enum tree_code) (t)->base.code) == TREE_LIST; t = TREE_CHAIN (t)((contains_struct_check ((t), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2685, __FUNCTION__))->common.chain)) | |||
2686 | ; | |||
2687 | if (DECL_P (t)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (t)->base.code))] == tcc_declaration)) | |||
2688 | bitmap_clear_bit (&allocate_head, DECL_UID (t)((contains_struct_check ((t), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2688, __FUNCTION__))->decl_minimal.uid)); | |||
2689 | break; | |||
2690 | } | |||
2691 | /* FALLTHRU */ | |||
2692 | case OMP_CLAUSE_PRIVATE: | |||
2693 | case OMP_CLAUSE_FIRSTPRIVATE: | |||
2694 | case OMP_CLAUSE_LASTPRIVATE: | |||
2695 | case OMP_CLAUSE_LINEAR: | |||
2696 | if (DECL_P (OMP_CLAUSE_DECL (c))(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) ((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2696, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2696, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2696, __FUNCTION__))))->base.code))] == tcc_declaration)) | |||
2697 | bitmap_clear_bit (&allocate_head, | |||
2698 | DECL_UID (OMP_CLAUSE_DECL (c))((contains_struct_check (((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2698, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2698, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2698, __FUNCTION__)))), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2698, __FUNCTION__))->decl_minimal.uid)); | |||
2699 | break; | |||
2700 | default: | |||
2701 | break; | |||
2702 | } | |||
2703 | for (c = cclauses[i]; c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2703, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2703, __FUNCTION__))->common.chain)) | |||
2704 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2704, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_ALLOCATE | |||
2705 | && DECL_P (OMP_CLAUSE_DECL (c))(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) ((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2705, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2705, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2705, __FUNCTION__))))->base.code))] == tcc_declaration) | |||
2706 | && bitmap_bit_p (&allocate_head, | |||
2707 | DECL_UID (OMP_CLAUSE_DECL (c))((contains_struct_check (((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2707, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2707, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2707, __FUNCTION__)))), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2707, __FUNCTION__))->decl_minimal.uid))) | |||
2708 | { | |||
2709 | /* Mark allocate clauses which don't have corresponding | |||
2710 | explicit data sharing clause. */ | |||
2711 | OMP_CLAUSE_ALLOCATE_COMBINED (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_ALLOCATE), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2711, __FUNCTION__))->base.public_flag) = 1; | |||
2712 | need_prune = true; | |||
2713 | } | |||
2714 | } | |||
2715 | bitmap_obstack_release (NULLnullptr); | |||
2716 | if (need_prune) | |||
2717 | { | |||
2718 | /* At least one allocate clause has been marked. Walk all the | |||
2719 | duplicated allocate clauses in sync. If it is marked in all | |||
2720 | constituent constructs, diagnose it as invalid and remove | |||
2721 | them. Otherwise, remove all marked inner clauses inside | |||
2722 | a construct that doesn't have them marked. Keep the outer | |||
2723 | marked ones, because some clause duplication is done only | |||
2724 | during gimplification. */ | |||
2725 | tree *p[C_OMP_CLAUSE_SPLIT_COUNT]; | |||
2726 | for (i = 0; i < C_OMP_CLAUSE_SPLIT_COUNT; i++) | |||
2727 | if (cclauses[i] == NULL_TREE(tree) nullptr | |||
2728 | || i == C_OMP_CLAUSE_SPLIT_SIMD | |||
2729 | || (i == C_OMP_CLAUSE_SPLIT_LOOP && code == OMP_LOOP)) | |||
2730 | p[i] = NULLnullptr; | |||
2731 | else | |||
2732 | p[i] = &cclauses[i]; | |||
2733 | do | |||
2734 | { | |||
2735 | int j = -1; | |||
2736 | tree seen = NULL_TREE(tree) nullptr; | |||
2737 | for (i = C_OMP_CLAUSE_SPLIT_COUNT - 1; i >= 0; i--) | |||
2738 | if (p[i]) | |||
2739 | { | |||
2740 | while (*p[i] | |||
2741 | && OMP_CLAUSE_CODE (*p[i])((tree_check ((*p[i]), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2741, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code != OMP_CLAUSE_ALLOCATE) | |||
2742 | p[i] = &OMP_CLAUSE_CHAIN (*p[i])((contains_struct_check (((tree_check ((*p[i]), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2742, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2742, __FUNCTION__))->common.chain); | |||
2743 | if (*p[i] == NULL_TREE(tree) nullptr) | |||
2744 | { | |||
2745 | i = C_OMP_CLAUSE_SPLIT_COUNT; | |||
2746 | break; | |||
2747 | } | |||
2748 | if (!OMP_CLAUSE_ALLOCATE_COMBINED (*p[i])((omp_clause_subcode_check ((*p[i]), (OMP_CLAUSE_ALLOCATE), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2748, __FUNCTION__))->base.public_flag) && j == -1) | |||
2749 | j = i; | |||
2750 | seen = *p[i]; | |||
2751 | } | |||
2752 | if (i == C_OMP_CLAUSE_SPLIT_COUNT) | |||
2753 | break; | |||
2754 | if (j == -1) | |||
2755 | error_at (OMP_CLAUSE_LOCATION (seen)((tree_check ((seen), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2755, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2756 | "%qD specified in %<allocate%> clause but not in " | |||
2757 | "an explicit privatization clause", | |||
2758 | OMP_CLAUSE_DECL (seen)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((seen), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2758, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2758, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2758, __FUNCTION__)))); | |||
2759 | for (i = 0; i < C_OMP_CLAUSE_SPLIT_COUNT; i++) | |||
2760 | if (p[i]) | |||
2761 | { | |||
2762 | if (i > j) | |||
2763 | /* Remove. */ | |||
2764 | *p[i] = OMP_CLAUSE_CHAIN (*p[i])((contains_struct_check (((tree_check ((*p[i]), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2764, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2764, __FUNCTION__))->common.chain); | |||
2765 | else | |||
2766 | /* Keep. */ | |||
2767 | p[i] = &OMP_CLAUSE_CHAIN (*p[i])((contains_struct_check (((tree_check ((*p[i]), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2767, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2767, __FUNCTION__))->common.chain); | |||
2768 | } | |||
2769 | } | |||
2770 | while (1); | |||
2771 | } | |||
2772 | } | |||
2773 | ||||
2774 | if (!flag_checkingglobal_options.x_flag_checking) | |||
2775 | return; | |||
2776 | ||||
2777 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_MAP)) == 0) | |||
2778 | gcc_assert (cclauses[C_OMP_CLAUSE_SPLIT_TARGET] == NULL_TREE)((void)(!(cclauses[C_OMP_CLAUSE_SPLIT_TARGET] == (tree) nullptr ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2778, __FUNCTION__), 0 : 0)); | |||
2779 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_NUM_TEAMS)) == 0) | |||
2780 | gcc_assert (cclauses[C_OMP_CLAUSE_SPLIT_TEAMS] == NULL_TREE)((void)(!(cclauses[C_OMP_CLAUSE_SPLIT_TEAMS] == (tree) nullptr ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2780, __FUNCTION__), 0 : 0)); | |||
2781 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE)) == 0 | |||
2782 | && (mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_FILTER)) == 0) | |||
2783 | gcc_assert (cclauses[C_OMP_CLAUSE_SPLIT_DISTRIBUTE] == NULL_TREE)((void)(!(cclauses[C_OMP_CLAUSE_SPLIT_DISTRIBUTE] == (tree) nullptr ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2783, __FUNCTION__), 0 : 0)); | |||
2784 | if ((mask & (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_NUM_THREADS)) == 0) | |||
2785 | gcc_assert (cclauses[C_OMP_CLAUSE_SPLIT_PARALLEL] == NULL_TREE)((void)(!(cclauses[C_OMP_CLAUSE_SPLIT_PARALLEL] == (tree) nullptr ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2785, __FUNCTION__), 0 : 0)); | |||
2786 | if ((mask & ((OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_SCHEDULE) | |||
2787 | | (OMP_CLAUSE_MASK_1omp_clause_mask (1) << PRAGMA_OMP_CLAUSE_NOGROUP))) == 0 | |||
2788 | && code != OMP_SECTIONS | |||
2789 | && code != OMP_LOOP) | |||
2790 | gcc_assert (cclauses[C_OMP_CLAUSE_SPLIT_FOR] == NULL_TREE)((void)(!(cclauses[C_OMP_CLAUSE_SPLIT_FOR] == (tree) nullptr) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2790, __FUNCTION__), 0 : 0)); | |||
2791 | if (code != OMP_SIMD) | |||
2792 | gcc_assert (cclauses[C_OMP_CLAUSE_SPLIT_SIMD] == NULL_TREE)((void)(!(cclauses[C_OMP_CLAUSE_SPLIT_SIMD] == (tree) nullptr ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2792, __FUNCTION__), 0 : 0)); | |||
2793 | } | |||
2794 | ||||
2795 | ||||
2796 | /* qsort callback to compare #pragma omp declare simd clauses. */ | |||
2797 | ||||
2798 | static int | |||
2799 | c_omp_declare_simd_clause_cmp (const void *p, const void *q) | |||
2800 | { | |||
2801 | tree a = *(const tree *) p; | |||
2802 | tree b = *(const tree *) q; | |||
2803 | if (OMP_CLAUSE_CODE (a)((tree_check ((a), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2803, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code != OMP_CLAUSE_CODE (b)((tree_check ((b), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2803, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code) | |||
2804 | { | |||
2805 | if (OMP_CLAUSE_CODE (a)((tree_check ((a), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2805, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code > OMP_CLAUSE_CODE (b)((tree_check ((b), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2805, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code) | |||
2806 | return -1; | |||
2807 | return 1; | |||
2808 | } | |||
2809 | if (OMP_CLAUSE_CODE (a)((tree_check ((a), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2809, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code != OMP_CLAUSE_SIMDLEN | |||
2810 | && OMP_CLAUSE_CODE (a)((tree_check ((a), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2810, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code != OMP_CLAUSE_INBRANCH | |||
2811 | && OMP_CLAUSE_CODE (a)((tree_check ((a), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2811, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code != OMP_CLAUSE_NOTINBRANCH) | |||
2812 | { | |||
2813 | int c = tree_to_shwi (OMP_CLAUSE_DECL (a)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((a), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2813, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2813, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2813, __FUNCTION__)))); | |||
2814 | int d = tree_to_shwi (OMP_CLAUSE_DECL (b)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((b), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2814, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2814, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2814, __FUNCTION__)))); | |||
2815 | if (c < d) | |||
2816 | return 1; | |||
2817 | if (c > d) | |||
2818 | return -1; | |||
2819 | } | |||
2820 | return 0; | |||
2821 | } | |||
2822 | ||||
2823 | /* Change PARM_DECLs in OMP_CLAUSE_DECL of #pragma omp declare simd | |||
2824 | CLAUSES on FNDECL into argument indexes and sort them. */ | |||
2825 | ||||
2826 | tree | |||
2827 | c_omp_declare_simd_clauses_to_numbers (tree parms, tree clauses) | |||
2828 | { | |||
2829 | tree c; | |||
2830 | vec<tree> clvec = vNULL; | |||
2831 | ||||
2832 | for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2832, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2832, __FUNCTION__))->common.chain)) | |||
2833 | { | |||
2834 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2834, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code != OMP_CLAUSE_SIMDLEN | |||
2835 | && OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2835, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code != OMP_CLAUSE_INBRANCH | |||
2836 | && OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2836, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code != OMP_CLAUSE_NOTINBRANCH) | |||
2837 | { | |||
2838 | 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/c-family/c-omp.cc" , 2838, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2838, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2838, __FUNCTION__))); | |||
2839 | tree arg; | |||
2840 | int idx; | |||
2841 | for (arg = parms, idx = 0; arg; | |||
2842 | arg = TREE_CHAIN (arg)((contains_struct_check ((arg), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2842, __FUNCTION__))->common.chain), idx++) | |||
2843 | if (arg == decl) | |||
2844 | break; | |||
2845 | if (arg == NULL_TREE(tree) nullptr) | |||
2846 | { | |||
2847 | error_at (OMP_CLAUSE_LOCATION (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2847, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2848 | "%qD is not a function argument", decl); | |||
2849 | continue; | |||
2850 | } | |||
2851 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2851, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2851, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2851, __FUNCTION__))) = build_int_cst (integer_type_nodeinteger_types[itk_int], idx); | |||
2852 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2852, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_LINEAR | |||
2853 | && OMP_CLAUSE_LINEAR_VARIABLE_STRIDE (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_LINEAR), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2853, __FUNCTION__)))->base.protected_flag)) | |||
2854 | { | |||
2855 | decl = OMP_CLAUSE_LINEAR_STEP (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_LINEAR ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2855, __FUNCTION__))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2855, __FUNCTION__))); | |||
2856 | for (arg = parms, idx = 0; arg; | |||
2857 | arg = TREE_CHAIN (arg)((contains_struct_check ((arg), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2857, __FUNCTION__))->common.chain), idx++) | |||
2858 | if (arg == decl) | |||
2859 | break; | |||
2860 | if (arg == NULL_TREE(tree) nullptr) | |||
2861 | { | |||
2862 | error_at (OMP_CLAUSE_LOCATION (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2862, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, | |||
2863 | "%qD is not a function argument", decl); | |||
2864 | continue; | |||
2865 | } | |||
2866 | OMP_CLAUSE_LINEAR_STEP (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_LINEAR ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2866, __FUNCTION__))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2866, __FUNCTION__))) | |||
2867 | = build_int_cst (integer_type_nodeinteger_types[itk_int], idx); | |||
2868 | } | |||
2869 | } | |||
2870 | clvec.safe_push (c); | |||
2871 | } | |||
2872 | if (!clvec.is_empty ()) | |||
2873 | { | |||
2874 | unsigned int len = clvec.length (), i; | |||
2875 | clvec.qsort (c_omp_declare_simd_clause_cmp)qsort (c_omp_declare_simd_clause_cmp); | |||
2876 | clauses = clvec[0]; | |||
2877 | for (i = 0; i < len; i++) | |||
2878 | OMP_CLAUSE_CHAIN (clvec[i])((contains_struct_check (((tree_check ((clvec[i]), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2878, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2878, __FUNCTION__))->common.chain) = (i < len - 1) ? clvec[i + 1] : NULL_TREE(tree) nullptr; | |||
2879 | } | |||
2880 | else | |||
2881 | clauses = NULL_TREE(tree) nullptr; | |||
2882 | clvec.release (); | |||
2883 | return clauses; | |||
2884 | } | |||
2885 | ||||
2886 | /* Change argument indexes in CLAUSES of FNDECL back to PARM_DECLs. */ | |||
2887 | ||||
2888 | void | |||
2889 | c_omp_declare_simd_clauses_to_decls (tree fndecl, tree clauses) | |||
2890 | { | |||
2891 | tree c; | |||
2892 | ||||
2893 | for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2893, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2893, __FUNCTION__))->common.chain)) | |||
2894 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2894, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code != OMP_CLAUSE_SIMDLEN | |||
2895 | && OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2895, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code != OMP_CLAUSE_INBRANCH | |||
2896 | && OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2896, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code != OMP_CLAUSE_NOTINBRANCH) | |||
2897 | { | |||
2898 | int idx = tree_to_shwi (OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2898, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2898, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2898, __FUNCTION__)))), i; | |||
2899 | tree arg; | |||
2900 | for (arg = DECL_ARGUMENTS (fndecl)((tree_check ((fndecl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2900, __FUNCTION__, (FUNCTION_DECL)))->function_decl.arguments ), i = 0; arg; | |||
2901 | arg = TREE_CHAIN (arg)((contains_struct_check ((arg), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2901, __FUNCTION__))->common.chain), i++) | |||
2902 | if (i == idx) | |||
2903 | break; | |||
2904 | gcc_assert (arg)((void)(!(arg) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2904, __FUNCTION__), 0 : 0)); | |||
2905 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2905, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2905, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2905, __FUNCTION__))) = arg; | |||
2906 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2906, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_LINEAR | |||
2907 | && OMP_CLAUSE_LINEAR_VARIABLE_STRIDE (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_LINEAR), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2907, __FUNCTION__)))->base.protected_flag)) | |||
2908 | { | |||
2909 | idx = tree_to_shwi (OMP_CLAUSE_LINEAR_STEP (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_LINEAR ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2909, __FUNCTION__))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2909, __FUNCTION__)))); | |||
2910 | for (arg = DECL_ARGUMENTS (fndecl)((tree_check ((fndecl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2910, __FUNCTION__, (FUNCTION_DECL)))->function_decl.arguments ), i = 0; arg; | |||
2911 | arg = TREE_CHAIN (arg)((contains_struct_check ((arg), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2911, __FUNCTION__))->common.chain), i++) | |||
2912 | if (i == idx) | |||
2913 | break; | |||
2914 | gcc_assert (arg)((void)(!(arg) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2914, __FUNCTION__), 0 : 0)); | |||
2915 | OMP_CLAUSE_LINEAR_STEP (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_LINEAR ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2915, __FUNCTION__))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2915, __FUNCTION__))) = arg; | |||
2916 | } | |||
2917 | } | |||
2918 | } | |||
2919 | ||||
2920 | /* Return true for __func__ and similar function-local predefined | |||
2921 | variables (which are in OpenMP predetermined shared, allowed in | |||
2922 | shared/firstprivate clauses). */ | |||
2923 | ||||
2924 | bool | |||
2925 | c_omp_predefined_variable (tree decl) | |||
2926 | { | |||
2927 | if (VAR_P (decl)(((enum tree_code) (decl)->base.code) == VAR_DECL) | |||
2928 | && DECL_ARTIFICIAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2928, __FUNCTION__))->decl_common.artificial_flag) | |||
2929 | && TREE_STATIC (decl)((decl)->base.static_flag) | |||
2930 | && DECL_NAME (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2930, __FUNCTION__))->decl_minimal.name)) | |||
2931 | { | |||
2932 | if (TREE_READONLY (decl)((non_type_check ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2932, __FUNCTION__))->base.readonly_flag) | |||
2933 | && (DECL_NAME (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2933, __FUNCTION__))->decl_minimal.name) == ridpointers[RID_C99_FUNCTION_NAME] | |||
2934 | || DECL_NAME (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2934, __FUNCTION__))->decl_minimal.name) == ridpointers[RID_FUNCTION_NAME] | |||
2935 | || DECL_NAME (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2935, __FUNCTION__))->decl_minimal.name) == ridpointers[RID_PRETTY_FUNCTION_NAME])) | |||
2936 | return true; | |||
2937 | /* For UBSan handle the same also ubsan_create_data created | |||
2938 | variables. There is no magic flag for those, but user variables | |||
2939 | shouldn't be DECL_ARTIFICIAL or have TYPE_ARTIFICIAL type with | |||
2940 | such names. */ | |||
2941 | if ((flag_sanitizeglobal_options.x_flag_sanitize & (SANITIZE_UNDEFINED | |||
2942 | | SANITIZE_UNDEFINED_NONDEFAULT)) != 0 | |||
2943 | && DECL_IGNORED_P (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2943, __FUNCTION__))->decl_common.ignored_flag) | |||
2944 | && !TREE_READONLY (decl)((non_type_check ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2944, __FUNCTION__))->base.readonly_flag) | |||
2945 | && TREE_CODE (DECL_NAME (decl))((enum tree_code) (((contains_struct_check ((decl), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2945, __FUNCTION__))->decl_minimal.name))->base.code) == IDENTIFIER_NODE | |||
2946 | && TREE_CODE (TREE_TYPE (decl))((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2946, __FUNCTION__))->typed.type))->base.code) == RECORD_TYPE | |||
2947 | && TYPE_ARTIFICIAL (TREE_TYPE (decl))((tree_class_check ((((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2947, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2947, __FUNCTION__))->base.nowarning_flag) | |||
2948 | && TYPE_NAME (TREE_TYPE (decl))((tree_class_check ((((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2948, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2948, __FUNCTION__))->type_common.name) | |||
2949 | && TREE_CODE (TYPE_NAME (TREE_TYPE (decl)))((enum tree_code) (((tree_class_check ((((contains_struct_check ((decl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2949, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2949, __FUNCTION__))->type_common.name))->base.code) == TYPE_DECL | |||
2950 | && DECL_NAME (TYPE_NAME (TREE_TYPE (decl)))((contains_struct_check ((((tree_class_check ((((contains_struct_check ((decl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2950, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2950, __FUNCTION__))->type_common.name)), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2950, __FUNCTION__))->decl_minimal.name) | |||
2951 | && (TREE_CODE (DECL_NAME (TYPE_NAME (TREE_TYPE (decl))))((enum tree_code) (((contains_struct_check ((((tree_class_check ((((contains_struct_check ((decl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2951, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2951, __FUNCTION__))->type_common.name)), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2951, __FUNCTION__))->decl_minimal.name))->base.code) | |||
2952 | == IDENTIFIER_NODE)) | |||
2953 | { | |||
2954 | tree id1 = DECL_NAME (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2954, __FUNCTION__))->decl_minimal.name); | |||
2955 | tree id2 = DECL_NAME (TYPE_NAME (TREE_TYPE (decl)))((contains_struct_check ((((tree_class_check ((((contains_struct_check ((decl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2955, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2955, __FUNCTION__))->type_common.name)), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2955, __FUNCTION__))->decl_minimal.name); | |||
2956 | if (IDENTIFIER_LENGTH (id1)((tree_check ((id1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2956, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.len ) >= sizeof ("ubsan_data") - 1 | |||
2957 | && IDENTIFIER_LENGTH (id2)((tree_check ((id2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2957, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.len ) >= sizeof ("__ubsan__data") | |||
2958 | && !memcmp (IDENTIFIER_POINTER (id2)((const char *) (tree_check ((id2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2958, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.str ), "__ubsan_", | |||
2959 | sizeof ("__ubsan_") - 1) | |||
2960 | && !memcmp (IDENTIFIER_POINTER (id2)((const char *) (tree_check ((id2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2960, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.str ) + IDENTIFIER_LENGTH (id2)((tree_check ((id2), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2960, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.len ) | |||
2961 | - sizeof ("_data") + 1, "_data", | |||
2962 | sizeof ("_data") - 1) | |||
2963 | && strstr (IDENTIFIER_POINTER (id1)((const char *) (tree_check ((id1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2963, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.str ), "ubsan_data")) | |||
2964 | return true; | |||
2965 | } | |||
2966 | } | |||
2967 | return false; | |||
2968 | } | |||
2969 | ||||
2970 | /* OMP_CLAUSE_DEFAULT_UNSPECIFIED unless OpenMP sharing attribute of DECL | |||
2971 | is predetermined. */ | |||
2972 | ||||
2973 | enum omp_clause_default_kind | |||
2974 | c_omp_predetermined_sharing (tree decl) | |||
2975 | { | |||
2976 | /* Predetermine artificial variables holding integral values, those | |||
2977 | are usually result of gimplify_one_sizepos or SAVE_EXPR | |||
2978 | gimplification. */ | |||
2979 | if (VAR_P (decl)(((enum tree_code) (decl)->base.code) == VAR_DECL) | |||
2980 | && DECL_ARTIFICIAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2980, __FUNCTION__))->decl_common.artificial_flag) | |||
2981 | && INTEGRAL_TYPE_P (TREE_TYPE (decl))(((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2981, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE || ((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2981, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE || ((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 2981, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE )) | |||
2982 | return OMP_CLAUSE_DEFAULT_SHARED; | |||
2983 | ||||
2984 | if (c_omp_predefined_variable (decl)) | |||
2985 | return OMP_CLAUSE_DEFAULT_SHARED; | |||
2986 | ||||
2987 | return OMP_CLAUSE_DEFAULT_UNSPECIFIED; | |||
2988 | } | |||
2989 | ||||
2990 | /* OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED unless OpenMP mapping attribute | |||
2991 | of DECL is predetermined. */ | |||
2992 | ||||
2993 | enum omp_clause_defaultmap_kind | |||
2994 | c_omp_predetermined_mapping (tree decl) | |||
2995 | { | |||
2996 | /* Predetermine artificial variables holding integral values, those | |||
2997 | are usually result of gimplify_one_sizepos or SAVE_EXPR | |||
2998 | gimplification. */ | |||
2999 | if (VAR_P (decl)(((enum tree_code) (decl)->base.code) == VAR_DECL) | |||
3000 | && DECL_ARTIFICIAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3000, __FUNCTION__))->decl_common.artificial_flag) | |||
3001 | && INTEGRAL_TYPE_P (TREE_TYPE (decl))(((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3001, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE || ((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3001, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE || ((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3001, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE )) | |||
3002 | return OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE; | |||
3003 | ||||
3004 | if (c_omp_predefined_variable (decl)) | |||
3005 | return OMP_CLAUSE_DEFAULTMAP_TO; | |||
3006 | ||||
3007 | return OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED; | |||
3008 | } | |||
3009 | ||||
3010 | ||||
3011 | /* Used to merge map clause information in c_omp_adjust_map_clauses. */ | |||
3012 | struct map_clause | |||
3013 | { | |||
3014 | tree clause; | |||
3015 | bool firstprivate_ptr_p; | |||
3016 | bool decl_mapped; | |||
3017 | bool omp_declare_target; | |||
3018 | map_clause (void) : clause (NULL_TREE(tree) nullptr), firstprivate_ptr_p (false), | |||
3019 | decl_mapped (false), omp_declare_target (false) { } | |||
3020 | }; | |||
3021 | ||||
3022 | /* Adjust map clauses after normal clause parsing, mainly to turn specific | |||
3023 | base-pointer map cases into attach/detach and mark them addressable. */ | |||
3024 | void | |||
3025 | c_omp_adjust_map_clauses (tree clauses, bool is_target) | |||
3026 | { | |||
3027 | if (!is_target) | |||
3028 | { | |||
3029 | /* If this is not a target construct, just turn firstprivate pointers | |||
3030 | into attach/detach, the runtime will check and do the rest. */ | |||
3031 | ||||
3032 | for (tree c = clauses; c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3032, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3032, __FUNCTION__))->common.chain)) | |||
3033 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3033, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_MAP | |||
3034 | && 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/c-family/c-omp.cc" , 3034, __FUNCTION__))->omp_clause.subcode.map_kind) == GOMP_MAP_FIRSTPRIVATE_POINTER | |||
3035 | && DECL_P (OMP_CLAUSE_DECL (c))(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) ((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3035, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3035, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3035, __FUNCTION__))))->base.code))] == tcc_declaration) | |||
3036 | && POINTER_TYPE_P (TREE_TYPE (OMP_CLAUSE_DECL (c)))(((enum tree_code) (((contains_struct_check (((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3036, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3036, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3036, __FUNCTION__)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3036, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check (((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3036, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3036, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3036, __FUNCTION__)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3036, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) | |||
3037 | { | |||
3038 | tree ptr = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3038, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3038, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3038, __FUNCTION__))); | |||
3039 | OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_ATTACH_DETACH)((omp_clause_subcode_check ((c), (OMP_CLAUSE_MAP), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3039, __FUNCTION__))->omp_clause.subcode.map_kind = (unsigned int) (GOMP_MAP_ATTACH_DETACH)); | |||
3040 | c_common_mark_addressable_vec (ptr); | |||
3041 | } | |||
3042 | return; | |||
3043 | } | |||
3044 | ||||
3045 | hash_map<tree, map_clause> maps; | |||
3046 | ||||
3047 | for (tree c = clauses; c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3047, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3047, __FUNCTION__))->common.chain)) | |||
3048 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3048, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_MAP | |||
3049 | && DECL_P (OMP_CLAUSE_DECL (c))(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) ((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3049, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3049, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3049, __FUNCTION__))))->base.code))] == tcc_declaration)) | |||
3050 | { | |||
3051 | /* If this is for a target construct, the firstprivate pointer | |||
3052 | is changed to attach/detach if either is true: | |||
3053 | (1) the base-pointer is mapped in this same construct, or | |||
3054 | (2) the base-pointer is a variable place on the device by | |||
3055 | "declare target" directives. | |||
3056 | ||||
3057 | Here we iterate through all map clauses collecting these cases, | |||
3058 | and merge them with a hash_map to process below. */ | |||
3059 | ||||
3060 | 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/c-family/c-omp.cc" , 3060, __FUNCTION__))->omp_clause.subcode.map_kind) == GOMP_MAP_FIRSTPRIVATE_POINTER | |||
3061 | && POINTER_TYPE_P (TREE_TYPE (OMP_CLAUSE_DECL (c)))(((enum tree_code) (((contains_struct_check (((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3061, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3061, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3061, __FUNCTION__)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3061, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check (((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3061, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3061, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3061, __FUNCTION__)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3061, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) | |||
3062 | { | |||
3063 | tree ptr = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3063, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3063, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3063, __FUNCTION__))); | |||
3064 | map_clause &mc = maps.get_or_insert (ptr); | |||
3065 | if (mc.clause == NULL_TREE(tree) nullptr) | |||
3066 | mc.clause = c; | |||
3067 | mc.firstprivate_ptr_p = true; | |||
3068 | ||||
3069 | if (is_global_var (ptr) | |||
3070 | && lookup_attribute ("omp declare target", | |||
3071 | DECL_ATTRIBUTES (ptr)((contains_struct_check ((ptr), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3071, __FUNCTION__))->decl_common.attributes))) | |||
3072 | mc.omp_declare_target = true; | |||
3073 | } | |||
3074 | else 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/c-family/c-omp.cc" , 3074, __FUNCTION__))->omp_clause.subcode.map_kind) == GOMP_MAP_ALLOC | |||
3075 | || 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/c-family/c-omp.cc" , 3075, __FUNCTION__))->omp_clause.subcode.map_kind) == GOMP_MAP_TO | |||
3076 | || 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/c-family/c-omp.cc" , 3076, __FUNCTION__))->omp_clause.subcode.map_kind) == GOMP_MAP_FROM | |||
3077 | || 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/c-family/c-omp.cc" , 3077, __FUNCTION__))->omp_clause.subcode.map_kind) == GOMP_MAP_TOFROM | |||
3078 | || 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/c-family/c-omp.cc" , 3078, __FUNCTION__))->omp_clause.subcode.map_kind) == GOMP_MAP_ALWAYS_TO | |||
3079 | || 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/c-family/c-omp.cc" , 3079, __FUNCTION__))->omp_clause.subcode.map_kind) == GOMP_MAP_ALWAYS_FROM | |||
3080 | || 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/c-family/c-omp.cc" , 3080, __FUNCTION__))->omp_clause.subcode.map_kind) == GOMP_MAP_ALWAYS_TOFROM) | |||
3081 | { | |||
3082 | map_clause &mc = maps.get_or_insert (OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3082, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3082, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3082, __FUNCTION__)))); | |||
3083 | mc.decl_mapped = true; | |||
3084 | } | |||
3085 | } | |||
3086 | ||||
3087 | for (hash_map<tree, map_clause>::iterator i = maps.begin (); | |||
3088 | i != maps.end (); ++i) | |||
3089 | { | |||
3090 | map_clause &mc = (*i).second; | |||
3091 | ||||
3092 | if (mc.firstprivate_ptr_p | |||
3093 | && (mc.decl_mapped || mc.omp_declare_target)) | |||
3094 | { | |||
3095 | OMP_CLAUSE_SET_MAP_KIND (mc.clause, GOMP_MAP_ATTACH_DETACH)((omp_clause_subcode_check ((mc.clause), (OMP_CLAUSE_MAP), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3095, __FUNCTION__))->omp_clause.subcode.map_kind = (unsigned int) (GOMP_MAP_ATTACH_DETACH)); | |||
3096 | c_common_mark_addressable_vec (OMP_CLAUSE_DECL (mc.clause)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((mc.clause), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3096, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3096, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/c-family/c-omp.cc" , 3096, __FUNCTION__)))); | |||
3097 | } | |||
3098 | } | |||
3099 | } | |||
3100 | ||||
3101 | const struct c_omp_directive c_omp_directives[] = { | |||
3102 | /* Keep this alphabetically sorted by the first word. Non-null second/third | |||
3103 | if any should precede null ones. */ | |||
3104 | { "allocate", nullptr, nullptr, PRAGMA_OMP_ALLOCATE, | |||
3105 | C_OMP_DIR_DECLARATIVE, false }, | |||
3106 | { "assume", nullptr, nullptr, PRAGMA_OMP_ASSUME, | |||
3107 | C_OMP_DIR_INFORMATIONAL, false }, | |||
3108 | { "assumes", nullptr, nullptr, PRAGMA_OMP_ASSUMES, | |||
3109 | C_OMP_DIR_INFORMATIONAL, false }, | |||
3110 | { "atomic", nullptr, nullptr, PRAGMA_OMP_ATOMIC, | |||
3111 | C_OMP_DIR_CONSTRUCT, false }, | |||
3112 | { "barrier", nullptr, nullptr, PRAGMA_OMP_BARRIER, | |||
3113 | C_OMP_DIR_STANDALONE, false }, | |||
3114 | { "begin", "assumes", nullptr, PRAGMA_OMP_BEGIN, | |||
3115 | C_OMP_DIR_INFORMATIONAL, false }, | |||
3116 | { "begin", "declare", "target", PRAGMA_OMP_BEGIN, | |||
3117 | C_OMP_DIR_DECLARATIVE, false }, | |||
3118 | /* { "begin", "declare", "variant", PRAGMA_OMP_BEGIN, | |||
3119 | C_OMP_DIR_DECLARATIVE, false }, */ | |||
3120 | /* { "begin", "metadirective", nullptr, PRAGMA_OMP_BEGIN, | |||
3121 | C_OMP_DIR_???, ??? }, */ | |||
3122 | { "cancel", nullptr, nullptr, PRAGMA_OMP_CANCEL, | |||
3123 | C_OMP_DIR_STANDALONE, false }, | |||
3124 | { "cancellation", "point", nullptr, PRAGMA_OMP_CANCELLATION_POINT, | |||
3125 | C_OMP_DIR_STANDALONE, false }, | |||
3126 | { "critical", nullptr, nullptr, PRAGMA_OMP_CRITICAL, | |||
3127 | C_OMP_DIR_CONSTRUCT, false }, | |||
3128 | /* { "declare", "mapper", nullptr, PRAGMA_OMP_DECLARE, | |||
3129 | C_OMP_DIR_DECLARATIVE, false }, */ | |||
3130 | { "declare", "reduction", nullptr, PRAGMA_OMP_DECLARE, | |||
3131 | C_OMP_DIR_DECLARATIVE, true }, | |||
3132 | { "declare", "simd", nullptr, PRAGMA_OMP_DECLARE, | |||
3133 | C_OMP_DIR_DECLARATIVE, true }, | |||
3134 | { "declare", "target", nullptr, PRAGMA_OMP_DECLARE, | |||
3135 | C_OMP_DIR_DECLARATIVE, false }, | |||
3136 | { "declare", "variant", nullptr, PRAGMA_OMP_DECLARE, | |||
3137 | C_OMP_DIR_DECLARATIVE, false }, | |||
3138 | { "depobj", nullptr, nullptr, PRAGMA_OMP_DEPOBJ, | |||
3139 | C_OMP_DIR_STANDALONE, false }, | |||
3140 | /* { "dispatch", nullptr, nullptr, PRAGMA_OMP_DISPATCH, | |||
3141 | C_OMP_DIR_CONSTRUCT, false }, */ | |||
3142 | { "distribute", nullptr, nullptr, PRAGMA_OMP_DISTRIBUTE, | |||
3143 | C_OMP_DIR_CONSTRUCT, true }, | |||
3144 | { "end", "assumes", nullptr, PRAGMA_OMP_END, | |||
3145 | C_OMP_DIR_INFORMATIONAL, false }, | |||
3146 | { "end", "declare", "target", PRAGMA_OMP_END, | |||
3147 | C_OMP_DIR_DECLARATIVE, false }, | |||
3148 | /* { "end", "declare", "variant", PRAGMA_OMP_END, | |||
3149 | C_OMP_DIR_DECLARATIVE, false }, */ | |||
3150 | /* { "end", "metadirective", nullptr, PRAGMA_OMP_END, | |||
3151 | C_OMP_DIR_???, ??? }, */ | |||
3152 | /* error with at(execution) is C_OMP_DIR_STANDALONE. */ | |||
3153 | { "error", nullptr, nullptr, PRAGMA_OMP_ERROR, | |||
3154 | C_OMP_DIR_UTILITY, false }, | |||
3155 | { "flush", nullptr, nullptr, PRAGMA_OMP_FLUSH, | |||
3156 | C_OMP_DIR_STANDALONE, false }, | |||
3157 | { "for", nullptr, nullptr, PRAGMA_OMP_FOR, | |||
3158 | C_OMP_DIR_CONSTRUCT, true }, | |||
3159 | /* { "interop", nullptr, nullptr, PRAGMA_OMP_INTEROP, | |||
3160 | C_OMP_DIR_STANDALONE, false }, */ | |||
3161 | { "loop", nullptr, nullptr, PRAGMA_OMP_LOOP, | |||
3162 | C_OMP_DIR_CONSTRUCT, true }, | |||
3163 | { "masked", nullptr, nullptr, PRAGMA_OMP_MASKED, | |||
3164 | C_OMP_DIR_CONSTRUCT, true }, | |||
3165 | { "master", nullptr, nullptr, PRAGMA_OMP_MASTER, | |||
3166 | C_OMP_DIR_CONSTRUCT, true }, | |||
3167 | /* { "metadirective", nullptr, nullptr, PRAGMA_OMP_METADIRECTIVE, | |||
3168 | C_OMP_DIR_???, ??? }, */ | |||
3169 | { "nothing", nullptr, nullptr, PRAGMA_OMP_NOTHING, | |||
3170 | C_OMP_DIR_UTILITY, false }, | |||
3171 | /* ordered with depend clause is C_OMP_DIR_STANDALONE. */ | |||
3172 | { "ordered", nullptr, nullptr, PRAGMA_OMP_ORDERED, | |||
3173 | C_OMP_DIR_CONSTRUCT, true }, | |||
3174 | { "parallel", nullptr, nullptr, PRAGMA_OMP_PARALLEL, | |||
3175 | C_OMP_DIR_CONSTRUCT, true }, | |||
3176 | { "requires", nullptr, nullptr, PRAGMA_OMP_REQUIRES, | |||
3177 | C_OMP_DIR_INFORMATIONAL, false }, | |||
3178 | { "scan", nullptr, nullptr, PRAGMA_OMP_SCAN, | |||
3179 | C_OMP_DIR_CONSTRUCT, true }, | |||
3180 | { "scope", nullptr, nullptr, PRAGMA_OMP_SCOPE, | |||
3181 | C_OMP_DIR_CONSTRUCT, false }, | |||
3182 | { "section", nullptr, nullptr, PRAGMA_OMP_SECTION, | |||
3183 | C_OMP_DIR_CONSTRUCT, false }, | |||
3184 | { "sections", nullptr, nullptr, PRAGMA_OMP_SECTIONS, | |||
3185 | C_OMP_DIR_CONSTRUCT, false }, | |||
3186 | { "simd", nullptr, nullptr, PRAGMA_OMP_SIMD, | |||
3187 | C_OMP_DIR_CONSTRUCT, true }, | |||
3188 | { "single", nullptr, nullptr, PRAGMA_OMP_SINGLE, | |||
3189 | C_OMP_DIR_CONSTRUCT, false }, | |||
3190 | { "target", "data", nullptr, PRAGMA_OMP_TARGET, | |||
3191 | C_OMP_DIR_CONSTRUCT, false }, | |||
3192 | { "target", "enter", "data", PRAGMA_OMP_TARGET, | |||
3193 | C_OMP_DIR_STANDALONE, false }, | |||
3194 | { "target", "exit", "data", PRAGMA_OMP_TARGET, | |||
3195 | C_OMP_DIR_STANDALONE, false }, | |||
3196 | { "target", "update", nullptr, PRAGMA_OMP_TARGET, | |||
3197 | C_OMP_DIR_STANDALONE, false }, | |||
3198 | { "target", nullptr, nullptr, PRAGMA_OMP_TARGET, | |||
3199 | C_OMP_DIR_CONSTRUCT, true }, | |||
3200 | { "task", nullptr, nullptr, PRAGMA_OMP_TASK, | |||
3201 | C_OMP_DIR_CONSTRUCT, false }, | |||
3202 | { "taskgroup", nullptr, nullptr, PRAGMA_OMP_TASKGROUP, | |||
3203 | C_OMP_DIR_CONSTRUCT, false }, | |||
3204 | { "taskloop", nullptr, nullptr, PRAGMA_OMP_TASKLOOP, | |||
3205 | C_OMP_DIR_CONSTRUCT, true }, | |||
3206 | { "taskwait", nullptr, nullptr, PRAGMA_OMP_TASKWAIT, | |||
3207 | C_OMP_DIR_STANDALONE, false }, | |||
3208 | { "taskyield", nullptr, nullptr, PRAGMA_OMP_TASKYIELD, | |||
3209 | C_OMP_DIR_STANDALONE, false }, | |||
3210 | /* { "tile", nullptr, nullptr, PRAGMA_OMP_TILE, | |||
3211 | C_OMP_DIR_CONSTRUCT, false }, */ | |||
3212 | { "teams", nullptr, nullptr, PRAGMA_OMP_TEAMS, | |||
3213 | C_OMP_DIR_CONSTRUCT, true }, | |||
3214 | { "threadprivate", nullptr, nullptr, PRAGMA_OMP_THREADPRIVATE, | |||
3215 | C_OMP_DIR_DECLARATIVE, false } | |||
3216 | /* { "unroll", nullptr, nullptr, PRAGMA_OMP_UNROLL, | |||
3217 | C_OMP_DIR_CONSTRUCT, false }, */ | |||
3218 | }; | |||
3219 | ||||
3220 | /* Find (non-combined/composite) OpenMP directive (if any) which starts | |||
3221 | with FIRST keyword and for multi-word directives has SECOND and | |||
3222 | THIRD keyword after it. */ | |||
3223 | ||||
3224 | const struct c_omp_directive * | |||
3225 | c_omp_categorize_directive (const char *first, const char *second, | |||
3226 | const char *third) | |||
3227 | { | |||
3228 | const size_t n_omp_directives = ARRAY_SIZE (c_omp_directives)(sizeof (c_omp_directives) / sizeof ((c_omp_directives)[0])); | |||
3229 | for (size_t i = 0; i < n_omp_directives; i++) | |||
3230 | { | |||
3231 | if ((unsigned char) c_omp_directives[i].first[0] | |||
3232 | < (unsigned char) first[0]) | |||
3233 | continue; | |||
3234 | if ((unsigned char) c_omp_directives[i].first[0] | |||
3235 | > (unsigned char) first[0]) | |||
3236 | break; | |||
3237 | if (strcmp (c_omp_directives[i].first, first)) | |||
3238 | continue; | |||
3239 | if (!c_omp_directives[i].second) | |||
3240 | return &c_omp_directives[i]; | |||
3241 | if (!second || strcmp (c_omp_directives[i].second, second)) | |||
3242 | continue; | |||
3243 | if (!c_omp_directives[i].third) | |||
3244 | return &c_omp_directives[i]; | |||
3245 | if (!third || strcmp (c_omp_directives[i].third, third)) | |||
3246 | continue; | |||
3247 | return &c_omp_directives[i]; | |||
3248 | } | |||
3249 | return NULLnullptr; | |||
3250 | } |
1 | /* Vector API for GNU compiler. | ||||
2 | Copyright (C) 2004-2023 Free Software Foundation, Inc. | ||||
3 | Contributed by Nathan Sidwell <nathan@codesourcery.com> | ||||
4 | Re-implemented in C++ by Diego Novillo <dnovillo@google.com> | ||||
5 | |||||
6 | This file is part of GCC. | ||||
7 | |||||
8 | GCC is free software; you can redistribute it and/or modify it under | ||||
9 | the terms of the GNU General Public License as published by the Free | ||||
10 | Software Foundation; either version 3, or (at your option) any later | ||||
11 | version. | ||||
12 | |||||
13 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY | ||||
14 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||||
15 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||||
16 | for more details. | ||||
17 | |||||
18 | You should have received a copy of the GNU General Public License | ||||
19 | along with GCC; see the file COPYING3. If not see | ||||
20 | <http://www.gnu.org/licenses/>. */ | ||||
21 | |||||
22 | #ifndef GCC_VEC_H | ||||
23 | #define GCC_VEC_H | ||||
24 | |||||
25 | /* Some gen* file have no ggc support as the header file gtype-desc.h is | ||||
26 | missing. Provide these definitions in case ggc.h has not been included. | ||||
27 | This is not a problem because any code that runs before gengtype is built | ||||
28 | will never need to use GC vectors.*/ | ||||
29 | |||||
30 | extern void ggc_free (void *); | ||||
31 | extern size_t ggc_round_alloc_size (size_t requested_size); | ||||
32 | extern void *ggc_realloc (void *, size_t MEM_STAT_DECL); | ||||
33 | |||||
34 | /* Templated vector type and associated interfaces. | ||||
35 | |||||
36 | The interface functions are typesafe and use inline functions, | ||||
37 | sometimes backed by out-of-line generic functions. The vectors are | ||||
38 | designed to interoperate with the GTY machinery. | ||||
39 | |||||
40 | There are both 'index' and 'iterate' accessors. The index accessor | ||||
41 | is implemented by operator[]. The iterator returns a boolean | ||||
42 | iteration condition and updates the iteration variable passed by | ||||
43 | reference. Because the iterator will be inlined, the address-of | ||||
44 | can be optimized away. | ||||
45 | |||||
46 | Each operation that increases the number of active elements is | ||||
47 | available in 'quick' and 'safe' variants. The former presumes that | ||||
48 | there is sufficient allocated space for the operation to succeed | ||||
49 | (it dies if there is not). The latter will reallocate the | ||||
50 | vector, if needed. Reallocation causes an exponential increase in | ||||
51 | vector size. If you know you will be adding N elements, it would | ||||
52 | be more efficient to use the reserve operation before adding the | ||||
53 | elements with the 'quick' operation. This will ensure there are at | ||||
54 | least as many elements as you ask for, it will exponentially | ||||
55 | increase if there are too few spare slots. If you want reserve a | ||||
56 | specific number of slots, but do not want the exponential increase | ||||
57 | (for instance, you know this is the last allocation), use the | ||||
58 | reserve_exact operation. You can also create a vector of a | ||||
59 | specific size from the get go. | ||||
60 | |||||
61 | You should prefer the push and pop operations, as they append and | ||||
62 | remove from the end of the vector. If you need to remove several | ||||
63 | items in one go, use the truncate operation. The insert and remove | ||||
64 | operations allow you to change elements in the middle of the | ||||
65 | vector. There are two remove operations, one which preserves the | ||||
66 | element ordering 'ordered_remove', and one which does not | ||||
67 | 'unordered_remove'. The latter function copies the end element | ||||
68 | into the removed slot, rather than invoke a memmove operation. The | ||||
69 | 'lower_bound' function will determine where to place an item in the | ||||
70 | array using insert that will maintain sorted order. | ||||
71 | |||||
72 | Vectors are template types with three arguments: the type of the | ||||
73 | elements in the vector, the allocation strategy, and the physical | ||||
74 | layout to use | ||||
75 | |||||
76 | Four allocation strategies are supported: | ||||
77 | |||||
78 | - Heap: allocation is done using malloc/free. This is the | ||||
79 | default allocation strategy. | ||||
80 | |||||
81 | - GC: allocation is done using ggc_alloc/ggc_free. | ||||
82 | |||||
83 | - GC atomic: same as GC with the exception that the elements | ||||
84 | themselves are assumed to be of an atomic type that does | ||||
85 | not need to be garbage collected. This means that marking | ||||
86 | routines do not need to traverse the array marking the | ||||
87 | individual elements. This increases the performance of | ||||
88 | GC activities. | ||||
89 | |||||
90 | Two physical layouts are supported: | ||||
91 | |||||
92 | - Embedded: The vector is structured using the trailing array | ||||
93 | idiom. The last member of the structure is an array of size | ||||
94 | 1. When the vector is initially allocated, a single memory | ||||
95 | block is created to hold the vector's control data and the | ||||
96 | array of elements. These vectors cannot grow without | ||||
97 | reallocation (see discussion on embeddable vectors below). | ||||
98 | |||||
99 | - Space efficient: The vector is structured as a pointer to an | ||||
100 | embedded vector. This is the default layout. It means that | ||||
101 | vectors occupy a single word of storage before initial | ||||
102 | allocation. Vectors are allowed to grow (the internal | ||||
103 | pointer is reallocated but the main vector instance does not | ||||
104 | need to relocate). | ||||
105 | |||||
106 | The type, allocation and layout are specified when the vector is | ||||
107 | declared. | ||||
108 | |||||
109 | If you need to directly manipulate a vector, then the 'address' | ||||
110 | accessor will return the address of the start of the vector. Also | ||||
111 | the 'space' predicate will tell you whether there is spare capacity | ||||
112 | in the vector. You will not normally need to use these two functions. | ||||
113 | |||||
114 | Notes on the different layout strategies | ||||
115 | |||||
116 | * Embeddable vectors (vec<T, A, vl_embed>) | ||||
117 | |||||
118 | These vectors are suitable to be embedded in other data | ||||
119 | structures so that they can be pre-allocated in a contiguous | ||||
120 | memory block. | ||||
121 | |||||
122 | Embeddable vectors are implemented using the trailing array | ||||
123 | idiom, thus they are not resizeable without changing the address | ||||
124 | of the vector object itself. This means you cannot have | ||||
125 | variables or fields of embeddable vector type -- always use a | ||||
126 | pointer to a vector. The one exception is the final field of a | ||||
127 | structure, which could be a vector type. | ||||
128 | |||||
129 | You will have to use the embedded_size & embedded_init calls to | ||||
130 | create such objects, and they will not be resizeable (so the | ||||
131 | 'safe' allocation variants are not available). | ||||
132 | |||||
133 | Properties of embeddable vectors: | ||||
134 | |||||
135 | - The whole vector and control data are allocated in a single | ||||
136 | contiguous block. It uses the trailing-vector idiom, so | ||||
137 | allocation must reserve enough space for all the elements | ||||
138 | in the vector plus its control data. | ||||
139 | - The vector cannot be re-allocated. | ||||
140 | - The vector cannot grow nor shrink. | ||||
141 | - No indirections needed for access/manipulation. | ||||
142 | - It requires 2 words of storage (prior to vector allocation). | ||||
143 | |||||
144 | |||||
145 | * Space efficient vector (vec<T, A, vl_ptr>) | ||||
146 | |||||
147 | These vectors can grow dynamically and are allocated together | ||||
148 | with their control data. They are suited to be included in data | ||||
149 | structures. Prior to initial allocation, they only take a single | ||||
150 | word of storage. | ||||
151 | |||||
152 | These vectors are implemented as a pointer to embeddable vectors. | ||||
153 | The semantics allow for this pointer to be NULL to represent | ||||
154 | empty vectors. This way, empty vectors occupy minimal space in | ||||
155 | the structure containing them. | ||||
156 | |||||
157 | Properties: | ||||
158 | |||||
159 | - The whole vector and control data are allocated in a single | ||||
160 | contiguous block. | ||||
161 | - The whole vector may be re-allocated. | ||||
162 | - Vector data may grow and shrink. | ||||
163 | - Access and manipulation requires a pointer test and | ||||
164 | indirection. | ||||
165 | - It requires 1 word of storage (prior to vector allocation). | ||||
166 | |||||
167 | An example of their use would be, | ||||
168 | |||||
169 | struct my_struct { | ||||
170 | // A space-efficient vector of tree pointers in GC memory. | ||||
171 | vec<tree, va_gc, vl_ptr> v; | ||||
172 | }; | ||||
173 | |||||
174 | struct my_struct *s; | ||||
175 | |||||
176 | if (s->v.length ()) { we have some contents } | ||||
177 | s->v.safe_push (decl); // append some decl onto the end | ||||
178 | for (ix = 0; s->v.iterate (ix, &elt); ix++) | ||||
179 | { do something with elt } | ||||
180 | */ | ||||
181 | |||||
182 | /* Support function for statistics. */ | ||||
183 | extern void dump_vec_loc_statistics (void); | ||||
184 | |||||
185 | /* Hashtable mapping vec addresses to descriptors. */ | ||||
186 | extern htab_t vec_mem_usage_hash; | ||||
187 | |||||
188 | /* Control data for vectors. This contains the number of allocated | ||||
189 | and used slots inside a vector. */ | ||||
190 | |||||
191 | struct vec_prefix | ||||
192 | { | ||||
193 | /* FIXME - These fields should be private, but we need to cater to | ||||
194 | compilers that have stricter notions of PODness for types. */ | ||||
195 | |||||
196 | /* Memory allocation support routines in vec.cc. */ | ||||
197 | void register_overhead (void *, size_t, size_t CXX_MEM_STAT_INFO); | ||||
198 | void release_overhead (void *, size_t, size_t, bool CXX_MEM_STAT_INFO); | ||||
199 | static unsigned calculate_allocation (vec_prefix *, unsigned, bool); | ||||
200 | static unsigned calculate_allocation_1 (unsigned, unsigned); | ||||
201 | |||||
202 | /* Note that vec_prefix should be a base class for vec, but we use | ||||
203 | offsetof() on vector fields of tree structures (e.g., | ||||
204 | tree_binfo::base_binfos), and offsetof only supports base types. | ||||
205 | |||||
206 | To compensate, we make vec_prefix a field inside vec and make | ||||
207 | vec a friend class of vec_prefix so it can access its fields. */ | ||||
208 | template <typename, typename, typename> friend struct vec; | ||||
209 | |||||
210 | /* The allocator types also need access to our internals. */ | ||||
211 | friend struct va_gc; | ||||
212 | friend struct va_gc_atomic; | ||||
213 | friend struct va_heap; | ||||
214 | |||||
215 | unsigned m_alloc : 31; | ||||
216 | unsigned m_using_auto_storage : 1; | ||||
217 | unsigned m_num; | ||||
218 | }; | ||||
219 | |||||
220 | /* Calculate the number of slots to reserve a vector, making sure that | ||||
221 | RESERVE slots are free. If EXACT grow exactly, otherwise grow | ||||
222 | exponentially. PFX is the control data for the vector. */ | ||||
223 | |||||
224 | inline unsigned | ||||
225 | vec_prefix::calculate_allocation (vec_prefix *pfx, unsigned reserve, | ||||
226 | bool exact) | ||||
227 | { | ||||
228 | if (exact) | ||||
229 | return (pfx ? pfx->m_num : 0) + reserve; | ||||
230 | else if (!pfx) | ||||
231 | return MAX (4, reserve)((4) > (reserve) ? (4) : (reserve)); | ||||
232 | return calculate_allocation_1 (pfx->m_alloc, pfx->m_num + reserve); | ||||
233 | } | ||||
234 | |||||
235 | template<typename, typename, typename> struct vec; | ||||
236 | |||||
237 | /* Valid vector layouts | ||||
238 | |||||
239 | vl_embed - Embeddable vector that uses the trailing array idiom. | ||||
240 | vl_ptr - Space efficient vector that uses a pointer to an | ||||
241 | embeddable vector. */ | ||||
242 | struct vl_embed { }; | ||||
243 | struct vl_ptr { }; | ||||
244 | |||||
245 | |||||
246 | /* Types of supported allocations | ||||
247 | |||||
248 | va_heap - Allocation uses malloc/free. | ||||
249 | va_gc - Allocation uses ggc_alloc. | ||||
250 | va_gc_atomic - Same as GC, but individual elements of the array | ||||
251 | do not need to be marked during collection. */ | ||||
252 | |||||
253 | /* Allocator type for heap vectors. */ | ||||
254 | struct va_heap | ||||
255 | { | ||||
256 | /* Heap vectors are frequently regular instances, so use the vl_ptr | ||||
257 | layout for them. */ | ||||
258 | typedef vl_ptr default_layout; | ||||
259 | |||||
260 | template<typename T> | ||||
261 | static void reserve (vec<T, va_heap, vl_embed> *&, unsigned, bool | ||||
262 | CXX_MEM_STAT_INFO); | ||||
263 | |||||
264 | template<typename T> | ||||
265 | static void release (vec<T, va_heap, vl_embed> *&); | ||||
266 | }; | ||||
267 | |||||
268 | |||||
269 | /* Allocator for heap memory. Ensure there are at least RESERVE free | ||||
270 | slots in V. If EXACT is true, grow exactly, else grow | ||||
271 | exponentially. As a special case, if the vector had not been | ||||
272 | allocated and RESERVE is 0, no vector will be created. */ | ||||
273 | |||||
274 | template<typename T> | ||||
275 | inline void | ||||
276 | va_heap::reserve (vec<T, va_heap, vl_embed> *&v, unsigned reserve, bool exact | ||||
277 | MEM_STAT_DECL) | ||||
278 | { | ||||
279 | size_t elt_size = sizeof (T); | ||||
280 | unsigned alloc | ||||
281 | = vec_prefix::calculate_allocation (v ? &v->m_vecpfx : 0, reserve, exact); | ||||
282 | gcc_checking_assert (alloc)((void)(!(alloc) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/vec.h" , 282, __FUNCTION__), 0 : 0)); | ||||
283 | |||||
284 | if (GATHER_STATISTICS0 && v) | ||||
285 | v->m_vecpfx.release_overhead (v, elt_size * v->allocated (), | ||||
286 | v->allocated (), false); | ||||
287 | |||||
288 | size_t size = vec<T, va_heap, vl_embed>::embedded_size (alloc); | ||||
289 | unsigned nelem = v ? v->length () : 0; | ||||
290 | v = static_cast <vec<T, va_heap, vl_embed> *> (xrealloc (v, size)); | ||||
291 | v->embedded_init (alloc, nelem); | ||||
292 | |||||
293 | if (GATHER_STATISTICS0) | ||||
294 | v->m_vecpfx.register_overhead (v, alloc, elt_size PASS_MEM_STAT); | ||||
295 | } | ||||
296 | |||||
297 | |||||
298 | #if GCC_VERSION(4 * 1000 + 2) >= 4007 | ||||
299 | #pragma GCC diagnostic push | ||||
300 | #pragma GCC diagnostic ignored "-Wfree-nonheap-object" | ||||
301 | #endif | ||||
302 | |||||
303 | /* Free the heap space allocated for vector V. */ | ||||
304 | |||||
305 | template<typename T> | ||||
306 | void | ||||
307 | va_heap::release (vec<T, va_heap, vl_embed> *&v) | ||||
308 | { | ||||
309 | size_t elt_size = sizeof (T); | ||||
310 | if (v == NULLnullptr) | ||||
311 | return; | ||||
312 | |||||
313 | if (GATHER_STATISTICS0) | ||||
314 | v->m_vecpfx.release_overhead (v, elt_size * v->allocated (), | ||||
315 | v->allocated (), true); | ||||
316 | ::free (v); | ||||
317 | v = NULLnullptr; | ||||
318 | } | ||||
319 | |||||
320 | #if GCC_VERSION(4 * 1000 + 2) >= 4007 | ||||
321 | #pragma GCC diagnostic pop | ||||
322 | #endif | ||||
323 | |||||
324 | /* Allocator type for GC vectors. Notice that we need the structure | ||||
325 | declaration even if GC is not enabled. */ | ||||
326 | |||||
327 | struct va_gc | ||||
328 | { | ||||
329 | /* Use vl_embed as the default layout for GC vectors. Due to GTY | ||||
330 | limitations, GC vectors must always be pointers, so it is more | ||||
331 | efficient to use a pointer to the vl_embed layout, rather than | ||||
332 | using a pointer to a pointer as would be the case with vl_ptr. */ | ||||
333 | typedef vl_embed default_layout; | ||||
334 | |||||
335 | template<typename T, typename A> | ||||
336 | static void reserve (vec<T, A, vl_embed> *&, unsigned, bool | ||||
337 | CXX_MEM_STAT_INFO); | ||||
338 | |||||
339 | template<typename T, typename A> | ||||
340 | static void release (vec<T, A, vl_embed> *&v); | ||||
341 | }; | ||||
342 | |||||
343 | |||||
344 | /* Free GC memory used by V and reset V to NULL. */ | ||||
345 | |||||
346 | template<typename T, typename A> | ||||
347 | inline void | ||||
348 | va_gc::release (vec<T, A, vl_embed> *&v) | ||||
349 | { | ||||
350 | if (v) | ||||
351 | ::ggc_free (v); | ||||
352 | v = NULLnullptr; | ||||
353 | } | ||||
354 | |||||
355 | |||||
356 | /* Allocator for GC memory. Ensure there are at least RESERVE free | ||||
357 | slots in V. If EXACT is true, grow exactly, else grow | ||||
358 | exponentially. As a special case, if the vector had not been | ||||
359 | allocated and RESERVE is 0, no vector will be created. */ | ||||
360 | |||||
361 | template<typename T, typename A> | ||||
362 | void | ||||
363 | va_gc::reserve (vec<T, A, vl_embed> *&v, unsigned reserve, bool exact | ||||
364 | MEM_STAT_DECL) | ||||
365 | { | ||||
366 | unsigned alloc | ||||
367 | = vec_prefix::calculate_allocation (v ? &v->m_vecpfx : 0, reserve, exact); | ||||
368 | if (!alloc) | ||||
369 | { | ||||
370 | ::ggc_free (v); | ||||
371 | v = NULLnullptr; | ||||
372 | return; | ||||
373 | } | ||||
374 | |||||
375 | /* Calculate the amount of space we want. */ | ||||
376 | size_t size = vec<T, A, vl_embed>::embedded_size (alloc); | ||||
377 | |||||
378 | /* Ask the allocator how much space it will really give us. */ | ||||
379 | size = ::ggc_round_alloc_size (size); | ||||
380 | |||||
381 | /* Adjust the number of slots accordingly. */ | ||||
382 | size_t vec_offset = sizeof (vec_prefix); | ||||
383 | size_t elt_size = sizeof (T); | ||||
384 | alloc = (size - vec_offset) / elt_size; | ||||
385 | |||||
386 | /* And finally, recalculate the amount of space we ask for. */ | ||||
387 | size = vec_offset + alloc * elt_size; | ||||
388 | |||||
389 | unsigned nelem = v ? v->length () : 0; | ||||
390 | v = static_cast <vec<T, A, vl_embed> *> (::ggc_realloc (v, size | ||||
391 | PASS_MEM_STAT)); | ||||
392 | v->embedded_init (alloc, nelem); | ||||
393 | } | ||||
394 | |||||
395 | |||||
396 | /* Allocator type for GC vectors. This is for vectors of types | ||||
397 | atomics w.r.t. collection, so allocation and deallocation is | ||||
398 | completely inherited from va_gc. */ | ||||
399 | struct va_gc_atomic : va_gc | ||||
400 | { | ||||
401 | }; | ||||
402 | |||||
403 | |||||
404 | /* Generic vector template. Default values for A and L indicate the | ||||
405 | most commonly used strategies. | ||||
406 | |||||
407 | FIXME - Ideally, they would all be vl_ptr to encourage using regular | ||||
408 | instances for vectors, but the existing GTY machinery is limited | ||||
409 | in that it can only deal with GC objects that are pointers | ||||
410 | themselves. | ||||
411 | |||||
412 | This means that vector operations that need to deal with | ||||
413 | potentially NULL pointers, must be provided as free | ||||
414 | functions (see the vec_safe_* functions above). */ | ||||
415 | template<typename T, | ||||
416 | typename A = va_heap, | ||||
417 | typename L = typename A::default_layout> | ||||
418 | struct GTY((user)) vec | ||||
419 | { | ||||
420 | }; | ||||
421 | |||||
422 | /* Allow C++11 range-based 'for' to work directly on vec<T>*. */ | ||||
423 | template<typename T, typename A, typename L> | ||||
424 | T* begin (vec<T,A,L> *v) { return v ? v->begin () : nullptr; } | ||||
425 | template<typename T, typename A, typename L> | ||||
426 | T* end (vec<T,A,L> *v) { return v ? v->end () : nullptr; } | ||||
427 | template<typename T, typename A, typename L> | ||||
428 | const T* begin (const vec<T,A,L> *v) { return v ? v->begin () : nullptr; } | ||||
429 | template<typename T, typename A, typename L> | ||||
430 | const T* end (const vec<T,A,L> *v) { return v ? v->end () : nullptr; } | ||||
431 | |||||
432 | /* Generic vec<> debug helpers. | ||||
433 | |||||
434 | These need to be instantiated for each vec<TYPE> used throughout | ||||
435 | the compiler like this: | ||||
436 | |||||
437 | DEFINE_DEBUG_VEC (TYPE) | ||||
438 | |||||
439 | The reason we have a debug_helper() is because GDB can't | ||||
440 | disambiguate a plain call to debug(some_vec), and it must be called | ||||
441 | like debug<TYPE>(some_vec). */ | ||||
442 | |||||
443 | template<typename T> | ||||
444 | void | ||||
445 | debug_helper (vec<T> &ref) | ||||
446 | { | ||||
447 | unsigned i; | ||||
448 | for (i = 0; i < ref.length (); ++i) | ||||
449 | { | ||||
450 | fprintf (stderrstderr, "[%d] = ", i); | ||||
451 | debug_slim (ref[i]); | ||||
452 | fputc ('\n', stderrstderr); | ||||
453 | } | ||||
454 | } | ||||
455 | |||||
456 | /* We need a separate va_gc variant here because default template | ||||
457 | argument for functions cannot be used in c++-98. Once this | ||||
458 | restriction is removed, those variant should be folded with the | ||||
459 | above debug_helper. */ | ||||
460 | |||||
461 | template<typename T> | ||||
462 | void | ||||
463 | debug_helper (vec<T, va_gc> &ref) | ||||
464 | { | ||||
465 | unsigned i; | ||||
466 | for (i = 0; i < ref.length (); ++i) | ||||
467 | { | ||||
468 | fprintf (stderrstderr, "[%d] = ", i); | ||||
469 | debug_slim (ref[i]); | ||||
470 | fputc ('\n', stderrstderr); | ||||
471 | } | ||||
472 | } | ||||
473 | |||||
474 | /* Macro to define debug(vec<T>) and debug(vec<T, va_gc>) helper | ||||
475 | functions for a type T. */ | ||||
476 | |||||
477 | #define DEFINE_DEBUG_VEC(T)template void debug_helper (vec<T> &); template void debug_helper (vec<T, va_gc> &); __attribute__ ((__used__ )) void debug (vec<T> &ref) { debug_helper <T> (ref); } __attribute__ ((__used__)) void debug (vec<T> *ptr) { if (ptr) debug (*ptr); else fprintf (stderr, "<nil>\n" ); } __attribute__ ((__used__)) void debug (vec<T, va_gc> &ref) { debug_helper <T> (ref); } __attribute__ (( __used__)) void debug (vec<T, va_gc> *ptr) { if (ptr) debug (*ptr); else fprintf (stderr, "<nil>\n"); } \ | ||||
478 | template void debug_helper (vec<T> &); \ | ||||
479 | template void debug_helper (vec<T, va_gc> &); \ | ||||
480 | /* Define the vec<T> debug functions. */ \ | ||||
481 | DEBUG_FUNCTION__attribute__ ((__used__)) void \ | ||||
482 | debug (vec<T> &ref) \ | ||||
483 | { \ | ||||
484 | debug_helper <T> (ref); \ | ||||
485 | } \ | ||||
486 | DEBUG_FUNCTION__attribute__ ((__used__)) void \ | ||||
487 | debug (vec<T> *ptr) \ | ||||
488 | { \ | ||||
489 | if (ptr) \ | ||||
490 | debug (*ptr); \ | ||||
491 | else \ | ||||
492 | fprintf (stderrstderr, "<nil>\n"); \ | ||||
493 | } \ | ||||
494 | /* Define the vec<T, va_gc> debug functions. */ \ | ||||
495 | DEBUG_FUNCTION__attribute__ ((__used__)) void \ | ||||
496 | debug (vec<T, va_gc> &ref) \ | ||||
497 | { \ | ||||
498 | debug_helper <T> (ref); \ | ||||
499 | } \ | ||||
500 | DEBUG_FUNCTION__attribute__ ((__used__)) void \ | ||||
501 | debug (vec<T, va_gc> *ptr) \ | ||||
502 | { \ | ||||
503 | if (ptr) \ | ||||
504 | debug (*ptr); \ | ||||
505 | else \ | ||||
506 | fprintf (stderrstderr, "<nil>\n"); \ | ||||
507 | } | ||||
508 | |||||
509 | /* Default-construct N elements in DST. */ | ||||
510 | |||||
511 | template <typename T> | ||||
512 | inline void | ||||
513 | vec_default_construct (T *dst, unsigned n) | ||||
514 | { | ||||
515 | #ifdef BROKEN_VALUE_INITIALIZATION | ||||
516 | /* Versions of GCC before 4.4 sometimes leave certain objects | ||||
517 | uninitialized when value initialized, though if the type has | ||||
518 | user defined default ctor, that ctor is invoked. As a workaround | ||||
519 | perform clearing first and then the value initialization, which | ||||
520 | fixes the case when value initialization doesn't initialize due to | ||||
521 | the bugs and should initialize to all zeros, but still allows | ||||
522 | vectors for types with user defined default ctor that initializes | ||||
523 | some or all elements to non-zero. If T has no user defined | ||||
524 | default ctor and some non-static data members have user defined | ||||
525 | default ctors that initialize to non-zero the workaround will | ||||
526 | still not work properly; in that case we just need to provide | ||||
527 | user defined default ctor. */ | ||||
528 | memset (dst, '\0', sizeof (T) * n); | ||||
529 | #endif | ||||
530 | for ( ; n; ++dst, --n) | ||||
531 | ::new (static_cast<void*>(dst)) T (); | ||||
532 | } | ||||
533 | |||||
534 | /* Copy-construct N elements in DST from *SRC. */ | ||||
535 | |||||
536 | template <typename T> | ||||
537 | inline void | ||||
538 | vec_copy_construct (T *dst, const T *src, unsigned n) | ||||
539 | { | ||||
540 | for ( ; n; ++dst, ++src, --n) | ||||
541 | ::new (static_cast<void*>(dst)) T (*src); | ||||
542 | } | ||||
543 | |||||
544 | /* Type to provide zero-initialized values for vec<T, A, L>. This is | ||||
545 | used to provide nil initializers for vec instances. Since vec must | ||||
546 | be a trivially copyable type that can be copied by memcpy and zeroed | ||||
547 | out by memset, it must have defaulted default and copy ctor and copy | ||||
548 | assignment. To initialize a vec either use value initialization | ||||
549 | (e.g., vec() or vec v{ };) or assign it the value vNULL. This isn't | ||||
550 | needed for file-scope and function-local static vectors, which are | ||||
551 | zero-initialized by default. */ | ||||
552 | struct vnull { }; | ||||
553 | constexpr vnull vNULL{ }; | ||||
554 | |||||
555 | |||||
556 | /* Embeddable vector. These vectors are suitable to be embedded | ||||
557 | in other data structures so that they can be pre-allocated in a | ||||
558 | contiguous memory block. | ||||
559 | |||||
560 | Embeddable vectors are implemented using the trailing array idiom, | ||||
561 | thus they are not resizeable without changing the address of the | ||||
562 | vector object itself. This means you cannot have variables or | ||||
563 | fields of embeddable vector type -- always use a pointer to a | ||||
564 | vector. The one exception is the final field of a structure, which | ||||
565 | could be a vector type. | ||||
566 | |||||
567 | You will have to use the embedded_size & embedded_init calls to | ||||
568 | create such objects, and they will not be resizeable (so the 'safe' | ||||
569 | allocation variants are not available). | ||||
570 | |||||
571 | Properties: | ||||
572 | |||||
573 | - The whole vector and control data are allocated in a single | ||||
574 | contiguous block. It uses the trailing-vector idiom, so | ||||
575 | allocation must reserve enough space for all the elements | ||||
576 | in the vector plus its control data. | ||||
577 | - The vector cannot be re-allocated. | ||||
578 | - The vector cannot grow nor shrink. | ||||
579 | - No indirections needed for access/manipulation. | ||||
580 | - It requires 2 words of storage (prior to vector allocation). */ | ||||
581 | |||||
582 | template<typename T, typename A> | ||||
583 | struct GTY((user)) vec<T, A, vl_embed> | ||||
584 | { | ||||
585 | public: | ||||
586 | unsigned allocated (void) const { return m_vecpfx.m_alloc; } | ||||
587 | unsigned length (void) const { return m_vecpfx.m_num; } | ||||
588 | bool is_empty (void) const { return m_vecpfx.m_num == 0; } | ||||
589 | T *address (void) { return reinterpret_cast <T *> (this + 1); } | ||||
590 | const T *address (void) const | ||||
591 | { return reinterpret_cast <const T *> (this + 1); } | ||||
592 | T *begin () { return address (); } | ||||
593 | const T *begin () const { return address (); } | ||||
594 | T *end () { return address () + length (); } | ||||
595 | const T *end () const { return address () + length (); } | ||||
596 | const T &operator[] (unsigned) const; | ||||
597 | T &operator[] (unsigned); | ||||
598 | T &last (void); | ||||
599 | bool space (unsigned) const; | ||||
600 | bool iterate (unsigned, T *) const; | ||||
601 | bool iterate (unsigned, T **) const; | ||||
602 | vec *copy (ALONE_CXX_MEM_STAT_INFO) const; | ||||
603 | void splice (const vec &); | ||||
604 | void splice (const vec *src); | ||||
605 | T *quick_push (const T &); | ||||
606 | T &pop (void); | ||||
607 | void truncate (unsigned); | ||||
608 | void quick_insert (unsigned, const T &); | ||||
609 | void ordered_remove (unsigned); | ||||
610 | void unordered_remove (unsigned); | ||||
611 | void block_remove (unsigned, unsigned); | ||||
612 | void qsort (int (*) (const void *, const void *))qsort (int (*) (const void *, const void *)); | ||||
613 | void sort (int (*) (const void *, const void *, void *), void *); | ||||
614 | void stablesort (int (*) (const void *, const void *, void *), void *); | ||||
615 | T *bsearch (const void *key, int (*compar) (const void *, const void *)); | ||||
616 | T *bsearch (const void *key, | ||||
617 | int (*compar)(const void *, const void *, void *), void *); | ||||
618 | unsigned lower_bound (const T &, bool (*) (const T &, const T &)) const; | ||||
619 | bool contains (const T &search) const; | ||||
620 | static size_t embedded_size (unsigned); | ||||
621 | void embedded_init (unsigned, unsigned = 0, unsigned = 0); | ||||
622 | void quick_grow (unsigned len); | ||||
623 | void quick_grow_cleared (unsigned len); | ||||
624 | |||||
625 | /* vec class can access our internal data and functions. */ | ||||
626 | template <typename, typename, typename> friend struct vec; | ||||
627 | |||||
628 | /* The allocator types also need access to our internals. */ | ||||
629 | friend struct va_gc; | ||||
630 | friend struct va_gc_atomic; | ||||
631 | friend struct va_heap; | ||||
632 | |||||
633 | /* FIXME - This field should be private, but we need to cater to | ||||
634 | compilers that have stricter notions of PODness for types. */ | ||||
635 | /* Align m_vecpfx to simplify address (). */ | ||||
636 | alignas (T) alignas (vec_prefix) vec_prefix m_vecpfx; | ||||
637 | }; | ||||
638 | |||||
639 | |||||
640 | /* Convenience wrapper functions to use when dealing with pointers to | ||||
641 | embedded vectors. Some functionality for these vectors must be | ||||
642 | provided via free functions for these reasons: | ||||
643 | |||||
644 | 1- The pointer may be NULL (e.g., before initial allocation). | ||||
645 | |||||
646 | 2- When the vector needs to grow, it must be reallocated, so | ||||
647 | the pointer will change its value. | ||||
648 | |||||
649 | Because of limitations with the current GC machinery, all vectors | ||||
650 | in GC memory *must* be pointers. */ | ||||
651 | |||||
652 | |||||
653 | /* If V contains no room for NELEMS elements, return false. Otherwise, | ||||
654 | return true. */ | ||||
655 | template<typename T, typename A> | ||||
656 | inline bool | ||||
657 | vec_safe_space (const vec<T, A, vl_embed> *v, unsigned nelems) | ||||
658 | { | ||||
659 | return v ? v->space (nelems) : nelems == 0; | ||||
660 | } | ||||
661 | |||||
662 | |||||
663 | /* If V is NULL, return 0. Otherwise, return V->length(). */ | ||||
664 | template<typename T, typename A> | ||||
665 | inline unsigned | ||||
666 | vec_safe_length (const vec<T, A, vl_embed> *v) | ||||
667 | { | ||||
668 | return v ? v->length () : 0; | ||||
669 | } | ||||
670 | |||||
671 | |||||
672 | /* If V is NULL, return NULL. Otherwise, return V->address(). */ | ||||
673 | template<typename T, typename A> | ||||
674 | inline T * | ||||
675 | vec_safe_address (vec<T, A, vl_embed> *v) | ||||
676 | { | ||||
677 | return v ? v->address () : NULLnullptr; | ||||
678 | } | ||||
679 | |||||
680 | |||||
681 | /* If V is NULL, return true. Otherwise, return V->is_empty(). */ | ||||
682 | template<typename T, typename A> | ||||
683 | inline bool | ||||
684 | vec_safe_is_empty (vec<T, A, vl_embed> *v) | ||||
685 | { | ||||
686 | return v ? v->is_empty () : true; | ||||
687 | } | ||||
688 | |||||
689 | /* If V does not have space for NELEMS elements, call | ||||
690 | V->reserve(NELEMS, EXACT). */ | ||||
691 | template<typename T, typename A> | ||||
692 | inline bool | ||||
693 | vec_safe_reserve (vec<T, A, vl_embed> *&v, unsigned nelems, bool exact = false | ||||
694 | CXX_MEM_STAT_INFO) | ||||
695 | { | ||||
696 | bool extend = nelems ? !vec_safe_space (v, nelems) : false; | ||||
697 | if (extend
| ||||
698 | A::reserve (v, nelems, exact PASS_MEM_STAT); | ||||
699 | return extend; | ||||
700 | } | ||||
701 | |||||
702 | template<typename T, typename A> | ||||
703 | inline bool | ||||
704 | vec_safe_reserve_exact (vec<T, A, vl_embed> *&v, unsigned nelems | ||||
705 | CXX_MEM_STAT_INFO) | ||||
706 | { | ||||
707 | return vec_safe_reserve (v, nelems, true PASS_MEM_STAT); | ||||
708 | } | ||||
709 | |||||
710 | |||||
711 | /* Allocate GC memory for V with space for NELEMS slots. If NELEMS | ||||
712 | is 0, V is initialized to NULL. */ | ||||
713 | |||||
714 | template<typename T, typename A> | ||||
715 | inline void | ||||
716 | vec_alloc (vec<T, A, vl_embed> *&v, unsigned nelems CXX_MEM_STAT_INFO) | ||||
717 | { | ||||
718 | v = NULLnullptr; | ||||
719 | vec_safe_reserve (v, nelems, false PASS_MEM_STAT); | ||||
720 | } | ||||
721 | |||||
722 | |||||
723 | /* Free the GC memory allocated by vector V and set it to NULL. */ | ||||
724 | |||||
725 | template<typename T, typename A> | ||||
726 | inline void | ||||
727 | vec_free (vec<T, A, vl_embed> *&v) | ||||
728 | { | ||||
729 | A::release (v); | ||||
730 | } | ||||
731 | |||||
732 | |||||
733 | /* Grow V to length LEN. Allocate it, if necessary. */ | ||||
734 | template<typename T, typename A> | ||||
735 | inline void | ||||
736 | vec_safe_grow (vec<T, A, vl_embed> *&v, unsigned len, | ||||
737 | bool exact = false CXX_MEM_STAT_INFO) | ||||
738 | { | ||||
739 | unsigned oldlen = vec_safe_length (v); | ||||
740 | gcc_checking_assert (len >= oldlen)((void)(!(len >= oldlen) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/vec.h" , 740, __FUNCTION__), 0 : 0)); | ||||
741 | vec_safe_reserve (v, len - oldlen, exact PASS_MEM_STAT); | ||||
742 | v->quick_grow (len); | ||||
743 | } | ||||
744 | |||||
745 | |||||
746 | /* If V is NULL, allocate it. Call V->safe_grow_cleared(LEN). */ | ||||
747 | template<typename T, typename A> | ||||
748 | inline void | ||||
749 | vec_safe_grow_cleared (vec<T, A, vl_embed> *&v, unsigned len, | ||||
750 | bool exact = false CXX_MEM_STAT_INFO) | ||||
751 | { | ||||
752 | unsigned oldlen = vec_safe_length (v); | ||||
753 | vec_safe_grow (v, len, exact PASS_MEM_STAT); | ||||
754 | vec_default_construct (v->address () + oldlen, len - oldlen); | ||||
755 | } | ||||
756 | |||||
757 | |||||
758 | /* Assume V is not NULL. */ | ||||
759 | |||||
760 | template<typename T> | ||||
761 | inline void | ||||
762 | vec_safe_grow_cleared (vec<T, va_heap, vl_ptr> *&v, | ||||
763 | unsigned len, bool exact = false CXX_MEM_STAT_INFO) | ||||
764 | { | ||||
765 | v->safe_grow_cleared (len, exact PASS_MEM_STAT); | ||||
766 | } | ||||
767 | |||||
768 | /* If V does not have space for NELEMS elements, call | ||||
769 | V->reserve(NELEMS, EXACT). */ | ||||
770 | |||||
771 | template<typename T> | ||||
772 | inline bool | ||||
773 | vec_safe_reserve (vec<T, va_heap, vl_ptr> *&v, unsigned nelems, bool exact = false | ||||
774 | CXX_MEM_STAT_INFO) | ||||
775 | { | ||||
776 | return v->reserve (nelems, exact); | ||||
777 | } | ||||
778 | |||||
779 | |||||
780 | /* If V is NULL return false, otherwise return V->iterate(IX, PTR). */ | ||||
781 | template<typename T, typename A> | ||||
782 | inline bool | ||||
783 | vec_safe_iterate (const vec<T, A, vl_embed> *v, unsigned ix, T **ptr) | ||||
784 | { | ||||
785 | if (v) | ||||
786 | return v->iterate (ix, ptr); | ||||
787 | else | ||||
788 | { | ||||
789 | *ptr = 0; | ||||
790 | return false; | ||||
791 | } | ||||
792 | } | ||||
793 | |||||
794 | template<typename T, typename A> | ||||
795 | inline bool | ||||
796 | vec_safe_iterate (const vec<T, A, vl_embed> *v, unsigned ix, T *ptr) | ||||
797 | { | ||||
798 | if (v) | ||||
799 | return v->iterate (ix, ptr); | ||||
800 | else | ||||
801 | { | ||||
802 | *ptr = 0; | ||||
803 | return false; | ||||
804 | } | ||||
805 | } | ||||
806 | |||||
807 | |||||
808 | /* If V has no room for one more element, reallocate it. Then call | ||||
809 | V->quick_push(OBJ). */ | ||||
810 | template<typename T, typename A> | ||||
811 | inline T * | ||||
812 | vec_safe_push (vec<T, A, vl_embed> *&v, const T &obj CXX_MEM_STAT_INFO) | ||||
813 | { | ||||
814 | vec_safe_reserve (v, 1, false PASS_MEM_STAT); | ||||
815 | return v->quick_push (obj); | ||||
816 | } | ||||
817 | |||||
818 | |||||
819 | /* if V has no room for one more element, reallocate it. Then call | ||||
820 | V->quick_insert(IX, OBJ). */ | ||||
821 | template<typename T, typename A> | ||||
822 | inline void | ||||
823 | vec_safe_insert (vec<T, A, vl_embed> *&v, unsigned ix, const T &obj | ||||
824 | CXX_MEM_STAT_INFO) | ||||
825 | { | ||||
826 | vec_safe_reserve (v, 1, false PASS_MEM_STAT); | ||||
827 | v->quick_insert (ix, obj); | ||||
828 | } | ||||
829 | |||||
830 | |||||
831 | /* If V is NULL, do nothing. Otherwise, call V->truncate(SIZE). */ | ||||
832 | template<typename T, typename A> | ||||
833 | inline void | ||||
834 | vec_safe_truncate (vec<T, A, vl_embed> *v, unsigned size) | ||||
835 | { | ||||
836 | if (v) | ||||
837 | v->truncate (size); | ||||
838 | } | ||||
839 | |||||
840 | |||||
841 | /* If SRC is not NULL, return a pointer to a copy of it. */ | ||||
842 | template<typename T, typename A> | ||||
843 | inline vec<T, A, vl_embed> * | ||||
844 | vec_safe_copy (vec<T, A, vl_embed> *src CXX_MEM_STAT_INFO) | ||||
845 | { | ||||
846 | return src ? src->copy (ALONE_PASS_MEM_STAT) : NULLnullptr; | ||||
847 | } | ||||
848 | |||||
849 | /* Copy the elements from SRC to the end of DST as if by memcpy. | ||||
850 | Reallocate DST, if necessary. */ | ||||
851 | template<typename T, typename A> | ||||
852 | inline void | ||||
853 | vec_safe_splice (vec<T, A, vl_embed> *&dst, const vec<T, A, vl_embed> *src | ||||
854 | CXX_MEM_STAT_INFO) | ||||
855 | { | ||||
856 | unsigned src_len = vec_safe_length (src); | ||||
857 | if (src_len) | ||||
858 | { | ||||
859 | vec_safe_reserve_exact (dst, vec_safe_length (dst) + src_len | ||||
860 | PASS_MEM_STAT); | ||||
861 | dst->splice (*src); | ||||
862 | } | ||||
863 | } | ||||
864 | |||||
865 | /* Return true if SEARCH is an element of V. Note that this is O(N) in the | ||||
866 | size of the vector and so should be used with care. */ | ||||
867 | |||||
868 | template<typename T, typename A> | ||||
869 | inline bool | ||||
870 | vec_safe_contains (vec<T, A, vl_embed> *v, const T &search) | ||||
871 | { | ||||
872 | return v ? v->contains (search) : false; | ||||
873 | } | ||||
874 | |||||
875 | /* Index into vector. Return the IX'th element. IX must be in the | ||||
876 | domain of the vector. */ | ||||
877 | |||||
878 | template<typename T, typename A> | ||||
879 | inline const T & | ||||
880 | vec<T, A, vl_embed>::operator[] (unsigned ix) const | ||||
881 | { | ||||
882 | gcc_checking_assert (ix < m_vecpfx.m_num)((void)(!(ix < m_vecpfx.m_num) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/vec.h" , 882, __FUNCTION__), 0 : 0)); | ||||
883 | return address ()[ix]; | ||||
884 | } | ||||
885 | |||||
886 | template<typename T, typename A> | ||||
887 | inline T & | ||||
888 | vec<T, A, vl_embed>::operator[] (unsigned ix) | ||||
889 | { | ||||
890 | gcc_checking_assert (ix < m_vecpfx.m_num)((void)(!(ix < m_vecpfx.m_num) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/vec.h" , 890, __FUNCTION__), 0 : 0)); | ||||
891 | return address ()[ix]; | ||||
892 | } | ||||
893 | |||||
894 | |||||
895 | /* Get the final element of the vector, which must not be empty. */ | ||||
896 | |||||
897 | template<typename T, typename A> | ||||
898 | inline T & | ||||
899 | vec<T, A, vl_embed>::last (void) | ||||
900 | { | ||||
901 | gcc_checking_assert (m_vecpfx.m_num > 0)((void)(!(m_vecpfx.m_num > 0) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/vec.h" , 901, __FUNCTION__), 0 : 0)); | ||||
902 | return (*this)[m_vecpfx.m_num - 1]; | ||||
903 | } | ||||
904 | |||||
905 | |||||
906 | /* If this vector has space for NELEMS additional entries, return | ||||
907 | true. You usually only need to use this if you are doing your | ||||
908 | own vector reallocation, for instance on an embedded vector. This | ||||
909 | returns true in exactly the same circumstances that vec::reserve | ||||
910 | will. */ | ||||
911 | |||||
912 | template<typename T, typename A> | ||||
913 | inline bool | ||||
914 | vec<T, A, vl_embed>::space (unsigned nelems) const | ||||
915 | { | ||||
916 | return m_vecpfx.m_alloc - m_vecpfx.m_num >= nelems; | ||||
917 | } | ||||
918 | |||||
919 | |||||
920 | /* Return iteration condition and update *PTR to (a copy of) the IX'th | ||||
921 | element of this vector. Use this to iterate over the elements of a | ||||
922 | vector as follows, | ||||
923 | |||||
924 | for (ix = 0; v->iterate (ix, &val); ix++) | ||||
925 | continue; */ | ||||
926 | |||||
927 | template<typename T, typename A> | ||||
928 | inline bool | ||||
929 | vec<T, A, vl_embed>::iterate (unsigned ix, T *ptr) const | ||||
930 | { | ||||
931 | if (ix < m_vecpfx.m_num) | ||||
932 | { | ||||
933 | *ptr = address ()[ix]; | ||||
934 | return true; | ||||
935 | } | ||||
936 | else | ||||
937 | { | ||||
938 | *ptr = 0; | ||||
939 | return false; | ||||
940 | } | ||||
941 | } | ||||
942 | |||||
943 | |||||
944 | /* Return iteration condition and update *PTR to point to the | ||||
945 | IX'th element of this vector. Use this to iterate over the | ||||
946 | elements of a vector as follows, | ||||
947 | |||||
948 | for (ix = 0; v->iterate (ix, &ptr); ix++) | ||||
949 | continue; | ||||
950 | |||||
951 | This variant is for vectors of objects. */ | ||||
952 | |||||
953 | template<typename T, typename A> | ||||
954 | inline bool | ||||
955 | vec<T, A, vl_embed>::iterate (unsigned ix, T **ptr) const | ||||
956 | { | ||||
957 | if (ix < m_vecpfx.m_num) | ||||
958 | { | ||||
959 | *ptr = CONST_CAST (T *, &address ()[ix])(const_cast<T *> ((&address ()[ix]))); | ||||
960 | return true; | ||||
961 | } | ||||
962 | else | ||||
963 | { | ||||
964 | *ptr = 0; | ||||
965 | return false; | ||||
966 | } | ||||
967 | } | ||||
968 | |||||
969 | |||||
970 | /* Return a pointer to a copy of this vector. */ | ||||
971 | |||||
972 | template<typename T, typename A> | ||||
973 | inline vec<T, A, vl_embed> * | ||||
974 | vec<T, A, vl_embed>::copy (ALONE_MEM_STAT_DECLvoid) const | ||||
975 | { | ||||
976 | vec<T, A, vl_embed> *new_vec = NULLnullptr; | ||||
977 | unsigned len = length (); | ||||
978 | if (len) | ||||
979 | { | ||||
980 | vec_alloc (new_vec, len PASS_MEM_STAT); | ||||
981 | new_vec->embedded_init (len, len); | ||||
982 | vec_copy_construct (new_vec->address (), address (), len); | ||||
983 | } | ||||
984 | return new_vec; | ||||
985 | } | ||||
986 | |||||
987 | |||||
988 | /* Copy the elements from SRC to the end of this vector as if by memcpy. | ||||
989 | The vector must have sufficient headroom available. */ | ||||
990 | |||||
991 | template<typename T, typename A> | ||||
992 | inline void | ||||
993 | vec<T, A, vl_embed>::splice (const vec<T, A, vl_embed> &src) | ||||
994 | { | ||||
995 | unsigned len = src.length (); | ||||
996 | if (len) | ||||
997 | { | ||||
998 | gcc_checking_assert (space (len))((void)(!(space (len)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/vec.h" , 998, __FUNCTION__), 0 : 0)); | ||||
999 | vec_copy_construct (end (), src.address (), len); | ||||
1000 | m_vecpfx.m_num += len; | ||||
1001 | } | ||||
1002 | } | ||||
1003 | |||||
1004 | template<typename T, typename A> | ||||
1005 | inline void | ||||
1006 | vec<T, A, vl_embed>::splice (const vec<T, A, vl_embed> *src) | ||||
1007 | { | ||||
1008 | if (src) | ||||
1009 | splice (*src); | ||||
1010 | } | ||||
1011 | |||||
1012 | |||||
1013 | /* Push OBJ (a new element) onto the end of the vector. There must be | ||||
1014 | sufficient space in the vector. Return a pointer to the slot | ||||
1015 | where OBJ was inserted. */ | ||||
1016 | |||||
1017 | template<typename T, typename A> | ||||
1018 | inline T * | ||||
1019 | vec<T, A, vl_embed>::quick_push (const T &obj) | ||||
1020 | { | ||||
1021 | gcc_checking_assert (space (1))((void)(!(space (1)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/vec.h" , 1021, __FUNCTION__), 0 : 0)); | ||||
1022 | T *slot = &address ()[m_vecpfx.m_num++]; | ||||
1023 | *slot = obj; | ||||
1024 | return slot; | ||||
1025 | } | ||||
1026 | |||||
1027 | |||||
1028 | /* Pop and return the last element off the end of the vector. */ | ||||
1029 | |||||
1030 | template<typename T, typename A> | ||||
1031 | inline T & | ||||
1032 | vec<T, A, vl_embed>::pop (void) | ||||
1033 | { | ||||
1034 | gcc_checking_assert (length () > 0)((void)(!(length () > 0) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/vec.h" , 1034, __FUNCTION__), 0 : 0)); | ||||
1035 | return address ()[--m_vecpfx.m_num]; | ||||
1036 | } | ||||
1037 | |||||
1038 | |||||
1039 | /* Set the length of the vector to SIZE. The new length must be less | ||||
1040 | than or equal to the current length. This is an O(1) operation. */ | ||||
1041 | |||||
1042 | template<typename T, typename A> | ||||
1043 | inline void | ||||
1044 | vec<T, A, vl_embed>::truncate (unsigned size) | ||||
1045 | { | ||||
1046 | gcc_checking_assert (length () >= size)((void)(!(length () >= size) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/vec.h" , 1046, __FUNCTION__), 0 : 0)); | ||||
1047 | m_vecpfx.m_num = size; | ||||
1048 | } | ||||
1049 | |||||
1050 | |||||
1051 | /* Insert an element, OBJ, at the IXth position of this vector. There | ||||
1052 | must be sufficient space. */ | ||||
1053 | |||||
1054 | template<typename T, typename A> | ||||
1055 | inline void | ||||
1056 | vec<T, A, vl_embed>::quick_insert (unsigned ix, const T &obj) | ||||
1057 | { | ||||
1058 | gcc_checking_assert (length () < allocated ())((void)(!(length () < allocated ()) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/vec.h" , 1058, __FUNCTION__), 0 : 0)); | ||||
1059 | gcc_checking_assert (ix <= length ())((void)(!(ix <= length ()) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/vec.h" , 1059, __FUNCTION__), 0 : 0)); | ||||
1060 | T *slot = &address ()[ix]; | ||||
1061 | memmove (slot + 1, slot, (m_vecpfx.m_num++ - ix) * sizeof (T)); | ||||
1062 | *slot = obj; | ||||
1063 | } | ||||
1064 | |||||
1065 | |||||
1066 | /* Remove an element from the IXth position of this vector. Ordering of | ||||
1067 | remaining elements is preserved. This is an O(N) operation due to | ||||
1068 | memmove. */ | ||||
1069 | |||||
1070 | template<typename T, typename A> | ||||
1071 | inline void | ||||
1072 | vec<T, A, vl_embed>::ordered_remove (unsigned ix) | ||||
1073 | { | ||||
1074 | gcc_checking_assert (ix < length ())((void)(!(ix < length ()) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/vec.h" , 1074, __FUNCTION__), 0 : 0)); | ||||
1075 | T *slot = &address ()[ix]; | ||||
1076 | memmove (slot, slot + 1, (--m_vecpfx.m_num - ix) * sizeof (T)); | ||||
1077 | } | ||||
1078 | |||||
1079 | |||||
1080 | /* Remove elements in [START, END) from VEC for which COND holds. Ordering of | ||||
1081 | remaining elements is preserved. This is an O(N) operation. */ | ||||
1082 | |||||
1083 | #define VEC_ORDERED_REMOVE_IF_FROM_TO(vec, read_index, write_index, \{ ((void)(!((end) <= (vec).length ()) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/vec.h" , 1084, __FUNCTION__), 0 : 0)); for (read_index = write_index = (start); read_index < (end); ++read_index) { elem_ptr = &(vec)[read_index]; bool remove_p = (cond); if (remove_p ) continue; if (read_index != write_index) (vec)[write_index] = (vec)[read_index]; write_index++; } if (read_index - write_index > 0) (vec).block_remove (write_index, read_index - write_index ); } | ||||
1084 | elem_ptr, start, end, cond){ ((void)(!((end) <= (vec).length ()) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/vec.h" , 1084, __FUNCTION__), 0 : 0)); for (read_index = write_index = (start); read_index < (end); ++read_index) { elem_ptr = &(vec)[read_index]; bool remove_p = (cond); if (remove_p ) continue; if (read_index != write_index) (vec)[write_index] = (vec)[read_index]; write_index++; } if (read_index - write_index > 0) (vec).block_remove (write_index, read_index - write_index ); } \ | ||||
1085 | { \ | ||||
1086 | gcc_assert ((end) <= (vec).length ())((void)(!((end) <= (vec).length ()) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/vec.h" , 1086, __FUNCTION__), 0 : 0)); \ | ||||
1087 | for (read_index = write_index = (start); read_index < (end); \ | ||||
1088 | ++read_index) \ | ||||
1089 | { \ | ||||
1090 | elem_ptr = &(vec)[read_index]; \ | ||||
1091 | bool remove_p = (cond); \ | ||||
1092 | if (remove_p) \ | ||||
1093 | continue; \ | ||||
1094 | \ | ||||
1095 | if (read_index != write_index) \ | ||||
1096 | (vec)[write_index] = (vec)[read_index]; \ | ||||
1097 | \ | ||||
1098 | write_index++; \ | ||||
1099 | } \ | ||||
1100 | \ | ||||
1101 | if (read_index - write_index > 0) \ | ||||
1102 | (vec).block_remove (write_index, read_index - write_index); \ | ||||
1103 | } | ||||
1104 | |||||
1105 | |||||
1106 | /* Remove elements from VEC for which COND holds. Ordering of remaining | ||||
1107 | elements is preserved. This is an O(N) operation. */ | ||||
1108 | |||||
1109 | #define VEC_ORDERED_REMOVE_IF(vec, read_index, write_index, elem_ptr, \{ ((void)(!(((vec).length ()) <= ((vec)).length ()) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/vec.h" , 1110, __FUNCTION__), 0 : 0)); for (read_index = write_index = (0); read_index < ((vec).length ()); ++read_index) { elem_ptr = &((vec))[read_index]; bool remove_p = ((cond)); if (remove_p ) continue; if (read_index != write_index) ((vec))[write_index ] = ((vec))[read_index]; write_index++; } if (read_index - write_index > 0) ((vec)).block_remove (write_index, read_index - write_index ); } | ||||
1110 | cond){ ((void)(!(((vec).length ()) <= ((vec)).length ()) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/vec.h" , 1110, __FUNCTION__), 0 : 0)); for (read_index = write_index = (0); read_index < ((vec).length ()); ++read_index) { elem_ptr = &((vec))[read_index]; bool remove_p = ((cond)); if (remove_p ) continue; if (read_index != write_index) ((vec))[write_index ] = ((vec))[read_index]; write_index++; } if (read_index - write_index > 0) ((vec)).block_remove (write_index, read_index - write_index ); } \ | ||||
1111 | VEC_ORDERED_REMOVE_IF_FROM_TO ((vec), read_index, write_index, \{ ((void)(!(((vec).length ()) <= ((vec)).length ()) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/vec.h" , 1112, __FUNCTION__), 0 : 0)); for (read_index = write_index = (0); read_index < ((vec).length ()); ++read_index) { elem_ptr = &((vec))[read_index]; bool remove_p = ((cond)); if (remove_p ) continue; if (read_index != write_index) ((vec))[write_index ] = ((vec))[read_index]; write_index++; } if (read_index - write_index > 0) ((vec)).block_remove (write_index, read_index - write_index ); } | ||||
1112 | elem_ptr, 0, (vec).length (), (cond)){ ((void)(!(((vec).length ()) <= ((vec)).length ()) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/vec.h" , 1112, __FUNCTION__), 0 : 0)); for (read_index = write_index = (0); read_index < ((vec).length ()); ++read_index) { elem_ptr = &((vec))[read_index]; bool remove_p = ((cond)); if (remove_p ) continue; if (read_index != write_index) ((vec))[write_index ] = ((vec))[read_index]; write_index++; } if (read_index - write_index > 0) ((vec)).block_remove (write_index, read_index - write_index ); } | ||||
1113 | |||||
1114 | /* Remove an element from the IXth position of this vector. Ordering of | ||||
1115 | remaining elements is destroyed. This is an O(1) operation. */ | ||||
1116 | |||||
1117 | template<typename T, typename A> | ||||
1118 | inline void | ||||
1119 | vec<T, A, vl_embed>::unordered_remove (unsigned ix) | ||||
1120 | { | ||||
1121 | gcc_checking_assert (ix < length ())((void)(!(ix < length ()) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/vec.h" , 1121, __FUNCTION__), 0 : 0)); | ||||
1122 | T *p = address (); | ||||
1123 | p[ix] = p[--m_vecpfx.m_num]; | ||||
1124 | } | ||||
1125 | |||||
1126 | |||||
1127 | /* Remove LEN elements starting at the IXth. Ordering is retained. | ||||
1128 | This is an O(N) operation due to memmove. */ | ||||
1129 | |||||
1130 | template<typename T, typename A> | ||||
1131 | inline void | ||||
1132 | vec<T, A, vl_embed>::block_remove (unsigned ix, unsigned len) | ||||
1133 | { | ||||
1134 | gcc_checking_assert (ix + len <= length ())((void)(!(ix + len <= length ()) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/vec.h" , 1134, __FUNCTION__), 0 : 0)); | ||||
1135 | T *slot = &address ()[ix]; | ||||
1136 | m_vecpfx.m_num -= len; | ||||
1137 | memmove (slot, slot + len, (m_vecpfx.m_num - ix) * sizeof (T)); | ||||
1138 | } | ||||
1139 | |||||
1140 | |||||
1141 | /* Sort the contents of this vector with qsort. CMP is the comparison | ||||
1142 | function to pass to qsort. */ | ||||
1143 | |||||
1144 | template<typename T, typename A> | ||||
1145 | inline void | ||||
1146 | vec<T, A, vl_embed>::qsort (int (*cmp) (const void *, const void *))qsort (int (*cmp) (const void *, const void *)) | ||||
1147 | { | ||||
1148 | if (length () > 1) | ||||
1149 | gcc_qsort (address (), length (), sizeof (T), cmp); | ||||
1150 | } | ||||
1151 | |||||
1152 | /* Sort the contents of this vector with qsort. CMP is the comparison | ||||
1153 | function to pass to qsort. */ | ||||
1154 | |||||
1155 | template<typename T, typename A> | ||||
1156 | inline void | ||||
1157 | vec<T, A, vl_embed>::sort (int (*cmp) (const void *, const void *, void *), | ||||
1158 | void *data) | ||||
1159 | { | ||||
1160 | if (length () > 1) | ||||
1161 | gcc_sort_r (address (), length (), sizeof (T), cmp, data); | ||||
1162 | } | ||||
1163 | |||||
1164 | /* Sort the contents of this vector with gcc_stablesort_r. CMP is the | ||||
1165 | comparison function to pass to qsort. */ | ||||
1166 | |||||
1167 | template<typename T, typename A> | ||||
1168 | inline void | ||||
1169 | vec<T, A, vl_embed>::stablesort (int (*cmp) (const void *, const void *, | ||||
1170 | void *), void *data) | ||||
1171 | { | ||||
1172 | if (length () > 1) | ||||
1173 | gcc_stablesort_r (address (), length (), sizeof (T), cmp, data); | ||||
1174 | } | ||||
1175 | |||||
1176 | /* Search the contents of the sorted vector with a binary search. | ||||
1177 | CMP is the comparison function to pass to bsearch. */ | ||||
1178 | |||||
1179 | template<typename T, typename A> | ||||
1180 | inline T * | ||||
1181 | vec<T, A, vl_embed>::bsearch (const void *key, | ||||
1182 | int (*compar) (const void *, const void *)) | ||||
1183 | { | ||||
1184 | const void *base = this->address (); | ||||
1185 | size_t nmemb = this->length (); | ||||
1186 | size_t size = sizeof (T); | ||||
1187 | /* The following is a copy of glibc stdlib-bsearch.h. */ | ||||
1188 | size_t l, u, idx; | ||||
1189 | const void *p; | ||||
1190 | int comparison; | ||||
1191 | |||||
1192 | l = 0; | ||||
1193 | u = nmemb; | ||||
1194 | while (l < u) | ||||
1195 | { | ||||
1196 | idx = (l + u) / 2; | ||||
1197 | p = (const void *) (((const char *) base) + (idx * size)); | ||||
1198 | comparison = (*compar) (key, p); | ||||
1199 | if (comparison < 0) | ||||
1200 | u = idx; | ||||
1201 | else if (comparison > 0) | ||||
1202 | l = idx + 1; | ||||
1203 | else | ||||
1204 | return (T *)const_cast<void *>(p); | ||||
1205 | } | ||||
1206 | |||||
1207 | return NULLnullptr; | ||||
1208 | } | ||||
1209 | |||||
1210 | /* Search the contents of the sorted vector with a binary search. | ||||
1211 | CMP is the comparison function to pass to bsearch. */ | ||||
1212 | |||||
1213 | template<typename T, typename A> | ||||
1214 | inline T * | ||||
1215 | vec<T, A, vl_embed>::bsearch (const void *key, | ||||
1216 | int (*compar) (const void *, const void *, | ||||
1217 | void *), void *data) | ||||
1218 | { | ||||
1219 | const void *base = this->address (); | ||||
1220 | size_t nmemb = this->length (); | ||||
1221 | size_t size = sizeof (T); | ||||
1222 | /* The following is a copy of glibc stdlib-bsearch.h. */ | ||||
1223 | size_t l, u, idx; | ||||
1224 | const void *p; | ||||
1225 | int comparison; | ||||
1226 | |||||
1227 | l = 0; | ||||
1228 | u = nmemb; | ||||
1229 | while (l < u) | ||||
1230 | { | ||||
1231 | idx = (l + u) / 2; | ||||
1232 | p = (const void *) (((const char *) base) + (idx * size)); | ||||
1233 | comparison = (*compar) (key, p, data); | ||||
1234 | if (comparison < 0) | ||||
1235 | u = idx; | ||||
1236 | else if (comparison > 0) | ||||
1237 | l = idx + 1; | ||||
1238 | else | ||||
1239 | return (T *)const_cast<void *>(p); | ||||
1240 | } | ||||
1241 | |||||
1242 | return NULLnullptr; | ||||
1243 | } | ||||
1244 | |||||
1245 | /* Return true if SEARCH is an element of V. Note that this is O(N) in the | ||||
1246 | size of the vector and so should be used with care. */ | ||||
1247 | |||||
1248 | template<typename T, typename A> | ||||
1249 | inline bool | ||||
1250 | vec<T, A, vl_embed>::contains (const T &search) const | ||||
1251 | { | ||||
1252 | unsigned int len = length (); | ||||
1253 | const T *p = address (); | ||||
1254 | for (unsigned int i = 0; i < len; i++) | ||||
1255 | { | ||||
1256 | const T *slot = &p[i]; | ||||
1257 | if (*slot == search) | ||||
1258 | return true; | ||||
1259 | } | ||||
1260 | |||||
1261 | return false; | ||||
1262 | } | ||||
1263 | |||||
1264 | /* Find and return the first position in which OBJ could be inserted | ||||
1265 | without changing the ordering of this vector. LESSTHAN is a | ||||
1266 | function that returns true if the first argument is strictly less | ||||
1267 | than the second. */ | ||||
1268 | |||||
1269 | template<typename T, typename A> | ||||
1270 | unsigned | ||||
1271 | vec<T, A, vl_embed>::lower_bound (const T &obj, | ||||
1272 | bool (*lessthan)(const T &, const T &)) | ||||
1273 | const | ||||
1274 | { | ||||
1275 | unsigned int len = length (); | ||||
1276 | unsigned int half, middle; | ||||
1277 | unsigned int first = 0; | ||||
1278 | while (len > 0) | ||||
1279 | { | ||||
1280 | half = len / 2; | ||||
1281 | middle = first; | ||||
1282 | middle += half; | ||||
1283 | const T &middle_elem = address ()[middle]; | ||||
1284 | if (lessthan (middle_elem, obj)) | ||||
1285 | { | ||||
1286 | first = middle; | ||||
1287 | ++first; | ||||
1288 | len = len - half - 1; | ||||
1289 | } | ||||
1290 | else | ||||
1291 | len = half; | ||||
1292 | } | ||||
1293 | return first; | ||||
1294 | } | ||||
1295 | |||||
1296 | |||||
1297 | /* Return the number of bytes needed to embed an instance of an | ||||
1298 | embeddable vec inside another data structure. | ||||
1299 | |||||
1300 | Use these methods to determine the required size and initialization | ||||
1301 | of a vector V of type T embedded within another structure (as the | ||||
1302 | final member): | ||||
1303 | |||||
1304 | size_t vec<T, A, vl_embed>::embedded_size (unsigned alloc); | ||||
1305 | void v->embedded_init (unsigned alloc, unsigned num); | ||||
1306 | |||||
1307 | These allow the caller to perform the memory allocation. */ | ||||
1308 | |||||
1309 | template<typename T, typename A> | ||||
1310 | inline size_t | ||||
1311 | vec<T, A, vl_embed>::embedded_size (unsigned alloc) | ||||
1312 | { | ||||
1313 | struct alignas (T) U { char data[sizeof (T)]; }; | ||||
1314 | typedef vec<U, A, vl_embed> vec_embedded; | ||||
1315 | typedef typename std::conditional<std::is_standard_layout<T>::value, | ||||
1316 | vec, vec_embedded>::type vec_stdlayout; | ||||
1317 | static_assert (sizeof (vec_stdlayout) == sizeof (vec), ""); | ||||
1318 | static_assert (alignof (vec_stdlayout) == alignof (vec), ""); | ||||
1319 | return sizeof (vec_stdlayout) + alloc * sizeof (T); | ||||
1320 | } | ||||
1321 | |||||
1322 | |||||
1323 | /* Initialize the vector to contain room for ALLOC elements and | ||||
1324 | NUM active elements. */ | ||||
1325 | |||||
1326 | template<typename T, typename A> | ||||
1327 | inline void | ||||
1328 | vec<T, A, vl_embed>::embedded_init (unsigned alloc, unsigned num, unsigned aut) | ||||
1329 | { | ||||
1330 | m_vecpfx.m_alloc = alloc; | ||||
1331 | m_vecpfx.m_using_auto_storage = aut; | ||||
1332 | m_vecpfx.m_num = num; | ||||
1333 | } | ||||
1334 | |||||
1335 | |||||
1336 | /* Grow the vector to a specific length. LEN must be as long or longer than | ||||
1337 | the current length. The new elements are uninitialized. */ | ||||
1338 | |||||
1339 | template<typename T, typename A> | ||||
1340 | inline void | ||||
1341 | vec<T, A, vl_embed>::quick_grow (unsigned len) | ||||
1342 | { | ||||
1343 | gcc_checking_assert (length () <= len && len <= m_vecpfx.m_alloc)((void)(!(length () <= len && len <= m_vecpfx.m_alloc ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/vec.h" , 1343, __FUNCTION__), 0 : 0)); | ||||
1344 | m_vecpfx.m_num = len; | ||||
1345 | } | ||||
1346 | |||||
1347 | |||||
1348 | /* Grow the vector to a specific length. LEN must be as long or longer than | ||||
1349 | the current length. The new elements are initialized to zero. */ | ||||
1350 | |||||
1351 | template<typename T, typename A> | ||||
1352 | inline void | ||||
1353 | vec<T, A, vl_embed>::quick_grow_cleared (unsigned len) | ||||
1354 | { | ||||
1355 | unsigned oldlen = length (); | ||||
1356 | size_t growby = len - oldlen; | ||||
1357 | quick_grow (len); | ||||
1358 | if (growby != 0) | ||||
1359 | vec_default_construct (address () + oldlen, growby); | ||||
1360 | } | ||||
1361 | |||||
1362 | /* Garbage collection support for vec<T, A, vl_embed>. */ | ||||
1363 | |||||
1364 | template<typename T> | ||||
1365 | void | ||||
1366 | gt_ggc_mx (vec<T, va_gc> *v) | ||||
1367 | { | ||||
1368 | extern void gt_ggc_mx (T &); | ||||
1369 | for (unsigned i = 0; i < v->length (); i++) | ||||
1370 | gt_ggc_mx ((*v)[i]); | ||||
1371 | } | ||||
1372 | |||||
1373 | template<typename T> | ||||
1374 | void | ||||
1375 | gt_ggc_mx (vec<T, va_gc_atomic, vl_embed> *v ATTRIBUTE_UNUSED__attribute__ ((__unused__))) | ||||
1376 | { | ||||
1377 | /* Nothing to do. Vectors of atomic types wrt GC do not need to | ||||
1378 | be traversed. */ | ||||
1379 | } | ||||
1380 | |||||
1381 | |||||
1382 | /* PCH support for vec<T, A, vl_embed>. */ | ||||
1383 | |||||
1384 | template<typename T, typename A> | ||||
1385 | void | ||||
1386 | gt_pch_nx (vec<T, A, vl_embed> *v) | ||||
1387 | { | ||||
1388 | extern void gt_pch_nx (T &); | ||||
1389 | for (unsigned i = 0; i < v->length (); i++) | ||||
1390 | gt_pch_nx ((*v)[i]); | ||||
1391 | } | ||||
1392 | |||||
1393 | template<typename T, typename A> | ||||
1394 | void | ||||
1395 | gt_pch_nx (vec<T *, A, vl_embed> *v, gt_pointer_operator op, void *cookie) | ||||
1396 | { | ||||
1397 | for (unsigned i = 0; i < v->length (); i++) | ||||
1398 | op (&((*v)[i]), NULLnullptr, cookie); | ||||
1399 | } | ||||
1400 | |||||
1401 | template<typename T, typename A> | ||||
1402 | void | ||||
1403 | gt_pch_nx (vec<T, A, vl_embed> *v, gt_pointer_operator op, void *cookie) | ||||
1404 | { | ||||
1405 | extern void gt_pch_nx (T *, gt_pointer_operator, void *); | ||||
1406 | for (unsigned i = 0; i < v->length (); i++) | ||||
1407 | gt_pch_nx (&((*v)[i]), op, cookie); | ||||
1408 | } | ||||
1409 | |||||
1410 | |||||
1411 | /* Space efficient vector. These vectors can grow dynamically and are | ||||
1412 | allocated together with their control data. They are suited to be | ||||
1413 | included in data structures. Prior to initial allocation, they | ||||
1414 | only take a single word of storage. | ||||
1415 | |||||
1416 | These vectors are implemented as a pointer to an embeddable vector. | ||||
1417 | The semantics allow for this pointer to be NULL to represent empty | ||||
1418 | vectors. This way, empty vectors occupy minimal space in the | ||||
1419 | structure containing them. | ||||
1420 | |||||
1421 | Properties: | ||||
1422 | |||||
1423 | - The whole vector and control data are allocated in a single | ||||
1424 | contiguous block. | ||||
1425 | - The whole vector may be re-allocated. | ||||
1426 | - Vector data may grow and shrink. | ||||
1427 | - Access and manipulation requires a pointer test and | ||||
1428 | indirection. | ||||
1429 | - It requires 1 word of storage (prior to vector allocation). | ||||
1430 | |||||
1431 | |||||
1432 | Limitations: | ||||
1433 | |||||
1434 | These vectors must be PODs because they are stored in unions. | ||||
1435 | (http://en.wikipedia.org/wiki/Plain_old_data_structures). | ||||
1436 | As long as we use C++03, we cannot have constructors nor | ||||
1437 | destructors in classes that are stored in unions. */ | ||||
1438 | |||||
1439 | template<typename T, size_t N = 0> | ||||
1440 | class auto_vec; | ||||
1441 | |||||
1442 | template<typename T> | ||||
1443 | struct vec<T, va_heap, vl_ptr> | ||||
1444 | { | ||||
1445 | public: | ||||
1446 | /* Default ctors to ensure triviality. Use value-initialization | ||||
1447 | (e.g., vec() or vec v{ };) or vNULL to create a zero-initialized | ||||
1448 | instance. */ | ||||
1449 | vec () = default; | ||||
1450 | vec (const vec &) = default; | ||||
1451 | /* Initialization from the generic vNULL. */ | ||||
1452 | vec (vnull): m_vec () { } | ||||
1453 | /* Same as default ctor: vec storage must be released manually. */ | ||||
1454 | ~vec () = default; | ||||
1455 | |||||
1456 | /* Defaulted same as copy ctor. */ | ||||
1457 | vec& operator= (const vec &) = default; | ||||
1458 | |||||
1459 | /* Prevent implicit conversion from auto_vec. Use auto_vec::to_vec() | ||||
1460 | instead. */ | ||||
1461 | template <size_t N> | ||||
1462 | vec (auto_vec<T, N> &) = delete; | ||||
1463 | |||||
1464 | template <size_t N> | ||||
1465 | void operator= (auto_vec<T, N> &) = delete; | ||||
1466 | |||||
1467 | /* Memory allocation and deallocation for the embedded vector. | ||||
1468 | Needed because we cannot have proper ctors/dtors defined. */ | ||||
1469 | void create (unsigned nelems CXX_MEM_STAT_INFO); | ||||
1470 | void release (void); | ||||
1471 | |||||
1472 | /* Vector operations. */ | ||||
1473 | bool exists (void) const | ||||
1474 | { return m_vec != NULLnullptr; } | ||||
1475 | |||||
1476 | bool is_empty (void) const | ||||
1477 | { return m_vec ? m_vec->is_empty () : true; } | ||||
1478 | |||||
1479 | unsigned allocated (void) const | ||||
1480 | { return m_vec ? m_vec->allocated () : 0; } | ||||
1481 | |||||
1482 | unsigned length (void) const | ||||
1483 | { return m_vec ? m_vec->length () : 0; } | ||||
1484 | |||||
1485 | T *address (void) | ||||
1486 | { return m_vec ? m_vec->address () : NULLnullptr; } | ||||
1487 | |||||
1488 | const T *address (void) const | ||||
1489 | { return m_vec ? m_vec->address () : NULLnullptr; } | ||||
1490 | |||||
1491 | T *begin () { return address (); } | ||||
1492 | const T *begin () const { return address (); } | ||||
1493 | T *end () { return begin () + length (); } | ||||
1494 | const T *end () const { return begin () + length (); } | ||||
1495 | const T &operator[] (unsigned ix) const | ||||
1496 | { return (*m_vec)[ix]; } | ||||
1497 | |||||
1498 | bool operator!=(const vec &other) const | ||||
1499 |