1 @c Copyright (c) 2008, 2009 Free Software Foundation, Inc.
2 @c Free Software Foundation, Inc.
3 @c This is part of the GCC manual.
4 @c For copying conditions, see the file gcc.texi.
10 GIMPLE is a three-address representation derived from GENERIC by
11 breaking down GENERIC expressions into tuples of no more than 3
12 operands (with some exceptions like function calls). GIMPLE was
13 heavily influenced by the SIMPLE IL used by the McCAT compiler
14 project at McGill University, though we have made some different
15 choices. For one thing, SIMPLE doesn't support @code{goto}.
17 Temporaries are introduced to hold intermediate values needed to
18 compute complex expressions. Additionally, all the control
19 structures used in GENERIC are lowered into conditional jumps,
20 lexical scopes are removed and exception regions are converted
21 into an on the side exception region tree.
23 The compiler pass which converts GENERIC into GIMPLE is referred to as
24 the @samp{gimplifier}. The gimplifier works recursively, generating
25 GIMPLE tuples out of the original GENERIC expressions.
27 One of the early implementation strategies used for the GIMPLE
28 representation was to use the same internal data structures used
29 by front ends to represent parse trees. This simplified
30 implementation because we could leverage existing functionality
31 and interfaces. However, GIMPLE is a much more restrictive
32 representation than abstract syntax trees (AST), therefore it
33 does not require the full structural complexity provided by the
34 main tree data structure.
36 The GENERIC representation of a function is stored in the
37 @code{DECL_SAVED_TREE} field of the associated @code{FUNCTION_DECL}
38 tree node. It is converted to GIMPLE by a call to
39 @code{gimplify_function_tree}.
41 If a front end wants to include language-specific tree codes in the tree
42 representation which it provides to the back end, it must provide a
43 definition of @code{LANG_HOOKS_GIMPLIFY_EXPR} which knows how to
44 convert the front end trees to GIMPLE@. Usually such a hook will involve
45 much of the same code for expanding front end trees to RTL@. This function
46 can return fully lowered GIMPLE, or it can return GENERIC trees and let the
47 main gimplifier lower them the rest of the way; this is often simpler.
48 GIMPLE that is not fully lowered is known as ``High GIMPLE'' and
49 consists of the IL before the pass @code{pass_lower_cf}. High GIMPLE
50 contains some container statements like lexical scopes
51 (represented by @code{GIMPLE_BIND}) and nested expressions (e.g.,
52 @code{GIMPLE_TRY}), while ``Low GIMPLE'' exposes all of the
53 implicit jumps for control and exception expressions directly in
54 the IL and EH region trees.
56 The C and C++ front ends currently convert directly from front end
57 trees to GIMPLE, and hand that off to the back end rather than first
58 converting to GENERIC@. Their gimplifier hooks know about all the
59 @code{_STMT} nodes and how to convert them to GENERIC forms. There
60 was some work done on a genericization pass which would run first, but
61 the existence of @code{STMT_EXPR} meant that in order to convert all
62 of the C statements into GENERIC equivalents would involve walking the
63 entire tree anyway, so it was simpler to lower all the way. This
64 might change in the future if someone writes an optimization pass
65 which would work better with higher-level trees, but currently the
66 optimizers all expect GIMPLE@.
68 You can request to dump a C-like representation of the GIMPLE form
69 with the flag @option{-fdump-tree-gimple}.
72 * Tuple representation::
73 * GIMPLE instruction set::
74 * GIMPLE Exception Handling::
77 * Manipulating GIMPLE statements::
78 * Tuple specific accessors::
80 * Sequence iterators::
81 * Adding a new GIMPLE statement code::
82 * Statement and operand traversals::
85 @node Tuple representation
86 @section Tuple representation
89 GIMPLE instructions are tuples of variable size divided in two
90 groups: a header describing the instruction and its locations,
91 and a variable length body with all the operands. Tuples are
92 organized into a hierarchy with 3 main classes of tuples.
94 @subsection @code{gimple_statement_base} (gsbase)
95 @cindex gimple_statement_base
97 This is the root of the hierarchy, it holds basic information
98 needed by most GIMPLE statements. There are some fields that
99 may not be relevant to every GIMPLE statement, but those were
100 moved into the base structure to take advantage of holes left by
101 other fields (thus making the structure more compact). The
102 structure takes 4 words (32 bytes) on 64 bit hosts:
104 @multitable {@code{references_memory_p}} {Size (bits)}
105 @item Field @tab Size (bits)
106 @item @code{code} @tab 8
107 @item @code{subcode} @tab 16
108 @item @code{no_warning} @tab 1
109 @item @code{visited} @tab 1
110 @item @code{nontemporal_move} @tab 1
111 @item @code{plf} @tab 2
112 @item @code{modified} @tab 1
113 @item @code{has_volatile_ops} @tab 1
114 @item @code{references_memory_p} @tab 1
115 @item @code{uid} @tab 32
116 @item @code{location} @tab 32
117 @item @code{num_ops} @tab 32
118 @item @code{bb} @tab 64
119 @item @code{block} @tab 63
120 @item Total size @tab 32 bytes
125 Main identifier for a GIMPLE instruction.
128 Used to distinguish different variants of the same basic
129 instruction or provide flags applicable to a given code. The
130 @code{subcode} flags field has different uses depending on the code of
131 the instruction, but mostly it distinguishes instructions of the
132 same family. The most prominent use of this field is in
133 assignments, where subcode indicates the operation done on the
134 RHS of the assignment. For example, a = b + c is encoded as
135 @code{GIMPLE_ASSIGN <PLUS_EXPR, a, b, c>}.
137 @item @code{no_warning}
138 Bitflag to indicate whether a warning has already been issued on
142 General purpose ``visited'' marker. Set and cleared by each pass
145 @item @code{nontemporal_move}
146 Bitflag used in assignments that represent non-temporal moves.
147 Although this bitflag is only used in assignments, it was moved
148 into the base to take advantage of the bit holes left by the
152 Pass Local Flags. This 2-bit mask can be used as general purpose
153 markers by any pass. Passes are responsible for clearing and
154 setting these two flags accordingly.
156 @item @code{modified}
157 Bitflag to indicate whether the statement has been modified.
158 Used mainly by the operand scanner to determine when to re-scan a
159 statement for operands.
161 @item @code{has_volatile_ops}
162 Bitflag to indicate whether this statement contains operands that
163 have been marked volatile.
165 @item @code{references_memory_p}
166 Bitflag to indicate whether this statement contains memory
167 references (i.e., its operands are either global variables, or
168 pointer dereferences or anything that must reside in memory).
171 This is an unsigned integer used by passes that want to assign
172 IDs to every statement. These IDs must be assigned and used by
175 @item @code{location}
176 This is a @code{location_t} identifier to specify source code
177 location for this statement. It is inherited from the front
181 Number of operands that this statement has. This specifies the
182 size of the operand vector embedded in the tuple. Only used in
183 some tuples, but it is declared in the base tuple to take
184 advantage of the 32-bit hole left by the previous fields.
187 Basic block holding the instruction.
190 Lexical block holding this statement. Also used for debug
191 information generation.
194 @subsection @code{gimple_statement_with_ops}
195 @cindex gimple_statement_with_ops
197 This tuple is actually split in two:
198 @code{gimple_statement_with_ops_base} and
199 @code{gimple_statement_with_ops}. This is needed to accommodate the
200 way the operand vector is allocated. The operand vector is
201 defined to be an array of 1 element. So, to allocate a dynamic
202 number of operands, the memory allocator (@code{gimple_alloc}) simply
203 allocates enough memory to hold the structure itself plus @code{N
204 - 1} operands which run ``off the end'' of the structure. For
205 example, to allocate space for a tuple with 3 operands,
206 @code{gimple_alloc} reserves @code{sizeof (struct
207 gimple_statement_with_ops) + 2 * sizeof (tree)} bytes.
209 On the other hand, several fields in this tuple need to be shared
210 with the @code{gimple_statement_with_memory_ops} tuple. So, these
211 common fields are placed in @code{gimple_statement_with_ops_base} which
212 is then inherited from the other two tuples.
215 @multitable {@code{addresses_taken}} {56 + 8 * @code{num_ops} bytes}
216 @item @code{gsbase} @tab 256
217 @item @code{addresses_taken} @tab 64
218 @item @code{def_ops} @tab 64
219 @item @code{use_ops} @tab 64
220 @item @code{op} @tab @code{num_ops} * 64
221 @item Total size @tab 56 + 8 * @code{num_ops} bytes
226 Inherited from @code{struct gimple_statement_base}.
228 @item @code{addresses_taken}
229 Bitmap holding the UIDs of all the @code{VAR_DECL}s whose addresses are
230 taken by this statement. For example, a statement of the form
231 @code{p = &b} will have the UID for symbol @code{b} in this set.
234 Array of pointers into the operand array indicating all the slots that
235 contain a variable written-to by the statement. This array is
236 also used for immediate use chaining. Note that it would be
237 possible to not rely on this array, but the changes required to
238 implement this are pretty invasive.
241 Similar to @code{def_ops} but for variables read by the statement.
244 Array of trees with @code{num_ops} slots.
247 @subsection @code{gimple_statement_with_memory_ops}
249 This tuple is essentially identical to @code{gimple_statement_with_ops},
250 except that it contains 4 additional fields to hold vectors
251 related memory stores and loads. Similar to the previous case,
252 the structure is split in two to accommodate for the operand
253 vector (@code{gimple_statement_with_memory_ops_base} and
254 @code{gimple_statement_with_memory_ops}).
257 @multitable {@code{addresses_taken}} {88 + 8 * @code{num_ops} bytes}
258 @item Field @tab Size (bits)
259 @item @code{gsbase} @tab 256
260 @item @code{addresses_taken} @tab 64
261 @item @code{def_ops} @tab 64
262 @item @code{use_ops} @tab 64
263 @item @code{vdef_ops} @tab 64
264 @item @code{vuse_ops} @tab 64
265 @item @code{stores} @tab 64
266 @item @code{loads} @tab 64
267 @item @code{op} @tab @code{num_ops} * 64
268 @item Total size @tab 88 + 8 * @code{num_ops} bytes
272 @item @code{vdef_ops}
273 Similar to @code{def_ops} but for @code{VDEF} operators. There is
274 one entry per memory symbol written by this statement. This is
275 used to maintain the memory SSA use-def and def-def chains.
277 @item @code{vuse_ops}
278 Similar to @code{use_ops} but for @code{VUSE} operators. There is
279 one entry per memory symbol loaded by this statement. This is
280 used to maintain the memory SSA use-def chains.
283 Bitset with all the UIDs for the symbols written-to by the
284 statement. This is different than @code{vdef_ops} in that all the
285 affected symbols are mentioned in this set. If memory
286 partitioning is enabled, the @code{vdef_ops} vector will refer to memory
287 partitions. Furthermore, no SSA information is stored in this
291 Similar to @code{stores}, but for memory loads. (Note that there
292 is some amount of redundancy here, it should be possible to
293 reduce memory utilization further by removing these sets).
296 All the other tuples are defined in terms of these three basic
297 ones. Each tuple will add some fields. The main gimple type
298 is defined to be the union of all these structures (@code{GTY} markers
302 union gimple_statement_d
304 struct gimple_statement_base gsbase;
305 struct gimple_statement_with_ops gsops;
306 struct gimple_statement_with_memory_ops gsmem;
307 struct gimple_statement_omp omp;
308 struct gimple_statement_bind gimple_bind;
309 struct gimple_statement_catch gimple_catch;
310 struct gimple_statement_eh_filter gimple_eh_filter;
311 struct gimple_statement_phi gimple_phi;
312 struct gimple_statement_resx gimple_resx;
313 struct gimple_statement_try gimple_try;
314 struct gimple_statement_wce gimple_wce;
315 struct gimple_statement_asm gimple_asm;
316 struct gimple_statement_omp_critical gimple_omp_critical;
317 struct gimple_statement_omp_for gimple_omp_for;
318 struct gimple_statement_omp_parallel gimple_omp_parallel;
319 struct gimple_statement_omp_task gimple_omp_task;
320 struct gimple_statement_omp_sections gimple_omp_sections;
321 struct gimple_statement_omp_single gimple_omp_single;
322 struct gimple_statement_omp_continue gimple_omp_continue;
323 struct gimple_statement_omp_atomic_load gimple_omp_atomic_load;
324 struct gimple_statement_omp_atomic_store gimple_omp_atomic_store;
329 @node GIMPLE instruction set
330 @section GIMPLE instruction set
331 @cindex GIMPLE instruction set
333 The following table briefly describes the GIMPLE instruction set.
335 @multitable {@code{GIMPLE_OMP_SECTIONS_SWITCH}} {High GIMPLE} {Low GIMPLE}
336 @item Instruction @tab High GIMPLE @tab Low GIMPLE
337 @item @code{GIMPLE_ASM} @tab x @tab x
338 @item @code{GIMPLE_ASSIGN} @tab x @tab x
339 @item @code{GIMPLE_BIND} @tab x @tab
340 @item @code{GIMPLE_CALL} @tab x @tab x
341 @item @code{GIMPLE_CATCH} @tab x @tab
342 @item @code{GIMPLE_COND} @tab x @tab x
343 @item @code{GIMPLE_EH_FILTER} @tab x @tab
344 @item @code{GIMPLE_GOTO} @tab x @tab x
345 @item @code{GIMPLE_LABEL} @tab x @tab x
346 @item @code{GIMPLE_NOP} @tab x @tab x
347 @item @code{GIMPLE_OMP_ATOMIC_LOAD} @tab x @tab x
348 @item @code{GIMPLE_OMP_ATOMIC_STORE} @tab x @tab x
349 @item @code{GIMPLE_OMP_CONTINUE} @tab x @tab x
350 @item @code{GIMPLE_OMP_CRITICAL} @tab x @tab x
351 @item @code{GIMPLE_OMP_FOR} @tab x @tab x
352 @item @code{GIMPLE_OMP_MASTER} @tab x @tab x
353 @item @code{GIMPLE_OMP_ORDERED} @tab x @tab x
354 @item @code{GIMPLE_OMP_PARALLEL} @tab x @tab x
355 @item @code{GIMPLE_OMP_RETURN} @tab x @tab x
356 @item @code{GIMPLE_OMP_SECTION} @tab x @tab x
357 @item @code{GIMPLE_OMP_SECTIONS} @tab x @tab x
358 @item @code{GIMPLE_OMP_SECTIONS_SWITCH} @tab x @tab x
359 @item @code{GIMPLE_OMP_SINGLE} @tab x @tab x
360 @item @code{GIMPLE_PHI} @tab @tab x
361 @item @code{GIMPLE_RESX} @tab @tab x
362 @item @code{GIMPLE_RETURN} @tab x @tab x
363 @item @code{GIMPLE_SWITCH} @tab x @tab x
364 @item @code{GIMPLE_TRY} @tab x @tab
367 @node GIMPLE Exception Handling
368 @section Exception Handling
369 @cindex GIMPLE Exception Handling
371 Other exception handling constructs are represented using
372 @code{GIMPLE_TRY_CATCH}. @code{GIMPLE_TRY_CATCH} has two operands. The
373 first operand is a sequence of statements to execute. If executing
374 these statements does not throw an exception, then the second operand
375 is ignored. Otherwise, if an exception is thrown, then the second
376 operand of the @code{GIMPLE_TRY_CATCH} is checked. The second
377 operand may have the following forms:
381 @item A sequence of statements to execute. When an exception occurs,
382 these statements are executed, and then the exception is rethrown.
384 @item A sequence of @code{GIMPLE_CATCH} statements. Each
385 @code{GIMPLE_CATCH} has a list of applicable exception types and
386 handler code. If the thrown exception matches one of the caught
387 types, the associated handler code is executed. If the handler
388 code falls off the bottom, execution continues after the original
389 @code{GIMPLE_TRY_CATCH}.
391 @item A @code{GIMPLE_EH_FILTER} statement. This has a list of
392 permitted exception types, and code to handle a match failure. If the
393 thrown exception does not match one of the allowed types, the
394 associated match failure code is executed. If the thrown exception
395 does match, it continues unwinding the stack looking for the next
400 Currently throwing an exception is not directly represented in
401 GIMPLE, since it is implemented by calling a function. At some
402 point in the future we will want to add some way to express that
403 the call will throw an exception of a known type.
405 Just before running the optimizers, the compiler lowers the
406 high-level EH constructs above into a set of @samp{goto}s, magic
407 labels, and EH regions. Continuing to unwind at the end of a
408 cleanup is represented with a @code{GIMPLE_RESX}.
415 When gimplification encounters a subexpression that is too
416 complex, it creates a new temporary variable to hold the value of
417 the subexpression, and adds a new statement to initialize it
418 before the current statement. These special temporaries are known
419 as @samp{expression temporaries}, and are allocated using
420 @code{get_formal_tmp_var}. The compiler tries to always evaluate
421 identical expressions into the same temporary, to simplify
422 elimination of redundant calculations.
424 We can only use expression temporaries when we know that it will
425 not be reevaluated before its value is used, and that it will not
426 be otherwise modified@footnote{These restrictions are derived
427 from those in Morgan 4.8.}. Other temporaries can be allocated
428 using @code{get_initialized_tmp_var} or @code{create_tmp_var}.
430 Currently, an expression like @code{a = b + 5} is not reduced any
431 further. We tried converting it to something like
436 but this bloated the representation for minimal benefit. However, a
437 variable which must live in memory cannot appear in an expression; its
438 value is explicitly loaded into a temporary first. Similarly, storing
439 the value of an expression to a memory variable goes through a
446 In general, expressions in GIMPLE consist of an operation and the
447 appropriate number of simple operands; these operands must either be a
448 GIMPLE rvalue (@code{is_gimple_val}), i.e.@: a constant or a register
449 variable. More complex operands are factored out into temporaries, so
460 The same rule holds for arguments to a @code{GIMPLE_CALL}.
462 The target of an assignment is usually a variable, but can also be an
463 @code{INDIRECT_REF} or a compound lvalue as described below.
466 * Compound Expressions::
468 * Conditional Expressions::
469 * Logical Operators::
472 @node Compound Expressions
473 @subsection Compound Expressions
474 @cindex Compound Expressions
476 The left-hand side of a C comma expression is simply moved into a separate
479 @node Compound Lvalues
480 @subsection Compound Lvalues
481 @cindex Compound Lvalues
483 Currently compound lvalues involving array and structure field references
484 are not broken down; an expression like @code{a.b[2] = 42} is not reduced
485 any further (though complex array subscripts are). This restriction is a
486 workaround for limitations in later optimizers; if we were to convert this
494 alias analysis would not remember that the reference to @code{T1[2]} came
495 by way of @code{a.b}, so it would think that the assignment could alias
496 another member of @code{a}; this broke @code{struct-alias-1.c}. Future
497 optimizer improvements may make this limitation unnecessary.
499 @node Conditional Expressions
500 @subsection Conditional Expressions
501 @cindex Conditional Expressions
503 A C @code{?:} expression is converted into an @code{if} statement with
504 each branch assigning to the same temporary. So,
518 The GIMPLE level if-conversion pass re-introduces @code{?:}
519 expression, if appropriate. It is used to vectorize loops with
520 conditions using vector conditional operations.
522 Note that in GIMPLE, @code{if} statements are represented using
523 @code{GIMPLE_COND}, as described below.
525 @node Logical Operators
526 @subsection Logical Operators
527 @cindex Logical Operators
529 Except when they appear in the condition operand of a
530 @code{GIMPLE_COND}, logical `and' and `or' operators are simplified
531 as follows: @code{a = b && c} becomes
540 Note that @code{T1} in this example cannot be an expression temporary,
541 because it has two different assignments.
543 @subsection Manipulating operands
545 All gimple operands are of type @code{tree}. But only certain
546 types of trees are allowed to be used as operand tuples. Basic
547 validation is controlled by the function
548 @code{get_gimple_rhs_class}, which given a tree code, returns an
549 @code{enum} with the following values of type @code{enum
553 @item @code{GIMPLE_INVALID_RHS}
554 The tree cannot be used as a GIMPLE operand.
556 @item @code{GIMPLE_BINARY_RHS}
557 The tree is a valid GIMPLE binary operation.
559 @item @code{GIMPLE_UNARY_RHS}
560 The tree is a valid GIMPLE unary operation.
562 @item @code{GIMPLE_SINGLE_RHS}
563 The tree is a single object, that cannot be split into simpler
564 operands (for instance, @code{SSA_NAME}, @code{VAR_DECL}, @code{COMPONENT_REF}, etc).
566 This operand class also acts as an escape hatch for tree nodes
567 that may be flattened out into the operand vector, but would need
568 more than two slots on the RHS. For instance, a @code{COND_EXPR}
569 expression of the form @code{(a op b) ? x : y} could be flattened
570 out on the operand vector using 4 slots, but it would also
571 require additional processing to distinguish @code{c = a op b}
572 from @code{c = a op b ? x : y}. Something similar occurs with
573 @code{ASSERT_EXPR}. In time, these special case tree
574 expressions should be flattened into the operand vector.
577 For tree nodes in the categories @code{GIMPLE_BINARY_RHS} and
578 @code{GIMPLE_UNARY_RHS}, they cannot be stored inside tuples directly.
579 They first need to be flattened and separated into individual
580 components. For instance, given the GENERIC expression
586 its tree representation is:
589 MODIFY_EXPR <VAR_DECL <a>, PLUS_EXPR <VAR_DECL <b>, VAR_DECL <c>>>
592 In this case, the GIMPLE form for this statement is logically
593 identical to its GENERIC form but in GIMPLE, the @code{PLUS_EXPR}
594 on the RHS of the assignment is not represented as a tree,
595 instead the two operands are taken out of the @code{PLUS_EXPR} sub-tree
596 and flattened into the GIMPLE tuple as follows:
599 GIMPLE_ASSIGN <PLUS_EXPR, VAR_DECL <a>, VAR_DECL <b>, VAR_DECL <c>>
602 @subsection Operand vector allocation
604 The operand vector is stored at the bottom of the three tuple
605 structures that accept operands. This means, that depending on
606 the code of a given statement, its operand vector will be at
607 different offsets from the base of the structure. To access
608 tuple operands use the following accessors
610 @deftypefn {GIMPLE function} unsigned gimple_num_ops (gimple g)
611 Returns the number of operands in statement G.
614 @deftypefn {GIMPLE function} tree gimple_op (gimple g, unsigned i)
615 Returns operand @code{I} from statement @code{G}.
618 @deftypefn {GIMPLE function} tree *gimple_ops (gimple g)
619 Returns a pointer into the operand vector for statement @code{G}. This
620 is computed using an internal table called @code{gimple_ops_offset_}[].
621 This table is indexed by the gimple code of @code{G}.
623 When the compiler is built, this table is filled-in using the
624 sizes of the structures used by each statement code defined in
625 gimple.def. Since the operand vector is at the bottom of the
626 structure, for a gimple code @code{C} the offset is computed as sizeof
627 (struct-of @code{C}) - sizeof (tree).
629 This mechanism adds one memory indirection to every access when
630 using @code{gimple_op}(), if this becomes a bottleneck, a pass can
631 choose to memoize the result from @code{gimple_ops}() and use that to
635 @subsection Operand validation
637 When adding a new operand to a gimple statement, the operand will
638 be validated according to what each tuple accepts in its operand
639 vector. These predicates are called by the
640 @code{gimple_<name>_set_...()}. Each tuple will use one of the
641 following predicates (Note, this list is not exhaustive):
643 @deftypefn {GIMPLE function} is_gimple_operand (tree t)
644 This is the most permissive of the predicates. It essentially
645 checks whether t has a @code{gimple_rhs_class} of @code{GIMPLE_SINGLE_RHS}.
649 @deftypefn {GIMPLE function} is_gimple_val (tree t)
650 Returns true if t is a "GIMPLE value", which are all the
651 non-addressable stack variables (variables for which
652 @code{is_gimple_reg} returns true) and constants (expressions for which
653 @code{is_gimple_min_invariant} returns true).
656 @deftypefn {GIMPLE function} is_gimple_addressable (tree t)
657 Returns true if t is a symbol or memory reference whose address
661 @deftypefn {GIMPLE function} is_gimple_asm_val (tree t)
662 Similar to @code{is_gimple_val} but it also accepts hard registers.
665 @deftypefn {GIMPLE function} is_gimple_call_addr (tree t)
666 Return true if t is a valid expression to use as the function
667 called by a @code{GIMPLE_CALL}.
670 @deftypefn {GIMPLE function} is_gimple_constant (tree t)
671 Return true if t is a valid gimple constant.
674 @deftypefn {GIMPLE function} is_gimple_min_invariant (tree t)
675 Return true if t is a valid minimal invariant. This is different
676 from constants, in that the specific value of t may not be known
677 at compile time, but it is known that it doesn't change (e.g.,
678 the address of a function local variable).
681 @deftypefn {GIMPLE function} is_gimple_min_invariant_address (tree t)
682 Return true if t is an @code{ADDR_EXPR} that does not change once the
687 @subsection Statement validation
689 @deftypefn {GIMPLE function} is_gimple_assign (gimple g)
690 Return true if the code of g is @code{GIMPLE_ASSIGN}.
693 @deftypefn {GIMPLE function} is_gimple_call (gimple g)
694 Return true if the code of g is @code{GIMPLE_CALL}
697 @deftypefn {GIMPLE function} gimple_assign_cast_p (gimple g)
698 Return true if g is a @code{GIMPLE_ASSIGN} that performs a type cast
702 @node Manipulating GIMPLE statements
703 @section Manipulating GIMPLE statements
704 @cindex Manipulating GIMPLE statements
706 This section documents all the functions available to handle each
707 of the GIMPLE instructions.
709 @subsection Common accessors
710 The following are common accessors for gimple statements.
712 @deftypefn {GIMPLE function} enum gimple_code gimple_code (gimple g)
713 Return the code for statement @code{G}.
716 @deftypefn {GIMPLE function} basic_block gimple_bb (gimple g)
717 Return the basic block to which statement @code{G} belongs to.
720 @deftypefn {GIMPLE function} tree gimple_block (gimple g)
721 Return the lexical scope block holding statement @code{G}.
724 @deftypefn {GIMPLE function} tree gimple_expr_type (gimple stmt)
725 Return the type of the main expression computed by @code{STMT}. Return
726 @code{void_type_node} if @code{STMT} computes nothing. This will only return
727 something meaningful for @code{GIMPLE_ASSIGN}, @code{GIMPLE_COND} and
728 @code{GIMPLE_CALL}. For all other tuple codes, it will return
729 @code{void_type_node}.
732 @deftypefn {GIMPLE function} enum tree_code gimple_expr_code (gimple stmt)
733 Return the tree code for the expression computed by @code{STMT}. This
734 is only meaningful for @code{GIMPLE_CALL}, @code{GIMPLE_ASSIGN} and
735 @code{GIMPLE_COND}. If @code{STMT} is @code{GIMPLE_CALL}, it will return @code{CALL_EXPR}.
736 For @code{GIMPLE_COND}, it returns the code of the comparison predicate.
737 For @code{GIMPLE_ASSIGN} it returns the code of the operation performed
738 by the @code{RHS} of the assignment.
741 @deftypefn {GIMPLE function} void gimple_set_block (gimple g, tree block)
742 Set the lexical scope block of @code{G} to @code{BLOCK}.
745 @deftypefn {GIMPLE function} location_t gimple_locus (gimple g)
746 Return locus information for statement @code{G}.
749 @deftypefn {GIMPLE function} void gimple_set_locus (gimple g, location_t locus)
750 Set locus information for statement @code{G}.
753 @deftypefn {GIMPLE function} bool gimple_locus_empty_p (gimple g)
754 Return true if @code{G} does not have locus information.
757 @deftypefn {GIMPLE function} bool gimple_no_warning_p (gimple stmt)
758 Return true if no warnings should be emitted for statement @code{STMT}.
761 @deftypefn {GIMPLE function} void gimple_set_visited (gimple stmt, bool visited_p)
762 Set the visited status on statement @code{STMT} to @code{VISITED_P}.
765 @deftypefn {GIMPLE function} bool gimple_visited_p (gimple stmt)
766 Return the visited status on statement @code{STMT}.
769 @deftypefn {GIMPLE function} void gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
770 Set pass local flag @code{PLF} on statement @code{STMT} to @code{VAL_P}.
773 @deftypefn {GIMPLE function} unsigned int gimple_plf (gimple stmt, enum plf_mask plf)
774 Return the value of pass local flag @code{PLF} on statement @code{STMT}.
777 @deftypefn {GIMPLE function} bool gimple_has_ops (gimple g)
778 Return true if statement @code{G} has register or memory operands.
781 @deftypefn {GIMPLE function} bool gimple_has_mem_ops (gimple g)
782 Return true if statement @code{G} has memory operands.
785 @deftypefn {GIMPLE function} unsigned gimple_num_ops (gimple g)
786 Return the number of operands for statement @code{G}.
789 @deftypefn {GIMPLE function} tree *gimple_ops (gimple g)
790 Return the array of operands for statement @code{G}.
793 @deftypefn {GIMPLE function} tree gimple_op (gimple g, unsigned i)
794 Return operand @code{I} for statement @code{G}.
797 @deftypefn {GIMPLE function} tree *gimple_op_ptr (gimple g, unsigned i)
798 Return a pointer to operand @code{I} for statement @code{G}.
801 @deftypefn {GIMPLE function} void gimple_set_op (gimple g, unsigned i, tree op)
802 Set operand @code{I} of statement @code{G} to @code{OP}.
805 @deftypefn {GIMPLE function} bitmap gimple_addresses_taken (gimple stmt)
806 Return the set of symbols that have had their address taken by
810 @deftypefn {GIMPLE function} struct def_optype_d *gimple_def_ops (gimple g)
811 Return the set of @code{DEF} operands for statement @code{G}.
814 @deftypefn {GIMPLE function} void gimple_set_def_ops (gimple g, struct def_optype_d *def)
815 Set @code{DEF} to be the set of @code{DEF} operands for statement @code{G}.
818 @deftypefn {GIMPLE function} struct use_optype_d *gimple_use_ops (gimple g)
819 Return the set of @code{USE} operands for statement @code{G}.
822 @deftypefn {GIMPLE function} void gimple_set_use_ops (gimple g, struct use_optype_d *use)
823 Set @code{USE} to be the set of @code{USE} operands for statement @code{G}.
826 @deftypefn {GIMPLE function} struct voptype_d *gimple_vuse_ops (gimple g)
827 Return the set of @code{VUSE} operands for statement @code{G}.
830 @deftypefn {GIMPLE function} void gimple_set_vuse_ops (gimple g, struct voptype_d *ops)
831 Set @code{OPS} to be the set of @code{VUSE} operands for statement @code{G}.
834 @deftypefn {GIMPLE function} struct voptype_d *gimple_vdef_ops (gimple g)
835 Return the set of @code{VDEF} operands for statement @code{G}.
838 @deftypefn {GIMPLE function} void gimple_set_vdef_ops (gimple g, struct voptype_d *ops)
839 Set @code{OPS} to be the set of @code{VDEF} operands for statement @code{G}.
842 @deftypefn {GIMPLE function} bitmap gimple_loaded_syms (gimple g)
843 Return the set of symbols loaded by statement @code{G}. Each element of
844 the set is the @code{DECL_UID} of the corresponding symbol.
847 @deftypefn {GIMPLE function} bitmap gimple_stored_syms (gimple g)
848 Return the set of symbols stored by statement @code{G}. Each element of
849 the set is the @code{DECL_UID} of the corresponding symbol.
852 @deftypefn {GIMPLE function} bool gimple_modified_p (gimple g)
853 Return true if statement @code{G} has operands and the modified field
857 @deftypefn {GIMPLE function} bool gimple_has_volatile_ops (gimple stmt)
858 Return true if statement @code{STMT} contains volatile operands.
861 @deftypefn {GIMPLE function} void gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
862 Return true if statement @code{STMT} contains volatile operands.
865 @deftypefn {GIMPLE function} void update_stmt (gimple s)
866 Mark statement @code{S} as modified, and update it.
869 @deftypefn {GIMPLE function} void update_stmt_if_modified (gimple s)
870 Update statement @code{S} if it has been marked modified.
873 @deftypefn {GIMPLE function} gimple gimple_copy (gimple stmt)
874 Return a deep copy of statement @code{STMT}.
877 @node Tuple specific accessors
878 @section Tuple specific accessors
879 @cindex Tuple specific accessors
882 * @code{GIMPLE_ASM}::
883 * @code{GIMPLE_ASSIGN}::
884 * @code{GIMPLE_BIND}::
885 * @code{GIMPLE_CALL}::
886 * @code{GIMPLE_CATCH}::
887 * @code{GIMPLE_COND}::
888 * @code{GIMPLE_EH_FILTER}::
889 * @code{GIMPLE_LABEL}::
890 * @code{GIMPLE_NOP}::
891 * @code{GIMPLE_OMP_ATOMIC_LOAD}::
892 * @code{GIMPLE_OMP_ATOMIC_STORE}::
893 * @code{GIMPLE_OMP_CONTINUE}::
894 * @code{GIMPLE_OMP_CRITICAL}::
895 * @code{GIMPLE_OMP_FOR}::
896 * @code{GIMPLE_OMP_MASTER}::
897 * @code{GIMPLE_OMP_ORDERED}::
898 * @code{GIMPLE_OMP_PARALLEL}::
899 * @code{GIMPLE_OMP_RETURN}::
900 * @code{GIMPLE_OMP_SECTION}::
901 * @code{GIMPLE_OMP_SECTIONS}::
902 * @code{GIMPLE_OMP_SINGLE}::
903 * @code{GIMPLE_PHI}::
904 * @code{GIMPLE_RESX}::
905 * @code{GIMPLE_RETURN}::
906 * @code{GIMPLE_SWITCH}::
907 * @code{GIMPLE_TRY}::
908 * @code{GIMPLE_WITH_CLEANUP_EXPR}::
912 @node @code{GIMPLE_ASM}
913 @subsection @code{GIMPLE_ASM}
914 @cindex @code{GIMPLE_ASM}
916 @deftypefn {GIMPLE function} gimple gimple_build_asm (const char *string, ninputs, noutputs, nclobbers, ...)
917 Build a @code{GIMPLE_ASM} statement. This statement is used for
918 building in-line assembly constructs. @code{STRING} is the assembly
919 code. @code{NINPUT} is the number of register inputs. @code{NOUTPUT} is the
920 number of register outputs. @code{NCLOBBERS} is the number of clobbered
921 registers. The rest of the arguments trees for each input,
922 output, and clobbered registers.
925 @deftypefn {GIMPLE function} gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *, VEC(tree,gc) *)
926 Identical to gimple_build_asm, but the arguments are passed in
930 @deftypefn {GIMPLE function} gimple_asm_ninputs (gimple g)
931 Return the number of input operands for @code{GIMPLE_ASM} @code{G}.
934 @deftypefn {GIMPLE function} gimple_asm_noutputs (gimple g)
935 Return the number of output operands for @code{GIMPLE_ASM} @code{G}.
938 @deftypefn {GIMPLE function} gimple_asm_nclobbers (gimple g)
939 Return the number of clobber operands for @code{GIMPLE_ASM} @code{G}.
942 @deftypefn {GIMPLE function} tree gimple_asm_input_op (gimple g, unsigned index)
943 Return input operand @code{INDEX} of @code{GIMPLE_ASM} @code{G}.
946 @deftypefn {GIMPLE function} void gimple_asm_set_input_op (gimple g, unsigned index, tree in_op)
947 Set @code{IN_OP} to be input operand @code{INDEX} in @code{GIMPLE_ASM} @code{G}.
950 @deftypefn {GIMPLE function} tree gimple_asm_output_op (gimple g, unsigned index)
951 Return output operand @code{INDEX} of @code{GIMPLE_ASM} @code{G}.
954 @deftypefn {GIMPLE function} void gimple_asm_set_output_op (gimple g, @
955 unsigned index, tree out_op)
956 Set @code{OUT_OP} to be output operand @code{INDEX} in @code{GIMPLE_ASM} @code{G}.
959 @deftypefn {GIMPLE function} tree gimple_asm_clobber_op (gimple g, unsigned index)
960 Return clobber operand @code{INDEX} of @code{GIMPLE_ASM} @code{G}.
963 @deftypefn {GIMPLE function} void gimple_asm_set_clobber_op (gimple g, unsigned index, tree clobber_op)
964 Set @code{CLOBBER_OP} to be clobber operand @code{INDEX} in @code{GIMPLE_ASM} @code{G}.
967 @deftypefn {GIMPLE function} const char *gimple_asm_string (gimple g)
968 Return the string representing the assembly instruction in
969 @code{GIMPLE_ASM} @code{G}.
972 @deftypefn {GIMPLE function} bool gimple_asm_volatile_p (gimple g)
973 Return true if @code{G} is an asm statement marked volatile.
976 @deftypefn {GIMPLE function} void gimple_asm_set_volatile (gimple g)
977 Mark asm statement @code{G} as volatile.
980 @deftypefn {GIMPLE function} void gimple_asm_clear_volatile (gimple g)
981 Remove volatile marker from asm statement @code{G}.
984 @node @code{GIMPLE_ASSIGN}
985 @subsection @code{GIMPLE_ASSIGN}
986 @cindex @code{GIMPLE_ASSIGN}
988 @deftypefn {GIMPLE function} gimple gimple_build_assign (tree lhs, tree rhs)
989 Build a @code{GIMPLE_ASSIGN} statement. The left-hand side is an lvalue
990 passed in lhs. The right-hand side can be either a unary or
991 binary tree expression. The expression tree rhs will be
992 flattened and its operands assigned to the corresponding operand
993 slots in the new statement. This function is useful when you
994 already have a tree expression that you want to convert into a
995 tuple. However, try to avoid building expression trees for the
996 sole purpose of calling this function. If you already have the
997 operands in separate trees, it is better to use
998 @code{gimple_build_assign_with_ops}.
1002 @deftypefn {GIMPLE function} gimple gimplify_assign (tree dst, tree src, gimple_seq *seq_p)
1003 Build a new @code{GIMPLE_ASSIGN} tuple and append it to the end of
1007 @code{DST}/@code{SRC} are the destination and source respectively. You can
1008 pass ungimplified trees in @code{DST} or @code{SRC}, in which
1009 case they will be converted to a gimple operand if necessary.
1011 This function returns the newly created @code{GIMPLE_ASSIGN} tuple.
1013 @deftypefn {GIMPLE function} gimple gimple_build_assign_with_ops @
1014 (enum tree_code subcode, tree lhs, tree op1, tree op2)
1015 This function is similar to @code{gimple_build_assign}, but is used to
1016 build a @code{GIMPLE_ASSIGN} statement when the operands of the
1017 right-hand side of the assignment are already split into
1020 The left-hand side is an lvalue passed in lhs. Subcode is the
1021 @code{tree_code} for the right-hand side of the assignment. Op1 and op2
1022 are the operands. If op2 is null, subcode must be a @code{tree_code}
1023 for a unary expression.
1026 @deftypefn {GIMPLE function} enum tree_code gimple_assign_rhs_code (gimple g)
1027 Return the code of the expression computed on the @code{RHS} of
1028 assignment statement @code{G}.
1032 @deftypefn {GIMPLE function} enum gimple_rhs_class gimple_assign_rhs_class (gimple g)
1033 Return the gimple rhs class of the code for the expression
1034 computed on the rhs of assignment statement @code{G}. This will never
1035 return @code{GIMPLE_INVALID_RHS}.
1038 @deftypefn {GIMPLE function} tree gimple_assign_lhs (gimple g)
1039 Return the @code{LHS} of assignment statement @code{G}.
1042 @deftypefn {GIMPLE function} tree *gimple_assign_lhs_ptr (gimple g)
1043 Return a pointer to the @code{LHS} of assignment statement @code{G}.
1046 @deftypefn {GIMPLE function} tree gimple_assign_rhs1 (gimple g)
1047 Return the first operand on the @code{RHS} of assignment statement @code{G}.
1050 @deftypefn {GIMPLE function} tree *gimple_assign_rhs1_ptr (gimple g)
1051 Return the address of the first operand on the @code{RHS} of assignment
1055 @deftypefn {GIMPLE function} tree gimple_assign_rhs2 (gimple g)
1056 Return the second operand on the @code{RHS} of assignment statement @code{G}.
1059 @deftypefn {GIMPLE function} tree *gimple_assign_rhs2_ptr (gimple g)
1060 Return the address of the second operand on the @code{RHS} of assignment
1064 @deftypefn {GIMPLE function} void gimple_assign_set_lhs (gimple g, tree lhs)
1065 Set @code{LHS} to be the @code{LHS} operand of assignment statement @code{G}.
1068 @deftypefn {GIMPLE function} void gimple_assign_set_rhs1 (gimple g, tree rhs)
1069 Set @code{RHS} to be the first operand on the @code{RHS} of assignment
1073 @deftypefn {GIMPLE function} tree gimple_assign_rhs2 (gimple g)
1074 Return the second operand on the @code{RHS} of assignment statement @code{G}.
1077 @deftypefn {GIMPLE function} tree *gimple_assign_rhs2_ptr (gimple g)
1078 Return a pointer to the second operand on the @code{RHS} of assignment
1082 @deftypefn {GIMPLE function} void gimple_assign_set_rhs2 (gimple g, tree rhs)
1083 Set @code{RHS} to be the second operand on the @code{RHS} of assignment
1087 @deftypefn {GIMPLE function} bool gimple_assign_cast_p (gimple s)
1088 Return true if @code{S} is a type-cast assignment.
1092 @node @code{GIMPLE_BIND}
1093 @subsection @code{GIMPLE_BIND}
1094 @cindex @code{GIMPLE_BIND}
1096 @deftypefn {GIMPLE function} gimple gimple_build_bind (tree vars, gimple_seq body)
1097 Build a @code{GIMPLE_BIND} statement with a list of variables in @code{VARS}
1098 and a body of statements in sequence @code{BODY}.
1101 @deftypefn {GIMPLE function} tree gimple_bind_vars (gimple g)
1102 Return the variables declared in the @code{GIMPLE_BIND} statement @code{G}.
1105 @deftypefn {GIMPLE function} void gimple_bind_set_vars (gimple g, tree vars)
1106 Set @code{VARS} to be the set of variables declared in the @code{GIMPLE_BIND}
1110 @deftypefn {GIMPLE function} void gimple_bind_append_vars (gimple g, tree vars)
1111 Append @code{VARS} to the set of variables declared in the @code{GIMPLE_BIND}
1115 @deftypefn {GIMPLE function} gimple_seq gimple_bind_body (gimple g)
1116 Return the GIMPLE sequence contained in the @code{GIMPLE_BIND} statement
1120 @deftypefn {GIMPLE function} void gimple_bind_set_body (gimple g, gimple_seq seq)
1121 Set @code{SEQ} to be sequence contained in the @code{GIMPLE_BIND} statement @code{G}.
1124 @deftypefn {GIMPLE function} void gimple_bind_add_stmt (gimple gs, gimple stmt)
1125 Append a statement to the end of a @code{GIMPLE_BIND}'s body.
1128 @deftypefn {GIMPLE function} void gimple_bind_add_seq (gimple gs, gimple_seq seq)
1129 Append a sequence of statements to the end of a @code{GIMPLE_BIND}'s
1133 @deftypefn {GIMPLE function} tree gimple_bind_block (gimple g)
1134 Return the @code{TREE_BLOCK} node associated with @code{GIMPLE_BIND} statement
1135 @code{G}. This is analogous to the @code{BIND_EXPR_BLOCK} field in trees.
1138 @deftypefn {GIMPLE function} void gimple_bind_set_block (gimple g, tree block)
1139 Set @code{BLOCK} to be the @code{TREE_BLOCK} node associated with @code{GIMPLE_BIND}
1144 @node @code{GIMPLE_CALL}
1145 @subsection @code{GIMPLE_CALL}
1146 @cindex @code{GIMPLE_CALL}
1148 @deftypefn {GIMPLE function} gimple gimple_build_call (tree fn, unsigned nargs, ...)
1149 Build a @code{GIMPLE_CALL} statement to function @code{FN}. The argument @code{FN}
1150 must be either a @code{FUNCTION_DECL} or a gimple call address as
1151 determined by @code{is_gimple_call_addr}. @code{NARGS} are the number of
1152 arguments. The rest of the arguments follow the argument @code{NARGS},
1153 and must be trees that are valid as rvalues in gimple (i.e., each
1154 operand is validated with @code{is_gimple_operand}).
1158 @deftypefn {GIMPLE function} gimple gimple_build_call_from_tree (tree call_expr)
1159 Build a @code{GIMPLE_CALL} from a @code{CALL_EXPR} node. The arguments and the
1160 function are taken from the expression directly. This routine
1161 assumes that @code{call_expr} is already in GIMPLE form. That is, its
1162 operands are GIMPLE values and the function call needs no further
1163 simplification. All the call flags in @code{call_expr} are copied over
1164 to the new @code{GIMPLE_CALL}.
1167 @deftypefn {GIMPLE function} gimple gimple_build_call_vec (tree fn, @code{VEC}(tree, heap) *args)
1168 Identical to @code{gimple_build_call} but the arguments are stored in a
1172 @deftypefn {GIMPLE function} tree gimple_call_lhs (gimple g)
1173 Return the @code{LHS} of call statement @code{G}.
1176 @deftypefn {GIMPLE function} tree *gimple_call_lhs_ptr (gimple g)
1177 Return a pointer to the @code{LHS} of call statement @code{G}.
1180 @deftypefn {GIMPLE function} void gimple_call_set_lhs (gimple g, tree lhs)
1181 Set @code{LHS} to be the @code{LHS} operand of call statement @code{G}.
1184 @deftypefn {GIMPLE function} tree gimple_call_fn (gimple g)
1185 Return the tree node representing the function called by call
1189 @deftypefn {GIMPLE function} void gimple_call_set_fn (gimple g, tree fn)
1190 Set @code{FN} to be the function called by call statement @code{G}. This has
1191 to be a gimple value specifying the address of the called
1195 @deftypefn {GIMPLE function} tree gimple_call_fndecl (gimple g)
1196 If a given @code{GIMPLE_CALL}'s callee is a @code{FUNCTION_DECL}, return it.
1197 Otherwise return @code{NULL}. This function is analogous to
1198 @code{get_callee_fndecl} in @code{GENERIC}.
1201 @deftypefn {GIMPLE function} tree gimple_call_set_fndecl (gimple g, tree fndecl)
1202 Set the called function to @code{FNDECL}.
1205 @deftypefn {GIMPLE function} tree gimple_call_return_type (gimple g)
1206 Return the type returned by call statement @code{G}.
1209 @deftypefn {GIMPLE function} tree gimple_call_chain (gimple g)
1210 Return the static chain for call statement @code{G}.
1213 @deftypefn {GIMPLE function} void gimple_call_set_chain (gimple g, tree chain)
1214 Set @code{CHAIN} to be the static chain for call statement @code{G}.
1217 @deftypefn {GIMPLE function} gimple_call_num_args (gimple g)
1218 Return the number of arguments used by call statement @code{G}.
1221 @deftypefn {GIMPLE function} tree gimple_call_arg (gimple g, unsigned index)
1222 Return the argument at position @code{INDEX} for call statement @code{G}. The
1223 first argument is 0.
1226 @deftypefn {GIMPLE function} tree *gimple_call_arg_ptr (gimple g, unsigned index)
1227 Return a pointer to the argument at position @code{INDEX} for call
1231 @deftypefn {GIMPLE function} void gimple_call_set_arg (gimple g, unsigned index, tree arg)
1232 Set @code{ARG} to be the argument at position @code{INDEX} for call statement
1236 @deftypefn {GIMPLE function} void gimple_call_set_tail (gimple s)
1237 Mark call statement @code{S} as being a tail call (i.e., a call just
1238 before the exit of a function). These calls are candidate for
1239 tail call optimization.
1242 @deftypefn {GIMPLE function} bool gimple_call_tail_p (gimple s)
1243 Return true if @code{GIMPLE_CALL} @code{S} is marked as a tail call.
1246 @deftypefn {GIMPLE function} void gimple_call_mark_uninlinable (gimple s)
1247 Mark @code{GIMPLE_CALL} @code{S} as being uninlinable.
1250 @deftypefn {GIMPLE function} bool gimple_call_cannot_inline_p (gimple s)
1251 Return true if @code{GIMPLE_CALL} @code{S} cannot be inlined.
1254 @deftypefn {GIMPLE function} bool gimple_call_noreturn_p (gimple s)
1255 Return true if @code{S} is a noreturn call.
1258 @deftypefn {GIMPLE function} gimple gimple_call_copy_skip_args (gimple stmt, bitmap args_to_skip)
1259 Build a @code{GIMPLE_CALL} identical to @code{STMT} but skipping the arguments
1260 in the positions marked by the set @code{ARGS_TO_SKIP}.
1264 @node @code{GIMPLE_CATCH}
1265 @subsection @code{GIMPLE_CATCH}
1266 @cindex @code{GIMPLE_CATCH}
1268 @deftypefn {GIMPLE function} gimple gimple_build_catch (tree types, gimple_seq handler)
1269 Build a @code{GIMPLE_CATCH} statement. @code{TYPES} are the tree types this
1270 catch handles. @code{HANDLER} is a sequence of statements with the code
1274 @deftypefn {GIMPLE function} tree gimple_catch_types (gimple g)
1275 Return the types handled by @code{GIMPLE_CATCH} statement @code{G}.
1278 @deftypefn {GIMPLE function} tree *gimple_catch_types_ptr (gimple g)
1279 Return a pointer to the types handled by @code{GIMPLE_CATCH} statement
1283 @deftypefn {GIMPLE function} gimple_seq gimple_catch_handler (gimple g)
1284 Return the GIMPLE sequence representing the body of the handler
1285 of @code{GIMPLE_CATCH} statement @code{G}.
1288 @deftypefn {GIMPLE function} void gimple_catch_set_types (gimple g, tree t)
1289 Set @code{T} to be the set of types handled by @code{GIMPLE_CATCH} @code{G}.
1292 @deftypefn {GIMPLE function} void gimple_catch_set_handler (gimple g, gimple_seq handler)
1293 Set @code{HANDLER} to be the body of @code{GIMPLE_CATCH} @code{G}.
1297 @node @code{GIMPLE_COND}
1298 @subsection @code{GIMPLE_COND}
1299 @cindex @code{GIMPLE_COND}
1301 @deftypefn {GIMPLE function} gimple gimple_build_cond (enum tree_code pred_code, tree lhs, tree rhs, tree t_label, tree f_label)
1302 Build a @code{GIMPLE_COND} statement. @code{A} @code{GIMPLE_COND} statement compares
1303 @code{LHS} and @code{RHS} and if the condition in @code{PRED_CODE} is true, jump to
1304 the label in @code{t_label}, otherwise jump to the label in @code{f_label}.
1305 @code{PRED_CODE} are relational operator tree codes like @code{EQ_EXPR},
1306 @code{LT_EXPR}, @code{LE_EXPR}, @code{NE_EXPR}, etc.
1310 @deftypefn {GIMPLE function} gimple gimple_build_cond_from_tree (tree cond, tree t_label, tree f_label)
1311 Build a @code{GIMPLE_COND} statement from the conditional expression
1312 tree @code{COND}. @code{T_LABEL} and @code{F_LABEL} are as in @code{gimple_build_cond}.
1315 @deftypefn {GIMPLE function} enum tree_code gimple_cond_code (gimple g)
1316 Return the code of the predicate computed by conditional
1320 @deftypefn {GIMPLE function} void gimple_cond_set_code (gimple g, enum tree_code code)
1321 Set @code{CODE} to be the predicate code for the conditional statement
1325 @deftypefn {GIMPLE function} tree gimple_cond_lhs (gimple g)
1326 Return the @code{LHS} of the predicate computed by conditional statement
1330 @deftypefn {GIMPLE function} void gimple_cond_set_lhs (gimple g, tree lhs)
1331 Set @code{LHS} to be the @code{LHS} operand of the predicate computed by
1332 conditional statement @code{G}.
1335 @deftypefn {GIMPLE function} tree gimple_cond_rhs (gimple g)
1336 Return the @code{RHS} operand of the predicate computed by conditional
1340 @deftypefn {GIMPLE function} void gimple_cond_set_rhs (gimple g, tree rhs)
1341 Set @code{RHS} to be the @code{RHS} operand of the predicate computed by
1342 conditional statement @code{G}.
1345 @deftypefn {GIMPLE function} tree gimple_cond_true_label (gimple g)
1346 Return the label used by conditional statement @code{G} when its
1347 predicate evaluates to true.
1350 @deftypefn {GIMPLE function} void gimple_cond_set_true_label (gimple g, tree label)
1351 Set @code{LABEL} to be the label used by conditional statement @code{G} when
1352 its predicate evaluates to true.
1355 @deftypefn {GIMPLE function} void gimple_cond_set_false_label (gimple g, tree label)
1356 Set @code{LABEL} to be the label used by conditional statement @code{G} when
1357 its predicate evaluates to false.
1360 @deftypefn {GIMPLE function} tree gimple_cond_false_label (gimple g)
1361 Return the label used by conditional statement @code{G} when its
1362 predicate evaluates to false.
1365 @deftypefn {GIMPLE function} void gimple_cond_make_false (gimple g)
1366 Set the conditional @code{COND_STMT} to be of the form 'if (1 == 0)'.
1369 @deftypefn {GIMPLE function} void gimple_cond_make_true (gimple g)
1370 Set the conditional @code{COND_STMT} to be of the form 'if (1 == 1)'.
1373 @node @code{GIMPLE_EH_FILTER}
1374 @subsection @code{GIMPLE_EH_FILTER}
1375 @cindex @code{GIMPLE_EH_FILTER}
1377 @deftypefn {GIMPLE function} gimple gimple_build_eh_filter (tree types, gimple_seq failure)
1378 Build a @code{GIMPLE_EH_FILTER} statement. @code{TYPES} are the filter's
1379 types. @code{FAILURE} is a sequence with the filter's failure action.
1382 @deftypefn {GIMPLE function} tree gimple_eh_filter_types (gimple g)
1383 Return the types handled by @code{GIMPLE_EH_FILTER} statement @code{G}.
1386 @deftypefn {GIMPLE function} tree *gimple_eh_filter_types_ptr (gimple g)
1387 Return a pointer to the types handled by @code{GIMPLE_EH_FILTER}
1391 @deftypefn {GIMPLE function} gimple_seq gimple_eh_filter_failure (gimple g)
1392 Return the sequence of statement to execute when @code{GIMPLE_EH_FILTER}
1396 @deftypefn {GIMPLE function} void gimple_eh_filter_set_types (gimple g, tree types)
1397 Set @code{TYPES} to be the set of types handled by @code{GIMPLE_EH_FILTER} @code{G}.
1400 @deftypefn {GIMPLE function} void gimple_eh_filter_set_failure (gimple g, gimple_seq failure)
1401 Set @code{FAILURE} to be the sequence of statements to execute on
1402 failure for @code{GIMPLE_EH_FILTER} @code{G}.
1405 @deftypefn {GIMPLE function} bool gimple_eh_filter_must_not_throw (gimple g)
1406 Return the @code{EH_FILTER_MUST_NOT_THROW} flag.
1409 @deftypefn {GIMPLE function} void gimple_eh_filter_set_must_not_throw (gimple g, bool mntp)
1410 Set the @code{EH_FILTER_MUST_NOT_THROW} flag.
1414 @node @code{GIMPLE_LABEL}
1415 @subsection @code{GIMPLE_LABEL}
1416 @cindex @code{GIMPLE_LABEL}
1418 @deftypefn {GIMPLE function} gimple gimple_build_label (tree label)
1419 Build a @code{GIMPLE_LABEL} statement with corresponding to the tree
1420 label, @code{LABEL}.
1423 @deftypefn {GIMPLE function} tree gimple_label_label (gimple g)
1424 Return the @code{LABEL_DECL} node used by @code{GIMPLE_LABEL} statement @code{G}.
1427 @deftypefn {GIMPLE function} void gimple_label_set_label (gimple g, tree label)
1428 Set @code{LABEL} to be the @code{LABEL_DECL} node used by @code{GIMPLE_LABEL}
1433 @deftypefn {GIMPLE function} gimple gimple_build_goto (tree dest)
1434 Build a @code{GIMPLE_GOTO} statement to label @code{DEST}.
1437 @deftypefn {GIMPLE function} tree gimple_goto_dest (gimple g)
1438 Return the destination of the unconditional jump @code{G}.
1441 @deftypefn {GIMPLE function} void gimple_goto_set_dest (gimple g, tree dest)
1442 Set @code{DEST} to be the destination of the unconditional jump @code{G}.
1446 @node @code{GIMPLE_NOP}
1447 @subsection @code{GIMPLE_NOP}
1448 @cindex @code{GIMPLE_NOP}
1450 @deftypefn {GIMPLE function} gimple gimple_build_nop (void)
1451 Build a @code{GIMPLE_NOP} statement.
1454 @deftypefn {GIMPLE function} bool gimple_nop_p (gimple g)
1455 Returns @code{TRUE} if statement @code{G} is a @code{GIMPLE_NOP}.
1458 @node @code{GIMPLE_OMP_ATOMIC_LOAD}
1459 @subsection @code{GIMPLE_OMP_ATOMIC_LOAD}
1460 @cindex @code{GIMPLE_OMP_ATOMIC_LOAD}
1462 @deftypefn {GIMPLE function} gimple gimple_build_omp_atomic_load (tree lhs, tree rhs)
1463 Build a @code{GIMPLE_OMP_ATOMIC_LOAD} statement. @code{LHS} is the left-hand
1464 side of the assignment. @code{RHS} is the right-hand side of the
1468 @deftypefn {GIMPLE function} void gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
1469 Set the @code{LHS} of an atomic load.
1472 @deftypefn {GIMPLE function} tree gimple_omp_atomic_load_lhs (gimple g)
1473 Get the @code{LHS} of an atomic load.
1476 @deftypefn {GIMPLE function} void gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
1477 Set the @code{RHS} of an atomic set.
1480 @deftypefn {GIMPLE function} tree gimple_omp_atomic_load_rhs (gimple g)
1481 Get the @code{RHS} of an atomic set.
1485 @node @code{GIMPLE_OMP_ATOMIC_STORE}
1486 @subsection @code{GIMPLE_OMP_ATOMIC_STORE}
1487 @cindex @code{GIMPLE_OMP_ATOMIC_STORE}
1489 @deftypefn {GIMPLE function} gimple gimple_build_omp_atomic_store (tree val)
1490 Build a @code{GIMPLE_OMP_ATOMIC_STORE} statement. @code{VAL} is the value to be
1494 @deftypefn {GIMPLE function} void gimple_omp_atomic_store_set_val (gimple g, tree val)
1495 Set the value being stored in an atomic store.
1498 @deftypefn {GIMPLE function} tree gimple_omp_atomic_store_val (gimple g)
1499 Return the value being stored in an atomic store.
1502 @node @code{GIMPLE_OMP_CONTINUE}
1503 @subsection @code{GIMPLE_OMP_CONTINUE}
1504 @cindex @code{GIMPLE_OMP_CONTINUE}
1506 @deftypefn {GIMPLE function} gimple gimple_build_omp_continue (tree control_def, tree control_use)
1507 Build a @code{GIMPLE_OMP_CONTINUE} statement. @code{CONTROL_DEF} is the
1508 definition of the control variable. @code{CONTROL_USE} is the use of
1509 the control variable.
1512 @deftypefn {GIMPLE function} tree gimple_omp_continue_control_def (gimple s)
1513 Return the definition of the control variable on a
1514 @code{GIMPLE_OMP_CONTINUE} in @code{S}.
1517 @deftypefn {GIMPLE function} tree gimple_omp_continue_control_def_ptr (gimple s)
1518 Same as above, but return the pointer.
1521 @deftypefn {GIMPLE function} tree gimple_omp_continue_set_control_def (gimple s)
1522 Set the control variable definition for a @code{GIMPLE_OMP_CONTINUE}
1523 statement in @code{S}.
1526 @deftypefn {GIMPLE function} tree gimple_omp_continue_control_use (gimple s)
1527 Return the use of the control variable on a @code{GIMPLE_OMP_CONTINUE}
1531 @deftypefn {GIMPLE function} tree gimple_omp_continue_control_use_ptr (gimple s)
1532 Same as above, but return the pointer.
1535 @deftypefn {GIMPLE function} tree gimple_omp_continue_set_control_use (gimple s)
1536 Set the control variable use for a @code{GIMPLE_OMP_CONTINUE} statement
1541 @node @code{GIMPLE_OMP_CRITICAL}
1542 @subsection @code{GIMPLE_OMP_CRITICAL}
1543 @cindex @code{GIMPLE_OMP_CRITICAL}
1545 @deftypefn {GIMPLE function} gimple gimple_build_omp_critical (gimple_seq body, tree name)
1546 Build a @code{GIMPLE_OMP_CRITICAL} statement. @code{BODY} is the sequence of
1547 statements for which only one thread can execute. @code{NAME} is an
1548 optional identifier for this critical block.
1551 @deftypefn {GIMPLE function} tree gimple_omp_critical_name (gimple g)
1552 Return the name associated with @code{OMP_CRITICAL} statement @code{G}.
1555 @deftypefn {GIMPLE function} tree *gimple_omp_critical_name_ptr (gimple g)
1556 Return a pointer to the name associated with @code{OMP} critical
1560 @deftypefn {GIMPLE function} void gimple_omp_critical_set_name (gimple g, tree name)
1561 Set @code{NAME} to be the name associated with @code{OMP} critical statement @code{G}.
1564 @node @code{GIMPLE_OMP_FOR}
1565 @subsection @code{GIMPLE_OMP_FOR}
1566 @cindex @code{GIMPLE_OMP_FOR}
1568 @deftypefn {GIMPLE function} gimple gimple_build_omp_for (gimple_seq body, @
1569 tree clauses, tree index, tree initial, tree final, tree incr, @
1570 gimple_seq pre_body, enum tree_code omp_for_cond)
1571 Build a @code{GIMPLE_OMP_FOR} statement. @code{BODY} is sequence of statements
1572 inside the for loop. @code{CLAUSES}, are any of the @code{OMP} loop
1573 construct's clauses: private, firstprivate, lastprivate,
1574 reductions, ordered, schedule, and nowait. @code{PRE_BODY} is the
1575 sequence of statements that are loop invariant. @code{INDEX} is the
1576 index variable. @code{INITIAL} is the initial value of @code{INDEX}. @code{FINAL} is
1577 final value of @code{INDEX}. OMP_FOR_COND is the predicate used to
1578 compare @code{INDEX} and @code{FINAL}. @code{INCR} is the increment expression.
1581 @deftypefn {GIMPLE function} tree gimple_omp_for_clauses (gimple g)
1582 Return the clauses associated with @code{OMP_FOR} @code{G}.
1585 @deftypefn {GIMPLE function} tree *gimple_omp_for_clauses_ptr (gimple g)
1586 Return a pointer to the @code{OMP_FOR} @code{G}.
1589 @deftypefn {GIMPLE function} void gimple_omp_for_set_clauses (gimple g, tree clauses)
1590 Set @code{CLAUSES} to be the list of clauses associated with @code{OMP_FOR} @code{G}.
1593 @deftypefn {GIMPLE function} tree gimple_omp_for_index (gimple g)
1594 Return the index variable for @code{OMP_FOR} @code{G}.
1597 @deftypefn {GIMPLE function} tree *gimple_omp_for_index_ptr (gimple g)
1598 Return a pointer to the index variable for @code{OMP_FOR} @code{G}.
1601 @deftypefn {GIMPLE function} void gimple_omp_for_set_index (gimple g, tree index)
1602 Set @code{INDEX} to be the index variable for @code{OMP_FOR} @code{G}.
1605 @deftypefn {GIMPLE function} tree gimple_omp_for_initial (gimple g)
1606 Return the initial value for @code{OMP_FOR} @code{G}.
1609 @deftypefn {GIMPLE function} tree *gimple_omp_for_initial_ptr (gimple g)
1610 Return a pointer to the initial value for @code{OMP_FOR} @code{G}.
1613 @deftypefn {GIMPLE function} void gimple_omp_for_set_initial (gimple g, tree initial)
1614 Set @code{INITIAL} to be the initial value for @code{OMP_FOR} @code{G}.
1617 @deftypefn {GIMPLE function} tree gimple_omp_for_final (gimple g)
1618 Return the final value for @code{OMP_FOR} @code{G}.
1621 @deftypefn {GIMPLE function} tree *gimple_omp_for_final_ptr (gimple g)
1622 turn a pointer to the final value for @code{OMP_FOR} @code{G}.
1625 @deftypefn {GIMPLE function} void gimple_omp_for_set_final (gimple g, tree final)
1626 Set @code{FINAL} to be the final value for @code{OMP_FOR} @code{G}.
1629 @deftypefn {GIMPLE function} tree gimple_omp_for_incr (gimple g)
1630 Return the increment value for @code{OMP_FOR} @code{G}.
1633 @deftypefn {GIMPLE function} tree *gimple_omp_for_incr_ptr (gimple g)
1634 Return a pointer to the increment value for @code{OMP_FOR} @code{G}.
1637 @deftypefn {GIMPLE function} void gimple_omp_for_set_incr (gimple g, tree incr)
1638 Set @code{INCR} to be the increment value for @code{OMP_FOR} @code{G}.
1641 @deftypefn {GIMPLE function} gimple_seq gimple_omp_for_pre_body (gimple g)
1642 Return the sequence of statements to execute before the @code{OMP_FOR}
1643 statement @code{G} starts.
1646 @deftypefn {GIMPLE function} void gimple_omp_for_set_pre_body (gimple g, gimple_seq pre_body)
1647 Set @code{PRE_BODY} to be the sequence of statements to execute before
1648 the @code{OMP_FOR} statement @code{G} starts.
1651 @deftypefn {GIMPLE function} void gimple_omp_for_set_cond (gimple g, enum tree_code cond)
1652 Set @code{COND} to be the condition code for @code{OMP_FOR} @code{G}.
1655 @deftypefn {GIMPLE function} enum tree_code gimple_omp_for_cond (gimple g)
1656 Return the condition code associated with @code{OMP_FOR} @code{G}.
1660 @node @code{GIMPLE_OMP_MASTER}
1661 @subsection @code{GIMPLE_OMP_MASTER}
1662 @cindex @code{GIMPLE_OMP_MASTER}
1664 @deftypefn {GIMPLE function} gimple gimple_build_omp_master (gimple_seq body)
1665 Build a @code{GIMPLE_OMP_MASTER} statement. @code{BODY} is the sequence of
1666 statements to be executed by just the master.
1670 @node @code{GIMPLE_OMP_ORDERED}
1671 @subsection @code{GIMPLE_OMP_ORDERED}
1672 @cindex @code{GIMPLE_OMP_ORDERED}
1674 @deftypefn {GIMPLE function} gimple gimple_build_omp_ordered (gimple_seq body)
1675 Build a @code{GIMPLE_OMP_ORDERED} statement.
1678 @code{BODY} is the sequence of statements inside a loop that will
1679 executed in sequence.
1682 @node @code{GIMPLE_OMP_PARALLEL}
1683 @subsection @code{GIMPLE_OMP_PARALLEL}
1684 @cindex @code{GIMPLE_OMP_PARALLEL}
1686 @deftypefn {GIMPLE function} gimple gimple_build_omp_parallel (gimple_seq body, tree clauses, tree child_fn, tree data_arg)
1687 Build a @code{GIMPLE_OMP_PARALLEL} statement.
1690 @code{BODY} is sequence of statements which are executed in parallel.
1691 @code{CLAUSES}, are the @code{OMP} parallel construct's clauses. @code{CHILD_FN} is
1692 the function created for the parallel threads to execute.
1693 @code{DATA_ARG} are the shared data argument(s).
1695 @deftypefn {GIMPLE function} bool gimple_omp_parallel_combined_p (gimple g)
1696 Return true if @code{OMP} parallel statement @code{G} has the
1697 @code{GF_OMP_PARALLEL_COMBINED} flag set.
1700 @deftypefn {GIMPLE function} void gimple_omp_parallel_set_combined_p (gimple g)
1701 Set the @code{GF_OMP_PARALLEL_COMBINED} field in @code{OMP} parallel statement
1705 @deftypefn {GIMPLE function} gimple_seq gimple_omp_body (gimple g)
1706 Return the body for the @code{OMP} statement @code{G}.
1709 @deftypefn {GIMPLE function} void gimple_omp_set_body (gimple g, gimple_seq body)
1710 Set @code{BODY} to be the body for the @code{OMP} statement @code{G}.
1713 @deftypefn {GIMPLE function} tree gimple_omp_parallel_clauses (gimple g)
1714 Return the clauses associated with @code{OMP_PARALLEL} @code{G}.
1717 @deftypefn {GIMPLE function} tree *gimple_omp_parallel_clauses_ptr (gimple g)
1718 Return a pointer to the clauses associated with @code{OMP_PARALLEL} @code{G}.
1721 @deftypefn {GIMPLE function} void gimple_omp_parallel_set_clauses (gimple g, tree clauses)
1722 Set @code{CLAUSES} to be the list of clauses associated with
1723 @code{OMP_PARALLEL} @code{G}.
1726 @deftypefn {GIMPLE function} tree gimple_omp_parallel_child_fn (gimple g)
1727 Return the child function used to hold the body of @code{OMP_PARALLEL}
1731 @deftypefn {GIMPLE function} tree *gimple_omp_parallel_child_fn_ptr (gimple g)
1732 Return a pointer to the child function used to hold the body of
1733 @code{OMP_PARALLEL} @code{G}.
1736 @deftypefn {GIMPLE function} void gimple_omp_parallel_set_child_fn (gimple g, tree child_fn)
1737 Set @code{CHILD_FN} to be the child function for @code{OMP_PARALLEL} @code{G}.
1740 @deftypefn {GIMPLE function} tree gimple_omp_parallel_data_arg (gimple g)
1741 Return the artificial argument used to send variables and values
1742 from the parent to the children threads in @code{OMP_PARALLEL} @code{G}.
1745 @deftypefn {GIMPLE function} tree *gimple_omp_parallel_data_arg_ptr (gimple g)
1746 Return a pointer to the data argument for @code{OMP_PARALLEL} @code{G}.
1749 @deftypefn {GIMPLE function} void gimple_omp_parallel_set_data_arg (gimple g, tree data_arg)
1750 Set @code{DATA_ARG} to be the data argument for @code{OMP_PARALLEL} @code{G}.
1753 @deftypefn {GIMPLE function} bool is_gimple_omp (gimple stmt)
1754 Returns true when the gimple statement @code{STMT} is any of the OpenMP
1759 @node @code{GIMPLE_OMP_RETURN}
1760 @subsection @code{GIMPLE_OMP_RETURN}
1761 @cindex @code{GIMPLE_OMP_RETURN}
1763 @deftypefn {GIMPLE function} gimple gimple_build_omp_return (bool wait_p)
1764 Build a @code{GIMPLE_OMP_RETURN} statement. @code{WAIT_P} is true if this is a
1768 @deftypefn {GIMPLE function} void gimple_omp_return_set_nowait (gimple s)
1769 Set the nowait flag on @code{GIMPLE_OMP_RETURN} statement @code{S}.
1773 @deftypefn {GIMPLE function} bool gimple_omp_return_nowait_p (gimple g)
1774 Return true if @code{OMP} return statement @code{G} has the
1775 @code{GF_OMP_RETURN_NOWAIT} flag set.
1778 @node @code{GIMPLE_OMP_SECTION}
1779 @subsection @code{GIMPLE_OMP_SECTION}
1780 @cindex @code{GIMPLE_OMP_SECTION}
1782 @deftypefn {GIMPLE function} gimple gimple_build_omp_section (gimple_seq body)
1783 Build a @code{GIMPLE_OMP_SECTION} statement for a sections statement.
1786 @code{BODY} is the sequence of statements in the section.
1788 @deftypefn {GIMPLE function} bool gimple_omp_section_last_p (gimple g)
1789 Return true if @code{OMP} section statement @code{G} has the
1790 @code{GF_OMP_SECTION_LAST} flag set.
1793 @deftypefn {GIMPLE function} void gimple_omp_section_set_last (gimple g)
1794 Set the @code{GF_OMP_SECTION_LAST} flag on @code{G}.
1797 @node @code{GIMPLE_OMP_SECTIONS}
1798 @subsection @code{GIMPLE_OMP_SECTIONS}
1799 @cindex @code{GIMPLE_OMP_SECTIONS}
1801 @deftypefn {GIMPLE function} gimple gimple_build_omp_sections (gimple_seq body, tree clauses)
1802 Build a @code{GIMPLE_OMP_SECTIONS} statement. @code{BODY} is a sequence of
1803 section statements. @code{CLAUSES} are any of the @code{OMP} sections
1804 construct's clauses: private, firstprivate, lastprivate,
1805 reduction, and nowait.
1809 @deftypefn {GIMPLE function} gimple gimple_build_omp_sections_switch (void)
1810 Build a @code{GIMPLE_OMP_SECTIONS_SWITCH} statement.
1813 @deftypefn {GIMPLE function} tree gimple_omp_sections_control (gimple g)
1814 Return the control variable associated with the
1815 @code{GIMPLE_OMP_SECTIONS} in @code{G}.
1818 @deftypefn {GIMPLE function} tree *gimple_omp_sections_control_ptr (gimple g)
1819 Return a pointer to the clauses associated with the
1820 @code{GIMPLE_OMP_SECTIONS} in @code{G}.
1823 @deftypefn {GIMPLE function} void gimple_omp_sections_set_control (gimple g, tree control)
1824 Set @code{CONTROL} to be the set of clauses associated with the
1825 @code{GIMPLE_OMP_SECTIONS} in @code{G}.
1828 @deftypefn {GIMPLE function} tree gimple_omp_sections_clauses (gimple g)
1829 Return the clauses associated with @code{OMP_SECTIONS} @code{G}.
1832 @deftypefn {GIMPLE function} tree *gimple_omp_sections_clauses_ptr (gimple g)
1833 Return a pointer to the clauses associated with @code{OMP_SECTIONS} @code{G}.
1836 @deftypefn {GIMPLE function} void gimple_omp_sections_set_clauses (gimple g, tree clauses)
1837 Set @code{CLAUSES} to be the set of clauses associated with @code{OMP_SECTIONS}
1842 @node @code{GIMPLE_OMP_SINGLE}
1843 @subsection @code{GIMPLE_OMP_SINGLE}
1844 @cindex @code{GIMPLE_OMP_SINGLE}
1846 @deftypefn {GIMPLE function} gimple gimple_build_omp_single (gimple_seq body, tree clauses)
1847 Build a @code{GIMPLE_OMP_SINGLE} statement. @code{BODY} is the sequence of
1848 statements that will be executed once. @code{CLAUSES} are any of the
1849 @code{OMP} single construct's clauses: private, firstprivate,
1850 copyprivate, nowait.
1853 @deftypefn {GIMPLE function} tree gimple_omp_single_clauses (gimple g)
1854 Return the clauses associated with @code{OMP_SINGLE} @code{G}.
1857 @deftypefn {GIMPLE function} tree *gimple_omp_single_clauses_ptr (gimple g)
1858 Return a pointer to the clauses associated with @code{OMP_SINGLE} @code{G}.
1861 @deftypefn {GIMPLE function} void gimple_omp_single_set_clauses (gimple g, tree clauses)
1862 Set @code{CLAUSES} to be the clauses associated with @code{OMP_SINGLE} @code{G}.
1866 @node @code{GIMPLE_PHI}
1867 @subsection @code{GIMPLE_PHI}
1868 @cindex @code{GIMPLE_PHI}
1870 @deftypefn {GIMPLE function} gimple make_phi_node (tree var, int len)
1871 Build a @code{PHI} node with len argument slots for variable var.
1874 @deftypefn {GIMPLE function} unsigned gimple_phi_capacity (gimple g)
1875 Return the maximum number of arguments supported by @code{GIMPLE_PHI} @code{G}.
1878 @deftypefn {GIMPLE function} unsigned gimple_phi_num_args (gimple g)
1879 Return the number of arguments in @code{GIMPLE_PHI} @code{G}. This must always
1880 be exactly the number of incoming edges for the basic block
1884 @deftypefn {GIMPLE function} tree gimple_phi_result (gimple g)
1885 Return the @code{SSA} name created by @code{GIMPLE_PHI} @code{G}.
1888 @deftypefn {GIMPLE function} tree *gimple_phi_result_ptr (gimple g)
1889 Return a pointer to the @code{SSA} name created by @code{GIMPLE_PHI} @code{G}.
1892 @deftypefn {GIMPLE function} void gimple_phi_set_result (gimple g, tree result)
1893 Set @code{RESULT} to be the @code{SSA} name created by @code{GIMPLE_PHI} @code{G}.
1896 @deftypefn {GIMPLE function} struct phi_arg_d *gimple_phi_arg (gimple g, index)
1897 Return the @code{PHI} argument corresponding to incoming edge @code{INDEX} for
1898 @code{GIMPLE_PHI} @code{G}.
1901 @deftypefn {GIMPLE function} void gimple_phi_set_arg (gimple g, index, struct phi_arg_d * phiarg)
1902 Set @code{PHIARG} to be the argument corresponding to incoming edge
1903 @code{INDEX} for @code{GIMPLE_PHI} @code{G}.
1906 @node @code{GIMPLE_RESX}
1907 @subsection @code{GIMPLE_RESX}
1908 @cindex @code{GIMPLE_RESX}
1910 @deftypefn {GIMPLE function} gimple gimple_build_resx (int region)
1911 Build a @code{GIMPLE_RESX} statement which is a statement. This
1912 statement is a placeholder for _Unwind_Resume before we know if a
1913 function call or a branch is needed. @code{REGION} is the exception
1914 region from which control is flowing.
1917 @deftypefn {GIMPLE function} int gimple_resx_region (gimple g)
1918 Return the region number for @code{GIMPLE_RESX} @code{G}.
1921 @deftypefn {GIMPLE function} void gimple_resx_set_region (gimple g, int region)
1922 Set @code{REGION} to be the region number for @code{GIMPLE_RESX} @code{G}.
1925 @node @code{GIMPLE_RETURN}
1926 @subsection @code{GIMPLE_RETURN}
1927 @cindex @code{GIMPLE_RETURN}
1929 @deftypefn {GIMPLE function} gimple gimple_build_return (tree retval)
1930 Build a @code{GIMPLE_RETURN} statement whose return value is retval.
1933 @deftypefn {GIMPLE function} tree gimple_return_retval (gimple g)
1934 Return the return value for @code{GIMPLE_RETURN} @code{G}.
1937 @deftypefn {GIMPLE function} void gimple_return_set_retval (gimple g, tree retval)
1938 Set @code{RETVAL} to be the return value for @code{GIMPLE_RETURN} @code{G}.
1941 @node @code{GIMPLE_SWITCH}
1942 @subsection @code{GIMPLE_SWITCH}
1943 @cindex @code{GIMPLE_SWITCH}
1945 @deftypefn {GIMPLE function} gimple gimple_build_switch ( nlabels, tree index, tree default_label, ...)
1946 Build a @code{GIMPLE_SWITCH} statement. @code{NLABELS} are the number of
1947 labels excluding the default label. The default label is passed
1948 in @code{DEFAULT_LABEL}. The rest of the arguments are trees
1949 representing the labels. Each label is a tree of code
1950 @code{CASE_LABEL_EXPR}.
1953 @deftypefn {GIMPLE function} gimple gimple_build_switch_vec (tree index, tree default_label, @code{VEC}(tree,heap) *args)
1954 This function is an alternate way of building @code{GIMPLE_SWITCH}
1955 statements. @code{INDEX} and @code{DEFAULT_LABEL} are as in
1956 gimple_build_switch. @code{ARGS} is a vector of @code{CASE_LABEL_EXPR} trees
1957 that contain the labels.
1960 @deftypefn {GIMPLE function} unsigned gimple_switch_num_labels (gimple g)
1961 Return the number of labels associated with the switch statement
1965 @deftypefn {GIMPLE function} void gimple_switch_set_num_labels (gimple g, unsigned nlabels)
1966 Set @code{NLABELS} to be the number of labels for the switch statement
1970 @deftypefn {GIMPLE function} tree gimple_switch_index (gimple g)
1971 Return the index variable used by the switch statement @code{G}.
1974 @deftypefn {GIMPLE function} void gimple_switch_set_index (gimple g, tree index)
1975 Set @code{INDEX} to be the index variable for switch statement @code{G}.
1978 @deftypefn {GIMPLE function} tree gimple_switch_label (gimple g, unsigned index)
1979 Return the label numbered @code{INDEX}. The default label is 0, followed
1980 by any labels in a switch statement.
1983 @deftypefn {GIMPLE function} void gimple_switch_set_label (gimple g, unsigned index, tree label)
1984 Set the label number @code{INDEX} to @code{LABEL}. 0 is always the default
1988 @deftypefn {GIMPLE function} tree gimple_switch_default_label (gimple g)
1989 Return the default label for a switch statement.
1992 @deftypefn {GIMPLE function} void gimple_switch_set_default_label (gimple g, tree label)
1993 Set the default label for a switch statement.
1997 @node @code{GIMPLE_TRY}
1998 @subsection @code{GIMPLE_TRY}
1999 @cindex @code{GIMPLE_TRY}
2001 @deftypefn {GIMPLE function} gimple gimple_build_try (gimple_seq eval, gimple_seq cleanup, unsigned int kind)
2002 Build a @code{GIMPLE_TRY} statement. @code{EVAL} is a sequence with the
2003 expression to evaluate. @code{CLEANUP} is a sequence of statements to
2004 run at clean-up time. @code{KIND} is the enumeration value
2005 @code{GIMPLE_TRY_CATCH} if this statement denotes a try/catch construct
2006 or @code{GIMPLE_TRY_FINALLY} if this statement denotes a try/finally
2010 @deftypefn {GIMPLE function} enum gimple_try_flags gimple_try_kind (gimple g)
2011 Return the kind of try block represented by @code{GIMPLE_TRY} @code{G}. This is
2012 either @code{GIMPLE_TRY_CATCH} or @code{GIMPLE_TRY_FINALLY}.
2015 @deftypefn {GIMPLE function} bool gimple_try_catch_is_cleanup (gimple g)
2016 Return the @code{GIMPLE_TRY_CATCH_IS_CLEANUP} flag.
2019 @deftypefn {GIMPLE function} gimple_seq gimple_try_eval (gimple g)
2020 Return the sequence of statements used as the body for @code{GIMPLE_TRY}
2024 @deftypefn {GIMPLE function} gimple_seq gimple_try_cleanup (gimple g)
2025 Return the sequence of statements used as the cleanup body for
2026 @code{GIMPLE_TRY} @code{G}.
2029 @deftypefn {GIMPLE function} void gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
2030 Set the @code{GIMPLE_TRY_CATCH_IS_CLEANUP} flag.
2033 @deftypefn {GIMPLE function} void gimple_try_set_eval (gimple g, gimple_seq eval)
2034 Set @code{EVAL} to be the sequence of statements to use as the body for
2035 @code{GIMPLE_TRY} @code{G}.
2038 @deftypefn {GIMPLE function} void gimple_try_set_cleanup (gimple g, gimple_seq cleanup)
2039 Set @code{CLEANUP} to be the sequence of statements to use as the
2040 cleanup body for @code{GIMPLE_TRY} @code{G}.
2043 @node @code{GIMPLE_WITH_CLEANUP_EXPR}
2044 @subsection @code{GIMPLE_WITH_CLEANUP_EXPR}
2045 @cindex @code{GIMPLE_WITH_CLEANUP_EXPR}
2047 @deftypefn {GIMPLE function} gimple gimple_build_wce (gimple_seq cleanup)
2048 Build a @code{GIMPLE_WITH_CLEANUP_EXPR} statement. @code{CLEANUP} is the
2049 clean-up expression.
2052 @deftypefn {GIMPLE function} gimple_seq gimple_wce_cleanup (gimple g)
2053 Return the cleanup sequence for cleanup statement @code{G}.
2056 @deftypefn {GIMPLE function} void gimple_wce_set_cleanup (gimple g, gimple_seq cleanup)
2057 Set @code{CLEANUP} to be the cleanup sequence for @code{G}.
2060 @deftypefn {GIMPLE function} bool gimple_wce_cleanup_eh_only (gimple g)
2061 Return the @code{CLEANUP_EH_ONLY} flag for a @code{WCE} tuple.
2064 @deftypefn {GIMPLE function} void gimple_wce_set_cleanup_eh_only (gimple g, bool eh_only_p)
2065 Set the @code{CLEANUP_EH_ONLY} flag for a @code{WCE} tuple.
2069 @node GIMPLE sequences
2070 @section GIMPLE sequences
2071 @cindex GIMPLE sequences
2073 GIMPLE sequences are the tuple equivalent of @code{STATEMENT_LIST}'s
2074 used in @code{GENERIC}. They are used to chain statements together, and
2075 when used in conjunction with sequence iterators, provide a
2076 framework for iterating through statements.
2078 GIMPLE sequences are of type struct @code{gimple_sequence}, but are more
2079 commonly passed by reference to functions dealing with sequences.
2080 The type for a sequence pointer is @code{gimple_seq} which is the same
2081 as struct @code{gimple_sequence} *. When declaring a local sequence,
2082 you can define a local variable of type struct @code{gimple_sequence}.
2083 When declaring a sequence allocated on the garbage collected
2084 heap, use the function @code{gimple_seq_alloc} documented below.
2086 There are convenience functions for iterating through sequences
2087 in the section entitled Sequence Iterators.
2089 Below is a list of functions to manipulate and query sequences.
2091 @deftypefn {GIMPLE function} void gimple_seq_add_stmt (gimple_seq *seq, gimple g)
2092 Link a gimple statement to the end of the sequence *@code{SEQ} if @code{G} is
2093 not @code{NULL}. If *@code{SEQ} is @code{NULL}, allocate a sequence before linking.
2096 @deftypefn {GIMPLE function} void gimple_seq_add_seq (gimple_seq *dest, gimple_seq src)
2097 Append sequence @code{SRC} to the end of sequence *@code{DEST} if @code{SRC} is not
2098 @code{NULL}. If *@code{DEST} is @code{NULL}, allocate a new sequence before
2102 @deftypefn {GIMPLE function} gimple_seq gimple_seq_deep_copy (gimple_seq src)
2103 Perform a deep copy of sequence @code{SRC} and return the result.
2106 @deftypefn {GIMPLE function} gimple_seq gimple_seq_reverse (gimple_seq seq)
2107 Reverse the order of the statements in the sequence @code{SEQ}. Return
2111 @deftypefn {GIMPLE function} gimple gimple_seq_first (gimple_seq s)
2112 Return the first statement in sequence @code{S}.
2115 @deftypefn {GIMPLE function} gimple gimple_seq_last (gimple_seq s)
2116 Return the last statement in sequence @code{S}.
2119 @deftypefn {GIMPLE function} void gimple_seq_set_last (gimple_seq s, gimple last)
2120 Set the last statement in sequence @code{S} to the statement in @code{LAST}.
2123 @deftypefn {GIMPLE function} void gimple_seq_set_first (gimple_seq s, gimple first)
2124 Set the first statement in sequence @code{S} to the statement in @code{FIRST}.
2127 @deftypefn {GIMPLE function} void gimple_seq_init (gimple_seq s)
2128 Initialize sequence @code{S} to an empty sequence.
2131 @deftypefn {GIMPLE function} gimple_seq gimple_seq_alloc (void)
2132 Allocate a new sequence in the garbage collected store and return
2136 @deftypefn {GIMPLE function} void gimple_seq_copy (gimple_seq dest, gimple_seq src)
2137 Copy the sequence @code{SRC} into the sequence @code{DEST}.
2140 @deftypefn {GIMPLE function} bool gimple_seq_empty_p (gimple_seq s)
2141 Return true if the sequence @code{S} is empty.
2144 @deftypefn {GIMPLE function} gimple_seq bb_seq (basic_block bb)
2145 Returns the sequence of statements in @code{BB}.
2148 @deftypefn {GIMPLE function} void set_bb_seq (basic_block bb, gimple_seq seq)
2149 Sets the sequence of statements in @code{BB} to @code{SEQ}.
2152 @deftypefn {GIMPLE function} bool gimple_seq_singleton_p (gimple_seq seq)
2153 Determine whether @code{SEQ} contains exactly one statement.
2156 @node Sequence iterators
2157 @section Sequence iterators
2158 @cindex Sequence iterators
2160 Sequence iterators are convenience constructs for iterating
2161 through statements in a sequence. Given a sequence @code{SEQ}, here is
2162 a typical use of gimple sequence iterators:
2165 gimple_stmt_iterator gsi;
2167 for (gsi = gsi_start (seq); !gsi_end_p (gsi); gsi_next (&gsi))
2169 gimple g = gsi_stmt (gsi);
2170 /* Do something with gimple statement @code{G}. */
2174 Backward iterations are possible:
2177 for (gsi = gsi_last (seq); !gsi_end_p (gsi); gsi_prev (&gsi))
2180 Forward and backward iterations on basic blocks are possible with
2181 @code{gsi_start_bb} and @code{gsi_last_bb}.
2183 In the documentation below we sometimes refer to enum
2184 @code{gsi_iterator_update}. The valid options for this enumeration are:
2187 @item @code{GSI_NEW_STMT}
2188 Only valid when a single statement is added. Move the iterator to it.
2190 @item @code{GSI_SAME_STMT}
2191 Leave the iterator at the same statement.
2193 @item @code{GSI_CONTINUE_LINKING}
2194 Move iterator to whatever position is suitable for linking other
2195 statements in the same direction.
2198 Below is a list of the functions used to manipulate and use
2199 statement iterators.
2201 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_start (gimple_seq seq)
2202 Return a new iterator pointing to the sequence @code{SEQ}'s first
2203 statement. If @code{SEQ} is empty, the iterator's basic block is @code{NULL}.
2204 Use @code{gsi_start_bb} instead when the iterator needs to always have
2205 the correct basic block set.
2208 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_start_bb (basic_block bb)
2209 Return a new iterator pointing to the first statement in basic
2213 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_last (gimple_seq seq)
2214 Return a new iterator initially pointing to the last statement of
2215 sequence @code{SEQ}. If @code{SEQ} is empty, the iterator's basic block is
2216 @code{NULL}. Use @code{gsi_last_bb} instead when the iterator needs to always
2217 have the correct basic block set.
2220 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_last_bb (basic_block bb)
2221 Return a new iterator pointing to the last statement in basic
2225 @deftypefn {GIMPLE function} bool gsi_end_p (gimple_stmt_iterator i)
2226 Return @code{TRUE} if at the end of @code{I}.
2229 @deftypefn {GIMPLE function} bool gsi_one_before_end_p (gimple_stmt_iterator i)
2230 Return @code{TRUE} if we're one statement before the end of @code{I}.
2233 @deftypefn {GIMPLE function} void gsi_next (gimple_stmt_iterator *i)
2234 Advance the iterator to the next gimple statement.
2237 @deftypefn {GIMPLE function} void gsi_prev (gimple_stmt_iterator *i)
2238 Advance the iterator to the previous gimple statement.
2241 @deftypefn {GIMPLE function} gimple gsi_stmt (gimple_stmt_iterator i)
2242 Return the current stmt.
2245 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_after_labels (basic_block bb)
2246 Return a block statement iterator that points to the first
2247 non-label statement in block @code{BB}.
2250 @deftypefn {GIMPLE function} gimple *gsi_stmt_ptr (gimple_stmt_iterator *i)
2251 Return a pointer to the current stmt.
2254 @deftypefn {GIMPLE function} basic_block gsi_bb (gimple_stmt_iterator i)
2255 Return the basic block associated with this iterator.
2258 @deftypefn {GIMPLE function} gimple_seq gsi_seq (gimple_stmt_iterator i)
2259 Return the sequence associated with this iterator.
2262 @deftypefn {GIMPLE function} void gsi_remove (gimple_stmt_iterator *i, bool remove_eh_info)
2263 Remove the current stmt from the sequence. The iterator is
2264 updated to point to the next statement. When @code{REMOVE_EH_INFO} is
2265 true we remove the statement pointed to by iterator @code{I} from the @code{EH}
2266 tables. Otherwise we do not modify the @code{EH} tables. Generally,
2267 @code{REMOVE_EH_INFO} should be true when the statement is going to be
2268 removed from the @code{IL} and not reinserted elsewhere.
2271 @deftypefn {GIMPLE function} void gsi_link_seq_before (gimple_stmt_iterator *i, gimple_seq seq, enum gsi_iterator_update mode)
2272 Links the sequence of statements @code{SEQ} before the statement pointed
2273 by iterator @code{I}. @code{MODE} indicates what to do with the iterator
2274 after insertion (see @code{enum gsi_iterator_update} above).
2277 @deftypefn {GIMPLE function} void gsi_link_before (gimple_stmt_iterator *i, gimple g, enum gsi_iterator_update mode)
2278 Links statement @code{G} before the statement pointed-to by iterator @code{I}.
2279 Updates iterator @code{I} according to @code{MODE}.
2282 @deftypefn {GIMPLE function} void gsi_link_seq_after (gimple_stmt_iterator *i, gimple_seq seq, enum gsi_iterator_update mode)
2283 Links sequence @code{SEQ} after the statement pointed-to by iterator @code{I}.
2284 @code{MODE} is as in @code{gsi_insert_after}.
2287 @deftypefn {GIMPLE function} void gsi_link_after (gimple_stmt_iterator *i, gimple g, enum gsi_iterator_update mode)
2288 Links statement @code{G} after the statement pointed-to by iterator @code{I}.
2289 @code{MODE} is as in @code{gsi_insert_after}.
2292 @deftypefn {GIMPLE function} gimple_seq gsi_split_seq_after (gimple_stmt_iterator i)
2293 Move all statements in the sequence after @code{I} to a new sequence.
2294 Return this new sequence.
2297 @deftypefn {GIMPLE function} gimple_seq gsi_split_seq_before (gimple_stmt_iterator *i)
2298 Move all statements in the sequence before @code{I} to a new sequence.
2299 Return this new sequence.
2302 @deftypefn {GIMPLE function} void gsi_replace (gimple_stmt_iterator *i, gimple stmt, bool update_eh_info)
2303 Replace the statement pointed-to by @code{I} to @code{STMT}. If @code{UPDATE_EH_INFO}
2304 is true, the exception handling information of the original
2305 statement is moved to the new statement.
2308 @deftypefn {GIMPLE function} void gsi_insert_before (gimple_stmt_iterator *i, gimple stmt, enum gsi_iterator_update mode)
2309 Insert statement @code{STMT} before the statement pointed-to by iterator
2310 @code{I}, update @code{STMT}'s basic block and scan it for new operands. @code{MODE}
2311 specifies how to update iterator @code{I} after insertion (see enum
2312 @code{gsi_iterator_update}).
2315 @deftypefn {GIMPLE function} void gsi_insert_seq_before (gimple_stmt_iterator *i, gimple_seq seq, enum gsi_iterator_update mode)
2316 Like @code{gsi_insert_before}, but for all the statements in @code{SEQ}.
2319 @deftypefn {GIMPLE function} void gsi_insert_after (gimple_stmt_iterator *i, gimple stmt, enum gsi_iterator_update mode)
2320 Insert statement @code{STMT} after the statement pointed-to by iterator
2321 @code{I}, update @code{STMT}'s basic block and scan it for new operands. @code{MODE}
2322 specifies how to update iterator @code{I} after insertion (see enum
2323 @code{gsi_iterator_update}).
2326 @deftypefn {GIMPLE function} void gsi_insert_seq_after (gimple_stmt_iterator *i, gimple_seq seq, enum gsi_iterator_update mode)
2327 Like @code{gsi_insert_after}, but for all the statements in @code{SEQ}.
2330 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_for_stmt (gimple stmt)
2331 Finds iterator for @code{STMT}.
2334 @deftypefn {GIMPLE function} void gsi_move_after (gimple_stmt_iterator *from, gimple_stmt_iterator *to)
2335 Move the statement at @code{FROM} so it comes right after the statement
2339 @deftypefn {GIMPLE function} void gsi_move_before (gimple_stmt_iterator *from, gimple_stmt_iterator *to)
2340 Move the statement at @code{FROM} so it comes right before the statement
2344 @deftypefn {GIMPLE function} void gsi_move_to_bb_end (gimple_stmt_iterator *from, basic_block bb)
2345 Move the statement at @code{FROM} to the end of basic block @code{BB}.
2348 @deftypefn {GIMPLE function} void gsi_insert_on_edge (edge e, gimple stmt)
2349 Add @code{STMT} to the pending list of edge @code{E}. No actual insertion is
2350 made until a call to @code{gsi_commit_edge_inserts}() is made.
2353 @deftypefn {GIMPLE function} void gsi_insert_seq_on_edge (edge e, gimple_seq seq)
2354 Add the sequence of statements in @code{SEQ} to the pending list of edge
2355 @code{E}. No actual insertion is made until a call to
2356 @code{gsi_commit_edge_inserts}() is made.
2359 @deftypefn {GIMPLE function} basic_block gsi_insert_on_edge_immediate (edge e, gimple stmt)
2360 Similar to @code{gsi_insert_on_edge}+@code{gsi_commit_edge_inserts}. If a new
2361 block has to be created, it is returned.
2364 @deftypefn {GIMPLE function} void gsi_commit_one_edge_insert (edge e, basic_block *new_bb)
2365 Commit insertions pending at edge @code{E}. If a new block is created,
2366 set @code{NEW_BB} to this block, otherwise set it to @code{NULL}.
2369 @deftypefn {GIMPLE function} void gsi_commit_edge_inserts (void)
2370 This routine will commit all pending edge insertions, creating
2371 any new basic blocks which are necessary.
2375 @node Adding a new GIMPLE statement code
2376 @section Adding a new GIMPLE statement code
2377 @cindex Adding a new GIMPLE statement code
2379 The first step in adding a new GIMPLE statement code, is
2380 modifying the file @code{gimple.def}, which contains all the GIMPLE
2381 codes. Then you must add a corresponding structure, and an entry
2382 in @code{union gimple_statement_d}, both of which are located in
2383 @code{gimple.h}. This in turn, will require you to add a corresponding
2384 @code{GTY} tag in @code{gsstruct.def}, and code to handle this tag in
2385 @code{gss_for_code} which is located in @code{gimple.c}.
2387 In order for the garbage collector to know the size of the
2388 structure you created in @code{gimple.h}, you need to add a case to
2389 handle your new GIMPLE statement in @code{gimple_size} which is located
2392 You will probably want to create a function to build the new
2393 gimple statement in @code{gimple.c}. The function should be called
2394 @code{gimple_build_<@code{NEW_TUPLE_NAME}>}, and should return the new tuple
2397 If your new statement requires accessors for any members or
2398 operands it may have, put simple inline accessors in
2399 @code{gimple.h} and any non-trivial accessors in @code{gimple.c} with a
2400 corresponding prototype in @code{gimple.h}.
2403 @node Statement and operand traversals
2404 @section Statement and operand traversals
2405 @cindex Statement and operand traversals
2407 There are two functions available for walking statements and
2408 sequences: @code{walk_gimple_stmt} and @code{walk_gimple_seq},
2409 accordingly, and a third function for walking the operands in a
2410 statement: @code{walk_gimple_op}.
2412 @deftypefn {GIMPLE function} tree walk_gimple_stmt (gimple_stmt_iterator *gsi, walk_stmt_fn callback_stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi)
2413 This function is used to walk the current statement in @code{GSI},
2414 optionally using traversal state stored in @code{WI}. If @code{WI} is @code{NULL}, no
2415 state is kept during the traversal.
2417 The callback @code{CALLBACK_STMT} is called. If @code{CALLBACK_STMT} returns
2418 true, it means that the callback function has handled all the
2419 operands of the statement and it is not necessary to walk its
2422 If @code{CALLBACK_STMT} is @code{NULL} or it returns false, @code{CALLBACK_OP} is
2423 called on each operand of the statement via @code{walk_gimple_op}. If
2424 @code{walk_gimple_op} returns non-@code{NULL} for any operand, the remaining
2425 operands are not scanned.
2427 The return value is that returned by the last call to
2428 @code{walk_gimple_op}, or @code{NULL_TREE} if no @code{CALLBACK_OP} is specified.
2432 @deftypefn {GIMPLE function} tree walk_gimple_op (gimple stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi)
2433 Use this function to walk the operands of statement @code{STMT}. Every
2434 operand is walked via @code{walk_tree} with optional state information
2437 @code{CALLBACK_OP} is called on each operand of @code{STMT} via @code{walk_tree}.
2438 Additional parameters to @code{walk_tree} must be stored in @code{WI}. For
2439 each operand @code{OP}, @code{walk_tree} is called as:
2442 walk_tree (&@code{OP}, @code{CALLBACK_OP}, @code{WI}, @code{WI}- @code{PSET})
2445 If @code{CALLBACK_OP} returns non-@code{NULL} for an operand, the remaining
2446 operands are not scanned. The return value is that returned by
2447 the last call to @code{walk_tree}, or @code{NULL_TREE} if no @code{CALLBACK_OP} is
2452 @deftypefn {GIMPLE function} tree walk_gimple_seq (gimple_seq seq, walk_stmt_fn callback_stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi)
2453 This function walks all the statements in the sequence @code{SEQ}
2454 calling @code{walk_gimple_stmt} on each one. @code{WI} is as in
2455 @code{walk_gimple_stmt}. If @code{walk_gimple_stmt} returns non-@code{NULL}, the walk
2456 is stopped and the value returned. Otherwise, all the statements
2457 are walked and @code{NULL_TREE} returned.