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