gimple.h revision 1.12 1 1.1 mrg /* Gimple IR definitions.
2 1.1 mrg
3 1.12 mrg Copyright (C) 2007-2020 Free Software Foundation, Inc.
4 1.1 mrg Contributed by Aldy Hernandez <aldyh (at) redhat.com>
5 1.1 mrg
6 1.1 mrg This file is part of GCC.
7 1.1 mrg
8 1.1 mrg GCC is free software; you can redistribute it and/or modify it under
9 1.1 mrg the terms of the GNU General Public License as published by the Free
10 1.1 mrg Software Foundation; either version 3, or (at your option) any later
11 1.1 mrg version.
12 1.1 mrg
13 1.1 mrg GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 1.1 mrg WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 1.1 mrg FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 1.1 mrg for more details.
17 1.1 mrg
18 1.1 mrg You should have received a copy of the GNU General Public License
19 1.1 mrg along with GCC; see the file COPYING3. If not see
20 1.1 mrg <http://www.gnu.org/licenses/>. */
21 1.1 mrg
22 1.1 mrg #ifndef GCC_GIMPLE_H
23 1.1 mrg #define GCC_GIMPLE_H
24 1.1 mrg
25 1.6 mrg #include "tree-ssa-alias.h"
26 1.6 mrg #include "gimple-expr.h"
27 1.6 mrg
28 1.6 mrg typedef gimple *gimple_seq_node;
29 1.1 mrg
30 1.1 mrg enum gimple_code {
31 1.1 mrg #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
32 1.1 mrg #include "gimple.def"
33 1.1 mrg #undef DEFGSCODE
34 1.1 mrg LAST_AND_UNUSED_GIMPLE_CODE
35 1.1 mrg };
36 1.1 mrg
37 1.1 mrg extern const char *const gimple_code_name[];
38 1.1 mrg extern const unsigned char gimple_rhs_class_table[];
39 1.1 mrg
40 1.6 mrg /* Strip the outermost pointer, from tr1/type_traits. */
41 1.6 mrg template<typename T> struct remove_pointer { typedef T type; };
42 1.6 mrg template<typename T> struct remove_pointer<T *> { typedef T type; };
43 1.6 mrg
44 1.1 mrg /* Error out if a gimple tuple is addressed incorrectly. */
45 1.1 mrg #if defined ENABLE_GIMPLE_CHECKING
46 1.3 mrg #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
47 1.6 mrg extern void gimple_check_failed (const gimple *, const char *, int, \
48 1.1 mrg const char *, enum gimple_code, \
49 1.10 mrg enum tree_code) ATTRIBUTE_NORETURN \
50 1.10 mrg ATTRIBUTE_COLD;
51 1.1 mrg
52 1.1 mrg #define GIMPLE_CHECK(GS, CODE) \
53 1.1 mrg do { \
54 1.6 mrg const gimple *__gs = (GS); \
55 1.1 mrg if (gimple_code (__gs) != (CODE)) \
56 1.1 mrg gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
57 1.1 mrg (CODE), ERROR_MARK); \
58 1.1 mrg } while (0)
59 1.6 mrg template <typename T>
60 1.6 mrg static inline T
61 1.6 mrg GIMPLE_CHECK2(const gimple *gs,
62 1.6 mrg #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
63 1.6 mrg const char *file = __builtin_FILE (),
64 1.6 mrg int line = __builtin_LINE (),
65 1.6 mrg const char *fun = __builtin_FUNCTION ())
66 1.6 mrg #else
67 1.6 mrg const char *file = __FILE__,
68 1.6 mrg int line = __LINE__,
69 1.6 mrg const char *fun = NULL)
70 1.6 mrg #endif
71 1.6 mrg {
72 1.6 mrg T ret = dyn_cast <T> (gs);
73 1.6 mrg if (!ret)
74 1.6 mrg gimple_check_failed (gs, file, line, fun,
75 1.6 mrg remove_pointer<T>::type::code_, ERROR_MARK);
76 1.6 mrg return ret;
77 1.6 mrg }
78 1.6 mrg template <typename T>
79 1.6 mrg static inline T
80 1.6 mrg GIMPLE_CHECK2(gimple *gs,
81 1.6 mrg #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
82 1.6 mrg const char *file = __builtin_FILE (),
83 1.6 mrg int line = __builtin_LINE (),
84 1.6 mrg const char *fun = __builtin_FUNCTION ())
85 1.6 mrg #else
86 1.6 mrg const char *file = __FILE__,
87 1.6 mrg int line = __LINE__,
88 1.6 mrg const char *fun = NULL)
89 1.6 mrg #endif
90 1.6 mrg {
91 1.6 mrg T ret = dyn_cast <T> (gs);
92 1.6 mrg if (!ret)
93 1.6 mrg gimple_check_failed (gs, file, line, fun,
94 1.6 mrg remove_pointer<T>::type::code_, ERROR_MARK);
95 1.6 mrg return ret;
96 1.6 mrg }
97 1.1 mrg #else /* not ENABLE_GIMPLE_CHECKING */
98 1.3 mrg #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
99 1.1 mrg #define GIMPLE_CHECK(GS, CODE) (void)0
100 1.6 mrg template <typename T>
101 1.6 mrg static inline T
102 1.6 mrg GIMPLE_CHECK2(gimple *gs)
103 1.6 mrg {
104 1.6 mrg return as_a <T> (gs);
105 1.6 mrg }
106 1.6 mrg template <typename T>
107 1.6 mrg static inline T
108 1.6 mrg GIMPLE_CHECK2(const gimple *gs)
109 1.6 mrg {
110 1.6 mrg return as_a <T> (gs);
111 1.6 mrg }
112 1.1 mrg #endif
113 1.1 mrg
114 1.1 mrg /* Class of GIMPLE expressions suitable for the RHS of assignments. See
115 1.1 mrg get_gimple_rhs_class. */
116 1.1 mrg enum gimple_rhs_class
117 1.1 mrg {
118 1.1 mrg GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
119 1.3 mrg GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
120 1.1 mrg GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
121 1.1 mrg GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
122 1.1 mrg GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
123 1.1 mrg name, a _DECL, a _REF, etc. */
124 1.1 mrg };
125 1.1 mrg
126 1.1 mrg /* Specific flags for individual GIMPLE statements. These flags are
127 1.6 mrg always stored in gimple.subcode and they may only be
128 1.5 mrg defined for statement codes that do not use subcodes.
129 1.1 mrg
130 1.1 mrg Values for the masks can overlap as long as the overlapping values
131 1.1 mrg are never used in the same statement class.
132 1.1 mrg
133 1.1 mrg The maximum mask value that can be defined is 1 << 15 (i.e., each
134 1.1 mrg statement code can hold up to 16 bitflags).
135 1.1 mrg
136 1.1 mrg Keep this list sorted. */
137 1.1 mrg enum gf_mask {
138 1.1 mrg GF_ASM_INPUT = 1 << 0,
139 1.1 mrg GF_ASM_VOLATILE = 1 << 1,
140 1.9 mrg GF_ASM_INLINE = 1 << 2,
141 1.3 mrg GF_CALL_FROM_THUNK = 1 << 0,
142 1.3 mrg GF_CALL_RETURN_SLOT_OPT = 1 << 1,
143 1.3 mrg GF_CALL_TAILCALL = 1 << 2,
144 1.3 mrg GF_CALL_VA_ARG_PACK = 1 << 3,
145 1.3 mrg GF_CALL_NOTHROW = 1 << 4,
146 1.3 mrg GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
147 1.3 mrg GF_CALL_INTERNAL = 1 << 6,
148 1.5 mrg GF_CALL_CTRL_ALTERING = 1 << 7,
149 1.8 mrg GF_CALL_MUST_TAIL_CALL = 1 << 9,
150 1.8 mrg GF_CALL_BY_DESCRIPTOR = 1 << 10,
151 1.10 mrg GF_CALL_NOCF_CHECK = 1 << 11,
152 1.1 mrg GF_OMP_PARALLEL_COMBINED = 1 << 0,
153 1.6 mrg GF_OMP_PARALLEL_GRID_PHONY = 1 << 1,
154 1.6 mrg GF_OMP_TASK_TASKLOOP = 1 << 0,
155 1.11 mrg GF_OMP_TASK_TASKWAIT = 1 << 1,
156 1.12 mrg GF_OMP_FOR_KIND_MASK = (1 << 3) - 1,
157 1.5 mrg GF_OMP_FOR_KIND_FOR = 0,
158 1.5 mrg GF_OMP_FOR_KIND_DISTRIBUTE = 1,
159 1.6 mrg GF_OMP_FOR_KIND_TASKLOOP = 2,
160 1.6 mrg GF_OMP_FOR_KIND_OACC_LOOP = 4,
161 1.12 mrg GF_OMP_FOR_KIND_GRID_LOOP = 5,
162 1.12 mrg GF_OMP_FOR_KIND_SIMD = 6,
163 1.12 mrg GF_OMP_FOR_COMBINED = 1 << 3,
164 1.12 mrg GF_OMP_FOR_COMBINED_INTO = 1 << 4,
165 1.8 mrg /* The following flag must not be used on GF_OMP_FOR_KIND_GRID_LOOP loop
166 1.8 mrg statements. */
167 1.12 mrg GF_OMP_FOR_GRID_PHONY = 1 << 5,
168 1.8 mrg /* The following two flags should only be set on GF_OMP_FOR_KIND_GRID_LOOP
169 1.8 mrg loop statements. */
170 1.12 mrg GF_OMP_FOR_GRID_INTRA_GROUP = 1 << 5,
171 1.12 mrg GF_OMP_FOR_GRID_GROUP_ITER = 1 << 6,
172 1.6 mrg GF_OMP_TARGET_KIND_MASK = (1 << 4) - 1,
173 1.5 mrg GF_OMP_TARGET_KIND_REGION = 0,
174 1.5 mrg GF_OMP_TARGET_KIND_DATA = 1,
175 1.5 mrg GF_OMP_TARGET_KIND_UPDATE = 2,
176 1.6 mrg GF_OMP_TARGET_KIND_ENTER_DATA = 3,
177 1.6 mrg GF_OMP_TARGET_KIND_EXIT_DATA = 4,
178 1.6 mrg GF_OMP_TARGET_KIND_OACC_PARALLEL = 5,
179 1.6 mrg GF_OMP_TARGET_KIND_OACC_KERNELS = 6,
180 1.12 mrg GF_OMP_TARGET_KIND_OACC_SERIAL = 7,
181 1.12 mrg GF_OMP_TARGET_KIND_OACC_DATA = 8,
182 1.12 mrg GF_OMP_TARGET_KIND_OACC_UPDATE = 9,
183 1.12 mrg GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 10,
184 1.12 mrg GF_OMP_TARGET_KIND_OACC_DECLARE = 11,
185 1.12 mrg GF_OMP_TARGET_KIND_OACC_HOST_DATA = 12,
186 1.6 mrg GF_OMP_TEAMS_GRID_PHONY = 1 << 0,
187 1.11 mrg GF_OMP_TEAMS_HOST = 1 << 1,
188 1.1 mrg
189 1.1 mrg /* True on an GIMPLE_OMP_RETURN statement if the return does not require
190 1.1 mrg a thread synchronization via some sort of barrier. The exact barrier
191 1.1 mrg that would otherwise be emitted is dependent on the OMP statement with
192 1.1 mrg which this return is associated. */
193 1.1 mrg GF_OMP_RETURN_NOWAIT = 1 << 0,
194 1.1 mrg
195 1.1 mrg GF_OMP_SECTION_LAST = 1 << 0,
196 1.11 mrg GF_OMP_ATOMIC_MEMORY_ORDER = (1 << 3) - 1,
197 1.11 mrg GF_OMP_ATOMIC_NEED_VALUE = 1 << 3,
198 1.1 mrg GF_PREDICT_TAKEN = 1 << 15
199 1.1 mrg };
200 1.1 mrg
201 1.10 mrg /* This subcode tells apart different kinds of stmts that are not used
202 1.10 mrg for codegen, but rather to retain debug information. */
203 1.1 mrg enum gimple_debug_subcode {
204 1.3 mrg GIMPLE_DEBUG_BIND = 0,
205 1.10 mrg GIMPLE_DEBUG_SOURCE_BIND = 1,
206 1.10 mrg GIMPLE_DEBUG_BEGIN_STMT = 2,
207 1.10 mrg GIMPLE_DEBUG_INLINE_ENTRY = 3
208 1.1 mrg };
209 1.1 mrg
210 1.1 mrg /* Masks for selecting a pass local flag (PLF) to work on. These
211 1.1 mrg masks are used by gimple_set_plf and gimple_plf. */
212 1.1 mrg enum plf_mask {
213 1.1 mrg GF_PLF_1 = 1 << 0,
214 1.1 mrg GF_PLF_2 = 1 << 1
215 1.1 mrg };
216 1.1 mrg
217 1.1 mrg /* Data structure definitions for GIMPLE tuples. NOTE: word markers
218 1.1 mrg are for 64 bit hosts. */
219 1.1 mrg
220 1.5 mrg struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
221 1.5 mrg chain_next ("%h.next"), variable_size))
222 1.6 mrg gimple
223 1.5 mrg {
224 1.1 mrg /* [ WORD 1 ]
225 1.1 mrg Main identifying code for a tuple. */
226 1.1 mrg ENUM_BITFIELD(gimple_code) code : 8;
227 1.1 mrg
228 1.1 mrg /* Nonzero if a warning should not be emitted on this tuple. */
229 1.1 mrg unsigned int no_warning : 1;
230 1.1 mrg
231 1.1 mrg /* Nonzero if this tuple has been visited. Passes are responsible
232 1.1 mrg for clearing this bit before using it. */
233 1.1 mrg unsigned int visited : 1;
234 1.1 mrg
235 1.1 mrg /* Nonzero if this tuple represents a non-temporal move. */
236 1.1 mrg unsigned int nontemporal_move : 1;
237 1.1 mrg
238 1.1 mrg /* Pass local flags. These flags are free for any pass to use as
239 1.1 mrg they see fit. Passes should not assume that these flags contain
240 1.1 mrg any useful value when the pass starts. Any initial state that
241 1.1 mrg the pass requires should be set on entry to the pass. See
242 1.1 mrg gimple_set_plf and gimple_plf for usage. */
243 1.1 mrg unsigned int plf : 2;
244 1.1 mrg
245 1.1 mrg /* Nonzero if this statement has been modified and needs to have its
246 1.1 mrg operands rescanned. */
247 1.1 mrg unsigned modified : 1;
248 1.1 mrg
249 1.1 mrg /* Nonzero if this statement contains volatile operands. */
250 1.1 mrg unsigned has_volatile_ops : 1;
251 1.1 mrg
252 1.1 mrg /* Padding to get subcode to 16 bit alignment. */
253 1.1 mrg unsigned pad : 1;
254 1.1 mrg
255 1.1 mrg /* The SUBCODE field can be used for tuple-specific flags for tuples
256 1.1 mrg that do not require subcodes. Note that SUBCODE should be at
257 1.1 mrg least as wide as tree codes, as several tuples store tree codes
258 1.1 mrg in there. */
259 1.1 mrg unsigned int subcode : 16;
260 1.1 mrg
261 1.1 mrg /* UID of this statement. This is used by passes that want to
262 1.1 mrg assign IDs to statements. It must be assigned and used by each
263 1.1 mrg pass. By default it should be assumed to contain garbage. */
264 1.1 mrg unsigned uid;
265 1.1 mrg
266 1.1 mrg /* [ WORD 2 ]
267 1.1 mrg Locus information for debug info. */
268 1.1 mrg location_t location;
269 1.1 mrg
270 1.1 mrg /* Number of operands in this tuple. */
271 1.1 mrg unsigned num_ops;
272 1.1 mrg
273 1.1 mrg /* [ WORD 3 ]
274 1.1 mrg Basic block holding this statement. */
275 1.3 mrg basic_block bb;
276 1.1 mrg
277 1.3 mrg /* [ WORD 4-5 ]
278 1.3 mrg Linked lists of gimple statements. The next pointers form
279 1.3 mrg a NULL terminated list, the prev pointers are a cyclic list.
280 1.3 mrg A gimple statement is hence also a double-ended list of
281 1.3 mrg statements, with the pointer itself being the first element,
282 1.3 mrg and the prev pointer being the last. */
283 1.6 mrg gimple *next;
284 1.6 mrg gimple *GTY((skip)) prev;
285 1.1 mrg };
286 1.1 mrg
287 1.1 mrg
288 1.1 mrg /* Base structure for tuples with operands. */
289 1.1 mrg
290 1.5 mrg /* This gimple subclass has no tag value. */
291 1.5 mrg struct GTY(())
292 1.6 mrg gimple_statement_with_ops_base : public gimple
293 1.1 mrg {
294 1.5 mrg /* [ WORD 1-6 ] : base class */
295 1.1 mrg
296 1.3 mrg /* [ WORD 7 ]
297 1.1 mrg SSA operand vectors. NOTE: It should be possible to
298 1.1 mrg amalgamate these vectors with the operand vector OP. However,
299 1.1 mrg the SSA operand vectors are organized differently and contain
300 1.1 mrg more information (like immediate use chaining). */
301 1.1 mrg struct use_optype_d GTY((skip (""))) *use_ops;
302 1.1 mrg };
303 1.1 mrg
304 1.1 mrg
305 1.1 mrg /* Statements that take register operands. */
306 1.1 mrg
307 1.5 mrg struct GTY((tag("GSS_WITH_OPS")))
308 1.5 mrg gimple_statement_with_ops : public gimple_statement_with_ops_base
309 1.1 mrg {
310 1.5 mrg /* [ WORD 1-7 ] : base class */
311 1.1 mrg
312 1.3 mrg /* [ WORD 8 ]
313 1.1 mrg Operand vector. NOTE! This must always be the last field
314 1.1 mrg of this structure. In particular, this means that this
315 1.1 mrg structure cannot be embedded inside another one. */
316 1.5 mrg tree GTY((length ("%h.num_ops"))) op[1];
317 1.1 mrg };
318 1.1 mrg
319 1.1 mrg
320 1.1 mrg /* Base for statements that take both memory and register operands. */
321 1.1 mrg
322 1.5 mrg struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
323 1.5 mrg gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
324 1.1 mrg {
325 1.5 mrg /* [ WORD 1-7 ] : base class */
326 1.1 mrg
327 1.3 mrg /* [ WORD 8-9 ]
328 1.1 mrg Virtual operands for this statement. The GC will pick them
329 1.1 mrg up via the ssa_names array. */
330 1.1 mrg tree GTY((skip (""))) vdef;
331 1.1 mrg tree GTY((skip (""))) vuse;
332 1.1 mrg };
333 1.1 mrg
334 1.1 mrg
335 1.1 mrg /* Statements that take both memory and register operands. */
336 1.1 mrg
337 1.5 mrg struct GTY((tag("GSS_WITH_MEM_OPS")))
338 1.5 mrg gimple_statement_with_memory_ops :
339 1.5 mrg public gimple_statement_with_memory_ops_base
340 1.1 mrg {
341 1.5 mrg /* [ WORD 1-9 ] : base class */
342 1.3 mrg
343 1.3 mrg /* [ WORD 10 ]
344 1.3 mrg Operand vector. NOTE! This must always be the last field
345 1.3 mrg of this structure. In particular, this means that this
346 1.3 mrg structure cannot be embedded inside another one. */
347 1.5 mrg tree GTY((length ("%h.num_ops"))) op[1];
348 1.3 mrg };
349 1.3 mrg
350 1.3 mrg
351 1.3 mrg /* Call statements that take both memory and register operands. */
352 1.3 mrg
353 1.5 mrg struct GTY((tag("GSS_CALL")))
354 1.5 mrg gcall : public gimple_statement_with_memory_ops_base
355 1.3 mrg {
356 1.5 mrg /* [ WORD 1-9 ] : base class */
357 1.1 mrg
358 1.3 mrg /* [ WORD 10-13 ] */
359 1.3 mrg struct pt_solution call_used;
360 1.3 mrg struct pt_solution call_clobbered;
361 1.3 mrg
362 1.3 mrg /* [ WORD 14 ] */
363 1.5 mrg union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
364 1.3 mrg tree GTY ((tag ("0"))) fntype;
365 1.3 mrg enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
366 1.3 mrg } u;
367 1.3 mrg
368 1.3 mrg /* [ WORD 15 ]
369 1.1 mrg Operand vector. NOTE! This must always be the last field
370 1.1 mrg of this structure. In particular, this means that this
371 1.1 mrg structure cannot be embedded inside another one. */
372 1.5 mrg tree GTY((length ("%h.num_ops"))) op[1];
373 1.6 mrg
374 1.6 mrg static const enum gimple_code code_ = GIMPLE_CALL;
375 1.1 mrg };
376 1.1 mrg
377 1.1 mrg
378 1.5 mrg /* OMP statements. */
379 1.1 mrg
380 1.5 mrg struct GTY((tag("GSS_OMP")))
381 1.6 mrg gimple_statement_omp : public gimple
382 1.5 mrg {
383 1.5 mrg /* [ WORD 1-6 ] : base class */
384 1.1 mrg
385 1.3 mrg /* [ WORD 7 ] */
386 1.1 mrg gimple_seq body;
387 1.1 mrg };
388 1.1 mrg
389 1.1 mrg
390 1.1 mrg /* GIMPLE_BIND */
391 1.1 mrg
392 1.5 mrg struct GTY((tag("GSS_BIND")))
393 1.6 mrg gbind : public gimple
394 1.5 mrg {
395 1.5 mrg /* [ WORD 1-6 ] : base class */
396 1.1 mrg
397 1.3 mrg /* [ WORD 7 ]
398 1.1 mrg Variables declared in this scope. */
399 1.1 mrg tree vars;
400 1.1 mrg
401 1.3 mrg /* [ WORD 8 ]
402 1.6 mrg This is different than the BLOCK field in gimple,
403 1.1 mrg which is analogous to TREE_BLOCK (i.e., the lexical block holding
404 1.1 mrg this statement). This field is the equivalent of BIND_EXPR_BLOCK
405 1.1 mrg in tree land (i.e., the lexical scope defined by this bind). See
406 1.1 mrg gimple-low.c. */
407 1.1 mrg tree block;
408 1.1 mrg
409 1.3 mrg /* [ WORD 9 ] */
410 1.1 mrg gimple_seq body;
411 1.1 mrg };
412 1.1 mrg
413 1.1 mrg
414 1.1 mrg /* GIMPLE_CATCH */
415 1.1 mrg
416 1.5 mrg struct GTY((tag("GSS_CATCH")))
417 1.6 mrg gcatch : public gimple
418 1.5 mrg {
419 1.5 mrg /* [ WORD 1-6 ] : base class */
420 1.1 mrg
421 1.3 mrg /* [ WORD 7 ] */
422 1.1 mrg tree types;
423 1.1 mrg
424 1.3 mrg /* [ WORD 8 ] */
425 1.1 mrg gimple_seq handler;
426 1.1 mrg };
427 1.1 mrg
428 1.1 mrg
429 1.1 mrg /* GIMPLE_EH_FILTER */
430 1.1 mrg
431 1.5 mrg struct GTY((tag("GSS_EH_FILTER")))
432 1.6 mrg geh_filter : public gimple
433 1.5 mrg {
434 1.5 mrg /* [ WORD 1-6 ] : base class */
435 1.1 mrg
436 1.3 mrg /* [ WORD 7 ]
437 1.1 mrg Filter types. */
438 1.1 mrg tree types;
439 1.1 mrg
440 1.3 mrg /* [ WORD 8 ]
441 1.1 mrg Failure actions. */
442 1.1 mrg gimple_seq failure;
443 1.1 mrg };
444 1.1 mrg
445 1.3 mrg /* GIMPLE_EH_ELSE */
446 1.3 mrg
447 1.5 mrg struct GTY((tag("GSS_EH_ELSE")))
448 1.6 mrg geh_else : public gimple
449 1.5 mrg {
450 1.5 mrg /* [ WORD 1-6 ] : base class */
451 1.3 mrg
452 1.3 mrg /* [ WORD 7,8 ] */
453 1.3 mrg gimple_seq n_body, e_body;
454 1.3 mrg };
455 1.1 mrg
456 1.1 mrg /* GIMPLE_EH_MUST_NOT_THROW */
457 1.1 mrg
458 1.5 mrg struct GTY((tag("GSS_EH_MNT")))
459 1.6 mrg geh_mnt : public gimple
460 1.5 mrg {
461 1.5 mrg /* [ WORD 1-6 ] : base class */
462 1.1 mrg
463 1.3 mrg /* [ WORD 7 ] Abort function decl. */
464 1.1 mrg tree fndecl;
465 1.1 mrg };
466 1.1 mrg
467 1.1 mrg /* GIMPLE_PHI */
468 1.1 mrg
469 1.5 mrg struct GTY((tag("GSS_PHI")))
470 1.6 mrg gphi : public gimple
471 1.5 mrg {
472 1.5 mrg /* [ WORD 1-6 ] : base class */
473 1.1 mrg
474 1.3 mrg /* [ WORD 7 ] */
475 1.1 mrg unsigned capacity;
476 1.1 mrg unsigned nargs;
477 1.1 mrg
478 1.3 mrg /* [ WORD 8 ] */
479 1.1 mrg tree result;
480 1.1 mrg
481 1.3 mrg /* [ WORD 9 ] */
482 1.1 mrg struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
483 1.1 mrg };
484 1.1 mrg
485 1.1 mrg
486 1.1 mrg /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
487 1.1 mrg
488 1.5 mrg struct GTY((tag("GSS_EH_CTRL")))
489 1.6 mrg gimple_statement_eh_ctrl : public gimple
490 1.1 mrg {
491 1.5 mrg /* [ WORD 1-6 ] : base class */
492 1.1 mrg
493 1.3 mrg /* [ WORD 7 ]
494 1.1 mrg Exception region number. */
495 1.1 mrg int region;
496 1.1 mrg };
497 1.1 mrg
498 1.5 mrg struct GTY((tag("GSS_EH_CTRL")))
499 1.5 mrg gresx : public gimple_statement_eh_ctrl
500 1.5 mrg {
501 1.5 mrg /* No extra fields; adds invariant:
502 1.5 mrg stmt->code == GIMPLE_RESX. */
503 1.5 mrg };
504 1.5 mrg
505 1.5 mrg struct GTY((tag("GSS_EH_CTRL")))
506 1.5 mrg geh_dispatch : public gimple_statement_eh_ctrl
507 1.5 mrg {
508 1.5 mrg /* No extra fields; adds invariant:
509 1.5 mrg stmt->code == GIMPLE_EH_DISPATH. */
510 1.5 mrg };
511 1.5 mrg
512 1.1 mrg
513 1.1 mrg /* GIMPLE_TRY */
514 1.1 mrg
515 1.5 mrg struct GTY((tag("GSS_TRY")))
516 1.6 mrg gtry : public gimple
517 1.5 mrg {
518 1.5 mrg /* [ WORD 1-6 ] : base class */
519 1.1 mrg
520 1.3 mrg /* [ WORD 7 ]
521 1.1 mrg Expression to evaluate. */
522 1.1 mrg gimple_seq eval;
523 1.1 mrg
524 1.3 mrg /* [ WORD 8 ]
525 1.1 mrg Cleanup expression. */
526 1.1 mrg gimple_seq cleanup;
527 1.1 mrg };
528 1.1 mrg
529 1.1 mrg /* Kind of GIMPLE_TRY statements. */
530 1.1 mrg enum gimple_try_flags
531 1.1 mrg {
532 1.1 mrg /* A try/catch. */
533 1.1 mrg GIMPLE_TRY_CATCH = 1 << 0,
534 1.1 mrg
535 1.1 mrg /* A try/finally. */
536 1.1 mrg GIMPLE_TRY_FINALLY = 1 << 1,
537 1.1 mrg GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
538 1.1 mrg
539 1.1 mrg /* Analogous to TRY_CATCH_IS_CLEANUP. */
540 1.1 mrg GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
541 1.1 mrg };
542 1.1 mrg
543 1.1 mrg /* GIMPLE_WITH_CLEANUP_EXPR */
544 1.1 mrg
545 1.5 mrg struct GTY((tag("GSS_WCE")))
546 1.6 mrg gimple_statement_wce : public gimple
547 1.5 mrg {
548 1.5 mrg /* [ WORD 1-6 ] : base class */
549 1.1 mrg
550 1.1 mrg /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
551 1.1 mrg executed if an exception is thrown, not on normal exit of its
552 1.1 mrg scope. This flag is analogous to the CLEANUP_EH_ONLY flag
553 1.1 mrg in TARGET_EXPRs. */
554 1.1 mrg
555 1.3 mrg /* [ WORD 7 ]
556 1.1 mrg Cleanup expression. */
557 1.1 mrg gimple_seq cleanup;
558 1.1 mrg };
559 1.1 mrg
560 1.1 mrg
561 1.1 mrg /* GIMPLE_ASM */
562 1.1 mrg
563 1.5 mrg struct GTY((tag("GSS_ASM")))
564 1.5 mrg gasm : public gimple_statement_with_memory_ops_base
565 1.1 mrg {
566 1.5 mrg /* [ WORD 1-9 ] : base class */
567 1.1 mrg
568 1.3 mrg /* [ WORD 10 ]
569 1.1 mrg __asm__ statement. */
570 1.1 mrg const char *string;
571 1.1 mrg
572 1.3 mrg /* [ WORD 11 ]
573 1.1 mrg Number of inputs, outputs, clobbers, labels. */
574 1.1 mrg unsigned char ni;
575 1.1 mrg unsigned char no;
576 1.1 mrg unsigned char nc;
577 1.1 mrg unsigned char nl;
578 1.1 mrg
579 1.3 mrg /* [ WORD 12 ]
580 1.1 mrg Operand vector. NOTE! This must always be the last field
581 1.1 mrg of this structure. In particular, this means that this
582 1.1 mrg structure cannot be embedded inside another one. */
583 1.5 mrg tree GTY((length ("%h.num_ops"))) op[1];
584 1.1 mrg };
585 1.1 mrg
586 1.1 mrg /* GIMPLE_OMP_CRITICAL */
587 1.1 mrg
588 1.5 mrg struct GTY((tag("GSS_OMP_CRITICAL")))
589 1.5 mrg gomp_critical : public gimple_statement_omp
590 1.5 mrg {
591 1.5 mrg /* [ WORD 1-7 ] : base class */
592 1.1 mrg
593 1.6 mrg /* [ WORD 8 ] */
594 1.6 mrg tree clauses;
595 1.6 mrg
596 1.6 mrg /* [ WORD 9 ]
597 1.1 mrg Critical section name. */
598 1.1 mrg tree name;
599 1.1 mrg };
600 1.1 mrg
601 1.1 mrg
602 1.1 mrg struct GTY(()) gimple_omp_for_iter {
603 1.1 mrg /* Condition code. */
604 1.1 mrg enum tree_code cond;
605 1.1 mrg
606 1.1 mrg /* Index variable. */
607 1.1 mrg tree index;
608 1.1 mrg
609 1.1 mrg /* Initial value. */
610 1.1 mrg tree initial;
611 1.1 mrg
612 1.1 mrg /* Final value. */
613 1.1 mrg tree final;
614 1.1 mrg
615 1.1 mrg /* Increment. */
616 1.1 mrg tree incr;
617 1.1 mrg };
618 1.1 mrg
619 1.1 mrg /* GIMPLE_OMP_FOR */
620 1.1 mrg
621 1.5 mrg struct GTY((tag("GSS_OMP_FOR")))
622 1.5 mrg gomp_for : public gimple_statement_omp
623 1.5 mrg {
624 1.5 mrg /* [ WORD 1-7 ] : base class */
625 1.1 mrg
626 1.3 mrg /* [ WORD 8 ] */
627 1.1 mrg tree clauses;
628 1.1 mrg
629 1.3 mrg /* [ WORD 9 ]
630 1.1 mrg Number of elements in iter array. */
631 1.1 mrg size_t collapse;
632 1.1 mrg
633 1.3 mrg /* [ WORD 10 ] */
634 1.1 mrg struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
635 1.1 mrg
636 1.3 mrg /* [ WORD 11 ]
637 1.1 mrg Pre-body evaluated before the loop body begins. */
638 1.1 mrg gimple_seq pre_body;
639 1.1 mrg };
640 1.1 mrg
641 1.1 mrg
642 1.11 mrg /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK, GIMPLE_OMP_TEAMS */
643 1.1 mrg
644 1.5 mrg struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
645 1.5 mrg gimple_statement_omp_parallel_layout : public gimple_statement_omp
646 1.5 mrg {
647 1.5 mrg /* [ WORD 1-7 ] : base class */
648 1.1 mrg
649 1.3 mrg /* [ WORD 8 ]
650 1.1 mrg Clauses. */
651 1.1 mrg tree clauses;
652 1.1 mrg
653 1.3 mrg /* [ WORD 9 ]
654 1.1 mrg Child function holding the body of the parallel region. */
655 1.1 mrg tree child_fn;
656 1.1 mrg
657 1.3 mrg /* [ WORD 10 ]
658 1.1 mrg Shared data argument. */
659 1.1 mrg tree data_arg;
660 1.1 mrg };
661 1.1 mrg
662 1.5 mrg /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
663 1.5 mrg struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
664 1.5 mrg gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
665 1.5 mrg {
666 1.5 mrg /* No extra fields; adds invariant:
667 1.5 mrg stmt->code == GIMPLE_OMP_PARALLEL
668 1.11 mrg || stmt->code == GIMPLE_OMP_TASK
669 1.11 mrg || stmt->code == GIMPLE_OMP_TEAMS. */
670 1.5 mrg };
671 1.5 mrg
672 1.5 mrg /* GIMPLE_OMP_PARALLEL */
673 1.5 mrg struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
674 1.5 mrg gomp_parallel : public gimple_statement_omp_taskreg
675 1.5 mrg {
676 1.5 mrg /* No extra fields; adds invariant:
677 1.5 mrg stmt->code == GIMPLE_OMP_PARALLEL. */
678 1.5 mrg };
679 1.5 mrg
680 1.5 mrg /* GIMPLE_OMP_TARGET */
681 1.5 mrg struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
682 1.5 mrg gomp_target : public gimple_statement_omp_parallel_layout
683 1.5 mrg {
684 1.5 mrg /* No extra fields; adds invariant:
685 1.5 mrg stmt->code == GIMPLE_OMP_TARGET. */
686 1.5 mrg };
687 1.1 mrg
688 1.1 mrg /* GIMPLE_OMP_TASK */
689 1.1 mrg
690 1.5 mrg struct GTY((tag("GSS_OMP_TASK")))
691 1.5 mrg gomp_task : public gimple_statement_omp_taskreg
692 1.5 mrg {
693 1.5 mrg /* [ WORD 1-10 ] : base class */
694 1.1 mrg
695 1.3 mrg /* [ WORD 11 ]
696 1.1 mrg Child function holding firstprivate initialization if needed. */
697 1.1 mrg tree copy_fn;
698 1.1 mrg
699 1.3 mrg /* [ WORD 12-13 ]
700 1.1 mrg Size and alignment in bytes of the argument data block. */
701 1.1 mrg tree arg_size;
702 1.1 mrg tree arg_align;
703 1.1 mrg };
704 1.1 mrg
705 1.1 mrg
706 1.1 mrg /* GIMPLE_OMP_SECTION */
707 1.1 mrg /* Uses struct gimple_statement_omp. */
708 1.1 mrg
709 1.1 mrg
710 1.1 mrg /* GIMPLE_OMP_SECTIONS */
711 1.1 mrg
712 1.5 mrg struct GTY((tag("GSS_OMP_SECTIONS")))
713 1.5 mrg gomp_sections : public gimple_statement_omp
714 1.5 mrg {
715 1.5 mrg /* [ WORD 1-7 ] : base class */
716 1.1 mrg
717 1.3 mrg /* [ WORD 8 ] */
718 1.1 mrg tree clauses;
719 1.1 mrg
720 1.3 mrg /* [ WORD 9 ]
721 1.1 mrg The control variable used for deciding which of the sections to
722 1.1 mrg execute. */
723 1.1 mrg tree control;
724 1.1 mrg };
725 1.1 mrg
726 1.1 mrg /* GIMPLE_OMP_CONTINUE.
727 1.1 mrg
728 1.1 mrg Note: This does not inherit from gimple_statement_omp, because we
729 1.1 mrg do not need the body field. */
730 1.1 mrg
731 1.5 mrg struct GTY((tag("GSS_OMP_CONTINUE")))
732 1.6 mrg gomp_continue : public gimple
733 1.5 mrg {
734 1.5 mrg /* [ WORD 1-6 ] : base class */
735 1.1 mrg
736 1.3 mrg /* [ WORD 7 ] */
737 1.1 mrg tree control_def;
738 1.1 mrg
739 1.3 mrg /* [ WORD 8 ] */
740 1.1 mrg tree control_use;
741 1.1 mrg };
742 1.1 mrg
743 1.12 mrg /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_ORDERED, GIMPLE_OMP_TASKGROUP,
744 1.12 mrg GIMPLE_OMP_SCAN. */
745 1.1 mrg
746 1.5 mrg struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
747 1.5 mrg gimple_statement_omp_single_layout : public gimple_statement_omp
748 1.5 mrg {
749 1.5 mrg /* [ WORD 1-7 ] : base class */
750 1.1 mrg
751 1.6 mrg /* [ WORD 8 ] */
752 1.1 mrg tree clauses;
753 1.1 mrg };
754 1.1 mrg
755 1.5 mrg struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
756 1.5 mrg gomp_single : public gimple_statement_omp_single_layout
757 1.5 mrg {
758 1.5 mrg /* No extra fields; adds invariant:
759 1.5 mrg stmt->code == GIMPLE_OMP_SINGLE. */
760 1.5 mrg };
761 1.5 mrg
762 1.11 mrg struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
763 1.11 mrg gomp_teams : public gimple_statement_omp_taskreg
764 1.5 mrg {
765 1.5 mrg /* No extra fields; adds invariant:
766 1.5 mrg stmt->code == GIMPLE_OMP_TEAMS. */
767 1.5 mrg };
768 1.5 mrg
769 1.6 mrg struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
770 1.6 mrg gomp_ordered : public gimple_statement_omp_single_layout
771 1.6 mrg {
772 1.6 mrg /* No extra fields; adds invariant:
773 1.6 mrg stmt->code == GIMPLE_OMP_ORDERED. */
774 1.6 mrg };
775 1.6 mrg
776 1.12 mrg struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
777 1.12 mrg gomp_scan : public gimple_statement_omp_single_layout
778 1.12 mrg {
779 1.12 mrg /* No extra fields; adds invariant:
780 1.12 mrg stmt->code == GIMPLE_OMP_SCAN. */
781 1.12 mrg };
782 1.12 mrg
783 1.1 mrg
784 1.1 mrg /* GIMPLE_OMP_ATOMIC_LOAD.
785 1.6 mrg Note: This is based on gimple, not g_s_omp, because g_s_omp
786 1.1 mrg contains a sequence, which we don't need here. */
787 1.1 mrg
788 1.5 mrg struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
789 1.6 mrg gomp_atomic_load : public gimple
790 1.5 mrg {
791 1.5 mrg /* [ WORD 1-6 ] : base class */
792 1.1 mrg
793 1.3 mrg /* [ WORD 7-8 ] */
794 1.1 mrg tree rhs, lhs;
795 1.1 mrg };
796 1.1 mrg
797 1.1 mrg /* GIMPLE_OMP_ATOMIC_STORE.
798 1.1 mrg See note on GIMPLE_OMP_ATOMIC_LOAD. */
799 1.1 mrg
800 1.5 mrg struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
801 1.6 mrg gimple_statement_omp_atomic_store_layout : public gimple
802 1.5 mrg {
803 1.5 mrg /* [ WORD 1-6 ] : base class */
804 1.1 mrg
805 1.3 mrg /* [ WORD 7 ] */
806 1.1 mrg tree val;
807 1.1 mrg };
808 1.1 mrg
809 1.5 mrg struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
810 1.5 mrg gomp_atomic_store :
811 1.5 mrg public gimple_statement_omp_atomic_store_layout
812 1.5 mrg {
813 1.5 mrg /* No extra fields; adds invariant:
814 1.5 mrg stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
815 1.5 mrg };
816 1.5 mrg
817 1.5 mrg struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
818 1.5 mrg gimple_statement_omp_return :
819 1.5 mrg public gimple_statement_omp_atomic_store_layout
820 1.5 mrg {
821 1.5 mrg /* No extra fields; adds invariant:
822 1.5 mrg stmt->code == GIMPLE_OMP_RETURN. */
823 1.5 mrg };
824 1.5 mrg
825 1.3 mrg /* GIMPLE_TRANSACTION. */
826 1.3 mrg
827 1.3 mrg /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
828 1.3 mrg
829 1.3 mrg /* The __transaction_atomic was declared [[outer]] or it is
830 1.3 mrg __transaction_relaxed. */
831 1.3 mrg #define GTMA_IS_OUTER (1u << 0)
832 1.3 mrg #define GTMA_IS_RELAXED (1u << 1)
833 1.3 mrg #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
834 1.3 mrg
835 1.3 mrg /* The transaction is seen to not have an abort. */
836 1.3 mrg #define GTMA_HAVE_ABORT (1u << 2)
837 1.3 mrg /* The transaction is seen to have loads or stores. */
838 1.3 mrg #define GTMA_HAVE_LOAD (1u << 3)
839 1.3 mrg #define GTMA_HAVE_STORE (1u << 4)
840 1.3 mrg /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
841 1.3 mrg #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
842 1.3 mrg /* The transaction WILL enter serial irrevocable mode.
843 1.3 mrg An irrevocable block post-dominates the entire transaction, such
844 1.3 mrg that all invocations of the transaction will go serial-irrevocable.
845 1.3 mrg In such case, we don't bother instrumenting the transaction, and
846 1.3 mrg tell the runtime that it should begin the transaction in
847 1.3 mrg serial-irrevocable mode. */
848 1.3 mrg #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
849 1.3 mrg /* The transaction contains no instrumentation code whatsover, most
850 1.3 mrg likely because it is guaranteed to go irrevocable upon entry. */
851 1.3 mrg #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
852 1.3 mrg
853 1.5 mrg struct GTY((tag("GSS_TRANSACTION")))
854 1.5 mrg gtransaction : public gimple_statement_with_memory_ops_base
855 1.3 mrg {
856 1.5 mrg /* [ WORD 1-9 ] : base class */
857 1.3 mrg
858 1.3 mrg /* [ WORD 10 ] */
859 1.3 mrg gimple_seq body;
860 1.3 mrg
861 1.6 mrg /* [ WORD 11-13 ] */
862 1.6 mrg tree label_norm;
863 1.6 mrg tree label_uninst;
864 1.6 mrg tree label_over;
865 1.3 mrg };
866 1.3 mrg
867 1.1 mrg #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
868 1.1 mrg enum gimple_statement_structure_enum {
869 1.1 mrg #include "gsstruct.def"
870 1.1 mrg LAST_GSS_ENUM
871 1.1 mrg };
872 1.1 mrg #undef DEFGSSTRUCT
873 1.1 mrg
874 1.5 mrg /* A statement with the invariant that
875 1.5 mrg stmt->code == GIMPLE_COND
876 1.5 mrg i.e. a conditional jump statement. */
877 1.5 mrg
878 1.5 mrg struct GTY((tag("GSS_WITH_OPS")))
879 1.5 mrg gcond : public gimple_statement_with_ops
880 1.5 mrg {
881 1.5 mrg /* no additional fields; this uses the layout for GSS_WITH_OPS. */
882 1.6 mrg static const enum gimple_code code_ = GIMPLE_COND;
883 1.5 mrg };
884 1.5 mrg
885 1.5 mrg /* A statement with the invariant that
886 1.5 mrg stmt->code == GIMPLE_DEBUG
887 1.5 mrg i.e. a debug statement. */
888 1.5 mrg
889 1.5 mrg struct GTY((tag("GSS_WITH_OPS")))
890 1.5 mrg gdebug : public gimple_statement_with_ops
891 1.5 mrg {
892 1.5 mrg /* no additional fields; this uses the layout for GSS_WITH_OPS. */
893 1.5 mrg };
894 1.1 mrg
895 1.5 mrg /* A statement with the invariant that
896 1.5 mrg stmt->code == GIMPLE_GOTO
897 1.5 mrg i.e. a goto statement. */
898 1.1 mrg
899 1.5 mrg struct GTY((tag("GSS_WITH_OPS")))
900 1.5 mrg ggoto : public gimple_statement_with_ops
901 1.5 mrg {
902 1.5 mrg /* no additional fields; this uses the layout for GSS_WITH_OPS. */
903 1.1 mrg };
904 1.1 mrg
905 1.5 mrg /* A statement with the invariant that
906 1.5 mrg stmt->code == GIMPLE_LABEL
907 1.5 mrg i.e. a label statement. */
908 1.5 mrg
909 1.5 mrg struct GTY((tag("GSS_WITH_OPS")))
910 1.5 mrg glabel : public gimple_statement_with_ops
911 1.5 mrg {
912 1.5 mrg /* no additional fields; this uses the layout for GSS_WITH_OPS. */
913 1.5 mrg };
914 1.1 mrg
915 1.5 mrg /* A statement with the invariant that
916 1.5 mrg stmt->code == GIMPLE_SWITCH
917 1.5 mrg i.e. a switch statement. */
918 1.1 mrg
919 1.5 mrg struct GTY((tag("GSS_WITH_OPS")))
920 1.5 mrg gswitch : public gimple_statement_with_ops
921 1.5 mrg {
922 1.5 mrg /* no additional fields; this uses the layout for GSS_WITH_OPS. */
923 1.5 mrg };
924 1.1 mrg
925 1.5 mrg /* A statement with the invariant that
926 1.5 mrg stmt->code == GIMPLE_ASSIGN
927 1.5 mrg i.e. an assignment statement. */
928 1.1 mrg
929 1.5 mrg struct GTY((tag("GSS_WITH_MEM_OPS")))
930 1.5 mrg gassign : public gimple_statement_with_memory_ops
931 1.5 mrg {
932 1.6 mrg static const enum gimple_code code_ = GIMPLE_ASSIGN;
933 1.5 mrg /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
934 1.5 mrg };
935 1.1 mrg
936 1.5 mrg /* A statement with the invariant that
937 1.5 mrg stmt->code == GIMPLE_RETURN
938 1.5 mrg i.e. a return statement. */
939 1.1 mrg
940 1.5 mrg struct GTY((tag("GSS_WITH_MEM_OPS")))
941 1.5 mrg greturn : public gimple_statement_with_memory_ops
942 1.5 mrg {
943 1.5 mrg /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
944 1.5 mrg };
945 1.1 mrg
946 1.5 mrg template <>
947 1.5 mrg template <>
948 1.5 mrg inline bool
949 1.6 mrg is_a_helper <gasm *>::test (gimple *gs)
950 1.5 mrg {
951 1.5 mrg return gs->code == GIMPLE_ASM;
952 1.5 mrg }
953 1.1 mrg
954 1.5 mrg template <>
955 1.5 mrg template <>
956 1.5 mrg inline bool
957 1.6 mrg is_a_helper <gassign *>::test (gimple *gs)
958 1.5 mrg {
959 1.5 mrg return gs->code == GIMPLE_ASSIGN;
960 1.5 mrg }
961 1.1 mrg
962 1.5 mrg template <>
963 1.5 mrg template <>
964 1.5 mrg inline bool
965 1.6 mrg is_a_helper <const gassign *>::test (const gimple *gs)
966 1.6 mrg {
967 1.6 mrg return gs->code == GIMPLE_ASSIGN;
968 1.6 mrg }
969 1.6 mrg
970 1.6 mrg template <>
971 1.6 mrg template <>
972 1.6 mrg inline bool
973 1.6 mrg is_a_helper <gbind *>::test (gimple *gs)
974 1.5 mrg {
975 1.5 mrg return gs->code == GIMPLE_BIND;
976 1.5 mrg }
977 1.1 mrg
978 1.5 mrg template <>
979 1.5 mrg template <>
980 1.5 mrg inline bool
981 1.6 mrg is_a_helper <gcall *>::test (gimple *gs)
982 1.5 mrg {
983 1.5 mrg return gs->code == GIMPLE_CALL;
984 1.5 mrg }
985 1.3 mrg
986 1.5 mrg template <>
987 1.5 mrg template <>
988 1.5 mrg inline bool
989 1.6 mrg is_a_helper <gcatch *>::test (gimple *gs)
990 1.5 mrg {
991 1.5 mrg return gs->code == GIMPLE_CATCH;
992 1.5 mrg }
993 1.1 mrg
994 1.5 mrg template <>
995 1.5 mrg template <>
996 1.5 mrg inline bool
997 1.6 mrg is_a_helper <gcond *>::test (gimple *gs)
998 1.6 mrg {
999 1.6 mrg return gs->code == GIMPLE_COND;
1000 1.6 mrg }
1001 1.6 mrg
1002 1.6 mrg template <>
1003 1.6 mrg template <>
1004 1.6 mrg inline bool
1005 1.6 mrg is_a_helper <const gcond *>::test (const gimple *gs)
1006 1.5 mrg {
1007 1.5 mrg return gs->code == GIMPLE_COND;
1008 1.5 mrg }
1009 1.1 mrg
1010 1.5 mrg template <>
1011 1.5 mrg template <>
1012 1.5 mrg inline bool
1013 1.6 mrg is_a_helper <gdebug *>::test (gimple *gs)
1014 1.5 mrg {
1015 1.5 mrg return gs->code == GIMPLE_DEBUG;
1016 1.5 mrg }
1017 1.1 mrg
1018 1.5 mrg template <>
1019 1.5 mrg template <>
1020 1.5 mrg inline bool
1021 1.12 mrg is_a_helper <const gdebug *>::test (const gimple *gs)
1022 1.12 mrg {
1023 1.12 mrg return gs->code == GIMPLE_DEBUG;
1024 1.12 mrg }
1025 1.12 mrg
1026 1.12 mrg template <>
1027 1.12 mrg template <>
1028 1.12 mrg inline bool
1029 1.6 mrg is_a_helper <ggoto *>::test (gimple *gs)
1030 1.5 mrg {
1031 1.5 mrg return gs->code == GIMPLE_GOTO;
1032 1.5 mrg }
1033 1.1 mrg
1034 1.5 mrg template <>
1035 1.5 mrg template <>
1036 1.5 mrg inline bool
1037 1.12 mrg is_a_helper <const ggoto *>::test (const gimple *gs)
1038 1.12 mrg {
1039 1.12 mrg return gs->code == GIMPLE_GOTO;
1040 1.12 mrg }
1041 1.12 mrg
1042 1.12 mrg template <>
1043 1.12 mrg template <>
1044 1.12 mrg inline bool
1045 1.6 mrg is_a_helper <glabel *>::test (gimple *gs)
1046 1.5 mrg {
1047 1.5 mrg return gs->code == GIMPLE_LABEL;
1048 1.5 mrg }
1049 1.1 mrg
1050 1.5 mrg template <>
1051 1.5 mrg template <>
1052 1.5 mrg inline bool
1053 1.12 mrg is_a_helper <const glabel *>::test (const gimple *gs)
1054 1.12 mrg {
1055 1.12 mrg return gs->code == GIMPLE_LABEL;
1056 1.12 mrg }
1057 1.12 mrg
1058 1.12 mrg template <>
1059 1.12 mrg template <>
1060 1.12 mrg inline bool
1061 1.6 mrg is_a_helper <gresx *>::test (gimple *gs)
1062 1.5 mrg {
1063 1.5 mrg return gs->code == GIMPLE_RESX;
1064 1.5 mrg }
1065 1.3 mrg
1066 1.5 mrg template <>
1067 1.5 mrg template <>
1068 1.5 mrg inline bool
1069 1.6 mrg is_a_helper <geh_dispatch *>::test (gimple *gs)
1070 1.3 mrg {
1071 1.5 mrg return gs->code == GIMPLE_EH_DISPATCH;
1072 1.3 mrg }
1073 1.3 mrg
1074 1.5 mrg template <>
1075 1.5 mrg template <>
1076 1.5 mrg inline bool
1077 1.6 mrg is_a_helper <geh_else *>::test (gimple *gs)
1078 1.5 mrg {
1079 1.5 mrg return gs->code == GIMPLE_EH_ELSE;
1080 1.5 mrg }
1081 1.3 mrg
1082 1.5 mrg template <>
1083 1.5 mrg template <>
1084 1.5 mrg inline bool
1085 1.12 mrg is_a_helper <const geh_else *>::test (const gimple *gs)
1086 1.12 mrg {
1087 1.12 mrg return gs->code == GIMPLE_EH_ELSE;
1088 1.12 mrg }
1089 1.12 mrg
1090 1.12 mrg template <>
1091 1.12 mrg template <>
1092 1.12 mrg inline bool
1093 1.6 mrg is_a_helper <geh_filter *>::test (gimple *gs)
1094 1.5 mrg {
1095 1.5 mrg return gs->code == GIMPLE_EH_FILTER;
1096 1.5 mrg }
1097 1.3 mrg
1098 1.5 mrg template <>
1099 1.5 mrg template <>
1100 1.5 mrg inline bool
1101 1.6 mrg is_a_helper <geh_mnt *>::test (gimple *gs)
1102 1.3 mrg {
1103 1.5 mrg return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1104 1.3 mrg }
1105 1.3 mrg
1106 1.5 mrg template <>
1107 1.5 mrg template <>
1108 1.5 mrg inline bool
1109 1.12 mrg is_a_helper <const geh_mnt *>::test (const gimple *gs)
1110 1.12 mrg {
1111 1.12 mrg return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1112 1.12 mrg }
1113 1.12 mrg
1114 1.12 mrg template <>
1115 1.12 mrg template <>
1116 1.12 mrg inline bool
1117 1.6 mrg is_a_helper <gomp_atomic_load *>::test (gimple *gs)
1118 1.5 mrg {
1119 1.5 mrg return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1120 1.5 mrg }
1121 1.3 mrg
1122 1.5 mrg template <>
1123 1.5 mrg template <>
1124 1.5 mrg inline bool
1125 1.6 mrg is_a_helper <gomp_atomic_store *>::test (gimple *gs)
1126 1.5 mrg {
1127 1.5 mrg return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1128 1.5 mrg }
1129 1.3 mrg
1130 1.5 mrg template <>
1131 1.5 mrg template <>
1132 1.5 mrg inline bool
1133 1.6 mrg is_a_helper <gimple_statement_omp_return *>::test (gimple *gs)
1134 1.3 mrg {
1135 1.5 mrg return gs->code == GIMPLE_OMP_RETURN;
1136 1.3 mrg }
1137 1.3 mrg
1138 1.5 mrg template <>
1139 1.5 mrg template <>
1140 1.5 mrg inline bool
1141 1.6 mrg is_a_helper <gomp_continue *>::test (gimple *gs)
1142 1.5 mrg {
1143 1.5 mrg return gs->code == GIMPLE_OMP_CONTINUE;
1144 1.5 mrg }
1145 1.3 mrg
1146 1.5 mrg template <>
1147 1.5 mrg template <>
1148 1.5 mrg inline bool
1149 1.6 mrg is_a_helper <gomp_critical *>::test (gimple *gs)
1150 1.5 mrg {
1151 1.5 mrg return gs->code == GIMPLE_OMP_CRITICAL;
1152 1.5 mrg }
1153 1.3 mrg
1154 1.5 mrg template <>
1155 1.5 mrg template <>
1156 1.5 mrg inline bool
1157 1.6 mrg is_a_helper <gomp_ordered *>::test (gimple *gs)
1158 1.6 mrg {
1159 1.6 mrg return gs->code == GIMPLE_OMP_ORDERED;
1160 1.6 mrg }
1161 1.6 mrg
1162 1.6 mrg template <>
1163 1.6 mrg template <>
1164 1.6 mrg inline bool
1165 1.12 mrg is_a_helper <gomp_scan *>::test (gimple *gs)
1166 1.12 mrg {
1167 1.12 mrg return gs->code == GIMPLE_OMP_SCAN;
1168 1.12 mrg }
1169 1.12 mrg
1170 1.12 mrg template <>
1171 1.12 mrg template <>
1172 1.12 mrg inline bool
1173 1.6 mrg is_a_helper <gomp_for *>::test (gimple *gs)
1174 1.3 mrg {
1175 1.5 mrg return gs->code == GIMPLE_OMP_FOR;
1176 1.3 mrg }
1177 1.3 mrg
1178 1.5 mrg template <>
1179 1.5 mrg template <>
1180 1.5 mrg inline bool
1181 1.6 mrg is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
1182 1.5 mrg {
1183 1.11 mrg return (gs->code == GIMPLE_OMP_PARALLEL
1184 1.11 mrg || gs->code == GIMPLE_OMP_TASK
1185 1.11 mrg || gs->code == GIMPLE_OMP_TEAMS);
1186 1.5 mrg }
1187 1.3 mrg
1188 1.5 mrg template <>
1189 1.5 mrg template <>
1190 1.5 mrg inline bool
1191 1.6 mrg is_a_helper <gomp_parallel *>::test (gimple *gs)
1192 1.5 mrg {
1193 1.5 mrg return gs->code == GIMPLE_OMP_PARALLEL;
1194 1.5 mrg }
1195 1.3 mrg
1196 1.5 mrg template <>
1197 1.5 mrg template <>
1198 1.5 mrg inline bool
1199 1.6 mrg is_a_helper <gomp_target *>::test (gimple *gs)
1200 1.3 mrg {
1201 1.5 mrg return gs->code == GIMPLE_OMP_TARGET;
1202 1.3 mrg }
1203 1.3 mrg
1204 1.5 mrg template <>
1205 1.5 mrg template <>
1206 1.5 mrg inline bool
1207 1.6 mrg is_a_helper <gomp_sections *>::test (gimple *gs)
1208 1.5 mrg {
1209 1.5 mrg return gs->code == GIMPLE_OMP_SECTIONS;
1210 1.5 mrg }
1211 1.3 mrg
1212 1.5 mrg template <>
1213 1.5 mrg template <>
1214 1.5 mrg inline bool
1215 1.6 mrg is_a_helper <gomp_single *>::test (gimple *gs)
1216 1.5 mrg {
1217 1.5 mrg return gs->code == GIMPLE_OMP_SINGLE;
1218 1.5 mrg }
1219 1.3 mrg
1220 1.5 mrg template <>
1221 1.5 mrg template <>
1222 1.5 mrg inline bool
1223 1.6 mrg is_a_helper <gomp_teams *>::test (gimple *gs)
1224 1.3 mrg {
1225 1.5 mrg return gs->code == GIMPLE_OMP_TEAMS;
1226 1.3 mrg }
1227 1.3 mrg
1228 1.5 mrg template <>
1229 1.5 mrg template <>
1230 1.5 mrg inline bool
1231 1.6 mrg is_a_helper <gomp_task *>::test (gimple *gs)
1232 1.5 mrg {
1233 1.5 mrg return gs->code == GIMPLE_OMP_TASK;
1234 1.5 mrg }
1235 1.3 mrg
1236 1.5 mrg template <>
1237 1.5 mrg template <>
1238 1.5 mrg inline bool
1239 1.6 mrg is_a_helper <gphi *>::test (gimple *gs)
1240 1.5 mrg {
1241 1.5 mrg return gs->code == GIMPLE_PHI;
1242 1.5 mrg }
1243 1.3 mrg
1244 1.5 mrg template <>
1245 1.5 mrg template <>
1246 1.5 mrg inline bool
1247 1.6 mrg is_a_helper <greturn *>::test (gimple *gs)
1248 1.3 mrg {
1249 1.5 mrg return gs->code == GIMPLE_RETURN;
1250 1.3 mrg }
1251 1.3 mrg
1252 1.5 mrg template <>
1253 1.5 mrg template <>
1254 1.5 mrg inline bool
1255 1.6 mrg is_a_helper <gswitch *>::test (gimple *gs)
1256 1.5 mrg {
1257 1.5 mrg return gs->code == GIMPLE_SWITCH;
1258 1.5 mrg }
1259 1.3 mrg
1260 1.5 mrg template <>
1261 1.5 mrg template <>
1262 1.5 mrg inline bool
1263 1.12 mrg is_a_helper <const gswitch *>::test (const gimple *gs)
1264 1.12 mrg {
1265 1.12 mrg return gs->code == GIMPLE_SWITCH;
1266 1.12 mrg }
1267 1.12 mrg
1268 1.12 mrg template <>
1269 1.12 mrg template <>
1270 1.12 mrg inline bool
1271 1.6 mrg is_a_helper <gtransaction *>::test (gimple *gs)
1272 1.5 mrg {
1273 1.5 mrg return gs->code == GIMPLE_TRANSACTION;
1274 1.5 mrg }
1275 1.3 mrg
1276 1.5 mrg template <>
1277 1.5 mrg template <>
1278 1.5 mrg inline bool
1279 1.6 mrg is_a_helper <gtry *>::test (gimple *gs)
1280 1.5 mrg {
1281 1.5 mrg return gs->code == GIMPLE_TRY;
1282 1.5 mrg }
1283 1.3 mrg
1284 1.5 mrg template <>
1285 1.5 mrg template <>
1286 1.5 mrg inline bool
1287 1.12 mrg is_a_helper <const gtry *>::test (const gimple *gs)
1288 1.12 mrg {
1289 1.12 mrg return gs->code == GIMPLE_TRY;
1290 1.12 mrg }
1291 1.12 mrg
1292 1.12 mrg template <>
1293 1.12 mrg template <>
1294 1.12 mrg inline bool
1295 1.6 mrg is_a_helper <gimple_statement_wce *>::test (gimple *gs)
1296 1.5 mrg {
1297 1.5 mrg return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1298 1.5 mrg }
1299 1.3 mrg
1300 1.5 mrg template <>
1301 1.5 mrg template <>
1302 1.5 mrg inline bool
1303 1.6 mrg is_a_helper <const gasm *>::test (const gimple *gs)
1304 1.3 mrg {
1305 1.5 mrg return gs->code == GIMPLE_ASM;
1306 1.3 mrg }
1307 1.3 mrg
1308 1.5 mrg template <>
1309 1.5 mrg template <>
1310 1.5 mrg inline bool
1311 1.6 mrg is_a_helper <const gbind *>::test (const gimple *gs)
1312 1.5 mrg {
1313 1.5 mrg return gs->code == GIMPLE_BIND;
1314 1.5 mrg }
1315 1.3 mrg
1316 1.5 mrg template <>
1317 1.5 mrg template <>
1318 1.5 mrg inline bool
1319 1.6 mrg is_a_helper <const gcall *>::test (const gimple *gs)
1320 1.5 mrg {
1321 1.5 mrg return gs->code == GIMPLE_CALL;
1322 1.5 mrg }
1323 1.3 mrg
1324 1.5 mrg template <>
1325 1.5 mrg template <>
1326 1.5 mrg inline bool
1327 1.6 mrg is_a_helper <const gcatch *>::test (const gimple *gs)
1328 1.3 mrg {
1329 1.5 mrg return gs->code == GIMPLE_CATCH;
1330 1.3 mrg }
1331 1.3 mrg
1332 1.5 mrg template <>
1333 1.5 mrg template <>
1334 1.5 mrg inline bool
1335 1.6 mrg is_a_helper <const gresx *>::test (const gimple *gs)
1336 1.3 mrg {
1337 1.5 mrg return gs->code == GIMPLE_RESX;
1338 1.3 mrg }
1339 1.3 mrg
1340 1.5 mrg template <>
1341 1.5 mrg template <>
1342 1.5 mrg inline bool
1343 1.6 mrg is_a_helper <const geh_dispatch *>::test (const gimple *gs)
1344 1.5 mrg {
1345 1.5 mrg return gs->code == GIMPLE_EH_DISPATCH;
1346 1.5 mrg }
1347 1.3 mrg
1348 1.5 mrg template <>
1349 1.5 mrg template <>
1350 1.5 mrg inline bool
1351 1.6 mrg is_a_helper <const geh_filter *>::test (const gimple *gs)
1352 1.3 mrg {
1353 1.5 mrg return gs->code == GIMPLE_EH_FILTER;
1354 1.3 mrg }
1355 1.3 mrg
1356 1.5 mrg template <>
1357 1.5 mrg template <>
1358 1.5 mrg inline bool
1359 1.6 mrg is_a_helper <const gomp_atomic_load *>::test (const gimple *gs)
1360 1.5 mrg {
1361 1.5 mrg return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1362 1.5 mrg }
1363 1.3 mrg
1364 1.5 mrg template <>
1365 1.5 mrg template <>
1366 1.5 mrg inline bool
1367 1.6 mrg is_a_helper <const gomp_atomic_store *>::test (const gimple *gs)
1368 1.5 mrg {
1369 1.5 mrg return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1370 1.5 mrg }
1371 1.1 mrg
1372 1.5 mrg template <>
1373 1.5 mrg template <>
1374 1.5 mrg inline bool
1375 1.6 mrg is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs)
1376 1.1 mrg {
1377 1.5 mrg return gs->code == GIMPLE_OMP_RETURN;
1378 1.1 mrg }
1379 1.1 mrg
1380 1.5 mrg template <>
1381 1.5 mrg template <>
1382 1.5 mrg inline bool
1383 1.6 mrg is_a_helper <const gomp_continue *>::test (const gimple *gs)
1384 1.5 mrg {
1385 1.5 mrg return gs->code == GIMPLE_OMP_CONTINUE;
1386 1.5 mrg }
1387 1.1 mrg
1388 1.5 mrg template <>
1389 1.5 mrg template <>
1390 1.5 mrg inline bool
1391 1.6 mrg is_a_helper <const gomp_critical *>::test (const gimple *gs)
1392 1.5 mrg {
1393 1.5 mrg return gs->code == GIMPLE_OMP_CRITICAL;
1394 1.5 mrg }
1395 1.1 mrg
1396 1.5 mrg template <>
1397 1.5 mrg template <>
1398 1.5 mrg inline bool
1399 1.6 mrg is_a_helper <const gomp_ordered *>::test (const gimple *gs)
1400 1.6 mrg {
1401 1.6 mrg return gs->code == GIMPLE_OMP_ORDERED;
1402 1.6 mrg }
1403 1.6 mrg
1404 1.6 mrg template <>
1405 1.6 mrg template <>
1406 1.6 mrg inline bool
1407 1.12 mrg is_a_helper <const gomp_scan *>::test (const gimple *gs)
1408 1.12 mrg {
1409 1.12 mrg return gs->code == GIMPLE_OMP_SCAN;
1410 1.12 mrg }
1411 1.12 mrg
1412 1.12 mrg template <>
1413 1.12 mrg template <>
1414 1.12 mrg inline bool
1415 1.6 mrg is_a_helper <const gomp_for *>::test (const gimple *gs)
1416 1.1 mrg {
1417 1.5 mrg return gs->code == GIMPLE_OMP_FOR;
1418 1.1 mrg }
1419 1.1 mrg
1420 1.5 mrg template <>
1421 1.5 mrg template <>
1422 1.5 mrg inline bool
1423 1.6 mrg is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs)
1424 1.5 mrg {
1425 1.11 mrg return (gs->code == GIMPLE_OMP_PARALLEL
1426 1.11 mrg || gs->code == GIMPLE_OMP_TASK
1427 1.11 mrg || gs->code == GIMPLE_OMP_TEAMS);
1428 1.5 mrg }
1429 1.1 mrg
1430 1.5 mrg template <>
1431 1.5 mrg template <>
1432 1.5 mrg inline bool
1433 1.6 mrg is_a_helper <const gomp_parallel *>::test (const gimple *gs)
1434 1.5 mrg {
1435 1.5 mrg return gs->code == GIMPLE_OMP_PARALLEL;
1436 1.5 mrg }
1437 1.1 mrg
1438 1.5 mrg template <>
1439 1.5 mrg template <>
1440 1.5 mrg inline bool
1441 1.6 mrg is_a_helper <const gomp_target *>::test (const gimple *gs)
1442 1.1 mrg {
1443 1.5 mrg return gs->code == GIMPLE_OMP_TARGET;
1444 1.1 mrg }
1445 1.1 mrg
1446 1.5 mrg template <>
1447 1.5 mrg template <>
1448 1.5 mrg inline bool
1449 1.6 mrg is_a_helper <const gomp_sections *>::test (const gimple *gs)
1450 1.5 mrg {
1451 1.5 mrg return gs->code == GIMPLE_OMP_SECTIONS;
1452 1.5 mrg }
1453 1.1 mrg
1454 1.5 mrg template <>
1455 1.5 mrg template <>
1456 1.5 mrg inline bool
1457 1.6 mrg is_a_helper <const gomp_single *>::test (const gimple *gs)
1458 1.5 mrg {
1459 1.5 mrg return gs->code == GIMPLE_OMP_SINGLE;
1460 1.5 mrg }
1461 1.1 mrg
1462 1.5 mrg template <>
1463 1.5 mrg template <>
1464 1.5 mrg inline bool
1465 1.6 mrg is_a_helper <const gomp_teams *>::test (const gimple *gs)
1466 1.5 mrg {
1467 1.5 mrg return gs->code == GIMPLE_OMP_TEAMS;
1468 1.5 mrg }
1469 1.5 mrg
1470 1.5 mrg template <>
1471 1.5 mrg template <>
1472 1.5 mrg inline bool
1473 1.6 mrg is_a_helper <const gomp_task *>::test (const gimple *gs)
1474 1.5 mrg {
1475 1.5 mrg return gs->code == GIMPLE_OMP_TASK;
1476 1.5 mrg }
1477 1.5 mrg
1478 1.5 mrg template <>
1479 1.5 mrg template <>
1480 1.5 mrg inline bool
1481 1.6 mrg is_a_helper <const gphi *>::test (const gimple *gs)
1482 1.5 mrg {
1483 1.5 mrg return gs->code == GIMPLE_PHI;
1484 1.5 mrg }
1485 1.5 mrg
1486 1.5 mrg template <>
1487 1.5 mrg template <>
1488 1.5 mrg inline bool
1489 1.12 mrg is_a_helper <const greturn *>::test (const gimple *gs)
1490 1.12 mrg {
1491 1.12 mrg return gs->code == GIMPLE_RETURN;
1492 1.12 mrg }
1493 1.12 mrg
1494 1.12 mrg template <>
1495 1.12 mrg template <>
1496 1.12 mrg inline bool
1497 1.6 mrg is_a_helper <const gtransaction *>::test (const gimple *gs)
1498 1.5 mrg {
1499 1.5 mrg return gs->code == GIMPLE_TRANSACTION;
1500 1.5 mrg }
1501 1.5 mrg
1502 1.5 mrg /* Offset in bytes to the location of the operand vector.
1503 1.5 mrg Zero if there is no operand vector for this tuple structure. */
1504 1.5 mrg extern size_t const gimple_ops_offset_[];
1505 1.5 mrg
1506 1.5 mrg /* Map GIMPLE codes to GSS codes. */
1507 1.5 mrg extern enum gimple_statement_structure_enum const gss_for_code_[];
1508 1.5 mrg
1509 1.5 mrg /* This variable holds the currently expanded gimple statement for purposes
1510 1.5 mrg of comminucating the profile info to the builtin expanders. */
1511 1.6 mrg extern gimple *currently_expanding_gimple_stmt;
1512 1.5 mrg
1513 1.12 mrg size_t gimple_size (enum gimple_code code, unsigned num_ops = 0);
1514 1.12 mrg void gimple_init (gimple *g, enum gimple_code code, unsigned num_ops);
1515 1.10 mrg gimple *gimple_alloc (enum gimple_code, unsigned CXX_MEM_STAT_INFO);
1516 1.5 mrg greturn *gimple_build_return (tree);
1517 1.5 mrg void gimple_call_reset_alias_info (gcall *);
1518 1.5 mrg gcall *gimple_build_call_vec (tree, vec<tree> );
1519 1.5 mrg gcall *gimple_build_call (tree, unsigned, ...);
1520 1.5 mrg gcall *gimple_build_call_valist (tree, unsigned, va_list);
1521 1.5 mrg gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1522 1.5 mrg gcall *gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1523 1.10 mrg gcall *gimple_build_call_from_tree (tree, tree);
1524 1.5 mrg gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
1525 1.5 mrg gassign *gimple_build_assign (tree, enum tree_code,
1526 1.5 mrg tree, tree, tree CXX_MEM_STAT_INFO);
1527 1.5 mrg gassign *gimple_build_assign (tree, enum tree_code,
1528 1.5 mrg tree, tree CXX_MEM_STAT_INFO);
1529 1.5 mrg gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
1530 1.5 mrg gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1531 1.5 mrg gcond *gimple_build_cond_from_tree (tree, tree, tree);
1532 1.5 mrg void gimple_cond_set_condition_from_tree (gcond *, tree);
1533 1.5 mrg glabel *gimple_build_label (tree label);
1534 1.5 mrg ggoto *gimple_build_goto (tree dest);
1535 1.6 mrg gimple *gimple_build_nop (void);
1536 1.5 mrg gbind *gimple_build_bind (tree, gimple_seq, tree);
1537 1.5 mrg gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1538 1.5 mrg vec<tree, va_gc> *, vec<tree, va_gc> *,
1539 1.5 mrg vec<tree, va_gc> *);
1540 1.5 mrg gcatch *gimple_build_catch (tree, gimple_seq);
1541 1.5 mrg geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1542 1.5 mrg geh_mnt *gimple_build_eh_must_not_throw (tree);
1543 1.5 mrg geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1544 1.5 mrg gtry *gimple_build_try (gimple_seq, gimple_seq,
1545 1.5 mrg enum gimple_try_flags);
1546 1.6 mrg gimple *gimple_build_wce (gimple_seq);
1547 1.5 mrg gresx *gimple_build_resx (int);
1548 1.5 mrg gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1549 1.5 mrg gswitch *gimple_build_switch (tree, tree, vec<tree> );
1550 1.5 mrg geh_dispatch *gimple_build_eh_dispatch (int);
1551 1.10 mrg gdebug *gimple_build_debug_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1552 1.10 mrg gdebug *gimple_build_debug_source_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1553 1.10 mrg gdebug *gimple_build_debug_begin_stmt (tree, location_t CXX_MEM_STAT_INFO);
1554 1.10 mrg gdebug *gimple_build_debug_inline_entry (tree, location_t CXX_MEM_STAT_INFO);
1555 1.6 mrg gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
1556 1.5 mrg gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1557 1.5 mrg gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1558 1.5 mrg gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1559 1.5 mrg tree, tree);
1560 1.6 mrg gimple *gimple_build_omp_section (gimple_seq);
1561 1.6 mrg gimple *gimple_build_omp_master (gimple_seq);
1562 1.6 mrg gimple *gimple_build_omp_grid_body (gimple_seq);
1563 1.11 mrg gimple *gimple_build_omp_taskgroup (gimple_seq, tree);
1564 1.5 mrg gomp_continue *gimple_build_omp_continue (tree, tree);
1565 1.6 mrg gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
1566 1.6 mrg gimple *gimple_build_omp_return (bool);
1567 1.12 mrg gomp_scan *gimple_build_omp_scan (gimple_seq, tree);
1568 1.5 mrg gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1569 1.6 mrg gimple *gimple_build_omp_sections_switch (void);
1570 1.5 mrg gomp_single *gimple_build_omp_single (gimple_seq, tree);
1571 1.5 mrg gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1572 1.5 mrg gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1573 1.11 mrg gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree,
1574 1.11 mrg enum omp_memory_order);
1575 1.11 mrg gomp_atomic_store *gimple_build_omp_atomic_store (tree, enum omp_memory_order);
1576 1.6 mrg gtransaction *gimple_build_transaction (gimple_seq);
1577 1.6 mrg extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1578 1.6 mrg extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
1579 1.5 mrg void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1580 1.5 mrg void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1581 1.5 mrg extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1582 1.5 mrg location_t);
1583 1.5 mrg extern void annotate_all_with_location (gimple_seq, location_t);
1584 1.5 mrg bool empty_body_p (gimple_seq);
1585 1.5 mrg gimple_seq gimple_seq_copy (gimple_seq);
1586 1.6 mrg bool gimple_call_same_target_p (const gimple *, const gimple *);
1587 1.6 mrg int gimple_call_flags (const gimple *);
1588 1.5 mrg int gimple_call_arg_flags (const gcall *, unsigned);
1589 1.5 mrg int gimple_call_return_flags (const gcall *);
1590 1.11 mrg bool gimple_call_nonnull_result_p (gcall *);
1591 1.11 mrg tree gimple_call_nonnull_arg (gcall *);
1592 1.6 mrg bool gimple_assign_copy_p (gimple *);
1593 1.6 mrg bool gimple_assign_ssa_name_copy_p (gimple *);
1594 1.6 mrg bool gimple_assign_unary_nop_p (gimple *);
1595 1.6 mrg void gimple_set_bb (gimple *, basic_block);
1596 1.5 mrg void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1597 1.5 mrg void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1598 1.5 mrg tree, tree, tree);
1599 1.6 mrg tree gimple_get_lhs (const gimple *);
1600 1.6 mrg void gimple_set_lhs (gimple *, tree);
1601 1.6 mrg gimple *gimple_copy (gimple *);
1602 1.12 mrg void gimple_move_vops (gimple *, gimple *);
1603 1.6 mrg bool gimple_has_side_effects (const gimple *);
1604 1.6 mrg bool gimple_could_trap_p_1 (gimple *, bool, bool);
1605 1.6 mrg bool gimple_could_trap_p (gimple *);
1606 1.6 mrg bool gimple_assign_rhs_could_trap_p (gimple *);
1607 1.5 mrg extern void dump_gimple_statistics (void);
1608 1.5 mrg unsigned get_gimple_rhs_num_ops (enum tree_code);
1609 1.5 mrg extern tree canonicalize_cond_expr_cond (tree);
1610 1.5 mrg gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1611 1.5 mrg extern bool gimple_compare_field_offset (tree, tree);
1612 1.5 mrg extern tree gimple_unsigned_type (tree);
1613 1.5 mrg extern tree gimple_signed_type (tree);
1614 1.5 mrg extern alias_set_type gimple_get_alias_set (tree);
1615 1.6 mrg extern bool gimple_ior_addresses_taken (bitmap, gimple *);
1616 1.6 mrg extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
1617 1.6 mrg extern combined_fn gimple_call_combined_fn (const gimple *);
1618 1.12 mrg extern bool gimple_call_replaceable_operator_delete_p (const gcall *);
1619 1.6 mrg extern bool gimple_call_builtin_p (const gimple *);
1620 1.6 mrg extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1621 1.6 mrg extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1622 1.5 mrg extern bool gimple_asm_clobbers_memory_p (const gasm *);
1623 1.5 mrg extern void dump_decl_set (FILE *, bitmap);
1624 1.6 mrg extern bool nonfreeing_call_p (gimple *);
1625 1.6 mrg extern bool nonbarrier_call_p (gimple *);
1626 1.6 mrg extern bool infer_nonnull_range (gimple *, tree);
1627 1.6 mrg extern bool infer_nonnull_range_by_dereference (gimple *, tree);
1628 1.6 mrg extern bool infer_nonnull_range_by_attribute (gimple *, tree);
1629 1.5 mrg extern void sort_case_labels (vec<tree>);
1630 1.5 mrg extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
1631 1.5 mrg extern void gimple_seq_set_location (gimple_seq, location_t);
1632 1.5 mrg extern void gimple_seq_discard (gimple_seq);
1633 1.6 mrg extern void maybe_remove_unused_call_args (struct function *, gimple *);
1634 1.8 mrg extern bool gimple_inexpensive_call_p (gcall *);
1635 1.8 mrg extern bool stmt_can_terminate_bb_p (gimple *);
1636 1.12 mrg extern location_t gimple_or_expr_nonartificial_location (gimple *, tree);
1637 1.12 mrg
1638 1.5 mrg
1639 1.5 mrg /* Formal (expression) temporary table handling: multiple occurrences of
1640 1.5 mrg the same scalar expression are evaluated into the same temporary. */
1641 1.5 mrg
1642 1.5 mrg typedef struct gimple_temp_hash_elt
1643 1.5 mrg {
1644 1.5 mrg tree val; /* Key */
1645 1.5 mrg tree temp; /* Value */
1646 1.5 mrg } elt_t;
1647 1.5 mrg
1648 1.5 mrg /* Get the number of the next statement uid to be allocated. */
1649 1.5 mrg static inline unsigned int
1650 1.5 mrg gimple_stmt_max_uid (struct function *fn)
1651 1.5 mrg {
1652 1.5 mrg return fn->last_stmt_uid;
1653 1.5 mrg }
1654 1.5 mrg
1655 1.5 mrg /* Set the number of the next statement uid to be allocated. */
1656 1.5 mrg static inline void
1657 1.5 mrg set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1658 1.5 mrg {
1659 1.5 mrg fn->last_stmt_uid = maxid;
1660 1.5 mrg }
1661 1.5 mrg
1662 1.5 mrg /* Set the number of the next statement uid to be allocated. */
1663 1.5 mrg static inline unsigned int
1664 1.5 mrg inc_gimple_stmt_max_uid (struct function *fn)
1665 1.5 mrg {
1666 1.5 mrg return fn->last_stmt_uid++;
1667 1.5 mrg }
1668 1.5 mrg
1669 1.5 mrg /* Return the first node in GIMPLE sequence S. */
1670 1.5 mrg
1671 1.5 mrg static inline gimple_seq_node
1672 1.5 mrg gimple_seq_first (gimple_seq s)
1673 1.5 mrg {
1674 1.5 mrg return s;
1675 1.5 mrg }
1676 1.5 mrg
1677 1.5 mrg
1678 1.5 mrg /* Return the first statement in GIMPLE sequence S. */
1679 1.5 mrg
1680 1.6 mrg static inline gimple *
1681 1.5 mrg gimple_seq_first_stmt (gimple_seq s)
1682 1.5 mrg {
1683 1.5 mrg gimple_seq_node n = gimple_seq_first (s);
1684 1.5 mrg return n;
1685 1.5 mrg }
1686 1.5 mrg
1687 1.5 mrg /* Return the first statement in GIMPLE sequence S as a gbind *,
1688 1.5 mrg verifying that it has code GIMPLE_BIND in a checked build. */
1689 1.5 mrg
1690 1.5 mrg static inline gbind *
1691 1.5 mrg gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1692 1.5 mrg {
1693 1.5 mrg gimple_seq_node n = gimple_seq_first (s);
1694 1.5 mrg return as_a <gbind *> (n);
1695 1.5 mrg }
1696 1.5 mrg
1697 1.5 mrg
1698 1.5 mrg /* Return the last node in GIMPLE sequence S. */
1699 1.5 mrg
1700 1.5 mrg static inline gimple_seq_node
1701 1.5 mrg gimple_seq_last (gimple_seq s)
1702 1.5 mrg {
1703 1.5 mrg return s ? s->prev : NULL;
1704 1.5 mrg }
1705 1.5 mrg
1706 1.5 mrg
1707 1.5 mrg /* Return the last statement in GIMPLE sequence S. */
1708 1.5 mrg
1709 1.6 mrg static inline gimple *
1710 1.5 mrg gimple_seq_last_stmt (gimple_seq s)
1711 1.5 mrg {
1712 1.5 mrg gimple_seq_node n = gimple_seq_last (s);
1713 1.5 mrg return n;
1714 1.5 mrg }
1715 1.5 mrg
1716 1.5 mrg
1717 1.5 mrg /* Set the last node in GIMPLE sequence *PS to LAST. */
1718 1.5 mrg
1719 1.5 mrg static inline void
1720 1.5 mrg gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1721 1.5 mrg {
1722 1.5 mrg (*ps)->prev = last;
1723 1.5 mrg }
1724 1.5 mrg
1725 1.5 mrg
1726 1.5 mrg /* Set the first node in GIMPLE sequence *PS to FIRST. */
1727 1.5 mrg
1728 1.5 mrg static inline void
1729 1.5 mrg gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1730 1.5 mrg {
1731 1.5 mrg *ps = first;
1732 1.5 mrg }
1733 1.5 mrg
1734 1.5 mrg
1735 1.5 mrg /* Return true if GIMPLE sequence S is empty. */
1736 1.5 mrg
1737 1.5 mrg static inline bool
1738 1.5 mrg gimple_seq_empty_p (gimple_seq s)
1739 1.5 mrg {
1740 1.5 mrg return s == NULL;
1741 1.5 mrg }
1742 1.5 mrg
1743 1.5 mrg /* Allocate a new sequence and initialize its first element with STMT. */
1744 1.5 mrg
1745 1.5 mrg static inline gimple_seq
1746 1.6 mrg gimple_seq_alloc_with_stmt (gimple *stmt)
1747 1.5 mrg {
1748 1.5 mrg gimple_seq seq = NULL;
1749 1.5 mrg gimple_seq_add_stmt (&seq, stmt);
1750 1.5 mrg return seq;
1751 1.5 mrg }
1752 1.5 mrg
1753 1.5 mrg
1754 1.5 mrg /* Returns the sequence of statements in BB. */
1755 1.5 mrg
1756 1.5 mrg static inline gimple_seq
1757 1.5 mrg bb_seq (const_basic_block bb)
1758 1.5 mrg {
1759 1.5 mrg return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1760 1.5 mrg }
1761 1.5 mrg
1762 1.5 mrg static inline gimple_seq *
1763 1.5 mrg bb_seq_addr (basic_block bb)
1764 1.5 mrg {
1765 1.5 mrg return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1766 1.5 mrg }
1767 1.5 mrg
1768 1.5 mrg /* Sets the sequence of statements in BB to SEQ. */
1769 1.5 mrg
1770 1.5 mrg static inline void
1771 1.5 mrg set_bb_seq (basic_block bb, gimple_seq seq)
1772 1.5 mrg {
1773 1.5 mrg gcc_checking_assert (!(bb->flags & BB_RTL));
1774 1.5 mrg bb->il.gimple.seq = seq;
1775 1.5 mrg }
1776 1.5 mrg
1777 1.5 mrg
1778 1.5 mrg /* Return the code for GIMPLE statement G. */
1779 1.5 mrg
1780 1.5 mrg static inline enum gimple_code
1781 1.6 mrg gimple_code (const gimple *g)
1782 1.5 mrg {
1783 1.5 mrg return g->code;
1784 1.5 mrg }
1785 1.5 mrg
1786 1.5 mrg
1787 1.5 mrg /* Return the GSS code used by a GIMPLE code. */
1788 1.5 mrg
1789 1.5 mrg static inline enum gimple_statement_structure_enum
1790 1.5 mrg gss_for_code (enum gimple_code code)
1791 1.5 mrg {
1792 1.5 mrg gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1793 1.5 mrg return gss_for_code_[code];
1794 1.5 mrg }
1795 1.5 mrg
1796 1.5 mrg
1797 1.5 mrg /* Return which GSS code is used by GS. */
1798 1.5 mrg
1799 1.5 mrg static inline enum gimple_statement_structure_enum
1800 1.6 mrg gimple_statement_structure (gimple *gs)
1801 1.5 mrg {
1802 1.5 mrg return gss_for_code (gimple_code (gs));
1803 1.5 mrg }
1804 1.5 mrg
1805 1.5 mrg
1806 1.5 mrg /* Return true if statement G has sub-statements. This is only true for
1807 1.5 mrg High GIMPLE statements. */
1808 1.5 mrg
1809 1.5 mrg static inline bool
1810 1.6 mrg gimple_has_substatements (gimple *g)
1811 1.1 mrg {
1812 1.1 mrg switch (gimple_code (g))
1813 1.1 mrg {
1814 1.1 mrg case GIMPLE_BIND:
1815 1.1 mrg case GIMPLE_CATCH:
1816 1.1 mrg case GIMPLE_EH_FILTER:
1817 1.3 mrg case GIMPLE_EH_ELSE:
1818 1.1 mrg case GIMPLE_TRY:
1819 1.1 mrg case GIMPLE_OMP_FOR:
1820 1.1 mrg case GIMPLE_OMP_MASTER:
1821 1.5 mrg case GIMPLE_OMP_TASKGROUP:
1822 1.1 mrg case GIMPLE_OMP_ORDERED:
1823 1.1 mrg case GIMPLE_OMP_SECTION:
1824 1.1 mrg case GIMPLE_OMP_PARALLEL:
1825 1.1 mrg case GIMPLE_OMP_TASK:
1826 1.1 mrg case GIMPLE_OMP_SECTIONS:
1827 1.1 mrg case GIMPLE_OMP_SINGLE:
1828 1.5 mrg case GIMPLE_OMP_TARGET:
1829 1.5 mrg case GIMPLE_OMP_TEAMS:
1830 1.1 mrg case GIMPLE_OMP_CRITICAL:
1831 1.1 mrg case GIMPLE_WITH_CLEANUP_EXPR:
1832 1.3 mrg case GIMPLE_TRANSACTION:
1833 1.6 mrg case GIMPLE_OMP_GRID_BODY:
1834 1.1 mrg return true;
1835 1.1 mrg
1836 1.1 mrg default:
1837 1.1 mrg return false;
1838 1.1 mrg }
1839 1.1 mrg }
1840 1.1 mrg
1841 1.1 mrg
1842 1.1 mrg /* Return the basic block holding statement G. */
1843 1.1 mrg
1844 1.3 mrg static inline basic_block
1845 1.6 mrg gimple_bb (const gimple *g)
1846 1.1 mrg {
1847 1.5 mrg return g->bb;
1848 1.1 mrg }
1849 1.1 mrg
1850 1.1 mrg
1851 1.1 mrg /* Return the lexical scope block holding statement G. */
1852 1.1 mrg
1853 1.1 mrg static inline tree
1854 1.6 mrg gimple_block (const gimple *g)
1855 1.1 mrg {
1856 1.5 mrg return LOCATION_BLOCK (g->location);
1857 1.1 mrg }
1858 1.1 mrg
1859 1.1 mrg
1860 1.1 mrg /* Set BLOCK to be the lexical scope block holding statement G. */
1861 1.1 mrg
1862 1.1 mrg static inline void
1863 1.6 mrg gimple_set_block (gimple *g, tree block)
1864 1.1 mrg {
1865 1.6 mrg g->location = set_block (g->location, block);
1866 1.1 mrg }
1867 1.1 mrg
1868 1.1 mrg
1869 1.1 mrg /* Return location information for statement G. */
1870 1.1 mrg
1871 1.1 mrg static inline location_t
1872 1.6 mrg gimple_location (const gimple *g)
1873 1.1 mrg {
1874 1.5 mrg return g->location;
1875 1.5 mrg }
1876 1.5 mrg
1877 1.5 mrg /* Return location information for statement G if g is not NULL.
1878 1.5 mrg Otherwise, UNKNOWN_LOCATION is returned. */
1879 1.5 mrg
1880 1.5 mrg static inline location_t
1881 1.6 mrg gimple_location_safe (const gimple *g)
1882 1.5 mrg {
1883 1.5 mrg return g ? gimple_location (g) : UNKNOWN_LOCATION;
1884 1.1 mrg }
1885 1.1 mrg
1886 1.1 mrg /* Set location information for statement G. */
1887 1.1 mrg
1888 1.1 mrg static inline void
1889 1.6 mrg gimple_set_location (gimple *g, location_t location)
1890 1.1 mrg {
1891 1.5 mrg g->location = location;
1892 1.1 mrg }
1893 1.1 mrg
1894 1.12 mrg /* Return address of the location information for statement G. */
1895 1.12 mrg
1896 1.12 mrg static inline location_t *
1897 1.12 mrg gimple_location_ptr (gimple *g)
1898 1.12 mrg {
1899 1.12 mrg return &g->location;
1900 1.12 mrg }
1901 1.12 mrg
1902 1.1 mrg
1903 1.1 mrg /* Return true if G contains location information. */
1904 1.1 mrg
1905 1.1 mrg static inline bool
1906 1.6 mrg gimple_has_location (const gimple *g)
1907 1.1 mrg {
1908 1.3 mrg return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1909 1.1 mrg }
1910 1.1 mrg
1911 1.1 mrg
1912 1.11 mrg /* Return non-artificial location information for statement G. */
1913 1.11 mrg
1914 1.11 mrg static inline location_t
1915 1.11 mrg gimple_nonartificial_location (const gimple *g)
1916 1.11 mrg {
1917 1.11 mrg location_t *ploc = NULL;
1918 1.11 mrg
1919 1.11 mrg if (tree block = gimple_block (g))
1920 1.11 mrg ploc = block_nonartificial_location (block);
1921 1.11 mrg
1922 1.11 mrg return ploc ? *ploc : gimple_location (g);
1923 1.11 mrg }
1924 1.11 mrg
1925 1.11 mrg
1926 1.1 mrg /* Return the file name of the location of STMT. */
1927 1.1 mrg
1928 1.1 mrg static inline const char *
1929 1.6 mrg gimple_filename (const gimple *stmt)
1930 1.1 mrg {
1931 1.1 mrg return LOCATION_FILE (gimple_location (stmt));
1932 1.1 mrg }
1933 1.1 mrg
1934 1.1 mrg
1935 1.1 mrg /* Return the line number of the location of STMT. */
1936 1.1 mrg
1937 1.1 mrg static inline int
1938 1.6 mrg gimple_lineno (const gimple *stmt)
1939 1.1 mrg {
1940 1.1 mrg return LOCATION_LINE (gimple_location (stmt));
1941 1.1 mrg }
1942 1.1 mrg
1943 1.1 mrg
1944 1.1 mrg /* Determine whether SEQ is a singleton. */
1945 1.1 mrg
1946 1.1 mrg static inline bool
1947 1.1 mrg gimple_seq_singleton_p (gimple_seq seq)
1948 1.1 mrg {
1949 1.1 mrg return ((gimple_seq_first (seq) != NULL)
1950 1.1 mrg && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1951 1.1 mrg }
1952 1.1 mrg
1953 1.1 mrg /* Return true if no warnings should be emitted for statement STMT. */
1954 1.1 mrg
1955 1.1 mrg static inline bool
1956 1.6 mrg gimple_no_warning_p (const gimple *stmt)
1957 1.1 mrg {
1958 1.5 mrg return stmt->no_warning;
1959 1.1 mrg }
1960 1.1 mrg
1961 1.1 mrg /* Set the no_warning flag of STMT to NO_WARNING. */
1962 1.1 mrg
1963 1.1 mrg static inline void
1964 1.6 mrg gimple_set_no_warning (gimple *stmt, bool no_warning)
1965 1.1 mrg {
1966 1.5 mrg stmt->no_warning = (unsigned) no_warning;
1967 1.1 mrg }
1968 1.1 mrg
1969 1.5 mrg /* Set the visited status on statement STMT to VISITED_P.
1970 1.5 mrg
1971 1.5 mrg Please note that this 'visited' property of the gimple statement is
1972 1.5 mrg supposed to be undefined at pass boundaries. This means that a
1973 1.5 mrg given pass should not assume it contains any useful value when the
1974 1.5 mrg pass starts and thus can set it to any value it sees fit.
1975 1.5 mrg
1976 1.5 mrg You can learn more about the visited property of the gimple
1977 1.5 mrg statement by reading the comments of the 'visited' data member of
1978 1.6 mrg struct gimple.
1979 1.5 mrg */
1980 1.1 mrg
1981 1.1 mrg static inline void
1982 1.6 mrg gimple_set_visited (gimple *stmt, bool visited_p)
1983 1.1 mrg {
1984 1.5 mrg stmt->visited = (unsigned) visited_p;
1985 1.1 mrg }
1986 1.1 mrg
1987 1.1 mrg
1988 1.5 mrg /* Return the visited status for statement STMT.
1989 1.5 mrg
1990 1.5 mrg Please note that this 'visited' property of the gimple statement is
1991 1.5 mrg supposed to be undefined at pass boundaries. This means that a
1992 1.5 mrg given pass should not assume it contains any useful value when the
1993 1.5 mrg pass starts and thus can set it to any value it sees fit.
1994 1.5 mrg
1995 1.5 mrg You can learn more about the visited property of the gimple
1996 1.5 mrg statement by reading the comments of the 'visited' data member of
1997 1.6 mrg struct gimple. */
1998 1.1 mrg
1999 1.1 mrg static inline bool
2000 1.6 mrg gimple_visited_p (gimple *stmt)
2001 1.1 mrg {
2002 1.5 mrg return stmt->visited;
2003 1.1 mrg }
2004 1.1 mrg
2005 1.1 mrg
2006 1.5 mrg /* Set pass local flag PLF on statement STMT to VAL_P.
2007 1.5 mrg
2008 1.5 mrg Please note that this PLF property of the gimple statement is
2009 1.5 mrg supposed to be undefined at pass boundaries. This means that a
2010 1.5 mrg given pass should not assume it contains any useful value when the
2011 1.5 mrg pass starts and thus can set it to any value it sees fit.
2012 1.5 mrg
2013 1.5 mrg You can learn more about the PLF property by reading the comment of
2014 1.5 mrg the 'plf' data member of struct gimple_statement_structure. */
2015 1.1 mrg
2016 1.1 mrg static inline void
2017 1.6 mrg gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
2018 1.1 mrg {
2019 1.1 mrg if (val_p)
2020 1.5 mrg stmt->plf |= (unsigned int) plf;
2021 1.1 mrg else
2022 1.5 mrg stmt->plf &= ~((unsigned int) plf);
2023 1.1 mrg }
2024 1.1 mrg
2025 1.1 mrg
2026 1.5 mrg /* Return the value of pass local flag PLF on statement STMT.
2027 1.5 mrg
2028 1.5 mrg Please note that this 'plf' property of the gimple statement is
2029 1.5 mrg supposed to be undefined at pass boundaries. This means that a
2030 1.5 mrg given pass should not assume it contains any useful value when the
2031 1.5 mrg pass starts and thus can set it to any value it sees fit.
2032 1.5 mrg
2033 1.5 mrg You can learn more about the plf property by reading the comment of
2034 1.5 mrg the 'plf' data member of struct gimple_statement_structure. */
2035 1.1 mrg
2036 1.1 mrg static inline unsigned int
2037 1.6 mrg gimple_plf (gimple *stmt, enum plf_mask plf)
2038 1.1 mrg {
2039 1.5 mrg return stmt->plf & ((unsigned int) plf);
2040 1.1 mrg }
2041 1.1 mrg
2042 1.1 mrg
2043 1.5 mrg /* Set the UID of statement.
2044 1.5 mrg
2045 1.5 mrg Please note that this UID property is supposed to be undefined at
2046 1.5 mrg pass boundaries. This means that a given pass should not assume it
2047 1.5 mrg contains any useful value when the pass starts and thus can set it
2048 1.5 mrg to any value it sees fit. */
2049 1.1 mrg
2050 1.1 mrg static inline void
2051 1.6 mrg gimple_set_uid (gimple *g, unsigned uid)
2052 1.1 mrg {
2053 1.5 mrg g->uid = uid;
2054 1.1 mrg }
2055 1.1 mrg
2056 1.1 mrg
2057 1.5 mrg /* Return the UID of statement.
2058 1.5 mrg
2059 1.5 mrg Please note that this UID property is supposed to be undefined at
2060 1.5 mrg pass boundaries. This means that a given pass should not assume it
2061 1.5 mrg contains any useful value when the pass starts and thus can set it
2062 1.5 mrg to any value it sees fit. */
2063 1.1 mrg
2064 1.1 mrg static inline unsigned
2065 1.6 mrg gimple_uid (const gimple *g)
2066 1.1 mrg {
2067 1.5 mrg return g->uid;
2068 1.1 mrg }
2069 1.1 mrg
2070 1.1 mrg
2071 1.3 mrg /* Make statement G a singleton sequence. */
2072 1.3 mrg
2073 1.3 mrg static inline void
2074 1.6 mrg gimple_init_singleton (gimple *g)
2075 1.3 mrg {
2076 1.5 mrg g->next = NULL;
2077 1.5 mrg g->prev = g;
2078 1.3 mrg }
2079 1.3 mrg
2080 1.3 mrg
2081 1.1 mrg /* Return true if GIMPLE statement G has register or memory operands. */
2082 1.1 mrg
2083 1.1 mrg static inline bool
2084 1.6 mrg gimple_has_ops (const gimple *g)
2085 1.1 mrg {
2086 1.1 mrg return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
2087 1.1 mrg }
2088 1.1 mrg
2089 1.5 mrg template <>
2090 1.5 mrg template <>
2091 1.5 mrg inline bool
2092 1.6 mrg is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
2093 1.5 mrg {
2094 1.5 mrg return gimple_has_ops (gs);
2095 1.5 mrg }
2096 1.5 mrg
2097 1.5 mrg template <>
2098 1.5 mrg template <>
2099 1.5 mrg inline bool
2100 1.6 mrg is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
2101 1.5 mrg {
2102 1.5 mrg return gimple_has_ops (gs);
2103 1.5 mrg }
2104 1.1 mrg
2105 1.1 mrg /* Return true if GIMPLE statement G has memory operands. */
2106 1.1 mrg
2107 1.1 mrg static inline bool
2108 1.6 mrg gimple_has_mem_ops (const gimple *g)
2109 1.1 mrg {
2110 1.1 mrg return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
2111 1.1 mrg }
2112 1.1 mrg
2113 1.5 mrg template <>
2114 1.5 mrg template <>
2115 1.5 mrg inline bool
2116 1.6 mrg is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
2117 1.5 mrg {
2118 1.5 mrg return gimple_has_mem_ops (gs);
2119 1.5 mrg }
2120 1.5 mrg
2121 1.5 mrg template <>
2122 1.5 mrg template <>
2123 1.5 mrg inline bool
2124 1.6 mrg is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
2125 1.5 mrg {
2126 1.5 mrg return gimple_has_mem_ops (gs);
2127 1.5 mrg }
2128 1.1 mrg
2129 1.1 mrg /* Return the set of USE operands for statement G. */
2130 1.1 mrg
2131 1.1 mrg static inline struct use_optype_d *
2132 1.6 mrg gimple_use_ops (const gimple *g)
2133 1.1 mrg {
2134 1.5 mrg const gimple_statement_with_ops *ops_stmt =
2135 1.5 mrg dyn_cast <const gimple_statement_with_ops *> (g);
2136 1.5 mrg if (!ops_stmt)
2137 1.1 mrg return NULL;
2138 1.5 mrg return ops_stmt->use_ops;
2139 1.1 mrg }
2140 1.1 mrg
2141 1.1 mrg
2142 1.1 mrg /* Set USE to be the set of USE operands for statement G. */
2143 1.1 mrg
2144 1.1 mrg static inline void
2145 1.6 mrg gimple_set_use_ops (gimple *g, struct use_optype_d *use)
2146 1.1 mrg {
2147 1.5 mrg gimple_statement_with_ops *ops_stmt =
2148 1.5 mrg as_a <gimple_statement_with_ops *> (g);
2149 1.5 mrg ops_stmt->use_ops = use;
2150 1.1 mrg }
2151 1.1 mrg
2152 1.1 mrg
2153 1.1 mrg /* Return the single VUSE operand of the statement G. */
2154 1.1 mrg
2155 1.1 mrg static inline tree
2156 1.6 mrg gimple_vuse (const gimple *g)
2157 1.1 mrg {
2158 1.5 mrg const gimple_statement_with_memory_ops *mem_ops_stmt =
2159 1.5 mrg dyn_cast <const gimple_statement_with_memory_ops *> (g);
2160 1.5 mrg if (!mem_ops_stmt)
2161 1.1 mrg return NULL_TREE;
2162 1.5 mrg return mem_ops_stmt->vuse;
2163 1.1 mrg }
2164 1.1 mrg
2165 1.1 mrg /* Return the single VDEF operand of the statement G. */
2166 1.1 mrg
2167 1.1 mrg static inline tree
2168 1.6 mrg gimple_vdef (const gimple *g)
2169 1.1 mrg {
2170 1.5 mrg const gimple_statement_with_memory_ops *mem_ops_stmt =
2171 1.5 mrg dyn_cast <const gimple_statement_with_memory_ops *> (g);
2172 1.5 mrg if (!mem_ops_stmt)
2173 1.1 mrg return NULL_TREE;
2174 1.5 mrg return mem_ops_stmt->vdef;
2175 1.1 mrg }
2176 1.1 mrg
2177 1.1 mrg /* Return the single VUSE operand of the statement G. */
2178 1.1 mrg
2179 1.1 mrg static inline tree *
2180 1.6 mrg gimple_vuse_ptr (gimple *g)
2181 1.1 mrg {
2182 1.5 mrg gimple_statement_with_memory_ops *mem_ops_stmt =
2183 1.5 mrg dyn_cast <gimple_statement_with_memory_ops *> (g);
2184 1.5 mrg if (!mem_ops_stmt)
2185 1.1 mrg return NULL;
2186 1.5 mrg return &mem_ops_stmt->vuse;
2187 1.1 mrg }
2188 1.1 mrg
2189 1.1 mrg /* Return the single VDEF operand of the statement G. */
2190 1.1 mrg
2191 1.1 mrg static inline tree *
2192 1.6 mrg gimple_vdef_ptr (gimple *g)
2193 1.1 mrg {
2194 1.5 mrg gimple_statement_with_memory_ops *mem_ops_stmt =
2195 1.5 mrg dyn_cast <gimple_statement_with_memory_ops *> (g);
2196 1.5 mrg if (!mem_ops_stmt)
2197 1.1 mrg return NULL;
2198 1.5 mrg return &mem_ops_stmt->vdef;
2199 1.1 mrg }
2200 1.1 mrg
2201 1.1 mrg /* Set the single VUSE operand of the statement G. */
2202 1.1 mrg
2203 1.1 mrg static inline void
2204 1.6 mrg gimple_set_vuse (gimple *g, tree vuse)
2205 1.1 mrg {
2206 1.5 mrg gimple_statement_with_memory_ops *mem_ops_stmt =
2207 1.5 mrg as_a <gimple_statement_with_memory_ops *> (g);
2208 1.5 mrg mem_ops_stmt->vuse = vuse;
2209 1.1 mrg }
2210 1.1 mrg
2211 1.1 mrg /* Set the single VDEF operand of the statement G. */
2212 1.1 mrg
2213 1.1 mrg static inline void
2214 1.6 mrg gimple_set_vdef (gimple *g, tree vdef)
2215 1.1 mrg {
2216 1.5 mrg gimple_statement_with_memory_ops *mem_ops_stmt =
2217 1.5 mrg as_a <gimple_statement_with_memory_ops *> (g);
2218 1.5 mrg mem_ops_stmt->vdef = vdef;
2219 1.1 mrg }
2220 1.1 mrg
2221 1.1 mrg
2222 1.1 mrg /* Return true if statement G has operands and the modified field has
2223 1.1 mrg been set. */
2224 1.1 mrg
2225 1.1 mrg static inline bool
2226 1.6 mrg gimple_modified_p (const gimple *g)
2227 1.1 mrg {
2228 1.5 mrg return (gimple_has_ops (g)) ? (bool) g->modified : false;
2229 1.1 mrg }
2230 1.1 mrg
2231 1.1 mrg
2232 1.3 mrg /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2233 1.3 mrg a MODIFIED field. */
2234 1.3 mrg
2235 1.3 mrg static inline void
2236 1.6 mrg gimple_set_modified (gimple *s, bool modifiedp)
2237 1.3 mrg {
2238 1.3 mrg if (gimple_has_ops (s))
2239 1.5 mrg s->modified = (unsigned) modifiedp;
2240 1.3 mrg }
2241 1.3 mrg
2242 1.3 mrg
2243 1.1 mrg /* Return the tree code for the expression computed by STMT. This is
2244 1.1 mrg only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2245 1.1 mrg GIMPLE_CALL, return CALL_EXPR as the expression code for
2246 1.1 mrg consistency. This is useful when the caller needs to deal with the
2247 1.1 mrg three kinds of computation that GIMPLE supports. */
2248 1.1 mrg
2249 1.1 mrg static inline enum tree_code
2250 1.6 mrg gimple_expr_code (const gimple *stmt)
2251 1.1 mrg {
2252 1.1 mrg enum gimple_code code = gimple_code (stmt);
2253 1.1 mrg if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
2254 1.5 mrg return (enum tree_code) stmt->subcode;
2255 1.1 mrg else
2256 1.3 mrg {
2257 1.3 mrg gcc_gimple_checking_assert (code == GIMPLE_CALL);
2258 1.3 mrg return CALL_EXPR;
2259 1.3 mrg }
2260 1.1 mrg }
2261 1.1 mrg
2262 1.1 mrg
2263 1.1 mrg /* Return true if statement STMT contains volatile operands. */
2264 1.1 mrg
2265 1.1 mrg static inline bool
2266 1.6 mrg gimple_has_volatile_ops (const gimple *stmt)
2267 1.1 mrg {
2268 1.1 mrg if (gimple_has_mem_ops (stmt))
2269 1.5 mrg return stmt->has_volatile_ops;
2270 1.1 mrg else
2271 1.1 mrg return false;
2272 1.1 mrg }
2273 1.1 mrg
2274 1.1 mrg
2275 1.1 mrg /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2276 1.1 mrg
2277 1.1 mrg static inline void
2278 1.6 mrg gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
2279 1.1 mrg {
2280 1.1 mrg if (gimple_has_mem_ops (stmt))
2281 1.5 mrg stmt->has_volatile_ops = (unsigned) volatilep;
2282 1.3 mrg }
2283 1.3 mrg
2284 1.3 mrg /* Return true if STMT is in a transaction. */
2285 1.3 mrg
2286 1.3 mrg static inline bool
2287 1.6 mrg gimple_in_transaction (const gimple *stmt)
2288 1.3 mrg {
2289 1.5 mrg return bb_in_transaction (gimple_bb (stmt));
2290 1.3 mrg }
2291 1.1 mrg
2292 1.1 mrg /* Return true if statement STMT may access memory. */
2293 1.1 mrg
2294 1.1 mrg static inline bool
2295 1.6 mrg gimple_references_memory_p (gimple *stmt)
2296 1.1 mrg {
2297 1.1 mrg return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2298 1.1 mrg }
2299 1.1 mrg
2300 1.1 mrg
2301 1.1 mrg /* Return the subcode for OMP statement S. */
2302 1.1 mrg
2303 1.1 mrg static inline unsigned
2304 1.6 mrg gimple_omp_subcode (const gimple *s)
2305 1.1 mrg {
2306 1.3 mrg gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2307 1.11 mrg && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2308 1.5 mrg return s->subcode;
2309 1.1 mrg }
2310 1.1 mrg
2311 1.1 mrg /* Set the subcode for OMP statement S to SUBCODE. */
2312 1.1 mrg
2313 1.1 mrg static inline void
2314 1.6 mrg gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2315 1.1 mrg {
2316 1.1 mrg /* We only have 16 bits for the subcode. Assert that we are not
2317 1.1 mrg overflowing it. */
2318 1.3 mrg gcc_gimple_checking_assert (subcode < (1 << 16));
2319 1.5 mrg s->subcode = subcode;
2320 1.1 mrg }
2321 1.1 mrg
2322 1.1 mrg /* Set the nowait flag on OMP_RETURN statement S. */
2323 1.1 mrg
2324 1.1 mrg static inline void
2325 1.6 mrg gimple_omp_return_set_nowait (gimple *s)
2326 1.1 mrg {
2327 1.1 mrg GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2328 1.5 mrg s->subcode |= GF_OMP_RETURN_NOWAIT;
2329 1.1 mrg }
2330 1.1 mrg
2331 1.1 mrg
2332 1.1 mrg /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2333 1.1 mrg flag set. */
2334 1.1 mrg
2335 1.1 mrg static inline bool
2336 1.6 mrg gimple_omp_return_nowait_p (const gimple *g)
2337 1.1 mrg {
2338 1.1 mrg GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2339 1.1 mrg return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2340 1.1 mrg }
2341 1.1 mrg
2342 1.1 mrg
2343 1.5 mrg /* Set the LHS of OMP return. */
2344 1.5 mrg
2345 1.5 mrg static inline void
2346 1.6 mrg gimple_omp_return_set_lhs (gimple *g, tree lhs)
2347 1.5 mrg {
2348 1.5 mrg gimple_statement_omp_return *omp_return_stmt =
2349 1.5 mrg as_a <gimple_statement_omp_return *> (g);
2350 1.5 mrg omp_return_stmt->val = lhs;
2351 1.5 mrg }
2352 1.5 mrg
2353 1.5 mrg
2354 1.5 mrg /* Get the LHS of OMP return. */
2355 1.5 mrg
2356 1.5 mrg static inline tree
2357 1.6 mrg gimple_omp_return_lhs (const gimple *g)
2358 1.5 mrg {
2359 1.5 mrg const gimple_statement_omp_return *omp_return_stmt =
2360 1.5 mrg as_a <const gimple_statement_omp_return *> (g);
2361 1.5 mrg return omp_return_stmt->val;
2362 1.5 mrg }
2363 1.5 mrg
2364 1.5 mrg
2365 1.5 mrg /* Return a pointer to the LHS of OMP return. */
2366 1.5 mrg
2367 1.5 mrg static inline tree *
2368 1.6 mrg gimple_omp_return_lhs_ptr (gimple *g)
2369 1.5 mrg {
2370 1.5 mrg gimple_statement_omp_return *omp_return_stmt =
2371 1.5 mrg as_a <gimple_statement_omp_return *> (g);
2372 1.5 mrg return &omp_return_stmt->val;
2373 1.5 mrg }
2374 1.5 mrg
2375 1.5 mrg
2376 1.1 mrg /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2377 1.1 mrg flag set. */
2378 1.1 mrg
2379 1.1 mrg static inline bool
2380 1.6 mrg gimple_omp_section_last_p (const gimple *g)
2381 1.1 mrg {
2382 1.1 mrg GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2383 1.1 mrg return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2384 1.1 mrg }
2385 1.1 mrg
2386 1.1 mrg
2387 1.1 mrg /* Set the GF_OMP_SECTION_LAST flag on G. */
2388 1.1 mrg
2389 1.1 mrg static inline void
2390 1.6 mrg gimple_omp_section_set_last (gimple *g)
2391 1.1 mrg {
2392 1.1 mrg GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2393 1.5 mrg g->subcode |= GF_OMP_SECTION_LAST;
2394 1.1 mrg }
2395 1.1 mrg
2396 1.1 mrg
2397 1.1 mrg /* Return true if OMP parallel statement G has the
2398 1.1 mrg GF_OMP_PARALLEL_COMBINED flag set. */
2399 1.1 mrg
2400 1.1 mrg static inline bool
2401 1.6 mrg gimple_omp_parallel_combined_p (const gimple *g)
2402 1.1 mrg {
2403 1.1 mrg GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2404 1.1 mrg return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2405 1.1 mrg }
2406 1.1 mrg
2407 1.1 mrg
2408 1.1 mrg /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2409 1.1 mrg value of COMBINED_P. */
2410 1.1 mrg
2411 1.1 mrg static inline void
2412 1.6 mrg gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
2413 1.1 mrg {
2414 1.1 mrg GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2415 1.1 mrg if (combined_p)
2416 1.5 mrg g->subcode |= GF_OMP_PARALLEL_COMBINED;
2417 1.1 mrg else
2418 1.5 mrg g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2419 1.1 mrg }
2420 1.1 mrg
2421 1.1 mrg
2422 1.3 mrg /* Return true if OMP atomic load/store statement G has the
2423 1.3 mrg GF_OMP_ATOMIC_NEED_VALUE flag set. */
2424 1.3 mrg
2425 1.3 mrg static inline bool
2426 1.6 mrg gimple_omp_atomic_need_value_p (const gimple *g)
2427 1.3 mrg {
2428 1.3 mrg if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2429 1.3 mrg GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2430 1.3 mrg return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2431 1.3 mrg }
2432 1.3 mrg
2433 1.3 mrg
2434 1.3 mrg /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2435 1.3 mrg
2436 1.3 mrg static inline void
2437 1.6 mrg gimple_omp_atomic_set_need_value (gimple *g)
2438 1.3 mrg {
2439 1.3 mrg if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2440 1.3 mrg GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2441 1.5 mrg g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2442 1.5 mrg }
2443 1.5 mrg
2444 1.5 mrg
2445 1.11 mrg /* Return the memory order of the OMP atomic load/store statement G. */
2446 1.5 mrg
2447 1.11 mrg static inline enum omp_memory_order
2448 1.11 mrg gimple_omp_atomic_memory_order (const gimple *g)
2449 1.5 mrg {
2450 1.5 mrg if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2451 1.5 mrg GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2452 1.11 mrg return (enum omp_memory_order)
2453 1.11 mrg (gimple_omp_subcode (g) & GF_OMP_ATOMIC_MEMORY_ORDER);
2454 1.5 mrg }
2455 1.5 mrg
2456 1.5 mrg
2457 1.11 mrg /* Set the memory order on G. */
2458 1.5 mrg
2459 1.5 mrg static inline void
2460 1.11 mrg gimple_omp_atomic_set_memory_order (gimple *g, enum omp_memory_order mo)
2461 1.5 mrg {
2462 1.5 mrg if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2463 1.5 mrg GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2464 1.11 mrg g->subcode = ((g->subcode & ~GF_OMP_ATOMIC_MEMORY_ORDER)
2465 1.11 mrg | (mo & GF_OMP_ATOMIC_MEMORY_ORDER));
2466 1.3 mrg }
2467 1.3 mrg
2468 1.3 mrg
2469 1.1 mrg /* Return the number of operands for statement GS. */
2470 1.1 mrg
2471 1.1 mrg static inline unsigned
2472 1.6 mrg gimple_num_ops (const gimple *gs)
2473 1.1 mrg {
2474 1.5 mrg return gs->num_ops;
2475 1.1 mrg }
2476 1.1 mrg
2477 1.1 mrg
2478 1.1 mrg /* Set the number of operands for statement GS. */
2479 1.1 mrg
2480 1.1 mrg static inline void
2481 1.6 mrg gimple_set_num_ops (gimple *gs, unsigned num_ops)
2482 1.1 mrg {
2483 1.5 mrg gs->num_ops = num_ops;
2484 1.1 mrg }
2485 1.1 mrg
2486 1.1 mrg
2487 1.1 mrg /* Return the array of operands for statement GS. */
2488 1.1 mrg
2489 1.1 mrg static inline tree *
2490 1.6 mrg gimple_ops (gimple *gs)
2491 1.1 mrg {
2492 1.1 mrg size_t off;
2493 1.1 mrg
2494 1.1 mrg /* All the tuples have their operand vector at the very bottom
2495 1.1 mrg of the structure. Note that those structures that do not
2496 1.1 mrg have an operand vector have a zero offset. */
2497 1.1 mrg off = gimple_ops_offset_[gimple_statement_structure (gs)];
2498 1.3 mrg gcc_gimple_checking_assert (off != 0);
2499 1.1 mrg
2500 1.1 mrg return (tree *) ((char *) gs + off);
2501 1.1 mrg }
2502 1.1 mrg
2503 1.1 mrg
2504 1.1 mrg /* Return operand I for statement GS. */
2505 1.1 mrg
2506 1.1 mrg static inline tree
2507 1.6 mrg gimple_op (const gimple *gs, unsigned i)
2508 1.1 mrg {
2509 1.1 mrg if (gimple_has_ops (gs))
2510 1.1 mrg {
2511 1.3 mrg gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2512 1.1 mrg return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2513 1.1 mrg }
2514 1.1 mrg else
2515 1.1 mrg return NULL_TREE;
2516 1.1 mrg }
2517 1.1 mrg
2518 1.1 mrg /* Return a pointer to operand I for statement GS. */
2519 1.1 mrg
2520 1.1 mrg static inline tree *
2521 1.6 mrg gimple_op_ptr (gimple *gs, unsigned i)
2522 1.1 mrg {
2523 1.1 mrg if (gimple_has_ops (gs))
2524 1.1 mrg {
2525 1.3 mrg gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2526 1.6 mrg return gimple_ops (gs) + i;
2527 1.1 mrg }
2528 1.1 mrg else
2529 1.1 mrg return NULL;
2530 1.1 mrg }
2531 1.1 mrg
2532 1.1 mrg /* Set operand I of statement GS to OP. */
2533 1.1 mrg
2534 1.1 mrg static inline void
2535 1.6 mrg gimple_set_op (gimple *gs, unsigned i, tree op)
2536 1.1 mrg {
2537 1.3 mrg gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2538 1.1 mrg
2539 1.1 mrg /* Note. It may be tempting to assert that OP matches
2540 1.1 mrg is_gimple_operand, but that would be wrong. Different tuples
2541 1.1 mrg accept slightly different sets of tree operands. Each caller
2542 1.1 mrg should perform its own validation. */
2543 1.1 mrg gimple_ops (gs)[i] = op;
2544 1.1 mrg }
2545 1.1 mrg
2546 1.1 mrg /* Return true if GS is a GIMPLE_ASSIGN. */
2547 1.1 mrg
2548 1.1 mrg static inline bool
2549 1.6 mrg is_gimple_assign (const gimple *gs)
2550 1.1 mrg {
2551 1.1 mrg return gimple_code (gs) == GIMPLE_ASSIGN;
2552 1.1 mrg }
2553 1.1 mrg
2554 1.1 mrg /* Determine if expression CODE is one of the valid expressions that can
2555 1.1 mrg be used on the RHS of GIMPLE assignments. */
2556 1.1 mrg
2557 1.1 mrg static inline enum gimple_rhs_class
2558 1.1 mrg get_gimple_rhs_class (enum tree_code code)
2559 1.1 mrg {
2560 1.1 mrg return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2561 1.1 mrg }
2562 1.1 mrg
2563 1.1 mrg /* Return the LHS of assignment statement GS. */
2564 1.1 mrg
2565 1.1 mrg static inline tree
2566 1.6 mrg gimple_assign_lhs (const gassign *gs)
2567 1.6 mrg {
2568 1.6 mrg return gs->op[0];
2569 1.6 mrg }
2570 1.6 mrg
2571 1.6 mrg static inline tree
2572 1.6 mrg gimple_assign_lhs (const gimple *gs)
2573 1.1 mrg {
2574 1.6 mrg const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2575 1.6 mrg return gimple_assign_lhs (ass);
2576 1.1 mrg }
2577 1.1 mrg
2578 1.1 mrg
2579 1.1 mrg /* Return a pointer to the LHS of assignment statement GS. */
2580 1.1 mrg
2581 1.1 mrg static inline tree *
2582 1.6 mrg gimple_assign_lhs_ptr (gassign *gs)
2583 1.6 mrg {
2584 1.6 mrg return &gs->op[0];
2585 1.6 mrg }
2586 1.6 mrg
2587 1.6 mrg static inline tree *
2588 1.6 mrg gimple_assign_lhs_ptr (gimple *gs)
2589 1.1 mrg {
2590 1.6 mrg gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2591 1.6 mrg return gimple_assign_lhs_ptr (ass);
2592 1.1 mrg }
2593 1.1 mrg
2594 1.1 mrg
2595 1.1 mrg /* Set LHS to be the LHS operand of assignment statement GS. */
2596 1.1 mrg
2597 1.1 mrg static inline void
2598 1.6 mrg gimple_assign_set_lhs (gassign *gs, tree lhs)
2599 1.1 mrg {
2600 1.6 mrg gs->op[0] = lhs;
2601 1.1 mrg
2602 1.1 mrg if (lhs && TREE_CODE (lhs) == SSA_NAME)
2603 1.1 mrg SSA_NAME_DEF_STMT (lhs) = gs;
2604 1.1 mrg }
2605 1.1 mrg
2606 1.6 mrg static inline void
2607 1.6 mrg gimple_assign_set_lhs (gimple *gs, tree lhs)
2608 1.6 mrg {
2609 1.6 mrg gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2610 1.6 mrg gimple_assign_set_lhs (ass, lhs);
2611 1.6 mrg }
2612 1.6 mrg
2613 1.1 mrg
2614 1.1 mrg /* Return the first operand on the RHS of assignment statement GS. */
2615 1.1 mrg
2616 1.1 mrg static inline tree
2617 1.6 mrg gimple_assign_rhs1 (const gassign *gs)
2618 1.6 mrg {
2619 1.6 mrg return gs->op[1];
2620 1.6 mrg }
2621 1.6 mrg
2622 1.6 mrg static inline tree
2623 1.6 mrg gimple_assign_rhs1 (const gimple *gs)
2624 1.1 mrg {
2625 1.6 mrg const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2626 1.6 mrg return gimple_assign_rhs1 (ass);
2627 1.1 mrg }
2628 1.1 mrg
2629 1.1 mrg
2630 1.1 mrg /* Return a pointer to the first operand on the RHS of assignment
2631 1.1 mrg statement GS. */
2632 1.1 mrg
2633 1.1 mrg static inline tree *
2634 1.6 mrg gimple_assign_rhs1_ptr (gassign *gs)
2635 1.6 mrg {
2636 1.6 mrg return &gs->op[1];
2637 1.6 mrg }
2638 1.6 mrg
2639 1.6 mrg static inline tree *
2640 1.6 mrg gimple_assign_rhs1_ptr (gimple *gs)
2641 1.1 mrg {
2642 1.6 mrg gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2643 1.6 mrg return gimple_assign_rhs1_ptr (ass);
2644 1.1 mrg }
2645 1.1 mrg
2646 1.1 mrg /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2647 1.1 mrg
2648 1.1 mrg static inline void
2649 1.6 mrg gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2650 1.1 mrg {
2651 1.6 mrg gs->op[1] = rhs;
2652 1.6 mrg }
2653 1.1 mrg
2654 1.6 mrg static inline void
2655 1.6 mrg gimple_assign_set_rhs1 (gimple *gs, tree rhs)
2656 1.6 mrg {
2657 1.6 mrg gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2658 1.6 mrg gimple_assign_set_rhs1 (ass, rhs);
2659 1.1 mrg }
2660 1.1 mrg
2661 1.1 mrg
2662 1.1 mrg /* Return the second operand on the RHS of assignment statement GS.
2663 1.1 mrg If GS does not have two operands, NULL is returned instead. */
2664 1.1 mrg
2665 1.1 mrg static inline tree
2666 1.6 mrg gimple_assign_rhs2 (const gassign *gs)
2667 1.1 mrg {
2668 1.1 mrg if (gimple_num_ops (gs) >= 3)
2669 1.6 mrg return gs->op[2];
2670 1.1 mrg else
2671 1.1 mrg return NULL_TREE;
2672 1.1 mrg }
2673 1.1 mrg
2674 1.6 mrg static inline tree
2675 1.6 mrg gimple_assign_rhs2 (const gimple *gs)
2676 1.6 mrg {
2677 1.6 mrg const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2678 1.6 mrg return gimple_assign_rhs2 (ass);
2679 1.6 mrg }
2680 1.6 mrg
2681 1.1 mrg
2682 1.1 mrg /* Return a pointer to the second operand on the RHS of assignment
2683 1.1 mrg statement GS. */
2684 1.1 mrg
2685 1.1 mrg static inline tree *
2686 1.6 mrg gimple_assign_rhs2_ptr (gassign *gs)
2687 1.6 mrg {
2688 1.6 mrg gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2689 1.6 mrg return &gs->op[2];
2690 1.6 mrg }
2691 1.6 mrg
2692 1.6 mrg static inline tree *
2693 1.6 mrg gimple_assign_rhs2_ptr (gimple *gs)
2694 1.1 mrg {
2695 1.6 mrg gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2696 1.6 mrg return gimple_assign_rhs2_ptr (ass);
2697 1.1 mrg }
2698 1.1 mrg
2699 1.1 mrg
2700 1.1 mrg /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2701 1.1 mrg
2702 1.1 mrg static inline void
2703 1.6 mrg gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2704 1.1 mrg {
2705 1.6 mrg gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2706 1.6 mrg gs->op[2] = rhs;
2707 1.6 mrg }
2708 1.1 mrg
2709 1.6 mrg static inline void
2710 1.6 mrg gimple_assign_set_rhs2 (gimple *gs, tree rhs)
2711 1.6 mrg {
2712 1.6 mrg gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2713 1.6 mrg return gimple_assign_set_rhs2 (ass, rhs);
2714 1.1 mrg }
2715 1.1 mrg
2716 1.3 mrg /* Return the third operand on the RHS of assignment statement GS.
2717 1.3 mrg If GS does not have two operands, NULL is returned instead. */
2718 1.3 mrg
2719 1.3 mrg static inline tree
2720 1.6 mrg gimple_assign_rhs3 (const gassign *gs)
2721 1.3 mrg {
2722 1.3 mrg if (gimple_num_ops (gs) >= 4)
2723 1.6 mrg return gs->op[3];
2724 1.3 mrg else
2725 1.3 mrg return NULL_TREE;
2726 1.3 mrg }
2727 1.3 mrg
2728 1.6 mrg static inline tree
2729 1.6 mrg gimple_assign_rhs3 (const gimple *gs)
2730 1.6 mrg {
2731 1.6 mrg const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2732 1.6 mrg return gimple_assign_rhs3 (ass);
2733 1.6 mrg }
2734 1.6 mrg
2735 1.3 mrg /* Return a pointer to the third operand on the RHS of assignment
2736 1.3 mrg statement GS. */
2737 1.3 mrg
2738 1.3 mrg static inline tree *
2739 1.6 mrg gimple_assign_rhs3_ptr (gimple *gs)
2740 1.3 mrg {
2741 1.6 mrg gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2742 1.6 mrg gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2743 1.6 mrg return &ass->op[3];
2744 1.3 mrg }
2745 1.3 mrg
2746 1.3 mrg
2747 1.3 mrg /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2748 1.3 mrg
2749 1.3 mrg static inline void
2750 1.6 mrg gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2751 1.3 mrg {
2752 1.6 mrg gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2753 1.6 mrg gs->op[3] = rhs;
2754 1.6 mrg }
2755 1.3 mrg
2756 1.6 mrg static inline void
2757 1.6 mrg gimple_assign_set_rhs3 (gimple *gs, tree rhs)
2758 1.6 mrg {
2759 1.6 mrg gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2760 1.6 mrg gimple_assign_set_rhs3 (ass, rhs);
2761 1.3 mrg }
2762 1.3 mrg
2763 1.6 mrg
2764 1.5 mrg /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2765 1.5 mrg which expect to see only two operands. */
2766 1.3 mrg
2767 1.3 mrg static inline void
2768 1.3 mrg gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2769 1.3 mrg tree op1, tree op2)
2770 1.3 mrg {
2771 1.5 mrg gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2772 1.3 mrg }
2773 1.3 mrg
2774 1.5 mrg /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2775 1.5 mrg which expect to see only one operands. */
2776 1.3 mrg
2777 1.3 mrg static inline void
2778 1.5 mrg gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2779 1.5 mrg tree op1)
2780 1.3 mrg {
2781 1.5 mrg gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2782 1.3 mrg }
2783 1.3 mrg
2784 1.1 mrg /* Returns true if GS is a nontemporal move. */
2785 1.1 mrg
2786 1.1 mrg static inline bool
2787 1.5 mrg gimple_assign_nontemporal_move_p (const gassign *gs)
2788 1.1 mrg {
2789 1.5 mrg return gs->nontemporal_move;
2790 1.1 mrg }
2791 1.1 mrg
2792 1.1 mrg /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2793 1.1 mrg
2794 1.1 mrg static inline void
2795 1.6 mrg gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2796 1.1 mrg {
2797 1.1 mrg GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2798 1.5 mrg gs->nontemporal_move = nontemporal;
2799 1.1 mrg }
2800 1.1 mrg
2801 1.1 mrg
2802 1.1 mrg /* Return the code of the expression computed on the rhs of assignment
2803 1.1 mrg statement GS. In case that the RHS is a single object, returns the
2804 1.1 mrg tree code of the object. */
2805 1.1 mrg
2806 1.1 mrg static inline enum tree_code
2807 1.6 mrg gimple_assign_rhs_code (const gassign *gs)
2808 1.1 mrg {
2809 1.6 mrg enum tree_code code = (enum tree_code) gs->subcode;
2810 1.3 mrg /* While we initially set subcode to the TREE_CODE of the rhs for
2811 1.3 mrg GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2812 1.3 mrg in sync when we rewrite stmts into SSA form or do SSA propagations. */
2813 1.1 mrg if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2814 1.6 mrg code = TREE_CODE (gs->op[1]);
2815 1.1 mrg
2816 1.1 mrg return code;
2817 1.1 mrg }
2818 1.1 mrg
2819 1.6 mrg static inline enum tree_code
2820 1.6 mrg gimple_assign_rhs_code (const gimple *gs)
2821 1.6 mrg {
2822 1.6 mrg const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2823 1.6 mrg return gimple_assign_rhs_code (ass);
2824 1.6 mrg }
2825 1.6 mrg
2826 1.1 mrg
2827 1.1 mrg /* Set CODE to be the code for the expression computed on the RHS of
2828 1.1 mrg assignment S. */
2829 1.1 mrg
2830 1.1 mrg static inline void
2831 1.6 mrg gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
2832 1.1 mrg {
2833 1.1 mrg GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2834 1.5 mrg s->subcode = code;
2835 1.1 mrg }
2836 1.1 mrg
2837 1.1 mrg
2838 1.1 mrg /* Return the gimple rhs class of the code of the expression computed on
2839 1.1 mrg the rhs of assignment statement GS.
2840 1.1 mrg This will never return GIMPLE_INVALID_RHS. */
2841 1.1 mrg
2842 1.1 mrg static inline enum gimple_rhs_class
2843 1.6 mrg gimple_assign_rhs_class (const gimple *gs)
2844 1.1 mrg {
2845 1.1 mrg return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2846 1.1 mrg }
2847 1.1 mrg
2848 1.3 mrg /* Return true if GS is an assignment with a singleton RHS, i.e.,
2849 1.3 mrg there is no operator associated with the assignment itself.
2850 1.3 mrg Unlike gimple_assign_copy_p, this predicate returns true for
2851 1.3 mrg any RHS operand, including those that perform an operation
2852 1.3 mrg and do not have the semantics of a copy, such as COND_EXPR. */
2853 1.3 mrg
2854 1.3 mrg static inline bool
2855 1.6 mrg gimple_assign_single_p (const gimple *gs)
2856 1.3 mrg {
2857 1.3 mrg return (is_gimple_assign (gs)
2858 1.3 mrg && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2859 1.3 mrg }
2860 1.3 mrg
2861 1.3 mrg /* Return true if GS performs a store to its lhs. */
2862 1.3 mrg
2863 1.3 mrg static inline bool
2864 1.6 mrg gimple_store_p (const gimple *gs)
2865 1.3 mrg {
2866 1.3 mrg tree lhs = gimple_get_lhs (gs);
2867 1.3 mrg return lhs && !is_gimple_reg (lhs);
2868 1.3 mrg }
2869 1.3 mrg
2870 1.3 mrg /* Return true if GS is an assignment that loads from its rhs1. */
2871 1.3 mrg
2872 1.3 mrg static inline bool
2873 1.6 mrg gimple_assign_load_p (const gimple *gs)
2874 1.3 mrg {
2875 1.3 mrg tree rhs;
2876 1.3 mrg if (!gimple_assign_single_p (gs))
2877 1.3 mrg return false;
2878 1.3 mrg rhs = gimple_assign_rhs1 (gs);
2879 1.3 mrg if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2880 1.3 mrg return true;
2881 1.3 mrg rhs = get_base_address (rhs);
2882 1.3 mrg return (DECL_P (rhs)
2883 1.3 mrg || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2884 1.3 mrg }
2885 1.3 mrg
2886 1.1 mrg
2887 1.1 mrg /* Return true if S is a type-cast assignment. */
2888 1.1 mrg
2889 1.1 mrg static inline bool
2890 1.6 mrg gimple_assign_cast_p (const gimple *s)
2891 1.1 mrg {
2892 1.1 mrg if (is_gimple_assign (s))
2893 1.1 mrg {
2894 1.1 mrg enum tree_code sc = gimple_assign_rhs_code (s);
2895 1.1 mrg return CONVERT_EXPR_CODE_P (sc)
2896 1.1 mrg || sc == VIEW_CONVERT_EXPR
2897 1.1 mrg || sc == FIX_TRUNC_EXPR;
2898 1.1 mrg }
2899 1.1 mrg
2900 1.1 mrg return false;
2901 1.1 mrg }
2902 1.1 mrg
2903 1.3 mrg /* Return true if S is a clobber statement. */
2904 1.3 mrg
2905 1.3 mrg static inline bool
2906 1.6 mrg gimple_clobber_p (const gimple *s)
2907 1.3 mrg {
2908 1.3 mrg return gimple_assign_single_p (s)
2909 1.3 mrg && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2910 1.3 mrg }
2911 1.1 mrg
2912 1.1 mrg /* Return true if GS is a GIMPLE_CALL. */
2913 1.1 mrg
2914 1.1 mrg static inline bool
2915 1.6 mrg is_gimple_call (const gimple *gs)
2916 1.1 mrg {
2917 1.1 mrg return gimple_code (gs) == GIMPLE_CALL;
2918 1.1 mrg }
2919 1.1 mrg
2920 1.1 mrg /* Return the LHS of call statement GS. */
2921 1.1 mrg
2922 1.1 mrg static inline tree
2923 1.6 mrg gimple_call_lhs (const gcall *gs)
2924 1.6 mrg {
2925 1.6 mrg return gs->op[0];
2926 1.6 mrg }
2927 1.6 mrg
2928 1.6 mrg static inline tree
2929 1.6 mrg gimple_call_lhs (const gimple *gs)
2930 1.1 mrg {
2931 1.6 mrg const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2932 1.6 mrg return gimple_call_lhs (gc);
2933 1.1 mrg }
2934 1.1 mrg
2935 1.1 mrg
2936 1.1 mrg /* Return a pointer to the LHS of call statement GS. */
2937 1.1 mrg
2938 1.1 mrg static inline tree *
2939 1.6 mrg gimple_call_lhs_ptr (gcall *gs)
2940 1.6 mrg {
2941 1.6 mrg return &gs->op[0];
2942 1.6 mrg }
2943 1.6 mrg
2944 1.6 mrg static inline tree *
2945 1.6 mrg gimple_call_lhs_ptr (gimple *gs)
2946 1.1 mrg {
2947 1.6 mrg gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2948 1.6 mrg return gimple_call_lhs_ptr (gc);
2949 1.1 mrg }
2950 1.1 mrg
2951 1.1 mrg
2952 1.1 mrg /* Set LHS to be the LHS operand of call statement GS. */
2953 1.1 mrg
2954 1.1 mrg static inline void
2955 1.6 mrg gimple_call_set_lhs (gcall *gs, tree lhs)
2956 1.1 mrg {
2957 1.6 mrg gs->op[0] = lhs;
2958 1.1 mrg if (lhs && TREE_CODE (lhs) == SSA_NAME)
2959 1.1 mrg SSA_NAME_DEF_STMT (lhs) = gs;
2960 1.1 mrg }
2961 1.1 mrg
2962 1.6 mrg static inline void
2963 1.6 mrg gimple_call_set_lhs (gimple *gs, tree lhs)
2964 1.6 mrg {
2965 1.6 mrg gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2966 1.6 mrg gimple_call_set_lhs (gc, lhs);
2967 1.6 mrg }
2968 1.6 mrg
2969 1.1 mrg
2970 1.3 mrg /* Return true if call GS calls an internal-only function, as enumerated
2971 1.3 mrg by internal_fn. */
2972 1.3 mrg
2973 1.3 mrg static inline bool
2974 1.6 mrg gimple_call_internal_p (const gcall *gs)
2975 1.3 mrg {
2976 1.5 mrg return (gs->subcode & GF_CALL_INTERNAL) != 0;
2977 1.5 mrg }
2978 1.5 mrg
2979 1.6 mrg static inline bool
2980 1.6 mrg gimple_call_internal_p (const gimple *gs)
2981 1.6 mrg {
2982 1.6 mrg const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2983 1.6 mrg return gimple_call_internal_p (gc);
2984 1.6 mrg }
2985 1.6 mrg
2986 1.10 mrg /* Return true if call GS is marked as nocf_check. */
2987 1.10 mrg
2988 1.10 mrg static inline bool
2989 1.10 mrg gimple_call_nocf_check_p (const gcall *gs)
2990 1.10 mrg {
2991 1.10 mrg return (gs->subcode & GF_CALL_NOCF_CHECK) != 0;
2992 1.10 mrg }
2993 1.10 mrg
2994 1.10 mrg /* Mark statement GS as nocf_check call. */
2995 1.10 mrg
2996 1.10 mrg static inline void
2997 1.10 mrg gimple_call_set_nocf_check (gcall *gs, bool nocf_check)
2998 1.10 mrg {
2999 1.10 mrg if (nocf_check)
3000 1.10 mrg gs->subcode |= GF_CALL_NOCF_CHECK;
3001 1.10 mrg else
3002 1.10 mrg gs->subcode &= ~GF_CALL_NOCF_CHECK;
3003 1.10 mrg }
3004 1.10 mrg
3005 1.3 mrg /* Return the target of internal call GS. */
3006 1.3 mrg
3007 1.3 mrg static inline enum internal_fn
3008 1.6 mrg gimple_call_internal_fn (const gcall *gs)
3009 1.3 mrg {
3010 1.3 mrg gcc_gimple_checking_assert (gimple_call_internal_p (gs));
3011 1.6 mrg return gs->u.internal_fn;
3012 1.6 mrg }
3013 1.6 mrg
3014 1.6 mrg static inline enum internal_fn
3015 1.6 mrg gimple_call_internal_fn (const gimple *gs)
3016 1.6 mrg {
3017 1.6 mrg const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3018 1.6 mrg return gimple_call_internal_fn (gc);
3019 1.6 mrg }
3020 1.6 mrg
3021 1.6 mrg /* Return true, if this internal gimple call is unique. */
3022 1.6 mrg
3023 1.6 mrg static inline bool
3024 1.6 mrg gimple_call_internal_unique_p (const gcall *gs)
3025 1.6 mrg {
3026 1.6 mrg return gimple_call_internal_fn (gs) == IFN_UNIQUE;
3027 1.6 mrg }
3028 1.6 mrg
3029 1.6 mrg static inline bool
3030 1.6 mrg gimple_call_internal_unique_p (const gimple *gs)
3031 1.6 mrg {
3032 1.6 mrg const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3033 1.6 mrg return gimple_call_internal_unique_p (gc);
3034 1.5 mrg }
3035 1.5 mrg
3036 1.8 mrg /* Return true if GS is an internal function FN. */
3037 1.8 mrg
3038 1.8 mrg static inline bool
3039 1.8 mrg gimple_call_internal_p (const gimple *gs, internal_fn fn)
3040 1.8 mrg {
3041 1.8 mrg return (is_gimple_call (gs)
3042 1.8 mrg && gimple_call_internal_p (gs)
3043 1.8 mrg && gimple_call_internal_fn (gs) == fn);
3044 1.8 mrg }
3045 1.8 mrg
3046 1.5 mrg /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
3047 1.5 mrg that could alter control flow. */
3048 1.5 mrg
3049 1.5 mrg static inline void
3050 1.6 mrg gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
3051 1.5 mrg {
3052 1.5 mrg if (ctrl_altering_p)
3053 1.5 mrg s->subcode |= GF_CALL_CTRL_ALTERING;
3054 1.5 mrg else
3055 1.5 mrg s->subcode &= ~GF_CALL_CTRL_ALTERING;
3056 1.5 mrg }
3057 1.5 mrg
3058 1.6 mrg static inline void
3059 1.6 mrg gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
3060 1.6 mrg {
3061 1.6 mrg gcall *gc = GIMPLE_CHECK2<gcall *> (s);
3062 1.6 mrg gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
3063 1.6 mrg }
3064 1.6 mrg
3065 1.5 mrg /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
3066 1.5 mrg flag is set. Such call could not be a stmt in the middle of a bb. */
3067 1.5 mrg
3068 1.5 mrg static inline bool
3069 1.6 mrg gimple_call_ctrl_altering_p (const gcall *gs)
3070 1.5 mrg {
3071 1.5 mrg return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
3072 1.3 mrg }
3073 1.3 mrg
3074 1.6 mrg static inline bool
3075 1.6 mrg gimple_call_ctrl_altering_p (const gimple *gs)
3076 1.6 mrg {
3077 1.6 mrg const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3078 1.6 mrg return gimple_call_ctrl_altering_p (gc);
3079 1.6 mrg }
3080 1.6 mrg
3081 1.3 mrg
3082 1.3 mrg /* Return the function type of the function called by GS. */
3083 1.3 mrg
3084 1.3 mrg static inline tree
3085 1.6 mrg gimple_call_fntype (const gcall *gs)
3086 1.3 mrg {
3087 1.3 mrg if (gimple_call_internal_p (gs))
3088 1.3 mrg return NULL_TREE;
3089 1.6 mrg return gs->u.fntype;
3090 1.6 mrg }
3091 1.6 mrg
3092 1.6 mrg static inline tree
3093 1.6 mrg gimple_call_fntype (const gimple *gs)
3094 1.6 mrg {
3095 1.6 mrg const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
3096 1.6 mrg return gimple_call_fntype (call_stmt);
3097 1.3 mrg }
3098 1.3 mrg
3099 1.5 mrg /* Set the type of the function called by CALL_STMT to FNTYPE. */
3100 1.3 mrg
3101 1.3 mrg static inline void
3102 1.5 mrg gimple_call_set_fntype (gcall *call_stmt, tree fntype)
3103 1.3 mrg {
3104 1.5 mrg gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
3105 1.5 mrg call_stmt->u.fntype = fntype;
3106 1.3 mrg }
3107 1.3 mrg
3108 1.3 mrg
3109 1.1 mrg /* Return the tree node representing the function called by call
3110 1.1 mrg statement GS. */
3111 1.1 mrg
3112 1.1 mrg static inline tree
3113 1.6 mrg gimple_call_fn (const gcall *gs)
3114 1.6 mrg {
3115 1.6 mrg return gs->op[1];
3116 1.6 mrg }
3117 1.6 mrg
3118 1.6 mrg static inline tree
3119 1.6 mrg gimple_call_fn (const gimple *gs)
3120 1.1 mrg {
3121 1.6 mrg const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3122 1.6 mrg return gimple_call_fn (gc);
3123 1.1 mrg }
3124 1.1 mrg
3125 1.1 mrg /* Return a pointer to the tree node representing the function called by call
3126 1.1 mrg statement GS. */
3127 1.1 mrg
3128 1.1 mrg static inline tree *
3129 1.6 mrg gimple_call_fn_ptr (gcall *gs)
3130 1.1 mrg {
3131 1.6 mrg return &gs->op[1];
3132 1.6 mrg }
3133 1.6 mrg
3134 1.6 mrg static inline tree *
3135 1.6 mrg gimple_call_fn_ptr (gimple *gs)
3136 1.6 mrg {
3137 1.6 mrg gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3138 1.6 mrg return gimple_call_fn_ptr (gc);
3139 1.1 mrg }
3140 1.1 mrg
3141 1.1 mrg
3142 1.1 mrg /* Set FN to be the function called by call statement GS. */
3143 1.1 mrg
3144 1.1 mrg static inline void
3145 1.5 mrg gimple_call_set_fn (gcall *gs, tree fn)
3146 1.1 mrg {
3147 1.3 mrg gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3148 1.6 mrg gs->op[1] = fn;
3149 1.1 mrg }
3150 1.1 mrg
3151 1.1 mrg
3152 1.1 mrg /* Set FNDECL to be the function called by call statement GS. */
3153 1.1 mrg
3154 1.1 mrg static inline void
3155 1.6 mrg gimple_call_set_fndecl (gcall *gs, tree decl)
3156 1.1 mrg {
3157 1.3 mrg gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3158 1.6 mrg gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
3159 1.6 mrg build_pointer_type (TREE_TYPE (decl)), decl);
3160 1.6 mrg }
3161 1.6 mrg
3162 1.6 mrg static inline void
3163 1.6 mrg gimple_call_set_fndecl (gimple *gs, tree decl)
3164 1.6 mrg {
3165 1.6 mrg gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3166 1.6 mrg gimple_call_set_fndecl (gc, decl);
3167 1.1 mrg }
3168 1.1 mrg
3169 1.1 mrg
3170 1.5 mrg /* Set internal function FN to be the function called by call statement CALL_STMT. */
3171 1.3 mrg
3172 1.3 mrg static inline void
3173 1.5 mrg gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3174 1.3 mrg {
3175 1.5 mrg gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3176 1.5 mrg call_stmt->u.internal_fn = fn;
3177 1.3 mrg }
3178 1.3 mrg
3179 1.3 mrg
3180 1.1 mrg /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3181 1.1 mrg Otherwise return NULL. This function is analogous to
3182 1.1 mrg get_callee_fndecl in tree land. */
3183 1.1 mrg
3184 1.1 mrg static inline tree
3185 1.6 mrg gimple_call_fndecl (const gcall *gs)
3186 1.1 mrg {
3187 1.3 mrg return gimple_call_addr_fndecl (gimple_call_fn (gs));
3188 1.1 mrg }
3189 1.1 mrg
3190 1.6 mrg static inline tree
3191 1.6 mrg gimple_call_fndecl (const gimple *gs)
3192 1.6 mrg {
3193 1.6 mrg const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3194 1.6 mrg return gimple_call_fndecl (gc);
3195 1.6 mrg }
3196 1.6 mrg
3197 1.1 mrg
3198 1.1 mrg /* Return the type returned by call statement GS. */
3199 1.1 mrg
3200 1.1 mrg static inline tree
3201 1.5 mrg gimple_call_return_type (const gcall *gs)
3202 1.1 mrg {
3203 1.3 mrg tree type = gimple_call_fntype (gs);
3204 1.1 mrg
3205 1.3 mrg if (type == NULL_TREE)
3206 1.3 mrg return TREE_TYPE (gimple_call_lhs (gs));
3207 1.1 mrg
3208 1.3 mrg /* The type returned by a function is the type of its
3209 1.1 mrg function type. */
3210 1.1 mrg return TREE_TYPE (type);
3211 1.1 mrg }
3212 1.1 mrg
3213 1.1 mrg
3214 1.1 mrg /* Return the static chain for call statement GS. */
3215 1.1 mrg
3216 1.1 mrg static inline tree
3217 1.6 mrg gimple_call_chain (const gcall *gs)
3218 1.1 mrg {
3219 1.6 mrg return gs->op[2];
3220 1.6 mrg }
3221 1.6 mrg
3222 1.6 mrg static inline tree
3223 1.6 mrg gimple_call_chain (const gimple *gs)
3224 1.6 mrg {
3225 1.6 mrg const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3226 1.6 mrg return gimple_call_chain (gc);
3227 1.1 mrg }
3228 1.1 mrg
3229 1.1 mrg
3230 1.5 mrg /* Return a pointer to the static chain for call statement CALL_STMT. */
3231 1.1 mrg
3232 1.1 mrg static inline tree *
3233 1.6 mrg gimple_call_chain_ptr (gcall *call_stmt)
3234 1.1 mrg {
3235 1.6 mrg return &call_stmt->op[2];
3236 1.1 mrg }
3237 1.1 mrg
3238 1.5 mrg /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3239 1.1 mrg
3240 1.1 mrg static inline void
3241 1.5 mrg gimple_call_set_chain (gcall *call_stmt, tree chain)
3242 1.1 mrg {
3243 1.6 mrg call_stmt->op[2] = chain;
3244 1.1 mrg }
3245 1.1 mrg
3246 1.1 mrg
3247 1.1 mrg /* Return the number of arguments used by call statement GS. */
3248 1.1 mrg
3249 1.1 mrg static inline unsigned
3250 1.6 mrg gimple_call_num_args (const gcall *gs)
3251 1.1 mrg {
3252 1.6 mrg return gimple_num_ops (gs) - 3;
3253 1.6 mrg }
3254 1.6 mrg
3255 1.6 mrg static inline unsigned
3256 1.6 mrg gimple_call_num_args (const gimple *gs)
3257 1.6 mrg {
3258 1.6 mrg const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3259 1.6 mrg return gimple_call_num_args (gc);
3260 1.1 mrg }
3261 1.1 mrg
3262 1.1 mrg
3263 1.1 mrg /* Return the argument at position INDEX for call statement GS. */
3264 1.1 mrg
3265 1.1 mrg static inline tree
3266 1.6 mrg gimple_call_arg (const gcall *gs, unsigned index)
3267 1.6 mrg {
3268 1.6 mrg gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3269 1.6 mrg return gs->op[index + 3];
3270 1.6 mrg }
3271 1.6 mrg
3272 1.6 mrg static inline tree
3273 1.6 mrg gimple_call_arg (const gimple *gs, unsigned index)
3274 1.1 mrg {
3275 1.6 mrg const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3276 1.6 mrg return gimple_call_arg (gc, index);
3277 1.1 mrg }
3278 1.1 mrg
3279 1.1 mrg
3280 1.1 mrg /* Return a pointer to the argument at position INDEX for call
3281 1.1 mrg statement GS. */
3282 1.1 mrg
3283 1.1 mrg static inline tree *
3284 1.6 mrg gimple_call_arg_ptr (gcall *gs, unsigned index)
3285 1.6 mrg {
3286 1.6 mrg gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3287 1.6 mrg return &gs->op[index + 3];
3288 1.6 mrg }
3289 1.6 mrg
3290 1.6 mrg static inline tree *
3291 1.6 mrg gimple_call_arg_ptr (gimple *gs, unsigned index)
3292 1.1 mrg {
3293 1.6 mrg gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3294 1.6 mrg return gimple_call_arg_ptr (gc, index);
3295 1.1 mrg }
3296 1.1 mrg
3297 1.1 mrg
3298 1.1 mrg /* Set ARG to be the argument at position INDEX for call statement GS. */
3299 1.1 mrg
3300 1.1 mrg static inline void
3301 1.6 mrg gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3302 1.1 mrg {
3303 1.6 mrg gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3304 1.6 mrg gs->op[index + 3] = arg;
3305 1.6 mrg }
3306 1.6 mrg
3307 1.6 mrg static inline void
3308 1.6 mrg gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3309 1.6 mrg {
3310 1.6 mrg gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3311 1.6 mrg gimple_call_set_arg (gc, index, arg);
3312 1.1 mrg }
3313 1.1 mrg
3314 1.1 mrg
3315 1.1 mrg /* If TAIL_P is true, mark call statement S as being a tail call
3316 1.1 mrg (i.e., a call just before the exit of a function). These calls are
3317 1.1 mrg candidate for tail call optimization. */
3318 1.1 mrg
3319 1.1 mrg static inline void
3320 1.5 mrg gimple_call_set_tail (gcall *s, bool tail_p)
3321 1.1 mrg {
3322 1.1 mrg if (tail_p)
3323 1.5 mrg s->subcode |= GF_CALL_TAILCALL;
3324 1.1 mrg else
3325 1.5 mrg s->subcode &= ~GF_CALL_TAILCALL;
3326 1.1 mrg }
3327 1.1 mrg
3328 1.1 mrg
3329 1.1 mrg /* Return true if GIMPLE_CALL S is marked as a tail call. */
3330 1.1 mrg
3331 1.1 mrg static inline bool
3332 1.12 mrg gimple_call_tail_p (const gcall *s)
3333 1.1 mrg {
3334 1.5 mrg return (s->subcode & GF_CALL_TAILCALL) != 0;
3335 1.1 mrg }
3336 1.1 mrg
3337 1.8 mrg /* Mark (or clear) call statement S as requiring tail call optimization. */
3338 1.8 mrg
3339 1.8 mrg static inline void
3340 1.8 mrg gimple_call_set_must_tail (gcall *s, bool must_tail_p)
3341 1.8 mrg {
3342 1.8 mrg if (must_tail_p)
3343 1.8 mrg s->subcode |= GF_CALL_MUST_TAIL_CALL;
3344 1.8 mrg else
3345 1.8 mrg s->subcode &= ~GF_CALL_MUST_TAIL_CALL;
3346 1.8 mrg }
3347 1.8 mrg
3348 1.8 mrg /* Return true if call statement has been marked as requiring
3349 1.8 mrg tail call optimization. */
3350 1.8 mrg
3351 1.8 mrg static inline bool
3352 1.8 mrg gimple_call_must_tail_p (const gcall *s)
3353 1.8 mrg {
3354 1.8 mrg return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0;
3355 1.8 mrg }
3356 1.1 mrg
3357 1.1 mrg /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3358 1.1 mrg slot optimization. This transformation uses the target of the call
3359 1.1 mrg expansion as the return slot for calls that return in memory. */
3360 1.1 mrg
3361 1.1 mrg static inline void
3362 1.5 mrg gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3363 1.1 mrg {
3364 1.1 mrg if (return_slot_opt_p)
3365 1.5 mrg s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3366 1.1 mrg else
3367 1.5 mrg s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3368 1.1 mrg }
3369 1.1 mrg
3370 1.1 mrg
3371 1.1 mrg /* Return true if S is marked for return slot optimization. */
3372 1.1 mrg
3373 1.1 mrg static inline bool
3374 1.12 mrg gimple_call_return_slot_opt_p (const gcall *s)
3375 1.1 mrg {
3376 1.5 mrg return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3377 1.1 mrg }
3378 1.1 mrg
3379 1.1 mrg
3380 1.1 mrg /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3381 1.1 mrg thunk to the thunked-to function. */
3382 1.1 mrg
3383 1.1 mrg static inline void
3384 1.5 mrg gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3385 1.1 mrg {
3386 1.1 mrg if (from_thunk_p)
3387 1.5 mrg s->subcode |= GF_CALL_FROM_THUNK;
3388 1.1 mrg else
3389 1.5 mrg s->subcode &= ~GF_CALL_FROM_THUNK;
3390 1.1 mrg }
3391 1.1 mrg
3392 1.1 mrg
3393 1.1 mrg /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3394 1.1 mrg
3395 1.1 mrg static inline bool
3396 1.5 mrg gimple_call_from_thunk_p (gcall *s)
3397 1.1 mrg {
3398 1.5 mrg return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3399 1.1 mrg }
3400 1.1 mrg
3401 1.1 mrg
3402 1.1 mrg /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3403 1.1 mrg argument pack in its argument list. */
3404 1.1 mrg
3405 1.1 mrg static inline void
3406 1.5 mrg gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3407 1.1 mrg {
3408 1.1 mrg if (pass_arg_pack_p)
3409 1.5 mrg s->subcode |= GF_CALL_VA_ARG_PACK;
3410 1.1 mrg else
3411 1.5 mrg s->subcode &= ~GF_CALL_VA_ARG_PACK;
3412 1.1 mrg }
3413 1.1 mrg
3414 1.1 mrg
3415 1.1 mrg /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3416 1.1 mrg argument pack in its argument list. */
3417 1.1 mrg
3418 1.1 mrg static inline bool
3419 1.12 mrg gimple_call_va_arg_pack_p (const gcall *s)
3420 1.1 mrg {
3421 1.5 mrg return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3422 1.1 mrg }
3423 1.1 mrg
3424 1.1 mrg
3425 1.1 mrg /* Return true if S is a noreturn call. */
3426 1.1 mrg
3427 1.1 mrg static inline bool
3428 1.6 mrg gimple_call_noreturn_p (const gcall *s)
3429 1.1 mrg {
3430 1.1 mrg return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3431 1.1 mrg }
3432 1.1 mrg
3433 1.6 mrg static inline bool
3434 1.6 mrg gimple_call_noreturn_p (const gimple *s)
3435 1.6 mrg {
3436 1.6 mrg const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3437 1.6 mrg return gimple_call_noreturn_p (gc);
3438 1.6 mrg }
3439 1.6 mrg
3440 1.1 mrg
3441 1.1 mrg /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3442 1.1 mrg even if the called function can throw in other cases. */
3443 1.1 mrg
3444 1.1 mrg static inline void
3445 1.5 mrg gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3446 1.1 mrg {
3447 1.1 mrg if (nothrow_p)
3448 1.5 mrg s->subcode |= GF_CALL_NOTHROW;
3449 1.1 mrg else
3450 1.5 mrg s->subcode &= ~GF_CALL_NOTHROW;
3451 1.1 mrg }
3452 1.1 mrg
3453 1.1 mrg /* Return true if S is a nothrow call. */
3454 1.1 mrg
3455 1.1 mrg static inline bool
3456 1.5 mrg gimple_call_nothrow_p (gcall *s)
3457 1.1 mrg {
3458 1.1 mrg return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3459 1.1 mrg }
3460 1.1 mrg
3461 1.3 mrg /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3462 1.3 mrg is known to be emitted for VLA objects. Those are wrapped by
3463 1.3 mrg stack_save/stack_restore calls and hence can't lead to unbounded
3464 1.3 mrg stack growth even when they occur in loops. */
3465 1.3 mrg
3466 1.3 mrg static inline void
3467 1.5 mrg gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3468 1.3 mrg {
3469 1.3 mrg if (for_var)
3470 1.5 mrg s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3471 1.3 mrg else
3472 1.5 mrg s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3473 1.3 mrg }
3474 1.3 mrg
3475 1.3 mrg /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3476 1.3 mrg
3477 1.3 mrg static inline bool
3478 1.5 mrg gimple_call_alloca_for_var_p (gcall *s)
3479 1.3 mrg {
3480 1.5 mrg return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3481 1.3 mrg }
3482 1.1 mrg
3483 1.8 mrg /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
3484 1.8 mrg pointers to nested function are descriptors instead of trampolines. */
3485 1.8 mrg
3486 1.8 mrg static inline void
3487 1.8 mrg gimple_call_set_by_descriptor (gcall *s, bool by_descriptor_p)
3488 1.8 mrg {
3489 1.8 mrg if (by_descriptor_p)
3490 1.8 mrg s->subcode |= GF_CALL_BY_DESCRIPTOR;
3491 1.8 mrg else
3492 1.8 mrg s->subcode &= ~GF_CALL_BY_DESCRIPTOR;
3493 1.8 mrg }
3494 1.8 mrg
3495 1.8 mrg /* Return true if S is a by-descriptor call. */
3496 1.8 mrg
3497 1.8 mrg static inline bool
3498 1.8 mrg gimple_call_by_descriptor_p (gcall *s)
3499 1.8 mrg {
3500 1.8 mrg return (s->subcode & GF_CALL_BY_DESCRIPTOR) != 0;
3501 1.8 mrg }
3502 1.8 mrg
3503 1.1 mrg /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3504 1.1 mrg
3505 1.1 mrg static inline void
3506 1.5 mrg gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3507 1.1 mrg {
3508 1.5 mrg dest_call->subcode = orig_call->subcode;
3509 1.1 mrg }
3510 1.1 mrg
3511 1.1 mrg
3512 1.3 mrg /* Return a pointer to the points-to solution for the set of call-used
3513 1.5 mrg variables of the call CALL_STMT. */
3514 1.3 mrg
3515 1.3 mrg static inline struct pt_solution *
3516 1.5 mrg gimple_call_use_set (gcall *call_stmt)
3517 1.3 mrg {
3518 1.5 mrg return &call_stmt->call_used;
3519 1.3 mrg }
3520 1.3 mrg
3521 1.12 mrg /* As above, but const. */
3522 1.12 mrg
3523 1.12 mrg static inline const pt_solution *
3524 1.12 mrg gimple_call_use_set (const gcall *call_stmt)
3525 1.12 mrg {
3526 1.12 mrg return &call_stmt->call_used;
3527 1.12 mrg }
3528 1.3 mrg
3529 1.3 mrg /* Return a pointer to the points-to solution for the set of call-used
3530 1.5 mrg variables of the call CALL_STMT. */
3531 1.3 mrg
3532 1.3 mrg static inline struct pt_solution *
3533 1.5 mrg gimple_call_clobber_set (gcall *call_stmt)
3534 1.3 mrg {
3535 1.5 mrg return &call_stmt->call_clobbered;
3536 1.3 mrg }
3537 1.3 mrg
3538 1.12 mrg /* As above, but const. */
3539 1.12 mrg
3540 1.12 mrg static inline const pt_solution *
3541 1.12 mrg gimple_call_clobber_set (const gcall *call_stmt)
3542 1.12 mrg {
3543 1.12 mrg return &call_stmt->call_clobbered;
3544 1.12 mrg }
3545 1.12 mrg
3546 1.3 mrg
3547 1.1 mrg /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3548 1.1 mrg non-NULL lhs. */
3549 1.1 mrg
3550 1.1 mrg static inline bool
3551 1.12 mrg gimple_has_lhs (const gimple *stmt)
3552 1.1 mrg {
3553 1.6 mrg if (is_gimple_assign (stmt))
3554 1.6 mrg return true;
3555 1.12 mrg if (const gcall *call = dyn_cast <const gcall *> (stmt))
3556 1.6 mrg return gimple_call_lhs (call) != NULL_TREE;
3557 1.6 mrg return false;
3558 1.1 mrg }
3559 1.1 mrg
3560 1.1 mrg
3561 1.1 mrg /* Return the code of the predicate computed by conditional statement GS. */
3562 1.1 mrg
3563 1.1 mrg static inline enum tree_code
3564 1.6 mrg gimple_cond_code (const gcond *gs)
3565 1.1 mrg {
3566 1.5 mrg return (enum tree_code) gs->subcode;
3567 1.1 mrg }
3568 1.1 mrg
3569 1.6 mrg static inline enum tree_code
3570 1.6 mrg gimple_cond_code (const gimple *gs)
3571 1.6 mrg {
3572 1.6 mrg const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3573 1.6 mrg return gimple_cond_code (gc);
3574 1.6 mrg }
3575 1.6 mrg
3576 1.1 mrg
3577 1.1 mrg /* Set CODE to be the predicate code for the conditional statement GS. */
3578 1.1 mrg
3579 1.1 mrg static inline void
3580 1.5 mrg gimple_cond_set_code (gcond *gs, enum tree_code code)
3581 1.1 mrg {
3582 1.5 mrg gs->subcode = code;
3583 1.1 mrg }
3584 1.1 mrg
3585 1.1 mrg
3586 1.1 mrg /* Return the LHS of the predicate computed by conditional statement GS. */
3587 1.1 mrg
3588 1.1 mrg static inline tree
3589 1.6 mrg gimple_cond_lhs (const gcond *gs)
3590 1.6 mrg {
3591 1.6 mrg return gs->op[0];
3592 1.6 mrg }
3593 1.6 mrg
3594 1.6 mrg static inline tree
3595 1.6 mrg gimple_cond_lhs (const gimple *gs)
3596 1.1 mrg {
3597 1.6 mrg const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3598 1.6 mrg return gimple_cond_lhs (gc);
3599 1.1 mrg }
3600 1.1 mrg
3601 1.1 mrg /* Return the pointer to the LHS of the predicate computed by conditional
3602 1.1 mrg statement GS. */
3603 1.1 mrg
3604 1.1 mrg static inline tree *
3605 1.6 mrg gimple_cond_lhs_ptr (gcond *gs)
3606 1.1 mrg {
3607 1.6 mrg return &gs->op[0];
3608 1.1 mrg }
3609 1.1 mrg
3610 1.1 mrg /* Set LHS to be the LHS operand of the predicate computed by
3611 1.1 mrg conditional statement GS. */
3612 1.1 mrg
3613 1.1 mrg static inline void
3614 1.5 mrg gimple_cond_set_lhs (gcond *gs, tree lhs)
3615 1.1 mrg {
3616 1.6 mrg gs->op[0] = lhs;
3617 1.1 mrg }
3618 1.1 mrg
3619 1.1 mrg
3620 1.1 mrg /* Return the RHS operand of the predicate computed by conditional GS. */
3621 1.1 mrg
3622 1.1 mrg static inline tree
3623 1.6 mrg gimple_cond_rhs (const gcond *gs)
3624 1.6 mrg {
3625 1.6 mrg return gs->op[1];
3626 1.6 mrg }
3627 1.6 mrg
3628 1.6 mrg static inline tree
3629 1.6 mrg gimple_cond_rhs (const gimple *gs)
3630 1.1 mrg {
3631 1.6 mrg const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3632 1.6 mrg return gimple_cond_rhs (gc);
3633 1.1 mrg }
3634 1.1 mrg
3635 1.1 mrg /* Return the pointer to the RHS operand of the predicate computed by
3636 1.1 mrg conditional GS. */
3637 1.1 mrg
3638 1.1 mrg static inline tree *
3639 1.6 mrg gimple_cond_rhs_ptr (gcond *gs)
3640 1.1 mrg {
3641 1.6 mrg return &gs->op[1];
3642 1.1 mrg }
3643 1.1 mrg
3644 1.1 mrg
3645 1.1 mrg /* Set RHS to be the RHS operand of the predicate computed by
3646 1.1 mrg conditional statement GS. */
3647 1.1 mrg
3648 1.1 mrg static inline void
3649 1.5 mrg gimple_cond_set_rhs (gcond *gs, tree rhs)
3650 1.1 mrg {
3651 1.6 mrg gs->op[1] = rhs;
3652 1.1 mrg }
3653 1.1 mrg
3654 1.1 mrg
3655 1.1 mrg /* Return the label used by conditional statement GS when its
3656 1.1 mrg predicate evaluates to true. */
3657 1.1 mrg
3658 1.1 mrg static inline tree
3659 1.5 mrg gimple_cond_true_label (const gcond *gs)
3660 1.1 mrg {
3661 1.6 mrg return gs->op[2];
3662 1.1 mrg }
3663 1.1 mrg
3664 1.1 mrg
3665 1.1 mrg /* Set LABEL to be the label used by conditional statement GS when its
3666 1.1 mrg predicate evaluates to true. */
3667 1.1 mrg
3668 1.1 mrg static inline void
3669 1.5 mrg gimple_cond_set_true_label (gcond *gs, tree label)
3670 1.1 mrg {
3671 1.6 mrg gs->op[2] = label;
3672 1.1 mrg }
3673 1.1 mrg
3674 1.1 mrg
3675 1.1 mrg /* Set LABEL to be the label used by conditional statement GS when its
3676 1.1 mrg predicate evaluates to false. */
3677 1.1 mrg
3678 1.1 mrg static inline void
3679 1.5 mrg gimple_cond_set_false_label (gcond *gs, tree label)
3680 1.1 mrg {
3681 1.6 mrg gs->op[3] = label;
3682 1.1 mrg }
3683 1.1 mrg
3684 1.1 mrg
3685 1.1 mrg /* Return the label used by conditional statement GS when its
3686 1.1 mrg predicate evaluates to false. */
3687 1.1 mrg
3688 1.1 mrg static inline tree
3689 1.5 mrg gimple_cond_false_label (const gcond *gs)
3690 1.1 mrg {
3691 1.6 mrg return gs->op[3];
3692 1.1 mrg }
3693 1.1 mrg
3694 1.1 mrg
3695 1.1 mrg /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3696 1.1 mrg
3697 1.1 mrg static inline void
3698 1.5 mrg gimple_cond_make_false (gcond *gs)
3699 1.1 mrg {
3700 1.6 mrg gimple_cond_set_lhs (gs, boolean_false_node);
3701 1.1 mrg gimple_cond_set_rhs (gs, boolean_false_node);
3702 1.6 mrg gs->subcode = NE_EXPR;
3703 1.1 mrg }
3704 1.1 mrg
3705 1.1 mrg
3706 1.1 mrg /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3707 1.1 mrg
3708 1.1 mrg static inline void
3709 1.5 mrg gimple_cond_make_true (gcond *gs)
3710 1.1 mrg {
3711 1.1 mrg gimple_cond_set_lhs (gs, boolean_true_node);
3712 1.6 mrg gimple_cond_set_rhs (gs, boolean_false_node);
3713 1.6 mrg gs->subcode = NE_EXPR;
3714 1.1 mrg }
3715 1.1 mrg
3716 1.1 mrg /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3717 1.1 mrg 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3718 1.1 mrg
3719 1.1 mrg static inline bool
3720 1.5 mrg gimple_cond_true_p (const gcond *gs)
3721 1.1 mrg {
3722 1.1 mrg tree lhs = gimple_cond_lhs (gs);
3723 1.1 mrg tree rhs = gimple_cond_rhs (gs);
3724 1.1 mrg enum tree_code code = gimple_cond_code (gs);
3725 1.1 mrg
3726 1.1 mrg if (lhs != boolean_true_node && lhs != boolean_false_node)
3727 1.1 mrg return false;
3728 1.1 mrg
3729 1.1 mrg if (rhs != boolean_true_node && rhs != boolean_false_node)
3730 1.1 mrg return false;
3731 1.1 mrg
3732 1.1 mrg if (code == NE_EXPR && lhs != rhs)
3733 1.1 mrg return true;
3734 1.1 mrg
3735 1.1 mrg if (code == EQ_EXPR && lhs == rhs)
3736 1.1 mrg return true;
3737 1.1 mrg
3738 1.1 mrg return false;
3739 1.1 mrg }
3740 1.1 mrg
3741 1.1 mrg /* Check if conditional statement GS is of the form 'if (1 != 1)',
3742 1.1 mrg 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3743 1.1 mrg
3744 1.1 mrg static inline bool
3745 1.5 mrg gimple_cond_false_p (const gcond *gs)
3746 1.1 mrg {
3747 1.1 mrg tree lhs = gimple_cond_lhs (gs);
3748 1.1 mrg tree rhs = gimple_cond_rhs (gs);
3749 1.1 mrg enum tree_code code = gimple_cond_code (gs);
3750 1.1 mrg
3751 1.1 mrg if (lhs != boolean_true_node && lhs != boolean_false_node)
3752 1.1 mrg return false;
3753 1.1 mrg
3754 1.1 mrg if (rhs != boolean_true_node && rhs != boolean_false_node)
3755 1.1 mrg return false;
3756 1.1 mrg
3757 1.1 mrg if (code == NE_EXPR && lhs == rhs)
3758 1.1 mrg return true;
3759 1.1 mrg
3760 1.1 mrg if (code == EQ_EXPR && lhs != rhs)
3761 1.1 mrg return true;
3762 1.1 mrg
3763 1.1 mrg return false;
3764 1.1 mrg }
3765 1.1 mrg
3766 1.1 mrg /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3767 1.1 mrg
3768 1.1 mrg static inline void
3769 1.5 mrg gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3770 1.5 mrg tree rhs)
3771 1.1 mrg {
3772 1.1 mrg gimple_cond_set_code (stmt, code);
3773 1.1 mrg gimple_cond_set_lhs (stmt, lhs);
3774 1.1 mrg gimple_cond_set_rhs (stmt, rhs);
3775 1.1 mrg }
3776 1.1 mrg
3777 1.1 mrg /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3778 1.1 mrg
3779 1.1 mrg static inline tree
3780 1.5 mrg gimple_label_label (const glabel *gs)
3781 1.1 mrg {
3782 1.6 mrg return gs->op[0];
3783 1.1 mrg }
3784 1.1 mrg
3785 1.1 mrg
3786 1.1 mrg /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3787 1.1 mrg GS. */
3788 1.1 mrg
3789 1.1 mrg static inline void
3790 1.5 mrg gimple_label_set_label (glabel *gs, tree label)
3791 1.1 mrg {
3792 1.6 mrg gs->op[0] = label;
3793 1.1 mrg }
3794 1.1 mrg
3795 1.1 mrg
3796 1.1 mrg /* Return the destination of the unconditional jump GS. */
3797 1.1 mrg
3798 1.1 mrg static inline tree
3799 1.6 mrg gimple_goto_dest (const gimple *gs)
3800 1.1 mrg {
3801 1.1 mrg GIMPLE_CHECK (gs, GIMPLE_GOTO);
3802 1.1 mrg return gimple_op (gs, 0);
3803 1.1 mrg }
3804 1.1 mrg
3805 1.1 mrg
3806 1.1 mrg /* Set DEST to be the destination of the unconditonal jump GS. */
3807 1.1 mrg
3808 1.1 mrg static inline void
3809 1.5 mrg gimple_goto_set_dest (ggoto *gs, tree dest)
3810 1.1 mrg {
3811 1.6 mrg gs->op[0] = dest;
3812 1.1 mrg }
3813 1.1 mrg
3814 1.1 mrg
3815 1.1 mrg /* Return the variables declared in the GIMPLE_BIND statement GS. */
3816 1.1 mrg
3817 1.1 mrg static inline tree
3818 1.5 mrg gimple_bind_vars (const gbind *bind_stmt)
3819 1.1 mrg {
3820 1.5 mrg return bind_stmt->vars;
3821 1.1 mrg }
3822 1.1 mrg
3823 1.1 mrg
3824 1.1 mrg /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3825 1.1 mrg statement GS. */
3826 1.1 mrg
3827 1.1 mrg static inline void
3828 1.5 mrg gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3829 1.1 mrg {
3830 1.5 mrg bind_stmt->vars = vars;
3831 1.1 mrg }
3832 1.1 mrg
3833 1.1 mrg
3834 1.1 mrg /* Append VARS to the set of variables declared in the GIMPLE_BIND
3835 1.1 mrg statement GS. */
3836 1.1 mrg
3837 1.1 mrg static inline void
3838 1.5 mrg gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3839 1.1 mrg {
3840 1.5 mrg bind_stmt->vars = chainon (bind_stmt->vars, vars);
3841 1.1 mrg }
3842 1.1 mrg
3843 1.1 mrg
3844 1.3 mrg static inline gimple_seq *
3845 1.5 mrg gimple_bind_body_ptr (gbind *bind_stmt)
3846 1.3 mrg {
3847 1.5 mrg return &bind_stmt->body;
3848 1.3 mrg }
3849 1.3 mrg
3850 1.1 mrg /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3851 1.1 mrg
3852 1.1 mrg static inline gimple_seq
3853 1.12 mrg gimple_bind_body (const gbind *gs)
3854 1.1 mrg {
3855 1.12 mrg return *gimple_bind_body_ptr (const_cast <gbind *> (gs));
3856 1.1 mrg }
3857 1.1 mrg
3858 1.1 mrg
3859 1.1 mrg /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3860 1.1 mrg statement GS. */
3861 1.1 mrg
3862 1.1 mrg static inline void
3863 1.5 mrg gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3864 1.1 mrg {
3865 1.5 mrg bind_stmt->body = seq;
3866 1.1 mrg }
3867 1.1 mrg
3868 1.1 mrg
3869 1.1 mrg /* Append a statement to the end of a GIMPLE_BIND's body. */
3870 1.1 mrg
3871 1.1 mrg static inline void
3872 1.6 mrg gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
3873 1.1 mrg {
3874 1.5 mrg gimple_seq_add_stmt (&bind_stmt->body, stmt);
3875 1.1 mrg }
3876 1.1 mrg
3877 1.1 mrg
3878 1.1 mrg /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3879 1.1 mrg
3880 1.1 mrg static inline void
3881 1.5 mrg gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3882 1.1 mrg {
3883 1.5 mrg gimple_seq_add_seq (&bind_stmt->body, seq);
3884 1.1 mrg }
3885 1.1 mrg
3886 1.1 mrg
3887 1.1 mrg /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3888 1.1 mrg GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3889 1.1 mrg
3890 1.1 mrg static inline tree
3891 1.5 mrg gimple_bind_block (const gbind *bind_stmt)
3892 1.1 mrg {
3893 1.5 mrg return bind_stmt->block;
3894 1.1 mrg }
3895 1.1 mrg
3896 1.1 mrg
3897 1.1 mrg /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3898 1.1 mrg statement GS. */
3899 1.1 mrg
3900 1.1 mrg static inline void
3901 1.5 mrg gimple_bind_set_block (gbind *bind_stmt, tree block)
3902 1.1 mrg {
3903 1.3 mrg gcc_gimple_checking_assert (block == NULL_TREE
3904 1.3 mrg || TREE_CODE (block) == BLOCK);
3905 1.5 mrg bind_stmt->block = block;
3906 1.1 mrg }
3907 1.1 mrg
3908 1.1 mrg
3909 1.5 mrg /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3910 1.1 mrg
3911 1.1 mrg static inline unsigned
3912 1.5 mrg gimple_asm_ninputs (const gasm *asm_stmt)
3913 1.1 mrg {
3914 1.5 mrg return asm_stmt->ni;
3915 1.1 mrg }
3916 1.1 mrg
3917 1.1 mrg
3918 1.5 mrg /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3919 1.1 mrg
3920 1.1 mrg static inline unsigned
3921 1.5 mrg gimple_asm_noutputs (const gasm *asm_stmt)
3922 1.1 mrg {
3923 1.5 mrg return asm_stmt->no;
3924 1.1 mrg }
3925 1.1 mrg
3926 1.1 mrg
3927 1.5 mrg /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3928 1.1 mrg
3929 1.1 mrg static inline unsigned
3930 1.5 mrg gimple_asm_nclobbers (const gasm *asm_stmt)
3931 1.1 mrg {
3932 1.5 mrg return asm_stmt->nc;
3933 1.1 mrg }
3934 1.1 mrg
3935 1.5 mrg /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3936 1.1 mrg
3937 1.1 mrg static inline unsigned
3938 1.5 mrg gimple_asm_nlabels (const gasm *asm_stmt)
3939 1.1 mrg {
3940 1.5 mrg return asm_stmt->nl;
3941 1.1 mrg }
3942 1.1 mrg
3943 1.5 mrg /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3944 1.1 mrg
3945 1.1 mrg static inline tree
3946 1.5 mrg gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
3947 1.1 mrg {
3948 1.5 mrg gcc_gimple_checking_assert (index < asm_stmt->ni);
3949 1.6 mrg return asm_stmt->op[index + asm_stmt->no];
3950 1.1 mrg }
3951 1.1 mrg
3952 1.5 mrg /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3953 1.1 mrg
3954 1.1 mrg static inline void
3955 1.5 mrg gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
3956 1.1 mrg {
3957 1.5 mrg gcc_gimple_checking_assert (index < asm_stmt->ni
3958 1.3 mrg && TREE_CODE (in_op) == TREE_LIST);
3959 1.6 mrg asm_stmt->op[index + asm_stmt->no] = in_op;
3960 1.1 mrg }
3961 1.1 mrg
3962 1.1 mrg
3963 1.5 mrg /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3964 1.1 mrg
3965 1.1 mrg static inline tree
3966 1.5 mrg gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
3967 1.1 mrg {
3968 1.5 mrg gcc_gimple_checking_assert (index < asm_stmt->no);
3969 1.6 mrg return asm_stmt->op[index];
3970 1.1 mrg }
3971 1.1 mrg
3972 1.5 mrg /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3973 1.1 mrg
3974 1.1 mrg static inline void
3975 1.5 mrg gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
3976 1.1 mrg {
3977 1.5 mrg gcc_gimple_checking_assert (index < asm_stmt->no
3978 1.3 mrg && TREE_CODE (out_op) == TREE_LIST);
3979 1.6 mrg asm_stmt->op[index] = out_op;
3980 1.1 mrg }
3981 1.1 mrg
3982 1.1 mrg
3983 1.5 mrg /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3984 1.1 mrg
3985 1.1 mrg static inline tree
3986 1.5 mrg gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
3987 1.1 mrg {
3988 1.5 mrg gcc_gimple_checking_assert (index < asm_stmt->nc);
3989 1.6 mrg return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
3990 1.1 mrg }
3991 1.1 mrg
3992 1.1 mrg
3993 1.5 mrg /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3994 1.1 mrg
3995 1.1 mrg static inline void
3996 1.5 mrg gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
3997 1.1 mrg {
3998 1.5 mrg gcc_gimple_checking_assert (index < asm_stmt->nc
3999 1.3 mrg && TREE_CODE (clobber_op) == TREE_LIST);
4000 1.6 mrg asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
4001 1.1 mrg }
4002 1.1 mrg
4003 1.5 mrg /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
4004 1.1 mrg
4005 1.1 mrg static inline tree
4006 1.5 mrg gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
4007 1.1 mrg {
4008 1.5 mrg gcc_gimple_checking_assert (index < asm_stmt->nl);
4009 1.6 mrg return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc];
4010 1.1 mrg }
4011 1.1 mrg
4012 1.5 mrg /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
4013 1.1 mrg
4014 1.1 mrg static inline void
4015 1.5 mrg gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
4016 1.1 mrg {
4017 1.5 mrg gcc_gimple_checking_assert (index < asm_stmt->nl
4018 1.3 mrg && TREE_CODE (label_op) == TREE_LIST);
4019 1.6 mrg asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op;
4020 1.1 mrg }
4021 1.1 mrg
4022 1.1 mrg /* Return the string representing the assembly instruction in
4023 1.5 mrg GIMPLE_ASM ASM_STMT. */
4024 1.1 mrg
4025 1.1 mrg static inline const char *
4026 1.5 mrg gimple_asm_string (const gasm *asm_stmt)
4027 1.1 mrg {
4028 1.5 mrg return asm_stmt->string;
4029 1.1 mrg }
4030 1.1 mrg
4031 1.1 mrg
4032 1.9 mrg /* Return true if ASM_STMT is marked volatile. */
4033 1.1 mrg
4034 1.1 mrg static inline bool
4035 1.5 mrg gimple_asm_volatile_p (const gasm *asm_stmt)
4036 1.1 mrg {
4037 1.5 mrg return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
4038 1.1 mrg }
4039 1.1 mrg
4040 1.1 mrg
4041 1.9 mrg /* If VOLATILE_P is true, mark asm statement ASM_STMT as volatile. */
4042 1.1 mrg
4043 1.1 mrg static inline void
4044 1.5 mrg gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
4045 1.1 mrg {
4046 1.1 mrg if (volatile_p)
4047 1.5 mrg asm_stmt->subcode |= GF_ASM_VOLATILE;
4048 1.1 mrg else
4049 1.5 mrg asm_stmt->subcode &= ~GF_ASM_VOLATILE;
4050 1.1 mrg }
4051 1.1 mrg
4052 1.1 mrg
4053 1.9 mrg /* Return true if ASM_STMT is marked inline. */
4054 1.9 mrg
4055 1.9 mrg static inline bool
4056 1.9 mrg gimple_asm_inline_p (const gasm *asm_stmt)
4057 1.9 mrg {
4058 1.9 mrg return (asm_stmt->subcode & GF_ASM_INLINE) != 0;
4059 1.9 mrg }
4060 1.9 mrg
4061 1.9 mrg
4062 1.9 mrg /* If INLINE_P is true, mark asm statement ASM_STMT as inline. */
4063 1.9 mrg
4064 1.9 mrg static inline void
4065 1.9 mrg gimple_asm_set_inline (gasm *asm_stmt, bool inline_p)
4066 1.9 mrg {
4067 1.9 mrg if (inline_p)
4068 1.9 mrg asm_stmt->subcode |= GF_ASM_INLINE;
4069 1.9 mrg else
4070 1.9 mrg asm_stmt->subcode &= ~GF_ASM_INLINE;
4071 1.9 mrg }
4072 1.9 mrg
4073 1.9 mrg
4074 1.5 mrg /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
4075 1.1 mrg
4076 1.1 mrg static inline void
4077 1.5 mrg gimple_asm_set_input (gasm *asm_stmt, bool input_p)
4078 1.1 mrg {
4079 1.1 mrg if (input_p)
4080 1.5 mrg asm_stmt->subcode |= GF_ASM_INPUT;
4081 1.1 mrg else
4082 1.5 mrg asm_stmt->subcode &= ~GF_ASM_INPUT;
4083 1.1 mrg }
4084 1.1 mrg
4085 1.1 mrg
4086 1.5 mrg /* Return true if asm ASM_STMT is an ASM_INPUT. */
4087 1.1 mrg
4088 1.1 mrg static inline bool
4089 1.5 mrg gimple_asm_input_p (const gasm *asm_stmt)
4090 1.1 mrg {
4091 1.5 mrg return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
4092 1.1 mrg }
4093 1.1 mrg
4094 1.1 mrg
4095 1.5 mrg /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4096 1.1 mrg
4097 1.1 mrg static inline tree
4098 1.5 mrg gimple_catch_types (const gcatch *catch_stmt)
4099 1.1 mrg {
4100 1.5 mrg return catch_stmt->types;
4101 1.1 mrg }
4102 1.1 mrg
4103 1.1 mrg
4104 1.5 mrg /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4105 1.1 mrg
4106 1.1 mrg static inline tree *
4107 1.5 mrg gimple_catch_types_ptr (gcatch *catch_stmt)
4108 1.1 mrg {
4109 1.5 mrg return &catch_stmt->types;
4110 1.1 mrg }
4111 1.1 mrg
4112 1.1 mrg
4113 1.3 mrg /* Return a pointer to the GIMPLE sequence representing the body of
4114 1.5 mrg the handler of GIMPLE_CATCH statement CATCH_STMT. */
4115 1.1 mrg
4116 1.3 mrg static inline gimple_seq *
4117 1.5 mrg gimple_catch_handler_ptr (gcatch *catch_stmt)
4118 1.1 mrg {
4119 1.5 mrg return &catch_stmt->handler;
4120 1.1 mrg }
4121 1.1 mrg
4122 1.1 mrg
4123 1.3 mrg /* Return the GIMPLE sequence representing the body of the handler of
4124 1.5 mrg GIMPLE_CATCH statement CATCH_STMT. */
4125 1.1 mrg
4126 1.3 mrg static inline gimple_seq
4127 1.12 mrg gimple_catch_handler (const gcatch *catch_stmt)
4128 1.1 mrg {
4129 1.12 mrg return *gimple_catch_handler_ptr (const_cast <gcatch *> (catch_stmt));
4130 1.1 mrg }
4131 1.1 mrg
4132 1.1 mrg
4133 1.5 mrg /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
4134 1.1 mrg
4135 1.1 mrg static inline void
4136 1.5 mrg gimple_catch_set_types (gcatch *catch_stmt, tree t)
4137 1.1 mrg {
4138 1.5 mrg catch_stmt->types = t;
4139 1.1 mrg }
4140 1.1 mrg
4141 1.1 mrg
4142 1.5 mrg /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
4143 1.1 mrg
4144 1.1 mrg static inline void
4145 1.5 mrg gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
4146 1.1 mrg {
4147 1.5 mrg catch_stmt->handler = handler;
4148 1.1 mrg }
4149 1.1 mrg
4150 1.1 mrg
4151 1.1 mrg /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
4152 1.1 mrg
4153 1.1 mrg static inline tree
4154 1.6 mrg gimple_eh_filter_types (const gimple *gs)
4155 1.1 mrg {
4156 1.5 mrg const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
4157 1.5 mrg return eh_filter_stmt->types;
4158 1.1 mrg }
4159 1.1 mrg
4160 1.1 mrg
4161 1.1 mrg /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
4162 1.1 mrg GS. */
4163 1.1 mrg
4164 1.1 mrg static inline tree *
4165 1.6 mrg gimple_eh_filter_types_ptr (gimple *gs)
4166 1.1 mrg {
4167 1.5 mrg geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4168 1.5 mrg return &eh_filter_stmt->types;
4169 1.1 mrg }
4170 1.1 mrg
4171 1.1 mrg
4172 1.3 mrg /* Return a pointer to the sequence of statement to execute when
4173 1.3 mrg GIMPLE_EH_FILTER statement fails. */
4174 1.3 mrg
4175 1.3 mrg static inline gimple_seq *
4176 1.6 mrg gimple_eh_filter_failure_ptr (gimple *gs)
4177 1.3 mrg {
4178 1.5 mrg geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4179 1.5 mrg return &eh_filter_stmt->failure;
4180 1.3 mrg }
4181 1.3 mrg
4182 1.3 mrg
4183 1.1 mrg /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4184 1.1 mrg statement fails. */
4185 1.1 mrg
4186 1.1 mrg static inline gimple_seq
4187 1.12 mrg gimple_eh_filter_failure (const gimple *gs)
4188 1.1 mrg {
4189 1.12 mrg return *gimple_eh_filter_failure_ptr (const_cast <gimple *> (gs));
4190 1.1 mrg }
4191 1.1 mrg
4192 1.1 mrg
4193 1.5 mrg /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4194 1.5 mrg EH_FILTER_STMT. */
4195 1.1 mrg
4196 1.1 mrg static inline void
4197 1.5 mrg gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
4198 1.1 mrg {
4199 1.5 mrg eh_filter_stmt->types = types;
4200 1.1 mrg }
4201 1.1 mrg
4202 1.1 mrg
4203 1.1 mrg /* Set FAILURE to be the sequence of statements to execute on failure
4204 1.5 mrg for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4205 1.1 mrg
4206 1.1 mrg static inline void
4207 1.5 mrg gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
4208 1.5 mrg gimple_seq failure)
4209 1.1 mrg {
4210 1.5 mrg eh_filter_stmt->failure = failure;
4211 1.1 mrg }
4212 1.1 mrg
4213 1.1 mrg /* Get the function decl to be called by the MUST_NOT_THROW region. */
4214 1.1 mrg
4215 1.1 mrg static inline tree
4216 1.12 mrg gimple_eh_must_not_throw_fndecl (const geh_mnt *eh_mnt_stmt)
4217 1.1 mrg {
4218 1.5 mrg return eh_mnt_stmt->fndecl;
4219 1.1 mrg }
4220 1.1 mrg
4221 1.1 mrg /* Set the function decl to be called by GS to DECL. */
4222 1.1 mrg
4223 1.1 mrg static inline void
4224 1.5 mrg gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4225 1.5 mrg tree decl)
4226 1.1 mrg {
4227 1.5 mrg eh_mnt_stmt->fndecl = decl;
4228 1.1 mrg }
4229 1.1 mrg
4230 1.3 mrg /* GIMPLE_EH_ELSE accessors. */
4231 1.3 mrg
4232 1.3 mrg static inline gimple_seq *
4233 1.5 mrg gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4234 1.3 mrg {
4235 1.5 mrg return &eh_else_stmt->n_body;
4236 1.3 mrg }
4237 1.3 mrg
4238 1.3 mrg static inline gimple_seq
4239 1.12 mrg gimple_eh_else_n_body (const geh_else *eh_else_stmt)
4240 1.3 mrg {
4241 1.12 mrg return *gimple_eh_else_n_body_ptr (const_cast <geh_else *> (eh_else_stmt));
4242 1.3 mrg }
4243 1.3 mrg
4244 1.3 mrg static inline gimple_seq *
4245 1.5 mrg gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4246 1.3 mrg {
4247 1.5 mrg return &eh_else_stmt->e_body;
4248 1.3 mrg }
4249 1.3 mrg
4250 1.3 mrg static inline gimple_seq
4251 1.12 mrg gimple_eh_else_e_body (const geh_else *eh_else_stmt)
4252 1.3 mrg {
4253 1.12 mrg return *gimple_eh_else_e_body_ptr (const_cast <geh_else *> (eh_else_stmt));
4254 1.3 mrg }
4255 1.3 mrg
4256 1.3 mrg static inline void
4257 1.5 mrg gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4258 1.3 mrg {
4259 1.5 mrg eh_else_stmt->n_body = seq;
4260 1.3 mrg }
4261 1.3 mrg
4262 1.3 mrg static inline void
4263 1.5 mrg gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4264 1.3 mrg {
4265 1.5 mrg eh_else_stmt->e_body = seq;
4266 1.3 mrg }
4267 1.1 mrg
4268 1.1 mrg /* GIMPLE_TRY accessors. */
4269 1.1 mrg
4270 1.1 mrg /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4271 1.1 mrg either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4272 1.1 mrg
4273 1.1 mrg static inline enum gimple_try_flags
4274 1.6 mrg gimple_try_kind (const gimple *gs)
4275 1.1 mrg {
4276 1.1 mrg GIMPLE_CHECK (gs, GIMPLE_TRY);
4277 1.5 mrg return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4278 1.1 mrg }
4279 1.1 mrg
4280 1.1 mrg
4281 1.1 mrg /* Set the kind of try block represented by GIMPLE_TRY GS. */
4282 1.1 mrg
4283 1.1 mrg static inline void
4284 1.5 mrg gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4285 1.1 mrg {
4286 1.3 mrg gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4287 1.3 mrg || kind == GIMPLE_TRY_FINALLY);
4288 1.1 mrg if (gimple_try_kind (gs) != kind)
4289 1.5 mrg gs->subcode = (unsigned int) kind;
4290 1.1 mrg }
4291 1.1 mrg
4292 1.1 mrg
4293 1.1 mrg /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4294 1.1 mrg
4295 1.1 mrg static inline bool
4296 1.6 mrg gimple_try_catch_is_cleanup (const gimple *gs)
4297 1.1 mrg {
4298 1.3 mrg gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4299 1.5 mrg return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4300 1.1 mrg }
4301 1.1 mrg
4302 1.1 mrg
4303 1.3 mrg /* Return a pointer to the sequence of statements used as the
4304 1.3 mrg body for GIMPLE_TRY GS. */
4305 1.3 mrg
4306 1.3 mrg static inline gimple_seq *
4307 1.6 mrg gimple_try_eval_ptr (gimple *gs)
4308 1.3 mrg {
4309 1.5 mrg gtry *try_stmt = as_a <gtry *> (gs);
4310 1.5 mrg return &try_stmt->eval;
4311 1.3 mrg }
4312 1.3 mrg
4313 1.3 mrg
4314 1.1 mrg /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4315 1.1 mrg
4316 1.1 mrg static inline gimple_seq
4317 1.12 mrg gimple_try_eval (const gimple *gs)
4318 1.1 mrg {
4319 1.12 mrg return *gimple_try_eval_ptr (const_cast <gimple *> (gs));
4320 1.3 mrg }
4321 1.3 mrg
4322 1.3 mrg
4323 1.3 mrg /* Return a pointer to the sequence of statements used as the cleanup body for
4324 1.3 mrg GIMPLE_TRY GS. */
4325 1.3 mrg
4326 1.3 mrg static inline gimple_seq *
4327 1.6 mrg gimple_try_cleanup_ptr (gimple *gs)
4328 1.3 mrg {
4329 1.5 mrg gtry *try_stmt = as_a <gtry *> (gs);
4330 1.5 mrg return &try_stmt->cleanup;
4331 1.1 mrg }
4332 1.1 mrg
4333 1.1 mrg
4334 1.1 mrg /* Return the sequence of statements used as the cleanup body for
4335 1.1 mrg GIMPLE_TRY GS. */
4336 1.1 mrg
4337 1.1 mrg static inline gimple_seq
4338 1.12 mrg gimple_try_cleanup (const gimple *gs)
4339 1.1 mrg {
4340 1.12 mrg return *gimple_try_cleanup_ptr (const_cast <gimple *> (gs));
4341 1.1 mrg }
4342 1.1 mrg
4343 1.1 mrg
4344 1.1 mrg /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4345 1.1 mrg
4346 1.1 mrg static inline void
4347 1.5 mrg gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4348 1.1 mrg {
4349 1.3 mrg gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4350 1.1 mrg if (catch_is_cleanup)
4351 1.5 mrg g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4352 1.1 mrg else
4353 1.5 mrg g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4354 1.1 mrg }
4355 1.1 mrg
4356 1.1 mrg
4357 1.1 mrg /* Set EVAL to be the sequence of statements to use as the body for
4358 1.5 mrg GIMPLE_TRY TRY_STMT. */
4359 1.1 mrg
4360 1.1 mrg static inline void
4361 1.5 mrg gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4362 1.1 mrg {
4363 1.5 mrg try_stmt->eval = eval;
4364 1.1 mrg }
4365 1.1 mrg
4366 1.1 mrg
4367 1.1 mrg /* Set CLEANUP to be the sequence of statements to use as the cleanup
4368 1.5 mrg body for GIMPLE_TRY TRY_STMT. */
4369 1.1 mrg
4370 1.1 mrg static inline void
4371 1.5 mrg gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4372 1.1 mrg {
4373 1.5 mrg try_stmt->cleanup = cleanup;
4374 1.1 mrg }
4375 1.1 mrg
4376 1.1 mrg
4377 1.3 mrg /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4378 1.3 mrg
4379 1.3 mrg static inline gimple_seq *
4380 1.6 mrg gimple_wce_cleanup_ptr (gimple *gs)
4381 1.3 mrg {
4382 1.5 mrg gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4383 1.5 mrg return &wce_stmt->cleanup;
4384 1.3 mrg }
4385 1.3 mrg
4386 1.3 mrg
4387 1.1 mrg /* Return the cleanup sequence for cleanup statement GS. */
4388 1.1 mrg
4389 1.1 mrg static inline gimple_seq
4390 1.6 mrg gimple_wce_cleanup (gimple *gs)
4391 1.1 mrg {
4392 1.3 mrg return *gimple_wce_cleanup_ptr (gs);
4393 1.1 mrg }
4394 1.1 mrg
4395 1.1 mrg
4396 1.1 mrg /* Set CLEANUP to be the cleanup sequence for GS. */
4397 1.1 mrg
4398 1.1 mrg static inline void
4399 1.6 mrg gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
4400 1.1 mrg {
4401 1.5 mrg gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4402 1.5 mrg wce_stmt->cleanup = cleanup;
4403 1.1 mrg }
4404 1.1 mrg
4405 1.1 mrg
4406 1.1 mrg /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4407 1.1 mrg
4408 1.1 mrg static inline bool
4409 1.6 mrg gimple_wce_cleanup_eh_only (const gimple *gs)
4410 1.1 mrg {
4411 1.1 mrg GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4412 1.5 mrg return gs->subcode != 0;
4413 1.1 mrg }
4414 1.1 mrg
4415 1.1 mrg
4416 1.1 mrg /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4417 1.1 mrg
4418 1.1 mrg static inline void
4419 1.6 mrg gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
4420 1.1 mrg {
4421 1.1 mrg GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4422 1.5 mrg gs->subcode = (unsigned int) eh_only_p;
4423 1.1 mrg }
4424 1.1 mrg
4425 1.1 mrg
4426 1.1 mrg /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4427 1.1 mrg
4428 1.1 mrg static inline unsigned
4429 1.6 mrg gimple_phi_capacity (const gimple *gs)
4430 1.1 mrg {
4431 1.5 mrg const gphi *phi_stmt = as_a <const gphi *> (gs);
4432 1.5 mrg return phi_stmt->capacity;
4433 1.1 mrg }
4434 1.1 mrg
4435 1.1 mrg
4436 1.1 mrg /* Return the number of arguments in GIMPLE_PHI GS. This must always
4437 1.1 mrg be exactly the number of incoming edges for the basic block holding
4438 1.1 mrg GS. */
4439 1.1 mrg
4440 1.1 mrg static inline unsigned
4441 1.6 mrg gimple_phi_num_args (const gimple *gs)
4442 1.1 mrg {
4443 1.5 mrg const gphi *phi_stmt = as_a <const gphi *> (gs);
4444 1.5 mrg return phi_stmt->nargs;
4445 1.1 mrg }
4446 1.1 mrg
4447 1.1 mrg
4448 1.1 mrg /* Return the SSA name created by GIMPLE_PHI GS. */
4449 1.1 mrg
4450 1.1 mrg static inline tree
4451 1.10 mrg gimple_phi_result (const gphi *gs)
4452 1.10 mrg {
4453 1.10 mrg return gs->result;
4454 1.10 mrg }
4455 1.10 mrg
4456 1.10 mrg static inline tree
4457 1.6 mrg gimple_phi_result (const gimple *gs)
4458 1.1 mrg {
4459 1.5 mrg const gphi *phi_stmt = as_a <const gphi *> (gs);
4460 1.10 mrg return gimple_phi_result (phi_stmt);
4461 1.1 mrg }
4462 1.1 mrg
4463 1.1 mrg /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4464 1.1 mrg
4465 1.1 mrg static inline tree *
4466 1.10 mrg gimple_phi_result_ptr (gphi *gs)
4467 1.10 mrg {
4468 1.10 mrg return &gs->result;
4469 1.10 mrg }
4470 1.10 mrg
4471 1.10 mrg static inline tree *
4472 1.6 mrg gimple_phi_result_ptr (gimple *gs)
4473 1.1 mrg {
4474 1.5 mrg gphi *phi_stmt = as_a <gphi *> (gs);
4475 1.10 mrg return gimple_phi_result_ptr (phi_stmt);
4476 1.1 mrg }
4477 1.1 mrg
4478 1.5 mrg /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4479 1.1 mrg
4480 1.1 mrg static inline void
4481 1.5 mrg gimple_phi_set_result (gphi *phi, tree result)
4482 1.1 mrg {
4483 1.5 mrg phi->result = result;
4484 1.3 mrg if (result && TREE_CODE (result) == SSA_NAME)
4485 1.5 mrg SSA_NAME_DEF_STMT (result) = phi;
4486 1.1 mrg }
4487 1.1 mrg
4488 1.1 mrg
4489 1.1 mrg /* Return the PHI argument corresponding to incoming edge INDEX for
4490 1.1 mrg GIMPLE_PHI GS. */
4491 1.1 mrg
4492 1.1 mrg static inline struct phi_arg_d *
4493 1.10 mrg gimple_phi_arg (gphi *gs, unsigned index)
4494 1.10 mrg {
4495 1.10 mrg gcc_gimple_checking_assert (index < gs->nargs);
4496 1.10 mrg return &(gs->args[index]);
4497 1.10 mrg }
4498 1.10 mrg
4499 1.12 mrg static inline const phi_arg_d *
4500 1.12 mrg gimple_phi_arg (const gphi *gs, unsigned index)
4501 1.12 mrg {
4502 1.12 mrg gcc_gimple_checking_assert (index < gs->nargs);
4503 1.12 mrg return &(gs->args[index]);
4504 1.12 mrg }
4505 1.12 mrg
4506 1.10 mrg static inline struct phi_arg_d *
4507 1.6 mrg gimple_phi_arg (gimple *gs, unsigned index)
4508 1.1 mrg {
4509 1.5 mrg gphi *phi_stmt = as_a <gphi *> (gs);
4510 1.10 mrg return gimple_phi_arg (phi_stmt, index);
4511 1.1 mrg }
4512 1.1 mrg
4513 1.1 mrg /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4514 1.5 mrg for GIMPLE_PHI PHI. */
4515 1.5 mrg
4516 1.5 mrg static inline void
4517 1.5 mrg gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4518 1.5 mrg {
4519 1.10 mrg gcc_gimple_checking_assert (index < phi->nargs);
4520 1.5 mrg phi->args[index] = *phiarg;
4521 1.5 mrg }
4522 1.5 mrg
4523 1.5 mrg /* Return the PHI nodes for basic block BB, or NULL if there are no
4524 1.5 mrg PHI nodes. */
4525 1.5 mrg
4526 1.5 mrg static inline gimple_seq
4527 1.5 mrg phi_nodes (const_basic_block bb)
4528 1.5 mrg {
4529 1.5 mrg gcc_checking_assert (!(bb->flags & BB_RTL));
4530 1.5 mrg return bb->il.gimple.phi_nodes;
4531 1.5 mrg }
4532 1.5 mrg
4533 1.5 mrg /* Return a pointer to the PHI nodes for basic block BB. */
4534 1.5 mrg
4535 1.5 mrg static inline gimple_seq *
4536 1.5 mrg phi_nodes_ptr (basic_block bb)
4537 1.5 mrg {
4538 1.5 mrg gcc_checking_assert (!(bb->flags & BB_RTL));
4539 1.5 mrg return &bb->il.gimple.phi_nodes;
4540 1.5 mrg }
4541 1.5 mrg
4542 1.5 mrg /* Return the tree operand for argument I of PHI node GS. */
4543 1.5 mrg
4544 1.5 mrg static inline tree
4545 1.12 mrg gimple_phi_arg_def (const gphi *gs, size_t index)
4546 1.10 mrg {
4547 1.10 mrg return gimple_phi_arg (gs, index)->def;
4548 1.10 mrg }
4549 1.10 mrg
4550 1.10 mrg static inline tree
4551 1.6 mrg gimple_phi_arg_def (gimple *gs, size_t index)
4552 1.5 mrg {
4553 1.5 mrg return gimple_phi_arg (gs, index)->def;
4554 1.5 mrg }
4555 1.5 mrg
4556 1.5 mrg
4557 1.5 mrg /* Return a pointer to the tree operand for argument I of phi node PHI. */
4558 1.5 mrg
4559 1.5 mrg static inline tree *
4560 1.5 mrg gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4561 1.5 mrg {
4562 1.5 mrg return &gimple_phi_arg (phi, index)->def;
4563 1.5 mrg }
4564 1.5 mrg
4565 1.5 mrg /* Return the edge associated with argument I of phi node PHI. */
4566 1.5 mrg
4567 1.5 mrg static inline edge
4568 1.12 mrg gimple_phi_arg_edge (const gphi *phi, size_t i)
4569 1.5 mrg {
4570 1.5 mrg return EDGE_PRED (gimple_bb (phi), i);
4571 1.5 mrg }
4572 1.5 mrg
4573 1.5 mrg /* Return the source location of gimple argument I of phi node PHI. */
4574 1.5 mrg
4575 1.11 mrg static inline location_t
4576 1.12 mrg gimple_phi_arg_location (const gphi *phi, size_t i)
4577 1.5 mrg {
4578 1.5 mrg return gimple_phi_arg (phi, i)->locus;
4579 1.5 mrg }
4580 1.5 mrg
4581 1.5 mrg /* Return the source location of the argument on edge E of phi node PHI. */
4582 1.5 mrg
4583 1.11 mrg static inline location_t
4584 1.5 mrg gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4585 1.5 mrg {
4586 1.5 mrg return gimple_phi_arg (phi, e->dest_idx)->locus;
4587 1.5 mrg }
4588 1.5 mrg
4589 1.5 mrg /* Set the source location of gimple argument I of phi node PHI to LOC. */
4590 1.1 mrg
4591 1.1 mrg static inline void
4592 1.11 mrg gimple_phi_arg_set_location (gphi *phi, size_t i, location_t loc)
4593 1.5 mrg {
4594 1.5 mrg gimple_phi_arg (phi, i)->locus = loc;
4595 1.5 mrg }
4596 1.5 mrg
4597 1.12 mrg /* Return address of source location of gimple argument I of phi node PHI. */
4598 1.12 mrg
4599 1.12 mrg static inline location_t *
4600 1.12 mrg gimple_phi_arg_location_ptr (gphi *phi, size_t i)
4601 1.12 mrg {
4602 1.12 mrg return &gimple_phi_arg (phi, i)->locus;
4603 1.12 mrg }
4604 1.12 mrg
4605 1.5 mrg /* Return TRUE if argument I of phi node PHI has a location record. */
4606 1.5 mrg
4607 1.5 mrg static inline bool
4608 1.12 mrg gimple_phi_arg_has_location (const gphi *phi, size_t i)
4609 1.1 mrg {
4610 1.5 mrg return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4611 1.1 mrg }
4612 1.1 mrg
4613 1.5 mrg
4614 1.5 mrg /* Return the region number for GIMPLE_RESX RESX_STMT. */
4615 1.1 mrg
4616 1.1 mrg static inline int
4617 1.5 mrg gimple_resx_region (const gresx *resx_stmt)
4618 1.1 mrg {
4619 1.5 mrg return resx_stmt->region;
4620 1.1 mrg }
4621 1.1 mrg
4622 1.5 mrg /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4623 1.1 mrg
4624 1.1 mrg static inline void
4625 1.5 mrg gimple_resx_set_region (gresx *resx_stmt, int region)
4626 1.1 mrg {
4627 1.5 mrg resx_stmt->region = region;
4628 1.1 mrg }
4629 1.1 mrg
4630 1.5 mrg /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4631 1.1 mrg
4632 1.1 mrg static inline int
4633 1.5 mrg gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4634 1.1 mrg {
4635 1.5 mrg return eh_dispatch_stmt->region;
4636 1.1 mrg }
4637 1.1 mrg
4638 1.5 mrg /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4639 1.5 mrg EH_DISPATCH_STMT. */
4640 1.1 mrg
4641 1.1 mrg static inline void
4642 1.5 mrg gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4643 1.1 mrg {
4644 1.5 mrg eh_dispatch_stmt->region = region;
4645 1.1 mrg }
4646 1.1 mrg
4647 1.1 mrg /* Return the number of labels associated with the switch statement GS. */
4648 1.1 mrg
4649 1.1 mrg static inline unsigned
4650 1.5 mrg gimple_switch_num_labels (const gswitch *gs)
4651 1.1 mrg {
4652 1.1 mrg unsigned num_ops;
4653 1.1 mrg GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4654 1.1 mrg num_ops = gimple_num_ops (gs);
4655 1.3 mrg gcc_gimple_checking_assert (num_ops > 1);
4656 1.1 mrg return num_ops - 1;
4657 1.1 mrg }
4658 1.1 mrg
4659 1.1 mrg
4660 1.1 mrg /* Set NLABELS to be the number of labels for the switch statement GS. */
4661 1.1 mrg
4662 1.1 mrg static inline void
4663 1.5 mrg gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4664 1.1 mrg {
4665 1.1 mrg GIMPLE_CHECK (g, GIMPLE_SWITCH);
4666 1.1 mrg gimple_set_num_ops (g, nlabels + 1);
4667 1.1 mrg }
4668 1.1 mrg
4669 1.1 mrg
4670 1.1 mrg /* Return the index variable used by the switch statement GS. */
4671 1.1 mrg
4672 1.1 mrg static inline tree
4673 1.5 mrg gimple_switch_index (const gswitch *gs)
4674 1.1 mrg {
4675 1.6 mrg return gs->op[0];
4676 1.1 mrg }
4677 1.1 mrg
4678 1.1 mrg
4679 1.1 mrg /* Return a pointer to the index variable for the switch statement GS. */
4680 1.1 mrg
4681 1.1 mrg static inline tree *
4682 1.6 mrg gimple_switch_index_ptr (gswitch *gs)
4683 1.1 mrg {
4684 1.6 mrg return &gs->op[0];
4685 1.1 mrg }
4686 1.1 mrg
4687 1.1 mrg
4688 1.1 mrg /* Set INDEX to be the index variable for switch statement GS. */
4689 1.1 mrg
4690 1.1 mrg static inline void
4691 1.5 mrg gimple_switch_set_index (gswitch *gs, tree index)
4692 1.1 mrg {
4693 1.3 mrg gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4694 1.6 mrg gs->op[0] = index;
4695 1.1 mrg }
4696 1.1 mrg
4697 1.1 mrg
4698 1.1 mrg /* Return the label numbered INDEX. The default label is 0, followed by any
4699 1.1 mrg labels in a switch statement. */
4700 1.1 mrg
4701 1.1 mrg static inline tree
4702 1.5 mrg gimple_switch_label (const gswitch *gs, unsigned index)
4703 1.1 mrg {
4704 1.3 mrg gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4705 1.6 mrg return gs->op[index + 1];
4706 1.1 mrg }
4707 1.1 mrg
4708 1.1 mrg /* Set the label number INDEX to LABEL. 0 is always the default label. */
4709 1.1 mrg
4710 1.1 mrg static inline void
4711 1.5 mrg gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4712 1.1 mrg {
4713 1.3 mrg gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4714 1.3 mrg && (label == NULL_TREE
4715 1.3 mrg || TREE_CODE (label) == CASE_LABEL_EXPR));
4716 1.6 mrg gs->op[index + 1] = label;
4717 1.1 mrg }
4718 1.1 mrg
4719 1.1 mrg /* Return the default label for a switch statement. */
4720 1.1 mrg
4721 1.1 mrg static inline tree
4722 1.5 mrg gimple_switch_default_label (const gswitch *gs)
4723 1.1 mrg {
4724 1.3 mrg tree label = gimple_switch_label (gs, 0);
4725 1.3 mrg gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4726 1.3 mrg return label;
4727 1.1 mrg }
4728 1.1 mrg
4729 1.1 mrg /* Set the default label for a switch statement. */
4730 1.1 mrg
4731 1.1 mrg static inline void
4732 1.5 mrg gimple_switch_set_default_label (gswitch *gs, tree label)
4733 1.1 mrg {
4734 1.3 mrg gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4735 1.1 mrg gimple_switch_set_label (gs, 0, label);
4736 1.1 mrg }
4737 1.1 mrg
4738 1.1 mrg /* Return true if GS is a GIMPLE_DEBUG statement. */
4739 1.1 mrg
4740 1.1 mrg static inline bool
4741 1.6 mrg is_gimple_debug (const gimple *gs)
4742 1.1 mrg {
4743 1.1 mrg return gimple_code (gs) == GIMPLE_DEBUG;
4744 1.1 mrg }
4745 1.1 mrg
4746 1.10 mrg
4747 1.12 mrg /* Return the first nondebug statement in GIMPLE sequence S. */
4748 1.12 mrg
4749 1.12 mrg static inline gimple *
4750 1.12 mrg gimple_seq_first_nondebug_stmt (gimple_seq s)
4751 1.12 mrg {
4752 1.12 mrg gimple_seq_node n = gimple_seq_first (s);
4753 1.12 mrg while (n && is_gimple_debug (n))
4754 1.12 mrg n = n->next;
4755 1.12 mrg return n;
4756 1.12 mrg }
4757 1.12 mrg
4758 1.12 mrg
4759 1.10 mrg /* Return the last nondebug statement in GIMPLE sequence S. */
4760 1.10 mrg
4761 1.10 mrg static inline gimple *
4762 1.10 mrg gimple_seq_last_nondebug_stmt (gimple_seq s)
4763 1.10 mrg {
4764 1.10 mrg gimple_seq_node n;
4765 1.10 mrg for (n = gimple_seq_last (s);
4766 1.10 mrg n && is_gimple_debug (n);
4767 1.10 mrg n = n->prev)
4768 1.12 mrg if (n == s)
4769 1.10 mrg return NULL;
4770 1.10 mrg return n;
4771 1.10 mrg }
4772 1.10 mrg
4773 1.10 mrg
4774 1.1 mrg /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4775 1.1 mrg
4776 1.1 mrg static inline bool
4777 1.6 mrg gimple_debug_bind_p (const gimple *s)
4778 1.1 mrg {
4779 1.1 mrg if (is_gimple_debug (s))
4780 1.5 mrg return s->subcode == GIMPLE_DEBUG_BIND;
4781 1.1 mrg
4782 1.1 mrg return false;
4783 1.1 mrg }
4784 1.1 mrg
4785 1.1 mrg /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4786 1.1 mrg
4787 1.1 mrg static inline tree
4788 1.12 mrg gimple_debug_bind_get_var (const gimple *dbg)
4789 1.1 mrg {
4790 1.1 mrg GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4791 1.3 mrg gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4792 1.1 mrg return gimple_op (dbg, 0);
4793 1.1 mrg }
4794 1.1 mrg
4795 1.1 mrg /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4796 1.1 mrg statement. */
4797 1.1 mrg
4798 1.1 mrg static inline tree
4799 1.12 mrg gimple_debug_bind_get_value (const gimple *dbg)
4800 1.1 mrg {
4801 1.1 mrg GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4802 1.3 mrg gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4803 1.1 mrg return gimple_op (dbg, 1);
4804 1.1 mrg }
4805 1.1 mrg
4806 1.1 mrg /* Return a pointer to the value bound to the variable in a
4807 1.1 mrg GIMPLE_DEBUG bind statement. */
4808 1.1 mrg
4809 1.1 mrg static inline tree *
4810 1.6 mrg gimple_debug_bind_get_value_ptr (gimple *dbg)
4811 1.1 mrg {
4812 1.1 mrg GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4813 1.3 mrg gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4814 1.1 mrg return gimple_op_ptr (dbg, 1);
4815 1.1 mrg }
4816 1.1 mrg
4817 1.1 mrg /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4818 1.1 mrg
4819 1.1 mrg static inline void
4820 1.6 mrg gimple_debug_bind_set_var (gimple *dbg, tree var)
4821 1.1 mrg {
4822 1.1 mrg GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4823 1.3 mrg gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4824 1.1 mrg gimple_set_op (dbg, 0, var);
4825 1.1 mrg }
4826 1.1 mrg
4827 1.1 mrg /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4828 1.1 mrg statement. */
4829 1.1 mrg
4830 1.1 mrg static inline void
4831 1.6 mrg gimple_debug_bind_set_value (gimple *dbg, tree value)
4832 1.1 mrg {
4833 1.1 mrg GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4834 1.3 mrg gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4835 1.1 mrg gimple_set_op (dbg, 1, value);
4836 1.1 mrg }
4837 1.1 mrg
4838 1.1 mrg /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4839 1.1 mrg optimized away. */
4840 1.1 mrg #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4841 1.1 mrg
4842 1.1 mrg /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4843 1.1 mrg statement. */
4844 1.1 mrg
4845 1.1 mrg static inline void
4846 1.6 mrg gimple_debug_bind_reset_value (gimple *dbg)
4847 1.1 mrg {
4848 1.1 mrg GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4849 1.3 mrg gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4850 1.1 mrg gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4851 1.1 mrg }
4852 1.1 mrg
4853 1.1 mrg /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4854 1.1 mrg value. */
4855 1.1 mrg
4856 1.1 mrg static inline bool
4857 1.6 mrg gimple_debug_bind_has_value_p (gimple *dbg)
4858 1.1 mrg {
4859 1.1 mrg GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4860 1.3 mrg gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4861 1.1 mrg return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4862 1.1 mrg }
4863 1.1 mrg
4864 1.1 mrg #undef GIMPLE_DEBUG_BIND_NOVALUE
4865 1.1 mrg
4866 1.3 mrg /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4867 1.3 mrg
4868 1.3 mrg static inline bool
4869 1.6 mrg gimple_debug_source_bind_p (const gimple *s)
4870 1.3 mrg {
4871 1.3 mrg if (is_gimple_debug (s))
4872 1.5 mrg return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4873 1.3 mrg
4874 1.3 mrg return false;
4875 1.3 mrg }
4876 1.3 mrg
4877 1.3 mrg /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4878 1.3 mrg
4879 1.3 mrg static inline tree
4880 1.12 mrg gimple_debug_source_bind_get_var (const gimple *dbg)
4881 1.3 mrg {
4882 1.3 mrg GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4883 1.3 mrg gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4884 1.3 mrg return gimple_op (dbg, 0);
4885 1.3 mrg }
4886 1.3 mrg
4887 1.3 mrg /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4888 1.3 mrg statement. */
4889 1.3 mrg
4890 1.3 mrg static inline tree
4891 1.12 mrg gimple_debug_source_bind_get_value (const gimple *dbg)
4892 1.3 mrg {
4893 1.3 mrg GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4894 1.3 mrg gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4895 1.3 mrg return gimple_op (dbg, 1);
4896 1.3 mrg }
4897 1.3 mrg
4898 1.3 mrg /* Return a pointer to the value bound to the variable in a
4899 1.3 mrg GIMPLE_DEBUG source bind statement. */
4900 1.3 mrg
4901 1.3 mrg static inline tree *
4902 1.6 mrg gimple_debug_source_bind_get_value_ptr (gimple *dbg)
4903 1.3 mrg {
4904 1.3 mrg GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4905 1.3 mrg gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4906 1.3 mrg return gimple_op_ptr (dbg, 1);
4907 1.3 mrg }
4908 1.3 mrg
4909 1.3 mrg /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4910 1.3 mrg
4911 1.3 mrg static inline void
4912 1.6 mrg gimple_debug_source_bind_set_var (gimple *dbg, tree var)
4913 1.3 mrg {
4914 1.3 mrg GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4915 1.3 mrg gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4916 1.3 mrg gimple_set_op (dbg, 0, var);
4917 1.3 mrg }
4918 1.3 mrg
4919 1.3 mrg /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4920 1.3 mrg statement. */
4921 1.3 mrg
4922 1.3 mrg static inline void
4923 1.6 mrg gimple_debug_source_bind_set_value (gimple *dbg, tree value)
4924 1.3 mrg {
4925 1.3 mrg GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4926 1.3 mrg gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4927 1.3 mrg gimple_set_op (dbg, 1, value);
4928 1.3 mrg }
4929 1.3 mrg
4930 1.10 mrg /* Return true if S is a GIMPLE_DEBUG BEGIN_STMT statement. */
4931 1.10 mrg
4932 1.10 mrg static inline bool
4933 1.10 mrg gimple_debug_begin_stmt_p (const gimple *s)
4934 1.10 mrg {
4935 1.10 mrg if (is_gimple_debug (s))
4936 1.10 mrg return s->subcode == GIMPLE_DEBUG_BEGIN_STMT;
4937 1.10 mrg
4938 1.10 mrg return false;
4939 1.10 mrg }
4940 1.10 mrg
4941 1.10 mrg /* Return true if S is a GIMPLE_DEBUG INLINE_ENTRY statement. */
4942 1.10 mrg
4943 1.10 mrg static inline bool
4944 1.10 mrg gimple_debug_inline_entry_p (const gimple *s)
4945 1.10 mrg {
4946 1.10 mrg if (is_gimple_debug (s))
4947 1.10 mrg return s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
4948 1.10 mrg
4949 1.10 mrg return false;
4950 1.10 mrg }
4951 1.10 mrg
4952 1.10 mrg /* Return true if S is a GIMPLE_DEBUG non-binding marker statement. */
4953 1.10 mrg
4954 1.10 mrg static inline bool
4955 1.10 mrg gimple_debug_nonbind_marker_p (const gimple *s)
4956 1.10 mrg {
4957 1.10 mrg if (is_gimple_debug (s))
4958 1.10 mrg return s->subcode == GIMPLE_DEBUG_BEGIN_STMT
4959 1.10 mrg || s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
4960 1.10 mrg
4961 1.10 mrg return false;
4962 1.10 mrg }
4963 1.10 mrg
4964 1.5 mrg /* Return the line number for EXPR, or return -1 if we have no line
4965 1.5 mrg number information for it. */
4966 1.5 mrg static inline int
4967 1.6 mrg get_lineno (const gimple *stmt)
4968 1.5 mrg {
4969 1.5 mrg location_t loc;
4970 1.5 mrg
4971 1.5 mrg if (!stmt)
4972 1.5 mrg return -1;
4973 1.5 mrg
4974 1.5 mrg loc = gimple_location (stmt);
4975 1.5 mrg if (loc == UNKNOWN_LOCATION)
4976 1.5 mrg return -1;
4977 1.5 mrg
4978 1.5 mrg return LOCATION_LINE (loc);
4979 1.5 mrg }
4980 1.5 mrg
4981 1.3 mrg /* Return a pointer to the body for the OMP statement GS. */
4982 1.3 mrg
4983 1.3 mrg static inline gimple_seq *
4984 1.6 mrg gimple_omp_body_ptr (gimple *gs)
4985 1.3 mrg {
4986 1.5 mrg return &static_cast <gimple_statement_omp *> (gs)->body;
4987 1.3 mrg }
4988 1.3 mrg
4989 1.1 mrg /* Return the body for the OMP statement GS. */
4990 1.1 mrg
4991 1.1 mrg static inline gimple_seq
4992 1.12 mrg gimple_omp_body (const gimple *gs)
4993 1.1 mrg {
4994 1.12 mrg return *gimple_omp_body_ptr (const_cast <gimple *> (gs));
4995 1.1 mrg }
4996 1.1 mrg
4997 1.1 mrg /* Set BODY to be the body for the OMP statement GS. */
4998 1.1 mrg
4999 1.1 mrg static inline void
5000 1.6 mrg gimple_omp_set_body (gimple *gs, gimple_seq body)
5001 1.1 mrg {
5002 1.5 mrg static_cast <gimple_statement_omp *> (gs)->body = body;
5003 1.1 mrg }
5004 1.1 mrg
5005 1.1 mrg
5006 1.5 mrg /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
5007 1.1 mrg
5008 1.1 mrg static inline tree
5009 1.5 mrg gimple_omp_critical_name (const gomp_critical *crit_stmt)
5010 1.1 mrg {
5011 1.5 mrg return crit_stmt->name;
5012 1.1 mrg }
5013 1.1 mrg
5014 1.1 mrg
5015 1.6 mrg /* Return a pointer to the name associated with OMP critical statement
5016 1.6 mrg CRIT_STMT. */
5017 1.1 mrg
5018 1.1 mrg static inline tree *
5019 1.5 mrg gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
5020 1.1 mrg {
5021 1.5 mrg return &crit_stmt->name;
5022 1.1 mrg }
5023 1.1 mrg
5024 1.1 mrg
5025 1.6 mrg /* Set NAME to be the name associated with OMP critical statement
5026 1.6 mrg CRIT_STMT. */
5027 1.1 mrg
5028 1.1 mrg static inline void
5029 1.5 mrg gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
5030 1.5 mrg {
5031 1.5 mrg crit_stmt->name = name;
5032 1.5 mrg }
5033 1.5 mrg
5034 1.5 mrg
5035 1.6 mrg /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
5036 1.6 mrg
5037 1.6 mrg static inline tree
5038 1.6 mrg gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
5039 1.6 mrg {
5040 1.6 mrg return crit_stmt->clauses;
5041 1.6 mrg }
5042 1.6 mrg
5043 1.6 mrg
5044 1.6 mrg /* Return a pointer to the clauses associated with OMP critical statement
5045 1.6 mrg CRIT_STMT. */
5046 1.6 mrg
5047 1.6 mrg static inline tree *
5048 1.6 mrg gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
5049 1.6 mrg {
5050 1.6 mrg return &crit_stmt->clauses;
5051 1.6 mrg }
5052 1.6 mrg
5053 1.6 mrg
5054 1.6 mrg /* Set CLAUSES to be the clauses associated with OMP critical statement
5055 1.6 mrg CRIT_STMT. */
5056 1.6 mrg
5057 1.6 mrg static inline void
5058 1.6 mrg gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
5059 1.6 mrg {
5060 1.6 mrg crit_stmt->clauses = clauses;
5061 1.6 mrg }
5062 1.6 mrg
5063 1.6 mrg
5064 1.6 mrg /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
5065 1.6 mrg
5066 1.6 mrg static inline tree
5067 1.6 mrg gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
5068 1.6 mrg {
5069 1.6 mrg return ord_stmt->clauses;
5070 1.6 mrg }
5071 1.6 mrg
5072 1.6 mrg
5073 1.6 mrg /* Return a pointer to the clauses associated with OMP ordered statement
5074 1.6 mrg ORD_STMT. */
5075 1.6 mrg
5076 1.6 mrg static inline tree *
5077 1.6 mrg gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
5078 1.6 mrg {
5079 1.6 mrg return &ord_stmt->clauses;
5080 1.6 mrg }
5081 1.6 mrg
5082 1.6 mrg
5083 1.6 mrg /* Set CLAUSES to be the clauses associated with OMP ordered statement
5084 1.6 mrg ORD_STMT. */
5085 1.6 mrg
5086 1.6 mrg static inline void
5087 1.6 mrg gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
5088 1.6 mrg {
5089 1.6 mrg ord_stmt->clauses = clauses;
5090 1.6 mrg }
5091 1.6 mrg
5092 1.6 mrg
5093 1.12 mrg /* Return the clauses associated with OMP_SCAN statement SCAN_STMT. */
5094 1.12 mrg
5095 1.12 mrg static inline tree
5096 1.12 mrg gimple_omp_scan_clauses (const gomp_scan *scan_stmt)
5097 1.12 mrg {
5098 1.12 mrg return scan_stmt->clauses;
5099 1.12 mrg }
5100 1.12 mrg
5101 1.12 mrg
5102 1.12 mrg /* Return a pointer to the clauses associated with OMP scan statement
5103 1.12 mrg ORD_STMT. */
5104 1.12 mrg
5105 1.12 mrg static inline tree *
5106 1.12 mrg gimple_omp_scan_clauses_ptr (gomp_scan *scan_stmt)
5107 1.12 mrg {
5108 1.12 mrg return &scan_stmt->clauses;
5109 1.12 mrg }
5110 1.12 mrg
5111 1.12 mrg
5112 1.12 mrg /* Set CLAUSES to be the clauses associated with OMP scan statement
5113 1.12 mrg ORD_STMT. */
5114 1.12 mrg
5115 1.12 mrg static inline void
5116 1.12 mrg gimple_omp_scan_set_clauses (gomp_scan *scan_stmt, tree clauses)
5117 1.12 mrg {
5118 1.12 mrg scan_stmt->clauses = clauses;
5119 1.12 mrg }
5120 1.12 mrg
5121 1.12 mrg
5122 1.11 mrg /* Return the clauses associated with OMP_TASKGROUP statement GS. */
5123 1.11 mrg
5124 1.11 mrg static inline tree
5125 1.11 mrg gimple_omp_taskgroup_clauses (const gimple *gs)
5126 1.11 mrg {
5127 1.11 mrg GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5128 1.11 mrg return
5129 1.11 mrg static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses;
5130 1.11 mrg }
5131 1.11 mrg
5132 1.11 mrg
5133 1.11 mrg /* Return a pointer to the clauses associated with OMP taskgroup statement
5134 1.11 mrg GS. */
5135 1.11 mrg
5136 1.11 mrg static inline tree *
5137 1.11 mrg gimple_omp_taskgroup_clauses_ptr (gimple *gs)
5138 1.11 mrg {
5139 1.11 mrg GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5140 1.11 mrg return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses;
5141 1.11 mrg }
5142 1.11 mrg
5143 1.11 mrg
5144 1.11 mrg /* Set CLAUSES to be the clauses associated with OMP taskgroup statement
5145 1.11 mrg GS. */
5146 1.11 mrg
5147 1.11 mrg static inline void
5148 1.11 mrg gimple_omp_taskgroup_set_clauses (gimple *gs, tree clauses)
5149 1.11 mrg {
5150 1.11 mrg GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5151 1.11 mrg static_cast <gimple_statement_omp_single_layout *> (gs)->clauses
5152 1.11 mrg = clauses;
5153 1.11 mrg }
5154 1.11 mrg
5155 1.11 mrg
5156 1.5 mrg /* Return the kind of the OMP_FOR statemement G. */
5157 1.5 mrg
5158 1.5 mrg static inline int
5159 1.6 mrg gimple_omp_for_kind (const gimple *g)
5160 1.5 mrg {
5161 1.5 mrg GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5162 1.5 mrg return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
5163 1.5 mrg }
5164 1.5 mrg
5165 1.5 mrg
5166 1.5 mrg /* Set the kind of the OMP_FOR statement G. */
5167 1.5 mrg
5168 1.5 mrg static inline void
5169 1.5 mrg gimple_omp_for_set_kind (gomp_for *g, int kind)
5170 1.5 mrg {
5171 1.5 mrg g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
5172 1.5 mrg | (kind & GF_OMP_FOR_KIND_MASK);
5173 1.5 mrg }
5174 1.5 mrg
5175 1.5 mrg
5176 1.5 mrg /* Return true if OMP_FOR statement G has the
5177 1.5 mrg GF_OMP_FOR_COMBINED flag set. */
5178 1.5 mrg
5179 1.5 mrg static inline bool
5180 1.6 mrg gimple_omp_for_combined_p (const gimple *g)
5181 1.5 mrg {
5182 1.5 mrg GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5183 1.5 mrg return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
5184 1.5 mrg }
5185 1.5 mrg
5186 1.5 mrg
5187 1.5 mrg /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
5188 1.5 mrg the boolean value of COMBINED_P. */
5189 1.5 mrg
5190 1.5 mrg static inline void
5191 1.5 mrg gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
5192 1.5 mrg {
5193 1.5 mrg if (combined_p)
5194 1.5 mrg g->subcode |= GF_OMP_FOR_COMBINED;
5195 1.5 mrg else
5196 1.5 mrg g->subcode &= ~GF_OMP_FOR_COMBINED;
5197 1.5 mrg }
5198 1.5 mrg
5199 1.5 mrg
5200 1.5 mrg /* Return true if the OMP_FOR statement G has the
5201 1.5 mrg GF_OMP_FOR_COMBINED_INTO flag set. */
5202 1.5 mrg
5203 1.5 mrg static inline bool
5204 1.6 mrg gimple_omp_for_combined_into_p (const gimple *g)
5205 1.5 mrg {
5206 1.5 mrg GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5207 1.5 mrg return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
5208 1.5 mrg }
5209 1.5 mrg
5210 1.5 mrg
5211 1.5 mrg /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
5212 1.5 mrg on the boolean value of COMBINED_P. */
5213 1.5 mrg
5214 1.5 mrg static inline void
5215 1.5 mrg gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
5216 1.1 mrg {
5217 1.5 mrg if (combined_p)
5218 1.5 mrg g->subcode |= GF_OMP_FOR_COMBINED_INTO;
5219 1.5 mrg else
5220 1.5 mrg g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
5221 1.1 mrg }
5222 1.1 mrg
5223 1.1 mrg
5224 1.5 mrg /* Return the clauses associated with the OMP_FOR statement GS. */
5225 1.1 mrg
5226 1.1 mrg static inline tree
5227 1.6 mrg gimple_omp_for_clauses (const gimple *gs)
5228 1.1 mrg {
5229 1.5 mrg const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5230 1.5 mrg return omp_for_stmt->clauses;
5231 1.1 mrg }
5232 1.1 mrg
5233 1.1 mrg
5234 1.5 mrg /* Return a pointer to the clauses associated with the OMP_FOR statement
5235 1.5 mrg GS. */
5236 1.1 mrg
5237 1.1 mrg static inline tree *
5238 1.6 mrg gimple_omp_for_clauses_ptr (gimple *gs)
5239 1.1 mrg {
5240 1.5 mrg gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5241 1.5 mrg return &omp_for_stmt->clauses;
5242 1.1 mrg }
5243 1.1 mrg
5244 1.1 mrg
5245 1.5 mrg /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
5246 1.5 mrg GS. */
5247 1.1 mrg
5248 1.1 mrg static inline void
5249 1.6 mrg gimple_omp_for_set_clauses (gimple *gs, tree clauses)
5250 1.1 mrg {
5251 1.5 mrg gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5252 1.5 mrg omp_for_stmt->clauses = clauses;
5253 1.1 mrg }
5254 1.1 mrg
5255 1.1 mrg
5256 1.5 mrg /* Get the collapse count of the OMP_FOR statement GS. */
5257 1.1 mrg
5258 1.1 mrg static inline size_t
5259 1.12 mrg gimple_omp_for_collapse (const gimple *gs)
5260 1.1 mrg {
5261 1.12 mrg const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5262 1.5 mrg return omp_for_stmt->collapse;
5263 1.5 mrg }
5264 1.5 mrg
5265 1.5 mrg
5266 1.5 mrg /* Return the condition code associated with the OMP_FOR statement GS. */
5267 1.5 mrg
5268 1.5 mrg static inline enum tree_code
5269 1.6 mrg gimple_omp_for_cond (const gimple *gs, size_t i)
5270 1.5 mrg {
5271 1.5 mrg const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5272 1.5 mrg gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5273 1.5 mrg return omp_for_stmt->iter[i].cond;
5274 1.5 mrg }
5275 1.5 mrg
5276 1.5 mrg
5277 1.5 mrg /* Set COND to be the condition code for the OMP_FOR statement GS. */
5278 1.5 mrg
5279 1.5 mrg static inline void
5280 1.6 mrg gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
5281 1.5 mrg {
5282 1.5 mrg gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5283 1.5 mrg gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5284 1.5 mrg && i < omp_for_stmt->collapse);
5285 1.5 mrg omp_for_stmt->iter[i].cond = cond;
5286 1.1 mrg }
5287 1.1 mrg
5288 1.1 mrg
5289 1.5 mrg /* Return the index variable for the OMP_FOR statement GS. */
5290 1.1 mrg
5291 1.1 mrg static inline tree
5292 1.6 mrg gimple_omp_for_index (const gimple *gs, size_t i)
5293 1.1 mrg {
5294 1.5 mrg const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5295 1.5 mrg gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5296 1.5 mrg return omp_for_stmt->iter[i].index;
5297 1.1 mrg }
5298 1.1 mrg
5299 1.1 mrg
5300 1.5 mrg /* Return a pointer to the index variable for the OMP_FOR statement GS. */
5301 1.1 mrg
5302 1.1 mrg static inline tree *
5303 1.6 mrg gimple_omp_for_index_ptr (gimple *gs, size_t i)
5304 1.1 mrg {
5305 1.5 mrg gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5306 1.5 mrg gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5307 1.5 mrg return &omp_for_stmt->iter[i].index;
5308 1.1 mrg }
5309 1.1 mrg
5310 1.1 mrg
5311 1.5 mrg /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
5312 1.1 mrg
5313 1.1 mrg static inline void
5314 1.6 mrg gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
5315 1.1 mrg {
5316 1.5 mrg gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5317 1.5 mrg gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5318 1.5 mrg omp_for_stmt->iter[i].index = index;
5319 1.1 mrg }
5320 1.1 mrg
5321 1.1 mrg
5322 1.5 mrg /* Return the initial value for the OMP_FOR statement GS. */
5323 1.1 mrg
5324 1.1 mrg static inline tree
5325 1.6 mrg gimple_omp_for_initial (const gimple *gs, size_t i)
5326 1.1 mrg {
5327 1.5 mrg const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5328 1.5 mrg gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5329 1.5 mrg return omp_for_stmt->iter[i].initial;
5330 1.1 mrg }
5331 1.1 mrg
5332 1.1 mrg
5333 1.5 mrg /* Return a pointer to the initial value for the OMP_FOR statement GS. */
5334 1.1 mrg
5335 1.1 mrg static inline tree *
5336 1.6 mrg gimple_omp_for_initial_ptr (gimple *gs, size_t i)
5337 1.1 mrg {
5338 1.5 mrg gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5339 1.5 mrg gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5340 1.5 mrg return &omp_for_stmt->iter[i].initial;
5341 1.1 mrg }
5342 1.1 mrg
5343 1.1 mrg
5344 1.5 mrg /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5345 1.1 mrg
5346 1.1 mrg static inline void
5347 1.6 mrg gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
5348 1.1 mrg {
5349 1.5 mrg gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5350 1.5 mrg gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5351 1.5 mrg omp_for_stmt->iter[i].initial = initial;
5352 1.1 mrg }
5353 1.1 mrg
5354 1.1 mrg
5355 1.5 mrg /* Return the final value for the OMP_FOR statement GS. */
5356 1.1 mrg
5357 1.1 mrg static inline tree
5358 1.6 mrg gimple_omp_for_final (const gimple *gs, size_t i)
5359 1.1 mrg {
5360 1.5 mrg const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5361 1.5 mrg gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5362 1.5 mrg return omp_for_stmt->iter[i].final;
5363 1.1 mrg }
5364 1.1 mrg
5365 1.1 mrg
5366 1.5 mrg /* Return a pointer to the final value for the OMP_FOR statement GS. */
5367 1.1 mrg
5368 1.1 mrg static inline tree *
5369 1.6 mrg gimple_omp_for_final_ptr (gimple *gs, size_t i)
5370 1.1 mrg {
5371 1.5 mrg gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5372 1.5 mrg gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5373 1.5 mrg return &omp_for_stmt->iter[i].final;
5374 1.1 mrg }
5375 1.1 mrg
5376 1.1 mrg
5377 1.5 mrg /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5378 1.1 mrg
5379 1.1 mrg static inline void
5380 1.6 mrg gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
5381 1.1 mrg {
5382 1.5 mrg gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5383 1.5 mrg gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5384 1.5 mrg omp_for_stmt->iter[i].final = final;
5385 1.1 mrg }
5386 1.1 mrg
5387 1.1 mrg
5388 1.5 mrg /* Return the increment value for the OMP_FOR statement GS. */
5389 1.1 mrg
5390 1.1 mrg static inline tree
5391 1.6 mrg gimple_omp_for_incr (const gimple *gs, size_t i)
5392 1.1 mrg {
5393 1.5 mrg const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5394 1.5 mrg gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5395 1.5 mrg return omp_for_stmt->iter[i].incr;
5396 1.1 mrg }
5397 1.1 mrg
5398 1.1 mrg
5399 1.5 mrg /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5400 1.1 mrg
5401 1.1 mrg static inline tree *
5402 1.6 mrg gimple_omp_for_incr_ptr (gimple *gs, size_t i)
5403 1.1 mrg {
5404 1.5 mrg gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5405 1.5 mrg gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5406 1.5 mrg return &omp_for_stmt->iter[i].incr;
5407 1.1 mrg }
5408 1.1 mrg
5409 1.1 mrg
5410 1.5 mrg /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5411 1.1 mrg
5412 1.1 mrg static inline void
5413 1.6 mrg gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
5414 1.1 mrg {
5415 1.5 mrg gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5416 1.5 mrg gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5417 1.5 mrg omp_for_stmt->iter[i].incr = incr;
5418 1.1 mrg }
5419 1.1 mrg
5420 1.1 mrg
5421 1.3 mrg /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5422 1.3 mrg statement GS starts. */
5423 1.3 mrg
5424 1.3 mrg static inline gimple_seq *
5425 1.6 mrg gimple_omp_for_pre_body_ptr (gimple *gs)
5426 1.3 mrg {
5427 1.5 mrg gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5428 1.5 mrg return &omp_for_stmt->pre_body;
5429 1.3 mrg }
5430 1.3 mrg
5431 1.3 mrg
5432 1.1 mrg /* Return the sequence of statements to execute before the OMP_FOR
5433 1.1 mrg statement GS starts. */
5434 1.1 mrg
5435 1.1 mrg static inline gimple_seq
5436 1.12 mrg gimple_omp_for_pre_body (const gimple *gs)
5437 1.1 mrg {
5438 1.12 mrg return *gimple_omp_for_pre_body_ptr (const_cast <gimple *> (gs));
5439 1.1 mrg }
5440 1.1 mrg
5441 1.1 mrg
5442 1.1 mrg /* Set PRE_BODY to be the sequence of statements to execute before the
5443 1.1 mrg OMP_FOR statement GS starts. */
5444 1.1 mrg
5445 1.1 mrg static inline void
5446 1.6 mrg gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
5447 1.1 mrg {
5448 1.5 mrg gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5449 1.5 mrg omp_for_stmt->pre_body = pre_body;
5450 1.1 mrg }
5451 1.1 mrg
5452 1.6 mrg /* Return the kernel_phony of OMP_FOR statement. */
5453 1.6 mrg
5454 1.6 mrg static inline bool
5455 1.6 mrg gimple_omp_for_grid_phony (const gomp_for *omp_for)
5456 1.6 mrg {
5457 1.8 mrg gcc_checking_assert (gimple_omp_for_kind (omp_for)
5458 1.8 mrg != GF_OMP_FOR_KIND_GRID_LOOP);
5459 1.6 mrg return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_PHONY) != 0;
5460 1.6 mrg }
5461 1.6 mrg
5462 1.6 mrg /* Set kernel_phony flag of OMP_FOR to VALUE. */
5463 1.6 mrg
5464 1.6 mrg static inline void
5465 1.6 mrg gimple_omp_for_set_grid_phony (gomp_for *omp_for, bool value)
5466 1.6 mrg {
5467 1.8 mrg gcc_checking_assert (gimple_omp_for_kind (omp_for)
5468 1.8 mrg != GF_OMP_FOR_KIND_GRID_LOOP);
5469 1.6 mrg if (value)
5470 1.6 mrg omp_for->subcode |= GF_OMP_FOR_GRID_PHONY;
5471 1.6 mrg else
5472 1.6 mrg omp_for->subcode &= ~GF_OMP_FOR_GRID_PHONY;
5473 1.6 mrg }
5474 1.1 mrg
5475 1.8 mrg /* Return the kernel_intra_group of a GRID_LOOP OMP_FOR statement. */
5476 1.8 mrg
5477 1.8 mrg static inline bool
5478 1.8 mrg gimple_omp_for_grid_intra_group (const gomp_for *omp_for)
5479 1.8 mrg {
5480 1.8 mrg gcc_checking_assert (gimple_omp_for_kind (omp_for)
5481 1.8 mrg == GF_OMP_FOR_KIND_GRID_LOOP);
5482 1.8 mrg return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_INTRA_GROUP) != 0;
5483 1.8 mrg }
5484 1.8 mrg
5485 1.8 mrg /* Set kernel_intra_group flag of OMP_FOR to VALUE. */
5486 1.8 mrg
5487 1.8 mrg static inline void
5488 1.8 mrg gimple_omp_for_set_grid_intra_group (gomp_for *omp_for, bool value)
5489 1.8 mrg {
5490 1.8 mrg gcc_checking_assert (gimple_omp_for_kind (omp_for)
5491 1.8 mrg == GF_OMP_FOR_KIND_GRID_LOOP);
5492 1.8 mrg if (value)
5493 1.8 mrg omp_for->subcode |= GF_OMP_FOR_GRID_INTRA_GROUP;
5494 1.8 mrg else
5495 1.8 mrg omp_for->subcode &= ~GF_OMP_FOR_GRID_INTRA_GROUP;
5496 1.8 mrg }
5497 1.8 mrg
5498 1.8 mrg /* Return true if iterations of a grid OMP_FOR statement correspond to HSA
5499 1.8 mrg groups. */
5500 1.8 mrg
5501 1.8 mrg static inline bool
5502 1.8 mrg gimple_omp_for_grid_group_iter (const gomp_for *omp_for)
5503 1.8 mrg {
5504 1.8 mrg gcc_checking_assert (gimple_omp_for_kind (omp_for)
5505 1.8 mrg == GF_OMP_FOR_KIND_GRID_LOOP);
5506 1.8 mrg return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_GROUP_ITER) != 0;
5507 1.8 mrg }
5508 1.8 mrg
5509 1.8 mrg /* Set group_iter flag of OMP_FOR to VALUE. */
5510 1.8 mrg
5511 1.8 mrg static inline void
5512 1.8 mrg gimple_omp_for_set_grid_group_iter (gomp_for *omp_for, bool value)
5513 1.8 mrg {
5514 1.8 mrg gcc_checking_assert (gimple_omp_for_kind (omp_for)
5515 1.8 mrg == GF_OMP_FOR_KIND_GRID_LOOP);
5516 1.8 mrg if (value)
5517 1.8 mrg omp_for->subcode |= GF_OMP_FOR_GRID_GROUP_ITER;
5518 1.8 mrg else
5519 1.8 mrg omp_for->subcode &= ~GF_OMP_FOR_GRID_GROUP_ITER;
5520 1.8 mrg }
5521 1.8 mrg
5522 1.1 mrg /* Return the clauses associated with OMP_PARALLEL GS. */
5523 1.1 mrg
5524 1.1 mrg static inline tree
5525 1.6 mrg gimple_omp_parallel_clauses (const gimple *gs)
5526 1.1 mrg {
5527 1.5 mrg const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
5528 1.5 mrg return omp_parallel_stmt->clauses;
5529 1.1 mrg }
5530 1.1 mrg
5531 1.1 mrg
5532 1.5 mrg /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5533 1.1 mrg
5534 1.1 mrg static inline tree *
5535 1.5 mrg gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5536 1.1 mrg {
5537 1.5 mrg return &omp_parallel_stmt->clauses;
5538 1.1 mrg }
5539 1.1 mrg
5540 1.1 mrg
5541 1.5 mrg /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5542 1.1 mrg
5543 1.1 mrg static inline void
5544 1.5 mrg gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5545 1.5 mrg tree clauses)
5546 1.1 mrg {
5547 1.5 mrg omp_parallel_stmt->clauses = clauses;
5548 1.1 mrg }
5549 1.1 mrg
5550 1.1 mrg
5551 1.5 mrg /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5552 1.1 mrg
5553 1.1 mrg static inline tree
5554 1.5 mrg gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5555 1.1 mrg {
5556 1.5 mrg return omp_parallel_stmt->child_fn;
5557 1.1 mrg }
5558 1.1 mrg
5559 1.1 mrg /* Return a pointer to the child function used to hold the body of
5560 1.5 mrg OMP_PARALLEL_STMT. */
5561 1.1 mrg
5562 1.1 mrg static inline tree *
5563 1.5 mrg gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5564 1.1 mrg {
5565 1.5 mrg return &omp_parallel_stmt->child_fn;
5566 1.1 mrg }
5567 1.1 mrg
5568 1.1 mrg
5569 1.5 mrg /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5570 1.1 mrg
5571 1.1 mrg static inline void
5572 1.5 mrg gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5573 1.5 mrg tree child_fn)
5574 1.1 mrg {
5575 1.5 mrg omp_parallel_stmt->child_fn = child_fn;
5576 1.1 mrg }
5577 1.1 mrg
5578 1.1 mrg
5579 1.1 mrg /* Return the artificial argument used to send variables and values
5580 1.5 mrg from the parent to the children threads in OMP_PARALLEL_STMT. */
5581 1.1 mrg
5582 1.1 mrg static inline tree
5583 1.5 mrg gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5584 1.1 mrg {
5585 1.5 mrg return omp_parallel_stmt->data_arg;
5586 1.1 mrg }
5587 1.1 mrg
5588 1.1 mrg
5589 1.5 mrg /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5590 1.1 mrg
5591 1.1 mrg static inline tree *
5592 1.5 mrg gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5593 1.1 mrg {
5594 1.5 mrg return &omp_parallel_stmt->data_arg;
5595 1.1 mrg }
5596 1.1 mrg
5597 1.1 mrg
5598 1.5 mrg /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5599 1.1 mrg
5600 1.1 mrg static inline void
5601 1.5 mrg gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5602 1.5 mrg tree data_arg)
5603 1.1 mrg {
5604 1.5 mrg omp_parallel_stmt->data_arg = data_arg;
5605 1.1 mrg }
5606 1.1 mrg
5607 1.6 mrg /* Return the kernel_phony flag of OMP_PARALLEL_STMT. */
5608 1.6 mrg
5609 1.6 mrg static inline bool
5610 1.6 mrg gimple_omp_parallel_grid_phony (const gomp_parallel *stmt)
5611 1.6 mrg {
5612 1.6 mrg return (gimple_omp_subcode (stmt) & GF_OMP_PARALLEL_GRID_PHONY) != 0;
5613 1.6 mrg }
5614 1.6 mrg
5615 1.6 mrg /* Set kernel_phony flag of OMP_PARALLEL_STMT to VALUE. */
5616 1.6 mrg
5617 1.6 mrg static inline void
5618 1.6 mrg gimple_omp_parallel_set_grid_phony (gomp_parallel *stmt, bool value)
5619 1.6 mrg {
5620 1.6 mrg if (value)
5621 1.6 mrg stmt->subcode |= GF_OMP_PARALLEL_GRID_PHONY;
5622 1.6 mrg else
5623 1.6 mrg stmt->subcode &= ~GF_OMP_PARALLEL_GRID_PHONY;
5624 1.6 mrg }
5625 1.1 mrg
5626 1.1 mrg /* Return the clauses associated with OMP_TASK GS. */
5627 1.1 mrg
5628 1.1 mrg static inline tree
5629 1.6 mrg gimple_omp_task_clauses (const gimple *gs)
5630 1.1 mrg {
5631 1.5 mrg const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5632 1.5 mrg return omp_task_stmt->clauses;
5633 1.1 mrg }
5634 1.1 mrg
5635 1.1 mrg
5636 1.1 mrg /* Return a pointer to the clauses associated with OMP_TASK GS. */
5637 1.1 mrg
5638 1.1 mrg static inline tree *
5639 1.6 mrg gimple_omp_task_clauses_ptr (gimple *gs)
5640 1.1 mrg {
5641 1.5 mrg gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5642 1.5 mrg return &omp_task_stmt->clauses;
5643 1.1 mrg }
5644 1.1 mrg
5645 1.1 mrg
5646 1.1 mrg /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5647 1.1 mrg GS. */
5648 1.1 mrg
5649 1.1 mrg static inline void
5650 1.6 mrg gimple_omp_task_set_clauses (gimple *gs, tree clauses)
5651 1.1 mrg {
5652 1.5 mrg gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5653 1.5 mrg omp_task_stmt->clauses = clauses;
5654 1.1 mrg }
5655 1.1 mrg
5656 1.1 mrg
5657 1.6 mrg /* Return true if OMP task statement G has the
5658 1.6 mrg GF_OMP_TASK_TASKLOOP flag set. */
5659 1.6 mrg
5660 1.6 mrg static inline bool
5661 1.6 mrg gimple_omp_task_taskloop_p (const gimple *g)
5662 1.6 mrg {
5663 1.6 mrg GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5664 1.6 mrg return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
5665 1.6 mrg }
5666 1.6 mrg
5667 1.6 mrg
5668 1.6 mrg /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5669 1.6 mrg value of TASKLOOP_P. */
5670 1.6 mrg
5671 1.6 mrg static inline void
5672 1.6 mrg gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
5673 1.6 mrg {
5674 1.6 mrg GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5675 1.6 mrg if (taskloop_p)
5676 1.6 mrg g->subcode |= GF_OMP_TASK_TASKLOOP;
5677 1.6 mrg else
5678 1.6 mrg g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5679 1.6 mrg }
5680 1.6 mrg
5681 1.6 mrg
5682 1.11 mrg /* Return true if OMP task statement G has the
5683 1.11 mrg GF_OMP_TASK_TASKWAIT flag set. */
5684 1.11 mrg
5685 1.11 mrg static inline bool
5686 1.11 mrg gimple_omp_task_taskwait_p (const gimple *g)
5687 1.11 mrg {
5688 1.11 mrg GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5689 1.11 mrg return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKWAIT) != 0;
5690 1.11 mrg }
5691 1.11 mrg
5692 1.11 mrg
5693 1.11 mrg /* Set the GF_OMP_TASK_TASKWAIT field in G depending on the boolean
5694 1.11 mrg value of TASKWAIT_P. */
5695 1.11 mrg
5696 1.11 mrg static inline void
5697 1.11 mrg gimple_omp_task_set_taskwait_p (gimple *g, bool taskwait_p)
5698 1.11 mrg {
5699 1.11 mrg GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5700 1.11 mrg if (taskwait_p)
5701 1.11 mrg g->subcode |= GF_OMP_TASK_TASKWAIT;
5702 1.11 mrg else
5703 1.11 mrg g->subcode &= ~GF_OMP_TASK_TASKWAIT;
5704 1.11 mrg }
5705 1.11 mrg
5706 1.11 mrg
5707 1.1 mrg /* Return the child function used to hold the body of OMP_TASK GS. */
5708 1.1 mrg
5709 1.1 mrg static inline tree
5710 1.6 mrg gimple_omp_task_child_fn (const gimple *gs)
5711 1.1 mrg {
5712 1.5 mrg const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5713 1.5 mrg return omp_task_stmt->child_fn;
5714 1.1 mrg }
5715 1.1 mrg
5716 1.1 mrg /* Return a pointer to the child function used to hold the body of
5717 1.1 mrg OMP_TASK GS. */
5718 1.1 mrg
5719 1.1 mrg static inline tree *
5720 1.6 mrg gimple_omp_task_child_fn_ptr (gimple *gs)
5721 1.1 mrg {
5722 1.5 mrg gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5723 1.5 mrg return &omp_task_stmt->child_fn;
5724 1.1 mrg }
5725 1.1 mrg
5726 1.1 mrg
5727 1.1 mrg /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5728 1.1 mrg
5729 1.1 mrg static inline void
5730 1.6 mrg gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
5731 1.1 mrg {
5732 1.5 mrg gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5733 1.5 mrg omp_task_stmt->child_fn = child_fn;
5734 1.5 mrg }
5735 1.5 mrg
5736 1.5 mrg
5737 1.5 mrg /* Return the artificial argument used to send variables and values
5738 1.5 mrg from the parent to the children threads in OMP_TASK GS. */
5739 1.5 mrg
5740 1.5 mrg static inline tree
5741 1.6 mrg gimple_omp_task_data_arg (const gimple *gs)
5742 1.5 mrg {
5743 1.5 mrg const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5744 1.5 mrg return omp_task_stmt->data_arg;
5745 1.5 mrg }
5746 1.5 mrg
5747 1.5 mrg
5748 1.5 mrg /* Return a pointer to the data argument for OMP_TASK GS. */
5749 1.5 mrg
5750 1.5 mrg static inline tree *
5751 1.6 mrg gimple_omp_task_data_arg_ptr (gimple *gs)
5752 1.5 mrg {
5753 1.5 mrg gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5754 1.5 mrg return &omp_task_stmt->data_arg;
5755 1.5 mrg }
5756 1.5 mrg
5757 1.5 mrg
5758 1.5 mrg /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5759 1.5 mrg
5760 1.5 mrg static inline void
5761 1.6 mrg gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
5762 1.5 mrg {
5763 1.5 mrg gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5764 1.5 mrg omp_task_stmt->data_arg = data_arg;
5765 1.5 mrg }
5766 1.5 mrg
5767 1.5 mrg
5768 1.5 mrg /* Return the clauses associated with OMP_TASK GS. */
5769 1.5 mrg
5770 1.5 mrg static inline tree
5771 1.6 mrg gimple_omp_taskreg_clauses (const gimple *gs)
5772 1.5 mrg {
5773 1.5 mrg const gimple_statement_omp_taskreg *omp_taskreg_stmt
5774 1.5 mrg = as_a <const gimple_statement_omp_taskreg *> (gs);
5775 1.5 mrg return omp_taskreg_stmt->clauses;
5776 1.5 mrg }
5777 1.5 mrg
5778 1.5 mrg
5779 1.5 mrg /* Return a pointer to the clauses associated with OMP_TASK GS. */
5780 1.5 mrg
5781 1.5 mrg static inline tree *
5782 1.6 mrg gimple_omp_taskreg_clauses_ptr (gimple *gs)
5783 1.5 mrg {
5784 1.5 mrg gimple_statement_omp_taskreg *omp_taskreg_stmt
5785 1.5 mrg = as_a <gimple_statement_omp_taskreg *> (gs);
5786 1.5 mrg return &omp_taskreg_stmt->clauses;
5787 1.5 mrg }
5788 1.5 mrg
5789 1.5 mrg
5790 1.5 mrg /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5791 1.5 mrg GS. */
5792 1.5 mrg
5793 1.5 mrg static inline void
5794 1.6 mrg gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
5795 1.5 mrg {
5796 1.5 mrg gimple_statement_omp_taskreg *omp_taskreg_stmt
5797 1.5 mrg = as_a <gimple_statement_omp_taskreg *> (gs);
5798 1.5 mrg omp_taskreg_stmt->clauses = clauses;
5799 1.5 mrg }
5800 1.5 mrg
5801 1.5 mrg
5802 1.5 mrg /* Return the child function used to hold the body of OMP_TASK GS. */
5803 1.5 mrg
5804 1.5 mrg static inline tree
5805 1.6 mrg gimple_omp_taskreg_child_fn (const gimple *gs)
5806 1.5 mrg {
5807 1.5 mrg const gimple_statement_omp_taskreg *omp_taskreg_stmt
5808 1.5 mrg = as_a <const gimple_statement_omp_taskreg *> (gs);
5809 1.5 mrg return omp_taskreg_stmt->child_fn;
5810 1.5 mrg }
5811 1.5 mrg
5812 1.5 mrg /* Return a pointer to the child function used to hold the body of
5813 1.5 mrg OMP_TASK GS. */
5814 1.5 mrg
5815 1.5 mrg static inline tree *
5816 1.6 mrg gimple_omp_taskreg_child_fn_ptr (gimple *gs)
5817 1.5 mrg {
5818 1.5 mrg gimple_statement_omp_taskreg *omp_taskreg_stmt
5819 1.5 mrg = as_a <gimple_statement_omp_taskreg *> (gs);
5820 1.5 mrg return &omp_taskreg_stmt->child_fn;
5821 1.5 mrg }
5822 1.5 mrg
5823 1.5 mrg
5824 1.5 mrg /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5825 1.5 mrg
5826 1.5 mrg static inline void
5827 1.6 mrg gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
5828 1.5 mrg {
5829 1.5 mrg gimple_statement_omp_taskreg *omp_taskreg_stmt
5830 1.5 mrg = as_a <gimple_statement_omp_taskreg *> (gs);
5831 1.5 mrg omp_taskreg_stmt->child_fn = child_fn;
5832 1.5 mrg }
5833 1.5 mrg
5834 1.5 mrg
5835 1.5 mrg /* Return the artificial argument used to send variables and values
5836 1.5 mrg from the parent to the children threads in OMP_TASK GS. */
5837 1.5 mrg
5838 1.5 mrg static inline tree
5839 1.6 mrg gimple_omp_taskreg_data_arg (const gimple *gs)
5840 1.5 mrg {
5841 1.5 mrg const gimple_statement_omp_taskreg *omp_taskreg_stmt
5842 1.5 mrg = as_a <const gimple_statement_omp_taskreg *> (gs);
5843 1.5 mrg return omp_taskreg_stmt->data_arg;
5844 1.5 mrg }
5845 1.5 mrg
5846 1.5 mrg
5847 1.5 mrg /* Return a pointer to the data argument for OMP_TASK GS. */
5848 1.5 mrg
5849 1.5 mrg static inline tree *
5850 1.6 mrg gimple_omp_taskreg_data_arg_ptr (gimple *gs)
5851 1.5 mrg {
5852 1.5 mrg gimple_statement_omp_taskreg *omp_taskreg_stmt
5853 1.5 mrg = as_a <gimple_statement_omp_taskreg *> (gs);
5854 1.5 mrg return &omp_taskreg_stmt->data_arg;
5855 1.5 mrg }
5856 1.5 mrg
5857 1.5 mrg
5858 1.5 mrg /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5859 1.5 mrg
5860 1.5 mrg static inline void
5861 1.6 mrg gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
5862 1.5 mrg {
5863 1.5 mrg gimple_statement_omp_taskreg *omp_taskreg_stmt
5864 1.5 mrg = as_a <gimple_statement_omp_taskreg *> (gs);
5865 1.5 mrg omp_taskreg_stmt->data_arg = data_arg;
5866 1.5 mrg }
5867 1.5 mrg
5868 1.5 mrg
5869 1.5 mrg /* Return the copy function used to hold the body of OMP_TASK GS. */
5870 1.5 mrg
5871 1.5 mrg static inline tree
5872 1.6 mrg gimple_omp_task_copy_fn (const gimple *gs)
5873 1.5 mrg {
5874 1.5 mrg const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5875 1.5 mrg return omp_task_stmt->copy_fn;
5876 1.5 mrg }
5877 1.5 mrg
5878 1.5 mrg /* Return a pointer to the copy function used to hold the body of
5879 1.5 mrg OMP_TASK GS. */
5880 1.5 mrg
5881 1.5 mrg static inline tree *
5882 1.6 mrg gimple_omp_task_copy_fn_ptr (gimple *gs)
5883 1.5 mrg {
5884 1.5 mrg gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5885 1.5 mrg return &omp_task_stmt->copy_fn;
5886 1.5 mrg }
5887 1.5 mrg
5888 1.5 mrg
5889 1.5 mrg /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5890 1.5 mrg
5891 1.5 mrg static inline void
5892 1.6 mrg gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
5893 1.5 mrg {
5894 1.5 mrg gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5895 1.5 mrg omp_task_stmt->copy_fn = copy_fn;
5896 1.1 mrg }
5897 1.1 mrg
5898 1.1 mrg
5899 1.5 mrg /* Return size of the data block in bytes in OMP_TASK GS. */
5900 1.1 mrg
5901 1.1 mrg static inline tree
5902 1.6 mrg gimple_omp_task_arg_size (const gimple *gs)
5903 1.1 mrg {
5904 1.5 mrg const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5905 1.5 mrg return omp_task_stmt->arg_size;
5906 1.1 mrg }
5907 1.1 mrg
5908 1.1 mrg
5909 1.5 mrg /* Return a pointer to the data block size for OMP_TASK GS. */
5910 1.1 mrg
5911 1.1 mrg static inline tree *
5912 1.6 mrg gimple_omp_task_arg_size_ptr (gimple *gs)
5913 1.1 mrg {
5914 1.5 mrg gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5915 1.5 mrg return &omp_task_stmt->arg_size;
5916 1.1 mrg }
5917 1.1 mrg
5918 1.1 mrg
5919 1.5 mrg /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5920 1.1 mrg
5921 1.1 mrg static inline void
5922 1.6 mrg gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
5923 1.1 mrg {
5924 1.5 mrg gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5925 1.5 mrg omp_task_stmt->arg_size = arg_size;
5926 1.1 mrg }
5927 1.1 mrg
5928 1.1 mrg
5929 1.5 mrg /* Return align of the data block in bytes in OMP_TASK GS. */
5930 1.1 mrg
5931 1.1 mrg static inline tree
5932 1.6 mrg gimple_omp_task_arg_align (const gimple *gs)
5933 1.1 mrg {
5934 1.5 mrg const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5935 1.5 mrg return omp_task_stmt->arg_align;
5936 1.1 mrg }
5937 1.1 mrg
5938 1.1 mrg
5939 1.5 mrg /* Return a pointer to the data block align for OMP_TASK GS. */
5940 1.1 mrg
5941 1.1 mrg static inline tree *
5942 1.6 mrg gimple_omp_task_arg_align_ptr (gimple *gs)
5943 1.1 mrg {
5944 1.5 mrg gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5945 1.5 mrg return &omp_task_stmt->arg_align;
5946 1.1 mrg }
5947 1.1 mrg
5948 1.1 mrg
5949 1.5 mrg /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5950 1.1 mrg
5951 1.1 mrg static inline void
5952 1.6 mrg gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
5953 1.1 mrg {
5954 1.5 mrg gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5955 1.5 mrg omp_task_stmt->arg_align = arg_align;
5956 1.1 mrg }
5957 1.1 mrg
5958 1.1 mrg
5959 1.5 mrg /* Return the clauses associated with OMP_SINGLE GS. */
5960 1.1 mrg
5961 1.1 mrg static inline tree
5962 1.6 mrg gimple_omp_single_clauses (const gimple *gs)
5963 1.1 mrg {
5964 1.5 mrg const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
5965 1.5 mrg return omp_single_stmt->clauses;
5966 1.1 mrg }
5967 1.1 mrg
5968 1.5 mrg
5969 1.5 mrg /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5970 1.1 mrg
5971 1.1 mrg static inline tree *
5972 1.6 mrg gimple_omp_single_clauses_ptr (gimple *gs)
5973 1.1 mrg {
5974 1.5 mrg gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
5975 1.5 mrg return &omp_single_stmt->clauses;
5976 1.1 mrg }
5977 1.1 mrg
5978 1.1 mrg
5979 1.5 mrg /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5980 1.1 mrg
5981 1.1 mrg static inline void
5982 1.5 mrg gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
5983 1.1 mrg {
5984 1.5 mrg omp_single_stmt->clauses = clauses;
5985 1.1 mrg }
5986 1.1 mrg
5987 1.1 mrg
5988 1.5 mrg /* Return the clauses associated with OMP_TARGET GS. */
5989 1.1 mrg
5990 1.1 mrg static inline tree
5991 1.6 mrg gimple_omp_target_clauses (const gimple *gs)
5992 1.1 mrg {
5993 1.5 mrg const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
5994 1.5 mrg return omp_target_stmt->clauses;
5995 1.1 mrg }
5996 1.1 mrg
5997 1.1 mrg
5998 1.5 mrg /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5999 1.1 mrg
6000 1.1 mrg static inline tree *
6001 1.6 mrg gimple_omp_target_clauses_ptr (gimple *gs)
6002 1.1 mrg {
6003 1.5 mrg gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
6004 1.5 mrg return &omp_target_stmt->clauses;
6005 1.1 mrg }
6006 1.1 mrg
6007 1.1 mrg
6008 1.5 mrg /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
6009 1.1 mrg
6010 1.1 mrg static inline void
6011 1.5 mrg gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
6012 1.5 mrg tree clauses)
6013 1.1 mrg {
6014 1.5 mrg omp_target_stmt->clauses = clauses;
6015 1.1 mrg }
6016 1.1 mrg
6017 1.1 mrg
6018 1.5 mrg /* Return the kind of the OMP_TARGET G. */
6019 1.1 mrg
6020 1.5 mrg static inline int
6021 1.6 mrg gimple_omp_target_kind (const gimple *g)
6022 1.1 mrg {
6023 1.5 mrg GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
6024 1.5 mrg return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
6025 1.1 mrg }
6026 1.1 mrg
6027 1.1 mrg
6028 1.5 mrg /* Set the kind of the OMP_TARGET G. */
6029 1.1 mrg
6030 1.1 mrg static inline void
6031 1.5 mrg gimple_omp_target_set_kind (gomp_target *g, int kind)
6032 1.1 mrg {
6033 1.5 mrg g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
6034 1.5 mrg | (kind & GF_OMP_TARGET_KIND_MASK);
6035 1.1 mrg }
6036 1.1 mrg
6037 1.1 mrg
6038 1.5 mrg /* Return the child function used to hold the body of OMP_TARGET_STMT. */
6039 1.1 mrg
6040 1.1 mrg static inline tree
6041 1.5 mrg gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
6042 1.1 mrg {
6043 1.5 mrg return omp_target_stmt->child_fn;
6044 1.1 mrg }
6045 1.1 mrg
6046 1.5 mrg /* Return a pointer to the child function used to hold the body of
6047 1.5 mrg OMP_TARGET_STMT. */
6048 1.1 mrg
6049 1.1 mrg static inline tree *
6050 1.5 mrg gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
6051 1.1 mrg {
6052 1.5 mrg return &omp_target_stmt->child_fn;
6053 1.1 mrg }
6054 1.1 mrg
6055 1.1 mrg
6056 1.5 mrg /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
6057 1.1 mrg
6058 1.1 mrg static inline void
6059 1.5 mrg gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
6060 1.5 mrg tree child_fn)
6061 1.1 mrg {
6062 1.5 mrg omp_target_stmt->child_fn = child_fn;
6063 1.1 mrg }
6064 1.1 mrg
6065 1.1 mrg
6066 1.5 mrg /* Return the artificial argument used to send variables and values
6067 1.5 mrg from the parent to the children threads in OMP_TARGET_STMT. */
6068 1.1 mrg
6069 1.1 mrg static inline tree
6070 1.5 mrg gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
6071 1.1 mrg {
6072 1.5 mrg return omp_target_stmt->data_arg;
6073 1.1 mrg }
6074 1.1 mrg
6075 1.1 mrg
6076 1.5 mrg /* Return a pointer to the data argument for OMP_TARGET GS. */
6077 1.1 mrg
6078 1.1 mrg static inline tree *
6079 1.5 mrg gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
6080 1.1 mrg {
6081 1.5 mrg return &omp_target_stmt->data_arg;
6082 1.1 mrg }
6083 1.1 mrg
6084 1.1 mrg
6085 1.5 mrg /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
6086 1.1 mrg
6087 1.1 mrg static inline void
6088 1.5 mrg gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
6089 1.5 mrg tree data_arg)
6090 1.1 mrg {
6091 1.5 mrg omp_target_stmt->data_arg = data_arg;
6092 1.1 mrg }
6093 1.1 mrg
6094 1.1 mrg
6095 1.5 mrg /* Return the clauses associated with OMP_TEAMS GS. */
6096 1.1 mrg
6097 1.1 mrg static inline tree
6098 1.6 mrg gimple_omp_teams_clauses (const gimple *gs)
6099 1.1 mrg {
6100 1.5 mrg const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
6101 1.5 mrg return omp_teams_stmt->clauses;
6102 1.1 mrg }
6103 1.1 mrg
6104 1.1 mrg
6105 1.5 mrg /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
6106 1.1 mrg
6107 1.1 mrg static inline tree *
6108 1.6 mrg gimple_omp_teams_clauses_ptr (gimple *gs)
6109 1.1 mrg {
6110 1.5 mrg gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
6111 1.5 mrg return &omp_teams_stmt->clauses;
6112 1.1 mrg }
6113 1.1 mrg
6114 1.1 mrg
6115 1.5 mrg /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
6116 1.1 mrg
6117 1.1 mrg static inline void
6118 1.5 mrg gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
6119 1.1 mrg {
6120 1.5 mrg omp_teams_stmt->clauses = clauses;
6121 1.1 mrg }
6122 1.1 mrg
6123 1.11 mrg /* Return the child function used to hold the body of OMP_TEAMS_STMT. */
6124 1.11 mrg
6125 1.11 mrg static inline tree
6126 1.11 mrg gimple_omp_teams_child_fn (const gomp_teams *omp_teams_stmt)
6127 1.11 mrg {
6128 1.11 mrg return omp_teams_stmt->child_fn;
6129 1.11 mrg }
6130 1.11 mrg
6131 1.11 mrg /* Return a pointer to the child function used to hold the body of
6132 1.11 mrg OMP_TEAMS_STMT. */
6133 1.11 mrg
6134 1.11 mrg static inline tree *
6135 1.11 mrg gimple_omp_teams_child_fn_ptr (gomp_teams *omp_teams_stmt)
6136 1.11 mrg {
6137 1.11 mrg return &omp_teams_stmt->child_fn;
6138 1.11 mrg }
6139 1.11 mrg
6140 1.11 mrg
6141 1.11 mrg /* Set CHILD_FN to be the child function for OMP_TEAMS_STMT. */
6142 1.11 mrg
6143 1.11 mrg static inline void
6144 1.11 mrg gimple_omp_teams_set_child_fn (gomp_teams *omp_teams_stmt, tree child_fn)
6145 1.11 mrg {
6146 1.11 mrg omp_teams_stmt->child_fn = child_fn;
6147 1.11 mrg }
6148 1.11 mrg
6149 1.11 mrg
6150 1.11 mrg /* Return the artificial argument used to send variables and values
6151 1.11 mrg from the parent to the children threads in OMP_TEAMS_STMT. */
6152 1.11 mrg
6153 1.11 mrg static inline tree
6154 1.11 mrg gimple_omp_teams_data_arg (const gomp_teams *omp_teams_stmt)
6155 1.11 mrg {
6156 1.11 mrg return omp_teams_stmt->data_arg;
6157 1.11 mrg }
6158 1.11 mrg
6159 1.11 mrg
6160 1.11 mrg /* Return a pointer to the data argument for OMP_TEAMS_STMT. */
6161 1.11 mrg
6162 1.11 mrg static inline tree *
6163 1.11 mrg gimple_omp_teams_data_arg_ptr (gomp_teams *omp_teams_stmt)
6164 1.11 mrg {
6165 1.11 mrg return &omp_teams_stmt->data_arg;
6166 1.11 mrg }
6167 1.11 mrg
6168 1.11 mrg
6169 1.11 mrg /* Set DATA_ARG to be the data argument for OMP_TEAMS_STMT. */
6170 1.11 mrg
6171 1.11 mrg static inline void
6172 1.11 mrg gimple_omp_teams_set_data_arg (gomp_teams *omp_teams_stmt, tree data_arg)
6173 1.11 mrg {
6174 1.11 mrg omp_teams_stmt->data_arg = data_arg;
6175 1.11 mrg }
6176 1.11 mrg
6177 1.6 mrg /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */
6178 1.6 mrg
6179 1.6 mrg static inline bool
6180 1.6 mrg gimple_omp_teams_grid_phony (const gomp_teams *omp_teams_stmt)
6181 1.6 mrg {
6182 1.6 mrg return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_GRID_PHONY) != 0;
6183 1.6 mrg }
6184 1.6 mrg
6185 1.6 mrg /* Set kernel_phony flag of an OMP_TEAMS_STMT to VALUE. */
6186 1.6 mrg
6187 1.6 mrg static inline void
6188 1.6 mrg gimple_omp_teams_set_grid_phony (gomp_teams *omp_teams_stmt, bool value)
6189 1.6 mrg {
6190 1.6 mrg if (value)
6191 1.6 mrg omp_teams_stmt->subcode |= GF_OMP_TEAMS_GRID_PHONY;
6192 1.6 mrg else
6193 1.6 mrg omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_GRID_PHONY;
6194 1.6 mrg }
6195 1.1 mrg
6196 1.11 mrg /* Return the host flag of an OMP_TEAMS_STMT. */
6197 1.11 mrg
6198 1.11 mrg static inline bool
6199 1.11 mrg gimple_omp_teams_host (const gomp_teams *omp_teams_stmt)
6200 1.11 mrg {
6201 1.11 mrg return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_HOST) != 0;
6202 1.11 mrg }
6203 1.11 mrg
6204 1.11 mrg /* Set host flag of an OMP_TEAMS_STMT to VALUE. */
6205 1.11 mrg
6206 1.11 mrg static inline void
6207 1.11 mrg gimple_omp_teams_set_host (gomp_teams *omp_teams_stmt, bool value)
6208 1.11 mrg {
6209 1.11 mrg if (value)
6210 1.11 mrg omp_teams_stmt->subcode |= GF_OMP_TEAMS_HOST;
6211 1.11 mrg else
6212 1.11 mrg omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_HOST;
6213 1.11 mrg }
6214 1.11 mrg
6215 1.1 mrg /* Return the clauses associated with OMP_SECTIONS GS. */
6216 1.1 mrg
6217 1.1 mrg static inline tree
6218 1.6 mrg gimple_omp_sections_clauses (const gimple *gs)
6219 1.1 mrg {
6220 1.5 mrg const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
6221 1.5 mrg return omp_sections_stmt->clauses;
6222 1.1 mrg }
6223 1.1 mrg
6224 1.1 mrg
6225 1.1 mrg /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
6226 1.1 mrg
6227 1.1 mrg static inline tree *
6228 1.6 mrg gimple_omp_sections_clauses_ptr (gimple *gs)
6229 1.1 mrg {
6230 1.5 mrg gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6231 1.5 mrg return &omp_sections_stmt->clauses;
6232 1.1 mrg }
6233 1.1 mrg
6234 1.1 mrg
6235 1.1 mrg /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
6236 1.1 mrg GS. */
6237 1.1 mrg
6238 1.1 mrg static inline void
6239 1.6 mrg gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
6240 1.1 mrg {
6241 1.5 mrg gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6242 1.5 mrg omp_sections_stmt->clauses = clauses;
6243 1.1 mrg }
6244 1.1 mrg
6245 1.1 mrg
6246 1.1 mrg /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
6247 1.1 mrg in GS. */
6248 1.1 mrg
6249 1.1 mrg static inline tree
6250 1.6 mrg gimple_omp_sections_control (const gimple *gs)
6251 1.1 mrg {
6252 1.5 mrg const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
6253 1.5 mrg return omp_sections_stmt->control;
6254 1.1 mrg }
6255 1.1 mrg
6256 1.1 mrg
6257 1.1 mrg /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
6258 1.1 mrg GS. */
6259 1.1 mrg
6260 1.1 mrg static inline tree *
6261 1.6 mrg gimple_omp_sections_control_ptr (gimple *gs)
6262 1.1 mrg {
6263 1.5 mrg gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6264 1.5 mrg return &omp_sections_stmt->control;
6265 1.1 mrg }
6266 1.1 mrg
6267 1.1 mrg
6268 1.1 mrg /* Set CONTROL to be the set of clauses associated with the
6269 1.1 mrg GIMPLE_OMP_SECTIONS in GS. */
6270 1.1 mrg
6271 1.1 mrg static inline void
6272 1.6 mrg gimple_omp_sections_set_control (gimple *gs, tree control)
6273 1.1 mrg {
6274 1.5 mrg gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6275 1.5 mrg omp_sections_stmt->control = control;
6276 1.1 mrg }
6277 1.1 mrg
6278 1.1 mrg
6279 1.1 mrg /* Set the value being stored in an atomic store. */
6280 1.1 mrg
6281 1.1 mrg static inline void
6282 1.5 mrg gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
6283 1.1 mrg {
6284 1.5 mrg store_stmt->val = val;
6285 1.1 mrg }
6286 1.1 mrg
6287 1.1 mrg
6288 1.1 mrg /* Return the value being stored in an atomic store. */
6289 1.1 mrg
6290 1.1 mrg static inline tree
6291 1.5 mrg gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
6292 1.1 mrg {
6293 1.5 mrg return store_stmt->val;
6294 1.1 mrg }
6295 1.1 mrg
6296 1.1 mrg
6297 1.1 mrg /* Return a pointer to the value being stored in an atomic store. */
6298 1.1 mrg
6299 1.1 mrg static inline tree *
6300 1.5 mrg gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
6301 1.1 mrg {
6302 1.5 mrg return &store_stmt->val;
6303 1.1 mrg }
6304 1.1 mrg
6305 1.1 mrg
6306 1.1 mrg /* Set the LHS of an atomic load. */
6307 1.1 mrg
6308 1.1 mrg static inline void
6309 1.5 mrg gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
6310 1.1 mrg {
6311 1.5 mrg load_stmt->lhs = lhs;
6312 1.1 mrg }
6313 1.1 mrg
6314 1.1 mrg
6315 1.1 mrg /* Get the LHS of an atomic load. */
6316 1.1 mrg
6317 1.1 mrg static inline tree
6318 1.5 mrg gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
6319 1.1 mrg {
6320 1.5 mrg return load_stmt->lhs;
6321 1.1 mrg }
6322 1.1 mrg
6323 1.1 mrg
6324 1.1 mrg /* Return a pointer to the LHS of an atomic load. */
6325 1.1 mrg
6326 1.1 mrg static inline tree *
6327 1.5 mrg gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
6328 1.1 mrg {
6329 1.5 mrg return &load_stmt->lhs;
6330 1.1 mrg }
6331 1.1 mrg
6332 1.1 mrg
6333 1.1 mrg /* Set the RHS of an atomic load. */
6334 1.1 mrg
6335 1.1 mrg static inline void
6336 1.5 mrg gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
6337 1.1 mrg {
6338 1.5 mrg load_stmt->rhs = rhs;
6339 1.1 mrg }
6340 1.1 mrg
6341 1.1 mrg
6342 1.1 mrg /* Get the RHS of an atomic load. */
6343 1.1 mrg
6344 1.1 mrg static inline tree
6345 1.5 mrg gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
6346 1.1 mrg {
6347 1.5 mrg return load_stmt->rhs;
6348 1.1 mrg }
6349 1.1 mrg
6350 1.1 mrg
6351 1.1 mrg /* Return a pointer to the RHS of an atomic load. */
6352 1.1 mrg
6353 1.1 mrg static inline tree *
6354 1.5 mrg gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
6355 1.1 mrg {
6356 1.5 mrg return &load_stmt->rhs;
6357 1.1 mrg }
6358 1.1 mrg
6359 1.1 mrg
6360 1.1 mrg /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6361 1.1 mrg
6362 1.1 mrg static inline tree
6363 1.5 mrg gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
6364 1.1 mrg {
6365 1.5 mrg return cont_stmt->control_def;
6366 1.1 mrg }
6367 1.1 mrg
6368 1.1 mrg /* The same as above, but return the address. */
6369 1.1 mrg
6370 1.1 mrg static inline tree *
6371 1.5 mrg gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
6372 1.1 mrg {
6373 1.5 mrg return &cont_stmt->control_def;
6374 1.1 mrg }
6375 1.1 mrg
6376 1.1 mrg /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6377 1.1 mrg
6378 1.1 mrg static inline void
6379 1.5 mrg gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
6380 1.1 mrg {
6381 1.5 mrg cont_stmt->control_def = def;
6382 1.1 mrg }
6383 1.1 mrg
6384 1.1 mrg
6385 1.1 mrg /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6386 1.1 mrg
6387 1.1 mrg static inline tree
6388 1.5 mrg gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
6389 1.1 mrg {
6390 1.5 mrg return cont_stmt->control_use;
6391 1.1 mrg }
6392 1.1 mrg
6393 1.1 mrg
6394 1.1 mrg /* The same as above, but return the address. */
6395 1.1 mrg
6396 1.1 mrg static inline tree *
6397 1.5 mrg gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
6398 1.1 mrg {
6399 1.5 mrg return &cont_stmt->control_use;
6400 1.1 mrg }
6401 1.1 mrg
6402 1.1 mrg
6403 1.1 mrg /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6404 1.1 mrg
6405 1.1 mrg static inline void
6406 1.5 mrg gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
6407 1.1 mrg {
6408 1.5 mrg cont_stmt->control_use = use;
6409 1.1 mrg }
6410 1.1 mrg
6411 1.5 mrg /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
6412 1.5 mrg TRANSACTION_STMT. */
6413 1.3 mrg
6414 1.3 mrg static inline gimple_seq *
6415 1.5 mrg gimple_transaction_body_ptr (gtransaction *transaction_stmt)
6416 1.3 mrg {
6417 1.5 mrg return &transaction_stmt->body;
6418 1.3 mrg }
6419 1.3 mrg
6420 1.5 mrg /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
6421 1.3 mrg
6422 1.3 mrg static inline gimple_seq
6423 1.12 mrg gimple_transaction_body (const gtransaction *transaction_stmt)
6424 1.3 mrg {
6425 1.6 mrg return transaction_stmt->body;
6426 1.3 mrg }
6427 1.3 mrg
6428 1.3 mrg /* Return the label associated with a GIMPLE_TRANSACTION. */
6429 1.3 mrg
6430 1.3 mrg static inline tree
6431 1.6 mrg gimple_transaction_label_norm (const gtransaction *transaction_stmt)
6432 1.6 mrg {
6433 1.6 mrg return transaction_stmt->label_norm;
6434 1.6 mrg }
6435 1.6 mrg
6436 1.6 mrg static inline tree *
6437 1.6 mrg gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt)
6438 1.6 mrg {
6439 1.6 mrg return &transaction_stmt->label_norm;
6440 1.6 mrg }
6441 1.6 mrg
6442 1.6 mrg static inline tree
6443 1.6 mrg gimple_transaction_label_uninst (const gtransaction *transaction_stmt)
6444 1.6 mrg {
6445 1.6 mrg return transaction_stmt->label_uninst;
6446 1.6 mrg }
6447 1.6 mrg
6448 1.6 mrg static inline tree *
6449 1.6 mrg gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt)
6450 1.6 mrg {
6451 1.6 mrg return &transaction_stmt->label_uninst;
6452 1.6 mrg }
6453 1.6 mrg
6454 1.6 mrg static inline tree
6455 1.6 mrg gimple_transaction_label_over (const gtransaction *transaction_stmt)
6456 1.3 mrg {
6457 1.6 mrg return transaction_stmt->label_over;
6458 1.3 mrg }
6459 1.3 mrg
6460 1.3 mrg static inline tree *
6461 1.6 mrg gimple_transaction_label_over_ptr (gtransaction *transaction_stmt)
6462 1.3 mrg {
6463 1.6 mrg return &transaction_stmt->label_over;
6464 1.3 mrg }
6465 1.3 mrg
6466 1.3 mrg /* Return the subcode associated with a GIMPLE_TRANSACTION. */
6467 1.3 mrg
6468 1.3 mrg static inline unsigned int
6469 1.5 mrg gimple_transaction_subcode (const gtransaction *transaction_stmt)
6470 1.3 mrg {
6471 1.5 mrg return transaction_stmt->subcode;
6472 1.3 mrg }
6473 1.3 mrg
6474 1.5 mrg /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
6475 1.5 mrg TRANSACTION_STMT. */
6476 1.3 mrg
6477 1.3 mrg static inline void
6478 1.5 mrg gimple_transaction_set_body (gtransaction *transaction_stmt,
6479 1.5 mrg gimple_seq body)
6480 1.3 mrg {
6481 1.5 mrg transaction_stmt->body = body;
6482 1.3 mrg }
6483 1.3 mrg
6484 1.3 mrg /* Set the label associated with a GIMPLE_TRANSACTION. */
6485 1.3 mrg
6486 1.3 mrg static inline void
6487 1.6 mrg gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label)
6488 1.6 mrg {
6489 1.6 mrg transaction_stmt->label_norm = label;
6490 1.6 mrg }
6491 1.6 mrg
6492 1.6 mrg static inline void
6493 1.6 mrg gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label)
6494 1.6 mrg {
6495 1.6 mrg transaction_stmt->label_uninst = label;
6496 1.6 mrg }
6497 1.6 mrg
6498 1.6 mrg static inline void
6499 1.6 mrg gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label)
6500 1.3 mrg {
6501 1.6 mrg transaction_stmt->label_over = label;
6502 1.3 mrg }
6503 1.3 mrg
6504 1.3 mrg /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6505 1.3 mrg
6506 1.3 mrg static inline void
6507 1.5 mrg gimple_transaction_set_subcode (gtransaction *transaction_stmt,
6508 1.5 mrg unsigned int subcode)
6509 1.3 mrg {
6510 1.5 mrg transaction_stmt->subcode = subcode;
6511 1.3 mrg }
6512 1.3 mrg
6513 1.1 mrg /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6514 1.1 mrg
6515 1.1 mrg static inline tree *
6516 1.6 mrg gimple_return_retval_ptr (greturn *gs)
6517 1.1 mrg {
6518 1.6 mrg return &gs->op[0];
6519 1.1 mrg }
6520 1.1 mrg
6521 1.1 mrg /* Return the return value for GIMPLE_RETURN GS. */
6522 1.1 mrg
6523 1.1 mrg static inline tree
6524 1.5 mrg gimple_return_retval (const greturn *gs)
6525 1.1 mrg {
6526 1.6 mrg return gs->op[0];
6527 1.1 mrg }
6528 1.1 mrg
6529 1.1 mrg
6530 1.1 mrg /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6531 1.1 mrg
6532 1.1 mrg static inline void
6533 1.5 mrg gimple_return_set_retval (greturn *gs, tree retval)
6534 1.5 mrg {
6535 1.6 mrg gs->op[0] = retval;
6536 1.5 mrg }
6537 1.5 mrg
6538 1.5 mrg
6539 1.5 mrg /* Returns true when the gimple statement STMT is any of the OMP types. */
6540 1.1 mrg
6541 1.1 mrg #define CASE_GIMPLE_OMP \
6542 1.1 mrg case GIMPLE_OMP_PARALLEL: \
6543 1.1 mrg case GIMPLE_OMP_TASK: \
6544 1.1 mrg case GIMPLE_OMP_FOR: \
6545 1.1 mrg case GIMPLE_OMP_SECTIONS: \
6546 1.1 mrg case GIMPLE_OMP_SECTIONS_SWITCH: \
6547 1.1 mrg case GIMPLE_OMP_SINGLE: \
6548 1.5 mrg case GIMPLE_OMP_TARGET: \
6549 1.5 mrg case GIMPLE_OMP_TEAMS: \
6550 1.1 mrg case GIMPLE_OMP_SECTION: \
6551 1.1 mrg case GIMPLE_OMP_MASTER: \
6552 1.5 mrg case GIMPLE_OMP_TASKGROUP: \
6553 1.1 mrg case GIMPLE_OMP_ORDERED: \
6554 1.1 mrg case GIMPLE_OMP_CRITICAL: \
6555 1.12 mrg case GIMPLE_OMP_SCAN: \
6556 1.1 mrg case GIMPLE_OMP_RETURN: \
6557 1.1 mrg case GIMPLE_OMP_ATOMIC_LOAD: \
6558 1.1 mrg case GIMPLE_OMP_ATOMIC_STORE: \
6559 1.6 mrg case GIMPLE_OMP_CONTINUE: \
6560 1.6 mrg case GIMPLE_OMP_GRID_BODY
6561 1.1 mrg
6562 1.1 mrg static inline bool
6563 1.6 mrg is_gimple_omp (const gimple *stmt)
6564 1.1 mrg {
6565 1.1 mrg switch (gimple_code (stmt))
6566 1.1 mrg {
6567 1.1 mrg CASE_GIMPLE_OMP:
6568 1.1 mrg return true;
6569 1.1 mrg default:
6570 1.1 mrg return false;
6571 1.1 mrg }
6572 1.1 mrg }
6573 1.1 mrg
6574 1.5 mrg /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6575 1.5 mrg specifically. */
6576 1.5 mrg
6577 1.5 mrg static inline bool
6578 1.6 mrg is_gimple_omp_oacc (const gimple *stmt)
6579 1.5 mrg {
6580 1.5 mrg gcc_assert (is_gimple_omp (stmt));
6581 1.5 mrg switch (gimple_code (stmt))
6582 1.5 mrg {
6583 1.5 mrg case GIMPLE_OMP_FOR:
6584 1.5 mrg switch (gimple_omp_for_kind (stmt))
6585 1.5 mrg {
6586 1.5 mrg case GF_OMP_FOR_KIND_OACC_LOOP:
6587 1.5 mrg return true;
6588 1.5 mrg default:
6589 1.5 mrg return false;
6590 1.5 mrg }
6591 1.5 mrg case GIMPLE_OMP_TARGET:
6592 1.5 mrg switch (gimple_omp_target_kind (stmt))
6593 1.5 mrg {
6594 1.5 mrg case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6595 1.5 mrg case GF_OMP_TARGET_KIND_OACC_KERNELS:
6596 1.12 mrg case GF_OMP_TARGET_KIND_OACC_SERIAL:
6597 1.5 mrg case GF_OMP_TARGET_KIND_OACC_DATA:
6598 1.5 mrg case GF_OMP_TARGET_KIND_OACC_UPDATE:
6599 1.5 mrg case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
6600 1.6 mrg case GF_OMP_TARGET_KIND_OACC_DECLARE:
6601 1.6 mrg case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
6602 1.5 mrg return true;
6603 1.5 mrg default:
6604 1.5 mrg return false;
6605 1.5 mrg }
6606 1.5 mrg default:
6607 1.5 mrg return false;
6608 1.5 mrg }
6609 1.5 mrg }
6610 1.5 mrg
6611 1.5 mrg
6612 1.5 mrg /* Return true if the OMP gimple statement STMT is offloaded. */
6613 1.5 mrg
6614 1.5 mrg static inline bool
6615 1.6 mrg is_gimple_omp_offloaded (const gimple *stmt)
6616 1.5 mrg {
6617 1.5 mrg gcc_assert (is_gimple_omp (stmt));
6618 1.5 mrg switch (gimple_code (stmt))
6619 1.5 mrg {
6620 1.5 mrg case GIMPLE_OMP_TARGET:
6621 1.5 mrg switch (gimple_omp_target_kind (stmt))
6622 1.5 mrg {
6623 1.5 mrg case GF_OMP_TARGET_KIND_REGION:
6624 1.5 mrg case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6625 1.5 mrg case GF_OMP_TARGET_KIND_OACC_KERNELS:
6626 1.12 mrg case GF_OMP_TARGET_KIND_OACC_SERIAL:
6627 1.5 mrg return true;
6628 1.5 mrg default:
6629 1.5 mrg return false;
6630 1.5 mrg }
6631 1.5 mrg default:
6632 1.5 mrg return false;
6633 1.5 mrg }
6634 1.5 mrg }
6635 1.5 mrg
6636 1.1 mrg
6637 1.1 mrg /* Returns TRUE if statement G is a GIMPLE_NOP. */
6638 1.1 mrg
6639 1.1 mrg static inline bool
6640 1.6 mrg gimple_nop_p (const gimple *g)
6641 1.1 mrg {
6642 1.1 mrg return gimple_code (g) == GIMPLE_NOP;
6643 1.1 mrg }
6644 1.1 mrg
6645 1.1 mrg
6646 1.1 mrg /* Return true if GS is a GIMPLE_RESX. */
6647 1.1 mrg
6648 1.1 mrg static inline bool
6649 1.6 mrg is_gimple_resx (const gimple *gs)
6650 1.1 mrg {
6651 1.1 mrg return gimple_code (gs) == GIMPLE_RESX;
6652 1.1 mrg }
6653 1.1 mrg
6654 1.1 mrg /* Return the type of the main expression computed by STMT. Return
6655 1.1 mrg void_type_node if the statement computes nothing. */
6656 1.1 mrg
6657 1.1 mrg static inline tree
6658 1.6 mrg gimple_expr_type (const gimple *stmt)
6659 1.1 mrg {
6660 1.1 mrg enum gimple_code code = gimple_code (stmt);
6661 1.6 mrg /* In general we want to pass out a type that can be substituted
6662 1.6 mrg for both the RHS and the LHS types if there is a possibly
6663 1.6 mrg useless conversion involved. That means returning the
6664 1.6 mrg original RHS type as far as we can reconstruct it. */
6665 1.6 mrg if (code == GIMPLE_CALL)
6666 1.6 mrg {
6667 1.6 mrg const gcall *call_stmt = as_a <const gcall *> (stmt);
6668 1.10 mrg if (gimple_call_internal_p (call_stmt))
6669 1.10 mrg switch (gimple_call_internal_fn (call_stmt))
6670 1.10 mrg {
6671 1.10 mrg case IFN_MASK_STORE:
6672 1.10 mrg case IFN_SCATTER_STORE:
6673 1.10 mrg return TREE_TYPE (gimple_call_arg (call_stmt, 3));
6674 1.10 mrg case IFN_MASK_SCATTER_STORE:
6675 1.10 mrg return TREE_TYPE (gimple_call_arg (call_stmt, 4));
6676 1.10 mrg default:
6677 1.10 mrg break;
6678 1.10 mrg }
6679 1.10 mrg return gimple_call_return_type (call_stmt);
6680 1.6 mrg }
6681 1.6 mrg else if (code == GIMPLE_ASSIGN)
6682 1.1 mrg {
6683 1.6 mrg if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
6684 1.6 mrg return TREE_TYPE (gimple_assign_rhs1 (stmt));
6685 1.1 mrg else
6686 1.6 mrg /* As fallback use the type of the LHS. */
6687 1.6 mrg return TREE_TYPE (gimple_get_lhs (stmt));
6688 1.1 mrg }
6689 1.1 mrg else if (code == GIMPLE_COND)
6690 1.1 mrg return boolean_type_node;
6691 1.1 mrg else
6692 1.1 mrg return void_type_node;
6693 1.1 mrg }
6694 1.1 mrg
6695 1.1 mrg /* Enum and arrays used for allocation stats. Keep in sync with
6696 1.1 mrg gimple.c:gimple_alloc_kind_names. */
6697 1.1 mrg enum gimple_alloc_kind
6698 1.1 mrg {
6699 1.1 mrg gimple_alloc_kind_assign, /* Assignments. */
6700 1.1 mrg gimple_alloc_kind_phi, /* PHI nodes. */
6701 1.1 mrg gimple_alloc_kind_cond, /* Conditionals. */
6702 1.1 mrg gimple_alloc_kind_rest, /* Everything else. */
6703 1.1 mrg gimple_alloc_kind_all
6704 1.1 mrg };
6705 1.1 mrg
6706 1.10 mrg extern uint64_t gimple_alloc_counts[];
6707 1.10 mrg extern uint64_t gimple_alloc_sizes[];
6708 1.1 mrg
6709 1.1 mrg /* Return the allocation kind for a given stmt CODE. */
6710 1.1 mrg static inline enum gimple_alloc_kind
6711 1.1 mrg gimple_alloc_kind (enum gimple_code code)
6712 1.1 mrg {
6713 1.1 mrg switch (code)
6714 1.1 mrg {
6715 1.1 mrg case GIMPLE_ASSIGN:
6716 1.1 mrg return gimple_alloc_kind_assign;
6717 1.1 mrg case GIMPLE_PHI:
6718 1.1 mrg return gimple_alloc_kind_phi;
6719 1.1 mrg case GIMPLE_COND:
6720 1.1 mrg return gimple_alloc_kind_cond;
6721 1.1 mrg default:
6722 1.1 mrg return gimple_alloc_kind_rest;
6723 1.1 mrg }
6724 1.1 mrg }
6725 1.1 mrg
6726 1.5 mrg /* Return true if a location should not be emitted for this statement
6727 1.5 mrg by annotate_all_with_location. */
6728 1.5 mrg
6729 1.5 mrg static inline bool
6730 1.6 mrg gimple_do_not_emit_location_p (gimple *g)
6731 1.5 mrg {
6732 1.5 mrg return gimple_plf (g, GF_PLF_1);
6733 1.5 mrg }
6734 1.5 mrg
6735 1.5 mrg /* Mark statement G so a location will not be emitted by
6736 1.5 mrg annotate_one_with_location. */
6737 1.5 mrg
6738 1.5 mrg static inline void
6739 1.6 mrg gimple_set_do_not_emit_location (gimple *g)
6740 1.5 mrg {
6741 1.5 mrg /* The PLF flags are initialized to 0 when a new tuple is created,
6742 1.5 mrg so no need to initialize it anywhere. */
6743 1.5 mrg gimple_set_plf (g, GF_PLF_1, true);
6744 1.5 mrg }
6745 1.5 mrg
6746 1.1 mrg #endif /* GCC_GIMPLE_H */
6747