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