OSDN Git Service

With large parts from Jim Wilson:
[pf3gnuchains/gcc-fork.git] / gcc / doc / gimple.texi
1 @c Copyright (c) 2008, 2009, 2010 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.
5
6 @node GIMPLE
7 @chapter GIMPLE
8 @cindex GIMPLE
9
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}.
16
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.
22
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.
26
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.
35
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}.
40
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.
55
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@.
67
68 You can request to dump a C-like representation of the GIMPLE form
69 with the flag @option{-fdump-tree-gimple}.
70
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
84
85 @node Tuple representation
86 @section Tuple representation
87 @cindex tuples
88
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.
93
94 @subsection @code{gimple_statement_base} (gsbase)
95 @cindex gimple_statement_base
96
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:
103
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
122
123 @itemize @bullet
124 @item @code{code}
125 Main identifier for a GIMPLE instruction. 
126
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>}.
136
137 @item @code{no_warning}
138 Bitflag to indicate whether a warning has already been issued on
139 this statement.
140
141 @item @code{visited}
142 General purpose ``visited'' marker. Set and cleared by each pass
143 when needed.
144
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.
150
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.
155
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.
160
161 @item @code{has_volatile_ops}
162 Bitflag to indicate whether this statement contains operands that
163 have been marked volatile.
164
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).
169
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.
174
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.
179
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.
185
186 @item @code{bb}
187 Basic block holding the instruction.
188  
189 @item @code{block}
190 Lexical block holding this statement.  Also used for debug
191 information generation.
192 @end itemize
193
194 @subsection @code{gimple_statement_with_ops}
195 @cindex gimple_statement_with_ops
196
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.
208
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.
213
214
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
222
223 @itemize @bullet
224 @item @code{gsbase}
225 Inherited from @code{struct gimple_statement_base}.
226
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.
233
234 @item @code{use_ops}
235 Similar to @code{def_ops} but for variables read by the statement.
236
237 @item @code{op}
238 Array of trees with @code{num_ops} slots.
239 @end itemize
240
241 @subsection @code{gimple_statement_with_memory_ops}
242
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}).
249
250
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
263
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.
269
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.
274
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.
282
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
288
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):
293
294 @smallexample
295 union gimple_statement_d
296 @{
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;
318 @};
319 @end smallexample
320
321  
322 @node GIMPLE instruction set
323 @section GIMPLE instruction set
324 @cindex GIMPLE instruction set
325
326 The following table briefly describes the GIMPLE instruction set.
327
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_EH_FILTER}           @tab x                  @tab
337 @item @code{GIMPLE_GOTO}                @tab x                  @tab x
338 @item @code{GIMPLE_LABEL}               @tab x                  @tab x
339 @item @code{GIMPLE_NOP}                 @tab x                  @tab x
340 @item @code{GIMPLE_OMP_ATOMIC_LOAD}     @tab x                  @tab x
341 @item @code{GIMPLE_OMP_ATOMIC_STORE}    @tab x                  @tab x
342 @item @code{GIMPLE_OMP_CONTINUE}        @tab x                  @tab x
343 @item @code{GIMPLE_OMP_CRITICAL}        @tab x                  @tab x
344 @item @code{GIMPLE_OMP_FOR}             @tab x                  @tab x
345 @item @code{GIMPLE_OMP_MASTER}          @tab x                  @tab x
346 @item @code{GIMPLE_OMP_ORDERED}         @tab x                  @tab x
347 @item @code{GIMPLE_OMP_PARALLEL}        @tab x                  @tab x
348 @item @code{GIMPLE_OMP_RETURN}          @tab x                  @tab x
349 @item @code{GIMPLE_OMP_SECTION}         @tab x                  @tab x
350 @item @code{GIMPLE_OMP_SECTIONS}        @tab x                  @tab x
351 @item @code{GIMPLE_OMP_SECTIONS_SWITCH} @tab x                  @tab x
352 @item @code{GIMPLE_OMP_SINGLE}          @tab x                  @tab x
353 @item @code{GIMPLE_PHI}                 @tab                    @tab x
354 @item @code{GIMPLE_RESX}                @tab                    @tab x
355 @item @code{GIMPLE_RETURN}              @tab x                  @tab x
356 @item @code{GIMPLE_SWITCH}              @tab x                  @tab x
357 @item @code{GIMPLE_TRY}                 @tab x                  @tab
358 @end multitable
359
360 @node GIMPLE Exception Handling
361 @section Exception Handling
362 @cindex GIMPLE Exception Handling
363
364 Other exception handling constructs are represented using
365 @code{GIMPLE_TRY_CATCH}.  @code{GIMPLE_TRY_CATCH} has two operands.  The
366 first operand is a sequence of statements to execute.  If executing
367 these statements does not throw an exception, then the second operand
368 is ignored.  Otherwise, if an exception is thrown, then the second
369 operand of the @code{GIMPLE_TRY_CATCH} is checked.  The second
370 operand may have the following forms:
371
372 @enumerate
373
374 @item A sequence of statements to execute.  When an exception occurs,
375 these statements are executed, and then the exception is rethrown.
376
377 @item A sequence of @code{GIMPLE_CATCH} statements.  Each
378 @code{GIMPLE_CATCH} has a list of applicable exception types and
379 handler code.  If the thrown exception matches one of the caught
380 types, the associated handler code is executed.  If the handler
381 code falls off the bottom, execution continues after the original
382 @code{GIMPLE_TRY_CATCH}.
383
384 @item A @code{GIMPLE_EH_FILTER} statement.  This has a list of
385 permitted exception types, and code to handle a match failure.  If the
386 thrown exception does not match one of the allowed types, the
387 associated match failure code is executed.  If the thrown exception
388 does match, it continues unwinding the stack looking for the next
389 handler.
390
391 @end enumerate
392
393 Currently throwing an exception is not directly represented in
394 GIMPLE, since it is implemented by calling a function.  At some
395 point in the future we will want to add some way to express that
396 the call will throw an exception of a known type.
397
398 Just before running the optimizers, the compiler lowers the
399 high-level EH constructs above into a set of @samp{goto}s, magic
400 labels, and EH regions.  Continuing to unwind at the end of a
401 cleanup is represented with a @code{GIMPLE_RESX}.
402
403
404 @node Temporaries
405 @section Temporaries
406 @cindex Temporaries
407
408 When gimplification encounters a subexpression that is too
409 complex, it creates a new temporary variable to hold the value of
410 the subexpression, and adds a new statement to initialize it
411 before the current statement. These special temporaries are known
412 as @samp{expression temporaries}, and are allocated using
413 @code{get_formal_tmp_var}.  The compiler tries to always evaluate
414 identical expressions into the same temporary, to simplify
415 elimination of redundant calculations.
416
417 We can only use expression temporaries when we know that it will
418 not be reevaluated before its value is used, and that it will not
419 be otherwise modified@footnote{These restrictions are derived
420 from those in Morgan 4.8.}. Other temporaries can be allocated
421 using @code{get_initialized_tmp_var} or @code{create_tmp_var}.
422
423 Currently, an expression like @code{a = b + 5} is not reduced any
424 further.  We tried converting it to something like
425 @smallexample
426   T1 = b + 5;
427   a = T1;
428 @end smallexample
429 but this bloated the representation for minimal benefit.  However, a
430 variable which must live in memory cannot appear in an expression; its
431 value is explicitly loaded into a temporary first.  Similarly, storing
432 the value of an expression to a memory variable goes through a
433 temporary.
434
435 @node Operands
436 @section Operands
437 @cindex Operands
438
439 In general, expressions in GIMPLE consist of an operation and the
440 appropriate number of simple operands; these operands must either be a
441 GIMPLE rvalue (@code{is_gimple_val}), i.e.@: a constant or a register
442 variable.  More complex operands are factored out into temporaries, so
443 that
444 @smallexample
445   a = b + c + d
446 @end smallexample
447 becomes
448 @smallexample
449   T1 = b + c;
450   a = T1 + d;
451 @end smallexample
452
453 The same rule holds for arguments to a @code{GIMPLE_CALL}.
454
455 The target of an assignment is usually a variable, but can also be an
456 @code{INDIRECT_REF} or a compound lvalue as described below.
457
458 @menu
459 * Compound Expressions::
460 * Compound Lvalues::
461 * Conditional Expressions::
462 * Logical Operators::
463 @end menu
464
465 @node Compound Expressions
466 @subsection Compound Expressions
467 @cindex Compound Expressions
468
469 The left-hand side of a C comma expression is simply moved into a separate
470 statement.
471
472 @node Compound Lvalues
473 @subsection Compound Lvalues
474 @cindex Compound Lvalues
475
476 Currently compound lvalues involving array and structure field references
477 are not broken down; an expression like @code{a.b[2] = 42} is not reduced
478 any further (though complex array subscripts are).  This restriction is a
479 workaround for limitations in later optimizers; if we were to convert this
480 to
481
482 @smallexample
483   T1 = &a.b;
484   T1[2] = 42;
485 @end smallexample
486
487 alias analysis would not remember that the reference to @code{T1[2]} came
488 by way of @code{a.b}, so it would think that the assignment could alias
489 another member of @code{a}; this broke @code{struct-alias-1.c}.  Future
490 optimizer improvements may make this limitation unnecessary.
491
492 @node Conditional Expressions
493 @subsection Conditional Expressions
494 @cindex Conditional Expressions
495
496 A C @code{?:} expression is converted into an @code{if} statement with
497 each branch assigning to the same temporary.  So,
498
499 @smallexample
500   a = b ? c : d;
501 @end smallexample
502 becomes
503 @smallexample
504   if (b == 1)
505     T1 = c;
506   else
507     T1 = d;
508   a = T1;
509 @end smallexample
510
511 The GIMPLE level if-conversion pass re-introduces @code{?:}
512 expression, if appropriate. It is used to vectorize loops with
513 conditions using vector conditional operations.
514
515 Note that in GIMPLE, @code{if} statements are represented using
516 @code{GIMPLE_COND}, as described below.
517
518 @node Logical Operators
519 @subsection Logical Operators
520 @cindex Logical Operators
521
522 Except when they appear in the condition operand of a
523 @code{GIMPLE_COND}, logical `and' and `or' operators are simplified
524 as follows: @code{a = b && c} becomes
525
526 @smallexample
527   T1 = (bool)b;
528   if (T1 == true)
529     T1 = (bool)c;
530   a = T1;
531 @end smallexample
532
533 Note that @code{T1} in this example cannot be an expression temporary,
534 because it has two different assignments.
535
536 @subsection Manipulating operands
537
538 All gimple operands are of type @code{tree}.  But only certain
539 types of trees are allowed to be used as operand tuples.  Basic
540 validation is controlled by the function
541 @code{get_gimple_rhs_class}, which given a tree code, returns an
542 @code{enum} with the following values of type @code{enum
543 gimple_rhs_class}
544
545 @itemize @bullet
546 @item @code{GIMPLE_INVALID_RHS}
547 The tree cannot be used as a GIMPLE operand.
548
549 @item @code{GIMPLE_TERNARY_RHS}
550 The tree is a valid GIMPLE ternary operation.
551
552 @item @code{GIMPLE_BINARY_RHS}
553 The tree is a valid GIMPLE binary operation.
554
555 @item @code{GIMPLE_UNARY_RHS}
556 The tree is a valid GIMPLE unary operation.
557
558 @item @code{GIMPLE_SINGLE_RHS}
559 The tree is a single object, that cannot be split into simpler
560 operands (for instance, @code{SSA_NAME}, @code{VAR_DECL}, @code{COMPONENT_REF}, etc).
561
562 This operand class also acts as an escape hatch for tree nodes
563 that may be flattened out into the operand vector, but would need
564 more than two slots on the RHS.  For instance, a @code{COND_EXPR}
565 expression of the form @code{(a op b) ? x : y} could be flattened
566 out on the operand vector using 4 slots, but it would also
567 require additional processing to distinguish @code{c = a op b}
568 from @code{c = a op b ? x : y}.  Something similar occurs with
569 @code{ASSERT_EXPR}.   In time, these special case tree
570 expressions should be flattened into the operand vector.
571 @end itemize
572
573 For tree nodes in the categories @code{GIMPLE_TERNARY_RHS},
574 @code{GIMPLE_BINARY_RHS} and @code{GIMPLE_UNARY_RHS}, they cannot be
575 stored inside tuples directly.  They first need to be flattened and
576 separated into individual components.  For instance, given the GENERIC
577 expression
578
579 @smallexample
580 a = b + c
581 @end smallexample
582
583 its tree representation is:
584
585 @smallexample
586 MODIFY_EXPR <VAR_DECL  <a>, PLUS_EXPR <VAR_DECL <b>, VAR_DECL <c>>>
587 @end smallexample
588
589 In this case, the GIMPLE form for this statement is logically
590 identical to its GENERIC form but in GIMPLE, the @code{PLUS_EXPR}
591 on the RHS of the assignment is not represented as a tree,
592 instead the two operands are taken out of the @code{PLUS_EXPR} sub-tree
593 and flattened into the GIMPLE tuple as follows:
594
595 @smallexample
596 GIMPLE_ASSIGN <PLUS_EXPR, VAR_DECL <a>, VAR_DECL <b>, VAR_DECL <c>>
597 @end smallexample
598
599 @subsection Operand vector allocation
600
601 The operand vector is stored at the bottom of the three tuple
602 structures that accept operands. This means, that depending on
603 the code of a given statement, its operand vector will be at
604 different offsets from the base of the structure.  To access
605 tuple operands use the following accessors
606
607 @deftypefn {GIMPLE function} unsigned gimple_num_ops (gimple g)
608 Returns the number of operands in statement G.
609 @end deftypefn
610
611 @deftypefn {GIMPLE function} tree gimple_op (gimple g, unsigned i)
612 Returns operand @code{I} from statement @code{G}.
613 @end deftypefn
614
615 @deftypefn {GIMPLE function} tree *gimple_ops (gimple g)
616 Returns a pointer into the operand vector for statement @code{G}.  This
617 is computed using an internal table called @code{gimple_ops_offset_}[].
618 This table is indexed by the gimple code of @code{G}.
619
620 When the compiler is built, this table is filled-in using the
621 sizes of the structures used by each statement code defined in
622 gimple.def.  Since the operand vector is at the bottom of the
623 structure, for a gimple code @code{C} the offset is computed as sizeof
624 (struct-of @code{C}) - sizeof (tree).
625
626 This mechanism adds one memory indirection to every access when
627 using @code{gimple_op}(), if this becomes a bottleneck, a pass can
628 choose to memoize the result from @code{gimple_ops}() and use that to
629 access the operands.
630 @end deftypefn
631
632 @subsection Operand validation
633
634 When adding a new operand to a gimple statement, the operand will
635 be validated according to what each tuple accepts in its operand
636 vector.  These predicates are called by the
637 @code{gimple_<name>_set_...()}.  Each tuple will use one of the
638 following predicates (Note, this list is not exhaustive):
639
640 @deftypefn {GIMPLE function} is_gimple_operand (tree t)
641 This is the most permissive of the predicates.  It essentially
642 checks whether t has a @code{gimple_rhs_class} of @code{GIMPLE_SINGLE_RHS}.
643 @end deftypefn
644
645
646 @deftypefn {GIMPLE function} is_gimple_val (tree t)
647 Returns true if t is a "GIMPLE value", which are all the
648 non-addressable stack variables (variables for which
649 @code{is_gimple_reg} returns true) and constants (expressions for which
650 @code{is_gimple_min_invariant} returns true).
651 @end deftypefn
652
653 @deftypefn {GIMPLE function} is_gimple_addressable (tree t)
654 Returns true if t is a symbol or memory reference whose address
655 can be taken.
656 @end deftypefn
657
658 @deftypefn {GIMPLE function} is_gimple_asm_val (tree t)
659 Similar to @code{is_gimple_val} but it also accepts hard registers.
660 @end deftypefn
661
662 @deftypefn {GIMPLE function} is_gimple_call_addr (tree t)
663 Return true if t is a valid expression to use as the function
664 called by a @code{GIMPLE_CALL}.
665 @end deftypefn
666
667 @deftypefn {GIMPLE function} is_gimple_constant (tree t)
668 Return true if t is a valid gimple constant.
669 @end deftypefn
670
671 @deftypefn {GIMPLE function} is_gimple_min_invariant (tree t)
672 Return true if t is a valid minimal invariant.  This is different
673 from constants, in that the specific value of t may not be known
674 at compile time, but it is known that it doesn't change (e.g.,
675 the address of a function local variable).
676 @end deftypefn
677
678 @deftypefn {GIMPLE function} is_gimple_min_invariant_address (tree t)
679 Return true if t is an @code{ADDR_EXPR} that does not change once a
680 function is running.
681 @end deftypefn
682
683 @deftypefn {GIMPLE function} is_gimple_ip_invariant (tree t)
684 Return true if t is an interprocedural invariant.  This means that t
685 is a valid invariant in all functions (e.g. it can be an address of a
686 global variable but not of a local one).
687 @end deftypefn
688
689 @deftypefn {GIMPLE function} is_gimple_ip_invariant_address (tree t)
690 Return true if t is an @code{ADDR_EXPR} that does not change once the
691 program is running (and which is valid in all functions).
692 @end deftypefn
693
694
695 @subsection Statement validation
696
697 @deftypefn {GIMPLE function} is_gimple_assign (gimple g)
698 Return true if the code of g is @code{GIMPLE_ASSIGN}.
699 @end deftypefn
700  
701 @deftypefn {GIMPLE function} is_gimple_call (gimple g)
702 Return true if the code of g is @code{GIMPLE_CALL}.
703 @end deftypefn
704  
705 @deftypefn {GIMPLE function} is_gimple_debug (gimple g)
706 Return true if the code of g is @code{GIMPLE_DEBUG}.
707 @end deftypefn
708
709 @deftypefn {GIMPLE function} gimple_assign_cast_p (gimple g)
710 Return true if g is a @code{GIMPLE_ASSIGN} that performs a type cast
711 operation.
712 @end deftypefn
713
714 @deftypefn {GIMPLE function} gimple_debug_bind_p (gimple g)
715 Return true if g is a @code{GIMPLE_DEBUG} that binds the value of an
716 expression to a variable.
717 @end deftypefn
718
719 @node Manipulating GIMPLE statements
720 @section Manipulating GIMPLE statements
721 @cindex Manipulating GIMPLE statements
722
723 This section documents all the functions available to handle each
724 of the GIMPLE instructions.
725
726 @subsection Common accessors 
727 The following are common accessors for gimple statements.
728
729 @deftypefn {GIMPLE function} enum gimple_code gimple_code (gimple g)
730 Return the code for statement @code{G}.
731 @end deftypefn
732  
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
736  
737 @deftypefn {GIMPLE function} tree gimple_block (gimple g)
738 Return the lexical scope block holding statement @code{G}.
739 @end deftypefn
740  
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
748
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
757
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
761  
762 @deftypefn {GIMPLE function} location_t gimple_locus (gimple g)
763 Return locus information for statement @code{G}.
764 @end deftypefn
765  
766 @deftypefn {GIMPLE function} void gimple_set_locus (gimple g, location_t locus)
767 Set locus information for statement @code{G}.
768 @end deftypefn
769  
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
773  
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
777  
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
781  
782 @deftypefn {GIMPLE function} bool gimple_visited_p (gimple stmt)
783 Return the visited status on statement @code{STMT}.
784 @end deftypefn
785  
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
789  
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
793  
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
797  
798 @deftypefn {GIMPLE function} bool gimple_has_mem_ops (gimple g)
799 Return true if statement @code{G} has memory operands.
800 @end deftypefn
801  
802 @deftypefn {GIMPLE function} unsigned gimple_num_ops (gimple g)
803 Return the number of operands for statement @code{G}.
804 @end deftypefn
805  
806 @deftypefn {GIMPLE function} tree *gimple_ops (gimple g)
807 Return the array of operands for statement @code{G}.
808 @end deftypefn
809  
810 @deftypefn {GIMPLE function} tree gimple_op (gimple g, unsigned i)
811 Return operand @code{I} for statement @code{G}.
812 @end deftypefn
813  
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
817  
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
821  
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
826  
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
830  
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
834  
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
838  
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
842  
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
846  
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
850  
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
854  
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
858  
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
863  
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
868  
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
873  
874 @deftypefn {GIMPLE function} bool gimple_has_volatile_ops (gimple stmt)
875 Return true if statement @code{STMT} contains volatile operands.
876 @end deftypefn
877  
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
881  
882 @deftypefn {GIMPLE function} void update_stmt (gimple s)
883 Mark statement @code{S} as modified, and update it.
884 @end deftypefn
885  
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
889  
890 @deftypefn {GIMPLE function} gimple gimple_copy (gimple stmt)
891 Return a deep copy of statement @code{STMT}.
892 @end deftypefn
893
894 @node Tuple specific accessors
895 @section Tuple specific accessors
896 @cindex Tuple specific accessors
897
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_EH_FILTER}::
906 * @code{GIMPLE_LABEL}::
907 * @code{GIMPLE_NOP}::
908 * @code{GIMPLE_OMP_ATOMIC_LOAD}::
909 * @code{GIMPLE_OMP_ATOMIC_STORE}::
910 * @code{GIMPLE_OMP_CONTINUE}::
911 * @code{GIMPLE_OMP_CRITICAL}::
912 * @code{GIMPLE_OMP_FOR}::
913 * @code{GIMPLE_OMP_MASTER}::
914 * @code{GIMPLE_OMP_ORDERED}::
915 * @code{GIMPLE_OMP_PARALLEL}::
916 * @code{GIMPLE_OMP_RETURN}::
917 * @code{GIMPLE_OMP_SECTION}::
918 * @code{GIMPLE_OMP_SECTIONS}::
919 * @code{GIMPLE_OMP_SINGLE}::
920 * @code{GIMPLE_PHI}::
921 * @code{GIMPLE_RESX}::
922 * @code{GIMPLE_RETURN}::
923 * @code{GIMPLE_SWITCH}::
924 * @code{GIMPLE_TRY}::
925 * @code{GIMPLE_WITH_CLEANUP_EXPR}::
926 @end menu
927
928
929 @node @code{GIMPLE_ASM}
930 @subsection @code{GIMPLE_ASM}
931 @cindex @code{GIMPLE_ASM}
932
933 @deftypefn {GIMPLE function} gimple gimple_build_asm (const char *string, ninputs, noutputs, nclobbers, ...)
934 Build a @code{GIMPLE_ASM} statement.  This statement is used for
935 building in-line assembly constructs.  @code{STRING} is the assembly
936 code.  @code{NINPUT} is the number of register inputs.  @code{NOUTPUT} is the
937 number of register outputs.  @code{NCLOBBERS} is the number of clobbered
938 registers.  The rest of the arguments trees for each input,
939 output, and clobbered registers.
940 @end deftypefn
941
942 @deftypefn {GIMPLE function} gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *, VEC(tree,gc) *)
943 Identical to gimple_build_asm, but the arguments are passed in
944 VECs.
945 @end deftypefn
946
947 @deftypefn {GIMPLE function} gimple_asm_ninputs (gimple g)
948 Return the number of input operands for @code{GIMPLE_ASM} @code{G}. 
949 @end deftypefn
950
951 @deftypefn {GIMPLE function} gimple_asm_noutputs (gimple g)
952 Return the number of output operands for @code{GIMPLE_ASM} @code{G}. 
953 @end deftypefn
954
955 @deftypefn {GIMPLE function} gimple_asm_nclobbers (gimple g)
956 Return the number of clobber operands for @code{GIMPLE_ASM} @code{G}. 
957 @end deftypefn
958
959 @deftypefn {GIMPLE function} tree gimple_asm_input_op (gimple g, unsigned index)
960 Return input operand @code{INDEX} of @code{GIMPLE_ASM} @code{G}. 
961 @end deftypefn
962
963 @deftypefn {GIMPLE function} void gimple_asm_set_input_op (gimple g, unsigned index, tree in_op)
964 Set @code{IN_OP} to be input operand @code{INDEX} in @code{GIMPLE_ASM} @code{G}. 
965 @end deftypefn
966
967 @deftypefn {GIMPLE function} tree gimple_asm_output_op (gimple g, unsigned index)
968 Return output operand @code{INDEX} of @code{GIMPLE_ASM} @code{G}. 
969 @end deftypefn
970
971 @deftypefn {GIMPLE function} void gimple_asm_set_output_op (gimple g, @
972 unsigned index, tree out_op)
973 Set @code{OUT_OP} to be output operand @code{INDEX} in @code{GIMPLE_ASM} @code{G}. 
974 @end deftypefn
975
976 @deftypefn {GIMPLE function} tree gimple_asm_clobber_op (gimple g, unsigned index)
977 Return clobber operand @code{INDEX} of @code{GIMPLE_ASM} @code{G}. 
978 @end deftypefn
979
980 @deftypefn {GIMPLE function} void gimple_asm_set_clobber_op (gimple g, unsigned index, tree clobber_op)
981 Set @code{CLOBBER_OP} to be clobber operand @code{INDEX} in @code{GIMPLE_ASM} @code{G}. 
982 @end deftypefn
983
984 @deftypefn {GIMPLE function} const char *gimple_asm_string (gimple g)
985 Return the string representing the assembly instruction in
986 @code{GIMPLE_ASM} @code{G}. 
987 @end deftypefn
988
989 @deftypefn {GIMPLE function} bool gimple_asm_volatile_p (gimple g)
990 Return true if @code{G} is an asm statement marked volatile. 
991 @end deftypefn
992
993 @deftypefn {GIMPLE function} void gimple_asm_set_volatile (gimple g)
994 Mark asm statement @code{G} as volatile. 
995 @end deftypefn
996
997 @deftypefn {GIMPLE function} void gimple_asm_clear_volatile (gimple g)
998 Remove volatile marker from asm statement @code{G}. 
999 @end deftypefn
1000
1001 @node @code{GIMPLE_ASSIGN}
1002 @subsection @code{GIMPLE_ASSIGN}
1003 @cindex @code{GIMPLE_ASSIGN}
1004
1005 @deftypefn {GIMPLE function} gimple gimple_build_assign (tree lhs, tree rhs)
1006 Build a @code{GIMPLE_ASSIGN} statement.  The left-hand side is an lvalue
1007 passed in lhs.  The right-hand side can be either a unary or
1008 binary tree expression.  The expression tree rhs will be
1009 flattened and its operands assigned to the corresponding operand
1010 slots in the new statement.  This function is useful when you
1011 already have a tree expression that you want to convert into a
1012 tuple.  However, try to avoid building expression trees for the
1013 sole purpose of calling this function.  If you already have the
1014 operands in separate trees, it is better to use
1015 @code{gimple_build_assign_with_ops}.
1016 @end deftypefn
1017
1018
1019 @deftypefn {GIMPLE function} gimple gimplify_assign (tree dst, tree src, gimple_seq *seq_p)
1020 Build a new @code{GIMPLE_ASSIGN} tuple and append it to the end of
1021 @code{*SEQ_P}.
1022 @end deftypefn
1023
1024 @code{DST}/@code{SRC} are the destination and source respectively.  You can
1025 pass ungimplified trees in @code{DST} or @code{SRC}, in which
1026 case they will be converted to a gimple operand if necessary.
1027
1028 This function returns the newly created @code{GIMPLE_ASSIGN} tuple.
1029
1030 @deftypefn {GIMPLE function} gimple gimple_build_assign_with_ops @
1031 (enum tree_code subcode, tree lhs, tree op1, tree op2)
1032 This function is similar to @code{gimple_build_assign}, but is used to
1033 build a @code{GIMPLE_ASSIGN} statement when the operands of the
1034 right-hand side of the assignment are already split into
1035 different operands.
1036
1037 The left-hand side is an lvalue passed in lhs.  Subcode is the
1038 @code{tree_code} for the right-hand side of the assignment.  Op1 and op2
1039 are the operands.  If op2 is null, subcode must be a @code{tree_code}
1040 for a unary expression.
1041 @end deftypefn
1042
1043 @deftypefn {GIMPLE function} enum tree_code gimple_assign_rhs_code (gimple g)
1044 Return the code of the expression computed on the @code{RHS} of
1045 assignment statement @code{G}.
1046 @end deftypefn
1047  
1048
1049 @deftypefn {GIMPLE function} enum gimple_rhs_class gimple_assign_rhs_class (gimple g)
1050 Return the gimple rhs class of the code for the expression
1051 computed on the rhs of assignment statement @code{G}.  This will never
1052 return @code{GIMPLE_INVALID_RHS}.
1053 @end deftypefn
1054
1055 @deftypefn {GIMPLE function} tree gimple_assign_lhs (gimple g)
1056 Return the @code{LHS} of assignment statement @code{G}.
1057 @end deftypefn
1058  
1059 @deftypefn {GIMPLE function} tree *gimple_assign_lhs_ptr (gimple g)
1060 Return a pointer to the @code{LHS} of assignment statement @code{G}.
1061 @end deftypefn
1062  
1063 @deftypefn {GIMPLE function} tree gimple_assign_rhs1 (gimple g)
1064 Return the first operand on the @code{RHS} of assignment statement @code{G}.
1065 @end deftypefn
1066  
1067 @deftypefn {GIMPLE function} tree *gimple_assign_rhs1_ptr (gimple g)
1068 Return the address of the first operand on the @code{RHS} of assignment
1069 statement @code{G}.
1070 @end deftypefn
1071  
1072 @deftypefn {GIMPLE function} tree gimple_assign_rhs2 (gimple g)
1073 Return the second operand on the @code{RHS} of assignment statement @code{G}.
1074 @end deftypefn
1075  
1076 @deftypefn {GIMPLE function} tree *gimple_assign_rhs2_ptr (gimple g)
1077 Return the address of the second operand on the @code{RHS} of assignment
1078 statement @code{G}.
1079 @end deftypefn
1080
1081 @deftypefn {GIMPLE function} tree gimple_assign_rhs3 (gimple g)
1082 Return the third operand on the @code{RHS} of assignment statement @code{G}.
1083 @end deftypefn
1084  
1085 @deftypefn {GIMPLE function} tree *gimple_assign_rhs3_ptr (gimple g)
1086 Return the address of the third operand on the @code{RHS} of assignment
1087 statement @code{G}.
1088 @end deftypefn
1089
1090 @deftypefn {GIMPLE function} void gimple_assign_set_lhs (gimple g, tree lhs)
1091 Set @code{LHS} to be the @code{LHS} operand of assignment statement @code{G}.
1092 @end deftypefn
1093  
1094 @deftypefn {GIMPLE function} void gimple_assign_set_rhs1 (gimple g, tree rhs)
1095 Set @code{RHS} to be the first operand on the @code{RHS} of assignment
1096 statement @code{G}.
1097 @end deftypefn
1098  
1099 @deftypefn {GIMPLE function} void gimple_assign_set_rhs2 (gimple g, tree rhs)
1100 Set @code{RHS} to be the second operand on the @code{RHS} of assignment
1101 statement @code{G}.
1102 @end deftypefn
1103  
1104 @deftypefn {GIMPLE function} void gimple_assign_set_rhs3 (gimple g, tree rhs)
1105 Set @code{RHS} to be the third operand on the @code{RHS} of assignment
1106 statement @code{G}.
1107 @end deftypefn
1108  
1109 @deftypefn {GIMPLE function} bool gimple_assign_cast_p (gimple s)
1110 Return true if @code{S} is a type-cast assignment.
1111 @end deftypefn
1112
1113
1114 @node @code{GIMPLE_BIND}
1115 @subsection @code{GIMPLE_BIND}
1116 @cindex @code{GIMPLE_BIND}
1117
1118 @deftypefn {GIMPLE function} gimple gimple_build_bind (tree vars, gimple_seq body)
1119 Build a @code{GIMPLE_BIND} statement with a list of variables in @code{VARS}
1120 and a body of statements in sequence @code{BODY}.
1121 @end deftypefn
1122
1123 @deftypefn {GIMPLE function} tree gimple_bind_vars (gimple g)
1124 Return the variables declared in the @code{GIMPLE_BIND} statement @code{G}. 
1125 @end deftypefn
1126
1127 @deftypefn {GIMPLE function} void gimple_bind_set_vars (gimple g, tree vars)
1128 Set @code{VARS} to be the set of variables declared in the @code{GIMPLE_BIND}
1129 statement @code{G}. 
1130 @end deftypefn
1131
1132 @deftypefn {GIMPLE function} void gimple_bind_append_vars (gimple g, tree vars)
1133 Append @code{VARS} to the set of variables declared in the @code{GIMPLE_BIND}
1134 statement @code{G}.
1135 @end deftypefn
1136
1137 @deftypefn {GIMPLE function} gimple_seq gimple_bind_body (gimple g)
1138 Return the GIMPLE sequence contained in the @code{GIMPLE_BIND} statement
1139 @code{G}. 
1140 @end deftypefn
1141
1142 @deftypefn {GIMPLE function} void gimple_bind_set_body (gimple g, gimple_seq seq)
1143 Set @code{SEQ} to be sequence contained in the @code{GIMPLE_BIND} statement @code{G}.
1144 @end deftypefn
1145
1146 @deftypefn {GIMPLE function} void gimple_bind_add_stmt (gimple gs, gimple stmt)
1147 Append a statement to the end of a @code{GIMPLE_BIND}'s body. 
1148 @end deftypefn
1149
1150 @deftypefn {GIMPLE function} void gimple_bind_add_seq (gimple gs, gimple_seq seq)
1151 Append a sequence of statements to the end of a @code{GIMPLE_BIND}'s
1152 body.
1153 @end deftypefn
1154
1155 @deftypefn {GIMPLE function} tree gimple_bind_block (gimple g)
1156 Return the @code{TREE_BLOCK} node associated with @code{GIMPLE_BIND} statement
1157 @code{G}. This is analogous to the @code{BIND_EXPR_BLOCK} field in trees. 
1158 @end deftypefn
1159
1160 @deftypefn {GIMPLE function} void gimple_bind_set_block (gimple g, tree block)
1161 Set @code{BLOCK} to be the @code{TREE_BLOCK} node associated with @code{GIMPLE_BIND}
1162 statement @code{G}. 
1163 @end deftypefn
1164
1165
1166 @node @code{GIMPLE_CALL}
1167 @subsection @code{GIMPLE_CALL}
1168 @cindex @code{GIMPLE_CALL}
1169
1170 @deftypefn {GIMPLE function} gimple gimple_build_call (tree fn, unsigned nargs, ...)
1171 Build a @code{GIMPLE_CALL} statement to function @code{FN}.  The argument @code{FN}
1172 must be either a @code{FUNCTION_DECL} or a gimple call address as
1173 determined by @code{is_gimple_call_addr}.  @code{NARGS} are the number of
1174 arguments.  The rest of the arguments follow the argument @code{NARGS},
1175 and must be trees that are valid as rvalues in gimple (i.e., each
1176 operand is validated with @code{is_gimple_operand}).
1177 @end deftypefn
1178
1179
1180 @deftypefn {GIMPLE function} gimple gimple_build_call_from_tree (tree call_expr)
1181 Build a @code{GIMPLE_CALL} from a @code{CALL_EXPR} node.  The arguments and the
1182 function are taken from the expression directly.  This routine
1183 assumes that @code{call_expr} is already in GIMPLE form.  That is, its
1184 operands are GIMPLE values and the function call needs no further
1185 simplification.  All the call flags in @code{call_expr} are copied over
1186 to the new @code{GIMPLE_CALL}.
1187 @end deftypefn
1188
1189 @deftypefn {GIMPLE function} gimple gimple_build_call_vec (tree fn, @code{VEC}(tree, heap) *args)
1190 Identical to @code{gimple_build_call} but the arguments are stored in a
1191 @code{VEC}().
1192 @end deftypefn
1193
1194 @deftypefn {GIMPLE function} tree gimple_call_lhs (gimple g)
1195 Return the @code{LHS} of call statement @code{G}.
1196 @end deftypefn
1197  
1198 @deftypefn {GIMPLE function} tree *gimple_call_lhs_ptr (gimple g)
1199 Return a pointer to the @code{LHS} of call statement @code{G}.
1200 @end deftypefn
1201  
1202 @deftypefn {GIMPLE function} void gimple_call_set_lhs (gimple g, tree lhs)
1203 Set @code{LHS} to be the @code{LHS} operand of call statement @code{G}.
1204 @end deftypefn
1205  
1206 @deftypefn {GIMPLE function} tree gimple_call_fn (gimple g)
1207 Return the tree node representing the function called by call
1208 statement @code{G}.
1209 @end deftypefn
1210  
1211 @deftypefn {GIMPLE function} void gimple_call_set_fn (gimple g, tree fn)
1212 Set @code{FN} to be the function called by call statement @code{G}.  This has
1213 to be a gimple value specifying the address of the called
1214 function.
1215 @end deftypefn
1216  
1217 @deftypefn {GIMPLE function} tree gimple_call_fndecl (gimple g)
1218 If a given @code{GIMPLE_CALL}'s callee is a @code{FUNCTION_DECL}, return it.
1219 Otherwise return @code{NULL}.  This function is analogous to
1220 @code{get_callee_fndecl} in @code{GENERIC}.
1221 @end deftypefn
1222  
1223 @deftypefn {GIMPLE function} tree gimple_call_set_fndecl (gimple g, tree fndecl)
1224 Set the called function to @code{FNDECL}.
1225 @end deftypefn
1226
1227 @deftypefn {GIMPLE function} tree gimple_call_return_type (gimple g)
1228 Return the type returned by call statement @code{G}.
1229 @end deftypefn
1230  
1231 @deftypefn {GIMPLE function} tree gimple_call_chain (gimple g)
1232 Return the static chain for call statement @code{G}. 
1233 @end deftypefn
1234
1235 @deftypefn {GIMPLE function} void gimple_call_set_chain (gimple g, tree chain)
1236 Set @code{CHAIN} to be the static chain for call statement @code{G}. 
1237 @end deftypefn
1238
1239 @deftypefn {GIMPLE function} gimple_call_num_args (gimple g)
1240 Return the number of arguments used by call statement @code{G}. 
1241 @end deftypefn
1242
1243 @deftypefn {GIMPLE function} tree gimple_call_arg (gimple g, unsigned index)
1244 Return the argument at position @code{INDEX} for call statement @code{G}.  The
1245 first argument is 0.
1246 @end deftypefn
1247  
1248 @deftypefn {GIMPLE function} tree *gimple_call_arg_ptr (gimple g, unsigned index)
1249 Return a pointer to the argument at position @code{INDEX} for call
1250 statement @code{G}. 
1251 @end deftypefn
1252
1253 @deftypefn {GIMPLE function} void gimple_call_set_arg (gimple g, unsigned index, tree arg)
1254 Set @code{ARG} to be the argument at position @code{INDEX} for call statement
1255 @code{G}. 
1256 @end deftypefn
1257
1258 @deftypefn {GIMPLE function} void gimple_call_set_tail (gimple s)
1259 Mark call statement @code{S} as being a tail call (i.e., a call just
1260 before the exit of a function). These calls are candidate for
1261 tail call optimization. 
1262 @end deftypefn
1263
1264 @deftypefn {GIMPLE function} bool gimple_call_tail_p (gimple s)
1265 Return true if @code{GIMPLE_CALL} @code{S} is marked as a tail call. 
1266 @end deftypefn
1267
1268 @deftypefn {GIMPLE function} void gimple_call_mark_uninlinable (gimple s)
1269 Mark @code{GIMPLE_CALL} @code{S} as being uninlinable. 
1270 @end deftypefn
1271
1272 @deftypefn {GIMPLE function} bool gimple_call_cannot_inline_p (gimple s)
1273 Return true if @code{GIMPLE_CALL} @code{S} cannot be inlined. 
1274 @end deftypefn
1275
1276 @deftypefn {GIMPLE function} bool gimple_call_noreturn_p (gimple s)
1277 Return true if @code{S} is a noreturn call. 
1278 @end deftypefn
1279
1280 @deftypefn {GIMPLE function} gimple gimple_call_copy_skip_args (gimple stmt, bitmap args_to_skip)
1281 Build a @code{GIMPLE_CALL} identical to @code{STMT} but skipping the arguments
1282 in the positions marked by the set @code{ARGS_TO_SKIP}.
1283 @end deftypefn
1284
1285
1286 @node @code{GIMPLE_CATCH}
1287 @subsection @code{GIMPLE_CATCH}
1288 @cindex @code{GIMPLE_CATCH}
1289
1290 @deftypefn {GIMPLE function} gimple gimple_build_catch (tree types, gimple_seq handler)
1291 Build a @code{GIMPLE_CATCH} statement.  @code{TYPES} are the tree types this
1292 catch handles.  @code{HANDLER} is a sequence of statements with the code
1293 for the handler.
1294 @end deftypefn
1295
1296 @deftypefn {GIMPLE function} tree gimple_catch_types (gimple g)
1297 Return the types handled by @code{GIMPLE_CATCH} statement @code{G}. 
1298 @end deftypefn
1299
1300 @deftypefn {GIMPLE function} tree *gimple_catch_types_ptr (gimple g)
1301 Return a pointer to the types handled by @code{GIMPLE_CATCH} statement
1302 @code{G}. 
1303 @end deftypefn
1304
1305 @deftypefn {GIMPLE function} gimple_seq gimple_catch_handler (gimple g)
1306 Return the GIMPLE sequence representing the body of the handler
1307 of @code{GIMPLE_CATCH} statement @code{G}. 
1308 @end deftypefn
1309
1310 @deftypefn {GIMPLE function} void gimple_catch_set_types (gimple g, tree t)
1311 Set @code{T} to be the set of types handled by @code{GIMPLE_CATCH} @code{G}. 
1312 @end deftypefn
1313
1314 @deftypefn {GIMPLE function} void gimple_catch_set_handler (gimple g, gimple_seq handler)
1315 Set @code{HANDLER} to be the body of @code{GIMPLE_CATCH} @code{G}. 
1316 @end deftypefn
1317
1318
1319 @node @code{GIMPLE_COND}
1320 @subsection @code{GIMPLE_COND}
1321 @cindex @code{GIMPLE_COND}
1322
1323 @deftypefn {GIMPLE function} gimple gimple_build_cond (enum tree_code pred_code, tree lhs, tree rhs, tree t_label, tree f_label)
1324 Build a @code{GIMPLE_COND} statement.  @code{A} @code{GIMPLE_COND} statement compares
1325 @code{LHS} and @code{RHS} and if the condition in @code{PRED_CODE} is true, jump to
1326 the label in @code{t_label}, otherwise jump to the label in @code{f_label}.
1327 @code{PRED_CODE} are relational operator tree codes like @code{EQ_EXPR},
1328 @code{LT_EXPR}, @code{LE_EXPR}, @code{NE_EXPR}, etc.
1329 @end deftypefn
1330
1331
1332 @deftypefn {GIMPLE function} gimple gimple_build_cond_from_tree (tree cond, tree t_label, tree f_label)
1333 Build a @code{GIMPLE_COND} statement from the conditional expression
1334 tree @code{COND}.  @code{T_LABEL} and @code{F_LABEL} are as in @code{gimple_build_cond}.
1335 @end deftypefn
1336
1337 @deftypefn {GIMPLE function} enum tree_code gimple_cond_code (gimple g)
1338 Return the code of the predicate computed by conditional
1339 statement @code{G}. 
1340 @end deftypefn
1341
1342 @deftypefn {GIMPLE function} void gimple_cond_set_code (gimple g, enum tree_code code)
1343 Set @code{CODE} to be the predicate code for the conditional statement
1344 @code{G}. 
1345 @end deftypefn
1346
1347 @deftypefn {GIMPLE function} tree gimple_cond_lhs (gimple g)
1348 Return the @code{LHS} of the predicate computed by conditional statement
1349 @code{G}. 
1350 @end deftypefn
1351
1352 @deftypefn {GIMPLE function} void gimple_cond_set_lhs (gimple g, tree lhs)
1353 Set @code{LHS} to be the @code{LHS} operand of the predicate computed by
1354 conditional statement @code{G}. 
1355 @end deftypefn
1356
1357 @deftypefn {GIMPLE function} tree gimple_cond_rhs (gimple g)
1358 Return the @code{RHS} operand of the predicate computed by conditional
1359 @code{G}. 
1360 @end deftypefn
1361
1362 @deftypefn {GIMPLE function} void gimple_cond_set_rhs (gimple g, tree rhs)
1363 Set @code{RHS} to be the @code{RHS} operand of the predicate computed by
1364 conditional statement @code{G}. 
1365 @end deftypefn
1366
1367 @deftypefn {GIMPLE function} tree gimple_cond_true_label (gimple g)
1368 Return the label used by conditional statement @code{G} when its
1369 predicate evaluates to true. 
1370 @end deftypefn
1371
1372 @deftypefn {GIMPLE function} void gimple_cond_set_true_label (gimple g, tree label)
1373 Set @code{LABEL} to be the label used by conditional statement @code{G} when
1374 its predicate evaluates to true. 
1375 @end deftypefn
1376
1377 @deftypefn {GIMPLE function} void gimple_cond_set_false_label (gimple g, tree label)
1378 Set @code{LABEL} to be the label used by conditional statement @code{G} when
1379 its predicate evaluates to false. 
1380 @end deftypefn
1381
1382 @deftypefn {GIMPLE function} tree gimple_cond_false_label (gimple g)
1383 Return the label used by conditional statement @code{G} when its
1384 predicate evaluates to false. 
1385 @end deftypefn
1386
1387 @deftypefn {GIMPLE function} void gimple_cond_make_false (gimple g)
1388 Set the conditional @code{COND_STMT} to be of the form 'if (1 == 0)'. 
1389 @end deftypefn
1390
1391 @deftypefn {GIMPLE function} void gimple_cond_make_true (gimple g)
1392 Set the conditional @code{COND_STMT} to be of the form 'if (1 == 1)'. 
1393 @end deftypefn
1394
1395 @node @code{GIMPLE_EH_FILTER}
1396 @subsection @code{GIMPLE_EH_FILTER}
1397 @cindex @code{GIMPLE_EH_FILTER}
1398
1399 @deftypefn {GIMPLE function} gimple gimple_build_eh_filter (tree types, gimple_seq failure)
1400 Build a @code{GIMPLE_EH_FILTER} statement.  @code{TYPES} are the filter's
1401 types.  @code{FAILURE} is a sequence with the filter's failure action.
1402 @end deftypefn
1403
1404 @deftypefn {GIMPLE function} tree gimple_eh_filter_types (gimple g)
1405 Return the types handled by @code{GIMPLE_EH_FILTER} statement @code{G}. 
1406 @end deftypefn
1407
1408 @deftypefn {GIMPLE function} tree *gimple_eh_filter_types_ptr (gimple g)
1409 Return a pointer to the types handled by @code{GIMPLE_EH_FILTER}
1410 statement @code{G}. 
1411 @end deftypefn
1412
1413 @deftypefn {GIMPLE function} gimple_seq gimple_eh_filter_failure (gimple g)
1414 Return the sequence of statement to execute when @code{GIMPLE_EH_FILTER}
1415 statement fails. 
1416 @end deftypefn
1417
1418 @deftypefn {GIMPLE function} void gimple_eh_filter_set_types (gimple g, tree types)
1419 Set @code{TYPES} to be the set of types handled by @code{GIMPLE_EH_FILTER} @code{G}. 
1420 @end deftypefn
1421
1422 @deftypefn {GIMPLE function} void gimple_eh_filter_set_failure (gimple g, gimple_seq failure)
1423 Set @code{FAILURE} to be the sequence of statements to execute on
1424 failure for @code{GIMPLE_EH_FILTER} @code{G}. 
1425 @end deftypefn
1426
1427 @deftypefn {GIMPLE function} bool gimple_eh_filter_must_not_throw (gimple g)
1428 Return the @code{EH_FILTER_MUST_NOT_THROW} flag. 
1429 @end deftypefn
1430
1431 @deftypefn {GIMPLE function} void gimple_eh_filter_set_must_not_throw (gimple g, bool mntp)
1432 Set the @code{EH_FILTER_MUST_NOT_THROW} flag. 
1433 @end deftypefn
1434
1435
1436 @node @code{GIMPLE_LABEL}
1437 @subsection @code{GIMPLE_LABEL}
1438 @cindex @code{GIMPLE_LABEL}
1439
1440 @deftypefn {GIMPLE function} gimple gimple_build_label (tree label)
1441 Build a @code{GIMPLE_LABEL} statement with corresponding to the tree
1442 label, @code{LABEL}.
1443 @end deftypefn
1444
1445 @deftypefn {GIMPLE function} tree gimple_label_label (gimple g)
1446 Return the @code{LABEL_DECL} node used by @code{GIMPLE_LABEL} statement @code{G}. 
1447 @end deftypefn
1448
1449 @deftypefn {GIMPLE function} void gimple_label_set_label (gimple g, tree label)
1450 Set @code{LABEL} to be the @code{LABEL_DECL} node used by @code{GIMPLE_LABEL}
1451 statement @code{G}. 
1452 @end deftypefn
1453
1454
1455 @deftypefn {GIMPLE function} gimple gimple_build_goto (tree dest)
1456 Build a @code{GIMPLE_GOTO} statement to label @code{DEST}.
1457 @end deftypefn
1458
1459 @deftypefn {GIMPLE function} tree gimple_goto_dest (gimple g)
1460 Return the destination of the unconditional jump @code{G}. 
1461 @end deftypefn
1462
1463 @deftypefn {GIMPLE function} void gimple_goto_set_dest (gimple g, tree dest)
1464 Set @code{DEST} to be the destination of the unconditional jump @code{G}.
1465 @end deftypefn
1466
1467
1468 @node @code{GIMPLE_NOP}
1469 @subsection @code{GIMPLE_NOP}
1470 @cindex @code{GIMPLE_NOP}
1471
1472 @deftypefn {GIMPLE function} gimple gimple_build_nop (void)
1473 Build a @code{GIMPLE_NOP} statement.
1474 @end deftypefn
1475
1476 @deftypefn {GIMPLE function} bool gimple_nop_p (gimple g)
1477 Returns @code{TRUE} if statement @code{G} is a @code{GIMPLE_NOP}. 
1478 @end deftypefn
1479
1480 @node @code{GIMPLE_OMP_ATOMIC_LOAD}
1481 @subsection @code{GIMPLE_OMP_ATOMIC_LOAD}
1482 @cindex @code{GIMPLE_OMP_ATOMIC_LOAD}
1483
1484 @deftypefn {GIMPLE function} gimple gimple_build_omp_atomic_load (tree lhs, tree rhs)
1485 Build a @code{GIMPLE_OMP_ATOMIC_LOAD} statement.  @code{LHS} is the left-hand
1486 side of the assignment.  @code{RHS} is the right-hand side of the
1487 assignment.
1488 @end deftypefn
1489
1490 @deftypefn {GIMPLE function} void gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
1491 Set the @code{LHS} of an atomic load. 
1492 @end deftypefn
1493
1494 @deftypefn {GIMPLE function} tree gimple_omp_atomic_load_lhs (gimple g)
1495 Get the @code{LHS} of an atomic load. 
1496 @end deftypefn
1497
1498 @deftypefn {GIMPLE function} void gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
1499 Set the @code{RHS} of an atomic set. 
1500 @end deftypefn
1501
1502 @deftypefn {GIMPLE function} tree gimple_omp_atomic_load_rhs (gimple g)
1503 Get the @code{RHS} of an atomic set. 
1504 @end deftypefn
1505
1506
1507 @node @code{GIMPLE_OMP_ATOMIC_STORE}
1508 @subsection @code{GIMPLE_OMP_ATOMIC_STORE}
1509 @cindex @code{GIMPLE_OMP_ATOMIC_STORE}
1510
1511 @deftypefn {GIMPLE function} gimple gimple_build_omp_atomic_store (tree val)
1512 Build a @code{GIMPLE_OMP_ATOMIC_STORE} statement. @code{VAL} is the value to be
1513 stored.
1514 @end deftypefn
1515
1516 @deftypefn {GIMPLE function} void gimple_omp_atomic_store_set_val (gimple g, tree val)
1517 Set the value being stored in an atomic store. 
1518 @end deftypefn
1519
1520 @deftypefn {GIMPLE function} tree gimple_omp_atomic_store_val (gimple g)
1521 Return the value being stored in an atomic store. 
1522 @end deftypefn
1523
1524 @node @code{GIMPLE_OMP_CONTINUE}
1525 @subsection @code{GIMPLE_OMP_CONTINUE}
1526 @cindex @code{GIMPLE_OMP_CONTINUE}
1527
1528 @deftypefn {GIMPLE function} gimple gimple_build_omp_continue (tree control_def, tree control_use)
1529 Build a @code{GIMPLE_OMP_CONTINUE} statement.  @code{CONTROL_DEF} is the
1530 definition of the control variable.  @code{CONTROL_USE} is the use of
1531 the control variable.
1532 @end deftypefn
1533
1534 @deftypefn {GIMPLE function} tree gimple_omp_continue_control_def (gimple s)
1535 Return the definition of the control variable on a
1536 @code{GIMPLE_OMP_CONTINUE} in @code{S}.
1537 @end deftypefn
1538  
1539 @deftypefn {GIMPLE function} tree gimple_omp_continue_control_def_ptr (gimple s)
1540 Same as above, but return the pointer.
1541 @end deftypefn
1542  
1543 @deftypefn {GIMPLE function} tree gimple_omp_continue_set_control_def (gimple s)
1544 Set the control variable definition for a @code{GIMPLE_OMP_CONTINUE}
1545 statement in @code{S}.
1546 @end deftypefn
1547  
1548 @deftypefn {GIMPLE function} tree gimple_omp_continue_control_use (gimple s)
1549 Return the use of the control variable on a @code{GIMPLE_OMP_CONTINUE}
1550 in @code{S}.
1551 @end deftypefn
1552  
1553 @deftypefn {GIMPLE function} tree gimple_omp_continue_control_use_ptr (gimple s)
1554 Same as above, but return the pointer.
1555 @end deftypefn
1556  
1557 @deftypefn {GIMPLE function} tree gimple_omp_continue_set_control_use (gimple s)
1558 Set the control variable use for a @code{GIMPLE_OMP_CONTINUE} statement
1559 in @code{S}.
1560 @end deftypefn
1561
1562
1563 @node @code{GIMPLE_OMP_CRITICAL}
1564 @subsection @code{GIMPLE_OMP_CRITICAL}
1565 @cindex @code{GIMPLE_OMP_CRITICAL}
1566
1567 @deftypefn {GIMPLE function} gimple gimple_build_omp_critical (gimple_seq body, tree name)
1568 Build a @code{GIMPLE_OMP_CRITICAL} statement. @code{BODY} is the sequence of
1569 statements for which only one thread can execute.  @code{NAME} is an
1570 optional identifier for this critical block.
1571 @end deftypefn
1572
1573 @deftypefn {GIMPLE function} tree gimple_omp_critical_name (gimple g)
1574 Return the name associated with @code{OMP_CRITICAL} statement @code{G}. 
1575 @end deftypefn
1576
1577 @deftypefn {GIMPLE function} tree *gimple_omp_critical_name_ptr (gimple g)
1578 Return a pointer to the name associated with @code{OMP} critical
1579 statement @code{G}. 
1580 @end deftypefn
1581
1582 @deftypefn {GIMPLE function} void gimple_omp_critical_set_name (gimple g, tree name)
1583 Set @code{NAME} to be the name associated with @code{OMP} critical statement @code{G}. 
1584 @end deftypefn
1585
1586 @node @code{GIMPLE_OMP_FOR}
1587 @subsection @code{GIMPLE_OMP_FOR}
1588 @cindex @code{GIMPLE_OMP_FOR}
1589
1590 @deftypefn {GIMPLE function} gimple gimple_build_omp_for (gimple_seq body, @
1591 tree clauses, tree index, tree initial, tree final, tree incr, @
1592 gimple_seq pre_body, enum tree_code omp_for_cond)
1593 Build a @code{GIMPLE_OMP_FOR} statement. @code{BODY} is sequence of statements
1594 inside the for loop.  @code{CLAUSES}, are any of the @code{OMP} loop
1595 construct's clauses: private, firstprivate,  lastprivate,
1596 reductions, ordered, schedule, and nowait.  @code{PRE_BODY} is the
1597 sequence of statements that are loop invariant.  @code{INDEX} is the
1598 index variable.  @code{INITIAL} is the initial value of @code{INDEX}.  @code{FINAL} is
1599 final value of @code{INDEX}.  OMP_FOR_COND is the predicate used to
1600 compare @code{INDEX} and @code{FINAL}.  @code{INCR} is the increment expression.
1601 @end deftypefn
1602
1603 @deftypefn {GIMPLE function} tree gimple_omp_for_clauses (gimple g)
1604 Return the clauses associated with @code{OMP_FOR} @code{G}. 
1605 @end deftypefn
1606
1607 @deftypefn {GIMPLE function} tree *gimple_omp_for_clauses_ptr (gimple g)
1608 Return a pointer to the @code{OMP_FOR} @code{G}. 
1609 @end deftypefn
1610
1611 @deftypefn {GIMPLE function} void gimple_omp_for_set_clauses (gimple g, tree clauses)
1612 Set @code{CLAUSES} to be the list of clauses associated with @code{OMP_FOR} @code{G}. 
1613 @end deftypefn
1614
1615 @deftypefn {GIMPLE function} tree gimple_omp_for_index (gimple g)
1616 Return the index variable for @code{OMP_FOR} @code{G}. 
1617 @end deftypefn
1618
1619 @deftypefn {GIMPLE function} tree *gimple_omp_for_index_ptr (gimple g)
1620 Return a pointer to the index variable for @code{OMP_FOR} @code{G}. 
1621 @end deftypefn
1622
1623 @deftypefn {GIMPLE function} void gimple_omp_for_set_index (gimple g, tree index)
1624 Set @code{INDEX} to be the index variable for @code{OMP_FOR} @code{G}. 
1625 @end deftypefn
1626
1627 @deftypefn {GIMPLE function} tree gimple_omp_for_initial (gimple g)
1628 Return the initial value for @code{OMP_FOR} @code{G}. 
1629 @end deftypefn
1630
1631 @deftypefn {GIMPLE function} tree *gimple_omp_for_initial_ptr (gimple g)
1632 Return a pointer to the initial value for @code{OMP_FOR} @code{G}. 
1633 @end deftypefn
1634
1635 @deftypefn {GIMPLE function} void gimple_omp_for_set_initial (gimple g, tree initial)
1636 Set @code{INITIAL} to be the initial value for @code{OMP_FOR} @code{G}.
1637 @end deftypefn
1638
1639 @deftypefn {GIMPLE function} tree gimple_omp_for_final (gimple g)
1640 Return the final value for @code{OMP_FOR} @code{G}. 
1641 @end deftypefn
1642
1643 @deftypefn {GIMPLE function} tree *gimple_omp_for_final_ptr (gimple g)
1644 turn a pointer to the final value for @code{OMP_FOR} @code{G}. 
1645 @end deftypefn
1646
1647 @deftypefn {GIMPLE function} void gimple_omp_for_set_final (gimple g, tree final)
1648 Set @code{FINAL} to be the final value for @code{OMP_FOR} @code{G}. 
1649 @end deftypefn
1650
1651 @deftypefn {GIMPLE function} tree gimple_omp_for_incr (gimple g)
1652 Return the increment value for @code{OMP_FOR} @code{G}. 
1653 @end deftypefn
1654
1655 @deftypefn {GIMPLE function} tree *gimple_omp_for_incr_ptr (gimple g)
1656 Return a pointer to the increment value for @code{OMP_FOR} @code{G}. 
1657 @end deftypefn
1658
1659 @deftypefn {GIMPLE function} void gimple_omp_for_set_incr (gimple g, tree incr)
1660 Set @code{INCR} to be the increment value for @code{OMP_FOR} @code{G}. 
1661 @end deftypefn
1662
1663 @deftypefn {GIMPLE function} gimple_seq gimple_omp_for_pre_body (gimple g)
1664 Return the sequence of statements to execute before the @code{OMP_FOR}
1665 statement @code{G} starts. 
1666 @end deftypefn
1667
1668 @deftypefn {GIMPLE function} void gimple_omp_for_set_pre_body (gimple g, gimple_seq pre_body)
1669 Set @code{PRE_BODY} to be the sequence of statements to execute before
1670 the @code{OMP_FOR} statement @code{G} starts.
1671 @end deftypefn
1672  
1673 @deftypefn {GIMPLE function} void gimple_omp_for_set_cond (gimple g, enum tree_code cond)
1674 Set @code{COND} to be the condition code for @code{OMP_FOR} @code{G}. 
1675 @end deftypefn
1676
1677 @deftypefn {GIMPLE function} enum tree_code gimple_omp_for_cond (gimple g)
1678 Return the condition code associated with @code{OMP_FOR} @code{G}. 
1679 @end deftypefn
1680
1681
1682 @node @code{GIMPLE_OMP_MASTER}
1683 @subsection @code{GIMPLE_OMP_MASTER}
1684 @cindex @code{GIMPLE_OMP_MASTER}
1685
1686 @deftypefn {GIMPLE function} gimple gimple_build_omp_master (gimple_seq body)
1687 Build a @code{GIMPLE_OMP_MASTER} statement. @code{BODY} is the sequence of
1688 statements to be executed by just the master.
1689 @end deftypefn
1690
1691
1692 @node @code{GIMPLE_OMP_ORDERED}
1693 @subsection @code{GIMPLE_OMP_ORDERED}
1694 @cindex @code{GIMPLE_OMP_ORDERED}
1695
1696 @deftypefn {GIMPLE function} gimple gimple_build_omp_ordered (gimple_seq body)
1697 Build a @code{GIMPLE_OMP_ORDERED} statement.
1698 @end deftypefn
1699
1700 @code{BODY} is the sequence of statements inside a loop that will
1701 executed in sequence.
1702
1703
1704 @node @code{GIMPLE_OMP_PARALLEL}
1705 @subsection @code{GIMPLE_OMP_PARALLEL}
1706 @cindex @code{GIMPLE_OMP_PARALLEL}
1707
1708 @deftypefn {GIMPLE function} gimple gimple_build_omp_parallel (gimple_seq body, tree clauses, tree child_fn, tree data_arg)
1709 Build a @code{GIMPLE_OMP_PARALLEL} statement.
1710 @end deftypefn
1711
1712 @code{BODY} is sequence of statements which are executed in parallel.
1713 @code{CLAUSES}, are the @code{OMP} parallel construct's clauses.  @code{CHILD_FN} is
1714 the function created for the parallel threads to execute.
1715 @code{DATA_ARG} are the shared data argument(s).
1716
1717 @deftypefn {GIMPLE function} bool gimple_omp_parallel_combined_p (gimple g)
1718 Return true if @code{OMP} parallel statement @code{G} has the
1719 @code{GF_OMP_PARALLEL_COMBINED} flag set.
1720 @end deftypefn
1721  
1722 @deftypefn {GIMPLE function} void gimple_omp_parallel_set_combined_p (gimple g)
1723 Set the @code{GF_OMP_PARALLEL_COMBINED} field in @code{OMP} parallel statement
1724 @code{G}.
1725 @end deftypefn
1726  
1727 @deftypefn {GIMPLE function} gimple_seq gimple_omp_body (gimple g)
1728 Return the body for the @code{OMP} statement @code{G}. 
1729 @end deftypefn
1730
1731 @deftypefn {GIMPLE function} void gimple_omp_set_body (gimple g, gimple_seq body)
1732 Set @code{BODY} to be the body for the @code{OMP} statement @code{G}. 
1733 @end deftypefn
1734
1735 @deftypefn {GIMPLE function} tree gimple_omp_parallel_clauses (gimple g)
1736 Return the clauses associated with @code{OMP_PARALLEL} @code{G}. 
1737 @end deftypefn
1738
1739 @deftypefn {GIMPLE function} tree *gimple_omp_parallel_clauses_ptr (gimple g)
1740 Return a pointer to the clauses associated with @code{OMP_PARALLEL} @code{G}. 
1741 @end deftypefn
1742
1743 @deftypefn {GIMPLE function} void gimple_omp_parallel_set_clauses (gimple g, tree clauses)
1744 Set @code{CLAUSES} to be the list of clauses associated with
1745 @code{OMP_PARALLEL} @code{G}. 
1746 @end deftypefn
1747
1748 @deftypefn {GIMPLE function} tree gimple_omp_parallel_child_fn (gimple g)
1749 Return the child function used to hold the body of @code{OMP_PARALLEL}
1750 @code{G}. 
1751 @end deftypefn
1752
1753 @deftypefn {GIMPLE function} tree *gimple_omp_parallel_child_fn_ptr (gimple g)
1754 Return a pointer to the child function used to hold the body of
1755 @code{OMP_PARALLEL} @code{G}. 
1756 @end deftypefn
1757
1758 @deftypefn {GIMPLE function} void gimple_omp_parallel_set_child_fn (gimple g, tree child_fn)
1759 Set @code{CHILD_FN} to be the child function for @code{OMP_PARALLEL} @code{G}. 
1760 @end deftypefn
1761
1762 @deftypefn {GIMPLE function} tree gimple_omp_parallel_data_arg (gimple g)
1763 Return the artificial argument used to send variables and values
1764 from the parent to the children threads in @code{OMP_PARALLEL} @code{G}. 
1765 @end deftypefn
1766
1767 @deftypefn {GIMPLE function} tree *gimple_omp_parallel_data_arg_ptr (gimple g)
1768 Return a pointer to the data argument for @code{OMP_PARALLEL} @code{G}. 
1769 @end deftypefn
1770
1771 @deftypefn {GIMPLE function} void gimple_omp_parallel_set_data_arg (gimple g, tree data_arg)
1772 Set @code{DATA_ARG} to be the data argument for @code{OMP_PARALLEL} @code{G}. 
1773 @end deftypefn
1774
1775 @deftypefn {GIMPLE function} bool is_gimple_omp (gimple stmt)
1776 Returns true when the gimple statement @code{STMT} is any of the OpenMP
1777 types. 
1778 @end deftypefn
1779
1780
1781 @node @code{GIMPLE_OMP_RETURN}
1782 @subsection @code{GIMPLE_OMP_RETURN}
1783 @cindex @code{GIMPLE_OMP_RETURN}
1784
1785 @deftypefn {GIMPLE function} gimple gimple_build_omp_return (bool wait_p)
1786 Build a @code{GIMPLE_OMP_RETURN} statement. @code{WAIT_P} is true if this is a
1787 non-waiting return.
1788 @end deftypefn
1789
1790 @deftypefn {GIMPLE function} void gimple_omp_return_set_nowait (gimple s)
1791 Set the nowait flag on @code{GIMPLE_OMP_RETURN} statement @code{S}.
1792 @end deftypefn
1793  
1794
1795 @deftypefn {GIMPLE function} bool gimple_omp_return_nowait_p (gimple g)
1796 Return true if @code{OMP} return statement @code{G} has the
1797 @code{GF_OMP_RETURN_NOWAIT} flag set.
1798 @end deftypefn
1799
1800 @node @code{GIMPLE_OMP_SECTION}
1801 @subsection @code{GIMPLE_OMP_SECTION}
1802 @cindex @code{GIMPLE_OMP_SECTION}
1803
1804 @deftypefn {GIMPLE function} gimple gimple_build_omp_section (gimple_seq body)
1805 Build a @code{GIMPLE_OMP_SECTION} statement for a sections statement.
1806 @end deftypefn
1807
1808 @code{BODY} is the sequence of statements in the section.
1809
1810 @deftypefn {GIMPLE function} bool gimple_omp_section_last_p (gimple g)
1811 Return true if @code{OMP} section statement @code{G} has the
1812 @code{GF_OMP_SECTION_LAST} flag set.
1813 @end deftypefn
1814  
1815 @deftypefn {GIMPLE function} void gimple_omp_section_set_last (gimple g)
1816 Set the @code{GF_OMP_SECTION_LAST} flag on @code{G}.
1817 @end deftypefn
1818
1819 @node @code{GIMPLE_OMP_SECTIONS}
1820 @subsection @code{GIMPLE_OMP_SECTIONS}
1821 @cindex @code{GIMPLE_OMP_SECTIONS}
1822
1823 @deftypefn {GIMPLE function} gimple gimple_build_omp_sections (gimple_seq body, tree clauses)
1824 Build a @code{GIMPLE_OMP_SECTIONS} statement. @code{BODY} is a sequence of
1825 section statements.  @code{CLAUSES} are any of the @code{OMP} sections
1826 construct's clauses: private, firstprivate, lastprivate,
1827 reduction, and nowait.
1828 @end deftypefn
1829
1830
1831 @deftypefn {GIMPLE function} gimple gimple_build_omp_sections_switch (void)
1832 Build a @code{GIMPLE_OMP_SECTIONS_SWITCH} statement.
1833 @end deftypefn
1834
1835 @deftypefn {GIMPLE function} tree gimple_omp_sections_control (gimple g)
1836 Return the control variable associated with the
1837 @code{GIMPLE_OMP_SECTIONS} in @code{G}.
1838 @end deftypefn
1839  
1840 @deftypefn {GIMPLE function} tree *gimple_omp_sections_control_ptr (gimple g)
1841 Return a pointer to the clauses associated with the
1842 @code{GIMPLE_OMP_SECTIONS} in @code{G}.
1843 @end deftypefn
1844  
1845 @deftypefn {GIMPLE function} void gimple_omp_sections_set_control (gimple g, tree control)
1846 Set @code{CONTROL} to be the set of clauses associated with the
1847 @code{GIMPLE_OMP_SECTIONS} in @code{G}.
1848 @end deftypefn
1849  
1850 @deftypefn {GIMPLE function} tree gimple_omp_sections_clauses (gimple g)
1851 Return the clauses associated with @code{OMP_SECTIONS} @code{G}. 
1852 @end deftypefn
1853
1854 @deftypefn {GIMPLE function} tree *gimple_omp_sections_clauses_ptr (gimple g)
1855 Return a pointer to the clauses associated with @code{OMP_SECTIONS} @code{G}. 
1856 @end deftypefn
1857
1858 @deftypefn {GIMPLE function} void gimple_omp_sections_set_clauses (gimple g, tree clauses)
1859 Set @code{CLAUSES} to be the set of clauses associated with @code{OMP_SECTIONS}
1860 @code{G}. 
1861 @end deftypefn
1862
1863
1864 @node @code{GIMPLE_OMP_SINGLE}
1865 @subsection @code{GIMPLE_OMP_SINGLE}
1866 @cindex @code{GIMPLE_OMP_SINGLE}
1867
1868 @deftypefn {GIMPLE function} gimple gimple_build_omp_single (gimple_seq body, tree clauses)
1869 Build a @code{GIMPLE_OMP_SINGLE} statement. @code{BODY} is the sequence of
1870 statements that will be executed once.  @code{CLAUSES} are any of the
1871 @code{OMP} single construct's clauses: private, firstprivate,
1872 copyprivate, nowait.
1873 @end deftypefn
1874
1875 @deftypefn {GIMPLE function} tree gimple_omp_single_clauses (gimple g)
1876 Return the clauses associated with @code{OMP_SINGLE} @code{G}. 
1877 @end deftypefn
1878
1879 @deftypefn {GIMPLE function} tree *gimple_omp_single_clauses_ptr (gimple g)
1880 Return a pointer to the clauses associated with @code{OMP_SINGLE} @code{G}. 
1881 @end deftypefn
1882
1883 @deftypefn {GIMPLE function} void gimple_omp_single_set_clauses (gimple g, tree clauses)
1884 Set @code{CLAUSES} to be the clauses associated with @code{OMP_SINGLE} @code{G}. 
1885 @end deftypefn
1886
1887
1888 @node @code{GIMPLE_PHI}
1889 @subsection @code{GIMPLE_PHI}
1890 @cindex @code{GIMPLE_PHI}
1891
1892 @deftypefn {GIMPLE function} gimple make_phi_node (tree var, int len)
1893 Build a @code{PHI} node with len argument slots for variable var.
1894 @end deftypefn
1895
1896 @deftypefn {GIMPLE function} unsigned gimple_phi_capacity (gimple g)
1897 Return the maximum number of arguments supported by @code{GIMPLE_PHI} @code{G}. 
1898 @end deftypefn
1899
1900 @deftypefn {GIMPLE function} unsigned gimple_phi_num_args (gimple g)
1901 Return the number of arguments in @code{GIMPLE_PHI} @code{G}. This must always
1902 be exactly the number of incoming edges for the basic block
1903 holding @code{G}. 
1904 @end deftypefn
1905
1906 @deftypefn {GIMPLE function} tree gimple_phi_result (gimple g)
1907 Return the @code{SSA} name created by @code{GIMPLE_PHI} @code{G}. 
1908 @end deftypefn
1909
1910 @deftypefn {GIMPLE function} tree *gimple_phi_result_ptr (gimple g)
1911 Return a pointer to the @code{SSA} name created by @code{GIMPLE_PHI} @code{G}. 
1912 @end deftypefn
1913
1914 @deftypefn {GIMPLE function} void gimple_phi_set_result (gimple g, tree result)
1915 Set @code{RESULT} to be the @code{SSA} name created by @code{GIMPLE_PHI} @code{G}. 
1916 @end deftypefn
1917
1918 @deftypefn {GIMPLE function} struct phi_arg_d *gimple_phi_arg (gimple g, index)
1919 Return the @code{PHI} argument corresponding to incoming edge @code{INDEX} for
1920 @code{GIMPLE_PHI} @code{G}. 
1921 @end deftypefn
1922
1923 @deftypefn {GIMPLE function} void gimple_phi_set_arg (gimple g, index, struct phi_arg_d * phiarg)
1924 Set @code{PHIARG} to be the argument corresponding to incoming edge
1925 @code{INDEX} for @code{GIMPLE_PHI} @code{G}. 
1926 @end deftypefn
1927
1928 @node @code{GIMPLE_RESX}
1929 @subsection @code{GIMPLE_RESX}
1930 @cindex @code{GIMPLE_RESX}
1931
1932 @deftypefn {GIMPLE function} gimple gimple_build_resx (int region)
1933 Build a @code{GIMPLE_RESX} statement which is a statement.  This
1934 statement is a placeholder for _Unwind_Resume before we know if a
1935 function call or a branch is needed.  @code{REGION} is the exception
1936 region from which control is flowing.
1937 @end deftypefn
1938
1939 @deftypefn {GIMPLE function} int gimple_resx_region (gimple g)
1940 Return the region number for @code{GIMPLE_RESX} @code{G}. 
1941 @end deftypefn
1942
1943 @deftypefn {GIMPLE function} void gimple_resx_set_region (gimple g, int region)
1944 Set @code{REGION} to be the region number for @code{GIMPLE_RESX} @code{G}. 
1945 @end deftypefn
1946
1947 @node @code{GIMPLE_RETURN}
1948 @subsection @code{GIMPLE_RETURN}
1949 @cindex @code{GIMPLE_RETURN}
1950
1951 @deftypefn {GIMPLE function} gimple gimple_build_return (tree retval)
1952 Build a @code{GIMPLE_RETURN} statement whose return value is retval.
1953 @end deftypefn
1954
1955 @deftypefn {GIMPLE function} tree gimple_return_retval (gimple g)
1956 Return the return value for @code{GIMPLE_RETURN} @code{G}. 
1957 @end deftypefn
1958
1959 @deftypefn {GIMPLE function} void gimple_return_set_retval (gimple g, tree retval)
1960 Set @code{RETVAL} to be the return value for @code{GIMPLE_RETURN} @code{G}. 
1961 @end deftypefn
1962
1963 @node @code{GIMPLE_SWITCH}
1964 @subsection @code{GIMPLE_SWITCH}
1965 @cindex @code{GIMPLE_SWITCH}
1966
1967 @deftypefn {GIMPLE function} gimple gimple_build_switch ( nlabels, tree index, tree default_label, ...)
1968 Build a @code{GIMPLE_SWITCH} statement.  @code{NLABELS} are the number of
1969 labels excluding the default label.  The default label is passed
1970 in @code{DEFAULT_LABEL}.  The rest of the arguments are trees
1971 representing the labels.  Each label is a tree of code
1972 @code{CASE_LABEL_EXPR}.
1973 @end deftypefn
1974
1975 @deftypefn {GIMPLE function} gimple gimple_build_switch_vec (tree index, tree default_label, @code{VEC}(tree,heap) *args)
1976 This function is an alternate way of building @code{GIMPLE_SWITCH}
1977 statements.  @code{INDEX} and @code{DEFAULT_LABEL} are as in
1978 gimple_build_switch.  @code{ARGS} is a vector of @code{CASE_LABEL_EXPR} trees
1979 that contain the labels.
1980 @end deftypefn
1981
1982 @deftypefn {GIMPLE function} unsigned gimple_switch_num_labels (gimple g)
1983 Return the number of labels associated with the switch statement
1984 @code{G}. 
1985 @end deftypefn
1986
1987 @deftypefn {GIMPLE function} void gimple_switch_set_num_labels (gimple g, unsigned nlabels)
1988 Set @code{NLABELS} to be the number of labels for the switch statement
1989 @code{G}. 
1990 @end deftypefn
1991
1992 @deftypefn {GIMPLE function} tree gimple_switch_index (gimple g)
1993 Return the index variable used by the switch statement @code{G}. 
1994 @end deftypefn
1995
1996 @deftypefn {GIMPLE function} void gimple_switch_set_index (gimple g, tree index)
1997 Set @code{INDEX} to be the index variable for switch statement @code{G}. 
1998 @end deftypefn
1999
2000 @deftypefn {GIMPLE function} tree gimple_switch_label (gimple g, unsigned index)
2001 Return the label numbered @code{INDEX}. The default label is 0, followed
2002 by any labels in a switch statement. 
2003 @end deftypefn
2004
2005 @deftypefn {GIMPLE function} void gimple_switch_set_label (gimple g, unsigned index, tree label)
2006 Set the label number @code{INDEX} to @code{LABEL}. 0 is always the default
2007 label. 
2008 @end deftypefn
2009
2010 @deftypefn {GIMPLE function} tree gimple_switch_default_label (gimple g)
2011 Return the default label for a switch statement. 
2012 @end deftypefn
2013
2014 @deftypefn {GIMPLE function} void gimple_switch_set_default_label (gimple g, tree label)
2015 Set the default label for a switch statement. 
2016 @end deftypefn
2017
2018
2019 @node @code{GIMPLE_TRY}
2020 @subsection @code{GIMPLE_TRY}
2021 @cindex @code{GIMPLE_TRY}
2022
2023 @deftypefn {GIMPLE function} gimple gimple_build_try (gimple_seq eval, gimple_seq cleanup, unsigned int kind)
2024 Build a @code{GIMPLE_TRY} statement.  @code{EVAL} is a sequence with the
2025 expression to evaluate.  @code{CLEANUP} is a sequence of statements to
2026 run at clean-up time.  @code{KIND} is the enumeration value
2027 @code{GIMPLE_TRY_CATCH} if this statement denotes a try/catch construct
2028 or @code{GIMPLE_TRY_FINALLY} if this statement denotes a try/finally
2029 construct.
2030 @end deftypefn
2031
2032 @deftypefn {GIMPLE function} enum gimple_try_flags gimple_try_kind (gimple g)
2033 Return the kind of try block represented by @code{GIMPLE_TRY} @code{G}. This is
2034 either @code{GIMPLE_TRY_CATCH} or @code{GIMPLE_TRY_FINALLY}. 
2035 @end deftypefn
2036
2037 @deftypefn {GIMPLE function} bool gimple_try_catch_is_cleanup (gimple g)
2038 Return the @code{GIMPLE_TRY_CATCH_IS_CLEANUP} flag. 
2039 @end deftypefn
2040
2041 @deftypefn {GIMPLE function} gimple_seq gimple_try_eval (gimple g)
2042 Return the sequence of statements used as the body for @code{GIMPLE_TRY}
2043 @code{G}. 
2044 @end deftypefn
2045
2046 @deftypefn {GIMPLE function} gimple_seq gimple_try_cleanup (gimple g)
2047 Return the sequence of statements used as the cleanup body for
2048 @code{GIMPLE_TRY} @code{G}. 
2049 @end deftypefn
2050
2051 @deftypefn {GIMPLE function} void gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
2052 Set the @code{GIMPLE_TRY_CATCH_IS_CLEANUP} flag. 
2053 @end deftypefn
2054
2055 @deftypefn {GIMPLE function} void gimple_try_set_eval (gimple g, gimple_seq eval)
2056 Set @code{EVAL} to be the sequence of statements to use as the body for
2057 @code{GIMPLE_TRY} @code{G}. 
2058 @end deftypefn
2059
2060 @deftypefn {GIMPLE function} void gimple_try_set_cleanup (gimple g, gimple_seq cleanup)
2061 Set @code{CLEANUP} to be the sequence of statements to use as the
2062 cleanup body for @code{GIMPLE_TRY} @code{G}. 
2063 @end deftypefn
2064
2065 @node @code{GIMPLE_WITH_CLEANUP_EXPR}
2066 @subsection @code{GIMPLE_WITH_CLEANUP_EXPR}
2067 @cindex @code{GIMPLE_WITH_CLEANUP_EXPR}
2068
2069 @deftypefn {GIMPLE function} gimple gimple_build_wce (gimple_seq cleanup)
2070 Build a @code{GIMPLE_WITH_CLEANUP_EXPR} statement.  @code{CLEANUP} is the
2071 clean-up expression.
2072 @end deftypefn
2073
2074 @deftypefn {GIMPLE function} gimple_seq gimple_wce_cleanup (gimple g)
2075 Return the cleanup sequence for cleanup statement @code{G}. 
2076 @end deftypefn
2077
2078 @deftypefn {GIMPLE function} void gimple_wce_set_cleanup (gimple g, gimple_seq cleanup)
2079 Set @code{CLEANUP} to be the cleanup sequence for @code{G}. 
2080 @end deftypefn
2081
2082 @deftypefn {GIMPLE function} bool gimple_wce_cleanup_eh_only (gimple g)
2083 Return the @code{CLEANUP_EH_ONLY} flag for a @code{WCE} tuple. 
2084 @end deftypefn
2085
2086 @deftypefn {GIMPLE function} void gimple_wce_set_cleanup_eh_only (gimple g, bool eh_only_p)
2087 Set the @code{CLEANUP_EH_ONLY} flag for a @code{WCE} tuple. 
2088 @end deftypefn
2089
2090
2091 @node GIMPLE sequences 
2092 @section GIMPLE sequences 
2093 @cindex GIMPLE sequences 
2094
2095 GIMPLE sequences are the tuple equivalent of @code{STATEMENT_LIST}'s
2096 used in @code{GENERIC}.  They are used to chain statements together, and
2097 when used in conjunction with sequence iterators, provide a
2098 framework for iterating through statements.
2099
2100 GIMPLE sequences are of type struct @code{gimple_sequence}, but are more
2101 commonly passed by reference to functions dealing with sequences.
2102 The type for a sequence pointer is @code{gimple_seq} which is the same
2103 as struct @code{gimple_sequence} *.  When declaring a local sequence,
2104 you can define a local variable of type struct @code{gimple_sequence}.
2105 When declaring a sequence allocated on the garbage collected
2106 heap, use the function @code{gimple_seq_alloc} documented below.
2107
2108 There are convenience functions for iterating through sequences
2109 in the section entitled Sequence Iterators.
2110
2111 Below is a list of functions to manipulate and query sequences.
2112
2113 @deftypefn {GIMPLE function} void gimple_seq_add_stmt (gimple_seq *seq, gimple g)
2114 Link a gimple statement to the end of the sequence *@code{SEQ} if @code{G} is
2115 not @code{NULL}.  If *@code{SEQ} is @code{NULL}, allocate a sequence before linking.
2116 @end deftypefn
2117
2118 @deftypefn {GIMPLE function} void gimple_seq_add_seq (gimple_seq *dest, gimple_seq src)
2119 Append sequence @code{SRC} to the end of sequence *@code{DEST} if @code{SRC} is not
2120 @code{NULL}.  If *@code{DEST} is @code{NULL}, allocate a new sequence before
2121 appending.
2122 @end deftypefn
2123
2124 @deftypefn {GIMPLE function} gimple_seq gimple_seq_deep_copy (gimple_seq src)
2125 Perform a deep copy of sequence @code{SRC} and return the result.
2126 @end deftypefn
2127
2128 @deftypefn {GIMPLE function} gimple_seq gimple_seq_reverse (gimple_seq seq)
2129 Reverse the order of the statements in the sequence @code{SEQ}.  Return
2130 @code{SEQ}.
2131 @end deftypefn
2132
2133 @deftypefn {GIMPLE function} gimple gimple_seq_first (gimple_seq s)
2134 Return the first statement in sequence @code{S}.
2135 @end deftypefn
2136
2137 @deftypefn {GIMPLE function} gimple gimple_seq_last (gimple_seq s)
2138 Return the last statement in sequence @code{S}.
2139 @end deftypefn
2140
2141 @deftypefn {GIMPLE function} void gimple_seq_set_last (gimple_seq s, gimple last)
2142 Set the last statement in sequence @code{S} to the statement in @code{LAST}.
2143 @end deftypefn
2144
2145 @deftypefn {GIMPLE function} void gimple_seq_set_first (gimple_seq s, gimple first)
2146 Set the first statement in sequence @code{S} to the statement in @code{FIRST}.
2147 @end deftypefn
2148
2149 @deftypefn {GIMPLE function} void gimple_seq_init (gimple_seq s)
2150 Initialize sequence @code{S} to an empty sequence.
2151 @end deftypefn
2152
2153 @deftypefn {GIMPLE function} gimple_seq gimple_seq_alloc (void)
2154 Allocate a new sequence in the garbage collected store and return
2155 it.
2156 @end deftypefn
2157
2158 @deftypefn {GIMPLE function} void gimple_seq_copy (gimple_seq dest, gimple_seq src)
2159 Copy the sequence @code{SRC} into the sequence @code{DEST}.
2160 @end deftypefn
2161
2162 @deftypefn {GIMPLE function} bool gimple_seq_empty_p (gimple_seq s)
2163 Return true if the sequence @code{S} is empty.
2164 @end deftypefn
2165
2166 @deftypefn {GIMPLE function} gimple_seq bb_seq (basic_block bb)
2167 Returns the sequence of statements in @code{BB}.
2168 @end deftypefn
2169
2170 @deftypefn {GIMPLE function} void set_bb_seq (basic_block bb, gimple_seq seq)
2171 Sets the sequence of statements in @code{BB} to @code{SEQ}.
2172 @end deftypefn
2173
2174 @deftypefn {GIMPLE function} bool gimple_seq_singleton_p (gimple_seq seq)
2175 Determine whether @code{SEQ} contains exactly one statement.
2176 @end deftypefn
2177
2178 @node Sequence iterators 
2179 @section Sequence iterators 
2180 @cindex Sequence iterators 
2181
2182 Sequence iterators are convenience constructs for iterating
2183 through statements in a sequence.  Given a sequence @code{SEQ}, here is
2184 a typical use of gimple sequence iterators:
2185
2186 @smallexample
2187 gimple_stmt_iterator gsi;
2188
2189 for (gsi = gsi_start (seq); !gsi_end_p (gsi); gsi_next (&gsi))
2190   @{
2191     gimple g = gsi_stmt (gsi);
2192     /* Do something with gimple statement @code{G}.  */
2193   @}
2194 @end smallexample
2195
2196 Backward iterations are possible:
2197
2198 @smallexample
2199         for (gsi = gsi_last (seq); !gsi_end_p (gsi); gsi_prev (&gsi))
2200 @end smallexample
2201
2202 Forward and backward iterations on basic blocks are possible with
2203 @code{gsi_start_bb} and @code{gsi_last_bb}.
2204
2205 In the documentation below we sometimes refer to enum
2206 @code{gsi_iterator_update}.  The valid options for this enumeration are:
2207
2208 @itemize @bullet
2209 @item @code{GSI_NEW_STMT}
2210 Only valid when a single statement is added.  Move the iterator to it.
2211
2212 @item @code{GSI_SAME_STMT}
2213 Leave the iterator at the same statement.
2214
2215 @item @code{GSI_CONTINUE_LINKING}
2216 Move iterator to whatever position is suitable for linking other
2217 statements in the same direction.
2218 @end itemize
2219
2220 Below is a list of the functions used to manipulate and use
2221 statement iterators.
2222
2223 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_start (gimple_seq seq)
2224 Return a new iterator pointing to the sequence @code{SEQ}'s first
2225 statement.  If @code{SEQ} is empty, the iterator's basic block is @code{NULL}.
2226 Use @code{gsi_start_bb} instead when the iterator needs to always have
2227 the correct basic block set.
2228 @end deftypefn
2229
2230 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_start_bb (basic_block bb)
2231 Return a new iterator pointing to the first statement in basic
2232 block @code{BB}.
2233 @end deftypefn
2234
2235 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_last (gimple_seq seq)
2236 Return a new iterator initially pointing to the last statement of
2237 sequence @code{SEQ}.  If @code{SEQ} is empty, the iterator's basic block is
2238 @code{NULL}.  Use @code{gsi_last_bb} instead when the iterator needs to always
2239 have the correct basic block set.
2240 @end deftypefn
2241
2242 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_last_bb (basic_block bb)
2243 Return a new iterator pointing to the last statement in basic
2244 block @code{BB}.
2245 @end deftypefn
2246
2247 @deftypefn {GIMPLE function} bool gsi_end_p (gimple_stmt_iterator i)
2248 Return @code{TRUE} if at the end of @code{I}.
2249 @end deftypefn
2250
2251 @deftypefn {GIMPLE function} bool gsi_one_before_end_p (gimple_stmt_iterator i)
2252 Return @code{TRUE} if we're one statement before the end of @code{I}.
2253 @end deftypefn
2254
2255 @deftypefn {GIMPLE function} void gsi_next (gimple_stmt_iterator *i)
2256 Advance the iterator to the next gimple statement.
2257 @end deftypefn
2258
2259 @deftypefn {GIMPLE function} void gsi_prev (gimple_stmt_iterator *i)
2260 Advance the iterator to the previous gimple statement.
2261 @end deftypefn
2262
2263 @deftypefn {GIMPLE function} gimple gsi_stmt (gimple_stmt_iterator i)
2264 Return the current stmt.
2265 @end deftypefn
2266
2267 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_after_labels (basic_block bb)
2268 Return a block statement iterator that points to the first
2269 non-label statement in block @code{BB}.
2270 @end deftypefn
2271
2272 @deftypefn {GIMPLE function} gimple *gsi_stmt_ptr (gimple_stmt_iterator *i)
2273 Return a pointer to the current stmt.
2274 @end deftypefn
2275
2276 @deftypefn {GIMPLE function} basic_block gsi_bb (gimple_stmt_iterator i)
2277 Return the basic block associated with this iterator.
2278 @end deftypefn
2279
2280 @deftypefn {GIMPLE function} gimple_seq gsi_seq (gimple_stmt_iterator i)
2281 Return the sequence associated with this iterator.
2282 @end deftypefn
2283
2284 @deftypefn {GIMPLE function} void gsi_remove (gimple_stmt_iterator *i, bool remove_eh_info)
2285 Remove the current stmt from the sequence.  The iterator is
2286 updated to point to the next statement.  When @code{REMOVE_EH_INFO} is
2287 true we remove the statement pointed to by iterator @code{I} from the @code{EH}
2288 tables.  Otherwise we do not modify the @code{EH} tables.  Generally,
2289 @code{REMOVE_EH_INFO} should be true when the statement is going to be
2290 removed from the @code{IL} and not reinserted elsewhere.
2291 @end deftypefn
2292
2293 @deftypefn {GIMPLE function} void gsi_link_seq_before (gimple_stmt_iterator *i, gimple_seq seq, enum gsi_iterator_update mode)
2294 Links the sequence of statements @code{SEQ} before the statement pointed
2295 by iterator @code{I}.  @code{MODE} indicates what to do with the iterator
2296 after insertion (see @code{enum gsi_iterator_update} above).
2297 @end deftypefn
2298
2299 @deftypefn {GIMPLE function} void gsi_link_before (gimple_stmt_iterator *i, gimple g, enum gsi_iterator_update mode)
2300 Links statement @code{G} before the statement pointed-to by iterator @code{I}.
2301 Updates iterator @code{I} according to @code{MODE}.
2302 @end deftypefn
2303
2304 @deftypefn {GIMPLE function} void gsi_link_seq_after (gimple_stmt_iterator *i, gimple_seq seq, enum gsi_iterator_update mode)
2305 Links sequence @code{SEQ} after the statement pointed-to by iterator @code{I}.
2306 @code{MODE} is as in @code{gsi_insert_after}.
2307 @end deftypefn
2308
2309 @deftypefn {GIMPLE function} void gsi_link_after (gimple_stmt_iterator *i, gimple g, enum gsi_iterator_update mode)
2310 Links statement @code{G} after the statement pointed-to by iterator @code{I}.
2311 @code{MODE} is as in @code{gsi_insert_after}.
2312 @end deftypefn
2313
2314 @deftypefn {GIMPLE function} gimple_seq gsi_split_seq_after (gimple_stmt_iterator i)
2315 Move all statements in the sequence after @code{I} to a new sequence.
2316 Return this new sequence.
2317 @end deftypefn
2318
2319 @deftypefn {GIMPLE function} gimple_seq gsi_split_seq_before (gimple_stmt_iterator *i)
2320 Move all statements in the sequence before @code{I} to a new sequence.
2321 Return this new sequence.
2322 @end deftypefn
2323
2324 @deftypefn {GIMPLE function} void gsi_replace (gimple_stmt_iterator *i, gimple stmt, bool update_eh_info)
2325 Replace the statement pointed-to by @code{I} to @code{STMT}.  If @code{UPDATE_EH_INFO}
2326 is true, the exception handling information of the original
2327 statement is moved to the new statement.
2328 @end deftypefn
2329
2330 @deftypefn {GIMPLE function} void gsi_insert_before (gimple_stmt_iterator *i, gimple stmt, enum gsi_iterator_update mode)
2331 Insert statement @code{STMT} before the statement pointed-to by iterator
2332 @code{I}, update @code{STMT}'s basic block and scan it for new operands.  @code{MODE}
2333 specifies how to update iterator @code{I} after insertion (see enum
2334 @code{gsi_iterator_update}).
2335 @end deftypefn
2336
2337 @deftypefn {GIMPLE function} void gsi_insert_seq_before (gimple_stmt_iterator *i, gimple_seq seq, enum gsi_iterator_update mode)
2338 Like @code{gsi_insert_before}, but for all the statements in @code{SEQ}.
2339 @end deftypefn
2340
2341 @deftypefn {GIMPLE function} void gsi_insert_after (gimple_stmt_iterator *i, gimple stmt, enum gsi_iterator_update mode)
2342 Insert statement @code{STMT} after the statement pointed-to by iterator
2343 @code{I}, update @code{STMT}'s basic block and scan it for new operands.  @code{MODE}
2344 specifies how to update iterator @code{I} after insertion (see enum
2345 @code{gsi_iterator_update}).
2346 @end deftypefn
2347
2348 @deftypefn {GIMPLE function} void gsi_insert_seq_after (gimple_stmt_iterator *i, gimple_seq seq, enum gsi_iterator_update mode)
2349 Like @code{gsi_insert_after}, but for all the statements in @code{SEQ}.
2350 @end deftypefn
2351
2352 @deftypefn {GIMPLE function} gimple_stmt_iterator gsi_for_stmt (gimple stmt)
2353 Finds iterator for @code{STMT}.
2354 @end deftypefn
2355
2356 @deftypefn {GIMPLE function} void gsi_move_after (gimple_stmt_iterator *from, gimple_stmt_iterator *to)
2357 Move the statement at @code{FROM} so it comes right after the statement
2358 at @code{TO}.
2359 @end deftypefn
2360
2361 @deftypefn {GIMPLE function} void gsi_move_before (gimple_stmt_iterator *from, gimple_stmt_iterator *to)
2362 Move the statement at @code{FROM} so it comes right before the statement
2363 at @code{TO}.
2364 @end deftypefn
2365
2366 @deftypefn {GIMPLE function} void gsi_move_to_bb_end (gimple_stmt_iterator *from, basic_block bb)
2367 Move the statement at @code{FROM} to the end of basic block @code{BB}.
2368 @end deftypefn
2369
2370 @deftypefn {GIMPLE function} void gsi_insert_on_edge (edge e, gimple stmt)
2371 Add @code{STMT} to the pending list of edge @code{E}.  No actual insertion is
2372 made until a call to @code{gsi_commit_edge_inserts}() is made.
2373 @end deftypefn
2374
2375 @deftypefn {GIMPLE function} void gsi_insert_seq_on_edge (edge e, gimple_seq seq)
2376 Add the sequence of statements in @code{SEQ} to the pending list of edge
2377 @code{E}.  No actual insertion is made until a call to
2378 @code{gsi_commit_edge_inserts}() is made.
2379 @end deftypefn
2380
2381 @deftypefn {GIMPLE function} basic_block gsi_insert_on_edge_immediate (edge e, gimple stmt)
2382 Similar to @code{gsi_insert_on_edge}+@code{gsi_commit_edge_inserts}.  If a new
2383 block has to be created, it is returned.
2384 @end deftypefn
2385
2386 @deftypefn {GIMPLE function} void gsi_commit_one_edge_insert (edge e, basic_block *new_bb)
2387 Commit insertions pending at edge @code{E}.  If a new block is created,
2388 set @code{NEW_BB} to this block, otherwise set it to @code{NULL}.
2389 @end deftypefn
2390
2391 @deftypefn {GIMPLE function} void gsi_commit_edge_inserts (void)
2392 This routine will commit all pending edge insertions, creating
2393 any new basic blocks which are necessary.
2394 @end deftypefn
2395
2396
2397 @node Adding a new GIMPLE statement code
2398 @section Adding a new GIMPLE statement code
2399 @cindex Adding a new GIMPLE statement code
2400
2401 The first step in adding a new GIMPLE statement code, is
2402 modifying the file @code{gimple.def}, which contains all the GIMPLE
2403 codes.  Then you must add a corresponding structure, and an entry
2404 in @code{union gimple_statement_d}, both of which are located in
2405 @code{gimple.h}.  This in turn, will require you to add a corresponding
2406 @code{GTY} tag in @code{gsstruct.def}, and code to handle this tag in
2407 @code{gss_for_code} which is located in @code{gimple.c}.
2408
2409 In order for the garbage collector to know the size of the
2410 structure you created in @code{gimple.h}, you need to add a case to
2411 handle your new GIMPLE statement in @code{gimple_size} which is located
2412 in @code{gimple.c}.
2413
2414 You will probably want to create a function to build the new
2415 gimple statement in @code{gimple.c}.  The function should be called
2416 @code{gimple_build_<@code{NEW_TUPLE_NAME}>}, and should return the new tuple
2417 of type gimple.
2418
2419 If your new statement requires accessors for any members or
2420 operands it may have, put simple inline accessors in
2421 @code{gimple.h} and any non-trivial accessors in @code{gimple.c} with a
2422 corresponding prototype in @code{gimple.h}.
2423
2424
2425 @node Statement and operand traversals
2426 @section Statement and operand traversals
2427 @cindex Statement and operand traversals
2428  
2429 There are two functions available for walking statements and
2430 sequences: @code{walk_gimple_stmt} and @code{walk_gimple_seq},
2431 accordingly, and a third function for walking the operands in a
2432 statement: @code{walk_gimple_op}.
2433
2434 @deftypefn {GIMPLE function} tree walk_gimple_stmt (gimple_stmt_iterator *gsi, walk_stmt_fn callback_stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi)
2435 This function is used to walk the current statement in @code{GSI},
2436 optionally using traversal state stored in @code{WI}.  If @code{WI} is @code{NULL}, no
2437 state is kept during the traversal.
2438
2439 The callback @code{CALLBACK_STMT} is called.  If @code{CALLBACK_STMT} returns
2440 true, it means that the callback function has handled all the
2441 operands of the statement and it is not necessary to walk its
2442 operands.
2443
2444 If @code{CALLBACK_STMT} is @code{NULL} or it returns false, @code{CALLBACK_OP} is
2445 called on each operand of the statement via @code{walk_gimple_op}.  If
2446 @code{walk_gimple_op} returns non-@code{NULL} for any operand, the remaining
2447 operands are not scanned.
2448
2449 The return value is that returned by the last call to
2450 @code{walk_gimple_op}, or @code{NULL_TREE} if no @code{CALLBACK_OP} is specified.
2451 @end deftypefn
2452
2453
2454 @deftypefn {GIMPLE function} tree walk_gimple_op (gimple stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi)
2455 Use this function to walk the operands of statement @code{STMT}.  Every
2456 operand is walked via @code{walk_tree} with optional state information
2457 in @code{WI}.
2458
2459 @code{CALLBACK_OP} is called on each operand of @code{STMT} via @code{walk_tree}.
2460 Additional parameters to @code{walk_tree} must be stored in @code{WI}.  For
2461 each operand @code{OP}, @code{walk_tree} is called as:
2462
2463 @smallexample
2464     walk_tree (&@code{OP}, @code{CALLBACK_OP}, @code{WI}, @code{WI}- @code{PSET})
2465 @end smallexample
2466
2467 If @code{CALLBACK_OP} returns non-@code{NULL} for an operand, the remaining
2468 operands are not scanned.  The return value is that returned by
2469 the last call to @code{walk_tree}, or @code{NULL_TREE} if no @code{CALLBACK_OP} is
2470 specified.
2471 @end deftypefn
2472
2473
2474 @deftypefn {GIMPLE function} tree walk_gimple_seq (gimple_seq seq, walk_stmt_fn callback_stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi)
2475 This function walks all the statements in the sequence @code{SEQ}
2476 calling @code{walk_gimple_stmt} on each one.  @code{WI} is as in
2477 @code{walk_gimple_stmt}.  If @code{walk_gimple_stmt} returns non-@code{NULL}, the walk
2478 is stopped and the value returned.  Otherwise, all the statements
2479 are walked and @code{NULL_TREE} returned.
2480 @end deftypefn