svn merge -r205223:206958 svn+ssh://gcc.gnu.org/svn/gcc/trunk
[official-gcc.git] / gcc / doc / gimple.texi
blob36a58cfe639cc25ce06ecea727be303775e23e97
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.
6 @node GIMPLE
7 @chapter GIMPLE
8 @cindex GIMPLE
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}.
71 @menu
72 * Tuple representation::
73 * GIMPLE instruction set::
74 * GIMPLE Exception Handling::
75 * Temporaries::
76 * Operands::
77 * Manipulating GIMPLE statements::
78 * Tuple specific accessors::
79 * GIMPLE sequences::
80 * Sequence iterators::
81 * Adding a new GIMPLE statement code::
82 * Statement and operand traversals::
83 @end menu
85 @node Tuple representation
86 @section Tuple representation
87 @cindex tuples
89 GIMPLE instructions are tuples of variable size divided in two
90 groups: a header describing the instruction and its locations,
91 and a variable length body with all the operands. Tuples are
92 organized into a hierarchy with 3 main classes of tuples.
94 @subsection @code{gimple_statement_base} (gsbase)
95 @cindex gimple_statement_base
97 This is the root of the hierarchy, it holds basic information
98 needed by most GIMPLE statements. There are some fields that
99 may not be relevant to every GIMPLE statement, but those were
100 moved into the base structure to take advantage of holes left by
101 other fields (thus making the structure more compact).  The
102 structure takes 4 words (32 bytes) on 64 bit hosts:
104 @multitable {@code{references_memory_p}} {Size (bits)}
105 @item Field                             @tab Size (bits)
106 @item @code{code}                       @tab 8
107 @item @code{subcode}                    @tab 16
108 @item @code{no_warning}                 @tab 1
109 @item @code{visited}                    @tab 1
110 @item @code{nontemporal_move}           @tab 1
111 @item @code{plf}                        @tab 2
112 @item @code{modified}                   @tab 1
113 @item @code{has_volatile_ops}           @tab 1
114 @item @code{references_memory_p}        @tab 1
115 @item @code{uid}                        @tab 32
116 @item @code{location}                   @tab 32
117 @item @code{num_ops}                    @tab 32
118 @item @code{bb}                         @tab 64
119 @item @code{block}                      @tab 63
120 @item Total size                        @tab 32 bytes   
121 @end multitable
123 @itemize @bullet
124 @item @code{code}
125 Main identifier for a GIMPLE instruction.
127 @item @code{subcode}
128 Used to distinguish different variants of the same basic
129 instruction or provide flags applicable to a given code. The
130 @code{subcode} flags field has different uses depending on the code of
131 the instruction, but mostly it distinguishes instructions of the
132 same family. The most prominent use of this field is in
133 assignments, where subcode indicates the operation done on the
134 RHS of the assignment. For example, a = b + c is encoded as
135 @code{GIMPLE_ASSIGN <PLUS_EXPR, a, b, c>}.
137 @item @code{no_warning}
138 Bitflag to indicate whether a warning has already been issued on
139 this statement.
141 @item @code{visited}
142 General purpose ``visited'' marker. Set and cleared by each pass
143 when needed.
145 @item @code{nontemporal_move}
146 Bitflag used in assignments that represent non-temporal moves.
147 Although this bitflag is only used in assignments, it was moved
148 into the base to take advantage of the bit holes left by the
149 previous fields.
151 @item @code{plf}
152 Pass Local Flags. This 2-bit mask can be used as general purpose
153 markers by any pass. Passes are responsible for clearing and
154 setting these two flags accordingly.
156 @item @code{modified}
157 Bitflag to indicate whether the statement has been modified.
158 Used mainly by the operand scanner to determine when to re-scan a
159 statement for operands.
161 @item @code{has_volatile_ops}
162 Bitflag to indicate whether this statement contains operands that
163 have been marked volatile.
165 @item @code{references_memory_p}
166 Bitflag to indicate whether this statement contains memory
167 references (i.e., its operands are either global variables, or
168 pointer dereferences or anything that must reside in memory).
170 @item @code{uid}
171 This is an unsigned integer used by passes that want to assign
172 IDs to every statement. These IDs must be assigned and used by
173 each pass.
175 @item @code{location}
176 This is a @code{location_t} identifier to specify source code
177 location for this statement. It is inherited from the front
178 end.
180 @item @code{num_ops}
181 Number of operands that this statement has. This specifies the
182 size of the operand vector embedded in the tuple. Only used in
183 some tuples, but it is declared in the base tuple to take
184 advantage of the 32-bit hole left by the previous fields.
186 @item @code{bb}
187 Basic block holding the instruction.
189 @item @code{block}
190 Lexical block holding this statement.  Also used for debug
191 information generation.
192 @end itemize
194 @subsection @code{gimple_statement_with_ops}
195 @cindex gimple_statement_with_ops
197 This tuple is actually split in two:
198 @code{gimple_statement_with_ops_base} and
199 @code{gimple_statement_with_ops}. This is needed to accommodate the
200 way the operand vector is allocated. The operand vector is
201 defined to be an array of 1 element. So, to allocate a dynamic
202 number of operands, the memory allocator (@code{gimple_alloc}) simply
203 allocates enough memory to hold the structure itself plus @code{N
204 - 1} operands which run ``off the end'' of the structure. For
205 example, to allocate space for a tuple with 3 operands,
206 @code{gimple_alloc} reserves @code{sizeof (struct
207 gimple_statement_with_ops) + 2 * sizeof (tree)} bytes.
209 On the other hand, several fields in this tuple need to be shared
210 with the @code{gimple_statement_with_memory_ops} tuple. So, these
211 common fields are placed in @code{gimple_statement_with_ops_base} which
212 is then inherited from the other two tuples.
215 @multitable {@code{def_ops}}    {48 + 8 * @code{num_ops} bytes}
216 @item   @code{gsbase}           @tab 256        
217 @item   @code{def_ops}          @tab 64 
218 @item   @code{use_ops}          @tab 64 
219 @item   @code{op}               @tab @code{num_ops} * 64        
220 @item   Total size              @tab 48 + 8 * @code{num_ops} bytes
221 @end multitable
223 @itemize @bullet
224 @item @code{gsbase}
225 Inherited from @code{struct gimple_statement_base}.
227 @item @code{def_ops}
228 Array of pointers into the operand array indicating all the slots that
229 contain a variable written-to by the statement. This array is
230 also used for immediate use chaining. Note that it would be
231 possible to not rely on this array, but the changes required to
232 implement this are pretty invasive.
234 @item @code{use_ops}
235 Similar to @code{def_ops} but for variables read by the statement.
237 @item @code{op}
238 Array of trees with @code{num_ops} slots.
239 @end itemize
241 @subsection @code{gimple_statement_with_memory_ops}
243 This tuple is essentially identical to @code{gimple_statement_with_ops},
244 except that it contains 4 additional fields to hold vectors
245 related memory stores and loads.  Similar to the previous case,
246 the structure is split in two to accommodate for the operand
247 vector (@code{gimple_statement_with_memory_ops_base} and
248 @code{gimple_statement_with_memory_ops}).
251 @multitable {@code{vdef_ops}}   {80 + 8 * @code{num_ops} bytes}
252 @item Field                     @tab Size (bits)
253 @item @code{gsbase}             @tab 256
254 @item @code{def_ops}            @tab 64
255 @item @code{use_ops}            @tab 64
256 @item @code{vdef_ops}           @tab 64
257 @item @code{vuse_ops}           @tab 64
258 @item @code{stores}             @tab 64 
259 @item @code{loads}              @tab 64 
260 @item @code{op}                 @tab @code{num_ops} * 64        
261 @item Total size                @tab 80 + 8 * @code{num_ops} bytes
262 @end multitable
264 @itemize @bullet
265 @item @code{vdef_ops}
266 Similar to @code{def_ops} but for @code{VDEF} operators. There is
267 one entry per memory symbol written by this statement. This is
268 used to maintain the memory SSA use-def and def-def chains.
270 @item @code{vuse_ops}
271 Similar to @code{use_ops} but for @code{VUSE} operators. There is
272 one entry per memory symbol loaded by this statement. This is
273 used to maintain the memory SSA use-def chains.
275 @item @code{stores}
276 Bitset with all the UIDs for the symbols written-to by the
277 statement.  This is different than @code{vdef_ops} in that all the
278 affected symbols are mentioned in this set.  If memory
279 partitioning is enabled, the @code{vdef_ops} vector will refer to memory
280 partitions. Furthermore, no SSA information is stored in this
281 set.
283 @item @code{loads}
284 Similar to @code{stores}, but for memory loads. (Note that there
285 is some amount of redundancy here, it should be possible to
286 reduce memory utilization further by removing these sets).
287 @end itemize
289 All the other tuples are defined in terms of these three basic
290 ones. Each tuple will add some fields. The main gimple type
291 is defined to be the union of all these structures (@code{GTY} markers
292 elided for clarity):
294 @smallexample
295 union gimple_statement_d
297   struct gimple_statement_base gsbase;
298   struct gimple_statement_with_ops gsops;
299   struct gimple_statement_with_memory_ops gsmem;
300   struct gimple_statement_omp omp;
301   struct gimple_statement_bind gimple_bind;
302   struct gimple_statement_catch gimple_catch;
303   struct gimple_statement_eh_filter gimple_eh_filter;
304   struct gimple_statement_phi gimple_phi;
305   struct gimple_statement_resx gimple_resx;
306   struct gimple_statement_try gimple_try;
307   struct gimple_statement_wce gimple_wce;
308   struct gimple_statement_asm gimple_asm;
309   struct gimple_statement_omp_critical gimple_omp_critical;
310   struct gimple_statement_omp_for gimple_omp_for;
311   struct gimple_statement_omp_parallel gimple_omp_parallel;
312   struct gimple_statement_omp_task gimple_omp_task;
313   struct gimple_statement_omp_sections gimple_omp_sections;
314   struct gimple_statement_omp_single gimple_omp_single;
315   struct gimple_statement_omp_continue gimple_omp_continue;
316   struct gimple_statement_omp_atomic_load gimple_omp_atomic_load;
317   struct gimple_statement_omp_atomic_store gimple_omp_atomic_store;
319 @end smallexample
322 @node GIMPLE instruction set
323 @section GIMPLE instruction set
324 @cindex GIMPLE instruction set
326 The following table briefly describes the GIMPLE instruction set.
328 @multitable {@code{GIMPLE_OMP_SECTIONS_SWITCH}} {High GIMPLE} {Low GIMPLE}
329 @item Instruction                       @tab High GIMPLE        @tab Low GIMPLE
330 @item @code{GIMPLE_ASM}                 @tab x                  @tab x
331 @item @code{GIMPLE_ASSIGN}              @tab x                  @tab x
332 @item @code{GIMPLE_BIND}                @tab x                  @tab
333 @item @code{GIMPLE_CALL}                @tab x                  @tab x
334 @item @code{GIMPLE_CATCH}               @tab x                  @tab
335 @item @code{GIMPLE_COND}                @tab x                  @tab x
336 @item @code{GIMPLE_DEBUG}               @tab x                  @tab x
337 @item @code{GIMPLE_EH_FILTER}           @tab x                  @tab
338 @item @code{GIMPLE_GOTO}                @tab x                  @tab x
339 @item @code{GIMPLE_LABEL}               @tab x                  @tab x
340 @item @code{GIMPLE_NOP}                 @tab x                  @tab x
341 @item @code{GIMPLE_OACC_PARALLEL}       @tab x                  @tab x
342 @item @code{GIMPLE_OMP_ATOMIC_LOAD}     @tab x                  @tab x
343 @item @code{GIMPLE_OMP_ATOMIC_STORE}    @tab x                  @tab x
344 @item @code{GIMPLE_OMP_CONTINUE}        @tab x                  @tab x
345 @item @code{GIMPLE_OMP_CRITICAL}        @tab x                  @tab x
346 @item @code{GIMPLE_OMP_FOR}             @tab x                  @tab x
347 @item @code{GIMPLE_OMP_MASTER}          @tab x                  @tab x
348 @item @code{GIMPLE_OMP_ORDERED}         @tab x                  @tab x
349 @item @code{GIMPLE_OMP_PARALLEL}        @tab x                  @tab x
350 @item @code{GIMPLE_OMP_RETURN}          @tab x                  @tab x
351 @item @code{GIMPLE_OMP_SECTION}         @tab x                  @tab x
352 @item @code{GIMPLE_OMP_SECTIONS}        @tab x                  @tab x
353 @item @code{GIMPLE_OMP_SECTIONS_SWITCH} @tab x                  @tab x
354 @item @code{GIMPLE_OMP_SINGLE}          @tab x                  @tab x
355 @item @code{GIMPLE_PHI}                 @tab                    @tab x
356 @item @code{GIMPLE_RESX}                @tab                    @tab x
357 @item @code{GIMPLE_RETURN}              @tab x                  @tab x
358 @item @code{GIMPLE_SWITCH}              @tab x                  @tab x
359 @item @code{GIMPLE_TRY}                 @tab x                  @tab
360 @end multitable
362 @node GIMPLE Exception Handling
363 @section Exception Handling
364 @cindex GIMPLE Exception Handling
366 Other exception handling constructs are represented using
367 @code{GIMPLE_TRY_CATCH}.  @code{GIMPLE_TRY_CATCH} has two operands.  The
368 first operand is a sequence of statements to execute.  If executing
369 these statements does not throw an exception, then the second operand
370 is ignored.  Otherwise, if an exception is thrown, then the second
371 operand of the @code{GIMPLE_TRY_CATCH} is checked.  The second
372 operand may have the following forms:
374 @enumerate
376 @item A sequence of statements to execute.  When an exception occurs,
377 these statements are executed, and then the exception is rethrown.
379 @item A sequence of @code{GIMPLE_CATCH} statements.  Each
380 @code{GIMPLE_CATCH} has a list of applicable exception types and
381 handler code.  If the thrown exception matches one of the caught
382 types, the associated handler code is executed.  If the handler
383 code falls off the bottom, execution continues after the original
384 @code{GIMPLE_TRY_CATCH}.
386 @item A @code{GIMPLE_EH_FILTER} statement.  This has a list of
387 permitted exception types, and code to handle a match failure.  If the
388 thrown exception does not match one of the allowed types, the
389 associated match failure code is executed.  If the thrown exception
390 does match, it continues unwinding the stack looking for the next
391 handler.
393 @end enumerate
395 Currently throwing an exception is not directly represented in
396 GIMPLE, since it is implemented by calling a function.  At some
397 point in the future we will want to add some way to express that
398 the call will throw an exception of a known type.
400 Just before running the optimizers, the compiler lowers the
401 high-level EH constructs above into a set of @samp{goto}s, magic
402 labels, and EH regions.  Continuing to unwind at the end of a
403 cleanup is represented with a @code{GIMPLE_RESX}.
406 @node Temporaries
407 @section Temporaries
408 @cindex Temporaries
410 When gimplification encounters a subexpression that is too
411 complex, it creates a new temporary variable to hold the value of
412 the subexpression, and adds a new statement to initialize it
413 before the current statement. These special temporaries are known
414 as @samp{expression temporaries}, and are allocated using
415 @code{get_formal_tmp_var}.  The compiler tries to always evaluate
416 identical expressions into the same temporary, to simplify
417 elimination of redundant calculations.
419 We can only use expression temporaries when we know that it will
420 not be reevaluated before its value is used, and that it will not
421 be otherwise modified@footnote{These restrictions are derived
422 from those in Morgan 4.8.}. Other temporaries can be allocated
423 using @code{get_initialized_tmp_var} or @code{create_tmp_var}.
425 Currently, an expression like @code{a = b + 5} is not reduced any
426 further.  We tried converting it to something like
427 @smallexample
428 T1 = b + 5;
429 a = T1;
430 @end smallexample
431 but this bloated the representation for minimal benefit.  However, a
432 variable which must live in memory cannot appear in an expression; its
433 value is explicitly loaded into a temporary first.  Similarly, storing
434 the value of an expression to a memory variable goes through a
435 temporary.
437 @node Operands
438 @section Operands
439 @cindex Operands
441 In general, expressions in GIMPLE consist of an operation and the
442 appropriate number of simple operands; these operands must either be a
443 GIMPLE rvalue (@code{is_gimple_val}), i.e.@: a constant or a register
444 variable.  More complex operands are factored out into temporaries, so
445 that
446 @smallexample
447 a = b + c + d
448 @end smallexample
449 becomes
450 @smallexample
451 T1 = b + c;
452 a = T1 + d;
453 @end smallexample
455 The same rule holds for arguments to a @code{GIMPLE_CALL}.
457 The target of an assignment is usually a variable, but can also be a
458 @code{MEM_REF} or a compound lvalue as described below.
460 @menu
461 * Compound Expressions::
462 * Compound Lvalues::
463 * Conditional Expressions::
464 * Logical Operators::
465 @end menu
467 @node Compound Expressions
468 @subsection Compound Expressions
469 @cindex Compound Expressions
471 The left-hand side of a C comma expression is simply moved into a separate
472 statement.
474 @node Compound Lvalues
475 @subsection Compound Lvalues
476 @cindex Compound Lvalues
478 Currently compound lvalues involving array and structure field references
479 are not broken down; an expression like @code{a.b[2] = 42} is not reduced
480 any further (though complex array subscripts are).  This restriction is a
481 workaround for limitations in later optimizers; if we were to convert this
484 @smallexample
485 T1 = &a.b;
486 T1[2] = 42;
487 @end smallexample
489 alias analysis would not remember that the reference to @code{T1[2]} came
490 by way of @code{a.b}, so it would think that the assignment could alias
491 another member of @code{a}; this broke @code{struct-alias-1.c}.  Future
492 optimizer improvements may make this limitation unnecessary.
494 @node Conditional Expressions
495 @subsection Conditional Expressions
496 @cindex Conditional Expressions
498 A C @code{?:} expression is converted into an @code{if} statement with
499 each branch assigning to the same temporary.  So,
501 @smallexample
502 a = b ? c : d;
503 @end smallexample
504 becomes
505 @smallexample
506 if (b == 1)
507   T1 = c;
508 else
509   T1 = d;
510 a = T1;
511 @end smallexample
513 The GIMPLE level if-conversion pass re-introduces @code{?:}
514 expression, if appropriate. It is used to vectorize loops with
515 conditions using vector conditional operations.
517 Note that in GIMPLE, @code{if} statements are represented using
518 @code{GIMPLE_COND}, as described below.
520 @node Logical Operators
521 @subsection Logical Operators
522 @cindex Logical Operators
524 Except when they appear in the condition operand of a
525 @code{GIMPLE_COND}, logical `and' and `or' operators are simplified
526 as follows: @code{a = b && c} becomes
528 @smallexample
529 T1 = (bool)b;
530 if (T1 == true)
531   T1 = (bool)c;
532 a = T1;
533 @end smallexample
535 Note that @code{T1} in this example cannot be an expression temporary,
536 because it has two different assignments.
538 @subsection Manipulating operands
540 All gimple operands are of type @code{tree}.  But only certain
541 types of trees are allowed to be used as operand tuples.  Basic
542 validation is controlled by the function
543 @code{get_gimple_rhs_class}, which given a tree code, returns an
544 @code{enum} with the following values of type @code{enum
545 gimple_rhs_class}
547 @itemize @bullet
548 @item @code{GIMPLE_INVALID_RHS}
549 The tree cannot be used as a GIMPLE operand.
551 @item @code{GIMPLE_TERNARY_RHS}
552 The tree is a valid GIMPLE ternary operation.
554 @item @code{GIMPLE_BINARY_RHS}
555 The tree is a valid GIMPLE binary operation.
557 @item @code{GIMPLE_UNARY_RHS}
558 The tree is a valid GIMPLE unary operation.
560 @item @code{GIMPLE_SINGLE_RHS}
561 The tree is a single object, that cannot be split into simpler
562 operands (for instance, @code{SSA_NAME}, @code{VAR_DECL}, @code{COMPONENT_REF}, etc).
564 This operand class also acts as an escape hatch for tree nodes
565 that may be flattened out into the operand vector, but would need
566 more than two slots on the RHS.  For instance, a @code{COND_EXPR}
567 expression of the form @code{(a op b) ? x : y} could be flattened
568 out on the operand vector using 4 slots, but it would also
569 require additional processing to distinguish @code{c = a op b}
570 from @code{c = a op b ? x : y}.  Something similar occurs with
571 @code{ASSERT_EXPR}.   In time, these special case tree
572 expressions should be flattened into the operand vector.
573 @end itemize
575 For tree nodes in the categories @code{GIMPLE_TERNARY_RHS},
576 @code{GIMPLE_BINARY_RHS} and @code{GIMPLE_UNARY_RHS}, they cannot be
577 stored inside tuples directly.  They first need to be flattened and
578 separated into individual components.  For instance, given the GENERIC
579 expression
581 @smallexample
582 a = b + c
583 @end smallexample
585 its tree representation is:
587 @smallexample
588 MODIFY_EXPR <VAR_DECL  <a>, PLUS_EXPR <VAR_DECL <b>, VAR_DECL <c>>>
589 @end smallexample
591 In this case, the GIMPLE form for this statement is logically
592 identical to its GENERIC form but in GIMPLE, the @code{PLUS_EXPR}
593 on the RHS of the assignment is not represented as a tree,
594 instead the two operands are taken out of the @code{PLUS_EXPR} sub-tree
595 and flattened into the GIMPLE tuple as follows:
597 @smallexample
598 GIMPLE_ASSIGN <PLUS_EXPR, VAR_DECL <a>, VAR_DECL <b>, VAR_DECL <c>>
599 @end smallexample
601 @subsection Operand vector allocation
603 The operand vector is stored at the bottom of the three tuple
604 structures that accept operands. This means, that depending on
605 the code of a given statement, its operand vector will be at
606 different offsets from the base of the structure.  To access
607 tuple operands use the following accessors
609 @deftypefn {GIMPLE function} unsigned gimple_num_ops (gimple g)
610 Returns the number of operands in statement G.
611 @end deftypefn
613 @deftypefn {GIMPLE function} tree gimple_op (gimple g, unsigned i)
614 Returns operand @code{I} from statement @code{G}.
615 @end deftypefn
617 @deftypefn {GIMPLE function} {tree *} gimple_ops (gimple g)
618 Returns a pointer into the operand vector for statement @code{G}.  This
619 is computed using an internal table called @code{gimple_ops_offset_}[].
620 This table is indexed by the gimple code of @code{G}.
622 When the compiler is built, this table is filled-in using the
623 sizes of the structures used by each statement code defined in
624 gimple.def.  Since the operand vector is at the bottom of the
625 structure, for a gimple code @code{C} the offset is computed as sizeof
626 (struct-of @code{C}) - sizeof (tree).
628 This mechanism adds one memory indirection to every access when
629 using @code{gimple_op}(), if this becomes a bottleneck, a pass can
630 choose to memoize the result from @code{gimple_ops}() and use that to
631 access the operands.
632 @end deftypefn
634 @subsection Operand validation
636 When adding a new operand to a gimple statement, the operand will
637 be validated according to what each tuple accepts in its operand
638 vector.  These predicates are called by the
639 @code{gimple_@var{name}_set_...()}.  Each tuple will use one of the
640 following predicates (Note, this list is not exhaustive):
642 @deftypefn {GIMPLE function} bool is_gimple_val (tree t)
643 Returns true if t is a "GIMPLE value", which are all the
644 non-addressable stack variables (variables for which
645 @code{is_gimple_reg} returns true) and constants (expressions for which
646 @code{is_gimple_min_invariant} returns true).
647 @end deftypefn
649 @deftypefn {GIMPLE function} bool is_gimple_addressable (tree t)
650 Returns true if t is a symbol or memory reference whose address
651 can be taken.
652 @end deftypefn
654 @deftypefn {GIMPLE function} bool is_gimple_asm_val (tree t)
655 Similar to @code{is_gimple_val} but it also accepts hard registers.
656 @end deftypefn
658 @deftypefn {GIMPLE function} bool is_gimple_call_addr (tree t)
659 Return true if t is a valid expression to use as the function
660 called by a @code{GIMPLE_CALL}.
661 @end deftypefn
663 @deftypefn {GIMPLE function} bool is_gimple_mem_ref_addr (tree t)
664 Return true if t is a valid expression to use as first operand
665 of a @code{MEM_REF} expression.
666 @end deftypefn
668 @deftypefn {GIMPLE function} bool is_gimple_constant (tree t)
669 Return true if t is a valid gimple constant.
670 @end deftypefn
672 @deftypefn {GIMPLE function} bool is_gimple_min_invariant (tree t)
673 Return true if t is a valid minimal invariant.  This is different
674 from constants, in that the specific value of t may not be known
675 at compile time, but it is known that it doesn't change (e.g.,
676 the address of a function local variable).
677 @end deftypefn
679 @deftypefn {GIMPLE function} bool is_gimple_ip_invariant (tree t)
680 Return true if t is an interprocedural invariant.  This means that t
681 is a valid invariant in all functions (e.g. it can be an address of a
682 global variable but not of a local one).
683 @end deftypefn
685 @deftypefn {GIMPLE function} bool is_gimple_ip_invariant_address (tree t)
686 Return true if t is an @code{ADDR_EXPR} that does not change once the
687 program is running (and which is valid in all functions).
688 @end deftypefn
691 @subsection Statement validation
693 @deftypefn {GIMPLE function} bool is_gimple_assign (gimple g)
694 Return true if the code of g is @code{GIMPLE_ASSIGN}.
695 @end deftypefn
697 @deftypefn {GIMPLE function} bool is_gimple_call (gimple g)
698 Return true if the code of g is @code{GIMPLE_CALL}.
699 @end deftypefn
701 @deftypefn {GIMPLE function} bool is_gimple_debug (gimple g)
702 Return true if the code of g is @code{GIMPLE_DEBUG}.
703 @end deftypefn
705 @deftypefn {GIMPLE function} bool gimple_assign_cast_p (gimple g)
706 Return true if g is a @code{GIMPLE_ASSIGN} that performs a type cast
707 operation.
708 @end deftypefn
710 @deftypefn {GIMPLE function} bool gimple_debug_bind_p (gimple g)
711 Return true if g is a @code{GIMPLE_DEBUG} that binds the value of an
712 expression to a variable.
713 @end deftypefn
715 @deftypefn {GIMPLE function} bool is_gimple_omp (gimple g)
716 Return true if g is any of the OpenMP codes.
717 @end deftypefn
719 @node Manipulating GIMPLE statements
720 @section Manipulating GIMPLE statements
721 @cindex Manipulating GIMPLE statements
723 This section documents all the functions available to handle each
724 of the GIMPLE instructions.
726 @subsection Common accessors
727 The following are common accessors for gimple statements.
729 @deftypefn {GIMPLE function} {enum gimple_code} gimple_code (gimple g)
730 Return the code for statement @code{G}.
731 @end deftypefn
733 @deftypefn {GIMPLE function} basic_block gimple_bb (gimple g)
734 Return the basic block to which statement @code{G} belongs to.
735 @end deftypefn
737 @deftypefn {GIMPLE function} tree gimple_block (gimple g)
738 Return the lexical scope block holding statement @code{G}.
739 @end deftypefn
741 @deftypefn {GIMPLE function} tree gimple_expr_type (gimple stmt)
742 Return the type of the main expression computed by @code{STMT}. Return
743 @code{void_type_node} if @code{STMT} computes nothing. This will only return
744 something meaningful for @code{GIMPLE_ASSIGN}, @code{GIMPLE_COND} and
745 @code{GIMPLE_CALL}.  For all other tuple codes, it will return
746 @code{void_type_node}.
747 @end deftypefn
749 @deftypefn {GIMPLE function} {enum tree_code} gimple_expr_code (gimple stmt)
750 Return the tree code for the expression computed by @code{STMT}.  This
751 is only meaningful for @code{GIMPLE_CALL}, @code{GIMPLE_ASSIGN} and
752 @code{GIMPLE_COND}.  If @code{STMT} is @code{GIMPLE_CALL}, it will return @code{CALL_EXPR}.
753 For @code{GIMPLE_COND}, it returns the code of the comparison predicate.
754 For @code{GIMPLE_ASSIGN} it returns the code of the operation performed
755 by the @code{RHS} of the assignment.
756 @end deftypefn
758 @deftypefn {GIMPLE function} void gimple_set_block (gimple g, tree block)
759 Set the lexical scope block of @code{G} to @code{BLOCK}.
760 @end deftypefn
762 @deftypefn {GIMPLE function} location_t gimple_locus (gimple g)
763 Return locus information for statement @code{G}.
764 @end deftypefn
766 @deftypefn {GIMPLE function} void gimple_set_locus (gimple g, location_t locus)
767 Set locus information for statement @code{G}.
768 @end deftypefn
770 @deftypefn {GIMPLE function} bool gimple_locus_empty_p (gimple g)
771 Return true if @code{G} does not have locus information.
772 @end deftypefn
774 @deftypefn {GIMPLE function} bool gimple_no_warning_p (gimple stmt)
775 Return true if no warnings should be emitted for statement @code{STMT}.
776 @end deftypefn
778 @deftypefn {GIMPLE function} void gimple_set_visited (gimple stmt, bool visited_p)
779 Set the visited status on statement @code{STMT} to @code{VISITED_P}.
780 @end deftypefn
782 @deftypefn {GIMPLE function} bool gimple_visited_p (gimple stmt)
783 Return the visited status on statement @code{STMT}.
784 @end deftypefn
786 @deftypefn {GIMPLE function} void gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
787 Set pass local flag @code{PLF} on statement @code{STMT} to @code{VAL_P}.
788 @end deftypefn
790 @deftypefn {GIMPLE function} {unsigned int} gimple_plf (gimple stmt, enum plf_mask plf)
791 Return the value of pass local flag @code{PLF} on statement @code{STMT}.
792 @end deftypefn
794 @deftypefn {GIMPLE function} bool gimple_has_ops (gimple g)
795 Return true if statement @code{G} has register or memory operands.
796 @end deftypefn
798 @deftypefn {GIMPLE function} bool gimple_has_mem_ops (gimple g)
799 Return true if statement @code{G} has memory operands.
800 @end deftypefn
802 @deftypefn {GIMPLE function} unsigned gimple_num_ops (gimple g)
803 Return the number of operands for statement @code{G}.
804 @end deftypefn
806 @deftypefn {GIMPLE function} {tree *} gimple_ops (gimple g)
807 Return the array of operands for statement @code{G}.
808 @end deftypefn
810 @deftypefn {GIMPLE function} tree gimple_op (gimple g, unsigned i)
811 Return operand @code{I} for statement @code{G}.
812 @end deftypefn
814 @deftypefn {GIMPLE function} {tree *} gimple_op_ptr (gimple g, unsigned i)
815 Return a pointer to operand @code{I} for statement @code{G}.
816 @end deftypefn
818 @deftypefn {GIMPLE function} void gimple_set_op (gimple g, unsigned i, tree op)
819 Set operand @code{I} of statement @code{G} to @code{OP}.
820 @end deftypefn
822 @deftypefn {GIMPLE function} bitmap gimple_addresses_taken (gimple stmt)
823 Return the set of symbols that have had their address taken by
824 @code{STMT}.
825 @end deftypefn
827 @deftypefn {GIMPLE function} {struct def_optype_d *} gimple_def_ops (gimple g)
828 Return the set of @code{DEF} operands for statement @code{G}.
829 @end deftypefn
831 @deftypefn {GIMPLE function} void gimple_set_def_ops (gimple g, struct def_optype_d *def)
832 Set @code{DEF} to be the set of @code{DEF} operands for statement @code{G}.
833 @end deftypefn
835 @deftypefn {GIMPLE function} {struct use_optype_d *} gimple_use_ops (gimple g)
836 Return the set of @code{USE} operands for statement @code{G}.
837 @end deftypefn
839 @deftypefn {GIMPLE function} void gimple_set_use_ops (gimple g, struct use_optype_d *use)
840 Set @code{USE} to be the set of @code{USE} operands for statement @code{G}.
841 @end deftypefn
843 @deftypefn {GIMPLE function} {struct voptype_d *} gimple_vuse_ops (gimple g)
844 Return the set of @code{VUSE} operands for statement @code{G}.
845 @end deftypefn
847 @deftypefn {GIMPLE function} void gimple_set_vuse_ops (gimple g, struct voptype_d *ops)
848 Set @code{OPS} to be the set of @code{VUSE} operands for statement @code{G}.
849 @end deftypefn
851 @deftypefn {GIMPLE function} {struct voptype_d *} gimple_vdef_ops (gimple g)
852 Return the set of @code{VDEF} operands for statement @code{G}.
853 @end deftypefn
855 @deftypefn {GIMPLE function} void gimple_set_vdef_ops (gimple g, struct voptype_d *ops)
856 Set @code{OPS} to be the set of @code{VDEF} operands for statement @code{G}.
857 @end deftypefn
859 @deftypefn {GIMPLE function} bitmap gimple_loaded_syms (gimple g)
860 Return the set of symbols loaded by statement @code{G}.  Each element of
861 the set is the @code{DECL_UID} of the corresponding symbol.
862 @end deftypefn
864 @deftypefn {GIMPLE function} bitmap gimple_stored_syms (gimple g)
865 Return the set of symbols stored by statement @code{G}.  Each element of
866 the set is the @code{DECL_UID} of the corresponding symbol.
867 @end deftypefn
869 @deftypefn {GIMPLE function} bool gimple_modified_p (gimple g)
870 Return true if statement @code{G} has operands and the modified field
871 has been set.
872 @end deftypefn
874 @deftypefn {GIMPLE function} bool gimple_has_volatile_ops (gimple stmt)
875 Return true if statement @code{STMT} contains volatile operands.
876 @end deftypefn
878 @deftypefn {GIMPLE function} void gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
879 Return true if statement @code{STMT} contains volatile operands.
880 @end deftypefn
882 @deftypefn {GIMPLE function} void update_stmt (gimple s)
883 Mark statement @code{S} as modified, and update it.
884 @end deftypefn
886 @deftypefn {GIMPLE function} void update_stmt_if_modified (gimple s)
887 Update statement @code{S} if it has been marked modified.
888 @end deftypefn
890 @deftypefn {GIMPLE function} gimple gimple_copy (gimple stmt)
891 Return a deep copy of statement @code{STMT}.
892 @end deftypefn
894 @node Tuple specific accessors
895 @section Tuple specific accessors
896 @cindex Tuple specific accessors
898 @menu
899 * @code{GIMPLE_ASM}::
900 * @code{GIMPLE_ASSIGN}::
901 * @code{GIMPLE_BIND}::
902 * @code{GIMPLE_CALL}::
903 * @code{GIMPLE_CATCH}::
904 * @code{GIMPLE_COND}::
905 * @code{GIMPLE_DEBUG}::
906 * @code{GIMPLE_EH_FILTER}::
907 * @code{GIMPLE_LABEL}::
908 * @code{GIMPLE_NOP}::
909 * @code{GIMPLE_OACC_PARALLEL}::
910 * @code{GIMPLE_OMP_ATOMIC_LOAD}::
911 * @code{GIMPLE_OMP_ATOMIC_STORE}::
912 * @code{GIMPLE_OMP_CONTINUE}::
913 * @code{GIMPLE_OMP_CRITICAL}::
914 * @code{GIMPLE_OMP_FOR}::
915 * @code{GIMPLE_OMP_MASTER}::
916 * @code{GIMPLE_OMP_ORDERED}::
917 * @code{GIMPLE_OMP_PARALLEL}::
918 * @code{GIMPLE_OMP_RETURN}::
919 * @code{GIMPLE_OMP_SECTION}::
920 * @code{GIMPLE_OMP_SECTIONS}::
921 * @code{GIMPLE_OMP_SINGLE}::
922 * @code{GIMPLE_PHI}::
923 * @code{GIMPLE_RESX}::
924 * @code{GIMPLE_RETURN}::
925 * @code{GIMPLE_SWITCH}::
926 * @code{GIMPLE_TRY}::
927 * @code{GIMPLE_WITH_CLEANUP_EXPR}::
928 @end menu
931 @node @code{GIMPLE_ASM}
932 @subsection @code{GIMPLE_ASM}
933 @cindex @code{GIMPLE_ASM}
935 @deftypefn {GIMPLE function} gimple gimple_build_asm (const char *string, ninputs, noutputs, nclobbers, ...)
936 Build a @code{GIMPLE_ASM} statement.  This statement is used for
937 building in-line assembly constructs.  @code{STRING} is the assembly
938 code.  @code{NINPUT} is the number of register inputs.  @code{NOUTPUT} is the
939 number of register outputs.  @code{NCLOBBERS} is the number of clobbered
940 registers.  The rest of the arguments trees for each input,
941 output, and clobbered registers.
942 @end deftypefn
944 @deftypefn {GIMPLE function} gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *, VEC(tree,gc) *)
945 Identical to gimple_build_asm, but the arguments are passed in
946 VECs.
947 @end deftypefn
949 @deftypefn {GIMPLE function} unsigned gimple_asm_ninputs (gimple g)
950 Return the number of input operands for @code{GIMPLE_ASM} @code{G}.
951 @end deftypefn
953 @deftypefn {GIMPLE function} unsigned gimple_asm_noutputs (gimple g)
954 Return the number of output operands for @code{GIMPLE_ASM} @code{G}.
955 @end deftypefn
957 @deftypefn {GIMPLE function} unsigned gimple_asm_nclobbers (gimple g)
958 Return the number of clobber operands for @code{GIMPLE_ASM} @code{G}.
959 @end deftypefn
961 @deftypefn {GIMPLE function} tree gimple_asm_input_op (gimple g, unsigned index)
962 Return input operand @code{INDEX} of @code{GIMPLE_ASM} @code{G}.
963 @end deftypefn
965 @deftypefn {GIMPLE function} void gimple_asm_set_input_op (gimple g, unsigned index, tree in_op)
966 Set @code{IN_OP} to be input operand @code{INDEX} in @code{GIMPLE_ASM} @code{G}.
967 @end deftypefn
969 @deftypefn {GIMPLE function} tree gimple_asm_output_op (gimple g, unsigned index)
970 Return output operand @code{INDEX} of @code{GIMPLE_ASM} @code{G}.
971 @end deftypefn
973 @deftypefn {GIMPLE function} void gimple_asm_set_output_op (gimple g, @
974 unsigned index, tree out_op)
975 Set @code{OUT_OP} to be output operand @code{INDEX} in @code{GIMPLE_ASM} @code{G}.
976 @end deftypefn
978 @deftypefn {GIMPLE function} tree gimple_asm_clobber_op (gimple g, unsigned index)
979 Return clobber operand @code{INDEX} of @code{GIMPLE_ASM} @code{G}.
980 @end deftypefn
982 @deftypefn {GIMPLE function} void gimple_asm_set_clobber_op (gimple g, unsigned index, tree clobber_op)
983 Set @code{CLOBBER_OP} to be clobber operand @code{INDEX} in @code{GIMPLE_ASM} @code{G}.
984 @end deftypefn
986 @deftypefn {GIMPLE function} {const char *} gimple_asm_string (gimple g)
987 Return the string representing the assembly instruction in
988 @code{GIMPLE_ASM} @code{G}.
989 @end deftypefn
991 @deftypefn {GIMPLE function} bool gimple_asm_volatile_p (gimple g)
992 Return true if @code{G} is an asm statement marked volatile.
993 @end deftypefn
995 @deftypefn {GIMPLE function} void gimple_asm_set_volatile (gimple g)
996 Mark asm statement @code{G} as volatile.
997 @end deftypefn
999 @deftypefn {GIMPLE function} void gimple_asm_clear_volatile (gimple g)
1000 Remove volatile marker from asm statement @code{G}.
1001 @end deftypefn
1003 @node @code{GIMPLE_ASSIGN}
1004 @subsection @code{GIMPLE_ASSIGN}
1005 @cindex @code{GIMPLE_ASSIGN}
1007 @deftypefn {GIMPLE function} gimple gimple_build_assign (tree lhs, tree rhs)
1008 Build a @code{GIMPLE_ASSIGN} statement.  The left-hand side is an lvalue
1009 passed in lhs.  The right-hand side can be either a unary or
1010 binary tree expression.  The expression tree rhs will be
1011 flattened and its operands assigned to the corresponding operand
1012 slots in the new statement.  This function is useful when you
1013 already have a tree expression that you want to convert into a
1014 tuple.  However, try to avoid building expression trees for the
1015 sole purpose of calling this function.  If you already have the
1016 operands in separate trees, it is better to use
1017 @code{gimple_build_assign_with_ops}.
1018 @end deftypefn
1021 @deftypefn {GIMPLE function} gimple gimplify_assign (tree dst, tree src, gimple_seq *seq_p)
1022 Build a new @code{GIMPLE_ASSIGN} tuple and append it to the end of
1023 @code{*SEQ_P}.
1024 @end deftypefn
1026 @code{DST}/@code{SRC} are the destination and source respectively.  You can
1027 pass ungimplified trees in @code{DST} or @code{SRC}, in which
1028 case they will be converted to a gimple operand if necessary.
1030 This function returns the newly created @code{GIMPLE_ASSIGN} tuple.
1032 @deftypefn {GIMPLE function} gimple gimple_build_assign_with_ops @
1033 (enum tree_code subcode, tree lhs, tree op1, tree op2)
1034 This function is similar to @code{gimple_build_assign}, but is used to
1035 build a @code{GIMPLE_ASSIGN} statement when the operands of the
1036 right-hand side of the assignment are already split into
1037 different operands.
1039 The left-hand side is an lvalue passed in lhs.  Subcode is the
1040 @code{tree_code} for the right-hand side of the assignment.  Op1 and op2
1041 are the operands.  If op2 is null, subcode must be a @code{tree_code}
1042 for a unary expression.
1043 @end deftypefn
1045 @deftypefn {GIMPLE function} {enum tree_code} gimple_assign_rhs_code (gimple g)
1046 Return the code of the expression computed on the @code{RHS} of
1047 assignment statement @code{G}.
1048 @end deftypefn
1051 @deftypefn {GIMPLE function} {enum gimple_rhs_class} gimple_assign_rhs_class (gimple g)
1052 Return the gimple rhs class of the code for the expression
1053 computed on the rhs of assignment statement @code{G}.  This will never
1054 return @code{GIMPLE_INVALID_RHS}.
1055 @end deftypefn
1057 @deftypefn {GIMPLE function} tree gimple_assign_lhs (gimple g)
1058 Return the @code{LHS} of assignment statement @code{G}.
1059 @end deftypefn
1061 @deftypefn {GIMPLE function} {tree *} gimple_assign_lhs_ptr (gimple g)
1062 Return a pointer to the @code{LHS} of assignment statement @code{G}.
1063 @end deftypefn
1065 @deftypefn {GIMPLE function} tree gimple_assign_rhs1 (gimple g)
1066 Return the first operand on the @code{RHS} of assignment statement @code{G}.
1067 @end deftypefn
1069 @deftypefn {GIMPLE function} {tree *} gimple_assign_rhs1_ptr (gimple g)
1070 Return the address of the first operand on the @code{RHS} of assignment
1071 statement @code{G}.
1072 @end deftypefn
1074 @deftypefn {GIMPLE function} tree gimple_assign_rhs2 (gimple g)
1075 Return the second operand on the @code{RHS} of assignment statement @code{G}.
1076 @end deftypefn
1078 @deftypefn {GIMPLE function} {tree *} gimple_assign_rhs2_ptr (gimple g)
1079 Return the address of the second operand on the @code{RHS} of assignment
1080 statement @code{G}.
1081 @end deftypefn
1083 @deftypefn {GIMPLE function} tree gimple_assign_rhs3 (gimple g)
1084 Return the third operand on the @code{RHS} of assignment statement @code{G}.
1085 @end deftypefn
1087 @deftypefn {GIMPLE function} {tree *} gimple_assign_rhs3_ptr (gimple g)
1088 Return the address of the third operand on the @code{RHS} of assignment
1089 statement @code{G}.
1090 @end deftypefn
1092 @deftypefn {GIMPLE function} void gimple_assign_set_lhs (gimple g, tree lhs)
1093 Set @code{LHS} to be the @code{LHS} operand of assignment statement @code{G}.
1094 @end deftypefn
1096 @deftypefn {GIMPLE function} void gimple_assign_set_rhs1 (gimple g, tree rhs)
1097 Set @code{RHS} to be the first operand on the @code{RHS} of assignment
1098 statement @code{G}.
1099 @end deftypefn
1101 @deftypefn {GIMPLE function} void gimple_assign_set_rhs2 (gimple g, tree rhs)
1102 Set @code{RHS} to be the second operand on the @code{RHS} of assignment
1103 statement @code{G}.
1104 @end deftypefn
1106 @deftypefn {GIMPLE function} void gimple_assign_set_rhs3 (gimple g, tree rhs)
1107 Set @code{RHS} to be the third operand on the @code{RHS} of assignment
1108 statement @code{G}.
1109 @end deftypefn
1111 @deftypefn {GIMPLE function} bool gimple_assign_cast_p (gimple s)
1112 Return true if @code{S} is a type-cast assignment.
1113 @end deftypefn
1116 @node @code{GIMPLE_BIND}
1117 @subsection @code{GIMPLE_BIND}
1118 @cindex @code{GIMPLE_BIND}
1120 @deftypefn {GIMPLE function} gimple gimple_build_bind (tree vars, gimple_seq body)
1121 Build a @code{GIMPLE_BIND} statement with a list of variables in @code{VARS}
1122 and a body of statements in sequence @code{BODY}.
1123 @end deftypefn
1125 @deftypefn {GIMPLE function} tree gimple_bind_vars (gimple g)
1126 Return the variables declared in the @code{GIMPLE_BIND} statement @code{G}.
1127 @end deftypefn
1129 @deftypefn {GIMPLE function} void gimple_bind_set_vars (gimple g, tree vars)
1130 Set @code{VARS} to be the set of variables declared in the @code{GIMPLE_BIND}
1131 statement @code{G}.
1132 @end deftypefn
1134 @deftypefn {GIMPLE function} void gimple_bind_append_vars (gimple g, tree vars)
1135 Append @code{VARS} to the set of variables declared in the @code{GIMPLE_BIND}
1136 statement @code{G}.
1137 @end deftypefn
1139 @deftypefn {GIMPLE function} gimple_seq gimple_bind_body (gimple g)
1140 Return the GIMPLE sequence contained in the @code{GIMPLE_BIND} statement
1141 @code{G}.
1142 @end deftypefn
1144 @deftypefn {GIMPLE function} void gimple_bind_set_body (gimple g, gimple_seq seq)
1145 Set @code{SEQ} to be sequence contained in the @code{GIMPLE_BIND} statement @code{G}.
1146 @end deftypefn
1148 @deftypefn {GIMPLE function} void gimple_bind_add_stmt (gimple gs, gimple stmt)
1149 Append a statement to the end of a @code{GIMPLE_BIND}'s body.
1150 @end deftypefn
1152 @deftypefn {GIMPLE function} void gimple_bind_add_seq (gimple gs, gimple_seq seq)
1153 Append a sequence of statements to the end of a @code{GIMPLE_BIND}'s
1154 body.
1155 @end deftypefn
1157 @deftypefn {GIMPLE function} tree gimple_bind_block (gimple g)
1158 Return the @code{TREE_BLOCK} node associated with @code{GIMPLE_BIND} statement
1159 @code{G}. This is analogous to the @code{BIND_EXPR_BLOCK} field in trees.
1160 @end deftypefn
1162 @deftypefn {GIMPLE function} void gimple_bind_set_block (gimple g, tree block)
1163 Set @code{BLOCK} to be the @code{TREE_BLOCK} node associated with @code{GIMPLE_BIND}
1164 statement @code{G}.
1165 @end deftypefn
1168 @node @code{GIMPLE_CALL}
1169 @subsection @code{GIMPLE_CALL}
1170 @cindex @code{GIMPLE_CALL}
1172 @deftypefn {GIMPLE function} gimple gimple_build_call (tree fn, unsigned nargs, ...)
1173 Build a @code{GIMPLE_CALL} statement to function @code{FN}.  The argument @code{FN}
1174 must be either a @code{FUNCTION_DECL} or a gimple call address as
1175 determined by @code{is_gimple_call_addr}.  @code{NARGS} are the number of
1176 arguments.  The rest of the arguments follow the argument @code{NARGS},
1177 and must be trees that are valid as rvalues in gimple (i.e., each
1178 operand is validated with @code{is_gimple_operand}).
1179 @end deftypefn
1182 @deftypefn {GIMPLE function} gimple gimple_build_call_from_tree (tree call_expr)
1183 Build a @code{GIMPLE_CALL} from a @code{CALL_EXPR} node.  The arguments and the
1184 function are taken from the expression directly.  This routine
1185 assumes that @code{call_expr} is already in GIMPLE form.  That is, its
1186 operands are GIMPLE values and the function call needs no further
1187 simplification.  All the call flags in @code{call_expr} are copied over
1188 to the new @code{GIMPLE_CALL}.
1189 @end deftypefn
1191 @deftypefn {GIMPLE function} gimple gimple_build_call_vec (tree fn, @code{VEC}(tree, heap) *args)
1192 Identical to @code{gimple_build_call} but the arguments are stored in a
1193 @code{VEC}().
1194 @end deftypefn
1196 @deftypefn {GIMPLE function} tree gimple_call_lhs (gimple g)
1197 Return the @code{LHS} of call statement @code{G}.
1198 @end deftypefn
1200 @deftypefn {GIMPLE function} {tree *} gimple_call_lhs_ptr (gimple g)
1201 Return a pointer to the @code{LHS} of call statement @code{G}.
1202 @end deftypefn
1204 @deftypefn {GIMPLE function} void gimple_call_set_lhs (gimple g, tree lhs)
1205 Set @code{LHS} to be the @code{LHS} operand of call statement @code{G}.
1206 @end deftypefn
1208 @deftypefn {GIMPLE function} tree gimple_call_fn (gimple g)
1209 Return the tree node representing the function called by call
1210 statement @code{G}.
1211 @end deftypefn
1213 @deftypefn {GIMPLE function} void gimple_call_set_fn (gimple g, tree fn)
1214 Set @code{FN} to be the function called by call statement @code{G}.  This has
1215 to be a gimple value specifying the address of the called
1216 function.
1217 @end deftypefn
1219 @deftypefn {GIMPLE function} tree gimple_call_fndecl (gimple g)
1220 If a given @code{GIMPLE_CALL}'s callee is a @code{FUNCTION_DECL}, return it.
1221 Otherwise return @code{NULL}.  This function is analogous to
1222 @code{get_callee_fndecl} in @code{GENERIC}.
1223 @end deftypefn
1225 @deftypefn {GIMPLE function} tree gimple_call_set_fndecl (gimple g, tree fndecl)
1226 Set the called function to @code{FNDECL}.
1227 @end deftypefn
1229 @deftypefn {GIMPLE function} tree gimple_call_return_type (gimple g)
1230 Return the type returned by call statement @code{G}.
1231 @end deftypefn
1233 @deftypefn {GIMPLE function} tree gimple_call_chain (gimple g)
1234 Return the static chain for call statement @code{G}.
1235 @end deftypefn
1237 @deftypefn {GIMPLE function} void gimple_call_set_chain (gimple g, tree chain)
1238 Set @code{CHAIN} to be the static chain for call statement @code{G}.
1239 @end deftypefn
1241 @deftypefn {GIMPLE function} unsigned gimple_call_num_args (gimple g)
1242 Return the number of arguments used by call statement @code{G}.
1243 @end deftypefn
1245 @deftypefn {GIMPLE function} tree gimple_call_arg (gimple g, unsigned index)
1246 Return the argument at position @code{INDEX} for call statement @code{G}.  The
1247 first argument is 0.
1248 @end deftypefn
1250 @deftypefn {GIMPLE function} {tree *} gimple_call_arg_ptr (gimple g, unsigned index)
1251 Return a pointer to the argument at position @code{INDEX} for call
1252 statement @code{G}.
1253 @end deftypefn
1255 @deftypefn {GIMPLE function} void gimple_call_set_arg (gimple g, unsigned index, tree arg)
1256 Set @code{ARG} to be the argument at position @code{INDEX} for call statement
1257 @code{G}.
1258 @end deftypefn
1260 @deftypefn {GIMPLE function} void gimple_call_set_tail (gimple s)
1261 Mark call statement @code{S} as being a tail call (i.e., a call just
1262 before the exit of a function). These calls are candidate for
1263 tail call optimization.
1264 @end deftypefn
1266 @deftypefn {GIMPLE function} bool gimple_call_tail_p (gimple s)
1267 Return true if @code{GIMPLE_CALL} @code{S} is marked as a tail call.
1268 @end deftypefn
1270 @deftypefn {GIMPLE function} void gimple_call_mark_uninlinable (gimple s)
1271 Mark @code{GIMPLE_CALL} @code{S} as being uninlinable.
1272 @end deftypefn
1274 @deftypefn {GIMPLE function} bool gimple_call_cannot_inline_p (gimple s)
1275 Return true if @code{GIMPLE_CALL} @code{S} cannot be inlined.
1276 @end deftypefn
1278 @deftypefn {GIMPLE function} bool gimple_call_noreturn_p (gimple s)
1279 Return true if @code{S} is a noreturn call.
1280 @end deftypefn
1282 @deftypefn {GIMPLE function} gimple gimple_call_copy_skip_args (gimple stmt, bitmap args_to_skip)
1283 Build a @code{GIMPLE_CALL} identical to @code{STMT} but skipping the arguments
1284 in the positions marked by the set @code{ARGS_TO_SKIP}.
1285 @end deftypefn
1288 @node @code{GIMPLE_CATCH}
1289 @subsection @code{GIMPLE_CATCH}
1290 @cindex @code{GIMPLE_CATCH}
1292 @deftypefn {GIMPLE function} gimple gimple_build_catch (tree types, gimple_seq handler)
1293 Build a @code{GIMPLE_CATCH} statement.  @code{TYPES} are the tree types this
1294 catch handles.  @code{HANDLER} is a sequence of statements with the code
1295 for the handler.
1296 @end deftypefn
1298 @deftypefn {GIMPLE function} tree gimple_catch_types (gimple g)
1299 Return the types handled by @code{GIMPLE_CATCH} statement @code{G}.
1300 @end deftypefn
1302 @deftypefn {GIMPLE function} {tree *} gimple_catch_types_ptr (gimple g)
1303 Return a pointer to the types handled by @code{GIMPLE_CATCH} statement
1304 @code{G}.
1305 @end deftypefn
1307 @deftypefn {GIMPLE function} gimple_seq gimple_catch_handler (gimple g)
1308 Return the GIMPLE sequence representing the body of the handler
1309 of @code{GIMPLE_CATCH} statement @code{G}.
1310 @end deftypefn
1312 @deftypefn {GIMPLE function} void gimple_catch_set_types (gimple g, tree t)
1313 Set @code{T} to be the set of types handled by @code{GIMPLE_CATCH} @code{G}.
1314 @end deftypefn
1316 @deftypefn {GIMPLE function} void gimple_catch_set_handler (gimple g, gimple_seq handler)
1317 Set @code{HANDLER} to be the body of @code{GIMPLE_CATCH} @code{G}.
1318 @end deftypefn
1321 @node @code{GIMPLE_COND}
1322 @subsection @code{GIMPLE_COND}
1323 @cindex @code{GIMPLE_COND}
1325 @deftypefn {GIMPLE function} gimple gimple_build_cond (enum tree_code pred_code, tree lhs, tree rhs, tree t_label, tree f_label)
1326 Build a @code{GIMPLE_COND} statement.  @code{A} @code{GIMPLE_COND} statement compares
1327 @code{LHS} and @code{RHS} and if the condition in @code{PRED_CODE} is true, jump to
1328 the label in @code{t_label}, otherwise jump to the label in @code{f_label}.
1329 @code{PRED_CODE} are relational operator tree codes like @code{EQ_EXPR},
1330 @code{LT_EXPR}, @code{LE_EXPR}, @code{NE_EXPR}, etc.
1331 @end deftypefn
1334 @deftypefn {GIMPLE function} gimple gimple_build_cond_from_tree (tree cond, tree t_label, tree f_label)
1335 Build a @code{GIMPLE_COND} statement from the conditional expression
1336 tree @code{COND}.  @code{T_LABEL} and @code{F_LABEL} are as in @code{gimple_build_cond}.
1337 @end deftypefn
1339 @deftypefn {GIMPLE function} {enum tree_code} gimple_cond_code (gimple g)
1340 Return the code of the predicate computed by conditional
1341 statement @code{G}.
1342 @end deftypefn
1344 @deftypefn {GIMPLE function} void gimple_cond_set_code (gimple g, enum tree_code code)
1345 Set @code{CODE} to be the predicate code for the conditional statement
1346 @code{G}.
1347 @end deftypefn
1349 @deftypefn {GIMPLE function} tree gimple_cond_lhs (gimple g)
1350 Return the @code{LHS} of the predicate computed by conditional statement
1351 @code{G}.
1352 @end deftypefn
1354 @deftypefn {GIMPLE function} void gimple_cond_set_lhs (gimple g, tree lhs)
1355 Set @code{LHS} to be the @code{LHS} operand of the predicate computed by
1356 conditional statement @code{G}.
1357 @end deftypefn
1359 @deftypefn {GIMPLE function} tree gimple_cond_rhs (gimple g)
1360 Return the @code{RHS} operand of the predicate computed by conditional
1361 @code{G}.
1362 @end deftypefn
1364 @deftypefn {GIMPLE function} void gimple_cond_set_rhs (gimple g, tree rhs)
1365 Set @code{RHS} to be the @code{RHS} operand of the predicate computed by
1366 conditional statement @code{G}.
1367 @end deftypefn
1369 @deftypefn {GIMPLE function} tree gimple_cond_true_label (gimple g)
1370 Return the label used by conditional statement @code{G} when its
1371 predicate evaluates to true.
1372 @end deftypefn
1374 @deftypefn {GIMPLE function} void gimple_cond_set_true_label (gimple g, tree label)
1375 Set @code{LABEL} to be the label used by conditional statement @code{G} when
1376 its predicate evaluates to true.
1377 @end deftypefn
1379 @deftypefn {GIMPLE function} void gimple_cond_set_false_label (gimple g, tree label)
1380 Set @code{LABEL} to be the label used by conditional statement @code{G} when
1381 its predicate evaluates to false.
1382 @end deftypefn
1384 @deftypefn {GIMPLE function} tree gimple_cond_false_label (gimple g)
1385 Return the label used by conditional statement @code{G} when its
1386 predicate evaluates to false.
1387 @end deftypefn
1389 @deftypefn {GIMPLE function} void gimple_cond_make_false (gimple g)
1390 Set the conditional @code{COND_STMT} to be of the form 'if (1 == 0)'.
1391 @end deftypefn
1393 @deftypefn {GIMPLE function} void gimple_cond_make_true (gimple g)
1394 Set the conditional @code{COND_STMT} to be of the form 'if (1 == 1)'.
1395 @end deftypefn
1397 @node @code{GIMPLE_DEBUG}
1398 @subsection @code{GIMPLE_DEBUG}
1399 @cindex @code{GIMPLE_DEBUG}
1400 @cindex @code{GIMPLE_DEBUG_BIND}
1402 @deftypefn {GIMPLE function} gimple gimple_build_debug_bind (tree var, tree value, gimple stmt)
1403 Build a @code{GIMPLE_DEBUG} statement with @code{GIMPLE_DEBUG_BIND} of
1404 @code{subcode}.  The effect of this statement is to tell debug
1405 information generation machinery that the value of user variable
1406 @code{var} is given by @code{value} at that point, and to remain with
1407 that value until @code{var} runs out of scope, a
1408 dynamically-subsequent debug bind statement overrides the binding, or
1409 conflicting values reach a control flow merge point.  Even if
1410 components of the @code{value} expression change afterwards, the
1411 variable is supposed to retain the same value, though not necessarily
1412 the same location.
1414 It is expected that @code{var} be most often a tree for automatic user
1415 variables (@code{VAR_DECL} or @code{PARM_DECL}) that satisfy the
1416 requirements for gimple registers, but it may also be a tree for a
1417 scalarized component of a user variable (@code{ARRAY_REF},
1418 @code{COMPONENT_REF}), or a debug temporary (@code{DEBUG_EXPR_DECL}).
1420 As for @code{value}, it can be an arbitrary tree expression, but it is
1421 recommended that it be in a suitable form for a gimple assignment
1422 @code{RHS}.  It is not expected that user variables that could appear
1423 as @code{var} ever appear in @code{value}, because in the latter we'd
1424 have their @code{SSA_NAME}s instead, but even if they were not in SSA
1425 form, user variables appearing in @code{value} are to be regarded as
1426 part of the executable code space, whereas those in @code{var} are to
1427 be regarded as part of the source code space.  There is no way to
1428 refer to the value bound to a user variable within a @code{value}
1429 expression.
1431 If @code{value} is @code{GIMPLE_DEBUG_BIND_NOVALUE}, debug information
1432 generation machinery is informed that the variable @code{var} is
1433 unbound, i.e., that its value is indeterminate, which sometimes means
1434 it is really unavailable, and other times that the compiler could not
1435 keep track of it.
1437 Block and location information for the newly-created stmt are
1438 taken from @code{stmt}, if given.
1439 @end deftypefn
1441 @deftypefn {GIMPLE function} tree gimple_debug_bind_get_var (gimple stmt)
1442 Return the user variable @var{var} that is bound at @code{stmt}.
1443 @end deftypefn
1445 @deftypefn {GIMPLE function} tree gimple_debug_bind_get_value (gimple stmt)
1446 Return the value expression that is bound to a user variable at
1447 @code{stmt}.
1448 @end deftypefn
1450 @deftypefn {GIMPLE function} {tree *} gimple_debug_bind_get_value_ptr (gimple stmt)
1451 Return a pointer to the value expression that is bound to a user
1452 variable at @code{stmt}.
1453 @end deftypefn
1455 @deftypefn {GIMPLE function} void gimple_debug_bind_set_var (gimple stmt, tree var)
1456 Modify the user variable bound at @code{stmt} to @var{var}.
1457 @end deftypefn
1459 @deftypefn {GIMPLE function} void gimple_debug_bind_set_value (gimple stmt, tree var)
1460 Modify the value bound to the user variable bound at @code{stmt} to
1461 @var{value}.
1462 @end deftypefn
1464 @deftypefn {GIMPLE function} void gimple_debug_bind_reset_value (gimple stmt)
1465 Modify the value bound to the user variable bound at @code{stmt} so
1466 that the variable becomes unbound.
1467 @end deftypefn
1469 @deftypefn {GIMPLE function} bool gimple_debug_bind_has_value_p (gimple stmt)
1470 Return @code{TRUE} if @code{stmt} binds a user variable to a value,
1471 and @code{FALSE} if it unbinds the variable.
1472 @end deftypefn
1474 @node @code{GIMPLE_EH_FILTER}
1475 @subsection @code{GIMPLE_EH_FILTER}
1476 @cindex @code{GIMPLE_EH_FILTER}
1478 @deftypefn {GIMPLE function} gimple gimple_build_eh_filter (tree types, gimple_seq failure)
1479 Build a @code{GIMPLE_EH_FILTER} statement.  @code{TYPES} are the filter's
1480 types.  @code{FAILURE} is a sequence with the filter's failure action.
1481 @end deftypefn
1483 @deftypefn {GIMPLE function} tree gimple_eh_filter_types (gimple g)
1484 Return the types handled by @code{GIMPLE_EH_FILTER} statement @code{G}.
1485 @end deftypefn
1487 @deftypefn {GIMPLE function} {tree *} gimple_eh_filter_types_ptr (gimple g)
1488 Return a pointer to the types handled by @code{GIMPLE_EH_FILTER}
1489 statement @code{G}.
1490 @end deftypefn
1492 @deftypefn {GIMPLE function} gimple_seq gimple_eh_filter_failure (gimple g)
1493 Return the sequence of statement to execute when @code{GIMPLE_EH_FILTER}
1494 statement fails.
1495 @end deftypefn
1497 @deftypefn {GIMPLE function} void gimple_eh_filter_set_types (gimple g, tree types)
1498 Set @code{TYPES} to be the set of types handled by @code{GIMPLE_EH_FILTER} @code{G}.
1499 @end deftypefn
1501 @deftypefn {GIMPLE function} void gimple_eh_filter_set_failure (gimple g, gimple_seq failure)
1502 Set @code{FAILURE} to be the sequence of statements to execute on
1503 failure for @code{GIMPLE_EH_FILTER} @code{G}.
1504 @end deftypefn
1506 @deftypefn {GIMPLE function} bool gimple_eh_filter_must_not_throw (gimple g)
1507 Return the @code{EH_FILTER_MUST_NOT_THROW} flag.
1508 @end deftypefn
1510 @deftypefn {GIMPLE function} void gimple_eh_filter_set_must_not_throw (gimple g, bool mntp)
1511 Set the @code{EH_FILTER_MUST_NOT_THROW} flag.
1512 @end deftypefn
1515 @node @code{GIMPLE_LABEL}
1516 @subsection @code{GIMPLE_LABEL}
1517 @cindex @code{GIMPLE_LABEL}
1519 @deftypefn {GIMPLE function} gimple gimple_build_label (tree label)
1520 Build a @code{GIMPLE_LABEL} statement with corresponding to the tree
1521 label, @code{LABEL}.
1522 @end deftypefn
1524 @deftypefn {GIMPLE function} tree gimple_label_label (gimple g)
1525 Return the @code{LABEL_DECL} node used by @code{GIMPLE_LABEL} statement @code{G}.
1526 @end deftypefn
1528 @deftypefn {GIMPLE function} void gimple_label_set_label (gimple g, tree label)
1529 Set @code{LABEL} to be the @code{LABEL_DECL} node used by @code{GIMPLE_LABEL}
1530 statement @code{G}.
1531 @end deftypefn
1534 @deftypefn {GIMPLE function} gimple gimple_build_goto (tree dest)
1535 Build a @code{GIMPLE_GOTO} statement to label @code{DEST}.
1536 @end deftypefn
1538 @deftypefn {GIMPLE function} tree gimple_goto_dest (gimple g)
1539 Return the destination of the unconditional jump @code{G}.
1540 @end deftypefn
1542 @deftypefn {GIMPLE function} void gimple_goto_set_dest (gimple g, tree dest)
1543 Set @code{DEST} to be the destination of the unconditional jump @code{G}.
1544 @end deftypefn
1547 @node @code{GIMPLE_NOP}
1548 @subsection @code{GIMPLE_NOP}
1549 @cindex @code{GIMPLE_NOP}
1551 @deftypefn {GIMPLE function} gimple gimple_build_nop (void)
1552 Build a @code{GIMPLE_NOP} statement.
1553 @end deftypefn
1555 @deftypefn {GIMPLE function} bool gimple_nop_p (gimple g)
1556 Returns @code{TRUE} if statement @code{G} is a @code{GIMPLE_NOP}.
1557 @end deftypefn
1560 @node @code{GIMPLE_OACC_PARALLEL}
1561 @subsection @code{GIMPLE_OACC_PARALLEL}
1562 @cindex @code{GIMPLE_OACC_PARALLEL}
1565 @node @code{GIMPLE_OMP_ATOMIC_LOAD}
1566 @subsection @code{GIMPLE_OMP_ATOMIC_LOAD}
1567 @cindex @code{GIMPLE_OMP_ATOMIC_LOAD}
1569 @deftypefn {GIMPLE function} gimple gimple_build_omp_atomic_load (tree lhs, tree rhs)
1570 Build a @code{GIMPLE_OMP_ATOMIC_LOAD} statement.  @code{LHS} is the left-hand
1571 side of the assignment.  @code{RHS} is the right-hand side of the
1572 assignment.
1573 @end deftypefn
1575 @deftypefn {GIMPLE function} void gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
1576 Set the @code{LHS} of an atomic load.
1577 @end deftypefn
1579 @deftypefn {GIMPLE function} tree gimple_omp_atomic_load_lhs (gimple g)
1580 Get the @code{LHS} of an atomic load.
1581 @end deftypefn
1583 @deftypefn {GIMPLE function} void gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
1584 Set the @code{RHS} of an atomic set.
1585 @end deftypefn
1587 @deftypefn {GIMPLE function} tree gimple_omp_atomic_load_rhs (gimple g)
1588 Get the @code{RHS} of an atomic set.
1589 @end deftypefn
1592 @node @code{GIMPLE_OMP_ATOMIC_STORE}
1593 @subsection @code{GIMPLE_OMP_ATOMIC_STORE}
1594 @cindex @code{GIMPLE_OMP_ATOMIC_STORE}
1596 @deftypefn {GIMPLE function} gimple gimple_build_omp_atomic_store (tree val)
1597 Build a @code{GIMPLE_OMP_ATOMIC_STORE} statement. @code{VAL} is the value to be
1598 stored.
1599 @end deftypefn
1601 @deftypefn {GIMPLE function} void gimple_omp_atomic_store_set_val (gimple g, tree val)
1602 Set the value being stored in an atomic store.
1603 @end deftypefn
1605 @deftypefn {GIMPLE function} tree gimple_omp_atomic_store_val (gimple g)
1606 Return the value being stored in an atomic store.
1607 @end deftypefn
1609 @node @code{GIMPLE_OMP_CONTINUE}
1610 @subsection @code{GIMPLE_OMP_CONTINUE}
1611 @cindex @code{GIMPLE_OMP_CONTINUE}
1613 @deftypefn {GIMPLE function} gimple gimple_build_omp_continue (tree control_def, tree control_use)
1614 Build a @code{GIMPLE_OMP_CONTINUE} statement.  @code{CONTROL_DEF} is the
1615 definition of the control variable.  @code{CONTROL_USE} is the use of
1616 the control variable.
1617 @end deftypefn
1619 @deftypefn {GIMPLE function} tree gimple_omp_continue_control_def (gimple s)
1620 Return the definition of the control variable on a
1621 @code{GIMPLE_OMP_CONTINUE} in @code{S}.
1622 @end deftypefn
1624 @deftypefn {GIMPLE function} tree gimple_omp_continue_control_def_ptr (gimple s)
1625 Same as above, but return the pointer.
1626 @end deftypefn
1628 @deftypefn {GIMPLE function} tree gimple_omp_continue_set_control_def (gimple s)
1629 Set the control variable definition for a @code{GIMPLE_OMP_CONTINUE}
1630 statement in @code{S}.
1631 @end deftypefn
1633 @deftypefn {GIMPLE function} tree gimple_omp_continue_control_use (gimple s)
1634 Return the use of the control variable on a @code{GIMPLE_OMP_CONTINUE}
1635 in @code{S}.
1636 @end deftypefn
1638 @deftypefn {GIMPLE function} tree gimple_omp_continue_control_use_ptr (gimple s)
1639 Same as above, but return the pointer.
1640 @end deftypefn
1642 @deftypefn {GIMPLE function} tree gimple_omp_continue_set_control_use (gimple s)
1643 Set the control variable use for a @code{GIMPLE_OMP_CONTINUE} statement
1644 in @code{S}.
1645 @end deftypefn
1648 @node @code{GIMPLE_OMP_CRITICAL}
1649 @subsection @code{GIMPLE_OMP_CRITICAL}
1650 @cindex @code{GIMPLE_OMP_CRITICAL}
1652 @deftypefn {GIMPLE function} gimple gimple_build_omp_critical (gimple_seq body, tree name)
1653 Build a @code{GIMPLE_OMP_CRITICAL} statement. @code{BODY} is the sequence of
1654 statements for which only one thread can execute.  @code{NAME} is an
1655 optional identifier for this critical block.
1656 @end deftypefn
1658 @deftypefn {GIMPLE function} tree gimple_omp_critical_name (gimple g)
1659 Return the name associated with @code{OMP_CRITICAL} statement @code{G}.
1660 @end deftypefn
1662 @deftypefn {GIMPLE function} {tree *} gimple_omp_critical_name_ptr (gimple g)
1663 Return a pointer to the name associated with @code{OMP} critical
1664 statement @code{G}.
1665 @end deftypefn
1667 @deftypefn {GIMPLE function} void gimple_omp_critical_set_name (gimple g, tree name)
1668 Set @code{NAME} to be the name associated with @code{OMP} critical statement @code{G}.
1669 @end deftypefn
1671 @node @code{GIMPLE_OMP_FOR}
1672 @subsection @code{GIMPLE_OMP_FOR}
1673 @cindex @code{GIMPLE_OMP_FOR}
1675 @deftypefn {GIMPLE function} gimple gimple_build_omp_for (gimple_seq body, @
1676 tree clauses, tree index, tree initial, tree final, tree incr, @
1677 gimple_seq pre_body, enum tree_code omp_for_cond)
1678 Build a @code{GIMPLE_OMP_FOR} statement. @code{BODY} is sequence of statements
1679 inside the for loop.  @code{CLAUSES}, are any of the @code{OMP} loop
1680 construct's clauses: private, firstprivate,  lastprivate,
1681 reductions, ordered, schedule, and nowait.  @code{PRE_BODY} is the
1682 sequence of statements that are loop invariant.  @code{INDEX} is the
1683 index variable.  @code{INITIAL} is the initial value of @code{INDEX}.  @code{FINAL} is
1684 final value of @code{INDEX}.  OMP_FOR_COND is the predicate used to
1685 compare @code{INDEX} and @code{FINAL}.  @code{INCR} is the increment expression.
1686 @end deftypefn
1688 @deftypefn {GIMPLE function} tree gimple_omp_for_clauses (gimple g)
1689 Return the clauses associated with @code{OMP_FOR} @code{G}.
1690 @end deftypefn
1692 @deftypefn {GIMPLE function} {tree *} gimple_omp_for_clauses_ptr (gimple g)
1693 Return a pointer to the @code{OMP_FOR} @code{G}.
1694 @end deftypefn
1696 @deftypefn {GIMPLE function} void gimple_omp_for_set_clauses (gimple g, tree clauses)
1697 Set @code{CLAUSES} to be the list of clauses associated with @code{OMP_FOR} @code{G}.
1698 @end deftypefn
1700 @deftypefn {GIMPLE function} tree gimple_omp_for_index (gimple g)
1701 Return the index variable for @code{OMP_FOR} @code{G}.
1702 @end deftypefn
1704 @deftypefn {GIMPLE function} {tree *} gimple_omp_for_index_ptr (gimple g)
1705 Return a pointer to the index variable for @code{OMP_FOR} @code{G}.
1706 @end deftypefn
1708 @deftypefn {GIMPLE function} void gimple_omp_for_set_index (gimple g, tree index)
1709 Set @code{INDEX} to be the index variable for @code{OMP_FOR} @code{G}.
1710 @end deftypefn
1712 @deftypefn {GIMPLE function} tree gimple_omp_for_initial (gimple g)
1713 Return the initial value for @code{OMP_FOR} @code{G}.
1714 @end deftypefn
1716 @deftypefn {GIMPLE function} {tree *} gimple_omp_for_initial_ptr (gimple g)
1717 Return a pointer to the initial value for @code{OMP_FOR} @code{G}.
1718 @end deftypefn
1720 @deftypefn {GIMPLE function} void gimple_omp_for_set_initial (gimple g, tree initial)
1721 Set @code{INITIAL} to be the initial value for @code{OMP_FOR} @code{G}.
1722 @end deftypefn
1724 @deftypefn {GIMPLE function} tree gimple_omp_for_final (gimple g)
1725 Return the final value for @code{OMP_FOR} @code{G}.
1726 @end deftypefn
1728 @deftypefn {GIMPLE function} {tree *} gimple_omp_for_final_ptr (gimple g)
1729 turn a pointer to the final value for @code{OMP_FOR} @code{G}.
1730 @end deftypefn
1732 @deftypefn {GIMPLE function} void gimple_omp_for_set_final (gimple g, tree final)
1733 Set @code{FINAL} to be the final value for @code{OMP_FOR} @code{G}.
1734 @end deftypefn
1736 @deftypefn {GIMPLE function} tree gimple_omp_for_incr (gimple g)
1737 Return the increment value for @code{OMP_FOR} @code{G}.
1738 @end deftypefn
1740 @deftypefn {GIMPLE function} {tree *} gimple_omp_for_incr_ptr (gimple g)
1741 Return a pointer to the increment value for @code{OMP_FOR} @code{G}.
1742 @end deftypefn
1744 @deftypefn {GIMPLE function} void gimple_omp_for_set_incr (gimple g, tree incr)
1745 Set @code{INCR} to be the increment value for @code{OMP_FOR} @code{G}.
1746 @end deftypefn
1748 @deftypefn {GIMPLE function} gimple_seq gimple_omp_for_pre_body (gimple g)
1749 Return the sequence of statements to execute before the @code{OMP_FOR}
1750 statement @code{G} starts.
1751 @end deftypefn
1753 @deftypefn {GIMPLE function} void gimple_omp_for_set_pre_body (gimple g, gimple_seq pre_body)
1754 Set @code{PRE_BODY} to be the sequence of statements to execute before
1755 the @code{OMP_FOR} statement @code{G} starts.
1756 @end deftypefn
1758 @deftypefn {GIMPLE function} void gimple_omp_for_set_cond (gimple g, enum tree_code cond)
1759 Set @code{COND} to be the condition code for @code{OMP_FOR} @code{G}.
1760 @end deftypefn
1762 @deftypefn {GIMPLE function} {enum tree_code} gimple_omp_for_cond (gimple g)
1763 Return the condition code associated with @code{OMP_FOR} @code{G}.
1764 @end deftypefn
1767 @node @code{GIMPLE_OMP_MASTER}
1768 @subsection @code{GIMPLE_OMP_MASTER}
1769 @cindex @code{GIMPLE_OMP_MASTER}
1771 @deftypefn {GIMPLE function} gimple gimple_build_omp_master (gimple_seq body)
1772 Build a @code{GIMPLE_OMP_MASTER} statement. @code{BODY} is the sequence of
1773 statements to be executed by just the master.
1774 @end deftypefn
1777 @node @code{GIMPLE_OMP_ORDERED}
1778 @subsection @code{GIMPLE_OMP_ORDERED}
1779 @cindex @code{GIMPLE_OMP_ORDERED}
1781 @deftypefn {GIMPLE function} gimple gimple_build_omp_ordered (gimple_seq body)
1782 Build a @code{GIMPLE_OMP_ORDERED} statement.
1783 @end deftypefn
1785 @code{BODY} is the sequence of statements inside a loop that will
1786 executed in sequence.
1789 @node @code{GIMPLE_OMP_PARALLEL}
1790 @subsection @code{GIMPLE_OMP_PARALLEL}
1791 @cindex @code{GIMPLE_OMP_PARALLEL}
1793 @deftypefn {GIMPLE function} gimple gimple_build_omp_parallel (gimple_seq @
1794 body, tree clauses, tree child_fn, tree data_arg)
1795 Build a @code{GIMPLE_OMP_PARALLEL} statement.
1796 @end deftypefn
1798 @code{BODY} is sequence of statements which are executed in parallel.
1799 @code{CLAUSES}, are the @code{OMP} parallel construct's clauses.  @code{CHILD_FN} is
1800 the function created for the parallel threads to execute.
1801 @code{DATA_ARG} are the shared data argument(s).
1803 @deftypefn {GIMPLE function} bool gimple_omp_parallel_combined_p (gimple g)
1804 Return true if @code{OMP} parallel statement @code{G} has the
1805 @code{GF_OMP_PARALLEL_COMBINED} flag set.
1806 @end deftypefn
1808 @deftypefn {GIMPLE function} void gimple_omp_parallel_set_combined_p (gimple g)
1809 Set the @code{GF_OMP_PARALLEL_COMBINED} field in @code{OMP} parallel statement
1810 @code{G}.
1811 @end deftypefn
1813 @deftypefn {GIMPLE function} gimple_seq gimple_omp_body (gimple g)
1814 Return the body for the @code{OMP} statement @code{G}.
1815 @end deftypefn
1817 @deftypefn {GIMPLE function} void gimple_omp_set_body (gimple g, gimple_seq body)
1818 Set @code{BODY} to be the body for the @code{OMP} statement @code{G}.
1819 @end deftypefn
1821 @deftypefn {GIMPLE function} tree gimple_omp_parallel_clauses (gimple g)
1822 Return the clauses associated with @code{OMP_PARALLEL} @code{G}.
1823 @end deftypefn
1825 @deftypefn {GIMPLE function} {tree *} gimple_omp_parallel_clauses_ptr (gimple g)
1826 Return a pointer to the clauses associated with @code{OMP_PARALLEL} @code{G}.
1827 @end deftypefn
1829 @deftypefn {GIMPLE function} void gimple_omp_parallel_set_clauses (gimple g, tree clauses)
1830 Set @code{CLAUSES} to be the list of clauses associated with
1831 @code{OMP_PARALLEL} @code{G}.
1832 @end deftypefn
1834 @deftypefn {GIMPLE function} tree gimple_omp_parallel_child_fn (gimple g)
1835 Return the child function used to hold the body of @code{OMP_PARALLEL}
1836 @code{G}.
1837 @end deftypefn
1839 @deftypefn {GIMPLE function} {tree *} gimple_omp_parallel_child_fn_ptr (gimple g)
1840 Return a pointer to the child function used to hold the body of
1841 @code{OMP_PARALLEL} @code{G}.
1842 @end deftypefn
1844 @deftypefn {GIMPLE function} void gimple_omp_parallel_set_child_fn (gimple g, tree child_fn)
1845 Set @code{CHILD_FN} to be the child function for @code{OMP_PARALLEL} @code{G}.
1846 @end deftypefn
1848 @deftypefn {GIMPLE function} tree gimple_omp_parallel_data_arg (gimple g)
1849 Return the artificial argument used to send variables and values
1850 from the parent to the children threads in @code{OMP_PARALLEL} @code{G}.
1851 @end deftypefn
1853 @deftypefn {GIMPLE function} {tree *} gimple_omp_parallel_data_arg_ptr (gimple g)
1854 Return a pointer to the data argument for @code{OMP_PARALLEL} @code{G}.
1855 @end deftypefn
1857 @deftypefn {GIMPLE function} void gimple_omp_parallel_set_data_arg (gimple g, tree data_arg)
1858 Set @code{DATA_ARG} to be the data argument for @code{OMP_PARALLEL} @code{G}.
1859 @end deftypefn
1862 @node @code{GIMPLE_OMP_RETURN}
1863 @subsection @code{GIMPLE_OMP_RETURN}
1864 @cindex @code{GIMPLE_OMP_RETURN}
1866 @deftypefn {GIMPLE function} gimple gimple_build_omp_return (bool wait_p)
1867 Build a @code{GIMPLE_OMP_RETURN} statement. @code{WAIT_P} is true if this is a
1868 non-waiting return.
1869 @end deftypefn
1871 @deftypefn {GIMPLE function} void gimple_omp_return_set_nowait (gimple s)
1872 Set the nowait flag on @code{GIMPLE_OMP_RETURN} statement @code{S}.
1873 @end deftypefn
1876 @deftypefn {GIMPLE function} bool gimple_omp_return_nowait_p (gimple g)
1877 Return true if @code{OMP} return statement @code{G} has the
1878 @code{GF_OMP_RETURN_NOWAIT} flag set.
1879 @end deftypefn
1881 @node @code{GIMPLE_OMP_SECTION}
1882 @subsection @code{GIMPLE_OMP_SECTION}
1883 @cindex @code{GIMPLE_OMP_SECTION}
1885 @deftypefn {GIMPLE function} gimple gimple_build_omp_section (gimple_seq body)
1886 Build a @code{GIMPLE_OMP_SECTION} statement for a sections statement.
1887 @end deftypefn
1889 @code{BODY} is the sequence of statements in the section.
1891 @deftypefn {GIMPLE function} bool gimple_omp_section_last_p (gimple g)
1892 Return true if @code{OMP} section statement @code{G} has the
1893 @code{GF_OMP_SECTION_LAST} flag set.
1894 @end deftypefn
1896 @deftypefn {GIMPLE function} void gimple_omp_section_set_last (gimple g)
1897 Set the @code{GF_OMP_SECTION_LAST} flag on @code{G}.
1898 @end deftypefn
1900 @node @code{GIMPLE_OMP_SECTIONS}
1901 @subsection @code{GIMPLE_OMP_SECTIONS}
1902 @cindex @code{GIMPLE_OMP_SECTIONS}
1904 @deftypefn {GIMPLE function} gimple gimple_build_omp_sections (gimple_seq body, tree clauses)
1905 Build a @code{GIMPLE_OMP_SECTIONS} statement. @code{BODY} is a sequence of
1906 section statements.  @code{CLAUSES} are any of the @code{OMP} sections
1907 construct's clauses: private, firstprivate, lastprivate,
1908 reduction, and nowait.
1909 @end deftypefn
1912 @deftypefn {GIMPLE function} gimple gimple_build_omp_sections_switch (void)
1913 Build a @code{GIMPLE_OMP_SECTIONS_SWITCH} statement.
1914 @end deftypefn
1916 @deftypefn {GIMPLE function} tree gimple_omp_sections_control (gimple g)
1917 Return the control variable associated with the
1918 @code{GIMPLE_OMP_SECTIONS} in @code{G}.
1919 @end deftypefn
1921 @deftypefn {GIMPLE function} {tree *} gimple_omp_sections_control_ptr (gimple g)
1922 Return a pointer to the clauses associated with the
1923 @code{GIMPLE_OMP_SECTIONS} in @code{G}.
1924 @end deftypefn
1926 @deftypefn {GIMPLE function} void gimple_omp_sections_set_control (gimple g, tree control)
1927 Set @code{CONTROL} to be the set of clauses associated with the
1928 @code{GIMPLE_OMP_SECTIONS} in @code{G}.
1929 @end deftypefn
1931 @deftypefn {GIMPLE function} tree gimple_omp_sections_clauses (gimple g)
1932 Return the clauses associated with @code{OMP_SECTIONS} @code{G}.
1933 @end deftypefn
1935 @deftypefn {GIMPLE function} {tree *} gimple_omp_sections_clauses_ptr (gimple g)
1936 Return a pointer to the clauses associated with @code{OMP_SECTIONS} @code{G}.
1937 @end deftypefn
1939 @deftypefn {GIMPLE function} void gimple_omp_sections_set_clauses (gimple g, tree clauses)
1940 Set @code{CLAUSES} to be the set of clauses associated with @code{OMP_SECTIONS}
1941 @code{G}.
1942 @end deftypefn
1945 @node @code{GIMPLE_OMP_SINGLE}
1946 @subsection @code{GIMPLE_OMP_SINGLE}
1947 @cindex @code{GIMPLE_OMP_SINGLE}
1949 @deftypefn {GIMPLE function} gimple gimple_build_omp_single (gimple_seq body, tree clauses)
1950 Build a @code{GIMPLE_OMP_SINGLE} statement. @code{BODY} is the sequence of
1951 statements that will be executed once.  @code{CLAUSES} are any of the
1952 @code{OMP} single construct's clauses: private, firstprivate,
1953 copyprivate, nowait.
1954 @end deftypefn
1956 @deftypefn {GIMPLE function} tree gimple_omp_single_clauses (gimple g)
1957 Return the clauses associated with @code{OMP_SINGLE} @code{G}.
1958 @end deftypefn
1960 @deftypefn {GIMPLE function} {tree *} gimple_omp_single_clauses_ptr (gimple g)
1961 Return a pointer to the clauses associated with @code{OMP_SINGLE} @code{G}.
1962 @end deftypefn
1964 @deftypefn {GIMPLE function} void gimple_omp_single_set_clauses (gimple g, tree clauses)
1965 Set @code{CLAUSES} to be the clauses associated with @code{OMP_SINGLE} @code{G}.
1966 @end deftypefn
1969 @node @code{GIMPLE_PHI}
1970 @subsection @code{GIMPLE_PHI}
1971 @cindex @code{GIMPLE_PHI}
1973 @deftypefn {GIMPLE function} unsigned gimple_phi_capacity (gimple g)
1974 Return the maximum number of arguments supported by @code{GIMPLE_PHI} @code{G}.
1975 @end deftypefn
1977 @deftypefn {GIMPLE function} unsigned gimple_phi_num_args (gimple g)
1978 Return the number of arguments in @code{GIMPLE_PHI} @code{G}. This must always
1979 be exactly the number of incoming edges for the basic block
1980 holding @code{G}.
1981 @end deftypefn
1983 @deftypefn {GIMPLE function} tree gimple_phi_result (gimple g)
1984 Return the @code{SSA} name created by @code{GIMPLE_PHI} @code{G}.
1985 @end deftypefn
1987 @deftypefn {GIMPLE function} {tree *} gimple_phi_result_ptr (gimple g)
1988 Return a pointer to the @code{SSA} name created by @code{GIMPLE_PHI} @code{G}.
1989 @end deftypefn
1991 @deftypefn {GIMPLE function} void gimple_phi_set_result (gimple g, tree result)
1992 Set @code{RESULT} to be the @code{SSA} name created by @code{GIMPLE_PHI} @code{G}.
1993 @end deftypefn
1995 @deftypefn {GIMPLE function} {struct phi_arg_d *} gimple_phi_arg (gimple g, index)
1996 Return the @code{PHI} argument corresponding to incoming edge @code{INDEX} for
1997 @code{GIMPLE_PHI} @code{G}.
1998 @end deftypefn
2000 @deftypefn {GIMPLE function} void gimple_phi_set_arg (gimple g, index, struct phi_arg_d * phiarg)
2001 Set @code{PHIARG} to be the argument corresponding to incoming edge
2002 @code{INDEX} for @code{GIMPLE_PHI} @code{G}.
2003 @end deftypefn
2005 @node @code{GIMPLE_RESX}
2006 @subsection @code{GIMPLE_RESX}
2007 @cindex @code{GIMPLE_RESX}
2009 @deftypefn {GIMPLE function} gimple gimple_build_resx (int region)
2010 Build a @code{GIMPLE_RESX} statement which is a statement.  This
2011 statement is a placeholder for _Unwind_Resume before we know if a
2012 function call or a branch is needed.  @code{REGION} is the exception
2013 region from which control is flowing.
2014 @end deftypefn
2016 @deftypefn {GIMPLE function} int gimple_resx_region (gimple g)
2017 Return the region number for @code{GIMPLE_RESX} @code{G}.
2018 @end deftypefn
2020 @deftypefn {GIMPLE function} void gimple_resx_set_region (gimple g, int region)
2021 Set @code{REGION} to be the region number for @code{GIMPLE_RESX} @code{G}.
2022 @end deftypefn
2024 @node @code{GIMPLE_RETURN}
2025 @subsection @code{GIMPLE_RETURN}
2026 @cindex @code{GIMPLE_RETURN}
2028 @deftypefn {GIMPLE function} gimple gimple_build_return (tree retval)
2029 Build a @code{GIMPLE_RETURN} statement whose return value is retval.
2030 @end deftypefn
2032 @deftypefn {GIMPLE function} tree gimple_return_retval (gimple g)
2033 Return the return value for @code{GIMPLE_RETURN} @code{G}.
2034 @end deftypefn
2036 @deftypefn {GIMPLE function} void gimple_return_set_retval (gimple g, tree retval)
2037 Set @code{RETVAL} to be the return value for @code{GIMPLE_RETURN} @code{G}.
2038 @end deftypefn
2040 @node @code{GIMPLE_SWITCH}
2041 @subsection @code{GIMPLE_SWITCH}
2042 @cindex @code{GIMPLE_SWITCH}
2044 @deftypefn {GIMPLE function} gimple gimple_build_switch (tree index, tree @
2045 default_label, @code{VEC}(tree,heap) *args)
2046 Build a @code{GIMPLE_SWITCH} statement.  @code{INDEX} is the index variable
2047 to switch on, and @code{DEFAULT_LABEL} represents the default label.
2048 @code{ARGS} is a vector of @code{CASE_LABEL_EXPR} trees that contain the
2049 non-default case labels.  Each label is a tree of code @code{CASE_LABEL_EXPR}.
2050 @end deftypefn
2052 @deftypefn {GIMPLE function} unsigned gimple_switch_num_labels (gimple g)
2053 Return the number of labels associated with the switch statement
2054 @code{G}.
2055 @end deftypefn
2057 @deftypefn {GIMPLE function} void gimple_switch_set_num_labels (gimple g, @
2058 unsigned nlabels)
2059 Set @code{NLABELS} to be the number of labels for the switch statement
2060 @code{G}.
2061 @end deftypefn
2063 @deftypefn {GIMPLE function} tree gimple_switch_index (gimple g)
2064 Return the index variable used by the switch statement @code{G}.
2065 @end deftypefn
2067 @deftypefn {GIMPLE function} void gimple_switch_set_index (gimple g, tree index)
2068 Set @code{INDEX} to be the index variable for switch statement @code{G}.
2069 @end deftypefn
2071 @deftypefn {GIMPLE function} tree gimple_switch_label (gimple g, unsigned index)
2072 Return the label numbered @code{INDEX}. The default label is 0, followed
2073 by any labels in a switch statement.
2074 @end deftypefn
2076 @deftypefn {GIMPLE function} void gimple_switch_set_label (gimple g, unsigned @
2077 index, tree label)
2078 Set the label number @code{INDEX} to @code{LABEL}. 0 is always the default
2079 label.
2080 @end deftypefn
2082 @deftypefn {GIMPLE function} tree gimple_switch_default_label (gimple g)
2083 Return the default label for a switch statement.
2084 @end deftypefn
2086 @deftypefn {GIMPLE function} void gimple_switch_set_default_label (gimple g, @
2087 tree label)
2088 Set the default label for a switch statement.
2089 @end deftypefn
2092 @node @code{GIMPLE_TRY}
2093 @subsection @code{GIMPLE_TRY}
2094 @cindex @code{GIMPLE_TRY}
2096 @deftypefn {GIMPLE function} gimple gimple_build_try (gimple_seq eval, @
2097 gimple_seq cleanup, unsigned int kind)
2098 Build a @code{GIMPLE_TRY} statement.  @code{EVAL} is a sequence with the
2099 expression to evaluate.  @code{CLEANUP} is a sequence of statements to
2100 run at clean-up time.  @code{KIND} is the enumeration value
2101 @code{GIMPLE_TRY_CATCH} if this statement denotes a try/catch construct
2102 or @code{GIMPLE_TRY_FINALLY} if this statement denotes a try/finally
2103 construct.
2104 @end deftypefn
2106 @deftypefn {GIMPLE function} {enum gimple_try_flags} gimple_try_kind (gimple g)
2107 Return the kind of try block represented by @code{GIMPLE_TRY} @code{G}. This is
2108 either @code{GIMPLE_TRY_CATCH} or @code{GIMPLE_TRY_FINALLY}.
2109 @end deftypefn
2111 @deftypefn {GIMPLE function} bool gimple_try_catch_is_cleanup (gimple g)
2112 Return the @code{GIMPLE_TRY_CATCH_IS_CLEANUP} flag.
2113 @end deftypefn
2115 @deftypefn {GIMPLE function} gimple_seq gimple_try_eval (gimple g)
2116 Return the sequence of statements used as the body for @code{GIMPLE_TRY}
2117 @code{G}.
2118 @end deftypefn
2120 @deftypefn {GIMPLE function} gimple_seq gimple_try_cleanup (gimple g)
2121 Return the sequence of statements used as the cleanup body for
2122 @code{GIMPLE_TRY} @code{G}.
2123 @end deftypefn
2125 @deftypefn {GIMPLE function} void gimple_try_set_catch_is_cleanup (gimple g, @
2126 bool catch_is_cleanup)
2127 Set the @code{GIMPLE_TRY_CATCH_IS_CLEANUP} flag.
2128 @end deftypefn
2130 @deftypefn {GIMPLE function} void gimple_try_set_eval (gimple g, gimple_seq eval)
2131 Set @code{EVAL} to be the sequence of statements to use as the body for
2132 @code{GIMPLE_TRY} @code{G}.
2133 @end deftypefn
2135 @deftypefn {GIMPLE function} void gimple_try_set_cleanup (gimple g, gimple_seq cleanup)
2136 Set @code{CLEANUP} to be the sequence of statements to use as the
2137 cleanup body for @code{GIMPLE_TRY} @code{G}.
2138 @end deftypefn
2140 @node @code{GIMPLE_WITH_CLEANUP_EXPR}
2141 @subsection @code{GIMPLE_WITH_CLEANUP_EXPR}
2142 @cindex @code{GIMPLE_WITH_CLEANUP_EXPR}
2144 @deftypefn {GIMPLE function} gimple gimple_build_wce (gimple_seq cleanup)
2145 Build a @code{GIMPLE_WITH_CLEANUP_EXPR} statement.  @code{CLEANUP} is the
2146 clean-up expression.
2147 @end deftypefn
2149 @deftypefn {GIMPLE function} gimple_seq gimple_wce_cleanup (gimple g)
2150 Return the cleanup sequence for cleanup statement @code{G}.
2151 @end deftypefn
2153 @deftypefn {GIMPLE function} void gimple_wce_set_cleanup (gimple g, gimple_seq cleanup)
2154 Set @code{CLEANUP} to be the cleanup sequence for @code{G}.
2155 @end deftypefn
2157 @deftypefn {GIMPLE function} bool gimple_wce_cleanup_eh_only (gimple g)
2158 Return the @code{CLEANUP_EH_ONLY} flag for a @code{WCE} tuple.
2159 @end deftypefn
2161 @deftypefn {GIMPLE function} void gimple_wce_set_cleanup_eh_only (gimple g, bool eh_only_p)
2162 Set the @code{CLEANUP_EH_ONLY} flag for a @code{WCE} tuple.
2163 @end deftypefn
2166 @node GIMPLE sequences
2167 @section GIMPLE sequences
2168 @cindex GIMPLE sequences
2170 GIMPLE sequences are the tuple equivalent of @code{STATEMENT_LIST}'s
2171 used in @code{GENERIC}.  They are used to chain statements together, and
2172 when used in conjunction with sequence iterators, provide a
2173 framework for iterating through statements.
2175 GIMPLE sequences are of type struct @code{gimple_sequence}, but are more
2176 commonly passed by reference to functions dealing with sequences.
2177 The type for a sequence pointer is @code{gimple_seq} which is the same
2178 as struct @code{gimple_sequence} *.  When declaring a local sequence,
2179 you can define a local variable of type struct @code{gimple_sequence}.
2180 When declaring a sequence allocated on the garbage collected
2181 heap, use the function @code{gimple_seq_alloc} documented below.
2183 There are convenience functions for iterating through sequences
2184 in the section entitled Sequence Iterators.
2186 Below is a list of functions to manipulate and query sequences.
2188 @deftypefn {GIMPLE function} void gimple_seq_add_stmt (gimple_seq *seq, gimple g)
2189 Link a gimple statement to the end of the sequence *@code{SEQ} if @code{G} is
2190 not @code{NULL}.  If *@code{SEQ} is @code{NULL}, allocate a sequence before linking.
2191 @end deftypefn
2193 @deftypefn {GIMPLE function} void gimple_seq_add_seq (gimple_seq *dest, gimple_seq src)
2194 Append sequence @code{SRC} to the end of sequence *@code{DEST} if @code{SRC} is not
2195 @code{NULL}.  If *@code{DEST} is @code{NULL}, allocate a new sequence before
2196 appending.
2197 @end deftypefn
2199 @deftypefn {GIMPLE function} gimple_seq gimple_seq_deep_copy (gimple_seq src)
2200 Perform a deep copy of sequence @code{SRC} and return the result.
2201 @end deftypefn
2203 @deftypefn {GIMPLE function} gimple_seq gimple_seq_reverse (gimple_seq seq)
2204 Reverse the order of the statements in the sequence @code{SEQ}.  Return
2205 @code{SEQ}.
2206 @end deftypefn
2208 @deftypefn {GIMPLE function} gimple gimple_seq_first (gimple_seq s)
2209 Return the first statement in sequence @code{S}.
2210 @end deftypefn
2212 @deftypefn {GIMPLE function} gimple gimple_seq_last (gimple_seq s)
2213 Return the last statement in sequence @code{S}.
2214 @end deftypefn
2216 @deftypefn {GIMPLE function} void gimple_seq_set_last (gimple_seq s, gimple last)
2217 Set the last statement in sequence @code{S} to the statement in @code{LAST}.
2218 @end deftypefn
2220 @deftypefn {GIMPLE function} void gimple_seq_set_first (gimple_seq s, gimple first)
2221 Set the first statement in sequence @code{S} to the statement in @code{FIRST}.
2222 @end deftypefn
2224 @deftypefn {GIMPLE function} void gimple_seq_init (gimple_seq s)
2225 Initialize sequence @code{S} to an empty sequence.
2226 @end deftypefn
2228 @deftypefn {GIMPLE function} gimple_seq gimple_seq_alloc (void)
2229 Allocate a new sequence in the garbage collected store and return
2231 @end deftypefn
2233 @deftypefn {GIMPLE function} void gimple_seq_copy (gimple_seq dest, gimple_seq src)
2234 Copy the sequence @code{SRC} into the sequence @code{DEST}.
2235 @end deftypefn
2237 @deftypefn {GIMPLE function} bool gimple_seq_empty_p (gimple_seq s)
2238 Return true if the sequence @code{S} is empty.
2239 @end deftypefn
2241 @deftypefn {GIMPLE function} gimple_seq bb_seq (basic_block bb)
2242 Returns the sequence of statements in @code{BB}.
2243 @end deftypefn
2245 @deftypefn {GIMPLE function} void set_bb_seq (basic_block bb, gimple_seq seq)
2246 Sets the sequence of statements in @code{BB} to @code{SEQ}.
2247 @end deftypefn
2249 @deftypefn {GIMPLE function} bool gimple_seq_singleton_p (gimple_seq seq)
2250 Determine whether @code{SEQ} contains exactly one statement.
2251 @end deftypefn
2253 @node Sequence iterators
2254 @section Sequence iterators
2255 @cindex Sequence iterators
2257 Sequence iterators are convenience constructs for iterating
2258 through statements in a sequence.  Given a sequence @code{SEQ}, here is
2259 a typical use of gimple sequence iterators:
2261 @smallexample
2262 gimple_stmt_iterator gsi;
2264 for (gsi = gsi_start (seq); !gsi_end_p (gsi); gsi_next (&gsi))
2265   @{
2266     gimple g = gsi_stmt (gsi);
2267     /* Do something with gimple statement @code{G}.  */
2268   @}
2269 @end smallexample
2271 Backward iterations are possible:
2273 @smallexample
2274         for (gsi = gsi_last (seq); !gsi_end_p (gsi); gsi_prev (&gsi))
2275 @end smallexample
2277 Forward and backward iterations on basic blocks are possible with
2278 @code{gsi_start_bb} and @code{gsi_last_bb}.
2280 In the documentation below we sometimes refer to enum
2281 @code{gsi_iterator_update}.  The valid options for this enumeration are:
2283 @itemize @bullet
2284 @item @code{GSI_NEW_STMT}
2285 Only valid when a single statement is added.  Move the iterator to it.
2287 @item @code{GSI_SAME_STMT}
2288 Leave the iterator at the same statement.
2290 @item @code{GSI_CONTINUE_LINKING}
2291 Move iterator to whatever position is suitable for linking other
2292 statements in the same direction.
2293 @end itemize
2295 Below is a list of the functions used to manipulate and use
2296 statement iterators.
2298 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_start (gimple_seq seq)
2299 Return a new iterator pointing to the sequence @code{SEQ}'s first
2300 statement.  If @code{SEQ} is empty, the iterator's basic block is @code{NULL}.
2301 Use @code{gsi_start_bb} instead when the iterator needs to always have
2302 the correct basic block set.
2303 @end deftypefn
2305 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_start_bb (basic_block bb)
2306 Return a new iterator pointing to the first statement in basic
2307 block @code{BB}.
2308 @end deftypefn
2310 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_last (gimple_seq seq)
2311 Return a new iterator initially pointing to the last statement of
2312 sequence @code{SEQ}.  If @code{SEQ} is empty, the iterator's basic block is
2313 @code{NULL}.  Use @code{gsi_last_bb} instead when the iterator needs to always
2314 have the correct basic block set.
2315 @end deftypefn
2317 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_last_bb (basic_block bb)
2318 Return a new iterator pointing to the last statement in basic
2319 block @code{BB}.
2320 @end deftypefn
2322 @deftypefn {GIMPLE function} bool gsi_end_p (gimple_stmt_iterator i)
2323 Return @code{TRUE} if at the end of @code{I}.
2324 @end deftypefn
2326 @deftypefn {GIMPLE function} bool gsi_one_before_end_p (gimple_stmt_iterator i)
2327 Return @code{TRUE} if we're one statement before the end of @code{I}.
2328 @end deftypefn
2330 @deftypefn {GIMPLE function} void gsi_next (gimple_stmt_iterator *i)
2331 Advance the iterator to the next gimple statement.
2332 @end deftypefn
2334 @deftypefn {GIMPLE function} void gsi_prev (gimple_stmt_iterator *i)
2335 Advance the iterator to the previous gimple statement.
2336 @end deftypefn
2338 @deftypefn {GIMPLE function} gimple gsi_stmt (gimple_stmt_iterator i)
2339 Return the current stmt.
2340 @end deftypefn
2342 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_after_labels (basic_block bb)
2343 Return a block statement iterator that points to the first
2344 non-label statement in block @code{BB}.
2345 @end deftypefn
2347 @deftypefn {GIMPLE function} {gimple *} gsi_stmt_ptr (gimple_stmt_iterator *i)
2348 Return a pointer to the current stmt.
2349 @end deftypefn
2351 @deftypefn {GIMPLE function} basic_block gsi_bb (gimple_stmt_iterator i)
2352 Return the basic block associated with this iterator.
2353 @end deftypefn
2355 @deftypefn {GIMPLE function} gimple_seq gsi_seq (gimple_stmt_iterator i)
2356 Return the sequence associated with this iterator.
2357 @end deftypefn
2359 @deftypefn {GIMPLE function} void gsi_remove (gimple_stmt_iterator *i, bool remove_eh_info)
2360 Remove the current stmt from the sequence.  The iterator is
2361 updated to point to the next statement.  When @code{REMOVE_EH_INFO} is
2362 true we remove the statement pointed to by iterator @code{I} from the @code{EH}
2363 tables.  Otherwise we do not modify the @code{EH} tables.  Generally,
2364 @code{REMOVE_EH_INFO} should be true when the statement is going to be
2365 removed from the @code{IL} and not reinserted elsewhere.
2366 @end deftypefn
2368 @deftypefn {GIMPLE function} void gsi_link_seq_before (gimple_stmt_iterator *i, gimple_seq seq, enum gsi_iterator_update mode)
2369 Links the sequence of statements @code{SEQ} before the statement pointed
2370 by iterator @code{I}.  @code{MODE} indicates what to do with the iterator
2371 after insertion (see @code{enum gsi_iterator_update} above).
2372 @end deftypefn
2374 @deftypefn {GIMPLE function} void gsi_link_before (gimple_stmt_iterator *i, gimple g, enum gsi_iterator_update mode)
2375 Links statement @code{G} before the statement pointed-to by iterator @code{I}.
2376 Updates iterator @code{I} according to @code{MODE}.
2377 @end deftypefn
2379 @deftypefn {GIMPLE function} void gsi_link_seq_after (gimple_stmt_iterator *i, @
2380 gimple_seq seq, enum gsi_iterator_update mode)
2381 Links sequence @code{SEQ} after the statement pointed-to by iterator @code{I}.
2382 @code{MODE} is as in @code{gsi_insert_after}.
2383 @end deftypefn
2385 @deftypefn {GIMPLE function} void gsi_link_after (gimple_stmt_iterator *i, @
2386 gimple g, enum gsi_iterator_update mode)
2387 Links statement @code{G} after the statement pointed-to by iterator @code{I}.
2388 @code{MODE} is as in @code{gsi_insert_after}.
2389 @end deftypefn
2391 @deftypefn {GIMPLE function} gimple_seq gsi_split_seq_after (gimple_stmt_iterator i)
2392 Move all statements in the sequence after @code{I} to a new sequence.
2393 Return this new sequence.
2394 @end deftypefn
2396 @deftypefn {GIMPLE function} gimple_seq gsi_split_seq_before (gimple_stmt_iterator *i)
2397 Move all statements in the sequence before @code{I} to a new sequence.
2398 Return this new sequence.
2399 @end deftypefn
2401 @deftypefn {GIMPLE function} void gsi_replace (gimple_stmt_iterator *i, @
2402 gimple stmt, bool update_eh_info)
2403 Replace the statement pointed-to by @code{I} to @code{STMT}.  If @code{UPDATE_EH_INFO}
2404 is true, the exception handling information of the original
2405 statement is moved to the new statement.
2406 @end deftypefn
2408 @deftypefn {GIMPLE function} void gsi_insert_before (gimple_stmt_iterator *i, @
2409 gimple stmt, enum gsi_iterator_update mode)
2410 Insert statement @code{STMT} before the statement pointed-to by iterator
2411 @code{I}, update @code{STMT}'s basic block and scan it for new operands.  @code{MODE}
2412 specifies how to update iterator @code{I} after insertion (see enum
2413 @code{gsi_iterator_update}).
2414 @end deftypefn
2416 @deftypefn {GIMPLE function} void gsi_insert_seq_before (gimple_stmt_iterator *i, @
2417 gimple_seq seq, enum gsi_iterator_update mode)
2418 Like @code{gsi_insert_before}, but for all the statements in @code{SEQ}.
2419 @end deftypefn
2421 @deftypefn {GIMPLE function} void gsi_insert_after (gimple_stmt_iterator *i, @
2422 gimple stmt, enum gsi_iterator_update mode)
2423 Insert statement @code{STMT} after the statement pointed-to by iterator
2424 @code{I}, update @code{STMT}'s basic block and scan it for new operands.  @code{MODE}
2425 specifies how to update iterator @code{I} after insertion (see enum
2426 @code{gsi_iterator_update}).
2427 @end deftypefn
2429 @deftypefn {GIMPLE function} void gsi_insert_seq_after (gimple_stmt_iterator *i, @
2430 gimple_seq seq, enum gsi_iterator_update mode)
2431 Like @code{gsi_insert_after}, but for all the statements in @code{SEQ}.
2432 @end deftypefn
2434 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_for_stmt (gimple stmt)
2435 Finds iterator for @code{STMT}.
2436 @end deftypefn
2438 @deftypefn {GIMPLE function} void gsi_move_after (gimple_stmt_iterator *from, @
2439 gimple_stmt_iterator *to)
2440 Move the statement at @code{FROM} so it comes right after the statement
2441 at @code{TO}.
2442 @end deftypefn
2444 @deftypefn {GIMPLE function} void gsi_move_before (gimple_stmt_iterator *from, @
2445 gimple_stmt_iterator *to)
2446 Move the statement at @code{FROM} so it comes right before the statement
2447 at @code{TO}.
2448 @end deftypefn
2450 @deftypefn {GIMPLE function} void gsi_move_to_bb_end (gimple_stmt_iterator *from, @
2451 basic_block bb)
2452 Move the statement at @code{FROM} to the end of basic block @code{BB}.
2453 @end deftypefn
2455 @deftypefn {GIMPLE function} void gsi_insert_on_edge (edge e, gimple stmt)
2456 Add @code{STMT} to the pending list of edge @code{E}.  No actual insertion is
2457 made until a call to @code{gsi_commit_edge_inserts}() is made.
2458 @end deftypefn
2460 @deftypefn {GIMPLE function} void gsi_insert_seq_on_edge (edge e, gimple_seq seq)
2461 Add the sequence of statements in @code{SEQ} to the pending list of edge
2462 @code{E}.  No actual insertion is made until a call to
2463 @code{gsi_commit_edge_inserts}() is made.
2464 @end deftypefn
2466 @deftypefn {GIMPLE function} basic_block gsi_insert_on_edge_immediate (edge e, gimple stmt)
2467 Similar to @code{gsi_insert_on_edge}+@code{gsi_commit_edge_inserts}.  If a new
2468 block has to be created, it is returned.
2469 @end deftypefn
2471 @deftypefn {GIMPLE function} void gsi_commit_one_edge_insert (edge e, basic_block *new_bb)
2472 Commit insertions pending at edge @code{E}.  If a new block is created,
2473 set @code{NEW_BB} to this block, otherwise set it to @code{NULL}.
2474 @end deftypefn
2476 @deftypefn {GIMPLE function} void gsi_commit_edge_inserts (void)
2477 This routine will commit all pending edge insertions, creating
2478 any new basic blocks which are necessary.
2479 @end deftypefn
2482 @node Adding a new GIMPLE statement code
2483 @section Adding a new GIMPLE statement code
2484 @cindex Adding a new GIMPLE statement code
2486 The first step in adding a new GIMPLE statement code, is
2487 modifying the file @code{gimple.def}, which contains all the GIMPLE
2488 codes.  Then you must add a corresponding structure, and an entry
2489 in @code{union gimple_statement_d}, both of which are located in
2490 @code{gimple.h}.  This in turn, will require you to add a corresponding
2491 @code{GTY} tag in @code{gsstruct.def}, and code to handle this tag in
2492 @code{gss_for_code} which is located in @code{gimple.c}.
2494 In order for the garbage collector to know the size of the
2495 structure you created in @code{gimple.h}, you need to add a case to
2496 handle your new GIMPLE statement in @code{gimple_size} which is located
2497 in @code{gimple.c}.
2499 You will probably want to create a function to build the new
2500 gimple statement in @code{gimple.c}.  The function should be called
2501 @code{gimple_build_@var{new-tuple-name}}, and should return the new tuple
2502 of type gimple.
2504 If your new statement requires accessors for any members or
2505 operands it may have, put simple inline accessors in
2506 @code{gimple.h} and any non-trivial accessors in @code{gimple.c} with a
2507 corresponding prototype in @code{gimple.h}.
2510 @node Statement and operand traversals
2511 @section Statement and operand traversals
2512 @cindex Statement and operand traversals
2514 There are two functions available for walking statements and
2515 sequences: @code{walk_gimple_stmt} and @code{walk_gimple_seq},
2516 accordingly, and a third function for walking the operands in a
2517 statement: @code{walk_gimple_op}.
2519 @deftypefn {GIMPLE function} tree walk_gimple_stmt (gimple_stmt_iterator *gsi, @
2520   walk_stmt_fn callback_stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi)
2521 This function is used to walk the current statement in @code{GSI},
2522 optionally using traversal state stored in @code{WI}.  If @code{WI} is @code{NULL}, no
2523 state is kept during the traversal.
2525 The callback @code{CALLBACK_STMT} is called.  If @code{CALLBACK_STMT} returns
2526 true, it means that the callback function has handled all the
2527 operands of the statement and it is not necessary to walk its
2528 operands.
2530 If @code{CALLBACK_STMT} is @code{NULL} or it returns false, @code{CALLBACK_OP} is
2531 called on each operand of the statement via @code{walk_gimple_op}.  If
2532 @code{walk_gimple_op} returns non-@code{NULL} for any operand, the remaining
2533 operands are not scanned.
2535 The return value is that returned by the last call to
2536 @code{walk_gimple_op}, or @code{NULL_TREE} if no @code{CALLBACK_OP} is specified.
2537 @end deftypefn
2540 @deftypefn {GIMPLE function} tree walk_gimple_op (gimple stmt, @
2541   walk_tree_fn callback_op, struct walk_stmt_info *wi)
2542 Use this function to walk the operands of statement @code{STMT}.  Every
2543 operand is walked via @code{walk_tree} with optional state information
2544 in @code{WI}.
2546 @code{CALLBACK_OP} is called on each operand of @code{STMT} via @code{walk_tree}.
2547 Additional parameters to @code{walk_tree} must be stored in @code{WI}.  For
2548 each operand @code{OP}, @code{walk_tree} is called as:
2550 @smallexample
2551 walk_tree (&@code{OP}, @code{CALLBACK_OP}, @code{WI}, @code{PSET})
2552 @end smallexample
2554 If @code{CALLBACK_OP} returns non-@code{NULL} for an operand, the remaining
2555 operands are not scanned.  The return value is that returned by
2556 the last call to @code{walk_tree}, or @code{NULL_TREE} if no @code{CALLBACK_OP} is
2557 specified.
2558 @end deftypefn
2561 @deftypefn {GIMPLE function} tree walk_gimple_seq (gimple_seq seq, @
2562   walk_stmt_fn callback_stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi)
2563 This function walks all the statements in the sequence @code{SEQ}
2564 calling @code{walk_gimple_stmt} on each one.  @code{WI} is as in
2565 @code{walk_gimple_stmt}.  If @code{walk_gimple_stmt} returns non-@code{NULL}, the walk
2566 is stopped and the value returned.  Otherwise, all the statements
2567 are walked and @code{NULL_TREE} returned.
2568 @end deftypefn