1 @c Copyright (C) 2008-2014 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 * Class hierarchy of GIMPLE statements::
74 * GIMPLE instruction set::
75 * GIMPLE Exception Handling::
78 * Manipulating GIMPLE statements::
79 * Tuple specific accessors::
81 * Sequence iterators::
82 * Adding a new GIMPLE statement code::
83 * Statement and operand traversals::
86 @node Tuple representation
87 @section Tuple representation
90 GIMPLE instructions are tuples of variable size divided in two
91 groups: a header describing the instruction and its locations,
92 and a variable length body with all the operands. Tuples are
93 organized into a hierarchy with 3 main classes of tuples.
95 @subsection @code{gimple_statement_base} (gsbase)
96 @cindex gimple_statement_base
98 This is the root of the hierarchy, it holds basic information
99 needed by most GIMPLE statements. There are some fields that
100 may not be relevant to every GIMPLE statement, but those were
101 moved into the base structure to take advantage of holes left by
102 other fields (thus making the structure more compact). The
103 structure takes 4 words (32 bytes) on 64 bit hosts:
105 @multitable {@code{references_memory_p}} {Size (bits)}
106 @item Field @tab Size (bits)
107 @item @code{code} @tab 8
108 @item @code{subcode} @tab 16
109 @item @code{no_warning} @tab 1
110 @item @code{visited} @tab 1
111 @item @code{nontemporal_move} @tab 1
112 @item @code{plf} @tab 2
113 @item @code{modified} @tab 1
114 @item @code{has_volatile_ops} @tab 1
115 @item @code{references_memory_p} @tab 1
116 @item @code{uid} @tab 32
117 @item @code{location} @tab 32
118 @item @code{num_ops} @tab 32
119 @item @code{bb} @tab 64
120 @item @code{block} @tab 63
121 @item Total size @tab 32 bytes
126 Main identifier for a GIMPLE instruction.
129 Used to distinguish different variants of the same basic
130 instruction or provide flags applicable to a given code. The
131 @code{subcode} flags field has different uses depending on the code of
132 the instruction, but mostly it distinguishes instructions of the
133 same family. The most prominent use of this field is in
134 assignments, where subcode indicates the operation done on the
135 RHS of the assignment. For example, a = b + c is encoded as
136 @code{GIMPLE_ASSIGN <PLUS_EXPR, a, b, c>}.
138 @item @code{no_warning}
139 Bitflag to indicate whether a warning has already been issued on
143 General purpose ``visited'' marker. Set and cleared by each pass
146 @item @code{nontemporal_move}
147 Bitflag used in assignments that represent non-temporal moves.
148 Although this bitflag is only used in assignments, it was moved
149 into the base to take advantage of the bit holes left by the
153 Pass Local Flags. This 2-bit mask can be used as general purpose
154 markers by any pass. Passes are responsible for clearing and
155 setting these two flags accordingly.
157 @item @code{modified}
158 Bitflag to indicate whether the statement has been modified.
159 Used mainly by the operand scanner to determine when to re-scan a
160 statement for operands.
162 @item @code{has_volatile_ops}
163 Bitflag to indicate whether this statement contains operands that
164 have been marked volatile.
166 @item @code{references_memory_p}
167 Bitflag to indicate whether this statement contains memory
168 references (i.e., its operands are either global variables, or
169 pointer dereferences or anything that must reside in memory).
172 This is an unsigned integer used by passes that want to assign
173 IDs to every statement. These IDs must be assigned and used by
176 @item @code{location}
177 This is a @code{location_t} identifier to specify source code
178 location for this statement. It is inherited from the front
182 Number of operands that this statement has. This specifies the
183 size of the operand vector embedded in the tuple. Only used in
184 some tuples, but it is declared in the base tuple to take
185 advantage of the 32-bit hole left by the previous fields.
188 Basic block holding the instruction.
191 Lexical block holding this statement. Also used for debug
192 information generation.
195 @subsection @code{gimple_statement_with_ops}
196 @cindex gimple_statement_with_ops
198 This tuple is actually split in two:
199 @code{gimple_statement_with_ops_base} and
200 @code{gimple_statement_with_ops}. This is needed to accommodate the
201 way the operand vector is allocated. The operand vector is
202 defined to be an array of 1 element. So, to allocate a dynamic
203 number of operands, the memory allocator (@code{gimple_alloc}) simply
204 allocates enough memory to hold the structure itself plus @code{N
205 - 1} operands which run ``off the end'' of the structure. For
206 example, to allocate space for a tuple with 3 operands,
207 @code{gimple_alloc} reserves @code{sizeof (struct
208 gimple_statement_with_ops) + 2 * sizeof (tree)} bytes.
210 On the other hand, several fields in this tuple need to be shared
211 with the @code{gimple_statement_with_memory_ops} tuple. So, these
212 common fields are placed in @code{gimple_statement_with_ops_base} which
213 is then inherited from the other two tuples.
216 @multitable {@code{def_ops}} {48 + 8 * @code{num_ops} bytes}
217 @item @code{gsbase} @tab 256
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 48 + 8 * @code{num_ops} bytes
226 Inherited from @code{struct gimple_statement_base}.
229 Array of pointers into the operand array indicating all the slots that
230 contain a variable written-to by the statement. This array is
231 also used for immediate use chaining. Note that it would be
232 possible to not rely on this array, but the changes required to
233 implement this are pretty invasive.
236 Similar to @code{def_ops} but for variables read by the statement.
239 Array of trees with @code{num_ops} slots.
242 @subsection @code{gimple_statement_with_memory_ops}
244 This tuple is essentially identical to @code{gimple_statement_with_ops},
245 except that it contains 4 additional fields to hold vectors
246 related memory stores and loads. Similar to the previous case,
247 the structure is split in two to accommodate for the operand
248 vector (@code{gimple_statement_with_memory_ops_base} and
249 @code{gimple_statement_with_memory_ops}).
252 @multitable {@code{vdef_ops}} {80 + 8 * @code{num_ops} bytes}
253 @item Field @tab Size (bits)
254 @item @code{gsbase} @tab 256
255 @item @code{def_ops} @tab 64
256 @item @code{use_ops} @tab 64
257 @item @code{vdef_ops} @tab 64
258 @item @code{vuse_ops} @tab 64
259 @item @code{stores} @tab 64
260 @item @code{loads} @tab 64
261 @item @code{op} @tab @code{num_ops} * 64
262 @item Total size @tab 80 + 8 * @code{num_ops} bytes
266 @item @code{vdef_ops}
267 Similar to @code{def_ops} but for @code{VDEF} operators. There is
268 one entry per memory symbol written by this statement. This is
269 used to maintain the memory SSA use-def and def-def chains.
271 @item @code{vuse_ops}
272 Similar to @code{use_ops} but for @code{VUSE} operators. There is
273 one entry per memory symbol loaded by this statement. This is
274 used to maintain the memory SSA use-def chains.
277 Bitset with all the UIDs for the symbols written-to by the
278 statement. This is different than @code{vdef_ops} in that all the
279 affected symbols are mentioned in this set. If memory
280 partitioning is enabled, the @code{vdef_ops} vector will refer to memory
281 partitions. Furthermore, no SSA information is stored in this
285 Similar to @code{stores}, but for memory loads. (Note that there
286 is some amount of redundancy here, it should be possible to
287 reduce memory utilization further by removing these sets).
290 All the other tuples are defined in terms of these three basic
291 ones. Each tuple will add some fields.
294 @node Class hierarchy of GIMPLE statements
295 @section Class hierarchy of GIMPLE statements
296 @cindex GIMPLE class hierarchy
298 The following diagram shows the C++ inheritance hierarchy of statement
299 kinds, along with their relationships to @code{GSS_} values (layouts) and
300 @code{GIMPLE_} values (codes):
303 gimple_statement_base
305 | used for 4 codes: GIMPLE_ERROR_MARK
307 | GIMPLE_OMP_SECTIONS_SWITCH
310 + gimple_statement_with_ops_base
313 | + gimple_statement_with_ops
314 | | layout: GSS_WITH_OPS
315 | | Used for 5 codes: GIMPLE_COND
321 | + gimple_statement_with_memory_ops_base
322 | | layout: GSS_WITH_MEM_OPS_BASE
324 | + gimple_statement_with_memory_ops
325 | | layout: GSS_WITH_MEM_OPS.
326 | | used for codes GIMPLE_ASSIGN and GIMPLE_RETURN.
328 | + gimple_statement_call
329 | | layout: GSS_CALL, code: GIMPLE_CALL
331 | + gimple_statement_asm
332 | | layout: GSS_ASM, code: GIMPLE_ASM
334 | + gimple_statement_transaction
335 | layout: GSS_TRANSACTION, code: GIMPLE_TRANSACTION
337 + gimple_statement_omp
338 | | layout: GSS_OMP. Used for code GIMPLE_OMP_SECTION
340 | + gimple_statement_omp_critical
341 | | layout: GSS_OMP_CRITICAL, code: GIMPLE_OMP_CRITICAL
343 | + gimple_statement_omp_for
344 | | layout: GSS_OMP_FOR, code: GIMPLE_OMP_FOR
346 | + gimple_statement_omp_parallel_layout
347 | | | layout: GSS_OMP_PARALLEL_LAYOUT
349 | | + gimple_statement_omp_taskreg
351 | | | + gimple_statement_omp_parallel
352 | | | | code: GIMPLE_OMP_PARALLEL
354 | | | + gimple_statement_omp_task
355 | | | code: GIMPLE_OMP_TASK
357 | | + gimple_statement_omp_target
358 | | code: GIMPLE_OMP_TARGET
360 | + gimple_statement_omp_sections
361 | | layout: GSS_OMP_SECTIONS, code: GIMPLE_OMP_SECTIONS
363 | + gimple_statement_omp_single_layout
364 | | layout: GSS_OMP_SINGLE_LAYOUT
366 | + gimple_statement_omp_single
367 | | code: GIMPLE_OMP_SINGLE
369 | + gimple_statement_omp_teams
370 | code: GIMPLE_OMP_TEAMS
372 + gimple_statement_bind
373 | layout: GSS_BIND, code: GIMPLE_BIND
375 + gimple_statement_catch
376 | layout: GSS_CATCH, code: GIMPLE_CATCH
378 + gimple_statement_eh_filter
379 | layout: GSS_EH_FILTER, code: GIMPLE_EH_FILTER
381 + gimple_statement_eh_else
382 | layout: GSS_EH_ELSE, code: GIMPLE_EH_ELSE
384 + gimple_statement_eh_mnt
385 | layout: GSS_EH_MNT, code: GIMPLE_EH_MUST_NOT_THROW
387 + gimple_statement_phi
388 | layout: GSS_PHI, code: GIMPLE_PHI
390 + gimple_statement_eh_ctrl
391 | | layout: GSS_EH_CTRL
393 | + gimple_statement_resx
394 | | code: GIMPLE_RESX
396 | + gimple_statement_eh_dispatch
397 | code: GIMPLE_EH_DISPATCH
399 + gimple_statement_try
400 | layout: GSS_TRY, code: GIMPLE_TRY
402 + gimple_statement_wce
403 | layout: GSS_WCE, code: GIMPLE_WITH_CLEANUP_EXPR
405 + gimple_statement_omp_continue
406 | layout: GSS_OMP_CONTINUE, code: GIMPLE_OMP_CONTINUE
408 + gimple_statement_omp_atomic_load
409 | layout: GSS_OMP_ATOMIC_LOAD, code: GIMPLE_OMP_ATOMIC_LOAD
411 + gimple_statement_omp_atomic_store_layout
412 | layout: GSS_OMP_ATOMIC_STORE_LAYOUT,
413 | code: GIMPLE_OMP_ATOMIC_STORE
415 + gimple_statement_omp_atomic_store
416 | code: GIMPLE_OMP_ATOMIC_STORE
418 + gimple_statement_omp_return
419 code: GIMPLE_OMP_RETURN
423 @node GIMPLE instruction set
424 @section GIMPLE instruction set
425 @cindex GIMPLE instruction set
427 The following table briefly describes the GIMPLE instruction set.
429 @multitable {@code{GIMPLE_OMP_SECTIONS_SWITCH}} {High GIMPLE} {Low GIMPLE}
430 @item Instruction @tab High GIMPLE @tab Low GIMPLE
431 @item @code{GIMPLE_ASM} @tab x @tab x
432 @item @code{GIMPLE_ASSIGN} @tab x @tab x
433 @item @code{GIMPLE_BIND} @tab x @tab
434 @item @code{GIMPLE_CALL} @tab x @tab x
435 @item @code{GIMPLE_CATCH} @tab x @tab
436 @item @code{GIMPLE_COND} @tab x @tab x
437 @item @code{GIMPLE_DEBUG} @tab x @tab x
438 @item @code{GIMPLE_EH_FILTER} @tab x @tab
439 @item @code{GIMPLE_GOTO} @tab x @tab x
440 @item @code{GIMPLE_LABEL} @tab x @tab x
441 @item @code{GIMPLE_NOP} @tab x @tab x
442 @item @code{GIMPLE_OMP_ATOMIC_LOAD} @tab x @tab x
443 @item @code{GIMPLE_OMP_ATOMIC_STORE} @tab x @tab x
444 @item @code{GIMPLE_OMP_CONTINUE} @tab x @tab x
445 @item @code{GIMPLE_OMP_CRITICAL} @tab x @tab x
446 @item @code{GIMPLE_OMP_FOR} @tab x @tab x
447 @item @code{GIMPLE_OMP_MASTER} @tab x @tab x
448 @item @code{GIMPLE_OMP_ORDERED} @tab x @tab x
449 @item @code{GIMPLE_OMP_PARALLEL} @tab x @tab x
450 @item @code{GIMPLE_OMP_RETURN} @tab x @tab x
451 @item @code{GIMPLE_OMP_SECTION} @tab x @tab x
452 @item @code{GIMPLE_OMP_SECTIONS} @tab x @tab x
453 @item @code{GIMPLE_OMP_SECTIONS_SWITCH} @tab x @tab x
454 @item @code{GIMPLE_OMP_SINGLE} @tab x @tab x
455 @item @code{GIMPLE_PHI} @tab @tab x
456 @item @code{GIMPLE_RESX} @tab @tab x
457 @item @code{GIMPLE_RETURN} @tab x @tab x
458 @item @code{GIMPLE_SWITCH} @tab x @tab x
459 @item @code{GIMPLE_TRY} @tab x @tab
462 @node GIMPLE Exception Handling
463 @section Exception Handling
464 @cindex GIMPLE Exception Handling
466 Other exception handling constructs are represented using
467 @code{GIMPLE_TRY_CATCH}. @code{GIMPLE_TRY_CATCH} has two operands. The
468 first operand is a sequence of statements to execute. If executing
469 these statements does not throw an exception, then the second operand
470 is ignored. Otherwise, if an exception is thrown, then the second
471 operand of the @code{GIMPLE_TRY_CATCH} is checked. The second
472 operand may have the following forms:
476 @item A sequence of statements to execute. When an exception occurs,
477 these statements are executed, and then the exception is rethrown.
479 @item A sequence of @code{GIMPLE_CATCH} statements. Each
480 @code{GIMPLE_CATCH} has a list of applicable exception types and
481 handler code. If the thrown exception matches one of the caught
482 types, the associated handler code is executed. If the handler
483 code falls off the bottom, execution continues after the original
484 @code{GIMPLE_TRY_CATCH}.
486 @item A @code{GIMPLE_EH_FILTER} statement. This has a list of
487 permitted exception types, and code to handle a match failure. If the
488 thrown exception does not match one of the allowed types, the
489 associated match failure code is executed. If the thrown exception
490 does match, it continues unwinding the stack looking for the next
495 Currently throwing an exception is not directly represented in
496 GIMPLE, since it is implemented by calling a function. At some
497 point in the future we will want to add some way to express that
498 the call will throw an exception of a known type.
500 Just before running the optimizers, the compiler lowers the
501 high-level EH constructs above into a set of @samp{goto}s, magic
502 labels, and EH regions. Continuing to unwind at the end of a
503 cleanup is represented with a @code{GIMPLE_RESX}.
510 When gimplification encounters a subexpression that is too
511 complex, it creates a new temporary variable to hold the value of
512 the subexpression, and adds a new statement to initialize it
513 before the current statement. These special temporaries are known
514 as @samp{expression temporaries}, and are allocated using
515 @code{get_formal_tmp_var}. The compiler tries to always evaluate
516 identical expressions into the same temporary, to simplify
517 elimination of redundant calculations.
519 We can only use expression temporaries when we know that it will
520 not be reevaluated before its value is used, and that it will not
521 be otherwise modified@footnote{These restrictions are derived
522 from those in Morgan 4.8.}. Other temporaries can be allocated
523 using @code{get_initialized_tmp_var} or @code{create_tmp_var}.
525 Currently, an expression like @code{a = b + 5} is not reduced any
526 further. We tried converting it to something like
531 but this bloated the representation for minimal benefit. However, a
532 variable which must live in memory cannot appear in an expression; its
533 value is explicitly loaded into a temporary first. Similarly, storing
534 the value of an expression to a memory variable goes through a
541 In general, expressions in GIMPLE consist of an operation and the
542 appropriate number of simple operands; these operands must either be a
543 GIMPLE rvalue (@code{is_gimple_val}), i.e.@: a constant or a register
544 variable. More complex operands are factored out into temporaries, so
555 The same rule holds for arguments to a @code{GIMPLE_CALL}.
557 The target of an assignment is usually a variable, but can also be a
558 @code{MEM_REF} or a compound lvalue as described below.
561 * Compound Expressions::
563 * Conditional Expressions::
564 * Logical Operators::
567 @node Compound Expressions
568 @subsection Compound Expressions
569 @cindex Compound Expressions
571 The left-hand side of a C comma expression is simply moved into a separate
574 @node Compound Lvalues
575 @subsection Compound Lvalues
576 @cindex Compound Lvalues
578 Currently compound lvalues involving array and structure field references
579 are not broken down; an expression like @code{a.b[2] = 42} is not reduced
580 any further (though complex array subscripts are). This restriction is a
581 workaround for limitations in later optimizers; if we were to convert this
589 alias analysis would not remember that the reference to @code{T1[2]} came
590 by way of @code{a.b}, so it would think that the assignment could alias
591 another member of @code{a}; this broke @code{struct-alias-1.c}. Future
592 optimizer improvements may make this limitation unnecessary.
594 @node Conditional Expressions
595 @subsection Conditional Expressions
596 @cindex Conditional Expressions
598 A C @code{?:} expression is converted into an @code{if} statement with
599 each branch assigning to the same temporary. So,
613 The GIMPLE level if-conversion pass re-introduces @code{?:}
614 expression, if appropriate. It is used to vectorize loops with
615 conditions using vector conditional operations.
617 Note that in GIMPLE, @code{if} statements are represented using
618 @code{GIMPLE_COND}, as described below.
620 @node Logical Operators
621 @subsection Logical Operators
622 @cindex Logical Operators
624 Except when they appear in the condition operand of a
625 @code{GIMPLE_COND}, logical `and' and `or' operators are simplified
626 as follows: @code{a = b && c} becomes
635 Note that @code{T1} in this example cannot be an expression temporary,
636 because it has two different assignments.
638 @subsection Manipulating operands
640 All gimple operands are of type @code{tree}. But only certain
641 types of trees are allowed to be used as operand tuples. Basic
642 validation is controlled by the function
643 @code{get_gimple_rhs_class}, which given a tree code, returns an
644 @code{enum} with the following values of type @code{enum
648 @item @code{GIMPLE_INVALID_RHS}
649 The tree cannot be used as a GIMPLE operand.
651 @item @code{GIMPLE_TERNARY_RHS}
652 The tree is a valid GIMPLE ternary operation.
654 @item @code{GIMPLE_BINARY_RHS}
655 The tree is a valid GIMPLE binary operation.
657 @item @code{GIMPLE_UNARY_RHS}
658 The tree is a valid GIMPLE unary operation.
660 @item @code{GIMPLE_SINGLE_RHS}
661 The tree is a single object, that cannot be split into simpler
662 operands (for instance, @code{SSA_NAME}, @code{VAR_DECL}, @code{COMPONENT_REF}, etc).
664 This operand class also acts as an escape hatch for tree nodes
665 that may be flattened out into the operand vector, but would need
666 more than two slots on the RHS. For instance, a @code{COND_EXPR}
667 expression of the form @code{(a op b) ? x : y} could be flattened
668 out on the operand vector using 4 slots, but it would also
669 require additional processing to distinguish @code{c = a op b}
670 from @code{c = a op b ? x : y}. Something similar occurs with
671 @code{ASSERT_EXPR}. In time, these special case tree
672 expressions should be flattened into the operand vector.
675 For tree nodes in the categories @code{GIMPLE_TERNARY_RHS},
676 @code{GIMPLE_BINARY_RHS} and @code{GIMPLE_UNARY_RHS}, they cannot be
677 stored inside tuples directly. They first need to be flattened and
678 separated into individual components. For instance, given the GENERIC
685 its tree representation is:
688 MODIFY_EXPR <VAR_DECL <a>, PLUS_EXPR <VAR_DECL <b>, VAR_DECL <c>>>
691 In this case, the GIMPLE form for this statement is logically
692 identical to its GENERIC form but in GIMPLE, the @code{PLUS_EXPR}
693 on the RHS of the assignment is not represented as a tree,
694 instead the two operands are taken out of the @code{PLUS_EXPR} sub-tree
695 and flattened into the GIMPLE tuple as follows:
698 GIMPLE_ASSIGN <PLUS_EXPR, VAR_DECL <a>, VAR_DECL <b>, VAR_DECL <c>>
701 @subsection Operand vector allocation
703 The operand vector is stored at the bottom of the three tuple
704 structures that accept operands. This means, that depending on
705 the code of a given statement, its operand vector will be at
706 different offsets from the base of the structure. To access
707 tuple operands use the following accessors
709 @deftypefn {GIMPLE function} unsigned gimple_num_ops (gimple g)
710 Returns the number of operands in statement G.
713 @deftypefn {GIMPLE function} tree gimple_op (gimple g, unsigned i)
714 Returns operand @code{I} from statement @code{G}.
717 @deftypefn {GIMPLE function} {tree *} gimple_ops (gimple g)
718 Returns a pointer into the operand vector for statement @code{G}. This
719 is computed using an internal table called @code{gimple_ops_offset_}[].
720 This table is indexed by the gimple code of @code{G}.
722 When the compiler is built, this table is filled-in using the
723 sizes of the structures used by each statement code defined in
724 gimple.def. Since the operand vector is at the bottom of the
725 structure, for a gimple code @code{C} the offset is computed as sizeof
726 (struct-of @code{C}) - sizeof (tree).
728 This mechanism adds one memory indirection to every access when
729 using @code{gimple_op}(), if this becomes a bottleneck, a pass can
730 choose to memoize the result from @code{gimple_ops}() and use that to
734 @subsection Operand validation
736 When adding a new operand to a gimple statement, the operand will
737 be validated according to what each tuple accepts in its operand
738 vector. These predicates are called by the
739 @code{gimple_@var{name}_set_...()}. Each tuple will use one of the
740 following predicates (Note, this list is not exhaustive):
742 @deftypefn {GIMPLE function} bool is_gimple_val (tree t)
743 Returns true if t is a "GIMPLE value", which are all the
744 non-addressable stack variables (variables for which
745 @code{is_gimple_reg} returns true) and constants (expressions for which
746 @code{is_gimple_min_invariant} returns true).
749 @deftypefn {GIMPLE function} bool is_gimple_addressable (tree t)
750 Returns true if t is a symbol or memory reference whose address
754 @deftypefn {GIMPLE function} bool is_gimple_asm_val (tree t)
755 Similar to @code{is_gimple_val} but it also accepts hard registers.
758 @deftypefn {GIMPLE function} bool is_gimple_call_addr (tree t)
759 Return true if t is a valid expression to use as the function
760 called by a @code{GIMPLE_CALL}.
763 @deftypefn {GIMPLE function} bool is_gimple_mem_ref_addr (tree t)
764 Return true if t is a valid expression to use as first operand
765 of a @code{MEM_REF} expression.
768 @deftypefn {GIMPLE function} bool is_gimple_constant (tree t)
769 Return true if t is a valid gimple constant.
772 @deftypefn {GIMPLE function} bool is_gimple_min_invariant (tree t)
773 Return true if t is a valid minimal invariant. This is different
774 from constants, in that the specific value of t may not be known
775 at compile time, but it is known that it doesn't change (e.g.,
776 the address of a function local variable).
779 @deftypefn {GIMPLE function} bool is_gimple_ip_invariant (tree t)
780 Return true if t is an interprocedural invariant. This means that t
781 is a valid invariant in all functions (e.g. it can be an address of a
782 global variable but not of a local one).
785 @deftypefn {GIMPLE function} bool is_gimple_ip_invariant_address (tree t)
786 Return true if t is an @code{ADDR_EXPR} that does not change once the
787 program is running (and which is valid in all functions).
791 @subsection Statement validation
793 @deftypefn {GIMPLE function} bool is_gimple_assign (gimple g)
794 Return true if the code of g is @code{GIMPLE_ASSIGN}.
797 @deftypefn {GIMPLE function} bool is_gimple_call (gimple g)
798 Return true if the code of g is @code{GIMPLE_CALL}.
801 @deftypefn {GIMPLE function} bool is_gimple_debug (gimple g)
802 Return true if the code of g is @code{GIMPLE_DEBUG}.
805 @deftypefn {GIMPLE function} bool gimple_assign_cast_p (const_gimple g)
806 Return true if g is a @code{GIMPLE_ASSIGN} that performs a type cast
810 @deftypefn {GIMPLE function} bool gimple_debug_bind_p (gimple g)
811 Return true if g is a @code{GIMPLE_DEBUG} that binds the value of an
812 expression to a variable.
815 @deftypefn {GIMPLE function} bool is_gimple_omp (gimple g)
816 Return true if g is any of the OpenMP codes.
819 @node Manipulating GIMPLE statements
820 @section Manipulating GIMPLE statements
821 @cindex Manipulating GIMPLE statements
823 This section documents all the functions available to handle each
824 of the GIMPLE instructions.
826 @subsection Common accessors
827 The following are common accessors for gimple statements.
829 @deftypefn {GIMPLE function} {enum gimple_code} gimple_code (gimple g)
830 Return the code for statement @code{G}.
833 @deftypefn {GIMPLE function} basic_block gimple_bb (gimple g)
834 Return the basic block to which statement @code{G} belongs to.
837 @deftypefn {GIMPLE function} tree gimple_block (gimple g)
838 Return the lexical scope block holding statement @code{G}.
841 @deftypefn {GIMPLE function} tree gimple_expr_type (gimple stmt)
842 Return the type of the main expression computed by @code{STMT}. Return
843 @code{void_type_node} if @code{STMT} computes nothing. This will only return
844 something meaningful for @code{GIMPLE_ASSIGN}, @code{GIMPLE_COND} and
845 @code{GIMPLE_CALL}. For all other tuple codes, it will return
846 @code{void_type_node}.
849 @deftypefn {GIMPLE function} {enum tree_code} gimple_expr_code (gimple stmt)
850 Return the tree code for the expression computed by @code{STMT}. This
851 is only meaningful for @code{GIMPLE_CALL}, @code{GIMPLE_ASSIGN} and
852 @code{GIMPLE_COND}. If @code{STMT} is @code{GIMPLE_CALL}, it will return @code{CALL_EXPR}.
853 For @code{GIMPLE_COND}, it returns the code of the comparison predicate.
854 For @code{GIMPLE_ASSIGN} it returns the code of the operation performed
855 by the @code{RHS} of the assignment.
858 @deftypefn {GIMPLE function} void gimple_set_block (gimple g, tree block)
859 Set the lexical scope block of @code{G} to @code{BLOCK}.
862 @deftypefn {GIMPLE function} location_t gimple_locus (gimple g)
863 Return locus information for statement @code{G}.
866 @deftypefn {GIMPLE function} void gimple_set_locus (gimple g, location_t locus)
867 Set locus information for statement @code{G}.
870 @deftypefn {GIMPLE function} bool gimple_locus_empty_p (gimple g)
871 Return true if @code{G} does not have locus information.
874 @deftypefn {GIMPLE function} bool gimple_no_warning_p (gimple stmt)
875 Return true if no warnings should be emitted for statement @code{STMT}.
878 @deftypefn {GIMPLE function} void gimple_set_visited (gimple stmt, bool visited_p)
879 Set the visited status on statement @code{STMT} to @code{VISITED_P}.
882 @deftypefn {GIMPLE function} bool gimple_visited_p (gimple stmt)
883 Return the visited status on statement @code{STMT}.
886 @deftypefn {GIMPLE function} void gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
887 Set pass local flag @code{PLF} on statement @code{STMT} to @code{VAL_P}.
890 @deftypefn {GIMPLE function} {unsigned int} gimple_plf (gimple stmt, enum plf_mask plf)
891 Return the value of pass local flag @code{PLF} on statement @code{STMT}.
894 @deftypefn {GIMPLE function} bool gimple_has_ops (gimple g)
895 Return true if statement @code{G} has register or memory operands.
898 @deftypefn {GIMPLE function} bool gimple_has_mem_ops (gimple g)
899 Return true if statement @code{G} has memory operands.
902 @deftypefn {GIMPLE function} unsigned gimple_num_ops (gimple g)
903 Return the number of operands for statement @code{G}.
906 @deftypefn {GIMPLE function} {tree *} gimple_ops (gimple g)
907 Return the array of operands for statement @code{G}.
910 @deftypefn {GIMPLE function} tree gimple_op (gimple g, unsigned i)
911 Return operand @code{I} for statement @code{G}.
914 @deftypefn {GIMPLE function} {tree *} gimple_op_ptr (gimple g, unsigned i)
915 Return a pointer to operand @code{I} for statement @code{G}.
918 @deftypefn {GIMPLE function} void gimple_set_op (gimple g, unsigned i, tree op)
919 Set operand @code{I} of statement @code{G} to @code{OP}.
922 @deftypefn {GIMPLE function} bitmap gimple_addresses_taken (gimple stmt)
923 Return the set of symbols that have had their address taken by
927 @deftypefn {GIMPLE function} {struct def_optype_d *} gimple_def_ops (gimple g)
928 Return the set of @code{DEF} operands for statement @code{G}.
931 @deftypefn {GIMPLE function} void gimple_set_def_ops (gimple g, struct def_optype_d *def)
932 Set @code{DEF} to be the set of @code{DEF} operands for statement @code{G}.
935 @deftypefn {GIMPLE function} {struct use_optype_d *} gimple_use_ops (gimple g)
936 Return the set of @code{USE} operands for statement @code{G}.
939 @deftypefn {GIMPLE function} void gimple_set_use_ops (gimple g, struct use_optype_d *use)
940 Set @code{USE} to be the set of @code{USE} operands for statement @code{G}.
943 @deftypefn {GIMPLE function} {struct voptype_d *} gimple_vuse_ops (gimple g)
944 Return the set of @code{VUSE} operands for statement @code{G}.
947 @deftypefn {GIMPLE function} void gimple_set_vuse_ops (gimple g, struct voptype_d *ops)
948 Set @code{OPS} to be the set of @code{VUSE} operands for statement @code{G}.
951 @deftypefn {GIMPLE function} {struct voptype_d *} gimple_vdef_ops (gimple g)
952 Return the set of @code{VDEF} operands for statement @code{G}.
955 @deftypefn {GIMPLE function} void gimple_set_vdef_ops (gimple g, struct voptype_d *ops)
956 Set @code{OPS} to be the set of @code{VDEF} operands for statement @code{G}.
959 @deftypefn {GIMPLE function} bitmap gimple_loaded_syms (gimple g)
960 Return the set of symbols loaded by statement @code{G}. Each element of
961 the set is the @code{DECL_UID} of the corresponding symbol.
964 @deftypefn {GIMPLE function} bitmap gimple_stored_syms (gimple g)
965 Return the set of symbols stored by statement @code{G}. Each element of
966 the set is the @code{DECL_UID} of the corresponding symbol.
969 @deftypefn {GIMPLE function} bool gimple_modified_p (gimple g)
970 Return true if statement @code{G} has operands and the modified field
974 @deftypefn {GIMPLE function} bool gimple_has_volatile_ops (gimple stmt)
975 Return true if statement @code{STMT} contains volatile operands.
978 @deftypefn {GIMPLE function} void gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
979 Return true if statement @code{STMT} contains volatile operands.
982 @deftypefn {GIMPLE function} void update_stmt (gimple s)
983 Mark statement @code{S} as modified, and update it.
986 @deftypefn {GIMPLE function} void update_stmt_if_modified (gimple s)
987 Update statement @code{S} if it has been marked modified.
990 @deftypefn {GIMPLE function} gimple gimple_copy (gimple stmt)
991 Return a deep copy of statement @code{STMT}.
994 @node Tuple specific accessors
995 @section Tuple specific accessors
996 @cindex Tuple specific accessors
999 * @code{GIMPLE_ASM}::
1000 * @code{GIMPLE_ASSIGN}::
1001 * @code{GIMPLE_BIND}::
1002 * @code{GIMPLE_CALL}::
1003 * @code{GIMPLE_CATCH}::
1004 * @code{GIMPLE_COND}::
1005 * @code{GIMPLE_DEBUG}::
1006 * @code{GIMPLE_EH_FILTER}::
1007 * @code{GIMPLE_LABEL}::
1008 * @code{GIMPLE_NOP}::
1009 * @code{GIMPLE_OMP_ATOMIC_LOAD}::
1010 * @code{GIMPLE_OMP_ATOMIC_STORE}::
1011 * @code{GIMPLE_OMP_CONTINUE}::
1012 * @code{GIMPLE_OMP_CRITICAL}::
1013 * @code{GIMPLE_OMP_FOR}::
1014 * @code{GIMPLE_OMP_MASTER}::
1015 * @code{GIMPLE_OMP_ORDERED}::
1016 * @code{GIMPLE_OMP_PARALLEL}::
1017 * @code{GIMPLE_OMP_RETURN}::
1018 * @code{GIMPLE_OMP_SECTION}::
1019 * @code{GIMPLE_OMP_SECTIONS}::
1020 * @code{GIMPLE_OMP_SINGLE}::
1021 * @code{GIMPLE_PHI}::
1022 * @code{GIMPLE_RESX}::
1023 * @code{GIMPLE_RETURN}::
1024 * @code{GIMPLE_SWITCH}::
1025 * @code{GIMPLE_TRY}::
1026 * @code{GIMPLE_WITH_CLEANUP_EXPR}::
1030 @node @code{GIMPLE_ASM}
1031 @subsection @code{GIMPLE_ASM}
1032 @cindex @code{GIMPLE_ASM}
1034 @deftypefn {GIMPLE function} gimple gimple_build_asm (const char *string, ninputs, noutputs, nclobbers, ...)
1035 Build a @code{GIMPLE_ASM} statement. This statement is used for
1036 building in-line assembly constructs. @code{STRING} is the assembly
1037 code. @code{NINPUT} is the number of register inputs. @code{NOUTPUT} is the
1038 number of register outputs. @code{NCLOBBERS} is the number of clobbered
1039 registers. The rest of the arguments trees for each input,
1040 output, and clobbered registers.
1043 @deftypefn {GIMPLE function} gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *, VEC(tree,gc) *)
1044 Identical to gimple_build_asm, but the arguments are passed in
1048 @deftypefn {GIMPLE function} unsigned gimple_asm_ninputs (gimple g)
1049 Return the number of input operands for @code{GIMPLE_ASM} @code{G}.
1052 @deftypefn {GIMPLE function} unsigned gimple_asm_noutputs (gimple g)
1053 Return the number of output operands for @code{GIMPLE_ASM} @code{G}.
1056 @deftypefn {GIMPLE function} unsigned gimple_asm_nclobbers (gimple g)
1057 Return the number of clobber operands for @code{GIMPLE_ASM} @code{G}.
1060 @deftypefn {GIMPLE function} tree gimple_asm_input_op (gimple g, unsigned index)
1061 Return input operand @code{INDEX} of @code{GIMPLE_ASM} @code{G}.
1064 @deftypefn {GIMPLE function} void gimple_asm_set_input_op (gimple g, unsigned index, tree in_op)
1065 Set @code{IN_OP} to be input operand @code{INDEX} in @code{GIMPLE_ASM} @code{G}.
1068 @deftypefn {GIMPLE function} tree gimple_asm_output_op (gimple g, unsigned index)
1069 Return output operand @code{INDEX} of @code{GIMPLE_ASM} @code{G}.
1072 @deftypefn {GIMPLE function} void gimple_asm_set_output_op (gimple g, @
1073 unsigned index, tree out_op)
1074 Set @code{OUT_OP} to be output operand @code{INDEX} in @code{GIMPLE_ASM} @code{G}.
1077 @deftypefn {GIMPLE function} tree gimple_asm_clobber_op (gimple g, unsigned index)
1078 Return clobber operand @code{INDEX} of @code{GIMPLE_ASM} @code{G}.
1081 @deftypefn {GIMPLE function} void gimple_asm_set_clobber_op (gimple g, unsigned index, tree clobber_op)
1082 Set @code{CLOBBER_OP} to be clobber operand @code{INDEX} in @code{GIMPLE_ASM} @code{G}.
1085 @deftypefn {GIMPLE function} {const char *} gimple_asm_string (gimple g)
1086 Return the string representing the assembly instruction in
1087 @code{GIMPLE_ASM} @code{G}.
1090 @deftypefn {GIMPLE function} bool gimple_asm_volatile_p (gimple g)
1091 Return true if @code{G} is an asm statement marked volatile.
1094 @deftypefn {GIMPLE function} void gimple_asm_set_volatile (gimple g)
1095 Mark asm statement @code{G} as volatile.
1098 @node @code{GIMPLE_ASSIGN}
1099 @subsection @code{GIMPLE_ASSIGN}
1100 @cindex @code{GIMPLE_ASSIGN}
1102 @deftypefn {GIMPLE function} gimple gimple_build_assign (tree lhs, tree rhs)
1103 Build a @code{GIMPLE_ASSIGN} statement. The left-hand side is an lvalue
1104 passed in lhs. The right-hand side can be either a unary or
1105 binary tree expression. The expression tree rhs will be
1106 flattened and its operands assigned to the corresponding operand
1107 slots in the new statement. This function is useful when you
1108 already have a tree expression that you want to convert into a
1109 tuple. However, try to avoid building expression trees for the
1110 sole purpose of calling this function. If you already have the
1111 operands in separate trees, it is better to use
1112 @code{gimple_build_assign_with_ops}.
1116 @deftypefn {GIMPLE function} gimple gimplify_assign (tree dst, tree src, gimple_seq *seq_p)
1117 Build a new @code{GIMPLE_ASSIGN} tuple and append it to the end of
1121 @code{DST}/@code{SRC} are the destination and source respectively. You can
1122 pass ungimplified trees in @code{DST} or @code{SRC}, in which
1123 case they will be converted to a gimple operand if necessary.
1125 This function returns the newly created @code{GIMPLE_ASSIGN} tuple.
1127 @deftypefn {GIMPLE function} gimple gimple_build_assign_with_ops @
1128 (enum tree_code subcode, tree lhs, tree op1, tree op2)
1129 This function is similar to @code{gimple_build_assign}, but is used to
1130 build a @code{GIMPLE_ASSIGN} statement when the operands of the
1131 right-hand side of the assignment are already split into
1134 The left-hand side is an lvalue passed in lhs. Subcode is the
1135 @code{tree_code} for the right-hand side of the assignment. Op1 and op2
1136 are the operands. If op2 is null, subcode must be a @code{tree_code}
1137 for a unary expression.
1140 @deftypefn {GIMPLE function} {enum tree_code} gimple_assign_rhs_code (gimple g)
1141 Return the code of the expression computed on the @code{RHS} of
1142 assignment statement @code{G}.
1146 @deftypefn {GIMPLE function} {enum gimple_rhs_class} gimple_assign_rhs_class (gimple g)
1147 Return the gimple rhs class of the code for the expression
1148 computed on the rhs of assignment statement @code{G}. This will never
1149 return @code{GIMPLE_INVALID_RHS}.
1152 @deftypefn {GIMPLE function} tree gimple_assign_lhs (gimple g)
1153 Return the @code{LHS} of assignment statement @code{G}.
1156 @deftypefn {GIMPLE function} {tree *} gimple_assign_lhs_ptr (gimple g)
1157 Return a pointer to the @code{LHS} of assignment statement @code{G}.
1160 @deftypefn {GIMPLE function} tree gimple_assign_rhs1 (gimple g)
1161 Return the first operand on the @code{RHS} of assignment statement @code{G}.
1164 @deftypefn {GIMPLE function} {tree *} gimple_assign_rhs1_ptr (gimple g)
1165 Return the address of the first operand on the @code{RHS} of assignment
1169 @deftypefn {GIMPLE function} tree gimple_assign_rhs2 (gimple g)
1170 Return the second operand on the @code{RHS} of assignment statement @code{G}.
1173 @deftypefn {GIMPLE function} {tree *} gimple_assign_rhs2_ptr (gimple g)
1174 Return the address of the second operand on the @code{RHS} of assignment
1178 @deftypefn {GIMPLE function} tree gimple_assign_rhs3 (gimple g)
1179 Return the third operand on the @code{RHS} of assignment statement @code{G}.
1182 @deftypefn {GIMPLE function} {tree *} gimple_assign_rhs3_ptr (gimple g)
1183 Return the address of the third operand on the @code{RHS} of assignment
1187 @deftypefn {GIMPLE function} void gimple_assign_set_lhs (gimple g, tree lhs)
1188 Set @code{LHS} to be the @code{LHS} operand of assignment statement @code{G}.
1191 @deftypefn {GIMPLE function} void gimple_assign_set_rhs1 (gimple g, tree rhs)
1192 Set @code{RHS} to be the first operand on the @code{RHS} of assignment
1196 @deftypefn {GIMPLE function} void gimple_assign_set_rhs2 (gimple g, tree rhs)
1197 Set @code{RHS} to be the second operand on the @code{RHS} of assignment
1201 @deftypefn {GIMPLE function} void gimple_assign_set_rhs3 (gimple g, tree rhs)
1202 Set @code{RHS} to be the third operand on the @code{RHS} of assignment
1206 @deftypefn {GIMPLE function} bool gimple_assign_cast_p (const_gimple s)
1207 Return true if @code{S} is a type-cast assignment.
1211 @node @code{GIMPLE_BIND}
1212 @subsection @code{GIMPLE_BIND}
1213 @cindex @code{GIMPLE_BIND}
1215 @deftypefn {GIMPLE function} gimple gimple_build_bind (tree vars, gimple_seq body)
1216 Build a @code{GIMPLE_BIND} statement with a list of variables in @code{VARS}
1217 and a body of statements in sequence @code{BODY}.
1220 @deftypefn {GIMPLE function} tree gimple_bind_vars (gimple g)
1221 Return the variables declared in the @code{GIMPLE_BIND} statement @code{G}.
1224 @deftypefn {GIMPLE function} void gimple_bind_set_vars (gimple g, tree vars)
1225 Set @code{VARS} to be the set of variables declared in the @code{GIMPLE_BIND}
1229 @deftypefn {GIMPLE function} void gimple_bind_append_vars (gimple g, tree vars)
1230 Append @code{VARS} to the set of variables declared in the @code{GIMPLE_BIND}
1234 @deftypefn {GIMPLE function} gimple_seq gimple_bind_body (gimple g)
1235 Return the GIMPLE sequence contained in the @code{GIMPLE_BIND} statement
1239 @deftypefn {GIMPLE function} void gimple_bind_set_body (gimple g, gimple_seq seq)
1240 Set @code{SEQ} to be sequence contained in the @code{GIMPLE_BIND} statement @code{G}.
1243 @deftypefn {GIMPLE function} void gimple_bind_add_stmt (gimple gs, gimple stmt)
1244 Append a statement to the end of a @code{GIMPLE_BIND}'s body.
1247 @deftypefn {GIMPLE function} void gimple_bind_add_seq (gimple gs, gimple_seq seq)
1248 Append a sequence of statements to the end of a @code{GIMPLE_BIND}'s
1252 @deftypefn {GIMPLE function} tree gimple_bind_block (gimple g)
1253 Return the @code{TREE_BLOCK} node associated with @code{GIMPLE_BIND} statement
1254 @code{G}. This is analogous to the @code{BIND_EXPR_BLOCK} field in trees.
1257 @deftypefn {GIMPLE function} void gimple_bind_set_block (gimple g, tree block)
1258 Set @code{BLOCK} to be the @code{TREE_BLOCK} node associated with @code{GIMPLE_BIND}
1263 @node @code{GIMPLE_CALL}
1264 @subsection @code{GIMPLE_CALL}
1265 @cindex @code{GIMPLE_CALL}
1267 @deftypefn {GIMPLE function} gimple gimple_build_call (tree fn, unsigned nargs, ...)
1268 Build a @code{GIMPLE_CALL} statement to function @code{FN}. The argument @code{FN}
1269 must be either a @code{FUNCTION_DECL} or a gimple call address as
1270 determined by @code{is_gimple_call_addr}. @code{NARGS} are the number of
1271 arguments. The rest of the arguments follow the argument @code{NARGS},
1272 and must be trees that are valid as rvalues in gimple (i.e., each
1273 operand is validated with @code{is_gimple_operand}).
1277 @deftypefn {GIMPLE function} gimple gimple_build_call_from_tree (tree call_expr)
1278 Build a @code{GIMPLE_CALL} from a @code{CALL_EXPR} node. The arguments and the
1279 function are taken from the expression directly. This routine
1280 assumes that @code{call_expr} is already in GIMPLE form. That is, its
1281 operands are GIMPLE values and the function call needs no further
1282 simplification. All the call flags in @code{call_expr} are copied over
1283 to the new @code{GIMPLE_CALL}.
1286 @deftypefn {GIMPLE function} gimple gimple_build_call_vec (tree fn, @code{VEC}(tree, heap) *args)
1287 Identical to @code{gimple_build_call} but the arguments are stored in a
1291 @deftypefn {GIMPLE function} tree gimple_call_lhs (gimple g)
1292 Return the @code{LHS} of call statement @code{G}.
1295 @deftypefn {GIMPLE function} {tree *} gimple_call_lhs_ptr (gimple g)
1296 Return a pointer to the @code{LHS} of call statement @code{G}.
1299 @deftypefn {GIMPLE function} void gimple_call_set_lhs (gimple g, tree lhs)
1300 Set @code{LHS} to be the @code{LHS} operand of call statement @code{G}.
1303 @deftypefn {GIMPLE function} tree gimple_call_fn (gimple g)
1304 Return the tree node representing the function called by call
1308 @deftypefn {GIMPLE function} void gimple_call_set_fn (gimple g, tree fn)
1309 Set @code{FN} to be the function called by call statement @code{G}. This has
1310 to be a gimple value specifying the address of the called
1314 @deftypefn {GIMPLE function} tree gimple_call_fndecl (gimple g)
1315 If a given @code{GIMPLE_CALL}'s callee is a @code{FUNCTION_DECL}, return it.
1316 Otherwise return @code{NULL}. This function is analogous to
1317 @code{get_callee_fndecl} in @code{GENERIC}.
1320 @deftypefn {GIMPLE function} tree gimple_call_set_fndecl (gimple g, tree fndecl)
1321 Set the called function to @code{FNDECL}.
1324 @deftypefn {GIMPLE function} tree gimple_call_return_type (gimple g)
1325 Return the type returned by call statement @code{G}.
1328 @deftypefn {GIMPLE function} tree gimple_call_chain (gimple g)
1329 Return the static chain for call statement @code{G}.
1332 @deftypefn {GIMPLE function} void gimple_call_set_chain (gimple g, tree chain)
1333 Set @code{CHAIN} to be the static chain for call statement @code{G}.
1336 @deftypefn {GIMPLE function} unsigned gimple_call_num_args (gimple g)
1337 Return the number of arguments used by call statement @code{G}.
1340 @deftypefn {GIMPLE function} tree gimple_call_arg (gimple g, unsigned index)
1341 Return the argument at position @code{INDEX} for call statement @code{G}. The
1342 first argument is 0.
1345 @deftypefn {GIMPLE function} {tree *} gimple_call_arg_ptr (gimple g, unsigned index)
1346 Return a pointer to the argument at position @code{INDEX} for call
1350 @deftypefn {GIMPLE function} void gimple_call_set_arg (gimple g, unsigned index, tree arg)
1351 Set @code{ARG} to be the argument at position @code{INDEX} for call statement
1355 @deftypefn {GIMPLE function} void gimple_call_set_tail (gimple s)
1356 Mark call statement @code{S} as being a tail call (i.e., a call just
1357 before the exit of a function). These calls are candidate for
1358 tail call optimization.
1361 @deftypefn {GIMPLE function} bool gimple_call_tail_p (gimple s)
1362 Return true if @code{GIMPLE_CALL} @code{S} is marked as a tail call.
1365 @deftypefn {GIMPLE function} void gimple_call_mark_uninlinable (gimple s)
1366 Mark @code{GIMPLE_CALL} @code{S} as being uninlinable.
1369 @deftypefn {GIMPLE function} bool gimple_call_cannot_inline_p (gimple s)
1370 Return true if @code{GIMPLE_CALL} @code{S} cannot be inlined.
1373 @deftypefn {GIMPLE function} bool gimple_call_noreturn_p (gimple s)
1374 Return true if @code{S} is a noreturn call.
1377 @deftypefn {GIMPLE function} gimple gimple_call_copy_skip_args (gimple stmt, bitmap args_to_skip)
1378 Build a @code{GIMPLE_CALL} identical to @code{STMT} but skipping the arguments
1379 in the positions marked by the set @code{ARGS_TO_SKIP}.
1383 @node @code{GIMPLE_CATCH}
1384 @subsection @code{GIMPLE_CATCH}
1385 @cindex @code{GIMPLE_CATCH}
1387 @deftypefn {GIMPLE function} gimple gimple_build_catch (tree types, gimple_seq handler)
1388 Build a @code{GIMPLE_CATCH} statement. @code{TYPES} are the tree types this
1389 catch handles. @code{HANDLER} is a sequence of statements with the code
1393 @deftypefn {GIMPLE function} tree gimple_catch_types (gimple g)
1394 Return the types handled by @code{GIMPLE_CATCH} statement @code{G}.
1397 @deftypefn {GIMPLE function} {tree *} gimple_catch_types_ptr (gimple g)
1398 Return a pointer to the types handled by @code{GIMPLE_CATCH} statement
1402 @deftypefn {GIMPLE function} gimple_seq gimple_catch_handler (gimple g)
1403 Return the GIMPLE sequence representing the body of the handler
1404 of @code{GIMPLE_CATCH} statement @code{G}.
1407 @deftypefn {GIMPLE function} void gimple_catch_set_types (gimple g, tree t)
1408 Set @code{T} to be the set of types handled by @code{GIMPLE_CATCH} @code{G}.
1411 @deftypefn {GIMPLE function} void gimple_catch_set_handler (gimple g, gimple_seq handler)
1412 Set @code{HANDLER} to be the body of @code{GIMPLE_CATCH} @code{G}.
1416 @node @code{GIMPLE_COND}
1417 @subsection @code{GIMPLE_COND}
1418 @cindex @code{GIMPLE_COND}
1420 @deftypefn {GIMPLE function} gimple gimple_build_cond (enum tree_code pred_code, tree lhs, tree rhs, tree t_label, tree f_label)
1421 Build a @code{GIMPLE_COND} statement. @code{A} @code{GIMPLE_COND} statement compares
1422 @code{LHS} and @code{RHS} and if the condition in @code{PRED_CODE} is true, jump to
1423 the label in @code{t_label}, otherwise jump to the label in @code{f_label}.
1424 @code{PRED_CODE} are relational operator tree codes like @code{EQ_EXPR},
1425 @code{LT_EXPR}, @code{LE_EXPR}, @code{NE_EXPR}, etc.
1429 @deftypefn {GIMPLE function} gimple gimple_build_cond_from_tree (tree cond, tree t_label, tree f_label)
1430 Build a @code{GIMPLE_COND} statement from the conditional expression
1431 tree @code{COND}. @code{T_LABEL} and @code{F_LABEL} are as in @code{gimple_build_cond}.
1434 @deftypefn {GIMPLE function} {enum tree_code} gimple_cond_code (gimple g)
1435 Return the code of the predicate computed by conditional
1439 @deftypefn {GIMPLE function} void gimple_cond_set_code (gimple g, enum tree_code code)
1440 Set @code{CODE} to be the predicate code for the conditional statement
1444 @deftypefn {GIMPLE function} tree gimple_cond_lhs (gimple g)
1445 Return the @code{LHS} of the predicate computed by conditional statement
1449 @deftypefn {GIMPLE function} void gimple_cond_set_lhs (gimple g, tree lhs)
1450 Set @code{LHS} to be the @code{LHS} operand of the predicate computed by
1451 conditional statement @code{G}.
1454 @deftypefn {GIMPLE function} tree gimple_cond_rhs (gimple g)
1455 Return the @code{RHS} operand of the predicate computed by conditional
1459 @deftypefn {GIMPLE function} void gimple_cond_set_rhs (gimple g, tree rhs)
1460 Set @code{RHS} to be the @code{RHS} operand of the predicate computed by
1461 conditional statement @code{G}.
1464 @deftypefn {GIMPLE function} tree gimple_cond_true_label (gimple g)
1465 Return the label used by conditional statement @code{G} when its
1466 predicate evaluates to true.
1469 @deftypefn {GIMPLE function} void gimple_cond_set_true_label (gimple g, tree label)
1470 Set @code{LABEL} to be the label used by conditional statement @code{G} when
1471 its predicate evaluates to true.
1474 @deftypefn {GIMPLE function} void gimple_cond_set_false_label (gimple g, tree label)
1475 Set @code{LABEL} to be the label used by conditional statement @code{G} when
1476 its predicate evaluates to false.
1479 @deftypefn {GIMPLE function} tree gimple_cond_false_label (gimple g)
1480 Return the label used by conditional statement @code{G} when its
1481 predicate evaluates to false.
1484 @deftypefn {GIMPLE function} void gimple_cond_make_false (gimple g)
1485 Set the conditional @code{COND_STMT} to be of the form 'if (1 == 0)'.
1488 @deftypefn {GIMPLE function} void gimple_cond_make_true (gimple g)
1489 Set the conditional @code{COND_STMT} to be of the form 'if (1 == 1)'.
1492 @node @code{GIMPLE_DEBUG}
1493 @subsection @code{GIMPLE_DEBUG}
1494 @cindex @code{GIMPLE_DEBUG}
1495 @cindex @code{GIMPLE_DEBUG_BIND}
1497 @deftypefn {GIMPLE function} gimple gimple_build_debug_bind (tree var, tree value, gimple stmt)
1498 Build a @code{GIMPLE_DEBUG} statement with @code{GIMPLE_DEBUG_BIND} of
1499 @code{subcode}. The effect of this statement is to tell debug
1500 information generation machinery that the value of user variable
1501 @code{var} is given by @code{value} at that point, and to remain with
1502 that value until @code{var} runs out of scope, a
1503 dynamically-subsequent debug bind statement overrides the binding, or
1504 conflicting values reach a control flow merge point. Even if
1505 components of the @code{value} expression change afterwards, the
1506 variable is supposed to retain the same value, though not necessarily
1509 It is expected that @code{var} be most often a tree for automatic user
1510 variables (@code{VAR_DECL} or @code{PARM_DECL}) that satisfy the
1511 requirements for gimple registers, but it may also be a tree for a
1512 scalarized component of a user variable (@code{ARRAY_REF},
1513 @code{COMPONENT_REF}), or a debug temporary (@code{DEBUG_EXPR_DECL}).
1515 As for @code{value}, it can be an arbitrary tree expression, but it is
1516 recommended that it be in a suitable form for a gimple assignment
1517 @code{RHS}. It is not expected that user variables that could appear
1518 as @code{var} ever appear in @code{value}, because in the latter we'd
1519 have their @code{SSA_NAME}s instead, but even if they were not in SSA
1520 form, user variables appearing in @code{value} are to be regarded as
1521 part of the executable code space, whereas those in @code{var} are to
1522 be regarded as part of the source code space. There is no way to
1523 refer to the value bound to a user variable within a @code{value}
1526 If @code{value} is @code{GIMPLE_DEBUG_BIND_NOVALUE}, debug information
1527 generation machinery is informed that the variable @code{var} is
1528 unbound, i.e., that its value is indeterminate, which sometimes means
1529 it is really unavailable, and other times that the compiler could not
1532 Block and location information for the newly-created stmt are
1533 taken from @code{stmt}, if given.
1536 @deftypefn {GIMPLE function} tree gimple_debug_bind_get_var (gimple stmt)
1537 Return the user variable @var{var} that is bound at @code{stmt}.
1540 @deftypefn {GIMPLE function} tree gimple_debug_bind_get_value (gimple stmt)
1541 Return the value expression that is bound to a user variable at
1545 @deftypefn {GIMPLE function} {tree *} gimple_debug_bind_get_value_ptr (gimple stmt)
1546 Return a pointer to the value expression that is bound to a user
1547 variable at @code{stmt}.
1550 @deftypefn {GIMPLE function} void gimple_debug_bind_set_var (gimple stmt, tree var)
1551 Modify the user variable bound at @code{stmt} to @var{var}.
1554 @deftypefn {GIMPLE function} void gimple_debug_bind_set_value (gimple stmt, tree var)
1555 Modify the value bound to the user variable bound at @code{stmt} to
1559 @deftypefn {GIMPLE function} void gimple_debug_bind_reset_value (gimple stmt)
1560 Modify the value bound to the user variable bound at @code{stmt} so
1561 that the variable becomes unbound.
1564 @deftypefn {GIMPLE function} bool gimple_debug_bind_has_value_p (gimple stmt)
1565 Return @code{TRUE} if @code{stmt} binds a user variable to a value,
1566 and @code{FALSE} if it unbinds the variable.
1569 @node @code{GIMPLE_EH_FILTER}
1570 @subsection @code{GIMPLE_EH_FILTER}
1571 @cindex @code{GIMPLE_EH_FILTER}
1573 @deftypefn {GIMPLE function} gimple gimple_build_eh_filter (tree types, gimple_seq failure)
1574 Build a @code{GIMPLE_EH_FILTER} statement. @code{TYPES} are the filter's
1575 types. @code{FAILURE} is a sequence with the filter's failure action.
1578 @deftypefn {GIMPLE function} tree gimple_eh_filter_types (gimple g)
1579 Return the types handled by @code{GIMPLE_EH_FILTER} statement @code{G}.
1582 @deftypefn {GIMPLE function} {tree *} gimple_eh_filter_types_ptr (gimple g)
1583 Return a pointer to the types handled by @code{GIMPLE_EH_FILTER}
1587 @deftypefn {GIMPLE function} gimple_seq gimple_eh_filter_failure (gimple g)
1588 Return the sequence of statement to execute when @code{GIMPLE_EH_FILTER}
1592 @deftypefn {GIMPLE function} void gimple_eh_filter_set_types (gimple g, tree types)
1593 Set @code{TYPES} to be the set of types handled by @code{GIMPLE_EH_FILTER} @code{G}.
1596 @deftypefn {GIMPLE function} void gimple_eh_filter_set_failure (gimple g, gimple_seq failure)
1597 Set @code{FAILURE} to be the sequence of statements to execute on
1598 failure for @code{GIMPLE_EH_FILTER} @code{G}.
1601 @deftypefn {GIMPLE function} bool gimple_eh_filter_must_not_throw (gimple g)
1602 Return the @code{EH_FILTER_MUST_NOT_THROW} flag.
1605 @deftypefn {GIMPLE function} void gimple_eh_filter_set_must_not_throw (gimple g, bool mntp)
1606 Set the @code{EH_FILTER_MUST_NOT_THROW} flag.
1610 @node @code{GIMPLE_LABEL}
1611 @subsection @code{GIMPLE_LABEL}
1612 @cindex @code{GIMPLE_LABEL}
1614 @deftypefn {GIMPLE function} gimple gimple_build_label (tree label)
1615 Build a @code{GIMPLE_LABEL} statement with corresponding to the tree
1616 label, @code{LABEL}.
1619 @deftypefn {GIMPLE function} tree gimple_label_label (gimple g)
1620 Return the @code{LABEL_DECL} node used by @code{GIMPLE_LABEL} statement @code{G}.
1623 @deftypefn {GIMPLE function} void gimple_label_set_label (gimple g, tree label)
1624 Set @code{LABEL} to be the @code{LABEL_DECL} node used by @code{GIMPLE_LABEL}
1629 @deftypefn {GIMPLE function} gimple gimple_build_goto (tree dest)
1630 Build a @code{GIMPLE_GOTO} statement to label @code{DEST}.
1633 @deftypefn {GIMPLE function} tree gimple_goto_dest (gimple g)
1634 Return the destination of the unconditional jump @code{G}.
1637 @deftypefn {GIMPLE function} void gimple_goto_set_dest (gimple g, tree dest)
1638 Set @code{DEST} to be the destination of the unconditional jump @code{G}.
1642 @node @code{GIMPLE_NOP}
1643 @subsection @code{GIMPLE_NOP}
1644 @cindex @code{GIMPLE_NOP}
1646 @deftypefn {GIMPLE function} gimple gimple_build_nop (void)
1647 Build a @code{GIMPLE_NOP} statement.
1650 @deftypefn {GIMPLE function} bool gimple_nop_p (gimple g)
1651 Returns @code{TRUE} if statement @code{G} is a @code{GIMPLE_NOP}.
1654 @node @code{GIMPLE_OMP_ATOMIC_LOAD}
1655 @subsection @code{GIMPLE_OMP_ATOMIC_LOAD}
1656 @cindex @code{GIMPLE_OMP_ATOMIC_LOAD}
1658 @deftypefn {GIMPLE function} gimple gimple_build_omp_atomic_load (tree lhs, tree rhs)
1659 Build a @code{GIMPLE_OMP_ATOMIC_LOAD} statement. @code{LHS} is the left-hand
1660 side of the assignment. @code{RHS} is the right-hand side of the
1664 @deftypefn {GIMPLE function} void gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
1665 Set the @code{LHS} of an atomic load.
1668 @deftypefn {GIMPLE function} tree gimple_omp_atomic_load_lhs (gimple g)
1669 Get the @code{LHS} of an atomic load.
1672 @deftypefn {GIMPLE function} void gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
1673 Set the @code{RHS} of an atomic set.
1676 @deftypefn {GIMPLE function} tree gimple_omp_atomic_load_rhs (gimple g)
1677 Get the @code{RHS} of an atomic set.
1681 @node @code{GIMPLE_OMP_ATOMIC_STORE}
1682 @subsection @code{GIMPLE_OMP_ATOMIC_STORE}
1683 @cindex @code{GIMPLE_OMP_ATOMIC_STORE}
1685 @deftypefn {GIMPLE function} gimple gimple_build_omp_atomic_store (tree val)
1686 Build a @code{GIMPLE_OMP_ATOMIC_STORE} statement. @code{VAL} is the value to be
1690 @deftypefn {GIMPLE function} void gimple_omp_atomic_store_set_val (gimple g, tree val)
1691 Set the value being stored in an atomic store.
1694 @deftypefn {GIMPLE function} tree gimple_omp_atomic_store_val (gimple g)
1695 Return the value being stored in an atomic store.
1698 @node @code{GIMPLE_OMP_CONTINUE}
1699 @subsection @code{GIMPLE_OMP_CONTINUE}
1700 @cindex @code{GIMPLE_OMP_CONTINUE}
1702 @deftypefn {GIMPLE function} gimple gimple_build_omp_continue (tree control_def, tree control_use)
1703 Build a @code{GIMPLE_OMP_CONTINUE} statement. @code{CONTROL_DEF} is the
1704 definition of the control variable. @code{CONTROL_USE} is the use of
1705 the control variable.
1708 @deftypefn {GIMPLE function} tree gimple_omp_continue_control_def (gimple s)
1709 Return the definition of the control variable on a
1710 @code{GIMPLE_OMP_CONTINUE} in @code{S}.
1713 @deftypefn {GIMPLE function} tree gimple_omp_continue_control_def_ptr (gimple s)
1714 Same as above, but return the pointer.
1717 @deftypefn {GIMPLE function} tree gimple_omp_continue_set_control_def (gimple s)
1718 Set the control variable definition for a @code{GIMPLE_OMP_CONTINUE}
1719 statement in @code{S}.
1722 @deftypefn {GIMPLE function} tree gimple_omp_continue_control_use (gimple s)
1723 Return the use of the control variable on a @code{GIMPLE_OMP_CONTINUE}
1727 @deftypefn {GIMPLE function} tree gimple_omp_continue_control_use_ptr (gimple s)
1728 Same as above, but return the pointer.
1731 @deftypefn {GIMPLE function} tree gimple_omp_continue_set_control_use (gimple s)
1732 Set the control variable use for a @code{GIMPLE_OMP_CONTINUE} statement
1737 @node @code{GIMPLE_OMP_CRITICAL}
1738 @subsection @code{GIMPLE_OMP_CRITICAL}
1739 @cindex @code{GIMPLE_OMP_CRITICAL}
1741 @deftypefn {GIMPLE function} gimple gimple_build_omp_critical (gimple_seq body, tree name)
1742 Build a @code{GIMPLE_OMP_CRITICAL} statement. @code{BODY} is the sequence of
1743 statements for which only one thread can execute. @code{NAME} is an
1744 optional identifier for this critical block.
1747 @deftypefn {GIMPLE function} tree gimple_omp_critical_name (gimple g)
1748 Return the name associated with @code{OMP_CRITICAL} statement @code{G}.
1751 @deftypefn {GIMPLE function} {tree *} gimple_omp_critical_name_ptr (gimple g)
1752 Return a pointer to the name associated with @code{OMP} critical
1756 @deftypefn {GIMPLE function} void gimple_omp_critical_set_name (gimple g, tree name)
1757 Set @code{NAME} to be the name associated with @code{OMP} critical statement @code{G}.
1760 @node @code{GIMPLE_OMP_FOR}
1761 @subsection @code{GIMPLE_OMP_FOR}
1762 @cindex @code{GIMPLE_OMP_FOR}
1764 @deftypefn {GIMPLE function} gimple gimple_build_omp_for (gimple_seq body, @
1765 tree clauses, tree index, tree initial, tree final, tree incr, @
1766 gimple_seq pre_body, enum tree_code omp_for_cond)
1767 Build a @code{GIMPLE_OMP_FOR} statement. @code{BODY} is sequence of statements
1768 inside the for loop. @code{CLAUSES}, are any of the @code{OMP} loop
1769 construct's clauses: private, firstprivate, lastprivate,
1770 reductions, ordered, schedule, and nowait. @code{PRE_BODY} is the
1771 sequence of statements that are loop invariant. @code{INDEX} is the
1772 index variable. @code{INITIAL} is the initial value of @code{INDEX}. @code{FINAL} is
1773 final value of @code{INDEX}. OMP_FOR_COND is the predicate used to
1774 compare @code{INDEX} and @code{FINAL}. @code{INCR} is the increment expression.
1777 @deftypefn {GIMPLE function} tree gimple_omp_for_clauses (gimple g)
1778 Return the clauses associated with @code{OMP_FOR} @code{G}.
1781 @deftypefn {GIMPLE function} {tree *} gimple_omp_for_clauses_ptr (gimple g)
1782 Return a pointer to the @code{OMP_FOR} @code{G}.
1785 @deftypefn {GIMPLE function} void gimple_omp_for_set_clauses (gimple g, tree clauses)
1786 Set @code{CLAUSES} to be the list of clauses associated with @code{OMP_FOR} @code{G}.
1789 @deftypefn {GIMPLE function} tree gimple_omp_for_index (gimple g)
1790 Return the index variable for @code{OMP_FOR} @code{G}.
1793 @deftypefn {GIMPLE function} {tree *} gimple_omp_for_index_ptr (gimple g)
1794 Return a pointer to the index variable for @code{OMP_FOR} @code{G}.
1797 @deftypefn {GIMPLE function} void gimple_omp_for_set_index (gimple g, tree index)
1798 Set @code{INDEX} to be the index variable for @code{OMP_FOR} @code{G}.
1801 @deftypefn {GIMPLE function} tree gimple_omp_for_initial (gimple g)
1802 Return the initial value for @code{OMP_FOR} @code{G}.
1805 @deftypefn {GIMPLE function} {tree *} gimple_omp_for_initial_ptr (gimple g)
1806 Return a pointer to the initial value for @code{OMP_FOR} @code{G}.
1809 @deftypefn {GIMPLE function} void gimple_omp_for_set_initial (gimple g, tree initial)
1810 Set @code{INITIAL} to be the initial value for @code{OMP_FOR} @code{G}.
1813 @deftypefn {GIMPLE function} tree gimple_omp_for_final (gimple g)
1814 Return the final value for @code{OMP_FOR} @code{G}.
1817 @deftypefn {GIMPLE function} {tree *} gimple_omp_for_final_ptr (gimple g)
1818 turn a pointer to the final value for @code{OMP_FOR} @code{G}.
1821 @deftypefn {GIMPLE function} void gimple_omp_for_set_final (gimple g, tree final)
1822 Set @code{FINAL} to be the final value for @code{OMP_FOR} @code{G}.
1825 @deftypefn {GIMPLE function} tree gimple_omp_for_incr (gimple g)
1826 Return the increment value for @code{OMP_FOR} @code{G}.
1829 @deftypefn {GIMPLE function} {tree *} gimple_omp_for_incr_ptr (gimple g)
1830 Return a pointer to the increment value for @code{OMP_FOR} @code{G}.
1833 @deftypefn {GIMPLE function} void gimple_omp_for_set_incr (gimple g, tree incr)
1834 Set @code{INCR} to be the increment value for @code{OMP_FOR} @code{G}.
1837 @deftypefn {GIMPLE function} gimple_seq gimple_omp_for_pre_body (gimple g)
1838 Return the sequence of statements to execute before the @code{OMP_FOR}
1839 statement @code{G} starts.
1842 @deftypefn {GIMPLE function} void gimple_omp_for_set_pre_body (gimple g, gimple_seq pre_body)
1843 Set @code{PRE_BODY} to be the sequence of statements to execute before
1844 the @code{OMP_FOR} statement @code{G} starts.
1847 @deftypefn {GIMPLE function} void gimple_omp_for_set_cond (gimple g, enum tree_code cond)
1848 Set @code{COND} to be the condition code for @code{OMP_FOR} @code{G}.
1851 @deftypefn {GIMPLE function} {enum tree_code} gimple_omp_for_cond (gimple g)
1852 Return the condition code associated with @code{OMP_FOR} @code{G}.
1856 @node @code{GIMPLE_OMP_MASTER}
1857 @subsection @code{GIMPLE_OMP_MASTER}
1858 @cindex @code{GIMPLE_OMP_MASTER}
1860 @deftypefn {GIMPLE function} gimple gimple_build_omp_master (gimple_seq body)
1861 Build a @code{GIMPLE_OMP_MASTER} statement. @code{BODY} is the sequence of
1862 statements to be executed by just the master.
1866 @node @code{GIMPLE_OMP_ORDERED}
1867 @subsection @code{GIMPLE_OMP_ORDERED}
1868 @cindex @code{GIMPLE_OMP_ORDERED}
1870 @deftypefn {GIMPLE function} gimple gimple_build_omp_ordered (gimple_seq body)
1871 Build a @code{GIMPLE_OMP_ORDERED} statement.
1874 @code{BODY} is the sequence of statements inside a loop that will
1875 executed in sequence.
1878 @node @code{GIMPLE_OMP_PARALLEL}
1879 @subsection @code{GIMPLE_OMP_PARALLEL}
1880 @cindex @code{GIMPLE_OMP_PARALLEL}
1882 @deftypefn {GIMPLE function} gimple gimple_build_omp_parallel (gimple_seq @
1883 body, tree clauses, tree child_fn, tree data_arg)
1884 Build a @code{GIMPLE_OMP_PARALLEL} statement.
1887 @code{BODY} is sequence of statements which are executed in parallel.
1888 @code{CLAUSES}, are the @code{OMP} parallel construct's clauses. @code{CHILD_FN} is
1889 the function created for the parallel threads to execute.
1890 @code{DATA_ARG} are the shared data argument(s).
1892 @deftypefn {GIMPLE function} bool gimple_omp_parallel_combined_p (gimple g)
1893 Return true if @code{OMP} parallel statement @code{G} has the
1894 @code{GF_OMP_PARALLEL_COMBINED} flag set.
1897 @deftypefn {GIMPLE function} void gimple_omp_parallel_set_combined_p (gimple g)
1898 Set the @code{GF_OMP_PARALLEL_COMBINED} field in @code{OMP} parallel statement
1902 @deftypefn {GIMPLE function} gimple_seq gimple_omp_body (gimple g)
1903 Return the body for the @code{OMP} statement @code{G}.
1906 @deftypefn {GIMPLE function} void gimple_omp_set_body (gimple g, gimple_seq body)
1907 Set @code{BODY} to be the body for the @code{OMP} statement @code{G}.
1910 @deftypefn {GIMPLE function} tree gimple_omp_parallel_clauses (gimple g)
1911 Return the clauses associated with @code{OMP_PARALLEL} @code{G}.
1914 @deftypefn {GIMPLE function} {tree *} gimple_omp_parallel_clauses_ptr (gimple g)
1915 Return a pointer to the clauses associated with @code{OMP_PARALLEL} @code{G}.
1918 @deftypefn {GIMPLE function} void gimple_omp_parallel_set_clauses (gimple g, tree clauses)
1919 Set @code{CLAUSES} to be the list of clauses associated with
1920 @code{OMP_PARALLEL} @code{G}.
1923 @deftypefn {GIMPLE function} tree gimple_omp_parallel_child_fn (gimple g)
1924 Return the child function used to hold the body of @code{OMP_PARALLEL}
1928 @deftypefn {GIMPLE function} {tree *} gimple_omp_parallel_child_fn_ptr (gimple g)
1929 Return a pointer to the child function used to hold the body of
1930 @code{OMP_PARALLEL} @code{G}.
1933 @deftypefn {GIMPLE function} void gimple_omp_parallel_set_child_fn (gimple g, tree child_fn)
1934 Set @code{CHILD_FN} to be the child function for @code{OMP_PARALLEL} @code{G}.
1937 @deftypefn {GIMPLE function} tree gimple_omp_parallel_data_arg (gimple g)
1938 Return the artificial argument used to send variables and values
1939 from the parent to the children threads in @code{OMP_PARALLEL} @code{G}.
1942 @deftypefn {GIMPLE function} {tree *} gimple_omp_parallel_data_arg_ptr (gimple g)
1943 Return a pointer to the data argument for @code{OMP_PARALLEL} @code{G}.
1946 @deftypefn {GIMPLE function} void gimple_omp_parallel_set_data_arg (gimple g, tree data_arg)
1947 Set @code{DATA_ARG} to be the data argument for @code{OMP_PARALLEL} @code{G}.
1951 @node @code{GIMPLE_OMP_RETURN}
1952 @subsection @code{GIMPLE_OMP_RETURN}
1953 @cindex @code{GIMPLE_OMP_RETURN}
1955 @deftypefn {GIMPLE function} gimple gimple_build_omp_return (bool wait_p)
1956 Build a @code{GIMPLE_OMP_RETURN} statement. @code{WAIT_P} is true if this is a
1960 @deftypefn {GIMPLE function} void gimple_omp_return_set_nowait (gimple s)
1961 Set the nowait flag on @code{GIMPLE_OMP_RETURN} statement @code{S}.
1965 @deftypefn {GIMPLE function} bool gimple_omp_return_nowait_p (gimple g)
1966 Return true if @code{OMP} return statement @code{G} has the
1967 @code{GF_OMP_RETURN_NOWAIT} flag set.
1970 @node @code{GIMPLE_OMP_SECTION}
1971 @subsection @code{GIMPLE_OMP_SECTION}
1972 @cindex @code{GIMPLE_OMP_SECTION}
1974 @deftypefn {GIMPLE function} gimple gimple_build_omp_section (gimple_seq body)
1975 Build a @code{GIMPLE_OMP_SECTION} statement for a sections statement.
1978 @code{BODY} is the sequence of statements in the section.
1980 @deftypefn {GIMPLE function} bool gimple_omp_section_last_p (gimple g)
1981 Return true if @code{OMP} section statement @code{G} has the
1982 @code{GF_OMP_SECTION_LAST} flag set.
1985 @deftypefn {GIMPLE function} void gimple_omp_section_set_last (gimple g)
1986 Set the @code{GF_OMP_SECTION_LAST} flag on @code{G}.
1989 @node @code{GIMPLE_OMP_SECTIONS}
1990 @subsection @code{GIMPLE_OMP_SECTIONS}
1991 @cindex @code{GIMPLE_OMP_SECTIONS}
1993 @deftypefn {GIMPLE function} gimple gimple_build_omp_sections (gimple_seq body, tree clauses)
1994 Build a @code{GIMPLE_OMP_SECTIONS} statement. @code{BODY} is a sequence of
1995 section statements. @code{CLAUSES} are any of the @code{OMP} sections
1996 construct's clauses: private, firstprivate, lastprivate,
1997 reduction, and nowait.
2001 @deftypefn {GIMPLE function} gimple gimple_build_omp_sections_switch (void)
2002 Build a @code{GIMPLE_OMP_SECTIONS_SWITCH} statement.
2005 @deftypefn {GIMPLE function} tree gimple_omp_sections_control (gimple g)
2006 Return the control variable associated with the
2007 @code{GIMPLE_OMP_SECTIONS} in @code{G}.
2010 @deftypefn {GIMPLE function} {tree *} gimple_omp_sections_control_ptr (gimple g)
2011 Return a pointer to the clauses associated with the
2012 @code{GIMPLE_OMP_SECTIONS} in @code{G}.
2015 @deftypefn {GIMPLE function} void gimple_omp_sections_set_control (gimple g, tree control)
2016 Set @code{CONTROL} to be the set of clauses associated with the
2017 @code{GIMPLE_OMP_SECTIONS} in @code{G}.
2020 @deftypefn {GIMPLE function} tree gimple_omp_sections_clauses (gimple g)
2021 Return the clauses associated with @code{OMP_SECTIONS} @code{G}.
2024 @deftypefn {GIMPLE function} {tree *} gimple_omp_sections_clauses_ptr (gimple g)
2025 Return a pointer to the clauses associated with @code{OMP_SECTIONS} @code{G}.
2028 @deftypefn {GIMPLE function} void gimple_omp_sections_set_clauses (gimple g, tree clauses)
2029 Set @code{CLAUSES} to be the set of clauses associated with @code{OMP_SECTIONS}
2034 @node @code{GIMPLE_OMP_SINGLE}
2035 @subsection @code{GIMPLE_OMP_SINGLE}
2036 @cindex @code{GIMPLE_OMP_SINGLE}
2038 @deftypefn {GIMPLE function} gimple gimple_build_omp_single (gimple_seq body, tree clauses)
2039 Build a @code{GIMPLE_OMP_SINGLE} statement. @code{BODY} is the sequence of
2040 statements that will be executed once. @code{CLAUSES} are any of the
2041 @code{OMP} single construct's clauses: private, firstprivate,
2042 copyprivate, nowait.
2045 @deftypefn {GIMPLE function} tree gimple_omp_single_clauses (gimple g)
2046 Return the clauses associated with @code{OMP_SINGLE} @code{G}.
2049 @deftypefn {GIMPLE function} {tree *} gimple_omp_single_clauses_ptr (gimple g)
2050 Return a pointer to the clauses associated with @code{OMP_SINGLE} @code{G}.
2053 @deftypefn {GIMPLE function} void gimple_omp_single_set_clauses (gimple g, tree clauses)
2054 Set @code{CLAUSES} to be the clauses associated with @code{OMP_SINGLE} @code{G}.
2058 @node @code{GIMPLE_PHI}
2059 @subsection @code{GIMPLE_PHI}
2060 @cindex @code{GIMPLE_PHI}
2062 @deftypefn {GIMPLE function} unsigned gimple_phi_capacity (gimple g)
2063 Return the maximum number of arguments supported by @code{GIMPLE_PHI} @code{G}.
2066 @deftypefn {GIMPLE function} unsigned gimple_phi_num_args (gimple g)
2067 Return the number of arguments in @code{GIMPLE_PHI} @code{G}. This must always
2068 be exactly the number of incoming edges for the basic block
2072 @deftypefn {GIMPLE function} tree gimple_phi_result (gimple g)
2073 Return the @code{SSA} name created by @code{GIMPLE_PHI} @code{G}.
2076 @deftypefn {GIMPLE function} {tree *} gimple_phi_result_ptr (gimple g)
2077 Return a pointer to the @code{SSA} name created by @code{GIMPLE_PHI} @code{G}.
2080 @deftypefn {GIMPLE function} void gimple_phi_set_result (gimple g, tree result)
2081 Set @code{RESULT} to be the @code{SSA} name created by @code{GIMPLE_PHI} @code{G}.
2084 @deftypefn {GIMPLE function} {struct phi_arg_d *} gimple_phi_arg (gimple g, index)
2085 Return the @code{PHI} argument corresponding to incoming edge @code{INDEX} for
2086 @code{GIMPLE_PHI} @code{G}.
2089 @deftypefn {GIMPLE function} void gimple_phi_set_arg (gimple g, index, struct phi_arg_d * phiarg)
2090 Set @code{PHIARG} to be the argument corresponding to incoming edge
2091 @code{INDEX} for @code{GIMPLE_PHI} @code{G}.
2094 @node @code{GIMPLE_RESX}
2095 @subsection @code{GIMPLE_RESX}
2096 @cindex @code{GIMPLE_RESX}
2098 @deftypefn {GIMPLE function} gimple gimple_build_resx (int region)
2099 Build a @code{GIMPLE_RESX} statement which is a statement. This
2100 statement is a placeholder for _Unwind_Resume before we know if a
2101 function call or a branch is needed. @code{REGION} is the exception
2102 region from which control is flowing.
2105 @deftypefn {GIMPLE function} int gimple_resx_region (gimple g)
2106 Return the region number for @code{GIMPLE_RESX} @code{G}.
2109 @deftypefn {GIMPLE function} void gimple_resx_set_region (gimple g, int region)
2110 Set @code{REGION} to be the region number for @code{GIMPLE_RESX} @code{G}.
2113 @node @code{GIMPLE_RETURN}
2114 @subsection @code{GIMPLE_RETURN}
2115 @cindex @code{GIMPLE_RETURN}
2117 @deftypefn {GIMPLE function} gimple gimple_build_return (tree retval)
2118 Build a @code{GIMPLE_RETURN} statement whose return value is retval.
2121 @deftypefn {GIMPLE function} tree gimple_return_retval (gimple g)
2122 Return the return value for @code{GIMPLE_RETURN} @code{G}.
2125 @deftypefn {GIMPLE function} void gimple_return_set_retval (gimple g, tree retval)
2126 Set @code{RETVAL} to be the return value for @code{GIMPLE_RETURN} @code{G}.
2129 @node @code{GIMPLE_SWITCH}
2130 @subsection @code{GIMPLE_SWITCH}
2131 @cindex @code{GIMPLE_SWITCH}
2133 @deftypefn {GIMPLE function} gimple gimple_build_switch (tree index, tree @
2134 default_label, @code{VEC}(tree,heap) *args)
2135 Build a @code{GIMPLE_SWITCH} statement. @code{INDEX} is the index variable
2136 to switch on, and @code{DEFAULT_LABEL} represents the default label.
2137 @code{ARGS} is a vector of @code{CASE_LABEL_EXPR} trees that contain the
2138 non-default case labels. Each label is a tree of code @code{CASE_LABEL_EXPR}.
2141 @deftypefn {GIMPLE function} unsigned gimple_switch_num_labels (gimple g)
2142 Return the number of labels associated with the switch statement
2146 @deftypefn {GIMPLE function} void gimple_switch_set_num_labels (gimple g, @
2148 Set @code{NLABELS} to be the number of labels for the switch statement
2152 @deftypefn {GIMPLE function} tree gimple_switch_index (gimple g)
2153 Return the index variable used by the switch statement @code{G}.
2156 @deftypefn {GIMPLE function} void gimple_switch_set_index (gimple g, tree index)
2157 Set @code{INDEX} to be the index variable for switch statement @code{G}.
2160 @deftypefn {GIMPLE function} tree gimple_switch_label (gimple g, unsigned index)
2161 Return the label numbered @code{INDEX}. The default label is 0, followed
2162 by any labels in a switch statement.
2165 @deftypefn {GIMPLE function} void gimple_switch_set_label (gimple g, unsigned @
2167 Set the label number @code{INDEX} to @code{LABEL}. 0 is always the default
2171 @deftypefn {GIMPLE function} tree gimple_switch_default_label (gimple g)
2172 Return the default label for a switch statement.
2175 @deftypefn {GIMPLE function} void gimple_switch_set_default_label (gimple g, @
2177 Set the default label for a switch statement.
2181 @node @code{GIMPLE_TRY}
2182 @subsection @code{GIMPLE_TRY}
2183 @cindex @code{GIMPLE_TRY}
2185 @deftypefn {GIMPLE function} gimple gimple_build_try (gimple_seq eval, @
2186 gimple_seq cleanup, unsigned int kind)
2187 Build a @code{GIMPLE_TRY} statement. @code{EVAL} is a sequence with the
2188 expression to evaluate. @code{CLEANUP} is a sequence of statements to
2189 run at clean-up time. @code{KIND} is the enumeration value
2190 @code{GIMPLE_TRY_CATCH} if this statement denotes a try/catch construct
2191 or @code{GIMPLE_TRY_FINALLY} if this statement denotes a try/finally
2195 @deftypefn {GIMPLE function} {enum gimple_try_flags} gimple_try_kind (gimple g)
2196 Return the kind of try block represented by @code{GIMPLE_TRY} @code{G}. This is
2197 either @code{GIMPLE_TRY_CATCH} or @code{GIMPLE_TRY_FINALLY}.
2200 @deftypefn {GIMPLE function} bool gimple_try_catch_is_cleanup (gimple g)
2201 Return the @code{GIMPLE_TRY_CATCH_IS_CLEANUP} flag.
2204 @deftypefn {GIMPLE function} gimple_seq gimple_try_eval (gimple g)
2205 Return the sequence of statements used as the body for @code{GIMPLE_TRY}
2209 @deftypefn {GIMPLE function} gimple_seq gimple_try_cleanup (gimple g)
2210 Return the sequence of statements used as the cleanup body for
2211 @code{GIMPLE_TRY} @code{G}.
2214 @deftypefn {GIMPLE function} void gimple_try_set_catch_is_cleanup (gimple g, @
2215 bool catch_is_cleanup)
2216 Set the @code{GIMPLE_TRY_CATCH_IS_CLEANUP} flag.
2219 @deftypefn {GIMPLE function} void gimple_try_set_eval (gimple g, gimple_seq eval)
2220 Set @code{EVAL} to be the sequence of statements to use as the body for
2221 @code{GIMPLE_TRY} @code{G}.
2224 @deftypefn {GIMPLE function} void gimple_try_set_cleanup (gimple g, gimple_seq cleanup)
2225 Set @code{CLEANUP} to be the sequence of statements to use as the
2226 cleanup body for @code{GIMPLE_TRY} @code{G}.
2229 @node @code{GIMPLE_WITH_CLEANUP_EXPR}
2230 @subsection @code{GIMPLE_WITH_CLEANUP_EXPR}
2231 @cindex @code{GIMPLE_WITH_CLEANUP_EXPR}
2233 @deftypefn {GIMPLE function} gimple gimple_build_wce (gimple_seq cleanup)
2234 Build a @code{GIMPLE_WITH_CLEANUP_EXPR} statement. @code{CLEANUP} is the
2235 clean-up expression.
2238 @deftypefn {GIMPLE function} gimple_seq gimple_wce_cleanup (gimple g)
2239 Return the cleanup sequence for cleanup statement @code{G}.
2242 @deftypefn {GIMPLE function} void gimple_wce_set_cleanup (gimple g, gimple_seq cleanup)
2243 Set @code{CLEANUP} to be the cleanup sequence for @code{G}.
2246 @deftypefn {GIMPLE function} bool gimple_wce_cleanup_eh_only (gimple g)
2247 Return the @code{CLEANUP_EH_ONLY} flag for a @code{WCE} tuple.
2250 @deftypefn {GIMPLE function} void gimple_wce_set_cleanup_eh_only (gimple g, bool eh_only_p)
2251 Set the @code{CLEANUP_EH_ONLY} flag for a @code{WCE} tuple.
2255 @node GIMPLE sequences
2256 @section GIMPLE sequences
2257 @cindex GIMPLE sequences
2259 GIMPLE sequences are the tuple equivalent of @code{STATEMENT_LIST}'s
2260 used in @code{GENERIC}. They are used to chain statements together, and
2261 when used in conjunction with sequence iterators, provide a
2262 framework for iterating through statements.
2264 GIMPLE sequences are of type struct @code{gimple_sequence}, but are more
2265 commonly passed by reference to functions dealing with sequences.
2266 The type for a sequence pointer is @code{gimple_seq} which is the same
2267 as struct @code{gimple_sequence} *. When declaring a local sequence,
2268 you can define a local variable of type struct @code{gimple_sequence}.
2269 When declaring a sequence allocated on the garbage collected
2270 heap, use the function @code{gimple_seq_alloc} documented below.
2272 There are convenience functions for iterating through sequences
2273 in the section entitled Sequence Iterators.
2275 Below is a list of functions to manipulate and query sequences.
2277 @deftypefn {GIMPLE function} void gimple_seq_add_stmt (gimple_seq *seq, gimple g)
2278 Link a gimple statement to the end of the sequence *@code{SEQ} if @code{G} is
2279 not @code{NULL}. If *@code{SEQ} is @code{NULL}, allocate a sequence before linking.
2282 @deftypefn {GIMPLE function} void gimple_seq_add_seq (gimple_seq *dest, gimple_seq src)
2283 Append sequence @code{SRC} to the end of sequence *@code{DEST} if @code{SRC} is not
2284 @code{NULL}. If *@code{DEST} is @code{NULL}, allocate a new sequence before
2288 @deftypefn {GIMPLE function} gimple_seq gimple_seq_deep_copy (gimple_seq src)
2289 Perform a deep copy of sequence @code{SRC} and return the result.
2292 @deftypefn {GIMPLE function} gimple_seq gimple_seq_reverse (gimple_seq seq)
2293 Reverse the order of the statements in the sequence @code{SEQ}. Return
2297 @deftypefn {GIMPLE function} gimple gimple_seq_first (gimple_seq s)
2298 Return the first statement in sequence @code{S}.
2301 @deftypefn {GIMPLE function} gimple gimple_seq_last (gimple_seq s)
2302 Return the last statement in sequence @code{S}.
2305 @deftypefn {GIMPLE function} void gimple_seq_set_last (gimple_seq s, gimple last)
2306 Set the last statement in sequence @code{S} to the statement in @code{LAST}.
2309 @deftypefn {GIMPLE function} void gimple_seq_set_first (gimple_seq s, gimple first)
2310 Set the first statement in sequence @code{S} to the statement in @code{FIRST}.
2313 @deftypefn {GIMPLE function} void gimple_seq_init (gimple_seq s)
2314 Initialize sequence @code{S} to an empty sequence.
2317 @deftypefn {GIMPLE function} gimple_seq gimple_seq_alloc (void)
2318 Allocate a new sequence in the garbage collected store and return
2322 @deftypefn {GIMPLE function} void gimple_seq_copy (gimple_seq dest, gimple_seq src)
2323 Copy the sequence @code{SRC} into the sequence @code{DEST}.
2326 @deftypefn {GIMPLE function} bool gimple_seq_empty_p (gimple_seq s)
2327 Return true if the sequence @code{S} is empty.
2330 @deftypefn {GIMPLE function} gimple_seq bb_seq (basic_block bb)
2331 Returns the sequence of statements in @code{BB}.
2334 @deftypefn {GIMPLE function} void set_bb_seq (basic_block bb, gimple_seq seq)
2335 Sets the sequence of statements in @code{BB} to @code{SEQ}.
2338 @deftypefn {GIMPLE function} bool gimple_seq_singleton_p (gimple_seq seq)
2339 Determine whether @code{SEQ} contains exactly one statement.
2342 @node Sequence iterators
2343 @section Sequence iterators
2344 @cindex Sequence iterators
2346 Sequence iterators are convenience constructs for iterating
2347 through statements in a sequence. Given a sequence @code{SEQ}, here is
2348 a typical use of gimple sequence iterators:
2351 gimple_stmt_iterator gsi;
2353 for (gsi = gsi_start (seq); !gsi_end_p (gsi); gsi_next (&gsi))
2355 gimple g = gsi_stmt (gsi);
2356 /* Do something with gimple statement @code{G}. */
2360 Backward iterations are possible:
2363 for (gsi = gsi_last (seq); !gsi_end_p (gsi); gsi_prev (&gsi))
2366 Forward and backward iterations on basic blocks are possible with
2367 @code{gsi_start_bb} and @code{gsi_last_bb}.
2369 In the documentation below we sometimes refer to enum
2370 @code{gsi_iterator_update}. The valid options for this enumeration are:
2373 @item @code{GSI_NEW_STMT}
2374 Only valid when a single statement is added. Move the iterator to it.
2376 @item @code{GSI_SAME_STMT}
2377 Leave the iterator at the same statement.
2379 @item @code{GSI_CONTINUE_LINKING}
2380 Move iterator to whatever position is suitable for linking other
2381 statements in the same direction.
2384 Below is a list of the functions used to manipulate and use
2385 statement iterators.
2387 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_start (gimple_seq seq)
2388 Return a new iterator pointing to the sequence @code{SEQ}'s first
2389 statement. If @code{SEQ} is empty, the iterator's basic block is @code{NULL}.
2390 Use @code{gsi_start_bb} instead when the iterator needs to always have
2391 the correct basic block set.
2394 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_start_bb (basic_block bb)
2395 Return a new iterator pointing to the first statement in basic
2399 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_last (gimple_seq seq)
2400 Return a new iterator initially pointing to the last statement of
2401 sequence @code{SEQ}. If @code{SEQ} is empty, the iterator's basic block is
2402 @code{NULL}. Use @code{gsi_last_bb} instead when the iterator needs to always
2403 have the correct basic block set.
2406 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_last_bb (basic_block bb)
2407 Return a new iterator pointing to the last statement in basic
2411 @deftypefn {GIMPLE function} bool gsi_end_p (gimple_stmt_iterator i)
2412 Return @code{TRUE} if at the end of @code{I}.
2415 @deftypefn {GIMPLE function} bool gsi_one_before_end_p (gimple_stmt_iterator i)
2416 Return @code{TRUE} if we're one statement before the end of @code{I}.
2419 @deftypefn {GIMPLE function} void gsi_next (gimple_stmt_iterator *i)
2420 Advance the iterator to the next gimple statement.
2423 @deftypefn {GIMPLE function} void gsi_prev (gimple_stmt_iterator *i)
2424 Advance the iterator to the previous gimple statement.
2427 @deftypefn {GIMPLE function} gimple gsi_stmt (gimple_stmt_iterator i)
2428 Return the current stmt.
2431 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_after_labels (basic_block bb)
2432 Return a block statement iterator that points to the first
2433 non-label statement in block @code{BB}.
2436 @deftypefn {GIMPLE function} {gimple *} gsi_stmt_ptr (gimple_stmt_iterator *i)
2437 Return a pointer to the current stmt.
2440 @deftypefn {GIMPLE function} basic_block gsi_bb (gimple_stmt_iterator i)
2441 Return the basic block associated with this iterator.
2444 @deftypefn {GIMPLE function} gimple_seq gsi_seq (gimple_stmt_iterator i)
2445 Return the sequence associated with this iterator.
2448 @deftypefn {GIMPLE function} void gsi_remove (gimple_stmt_iterator *i, bool remove_eh_info)
2449 Remove the current stmt from the sequence. The iterator is
2450 updated to point to the next statement. When @code{REMOVE_EH_INFO} is
2451 true we remove the statement pointed to by iterator @code{I} from the @code{EH}
2452 tables. Otherwise we do not modify the @code{EH} tables. Generally,
2453 @code{REMOVE_EH_INFO} should be true when the statement is going to be
2454 removed from the @code{IL} and not reinserted elsewhere.
2457 @deftypefn {GIMPLE function} void gsi_link_seq_before (gimple_stmt_iterator *i, gimple_seq seq, enum gsi_iterator_update mode)
2458 Links the sequence of statements @code{SEQ} before the statement pointed
2459 by iterator @code{I}. @code{MODE} indicates what to do with the iterator
2460 after insertion (see @code{enum gsi_iterator_update} above).
2463 @deftypefn {GIMPLE function} void gsi_link_before (gimple_stmt_iterator *i, gimple g, enum gsi_iterator_update mode)
2464 Links statement @code{G} before the statement pointed-to by iterator @code{I}.
2465 Updates iterator @code{I} according to @code{MODE}.
2468 @deftypefn {GIMPLE function} void gsi_link_seq_after (gimple_stmt_iterator *i, @
2469 gimple_seq seq, enum gsi_iterator_update mode)
2470 Links sequence @code{SEQ} after the statement pointed-to by iterator @code{I}.
2471 @code{MODE} is as in @code{gsi_insert_after}.
2474 @deftypefn {GIMPLE function} void gsi_link_after (gimple_stmt_iterator *i, @
2475 gimple g, enum gsi_iterator_update mode)
2476 Links statement @code{G} after the statement pointed-to by iterator @code{I}.
2477 @code{MODE} is as in @code{gsi_insert_after}.
2480 @deftypefn {GIMPLE function} gimple_seq gsi_split_seq_after (gimple_stmt_iterator i)
2481 Move all statements in the sequence after @code{I} to a new sequence.
2482 Return this new sequence.
2485 @deftypefn {GIMPLE function} gimple_seq gsi_split_seq_before (gimple_stmt_iterator *i)
2486 Move all statements in the sequence before @code{I} to a new sequence.
2487 Return this new sequence.
2490 @deftypefn {GIMPLE function} void gsi_replace (gimple_stmt_iterator *i, @
2491 gimple stmt, bool update_eh_info)
2492 Replace the statement pointed-to by @code{I} to @code{STMT}. If @code{UPDATE_EH_INFO}
2493 is true, the exception handling information of the original
2494 statement is moved to the new statement.
2497 @deftypefn {GIMPLE function} void gsi_insert_before (gimple_stmt_iterator *i, @
2498 gimple stmt, enum gsi_iterator_update mode)
2499 Insert statement @code{STMT} before the statement pointed-to by iterator
2500 @code{I}, update @code{STMT}'s basic block and scan it for new operands. @code{MODE}
2501 specifies how to update iterator @code{I} after insertion (see enum
2502 @code{gsi_iterator_update}).
2505 @deftypefn {GIMPLE function} void gsi_insert_seq_before (gimple_stmt_iterator *i, @
2506 gimple_seq seq, enum gsi_iterator_update mode)
2507 Like @code{gsi_insert_before}, but for all the statements in @code{SEQ}.
2510 @deftypefn {GIMPLE function} void gsi_insert_after (gimple_stmt_iterator *i, @
2511 gimple stmt, enum gsi_iterator_update mode)
2512 Insert statement @code{STMT} after the statement pointed-to by iterator
2513 @code{I}, update @code{STMT}'s basic block and scan it for new operands. @code{MODE}
2514 specifies how to update iterator @code{I} after insertion (see enum
2515 @code{gsi_iterator_update}).
2518 @deftypefn {GIMPLE function} void gsi_insert_seq_after (gimple_stmt_iterator *i, @
2519 gimple_seq seq, enum gsi_iterator_update mode)
2520 Like @code{gsi_insert_after}, but for all the statements in @code{SEQ}.
2523 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_for_stmt (gimple stmt)
2524 Finds iterator for @code{STMT}.
2527 @deftypefn {GIMPLE function} void gsi_move_after (gimple_stmt_iterator *from, @
2528 gimple_stmt_iterator *to)
2529 Move the statement at @code{FROM} so it comes right after the statement
2533 @deftypefn {GIMPLE function} void gsi_move_before (gimple_stmt_iterator *from, @
2534 gimple_stmt_iterator *to)
2535 Move the statement at @code{FROM} so it comes right before the statement
2539 @deftypefn {GIMPLE function} void gsi_move_to_bb_end (gimple_stmt_iterator *from, @
2541 Move the statement at @code{FROM} to the end of basic block @code{BB}.
2544 @deftypefn {GIMPLE function} void gsi_insert_on_edge (edge e, gimple stmt)
2545 Add @code{STMT} to the pending list of edge @code{E}. No actual insertion is
2546 made until a call to @code{gsi_commit_edge_inserts}() is made.
2549 @deftypefn {GIMPLE function} void gsi_insert_seq_on_edge (edge e, gimple_seq seq)
2550 Add the sequence of statements in @code{SEQ} to the pending list of edge
2551 @code{E}. No actual insertion is made until a call to
2552 @code{gsi_commit_edge_inserts}() is made.
2555 @deftypefn {GIMPLE function} basic_block gsi_insert_on_edge_immediate (edge e, gimple stmt)
2556 Similar to @code{gsi_insert_on_edge}+@code{gsi_commit_edge_inserts}. If a new
2557 block has to be created, it is returned.
2560 @deftypefn {GIMPLE function} void gsi_commit_one_edge_insert (edge e, basic_block *new_bb)
2561 Commit insertions pending at edge @code{E}. If a new block is created,
2562 set @code{NEW_BB} to this block, otherwise set it to @code{NULL}.
2565 @deftypefn {GIMPLE function} void gsi_commit_edge_inserts (void)
2566 This routine will commit all pending edge insertions, creating
2567 any new basic blocks which are necessary.
2571 @node Adding a new GIMPLE statement code
2572 @section Adding a new GIMPLE statement code
2573 @cindex Adding a new GIMPLE statement code
2575 The first step in adding a new GIMPLE statement code, is
2576 modifying the file @code{gimple.def}, which contains all the GIMPLE
2577 codes. Then you must add a corresponding structure, and an entry
2578 in @code{union gimple_statement_d}, both of which are located in
2579 @code{gimple.h}. This in turn, will require you to add a corresponding
2580 @code{GTY} tag in @code{gsstruct.def}, and code to handle this tag in
2581 @code{gss_for_code} which is located in @code{gimple.c}.
2583 In order for the garbage collector to know the size of the
2584 structure you created in @code{gimple.h}, you need to add a case to
2585 handle your new GIMPLE statement in @code{gimple_size} which is located
2588 You will probably want to create a function to build the new
2589 gimple statement in @code{gimple.c}. The function should be called
2590 @code{gimple_build_@var{new-tuple-name}}, and should return the new tuple
2593 If your new statement requires accessors for any members or
2594 operands it may have, put simple inline accessors in
2595 @code{gimple.h} and any non-trivial accessors in @code{gimple.c} with a
2596 corresponding prototype in @code{gimple.h}.
2599 @node Statement and operand traversals
2600 @section Statement and operand traversals
2601 @cindex Statement and operand traversals
2603 There are two functions available for walking statements and
2604 sequences: @code{walk_gimple_stmt} and @code{walk_gimple_seq},
2605 accordingly, and a third function for walking the operands in a
2606 statement: @code{walk_gimple_op}.
2608 @deftypefn {GIMPLE function} tree walk_gimple_stmt (gimple_stmt_iterator *gsi, @
2609 walk_stmt_fn callback_stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi)
2610 This function is used to walk the current statement in @code{GSI},
2611 optionally using traversal state stored in @code{WI}. If @code{WI} is @code{NULL}, no
2612 state is kept during the traversal.
2614 The callback @code{CALLBACK_STMT} is called. If @code{CALLBACK_STMT} returns
2615 true, it means that the callback function has handled all the
2616 operands of the statement and it is not necessary to walk its
2619 If @code{CALLBACK_STMT} is @code{NULL} or it returns false, @code{CALLBACK_OP} is
2620 called on each operand of the statement via @code{walk_gimple_op}. If
2621 @code{walk_gimple_op} returns non-@code{NULL} for any operand, the remaining
2622 operands are not scanned.
2624 The return value is that returned by the last call to
2625 @code{walk_gimple_op}, or @code{NULL_TREE} if no @code{CALLBACK_OP} is specified.
2629 @deftypefn {GIMPLE function} tree walk_gimple_op (gimple stmt, @
2630 walk_tree_fn callback_op, struct walk_stmt_info *wi)
2631 Use this function to walk the operands of statement @code{STMT}. Every
2632 operand is walked via @code{walk_tree} with optional state information
2635 @code{CALLBACK_OP} is called on each operand of @code{STMT} via @code{walk_tree}.
2636 Additional parameters to @code{walk_tree} must be stored in @code{WI}. For
2637 each operand @code{OP}, @code{walk_tree} is called as:
2640 walk_tree (&@code{OP}, @code{CALLBACK_OP}, @code{WI}, @code{PSET})
2643 If @code{CALLBACK_OP} returns non-@code{NULL} for an operand, the remaining
2644 operands are not scanned. The return value is that returned by
2645 the last call to @code{walk_tree}, or @code{NULL_TREE} if no @code{CALLBACK_OP} is
2650 @deftypefn {GIMPLE function} tree walk_gimple_seq (gimple_seq seq, @
2651 walk_stmt_fn callback_stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi)
2652 This function walks all the statements in the sequence @code{SEQ}
2653 calling @code{walk_gimple_stmt} on each one. @code{WI} is as in
2654 @code{walk_gimple_stmt}. If @code{walk_gimple_stmt} returns non-@code{NULL}, the walk
2655 is stopped and the value returned. Otherwise, all the statements
2656 are walked and @code{NULL_TREE} returned.