xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/doc/gimple.texi (revision b7b7574d3bf8eeb51a1fa3977b59142ec6434a55)
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
10GIMPLE is a three-address representation derived from GENERIC by
11breaking down GENERIC expressions into tuples of no more than 3
12operands (with some exceptions like function calls).  GIMPLE was
13heavily influenced by the SIMPLE IL used by the McCAT compiler
14project at McGill University, though we have made some different
15choices.  For one thing, SIMPLE doesn't support @code{goto}.
16
17Temporaries are introduced to hold intermediate values needed to
18compute complex expressions. Additionally, all the control
19structures used in GENERIC are lowered into conditional jumps,
20lexical scopes are removed and exception regions are converted
21into an on the side exception region tree.
22
23The compiler pass which converts GENERIC into GIMPLE is referred to as
24the @samp{gimplifier}.  The gimplifier works recursively, generating
25GIMPLE tuples out of the original GENERIC expressions.
26
27One of the early implementation strategies used for the GIMPLE
28representation was to use the same internal data structures used
29by front ends to represent parse trees. This simplified
30implementation because we could leverage existing functionality
31and interfaces. However, GIMPLE is a much more restrictive
32representation than abstract syntax trees (AST), therefore it
33does not require the full structural complexity provided by the
34main tree data structure.
35
36The GENERIC representation of a function is stored in the
37@code{DECL_SAVED_TREE} field of the associated @code{FUNCTION_DECL}
38tree node.  It is converted to GIMPLE by a call to
39@code{gimplify_function_tree}.
40
41If a front end wants to include language-specific tree codes in the tree
42representation which it provides to the back end, it must provide a
43definition of @code{LANG_HOOKS_GIMPLIFY_EXPR} which knows how to
44convert the front end trees to GIMPLE@.  Usually such a hook will involve
45much of the same code for expanding front end trees to RTL@.  This function
46can return fully lowered GIMPLE, or it can return GENERIC trees and let the
47main gimplifier lower them the rest of the way; this is often simpler.
48GIMPLE that is not fully lowered is known as ``High GIMPLE'' and
49consists of the IL before the pass @code{pass_lower_cf}.  High GIMPLE
50contains 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
53implicit jumps for control and exception expressions directly in
54the IL and EH region trees.
55
56The C and C++ front ends currently convert directly from front end
57trees to GIMPLE, and hand that off to the back end rather than first
58converting to GENERIC@.  Their gimplifier hooks know about all the
59@code{_STMT} nodes and how to convert them to GENERIC forms.  There
60was some work done on a genericization pass which would run first, but
61the existence of @code{STMT_EXPR} meant that in order to convert all
62of the C statements into GENERIC equivalents would involve walking the
63entire tree anyway, so it was simpler to lower all the way.  This
64might change in the future if someone writes an optimization pass
65which would work better with higher-level trees, but currently the
66optimizers all expect GIMPLE@.
67
68You can request to dump a C-like representation of the GIMPLE form
69with 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
89GIMPLE instructions are tuples of variable size divided in two
90groups: a header describing the instruction and its locations,
91and a variable length body with all the operands. Tuples are
92organized into a hierarchy with 3 main classes of tuples.
93
94@subsection @code{gimple_statement_base} (gsbase)
95@cindex gimple_statement_base
96
97This is the root of the hierarchy, it holds basic information
98needed by most GIMPLE statements. There are some fields that
99may not be relevant to every GIMPLE statement, but those were
100moved into the base structure to take advantage of holes left by
101other fields (thus making the structure more compact).  The
102structure 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}
125Main identifier for a GIMPLE instruction.
126
127@item @code{subcode}
128Used to distinguish different variants of the same basic
129instruction or provide flags applicable to a given code. The
130@code{subcode} flags field has different uses depending on the code of
131the instruction, but mostly it distinguishes instructions of the
132same family. The most prominent use of this field is in
133assignments, where subcode indicates the operation done on the
134RHS 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}
138Bitflag to indicate whether a warning has already been issued on
139this statement.
140
141@item @code{visited}
142General purpose ``visited'' marker. Set and cleared by each pass
143when needed.
144
145@item @code{nontemporal_move}
146Bitflag used in assignments that represent non-temporal moves.
147Although this bitflag is only used in assignments, it was moved
148into the base to take advantage of the bit holes left by the
149previous fields.
150
151@item @code{plf}
152Pass Local Flags. This 2-bit mask can be used as general purpose
153markers by any pass. Passes are responsible for clearing and
154setting these two flags accordingly.
155
156@item @code{modified}
157Bitflag to indicate whether the statement has been modified.
158Used mainly by the operand scanner to determine when to re-scan a
159statement for operands.
160
161@item @code{has_volatile_ops}
162Bitflag to indicate whether this statement contains operands that
163have been marked volatile.
164
165@item @code{references_memory_p}
166Bitflag to indicate whether this statement contains memory
167references (i.e., its operands are either global variables, or
168pointer dereferences or anything that must reside in memory).
169
170@item @code{uid}
171This is an unsigned integer used by passes that want to assign
172IDs to every statement. These IDs must be assigned and used by
173each pass.
174
175@item @code{location}
176This is a @code{location_t} identifier to specify source code
177location for this statement. It is inherited from the front
178end.
179
180@item @code{num_ops}
181Number of operands that this statement has. This specifies the
182size of the operand vector embedded in the tuple. Only used in
183some tuples, but it is declared in the base tuple to take
184advantage of the 32-bit hole left by the previous fields.
185
186@item @code{bb}
187Basic block holding the instruction.
188
189@item @code{block}
190Lexical block holding this statement.  Also used for debug
191information generation.
192@end itemize
193
194@subsection @code{gimple_statement_with_ops}
195@cindex gimple_statement_with_ops
196
197This 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
200way the operand vector is allocated. The operand vector is
201defined to be an array of 1 element. So, to allocate a dynamic
202number of operands, the memory allocator (@code{gimple_alloc}) simply
203allocates enough memory to hold the structure itself plus @code{N
204- 1} operands which run ``off the end'' of the structure. For
205example, to allocate space for a tuple with 3 operands,
206@code{gimple_alloc} reserves @code{sizeof (struct
207gimple_statement_with_ops) + 2 * sizeof (tree)} bytes.
208
209On the other hand, several fields in this tuple need to be shared
210with the @code{gimple_statement_with_memory_ops} tuple. So, these
211common fields are placed in @code{gimple_statement_with_ops_base} which
212is then inherited from the other two tuples.
213
214
215@multitable {@code{addresses_taken}}	{56 + 8 * @code{num_ops} bytes}
216@item	@code{gsbase}		@tab 256
217@item	@code{addresses_taken}	@tab 64
218@item	@code{def_ops}		@tab 64
219@item	@code{use_ops}		@tab 64
220@item	@code{op}		@tab @code{num_ops} * 64
221@item	Total size		@tab 56 + 8 * @code{num_ops} bytes
222@end multitable
223
224@itemize @bullet
225@item @code{gsbase}
226Inherited from @code{struct gimple_statement_base}.
227
228@item @code{addresses_taken}
229Bitmap holding the UIDs of all the @code{VAR_DECL}s whose addresses are
230taken by this statement. For example, a statement of the form
231@code{p = &b} will have the UID for symbol @code{b} in this set.
232
233@item @code{def_ops}
234Array of pointers into the operand array indicating all the slots that
235contain a variable written-to by the statement. This array is
236also used for immediate use chaining. Note that it would be
237possible to not rely on this array, but the changes required to
238implement this are pretty invasive.
239
240@item @code{use_ops}
241Similar to @code{def_ops} but for variables read by the statement.
242
243@item @code{op}
244Array of trees with @code{num_ops} slots.
245@end itemize
246
247@subsection @code{gimple_statement_with_memory_ops}
248
249This tuple is essentially identical to @code{gimple_statement_with_ops},
250except that it contains 4 additional fields to hold vectors
251related memory stores and loads.  Similar to the previous case,
252the structure is split in two to accommodate for the operand
253vector (@code{gimple_statement_with_memory_ops_base} and
254@code{gimple_statement_with_memory_ops}).
255
256
257@multitable {@code{addresses_taken}}	{88 + 8 * @code{num_ops} bytes}
258@item Field				@tab Size (bits)
259@item @code{gsbase}			@tab 256
260@item @code{addresses_taken}		@tab 64
261@item @code{def_ops}			@tab 64
262@item @code{use_ops}			@tab 64
263@item @code{vdef_ops}			@tab 64
264@item @code{vuse_ops}			@tab 64
265@item @code{stores}			@tab 64
266@item @code{loads}			@tab 64
267@item @code{op}				@tab @code{num_ops} * 64
268@item Total size			@tab 88 + 8 * @code{num_ops} bytes
269@end multitable
270
271@itemize @bullet
272@item @code{vdef_ops}
273Similar to @code{def_ops} but for @code{VDEF} operators. There is
274one entry per memory symbol written by this statement. This is
275used to maintain the memory SSA use-def and def-def chains.
276
277@item @code{vuse_ops}
278Similar to @code{use_ops} but for @code{VUSE} operators. There is
279one entry per memory symbol loaded by this statement. This is
280used to maintain the memory SSA use-def chains.
281
282@item @code{stores}
283Bitset with all the UIDs for the symbols written-to by the
284statement.  This is different than @code{vdef_ops} in that all the
285affected symbols are mentioned in this set.  If memory
286partitioning is enabled, the @code{vdef_ops} vector will refer to memory
287partitions. Furthermore, no SSA information is stored in this
288set.
289
290@item @code{loads}
291Similar to @code{stores}, but for memory loads. (Note that there
292is some amount of redundancy here, it should be possible to
293reduce memory utilization further by removing these sets).
294@end itemize
295
296All the other tuples are defined in terms of these three basic
297ones. Each tuple will add some fields. The main gimple type
298is defined to be the union of all these structures (@code{GTY} markers
299elided for clarity):
300
301@smallexample
302union gimple_statement_d
303@{
304  struct gimple_statement_base gsbase;
305  struct gimple_statement_with_ops gsops;
306  struct gimple_statement_with_memory_ops gsmem;
307  struct gimple_statement_omp omp;
308  struct gimple_statement_bind gimple_bind;
309  struct gimple_statement_catch gimple_catch;
310  struct gimple_statement_eh_filter gimple_eh_filter;
311  struct gimple_statement_phi gimple_phi;
312  struct gimple_statement_resx gimple_resx;
313  struct gimple_statement_try gimple_try;
314  struct gimple_statement_wce gimple_wce;
315  struct gimple_statement_asm gimple_asm;
316  struct gimple_statement_omp_critical gimple_omp_critical;
317  struct gimple_statement_omp_for gimple_omp_for;
318  struct gimple_statement_omp_parallel gimple_omp_parallel;
319  struct gimple_statement_omp_task gimple_omp_task;
320  struct gimple_statement_omp_sections gimple_omp_sections;
321  struct gimple_statement_omp_single gimple_omp_single;
322  struct gimple_statement_omp_continue gimple_omp_continue;
323  struct gimple_statement_omp_atomic_load gimple_omp_atomic_load;
324  struct gimple_statement_omp_atomic_store gimple_omp_atomic_store;
325@};
326@end smallexample
327
328
329@node GIMPLE instruction set
330@section GIMPLE instruction set
331@cindex GIMPLE instruction set
332
333The following table briefly describes the GIMPLE instruction set.
334
335@multitable {@code{GIMPLE_OMP_SECTIONS_SWITCH}} {High GIMPLE} {Low GIMPLE}
336@item Instruction			@tab High GIMPLE	@tab Low GIMPLE
337@item @code{GIMPLE_ASM}			@tab x			@tab x
338@item @code{GIMPLE_ASSIGN}		@tab x			@tab x
339@item @code{GIMPLE_BIND}		@tab x			@tab
340@item @code{GIMPLE_CALL}		@tab x			@tab x
341@item @code{GIMPLE_CATCH}		@tab x			@tab
342@item @code{GIMPLE_COND}		@tab x			@tab x
343@item @code{GIMPLE_DEBUG}		@tab x			@tab x
344@item @code{GIMPLE_EH_FILTER}		@tab x			@tab
345@item @code{GIMPLE_GOTO}		@tab x			@tab x
346@item @code{GIMPLE_LABEL}		@tab x			@tab x
347@item @code{GIMPLE_NOP}			@tab x			@tab x
348@item @code{GIMPLE_OMP_ATOMIC_LOAD}	@tab x			@tab x
349@item @code{GIMPLE_OMP_ATOMIC_STORE}	@tab x			@tab x
350@item @code{GIMPLE_OMP_CONTINUE}	@tab x			@tab x
351@item @code{GIMPLE_OMP_CRITICAL}	@tab x			@tab x
352@item @code{GIMPLE_OMP_FOR}		@tab x			@tab x
353@item @code{GIMPLE_OMP_MASTER}		@tab x			@tab x
354@item @code{GIMPLE_OMP_ORDERED}		@tab x			@tab x
355@item @code{GIMPLE_OMP_PARALLEL}	@tab x			@tab x
356@item @code{GIMPLE_OMP_RETURN}		@tab x			@tab x
357@item @code{GIMPLE_OMP_SECTION}		@tab x			@tab x
358@item @code{GIMPLE_OMP_SECTIONS}	@tab x			@tab x
359@item @code{GIMPLE_OMP_SECTIONS_SWITCH}	@tab x			@tab x
360@item @code{GIMPLE_OMP_SINGLE}		@tab x			@tab x
361@item @code{GIMPLE_PHI}			@tab 			@tab x
362@item @code{GIMPLE_RESX}		@tab			@tab x
363@item @code{GIMPLE_RETURN}		@tab x			@tab x
364@item @code{GIMPLE_SWITCH}		@tab x			@tab x
365@item @code{GIMPLE_TRY}			@tab x			@tab
366@end multitable
367
368@node GIMPLE Exception Handling
369@section Exception Handling
370@cindex GIMPLE Exception Handling
371
372Other exception handling constructs are represented using
373@code{GIMPLE_TRY_CATCH}.  @code{GIMPLE_TRY_CATCH} has two operands.  The
374first operand is a sequence of statements to execute.  If executing
375these statements does not throw an exception, then the second operand
376is ignored.  Otherwise, if an exception is thrown, then the second
377operand of the @code{GIMPLE_TRY_CATCH} is checked.  The second
378operand may have the following forms:
379
380@enumerate
381
382@item A sequence of statements to execute.  When an exception occurs,
383these statements are executed, and then the exception is rethrown.
384
385@item A sequence of @code{GIMPLE_CATCH} statements.  Each
386@code{GIMPLE_CATCH} has a list of applicable exception types and
387handler code.  If the thrown exception matches one of the caught
388types, the associated handler code is executed.  If the handler
389code falls off the bottom, execution continues after the original
390@code{GIMPLE_TRY_CATCH}.
391
392@item A @code{GIMPLE_EH_FILTER} statement.  This has a list of
393permitted exception types, and code to handle a match failure.  If the
394thrown exception does not match one of the allowed types, the
395associated match failure code is executed.  If the thrown exception
396does match, it continues unwinding the stack looking for the next
397handler.
398
399@end enumerate
400
401Currently throwing an exception is not directly represented in
402GIMPLE, since it is implemented by calling a function.  At some
403point in the future we will want to add some way to express that
404the call will throw an exception of a known type.
405
406Just before running the optimizers, the compiler lowers the
407high-level EH constructs above into a set of @samp{goto}s, magic
408labels, and EH regions.  Continuing to unwind at the end of a
409cleanup is represented with a @code{GIMPLE_RESX}.
410
411
412@node Temporaries
413@section Temporaries
414@cindex Temporaries
415
416When gimplification encounters a subexpression that is too
417complex, it creates a new temporary variable to hold the value of
418the subexpression, and adds a new statement to initialize it
419before the current statement. These special temporaries are known
420as @samp{expression temporaries}, and are allocated using
421@code{get_formal_tmp_var}.  The compiler tries to always evaluate
422identical expressions into the same temporary, to simplify
423elimination of redundant calculations.
424
425We can only use expression temporaries when we know that it will
426not be reevaluated before its value is used, and that it will not
427be otherwise modified@footnote{These restrictions are derived
428from those in Morgan 4.8.}. Other temporaries can be allocated
429using @code{get_initialized_tmp_var} or @code{create_tmp_var}.
430
431Currently, an expression like @code{a = b + 5} is not reduced any
432further.  We tried converting it to something like
433@smallexample
434  T1 = b + 5;
435  a = T1;
436@end smallexample
437but this bloated the representation for minimal benefit.  However, a
438variable which must live in memory cannot appear in an expression; its
439value is explicitly loaded into a temporary first.  Similarly, storing
440the value of an expression to a memory variable goes through a
441temporary.
442
443@node Operands
444@section Operands
445@cindex Operands
446
447In general, expressions in GIMPLE consist of an operation and the
448appropriate number of simple operands; these operands must either be a
449GIMPLE rvalue (@code{is_gimple_val}), i.e.@: a constant or a register
450variable.  More complex operands are factored out into temporaries, so
451that
452@smallexample
453  a = b + c + d
454@end smallexample
455becomes
456@smallexample
457  T1 = b + c;
458  a = T1 + d;
459@end smallexample
460
461The same rule holds for arguments to a @code{GIMPLE_CALL}.
462
463The target of an assignment is usually a variable, but can also be an
464@code{INDIRECT_REF} or a compound lvalue as described below.
465
466@menu
467* Compound Expressions::
468* Compound Lvalues::
469* Conditional Expressions::
470* Logical Operators::
471@end menu
472
473@node Compound Expressions
474@subsection Compound Expressions
475@cindex Compound Expressions
476
477The left-hand side of a C comma expression is simply moved into a separate
478statement.
479
480@node Compound Lvalues
481@subsection Compound Lvalues
482@cindex Compound Lvalues
483
484Currently compound lvalues involving array and structure field references
485are not broken down; an expression like @code{a.b[2] = 42} is not reduced
486any further (though complex array subscripts are).  This restriction is a
487workaround for limitations in later optimizers; if we were to convert this
488to
489
490@smallexample
491  T1 = &a.b;
492  T1[2] = 42;
493@end smallexample
494
495alias analysis would not remember that the reference to @code{T1[2]} came
496by way of @code{a.b}, so it would think that the assignment could alias
497another member of @code{a}; this broke @code{struct-alias-1.c}.  Future
498optimizer improvements may make this limitation unnecessary.
499
500@node Conditional Expressions
501@subsection Conditional Expressions
502@cindex Conditional Expressions
503
504A C @code{?:} expression is converted into an @code{if} statement with
505each branch assigning to the same temporary.  So,
506
507@smallexample
508  a = b ? c : d;
509@end smallexample
510becomes
511@smallexample
512  if (b == 1)
513    T1 = c;
514  else
515    T1 = d;
516  a = T1;
517@end smallexample
518
519The GIMPLE level if-conversion pass re-introduces @code{?:}
520expression, if appropriate. It is used to vectorize loops with
521conditions using vector conditional operations.
522
523Note that in GIMPLE, @code{if} statements are represented using
524@code{GIMPLE_COND}, as described below.
525
526@node Logical Operators
527@subsection Logical Operators
528@cindex Logical Operators
529
530Except when they appear in the condition operand of a
531@code{GIMPLE_COND}, logical `and' and `or' operators are simplified
532as follows: @code{a = b && c} becomes
533
534@smallexample
535  T1 = (bool)b;
536  if (T1 == true)
537    T1 = (bool)c;
538  a = T1;
539@end smallexample
540
541Note that @code{T1} in this example cannot be an expression temporary,
542because it has two different assignments.
543
544@subsection Manipulating operands
545
546All gimple operands are of type @code{tree}.  But only certain
547types of trees are allowed to be used as operand tuples.  Basic
548validation is controlled by the function
549@code{get_gimple_rhs_class}, which given a tree code, returns an
550@code{enum} with the following values of type @code{enum
551gimple_rhs_class}
552
553@itemize @bullet
554@item @code{GIMPLE_INVALID_RHS}
555The tree cannot be used as a GIMPLE operand.
556
557@item @code{GIMPLE_BINARY_RHS}
558The tree is a valid GIMPLE binary operation.
559
560@item @code{GIMPLE_UNARY_RHS}
561The tree is a valid GIMPLE unary operation.
562
563@item @code{GIMPLE_SINGLE_RHS}
564The tree is a single object, that cannot be split into simpler
565operands (for instance, @code{SSA_NAME}, @code{VAR_DECL}, @code{COMPONENT_REF}, etc).
566
567This operand class also acts as an escape hatch for tree nodes
568that may be flattened out into the operand vector, but would need
569more than two slots on the RHS.  For instance, a @code{COND_EXPR}
570expression of the form @code{(a op b) ? x : y} could be flattened
571out on the operand vector using 4 slots, but it would also
572require additional processing to distinguish @code{c = a op b}
573from @code{c = a op b ? x : y}.  Something similar occurs with
574@code{ASSERT_EXPR}.   In time, these special case tree
575expressions should be flattened into the operand vector.
576@end itemize
577
578For tree nodes in the categories @code{GIMPLE_BINARY_RHS} and
579@code{GIMPLE_UNARY_RHS}, they cannot be stored inside tuples directly.
580They first need to be flattened and separated into individual
581components.  For instance, given the GENERIC expression
582
583@smallexample
584a = b + c
585@end smallexample
586
587its tree representation is:
588
589@smallexample
590MODIFY_EXPR <VAR_DECL  <a>, PLUS_EXPR <VAR_DECL <b>, VAR_DECL <c>>>
591@end smallexample
592
593In this case, the GIMPLE form for this statement is logically
594identical to its GENERIC form but in GIMPLE, the @code{PLUS_EXPR}
595on the RHS of the assignment is not represented as a tree,
596instead the two operands are taken out of the @code{PLUS_EXPR} sub-tree
597and flattened into the GIMPLE tuple as follows:
598
599@smallexample
600GIMPLE_ASSIGN <PLUS_EXPR, VAR_DECL <a>, VAR_DECL <b>, VAR_DECL <c>>
601@end smallexample
602
603@subsection Operand vector allocation
604
605The operand vector is stored at the bottom of the three tuple
606structures that accept operands. This means, that depending on
607the code of a given statement, its operand vector will be at
608different offsets from the base of the structure.  To access
609tuple operands use the following accessors
610
611@deftypefn {GIMPLE function} unsigned gimple_num_ops (gimple g)
612Returns the number of operands in statement G.
613@end deftypefn
614
615@deftypefn {GIMPLE function} tree gimple_op (gimple g, unsigned i)
616Returns operand @code{I} from statement @code{G}.
617@end deftypefn
618
619@deftypefn {GIMPLE function} tree *gimple_ops (gimple g)
620Returns a pointer into the operand vector for statement @code{G}.  This
621is computed using an internal table called @code{gimple_ops_offset_}[].
622This table is indexed by the gimple code of @code{G}.
623
624When the compiler is built, this table is filled-in using the
625sizes of the structures used by each statement code defined in
626gimple.def.  Since the operand vector is at the bottom of the
627structure, for a gimple code @code{C} the offset is computed as sizeof
628(struct-of @code{C}) - sizeof (tree).
629
630This mechanism adds one memory indirection to every access when
631using @code{gimple_op}(), if this becomes a bottleneck, a pass can
632choose to memoize the result from @code{gimple_ops}() and use that to
633access the operands.
634@end deftypefn
635
636@subsection Operand validation
637
638When adding a new operand to a gimple statement, the operand will
639be validated according to what each tuple accepts in its operand
640vector.  These predicates are called by the
641@code{gimple_<name>_set_...()}.  Each tuple will use one of the
642following predicates (Note, this list is not exhaustive):
643
644@deftypefn {GIMPLE function} is_gimple_operand (tree t)
645This is the most permissive of the predicates.  It essentially
646checks whether t has a @code{gimple_rhs_class} of @code{GIMPLE_SINGLE_RHS}.
647@end deftypefn
648
649
650@deftypefn {GIMPLE function} is_gimple_val (tree t)
651Returns true if t is a "GIMPLE value", which are all the
652non-addressable stack variables (variables for which
653@code{is_gimple_reg} returns true) and constants (expressions for which
654@code{is_gimple_min_invariant} returns true).
655@end deftypefn
656
657@deftypefn {GIMPLE function} is_gimple_addressable (tree t)
658Returns true if t is a symbol or memory reference whose address
659can be taken.
660@end deftypefn
661
662@deftypefn {GIMPLE function} is_gimple_asm_val (tree t)
663Similar to @code{is_gimple_val} but it also accepts hard registers.
664@end deftypefn
665
666@deftypefn {GIMPLE function} is_gimple_call_addr (tree t)
667Return true if t is a valid expression to use as the function
668called by a @code{GIMPLE_CALL}.
669@end deftypefn
670
671@deftypefn {GIMPLE function} is_gimple_constant (tree t)
672Return true if t is a valid gimple constant.
673@end deftypefn
674
675@deftypefn {GIMPLE function} is_gimple_min_invariant (tree t)
676Return true if t is a valid minimal invariant.  This is different
677from constants, in that the specific value of t may not be known
678at compile time, but it is known that it doesn't change (e.g.,
679the address of a function local variable).
680@end deftypefn
681
682@deftypefn {GIMPLE function} is_gimple_min_invariant_address (tree t)
683Return true if t is an @code{ADDR_EXPR} that does not change once a
684function is running.
685@end deftypefn
686
687@deftypefn {GIMPLE function} is_gimple_ip_invariant (tree t)
688Return true if t is an interprocedural invariant.  This means that t
689is a valid invariant in all functions (e.g. it can be an address of a
690global variable but not of a local one).
691@end deftypefn
692
693@deftypefn {GIMPLE function} is_gimple_ip_invariant_address (tree t)
694Return true if t is an @code{ADDR_EXPR} that does not change once the
695program is running (and which is valid in all functions).
696@end deftypefn
697
698
699@subsection Statement validation
700
701@deftypefn {GIMPLE function} is_gimple_assign (gimple g)
702Return true if the code of g is @code{GIMPLE_ASSIGN}.
703@end deftypefn
704
705@deftypefn {GIMPLE function} is_gimple_call (gimple g)
706Return true if the code of g is @code{GIMPLE_CALL}.
707@end deftypefn
708
709@deftypefn {GIMPLE function} is_gimple_debug (gimple g)
710Return true if the code of g is @code{GIMPLE_DEBUG}.
711@end deftypefn
712
713@deftypefn {GIMPLE function} gimple_assign_cast_p (gimple g)
714Return true if g is a @code{GIMPLE_ASSIGN} that performs a type cast
715operation.
716@end deftypefn
717
718@deftypefn {GIMPLE function} gimple_debug_bind_p (gimple g)
719Return true if g is a @code{GIMPLE_DEBUG} that binds the value of an
720expression to a variable.
721@end deftypefn
722
723@node Manipulating GIMPLE statements
724@section Manipulating GIMPLE statements
725@cindex Manipulating GIMPLE statements
726
727This section documents all the functions available to handle each
728of the GIMPLE instructions.
729
730@subsection Common accessors
731The following are common accessors for gimple statements.
732
733@deftypefn {GIMPLE function} enum gimple_code gimple_code (gimple g)
734Return the code for statement @code{G}.
735@end deftypefn
736
737@deftypefn {GIMPLE function} basic_block gimple_bb (gimple g)
738Return the basic block to which statement @code{G} belongs to.
739@end deftypefn
740
741@deftypefn {GIMPLE function} tree gimple_block (gimple g)
742Return the lexical scope block holding statement @code{G}.
743@end deftypefn
744
745@deftypefn {GIMPLE function} tree gimple_expr_type (gimple stmt)
746Return the type of the main expression computed by @code{STMT}. Return
747@code{void_type_node} if @code{STMT} computes nothing. This will only return
748something meaningful for @code{GIMPLE_ASSIGN}, @code{GIMPLE_COND} and
749@code{GIMPLE_CALL}.  For all other tuple codes, it will return
750@code{void_type_node}.
751@end deftypefn
752
753@deftypefn {GIMPLE function} enum tree_code gimple_expr_code (gimple stmt)
754Return the tree code for the expression computed by @code{STMT}.  This
755is only meaningful for @code{GIMPLE_CALL}, @code{GIMPLE_ASSIGN} and
756@code{GIMPLE_COND}.  If @code{STMT} is @code{GIMPLE_CALL}, it will return @code{CALL_EXPR}.
757For @code{GIMPLE_COND}, it returns the code of the comparison predicate.
758For @code{GIMPLE_ASSIGN} it returns the code of the operation performed
759by the @code{RHS} of the assignment.
760@end deftypefn
761
762@deftypefn {GIMPLE function} void gimple_set_block (gimple g, tree block)
763Set the lexical scope block of @code{G} to @code{BLOCK}.
764@end deftypefn
765
766@deftypefn {GIMPLE function} location_t gimple_locus (gimple g)
767Return locus information for statement @code{G}.
768@end deftypefn
769
770@deftypefn {GIMPLE function} void gimple_set_locus (gimple g, location_t locus)
771Set locus information for statement @code{G}.
772@end deftypefn
773
774@deftypefn {GIMPLE function} bool gimple_locus_empty_p (gimple g)
775Return true if @code{G} does not have locus information.
776@end deftypefn
777
778@deftypefn {GIMPLE function} bool gimple_no_warning_p (gimple stmt)
779Return true if no warnings should be emitted for statement @code{STMT}.
780@end deftypefn
781
782@deftypefn {GIMPLE function} void gimple_set_visited (gimple stmt, bool visited_p)
783Set the visited status on statement @code{STMT} to @code{VISITED_P}.
784@end deftypefn
785
786@deftypefn {GIMPLE function} bool gimple_visited_p (gimple stmt)
787Return the visited status on statement @code{STMT}.
788@end deftypefn
789
790@deftypefn {GIMPLE function} void gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
791Set pass local flag @code{PLF} on statement @code{STMT} to @code{VAL_P}.
792@end deftypefn
793
794@deftypefn {GIMPLE function} unsigned int gimple_plf (gimple stmt, enum plf_mask plf)
795Return the value of pass local flag @code{PLF} on statement @code{STMT}.
796@end deftypefn
797
798@deftypefn {GIMPLE function} bool gimple_has_ops (gimple g)
799Return true if statement @code{G} has register or memory operands.
800@end deftypefn
801
802@deftypefn {GIMPLE function} bool gimple_has_mem_ops (gimple g)
803Return true if statement @code{G} has memory operands.
804@end deftypefn
805
806@deftypefn {GIMPLE function} unsigned gimple_num_ops (gimple g)
807Return the number of operands for statement @code{G}.
808@end deftypefn
809
810@deftypefn {GIMPLE function} tree *gimple_ops (gimple g)
811Return the array of operands for statement @code{G}.
812@end deftypefn
813
814@deftypefn {GIMPLE function} tree gimple_op (gimple g, unsigned i)
815Return operand @code{I} for statement @code{G}.
816@end deftypefn
817
818@deftypefn {GIMPLE function} tree *gimple_op_ptr (gimple g, unsigned i)
819Return a pointer to operand @code{I} for statement @code{G}.
820@end deftypefn
821
822@deftypefn {GIMPLE function} void gimple_set_op (gimple g, unsigned i, tree op)
823Set operand @code{I} of statement @code{G} to @code{OP}.
824@end deftypefn
825
826@deftypefn {GIMPLE function} bitmap gimple_addresses_taken (gimple stmt)
827Return the set of symbols that have had their address taken by
828@code{STMT}.
829@end deftypefn
830
831@deftypefn {GIMPLE function} struct def_optype_d *gimple_def_ops (gimple g)
832Return the set of @code{DEF} operands for statement @code{G}.
833@end deftypefn
834
835@deftypefn {GIMPLE function} void gimple_set_def_ops (gimple g, struct def_optype_d *def)
836Set @code{DEF} to be the set of @code{DEF} operands for statement @code{G}.
837@end deftypefn
838
839@deftypefn {GIMPLE function} struct use_optype_d *gimple_use_ops (gimple g)
840Return the set of @code{USE} operands for statement @code{G}.
841@end deftypefn
842
843@deftypefn {GIMPLE function} void gimple_set_use_ops (gimple g, struct use_optype_d *use)
844Set @code{USE} to be the set of @code{USE} operands for statement @code{G}.
845@end deftypefn
846
847@deftypefn {GIMPLE function} struct voptype_d *gimple_vuse_ops (gimple g)
848Return the set of @code{VUSE} operands for statement @code{G}.
849@end deftypefn
850
851@deftypefn {GIMPLE function} void gimple_set_vuse_ops (gimple g, struct voptype_d *ops)
852Set @code{OPS} to be the set of @code{VUSE} operands for statement @code{G}.
853@end deftypefn
854
855@deftypefn {GIMPLE function} struct voptype_d *gimple_vdef_ops (gimple g)
856Return the set of @code{VDEF} operands for statement @code{G}.
857@end deftypefn
858
859@deftypefn {GIMPLE function} void gimple_set_vdef_ops (gimple g, struct voptype_d *ops)
860Set @code{OPS} to be the set of @code{VDEF} operands for statement @code{G}.
861@end deftypefn
862
863@deftypefn {GIMPLE function} bitmap gimple_loaded_syms (gimple g)
864Return the set of symbols loaded by statement @code{G}.  Each element of
865the set is the @code{DECL_UID} of the corresponding symbol.
866@end deftypefn
867
868@deftypefn {GIMPLE function} bitmap gimple_stored_syms (gimple g)
869Return the set of symbols stored by statement @code{G}.  Each element of
870the set is the @code{DECL_UID} of the corresponding symbol.
871@end deftypefn
872
873@deftypefn {GIMPLE function} bool gimple_modified_p (gimple g)
874Return true if statement @code{G} has operands and the modified field
875has been set.
876@end deftypefn
877
878@deftypefn {GIMPLE function} bool gimple_has_volatile_ops (gimple stmt)
879Return true if statement @code{STMT} contains volatile operands.
880@end deftypefn
881
882@deftypefn {GIMPLE function} void gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
883Return true if statement @code{STMT} contains volatile operands.
884@end deftypefn
885
886@deftypefn {GIMPLE function} void update_stmt (gimple s)
887Mark statement @code{S} as modified, and update it.
888@end deftypefn
889
890@deftypefn {GIMPLE function} void update_stmt_if_modified (gimple s)
891Update statement @code{S} if it has been marked modified.
892@end deftypefn
893
894@deftypefn {GIMPLE function} gimple gimple_copy (gimple stmt)
895Return a deep copy of statement @code{STMT}.
896@end deftypefn
897
898@node Tuple specific accessors
899@section Tuple specific accessors
900@cindex Tuple specific accessors
901
902@menu
903* @code{GIMPLE_ASM}::
904* @code{GIMPLE_ASSIGN}::
905* @code{GIMPLE_BIND}::
906* @code{GIMPLE_CALL}::
907* @code{GIMPLE_CATCH}::
908* @code{GIMPLE_COND}::
909* @code{GIMPLE_DEBUG}::
910* @code{GIMPLE_EH_FILTER}::
911* @code{GIMPLE_LABEL}::
912* @code{GIMPLE_NOP}::
913* @code{GIMPLE_OMP_ATOMIC_LOAD}::
914* @code{GIMPLE_OMP_ATOMIC_STORE}::
915* @code{GIMPLE_OMP_CONTINUE}::
916* @code{GIMPLE_OMP_CRITICAL}::
917* @code{GIMPLE_OMP_FOR}::
918* @code{GIMPLE_OMP_MASTER}::
919* @code{GIMPLE_OMP_ORDERED}::
920* @code{GIMPLE_OMP_PARALLEL}::
921* @code{GIMPLE_OMP_RETURN}::
922* @code{GIMPLE_OMP_SECTION}::
923* @code{GIMPLE_OMP_SECTIONS}::
924* @code{GIMPLE_OMP_SINGLE}::
925* @code{GIMPLE_PHI}::
926* @code{GIMPLE_RESX}::
927* @code{GIMPLE_RETURN}::
928* @code{GIMPLE_SWITCH}::
929* @code{GIMPLE_TRY}::
930* @code{GIMPLE_WITH_CLEANUP_EXPR}::
931@end menu
932
933
934@node @code{GIMPLE_ASM}
935@subsection @code{GIMPLE_ASM}
936@cindex @code{GIMPLE_ASM}
937
938@deftypefn {GIMPLE function} gimple gimple_build_asm (const char *string, ninputs, noutputs, nclobbers, ...)
939Build a @code{GIMPLE_ASM} statement.  This statement is used for
940building in-line assembly constructs.  @code{STRING} is the assembly
941code.  @code{NINPUT} is the number of register inputs.  @code{NOUTPUT} is the
942number of register outputs.  @code{NCLOBBERS} is the number of clobbered
943registers.  The rest of the arguments trees for each input,
944output, and clobbered registers.
945@end deftypefn
946
947@deftypefn {GIMPLE function} gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *, VEC(tree,gc) *)
948Identical to gimple_build_asm, but the arguments are passed in
949VECs.
950@end deftypefn
951
952@deftypefn {GIMPLE function} gimple_asm_ninputs (gimple g)
953Return the number of input operands for @code{GIMPLE_ASM} @code{G}.
954@end deftypefn
955
956@deftypefn {GIMPLE function} gimple_asm_noutputs (gimple g)
957Return the number of output operands for @code{GIMPLE_ASM} @code{G}.
958@end deftypefn
959
960@deftypefn {GIMPLE function} gimple_asm_nclobbers (gimple g)
961Return the number of clobber operands for @code{GIMPLE_ASM} @code{G}.
962@end deftypefn
963
964@deftypefn {GIMPLE function} tree gimple_asm_input_op (gimple g, unsigned index)
965Return input operand @code{INDEX} of @code{GIMPLE_ASM} @code{G}.
966@end deftypefn
967
968@deftypefn {GIMPLE function} void gimple_asm_set_input_op (gimple g, unsigned index, tree in_op)
969Set @code{IN_OP} to be input operand @code{INDEX} in @code{GIMPLE_ASM} @code{G}.
970@end deftypefn
971
972@deftypefn {GIMPLE function} tree gimple_asm_output_op (gimple g, unsigned index)
973Return output operand @code{INDEX} of @code{GIMPLE_ASM} @code{G}.
974@end deftypefn
975
976@deftypefn {GIMPLE function} void gimple_asm_set_output_op (gimple g, @
977unsigned index, tree out_op)
978Set @code{OUT_OP} to be output operand @code{INDEX} in @code{GIMPLE_ASM} @code{G}.
979@end deftypefn
980
981@deftypefn {GIMPLE function} tree gimple_asm_clobber_op (gimple g, unsigned index)
982Return clobber operand @code{INDEX} of @code{GIMPLE_ASM} @code{G}.
983@end deftypefn
984
985@deftypefn {GIMPLE function} void gimple_asm_set_clobber_op (gimple g, unsigned index, tree clobber_op)
986Set @code{CLOBBER_OP} to be clobber operand @code{INDEX} in @code{GIMPLE_ASM} @code{G}.
987@end deftypefn
988
989@deftypefn {GIMPLE function} const char *gimple_asm_string (gimple g)
990Return the string representing the assembly instruction in
991@code{GIMPLE_ASM} @code{G}.
992@end deftypefn
993
994@deftypefn {GIMPLE function} bool gimple_asm_volatile_p (gimple g)
995Return true if @code{G} is an asm statement marked volatile.
996@end deftypefn
997
998@deftypefn {GIMPLE function} void gimple_asm_set_volatile (gimple g)
999Mark asm statement @code{G} as volatile.
1000@end deftypefn
1001
1002@deftypefn {GIMPLE function} void gimple_asm_clear_volatile (gimple g)
1003Remove volatile marker from asm statement @code{G}.
1004@end deftypefn
1005
1006@node @code{GIMPLE_ASSIGN}
1007@subsection @code{GIMPLE_ASSIGN}
1008@cindex @code{GIMPLE_ASSIGN}
1009
1010@deftypefn {GIMPLE function} gimple gimple_build_assign (tree lhs, tree rhs)
1011Build a @code{GIMPLE_ASSIGN} statement.  The left-hand side is an lvalue
1012passed in lhs.  The right-hand side can be either a unary or
1013binary tree expression.  The expression tree rhs will be
1014flattened and its operands assigned to the corresponding operand
1015slots in the new statement.  This function is useful when you
1016already have a tree expression that you want to convert into a
1017tuple.  However, try to avoid building expression trees for the
1018sole purpose of calling this function.  If you already have the
1019operands in separate trees, it is better to use
1020@code{gimple_build_assign_with_ops}.
1021@end deftypefn
1022
1023
1024@deftypefn {GIMPLE function} gimple gimplify_assign (tree dst, tree src, gimple_seq *seq_p)
1025Build a new @code{GIMPLE_ASSIGN} tuple and append it to the end of
1026@code{*SEQ_P}.
1027@end deftypefn
1028
1029@code{DST}/@code{SRC} are the destination and source respectively.  You can
1030pass ungimplified trees in @code{DST} or @code{SRC}, in which
1031case they will be converted to a gimple operand if necessary.
1032
1033This function returns the newly created @code{GIMPLE_ASSIGN} tuple.
1034
1035@deftypefn {GIMPLE function} gimple gimple_build_assign_with_ops @
1036(enum tree_code subcode, tree lhs, tree op1, tree op2)
1037This function is similar to @code{gimple_build_assign}, but is used to
1038build a @code{GIMPLE_ASSIGN} statement when the operands of the
1039right-hand side of the assignment are already split into
1040different operands.
1041
1042The left-hand side is an lvalue passed in lhs.  Subcode is the
1043@code{tree_code} for the right-hand side of the assignment.  Op1 and op2
1044are the operands.  If op2 is null, subcode must be a @code{tree_code}
1045for a unary expression.
1046@end deftypefn
1047
1048@deftypefn {GIMPLE function} enum tree_code gimple_assign_rhs_code (gimple g)
1049Return the code of the expression computed on the @code{RHS} of
1050assignment statement @code{G}.
1051@end deftypefn
1052
1053
1054@deftypefn {GIMPLE function} enum gimple_rhs_class gimple_assign_rhs_class (gimple g)
1055Return the gimple rhs class of the code for the expression
1056computed on the rhs of assignment statement @code{G}.  This will never
1057return @code{GIMPLE_INVALID_RHS}.
1058@end deftypefn
1059
1060@deftypefn {GIMPLE function} tree gimple_assign_lhs (gimple g)
1061Return the @code{LHS} of assignment statement @code{G}.
1062@end deftypefn
1063
1064@deftypefn {GIMPLE function} tree *gimple_assign_lhs_ptr (gimple g)
1065Return a pointer to the @code{LHS} of assignment statement @code{G}.
1066@end deftypefn
1067
1068@deftypefn {GIMPLE function} tree gimple_assign_rhs1 (gimple g)
1069Return the first operand on the @code{RHS} of assignment statement @code{G}.
1070@end deftypefn
1071
1072@deftypefn {GIMPLE function} tree *gimple_assign_rhs1_ptr (gimple g)
1073Return the address of the first operand on the @code{RHS} of assignment
1074statement @code{G}.
1075@end deftypefn
1076
1077@deftypefn {GIMPLE function} tree gimple_assign_rhs2 (gimple g)
1078Return the second operand on the @code{RHS} of assignment statement @code{G}.
1079@end deftypefn
1080
1081@deftypefn {GIMPLE function} tree *gimple_assign_rhs2_ptr (gimple g)
1082Return the address of the second operand on the @code{RHS} of assignment
1083statement @code{G}.
1084@end deftypefn
1085
1086@deftypefn {GIMPLE function} void gimple_assign_set_lhs (gimple g, tree lhs)
1087Set @code{LHS} to be the @code{LHS} operand of assignment statement @code{G}.
1088@end deftypefn
1089
1090@deftypefn {GIMPLE function} void gimple_assign_set_rhs1 (gimple g, tree rhs)
1091Set @code{RHS} to be the first operand on the @code{RHS} of assignment
1092statement @code{G}.
1093@end deftypefn
1094
1095@deftypefn {GIMPLE function} tree gimple_assign_rhs2 (gimple g)
1096Return the second operand on the @code{RHS} of assignment statement @code{G}.
1097@end deftypefn
1098
1099@deftypefn {GIMPLE function} tree *gimple_assign_rhs2_ptr (gimple g)
1100Return a pointer to the second operand on the @code{RHS} of assignment
1101statement @code{G}.
1102@end deftypefn
1103
1104@deftypefn {GIMPLE function} void gimple_assign_set_rhs2 (gimple g, tree rhs)
1105Set @code{RHS} to be the second operand on the @code{RHS} of assignment
1106statement @code{G}.
1107@end deftypefn
1108
1109@deftypefn {GIMPLE function} bool gimple_assign_cast_p (gimple s)
1110Return 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)
1119Build a @code{GIMPLE_BIND} statement with a list of variables in @code{VARS}
1120and a body of statements in sequence @code{BODY}.
1121@end deftypefn
1122
1123@deftypefn {GIMPLE function} tree gimple_bind_vars (gimple g)
1124Return 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)
1128Set @code{VARS} to be the set of variables declared in the @code{GIMPLE_BIND}
1129statement @code{G}.
1130@end deftypefn
1131
1132@deftypefn {GIMPLE function} void gimple_bind_append_vars (gimple g, tree vars)
1133Append @code{VARS} to the set of variables declared in the @code{GIMPLE_BIND}
1134statement @code{G}.
1135@end deftypefn
1136
1137@deftypefn {GIMPLE function} gimple_seq gimple_bind_body (gimple g)
1138Return 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)
1143Set @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)
1147Append 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)
1151Append a sequence of statements to the end of a @code{GIMPLE_BIND}'s
1152body.
1153@end deftypefn
1154
1155@deftypefn {GIMPLE function} tree gimple_bind_block (gimple g)
1156Return 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)
1161Set @code{BLOCK} to be the @code{TREE_BLOCK} node associated with @code{GIMPLE_BIND}
1162statement @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, ...)
1171Build a @code{GIMPLE_CALL} statement to function @code{FN}.  The argument @code{FN}
1172must be either a @code{FUNCTION_DECL} or a gimple call address as
1173determined by @code{is_gimple_call_addr}.  @code{NARGS} are the number of
1174arguments.  The rest of the arguments follow the argument @code{NARGS},
1175and must be trees that are valid as rvalues in gimple (i.e., each
1176operand 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)
1181Build a @code{GIMPLE_CALL} from a @code{CALL_EXPR} node.  The arguments and the
1182function are taken from the expression directly.  This routine
1183assumes that @code{call_expr} is already in GIMPLE form.  That is, its
1184operands are GIMPLE values and the function call needs no further
1185simplification.  All the call flags in @code{call_expr} are copied over
1186to 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)
1190Identical 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)
1195Return the @code{LHS} of call statement @code{G}.
1196@end deftypefn
1197
1198@deftypefn {GIMPLE function} tree *gimple_call_lhs_ptr (gimple g)
1199Return 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)
1203Set @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)
1207Return the tree node representing the function called by call
1208statement @code{G}.
1209@end deftypefn
1210
1211@deftypefn {GIMPLE function} void gimple_call_set_fn (gimple g, tree fn)
1212Set @code{FN} to be the function called by call statement @code{G}.  This has
1213to be a gimple value specifying the address of the called
1214function.
1215@end deftypefn
1216
1217@deftypefn {GIMPLE function} tree gimple_call_fndecl (gimple g)
1218If a given @code{GIMPLE_CALL}'s callee is a @code{FUNCTION_DECL}, return it.
1219Otherwise 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)
1224Set the called function to @code{FNDECL}.
1225@end deftypefn
1226
1227@deftypefn {GIMPLE function} tree gimple_call_return_type (gimple g)
1228Return the type returned by call statement @code{G}.
1229@end deftypefn
1230
1231@deftypefn {GIMPLE function} tree gimple_call_chain (gimple g)
1232Return 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)
1236Set @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)
1240Return 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)
1244Return the argument at position @code{INDEX} for call statement @code{G}.  The
1245first argument is 0.
1246@end deftypefn
1247
1248@deftypefn {GIMPLE function} tree *gimple_call_arg_ptr (gimple g, unsigned index)
1249Return a pointer to the argument at position @code{INDEX} for call
1250statement @code{G}.
1251@end deftypefn
1252
1253@deftypefn {GIMPLE function} void gimple_call_set_arg (gimple g, unsigned index, tree arg)
1254Set @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)
1259Mark call statement @code{S} as being a tail call (i.e., a call just
1260before the exit of a function). These calls are candidate for
1261tail call optimization.
1262@end deftypefn
1263
1264@deftypefn {GIMPLE function} bool gimple_call_tail_p (gimple s)
1265Return 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)
1269Mark @code{GIMPLE_CALL} @code{S} as being uninlinable.
1270@end deftypefn
1271
1272@deftypefn {GIMPLE function} bool gimple_call_cannot_inline_p (gimple s)
1273Return 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)
1277Return 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)
1281Build a @code{GIMPLE_CALL} identical to @code{STMT} but skipping the arguments
1282in 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)
1291Build a @code{GIMPLE_CATCH} statement.  @code{TYPES} are the tree types this
1292catch handles.  @code{HANDLER} is a sequence of statements with the code
1293for the handler.
1294@end deftypefn
1295
1296@deftypefn {GIMPLE function} tree gimple_catch_types (gimple g)
1297Return 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)
1301Return 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)
1306Return the GIMPLE sequence representing the body of the handler
1307of @code{GIMPLE_CATCH} statement @code{G}.
1308@end deftypefn
1309
1310@deftypefn {GIMPLE function} void gimple_catch_set_types (gimple g, tree t)
1311Set @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)
1315Set @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)
1324Build 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
1326the 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)
1333Build a @code{GIMPLE_COND} statement from the conditional expression
1334tree @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)
1338Return the code of the predicate computed by conditional
1339statement @code{G}.
1340@end deftypefn
1341
1342@deftypefn {GIMPLE function} void gimple_cond_set_code (gimple g, enum tree_code code)
1343Set @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)
1348Return 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)
1353Set @code{LHS} to be the @code{LHS} operand of the predicate computed by
1354conditional statement @code{G}.
1355@end deftypefn
1356
1357@deftypefn {GIMPLE function} tree gimple_cond_rhs (gimple g)
1358Return 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)
1363Set @code{RHS} to be the @code{RHS} operand of the predicate computed by
1364conditional statement @code{G}.
1365@end deftypefn
1366
1367@deftypefn {GIMPLE function} tree gimple_cond_true_label (gimple g)
1368Return the label used by conditional statement @code{G} when its
1369predicate evaluates to true.
1370@end deftypefn
1371
1372@deftypefn {GIMPLE function} void gimple_cond_set_true_label (gimple g, tree label)
1373Set @code{LABEL} to be the label used by conditional statement @code{G} when
1374its predicate evaluates to true.
1375@end deftypefn
1376
1377@deftypefn {GIMPLE function} void gimple_cond_set_false_label (gimple g, tree label)
1378Set @code{LABEL} to be the label used by conditional statement @code{G} when
1379its predicate evaluates to false.
1380@end deftypefn
1381
1382@deftypefn {GIMPLE function} tree gimple_cond_false_label (gimple g)
1383Return the label used by conditional statement @code{G} when its
1384predicate evaluates to false.
1385@end deftypefn
1386
1387@deftypefn {GIMPLE function} void gimple_cond_make_false (gimple g)
1388Set 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)
1392Set the conditional @code{COND_STMT} to be of the form 'if (1 == 1)'.
1393@end deftypefn
1394
1395@node @code{GIMPLE_DEBUG}
1396@subsection @code{GIMPLE_DEBUG}
1397@cindex @code{GIMPLE_DEBUG}
1398@cindex @code{GIMPLE_DEBUG_BIND}
1399
1400@deftypefn {GIMPLE function} gimple gimple_build_debug_bind (tree var, tree value, gimple stmt)
1401Build a @code{GIMPLE_DEBUG} statement with @code{GIMPLE_DEBUG_BIND} of
1402@code{subcode}.  The effect of this statement is to tell debug
1403information generation machinery that the value of user variable
1404@code{var} is given by @code{value} at that point, and to remain with
1405that value until @code{var} runs out of scope, a
1406dynamically-subsequent debug bind statement overrides the binding, or
1407conflicting values reach a control flow merge point.  Even if
1408components of the @code{value} expression change afterwards, the
1409variable is supposed to retain the same value, though not necessarily
1410the same location.
1411
1412It is expected that @code{var} be most often a tree for automatic user
1413variables (@code{VAR_DECL} or @code{PARM_DECL}) that satisfy the
1414requirements for gimple registers, but it may also be a tree for a
1415scalarized component of a user variable (@code{ARRAY_REF},
1416@code{COMPONENT_REF}), or a debug temporary (@code{DEBUG_EXPR_DECL}).
1417
1418As for @code{value}, it can be an arbitrary tree expression, but it is
1419recommended that it be in a suitable form for a gimple assignment
1420@code{RHS}.  It is not expected that user variables that could appear
1421as @code{var} ever appear in @code{value}, because in the latter we'd
1422have their @code{SSA_NAME}s instead, but even if they were not in SSA
1423form, user variables appearing in @code{value} are to be regarded as
1424part of the executable code space, whereas those in @code{var} are to
1425be regarded as part of the source code space.  There is no way to
1426refer to the value bound to a user variable within a @code{value}
1427expression.
1428
1429If @code{value} is @code{GIMPLE_DEBUG_BIND_NOVALUE}, debug information
1430generation machinery is informed that the variable @code{var} is
1431unbound, i.e., that its value is indeterminate, which sometimes means
1432it is really unavailable, and other times that the compiler could not
1433keep track of it.
1434
1435Block and location information for the newly-created stmt are
1436taken from @code{stmt}, if given.
1437@end deftypefn
1438
1439@deftypefn {GIMPLE function} tree gimple_debug_bind_get_var (gimple stmt)
1440Return the user variable @var{var} that is bound at @code{stmt}.
1441@end deftypefn
1442
1443@deftypefn {GIMPLE function} tree gimple_debug_bind_get_value (gimple stmt)
1444Return the value expression that is bound to a user variable at
1445@code{stmt}.
1446@end deftypefn
1447
1448@deftypefn {GIMPLE function} tree *gimple_debug_bind_get_value_ptr (gimple stmt)
1449Return a pointer to the value expression that is bound to a user
1450variable at @code{stmt}.
1451@end deftypefn
1452
1453@deftypefn {GIMPLE function} void gimple_debug_bind_set_var (gimple stmt, tree var)
1454Modify the user variable bound at @code{stmt} to @var{var}.
1455@end deftypefn
1456
1457@deftypefn {GIMPLE function} void gimple_debug_bind_set_value (gimple stmt, tree var)
1458Modify the value bound to the user variable bound at @code{stmt} to
1459@var{value}.
1460@end deftypefn
1461
1462@deftypefn {GIMPLE function} void gimple_debug_bind_reset_value (gimple stmt)
1463Modify the value bound to the user variable bound at @code{stmt} so
1464that the variable becomes unbound.
1465@end deftypefn
1466
1467@deftypefn {GIMPLE function} bool gimple_debug_bind_has_value_p (gimple stmt)
1468Return @code{TRUE} if @code{stmt} binds a user variable to a value,
1469and @code{FALSE} if it unbinds the variable.
1470@end deftypefn
1471
1472@node @code{GIMPLE_EH_FILTER}
1473@subsection @code{GIMPLE_EH_FILTER}
1474@cindex @code{GIMPLE_EH_FILTER}
1475
1476@deftypefn {GIMPLE function} gimple gimple_build_eh_filter (tree types, gimple_seq failure)
1477Build a @code{GIMPLE_EH_FILTER} statement.  @code{TYPES} are the filter's
1478types.  @code{FAILURE} is a sequence with the filter's failure action.
1479@end deftypefn
1480
1481@deftypefn {GIMPLE function} tree gimple_eh_filter_types (gimple g)
1482Return the types handled by @code{GIMPLE_EH_FILTER} statement @code{G}.
1483@end deftypefn
1484
1485@deftypefn {GIMPLE function} tree *gimple_eh_filter_types_ptr (gimple g)
1486Return a pointer to the types handled by @code{GIMPLE_EH_FILTER}
1487statement @code{G}.
1488@end deftypefn
1489
1490@deftypefn {GIMPLE function} gimple_seq gimple_eh_filter_failure (gimple g)
1491Return the sequence of statement to execute when @code{GIMPLE_EH_FILTER}
1492statement fails.
1493@end deftypefn
1494
1495@deftypefn {GIMPLE function} void gimple_eh_filter_set_types (gimple g, tree types)
1496Set @code{TYPES} to be the set of types handled by @code{GIMPLE_EH_FILTER} @code{G}.
1497@end deftypefn
1498
1499@deftypefn {GIMPLE function} void gimple_eh_filter_set_failure (gimple g, gimple_seq failure)
1500Set @code{FAILURE} to be the sequence of statements to execute on
1501failure for @code{GIMPLE_EH_FILTER} @code{G}.
1502@end deftypefn
1503
1504@deftypefn {GIMPLE function} bool gimple_eh_filter_must_not_throw (gimple g)
1505Return the @code{EH_FILTER_MUST_NOT_THROW} flag.
1506@end deftypefn
1507
1508@deftypefn {GIMPLE function} void gimple_eh_filter_set_must_not_throw (gimple g, bool mntp)
1509Set the @code{EH_FILTER_MUST_NOT_THROW} flag.
1510@end deftypefn
1511
1512
1513@node @code{GIMPLE_LABEL}
1514@subsection @code{GIMPLE_LABEL}
1515@cindex @code{GIMPLE_LABEL}
1516
1517@deftypefn {GIMPLE function} gimple gimple_build_label (tree label)
1518Build a @code{GIMPLE_LABEL} statement with corresponding to the tree
1519label, @code{LABEL}.
1520@end deftypefn
1521
1522@deftypefn {GIMPLE function} tree gimple_label_label (gimple g)
1523Return the @code{LABEL_DECL} node used by @code{GIMPLE_LABEL} statement @code{G}.
1524@end deftypefn
1525
1526@deftypefn {GIMPLE function} void gimple_label_set_label (gimple g, tree label)
1527Set @code{LABEL} to be the @code{LABEL_DECL} node used by @code{GIMPLE_LABEL}
1528statement @code{G}.
1529@end deftypefn
1530
1531
1532@deftypefn {GIMPLE function} gimple gimple_build_goto (tree dest)
1533Build a @code{GIMPLE_GOTO} statement to label @code{DEST}.
1534@end deftypefn
1535
1536@deftypefn {GIMPLE function} tree gimple_goto_dest (gimple g)
1537Return the destination of the unconditional jump @code{G}.
1538@end deftypefn
1539
1540@deftypefn {GIMPLE function} void gimple_goto_set_dest (gimple g, tree dest)
1541Set @code{DEST} to be the destination of the unconditional jump @code{G}.
1542@end deftypefn
1543
1544
1545@node @code{GIMPLE_NOP}
1546@subsection @code{GIMPLE_NOP}
1547@cindex @code{GIMPLE_NOP}
1548
1549@deftypefn {GIMPLE function} gimple gimple_build_nop (void)
1550Build a @code{GIMPLE_NOP} statement.
1551@end deftypefn
1552
1553@deftypefn {GIMPLE function} bool gimple_nop_p (gimple g)
1554Returns @code{TRUE} if statement @code{G} is a @code{GIMPLE_NOP}.
1555@end deftypefn
1556
1557@node @code{GIMPLE_OMP_ATOMIC_LOAD}
1558@subsection @code{GIMPLE_OMP_ATOMIC_LOAD}
1559@cindex @code{GIMPLE_OMP_ATOMIC_LOAD}
1560
1561@deftypefn {GIMPLE function} gimple gimple_build_omp_atomic_load (tree lhs, tree rhs)
1562Build a @code{GIMPLE_OMP_ATOMIC_LOAD} statement.  @code{LHS} is the left-hand
1563side of the assignment.  @code{RHS} is the right-hand side of the
1564assignment.
1565@end deftypefn
1566
1567@deftypefn {GIMPLE function} void gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
1568Set the @code{LHS} of an atomic load.
1569@end deftypefn
1570
1571@deftypefn {GIMPLE function} tree gimple_omp_atomic_load_lhs (gimple g)
1572Get the @code{LHS} of an atomic load.
1573@end deftypefn
1574
1575@deftypefn {GIMPLE function} void gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
1576Set the @code{RHS} of an atomic set.
1577@end deftypefn
1578
1579@deftypefn {GIMPLE function} tree gimple_omp_atomic_load_rhs (gimple g)
1580Get the @code{RHS} of an atomic set.
1581@end deftypefn
1582
1583
1584@node @code{GIMPLE_OMP_ATOMIC_STORE}
1585@subsection @code{GIMPLE_OMP_ATOMIC_STORE}
1586@cindex @code{GIMPLE_OMP_ATOMIC_STORE}
1587
1588@deftypefn {GIMPLE function} gimple gimple_build_omp_atomic_store (tree val)
1589Build a @code{GIMPLE_OMP_ATOMIC_STORE} statement. @code{VAL} is the value to be
1590stored.
1591@end deftypefn
1592
1593@deftypefn {GIMPLE function} void gimple_omp_atomic_store_set_val (gimple g, tree val)
1594Set the value being stored in an atomic store.
1595@end deftypefn
1596
1597@deftypefn {GIMPLE function} tree gimple_omp_atomic_store_val (gimple g)
1598Return the value being stored in an atomic store.
1599@end deftypefn
1600
1601@node @code{GIMPLE_OMP_CONTINUE}
1602@subsection @code{GIMPLE_OMP_CONTINUE}
1603@cindex @code{GIMPLE_OMP_CONTINUE}
1604
1605@deftypefn {GIMPLE function} gimple gimple_build_omp_continue (tree control_def, tree control_use)
1606Build a @code{GIMPLE_OMP_CONTINUE} statement.  @code{CONTROL_DEF} is the
1607definition of the control variable.  @code{CONTROL_USE} is the use of
1608the control variable.
1609@end deftypefn
1610
1611@deftypefn {GIMPLE function} tree gimple_omp_continue_control_def (gimple s)
1612Return the definition of the control variable on a
1613@code{GIMPLE_OMP_CONTINUE} in @code{S}.
1614@end deftypefn
1615
1616@deftypefn {GIMPLE function} tree gimple_omp_continue_control_def_ptr (gimple s)
1617Same as above, but return the pointer.
1618@end deftypefn
1619
1620@deftypefn {GIMPLE function} tree gimple_omp_continue_set_control_def (gimple s)
1621Set the control variable definition for a @code{GIMPLE_OMP_CONTINUE}
1622statement in @code{S}.
1623@end deftypefn
1624
1625@deftypefn {GIMPLE function} tree gimple_omp_continue_control_use (gimple s)
1626Return the use of the control variable on a @code{GIMPLE_OMP_CONTINUE}
1627in @code{S}.
1628@end deftypefn
1629
1630@deftypefn {GIMPLE function} tree gimple_omp_continue_control_use_ptr (gimple s)
1631Same as above, but return the pointer.
1632@end deftypefn
1633
1634@deftypefn {GIMPLE function} tree gimple_omp_continue_set_control_use (gimple s)
1635Set the control variable use for a @code{GIMPLE_OMP_CONTINUE} statement
1636in @code{S}.
1637@end deftypefn
1638
1639
1640@node @code{GIMPLE_OMP_CRITICAL}
1641@subsection @code{GIMPLE_OMP_CRITICAL}
1642@cindex @code{GIMPLE_OMP_CRITICAL}
1643
1644@deftypefn {GIMPLE function} gimple gimple_build_omp_critical (gimple_seq body, tree name)
1645Build a @code{GIMPLE_OMP_CRITICAL} statement. @code{BODY} is the sequence of
1646statements for which only one thread can execute.  @code{NAME} is an
1647optional identifier for this critical block.
1648@end deftypefn
1649
1650@deftypefn {GIMPLE function} tree gimple_omp_critical_name (gimple g)
1651Return the name associated with @code{OMP_CRITICAL} statement @code{G}.
1652@end deftypefn
1653
1654@deftypefn {GIMPLE function} tree *gimple_omp_critical_name_ptr (gimple g)
1655Return a pointer to the name associated with @code{OMP} critical
1656statement @code{G}.
1657@end deftypefn
1658
1659@deftypefn {GIMPLE function} void gimple_omp_critical_set_name (gimple g, tree name)
1660Set @code{NAME} to be the name associated with @code{OMP} critical statement @code{G}.
1661@end deftypefn
1662
1663@node @code{GIMPLE_OMP_FOR}
1664@subsection @code{GIMPLE_OMP_FOR}
1665@cindex @code{GIMPLE_OMP_FOR}
1666
1667@deftypefn {GIMPLE function} gimple gimple_build_omp_for (gimple_seq body, @
1668tree clauses, tree index, tree initial, tree final, tree incr, @
1669gimple_seq pre_body, enum tree_code omp_for_cond)
1670Build a @code{GIMPLE_OMP_FOR} statement. @code{BODY} is sequence of statements
1671inside the for loop.  @code{CLAUSES}, are any of the @code{OMP} loop
1672construct's clauses: private, firstprivate,  lastprivate,
1673reductions, ordered, schedule, and nowait.  @code{PRE_BODY} is the
1674sequence of statements that are loop invariant.  @code{INDEX} is the
1675index variable.  @code{INITIAL} is the initial value of @code{INDEX}.  @code{FINAL} is
1676final value of @code{INDEX}.  OMP_FOR_COND is the predicate used to
1677compare @code{INDEX} and @code{FINAL}.  @code{INCR} is the increment expression.
1678@end deftypefn
1679
1680@deftypefn {GIMPLE function} tree gimple_omp_for_clauses (gimple g)
1681Return the clauses associated with @code{OMP_FOR} @code{G}.
1682@end deftypefn
1683
1684@deftypefn {GIMPLE function} tree *gimple_omp_for_clauses_ptr (gimple g)
1685Return a pointer to the @code{OMP_FOR} @code{G}.
1686@end deftypefn
1687
1688@deftypefn {GIMPLE function} void gimple_omp_for_set_clauses (gimple g, tree clauses)
1689Set @code{CLAUSES} to be the list of clauses associated with @code{OMP_FOR} @code{G}.
1690@end deftypefn
1691
1692@deftypefn {GIMPLE function} tree gimple_omp_for_index (gimple g)
1693Return the index variable for @code{OMP_FOR} @code{G}.
1694@end deftypefn
1695
1696@deftypefn {GIMPLE function} tree *gimple_omp_for_index_ptr (gimple g)
1697Return a pointer to the index variable for @code{OMP_FOR} @code{G}.
1698@end deftypefn
1699
1700@deftypefn {GIMPLE function} void gimple_omp_for_set_index (gimple g, tree index)
1701Set @code{INDEX} to be the index variable for @code{OMP_FOR} @code{G}.
1702@end deftypefn
1703
1704@deftypefn {GIMPLE function} tree gimple_omp_for_initial (gimple g)
1705Return the initial value for @code{OMP_FOR} @code{G}.
1706@end deftypefn
1707
1708@deftypefn {GIMPLE function} tree *gimple_omp_for_initial_ptr (gimple g)
1709Return a pointer to the initial value for @code{OMP_FOR} @code{G}.
1710@end deftypefn
1711
1712@deftypefn {GIMPLE function} void gimple_omp_for_set_initial (gimple g, tree initial)
1713Set @code{INITIAL} to be the initial value for @code{OMP_FOR} @code{G}.
1714@end deftypefn
1715
1716@deftypefn {GIMPLE function} tree gimple_omp_for_final (gimple g)
1717Return the final value for @code{OMP_FOR} @code{G}.
1718@end deftypefn
1719
1720@deftypefn {GIMPLE function} tree *gimple_omp_for_final_ptr (gimple g)
1721turn a pointer to the final value for @code{OMP_FOR} @code{G}.
1722@end deftypefn
1723
1724@deftypefn {GIMPLE function} void gimple_omp_for_set_final (gimple g, tree final)
1725Set @code{FINAL} to be the final value for @code{OMP_FOR} @code{G}.
1726@end deftypefn
1727
1728@deftypefn {GIMPLE function} tree gimple_omp_for_incr (gimple g)
1729Return the increment value for @code{OMP_FOR} @code{G}.
1730@end deftypefn
1731
1732@deftypefn {GIMPLE function} tree *gimple_omp_for_incr_ptr (gimple g)
1733Return a pointer to the increment value for @code{OMP_FOR} @code{G}.
1734@end deftypefn
1735
1736@deftypefn {GIMPLE function} void gimple_omp_for_set_incr (gimple g, tree incr)
1737Set @code{INCR} to be the increment value for @code{OMP_FOR} @code{G}.
1738@end deftypefn
1739
1740@deftypefn {GIMPLE function} gimple_seq gimple_omp_for_pre_body (gimple g)
1741Return the sequence of statements to execute before the @code{OMP_FOR}
1742statement @code{G} starts.
1743@end deftypefn
1744
1745@deftypefn {GIMPLE function} void gimple_omp_for_set_pre_body (gimple g, gimple_seq pre_body)
1746Set @code{PRE_BODY} to be the sequence of statements to execute before
1747the @code{OMP_FOR} statement @code{G} starts.
1748@end deftypefn
1749
1750@deftypefn {GIMPLE function} void gimple_omp_for_set_cond (gimple g, enum tree_code cond)
1751Set @code{COND} to be the condition code for @code{OMP_FOR} @code{G}.
1752@end deftypefn
1753
1754@deftypefn {GIMPLE function} enum tree_code gimple_omp_for_cond (gimple g)
1755Return the condition code associated with @code{OMP_FOR} @code{G}.
1756@end deftypefn
1757
1758
1759@node @code{GIMPLE_OMP_MASTER}
1760@subsection @code{GIMPLE_OMP_MASTER}
1761@cindex @code{GIMPLE_OMP_MASTER}
1762
1763@deftypefn {GIMPLE function} gimple gimple_build_omp_master (gimple_seq body)
1764Build a @code{GIMPLE_OMP_MASTER} statement. @code{BODY} is the sequence of
1765statements to be executed by just the master.
1766@end deftypefn
1767
1768
1769@node @code{GIMPLE_OMP_ORDERED}
1770@subsection @code{GIMPLE_OMP_ORDERED}
1771@cindex @code{GIMPLE_OMP_ORDERED}
1772
1773@deftypefn {GIMPLE function} gimple gimple_build_omp_ordered (gimple_seq body)
1774Build a @code{GIMPLE_OMP_ORDERED} statement.
1775@end deftypefn
1776
1777@code{BODY} is the sequence of statements inside a loop that will
1778executed in sequence.
1779
1780
1781@node @code{GIMPLE_OMP_PARALLEL}
1782@subsection @code{GIMPLE_OMP_PARALLEL}
1783@cindex @code{GIMPLE_OMP_PARALLEL}
1784
1785@deftypefn {GIMPLE function} gimple gimple_build_omp_parallel (gimple_seq body, tree clauses, tree child_fn, tree data_arg)
1786Build a @code{GIMPLE_OMP_PARALLEL} statement.
1787@end deftypefn
1788
1789@code{BODY} is sequence of statements which are executed in parallel.
1790@code{CLAUSES}, are the @code{OMP} parallel construct's clauses.  @code{CHILD_FN} is
1791the function created for the parallel threads to execute.
1792@code{DATA_ARG} are the shared data argument(s).
1793
1794@deftypefn {GIMPLE function} bool gimple_omp_parallel_combined_p (gimple g)
1795Return true if @code{OMP} parallel statement @code{G} has the
1796@code{GF_OMP_PARALLEL_COMBINED} flag set.
1797@end deftypefn
1798
1799@deftypefn {GIMPLE function} void gimple_omp_parallel_set_combined_p (gimple g)
1800Set the @code{GF_OMP_PARALLEL_COMBINED} field in @code{OMP} parallel statement
1801@code{G}.
1802@end deftypefn
1803
1804@deftypefn {GIMPLE function} gimple_seq gimple_omp_body (gimple g)
1805Return the body for the @code{OMP} statement @code{G}.
1806@end deftypefn
1807
1808@deftypefn {GIMPLE function} void gimple_omp_set_body (gimple g, gimple_seq body)
1809Set @code{BODY} to be the body for the @code{OMP} statement @code{G}.
1810@end deftypefn
1811
1812@deftypefn {GIMPLE function} tree gimple_omp_parallel_clauses (gimple g)
1813Return the clauses associated with @code{OMP_PARALLEL} @code{G}.
1814@end deftypefn
1815
1816@deftypefn {GIMPLE function} tree *gimple_omp_parallel_clauses_ptr (gimple g)
1817Return a pointer to the clauses associated with @code{OMP_PARALLEL} @code{G}.
1818@end deftypefn
1819
1820@deftypefn {GIMPLE function} void gimple_omp_parallel_set_clauses (gimple g, tree clauses)
1821Set @code{CLAUSES} to be the list of clauses associated with
1822@code{OMP_PARALLEL} @code{G}.
1823@end deftypefn
1824
1825@deftypefn {GIMPLE function} tree gimple_omp_parallel_child_fn (gimple g)
1826Return the child function used to hold the body of @code{OMP_PARALLEL}
1827@code{G}.
1828@end deftypefn
1829
1830@deftypefn {GIMPLE function} tree *gimple_omp_parallel_child_fn_ptr (gimple g)
1831Return a pointer to the child function used to hold the body of
1832@code{OMP_PARALLEL} @code{G}.
1833@end deftypefn
1834
1835@deftypefn {GIMPLE function} void gimple_omp_parallel_set_child_fn (gimple g, tree child_fn)
1836Set @code{CHILD_FN} to be the child function for @code{OMP_PARALLEL} @code{G}.
1837@end deftypefn
1838
1839@deftypefn {GIMPLE function} tree gimple_omp_parallel_data_arg (gimple g)
1840Return the artificial argument used to send variables and values
1841from the parent to the children threads in @code{OMP_PARALLEL} @code{G}.
1842@end deftypefn
1843
1844@deftypefn {GIMPLE function} tree *gimple_omp_parallel_data_arg_ptr (gimple g)
1845Return a pointer to the data argument for @code{OMP_PARALLEL} @code{G}.
1846@end deftypefn
1847
1848@deftypefn {GIMPLE function} void gimple_omp_parallel_set_data_arg (gimple g, tree data_arg)
1849Set @code{DATA_ARG} to be the data argument for @code{OMP_PARALLEL} @code{G}.
1850@end deftypefn
1851
1852@deftypefn {GIMPLE function} bool is_gimple_omp (gimple stmt)
1853Returns true when the gimple statement @code{STMT} is any of the OpenMP
1854types.
1855@end deftypefn
1856
1857
1858@node @code{GIMPLE_OMP_RETURN}
1859@subsection @code{GIMPLE_OMP_RETURN}
1860@cindex @code{GIMPLE_OMP_RETURN}
1861
1862@deftypefn {GIMPLE function} gimple gimple_build_omp_return (bool wait_p)
1863Build a @code{GIMPLE_OMP_RETURN} statement. @code{WAIT_P} is true if this is a
1864non-waiting return.
1865@end deftypefn
1866
1867@deftypefn {GIMPLE function} void gimple_omp_return_set_nowait (gimple s)
1868Set the nowait flag on @code{GIMPLE_OMP_RETURN} statement @code{S}.
1869@end deftypefn
1870
1871
1872@deftypefn {GIMPLE function} bool gimple_omp_return_nowait_p (gimple g)
1873Return true if @code{OMP} return statement @code{G} has the
1874@code{GF_OMP_RETURN_NOWAIT} flag set.
1875@end deftypefn
1876
1877@node @code{GIMPLE_OMP_SECTION}
1878@subsection @code{GIMPLE_OMP_SECTION}
1879@cindex @code{GIMPLE_OMP_SECTION}
1880
1881@deftypefn {GIMPLE function} gimple gimple_build_omp_section (gimple_seq body)
1882Build a @code{GIMPLE_OMP_SECTION} statement for a sections statement.
1883@end deftypefn
1884
1885@code{BODY} is the sequence of statements in the section.
1886
1887@deftypefn {GIMPLE function} bool gimple_omp_section_last_p (gimple g)
1888Return true if @code{OMP} section statement @code{G} has the
1889@code{GF_OMP_SECTION_LAST} flag set.
1890@end deftypefn
1891
1892@deftypefn {GIMPLE function} void gimple_omp_section_set_last (gimple g)
1893Set the @code{GF_OMP_SECTION_LAST} flag on @code{G}.
1894@end deftypefn
1895
1896@node @code{GIMPLE_OMP_SECTIONS}
1897@subsection @code{GIMPLE_OMP_SECTIONS}
1898@cindex @code{GIMPLE_OMP_SECTIONS}
1899
1900@deftypefn {GIMPLE function} gimple gimple_build_omp_sections (gimple_seq body, tree clauses)
1901Build a @code{GIMPLE_OMP_SECTIONS} statement. @code{BODY} is a sequence of
1902section statements.  @code{CLAUSES} are any of the @code{OMP} sections
1903construct's clauses: private, firstprivate, lastprivate,
1904reduction, and nowait.
1905@end deftypefn
1906
1907
1908@deftypefn {GIMPLE function} gimple gimple_build_omp_sections_switch (void)
1909Build a @code{GIMPLE_OMP_SECTIONS_SWITCH} statement.
1910@end deftypefn
1911
1912@deftypefn {GIMPLE function} tree gimple_omp_sections_control (gimple g)
1913Return the control variable associated with the
1914@code{GIMPLE_OMP_SECTIONS} in @code{G}.
1915@end deftypefn
1916
1917@deftypefn {GIMPLE function} tree *gimple_omp_sections_control_ptr (gimple g)
1918Return a pointer to the clauses associated with the
1919@code{GIMPLE_OMP_SECTIONS} in @code{G}.
1920@end deftypefn
1921
1922@deftypefn {GIMPLE function} void gimple_omp_sections_set_control (gimple g, tree control)
1923Set @code{CONTROL} to be the set of clauses associated with the
1924@code{GIMPLE_OMP_SECTIONS} in @code{G}.
1925@end deftypefn
1926
1927@deftypefn {GIMPLE function} tree gimple_omp_sections_clauses (gimple g)
1928Return the clauses associated with @code{OMP_SECTIONS} @code{G}.
1929@end deftypefn
1930
1931@deftypefn {GIMPLE function} tree *gimple_omp_sections_clauses_ptr (gimple g)
1932Return a pointer to the clauses associated with @code{OMP_SECTIONS} @code{G}.
1933@end deftypefn
1934
1935@deftypefn {GIMPLE function} void gimple_omp_sections_set_clauses (gimple g, tree clauses)
1936Set @code{CLAUSES} to be the set of clauses associated with @code{OMP_SECTIONS}
1937@code{G}.
1938@end deftypefn
1939
1940
1941@node @code{GIMPLE_OMP_SINGLE}
1942@subsection @code{GIMPLE_OMP_SINGLE}
1943@cindex @code{GIMPLE_OMP_SINGLE}
1944
1945@deftypefn {GIMPLE function} gimple gimple_build_omp_single (gimple_seq body, tree clauses)
1946Build a @code{GIMPLE_OMP_SINGLE} statement. @code{BODY} is the sequence of
1947statements that will be executed once.  @code{CLAUSES} are any of the
1948@code{OMP} single construct's clauses: private, firstprivate,
1949copyprivate, nowait.
1950@end deftypefn
1951
1952@deftypefn {GIMPLE function} tree gimple_omp_single_clauses (gimple g)
1953Return the clauses associated with @code{OMP_SINGLE} @code{G}.
1954@end deftypefn
1955
1956@deftypefn {GIMPLE function} tree *gimple_omp_single_clauses_ptr (gimple g)
1957Return a pointer to the clauses associated with @code{OMP_SINGLE} @code{G}.
1958@end deftypefn
1959
1960@deftypefn {GIMPLE function} void gimple_omp_single_set_clauses (gimple g, tree clauses)
1961Set @code{CLAUSES} to be the clauses associated with @code{OMP_SINGLE} @code{G}.
1962@end deftypefn
1963
1964
1965@node @code{GIMPLE_PHI}
1966@subsection @code{GIMPLE_PHI}
1967@cindex @code{GIMPLE_PHI}
1968
1969@deftypefn {GIMPLE function} gimple make_phi_node (tree var, int len)
1970Build a @code{PHI} node with len argument slots for variable var.
1971@end deftypefn
1972
1973@deftypefn {GIMPLE function} unsigned gimple_phi_capacity (gimple g)
1974Return the maximum number of arguments supported by @code{GIMPLE_PHI} @code{G}.
1975@end deftypefn
1976
1977@deftypefn {GIMPLE function} unsigned gimple_phi_num_args (gimple g)
1978Return the number of arguments in @code{GIMPLE_PHI} @code{G}. This must always
1979be exactly the number of incoming edges for the basic block
1980holding @code{G}.
1981@end deftypefn
1982
1983@deftypefn {GIMPLE function} tree gimple_phi_result (gimple g)
1984Return the @code{SSA} name created by @code{GIMPLE_PHI} @code{G}.
1985@end deftypefn
1986
1987@deftypefn {GIMPLE function} tree *gimple_phi_result_ptr (gimple g)
1988Return a pointer to the @code{SSA} name created by @code{GIMPLE_PHI} @code{G}.
1989@end deftypefn
1990
1991@deftypefn {GIMPLE function} void gimple_phi_set_result (gimple g, tree result)
1992Set @code{RESULT} to be the @code{SSA} name created by @code{GIMPLE_PHI} @code{G}.
1993@end deftypefn
1994
1995@deftypefn {GIMPLE function} struct phi_arg_d *gimple_phi_arg (gimple g, index)
1996Return the @code{PHI} argument corresponding to incoming edge @code{INDEX} for
1997@code{GIMPLE_PHI} @code{G}.
1998@end deftypefn
1999
2000@deftypefn {GIMPLE function} void gimple_phi_set_arg (gimple g, index, struct phi_arg_d * phiarg)
2001Set @code{PHIARG} to be the argument corresponding to incoming edge
2002@code{INDEX} for @code{GIMPLE_PHI} @code{G}.
2003@end deftypefn
2004
2005@node @code{GIMPLE_RESX}
2006@subsection @code{GIMPLE_RESX}
2007@cindex @code{GIMPLE_RESX}
2008
2009@deftypefn {GIMPLE function} gimple gimple_build_resx (int region)
2010Build a @code{GIMPLE_RESX} statement which is a statement.  This
2011statement is a placeholder for _Unwind_Resume before we know if a
2012function call or a branch is needed.  @code{REGION} is the exception
2013region from which control is flowing.
2014@end deftypefn
2015
2016@deftypefn {GIMPLE function} int gimple_resx_region (gimple g)
2017Return the region number for @code{GIMPLE_RESX} @code{G}.
2018@end deftypefn
2019
2020@deftypefn {GIMPLE function} void gimple_resx_set_region (gimple g, int region)
2021Set @code{REGION} to be the region number for @code{GIMPLE_RESX} @code{G}.
2022@end deftypefn
2023
2024@node @code{GIMPLE_RETURN}
2025@subsection @code{GIMPLE_RETURN}
2026@cindex @code{GIMPLE_RETURN}
2027
2028@deftypefn {GIMPLE function} gimple gimple_build_return (tree retval)
2029Build a @code{GIMPLE_RETURN} statement whose return value is retval.
2030@end deftypefn
2031
2032@deftypefn {GIMPLE function} tree gimple_return_retval (gimple g)
2033Return the return value for @code{GIMPLE_RETURN} @code{G}.
2034@end deftypefn
2035
2036@deftypefn {GIMPLE function} void gimple_return_set_retval (gimple g, tree retval)
2037Set @code{RETVAL} to be the return value for @code{GIMPLE_RETURN} @code{G}.
2038@end deftypefn
2039
2040@node @code{GIMPLE_SWITCH}
2041@subsection @code{GIMPLE_SWITCH}
2042@cindex @code{GIMPLE_SWITCH}
2043
2044@deftypefn {GIMPLE function} gimple gimple_build_switch ( nlabels, tree index, tree default_label, ...)
2045Build a @code{GIMPLE_SWITCH} statement.  @code{NLABELS} are the number of
2046labels excluding the default label.  The default label is passed
2047in @code{DEFAULT_LABEL}.  The rest of the arguments are trees
2048representing the labels.  Each label is a tree of code
2049@code{CASE_LABEL_EXPR}.
2050@end deftypefn
2051
2052@deftypefn {GIMPLE function} gimple gimple_build_switch_vec (tree index, tree default_label, @code{VEC}(tree,heap) *args)
2053This function is an alternate way of building @code{GIMPLE_SWITCH}
2054statements.  @code{INDEX} and @code{DEFAULT_LABEL} are as in
2055gimple_build_switch.  @code{ARGS} is a vector of @code{CASE_LABEL_EXPR} trees
2056that contain the labels.
2057@end deftypefn
2058
2059@deftypefn {GIMPLE function} unsigned gimple_switch_num_labels (gimple g)
2060Return the number of labels associated with the switch statement
2061@code{G}.
2062@end deftypefn
2063
2064@deftypefn {GIMPLE function} void gimple_switch_set_num_labels (gimple g, unsigned nlabels)
2065Set @code{NLABELS} to be the number of labels for the switch statement
2066@code{G}.
2067@end deftypefn
2068
2069@deftypefn {GIMPLE function} tree gimple_switch_index (gimple g)
2070Return the index variable used by the switch statement @code{G}.
2071@end deftypefn
2072
2073@deftypefn {GIMPLE function} void gimple_switch_set_index (gimple g, tree index)
2074Set @code{INDEX} to be the index variable for switch statement @code{G}.
2075@end deftypefn
2076
2077@deftypefn {GIMPLE function} tree gimple_switch_label (gimple g, unsigned index)
2078Return the label numbered @code{INDEX}. The default label is 0, followed
2079by any labels in a switch statement.
2080@end deftypefn
2081
2082@deftypefn {GIMPLE function} void gimple_switch_set_label (gimple g, unsigned index, tree label)
2083Set the label number @code{INDEX} to @code{LABEL}. 0 is always the default
2084label.
2085@end deftypefn
2086
2087@deftypefn {GIMPLE function} tree gimple_switch_default_label (gimple g)
2088Return the default label for a switch statement.
2089@end deftypefn
2090
2091@deftypefn {GIMPLE function} void gimple_switch_set_default_label (gimple g, tree label)
2092Set the default label for a switch statement.
2093@end deftypefn
2094
2095
2096@node @code{GIMPLE_TRY}
2097@subsection @code{GIMPLE_TRY}
2098@cindex @code{GIMPLE_TRY}
2099
2100@deftypefn {GIMPLE function} gimple gimple_build_try (gimple_seq eval, gimple_seq cleanup, unsigned int kind)
2101Build a @code{GIMPLE_TRY} statement.  @code{EVAL} is a sequence with the
2102expression to evaluate.  @code{CLEANUP} is a sequence of statements to
2103run at clean-up time.  @code{KIND} is the enumeration value
2104@code{GIMPLE_TRY_CATCH} if this statement denotes a try/catch construct
2105or @code{GIMPLE_TRY_FINALLY} if this statement denotes a try/finally
2106construct.
2107@end deftypefn
2108
2109@deftypefn {GIMPLE function} enum gimple_try_flags gimple_try_kind (gimple g)
2110Return the kind of try block represented by @code{GIMPLE_TRY} @code{G}. This is
2111either @code{GIMPLE_TRY_CATCH} or @code{GIMPLE_TRY_FINALLY}.
2112@end deftypefn
2113
2114@deftypefn {GIMPLE function} bool gimple_try_catch_is_cleanup (gimple g)
2115Return the @code{GIMPLE_TRY_CATCH_IS_CLEANUP} flag.
2116@end deftypefn
2117
2118@deftypefn {GIMPLE function} gimple_seq gimple_try_eval (gimple g)
2119Return the sequence of statements used as the body for @code{GIMPLE_TRY}
2120@code{G}.
2121@end deftypefn
2122
2123@deftypefn {GIMPLE function} gimple_seq gimple_try_cleanup (gimple g)
2124Return the sequence of statements used as the cleanup body for
2125@code{GIMPLE_TRY} @code{G}.
2126@end deftypefn
2127
2128@deftypefn {GIMPLE function} void gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
2129Set the @code{GIMPLE_TRY_CATCH_IS_CLEANUP} flag.
2130@end deftypefn
2131
2132@deftypefn {GIMPLE function} void gimple_try_set_eval (gimple g, gimple_seq eval)
2133Set @code{EVAL} to be the sequence of statements to use as the body for
2134@code{GIMPLE_TRY} @code{G}.
2135@end deftypefn
2136
2137@deftypefn {GIMPLE function} void gimple_try_set_cleanup (gimple g, gimple_seq cleanup)
2138Set @code{CLEANUP} to be the sequence of statements to use as the
2139cleanup body for @code{GIMPLE_TRY} @code{G}.
2140@end deftypefn
2141
2142@node @code{GIMPLE_WITH_CLEANUP_EXPR}
2143@subsection @code{GIMPLE_WITH_CLEANUP_EXPR}
2144@cindex @code{GIMPLE_WITH_CLEANUP_EXPR}
2145
2146@deftypefn {GIMPLE function} gimple gimple_build_wce (gimple_seq cleanup)
2147Build a @code{GIMPLE_WITH_CLEANUP_EXPR} statement.  @code{CLEANUP} is the
2148clean-up expression.
2149@end deftypefn
2150
2151@deftypefn {GIMPLE function} gimple_seq gimple_wce_cleanup (gimple g)
2152Return the cleanup sequence for cleanup statement @code{G}.
2153@end deftypefn
2154
2155@deftypefn {GIMPLE function} void gimple_wce_set_cleanup (gimple g, gimple_seq cleanup)
2156Set @code{CLEANUP} to be the cleanup sequence for @code{G}.
2157@end deftypefn
2158
2159@deftypefn {GIMPLE function} bool gimple_wce_cleanup_eh_only (gimple g)
2160Return the @code{CLEANUP_EH_ONLY} flag for a @code{WCE} tuple.
2161@end deftypefn
2162
2163@deftypefn {GIMPLE function} void gimple_wce_set_cleanup_eh_only (gimple g, bool eh_only_p)
2164Set the @code{CLEANUP_EH_ONLY} flag for a @code{WCE} tuple.
2165@end deftypefn
2166
2167
2168@node GIMPLE sequences
2169@section GIMPLE sequences
2170@cindex GIMPLE sequences
2171
2172GIMPLE sequences are the tuple equivalent of @code{STATEMENT_LIST}'s
2173used in @code{GENERIC}.  They are used to chain statements together, and
2174when used in conjunction with sequence iterators, provide a
2175framework for iterating through statements.
2176
2177GIMPLE sequences are of type struct @code{gimple_sequence}, but are more
2178commonly passed by reference to functions dealing with sequences.
2179The type for a sequence pointer is @code{gimple_seq} which is the same
2180as struct @code{gimple_sequence} *.  When declaring a local sequence,
2181you can define a local variable of type struct @code{gimple_sequence}.
2182When declaring a sequence allocated on the garbage collected
2183heap, use the function @code{gimple_seq_alloc} documented below.
2184
2185There are convenience functions for iterating through sequences
2186in the section entitled Sequence Iterators.
2187
2188Below is a list of functions to manipulate and query sequences.
2189
2190@deftypefn {GIMPLE function} void gimple_seq_add_stmt (gimple_seq *seq, gimple g)
2191Link a gimple statement to the end of the sequence *@code{SEQ} if @code{G} is
2192not @code{NULL}.  If *@code{SEQ} is @code{NULL}, allocate a sequence before linking.
2193@end deftypefn
2194
2195@deftypefn {GIMPLE function} void gimple_seq_add_seq (gimple_seq *dest, gimple_seq src)
2196Append sequence @code{SRC} to the end of sequence *@code{DEST} if @code{SRC} is not
2197@code{NULL}.  If *@code{DEST} is @code{NULL}, allocate a new sequence before
2198appending.
2199@end deftypefn
2200
2201@deftypefn {GIMPLE function} gimple_seq gimple_seq_deep_copy (gimple_seq src)
2202Perform a deep copy of sequence @code{SRC} and return the result.
2203@end deftypefn
2204
2205@deftypefn {GIMPLE function} gimple_seq gimple_seq_reverse (gimple_seq seq)
2206Reverse the order of the statements in the sequence @code{SEQ}.  Return
2207@code{SEQ}.
2208@end deftypefn
2209
2210@deftypefn {GIMPLE function} gimple gimple_seq_first (gimple_seq s)
2211Return the first statement in sequence @code{S}.
2212@end deftypefn
2213
2214@deftypefn {GIMPLE function} gimple gimple_seq_last (gimple_seq s)
2215Return the last statement in sequence @code{S}.
2216@end deftypefn
2217
2218@deftypefn {GIMPLE function} void gimple_seq_set_last (gimple_seq s, gimple last)
2219Set the last statement in sequence @code{S} to the statement in @code{LAST}.
2220@end deftypefn
2221
2222@deftypefn {GIMPLE function} void gimple_seq_set_first (gimple_seq s, gimple first)
2223Set the first statement in sequence @code{S} to the statement in @code{FIRST}.
2224@end deftypefn
2225
2226@deftypefn {GIMPLE function} void gimple_seq_init (gimple_seq s)
2227Initialize sequence @code{S} to an empty sequence.
2228@end deftypefn
2229
2230@deftypefn {GIMPLE function} gimple_seq gimple_seq_alloc (void)
2231Allocate a new sequence in the garbage collected store and return
2232it.
2233@end deftypefn
2234
2235@deftypefn {GIMPLE function} void gimple_seq_copy (gimple_seq dest, gimple_seq src)
2236Copy the sequence @code{SRC} into the sequence @code{DEST}.
2237@end deftypefn
2238
2239@deftypefn {GIMPLE function} bool gimple_seq_empty_p (gimple_seq s)
2240Return true if the sequence @code{S} is empty.
2241@end deftypefn
2242
2243@deftypefn {GIMPLE function} gimple_seq bb_seq (basic_block bb)
2244Returns the sequence of statements in @code{BB}.
2245@end deftypefn
2246
2247@deftypefn {GIMPLE function} void set_bb_seq (basic_block bb, gimple_seq seq)
2248Sets the sequence of statements in @code{BB} to @code{SEQ}.
2249@end deftypefn
2250
2251@deftypefn {GIMPLE function} bool gimple_seq_singleton_p (gimple_seq seq)
2252Determine whether @code{SEQ} contains exactly one statement.
2253@end deftypefn
2254
2255@node Sequence iterators
2256@section Sequence iterators
2257@cindex Sequence iterators
2258
2259Sequence iterators are convenience constructs for iterating
2260through statements in a sequence.  Given a sequence @code{SEQ}, here is
2261a typical use of gimple sequence iterators:
2262
2263@smallexample
2264gimple_stmt_iterator gsi;
2265
2266for (gsi = gsi_start (seq); !gsi_end_p (gsi); gsi_next (&gsi))
2267  @{
2268    gimple g = gsi_stmt (gsi);
2269    /* Do something with gimple statement @code{G}.  */
2270  @}
2271@end smallexample
2272
2273Backward iterations are possible:
2274
2275@smallexample
2276        for (gsi = gsi_last (seq); !gsi_end_p (gsi); gsi_prev (&gsi))
2277@end smallexample
2278
2279Forward and backward iterations on basic blocks are possible with
2280@code{gsi_start_bb} and @code{gsi_last_bb}.
2281
2282In the documentation below we sometimes refer to enum
2283@code{gsi_iterator_update}.  The valid options for this enumeration are:
2284
2285@itemize @bullet
2286@item @code{GSI_NEW_STMT}
2287Only valid when a single statement is added.  Move the iterator to it.
2288
2289@item @code{GSI_SAME_STMT}
2290Leave the iterator at the same statement.
2291
2292@item @code{GSI_CONTINUE_LINKING}
2293Move iterator to whatever position is suitable for linking other
2294statements in the same direction.
2295@end itemize
2296
2297Below is a list of the functions used to manipulate and use
2298statement iterators.
2299
2300@deftypefn {GIMPLE function} gimple_stmt_iterator gsi_start (gimple_seq seq)
2301Return a new iterator pointing to the sequence @code{SEQ}'s first
2302statement.  If @code{SEQ} is empty, the iterator's basic block is @code{NULL}.
2303Use @code{gsi_start_bb} instead when the iterator needs to always have
2304the correct basic block set.
2305@end deftypefn
2306
2307@deftypefn {GIMPLE function} gimple_stmt_iterator gsi_start_bb (basic_block bb)
2308Return a new iterator pointing to the first statement in basic
2309block @code{BB}.
2310@end deftypefn
2311
2312@deftypefn {GIMPLE function} gimple_stmt_iterator gsi_last (gimple_seq seq)
2313Return a new iterator initially pointing to the last statement of
2314sequence @code{SEQ}.  If @code{SEQ} is empty, the iterator's basic block is
2315@code{NULL}.  Use @code{gsi_last_bb} instead when the iterator needs to always
2316have the correct basic block set.
2317@end deftypefn
2318
2319@deftypefn {GIMPLE function} gimple_stmt_iterator gsi_last_bb (basic_block bb)
2320Return a new iterator pointing to the last statement in basic
2321block @code{BB}.
2322@end deftypefn
2323
2324@deftypefn {GIMPLE function} bool gsi_end_p (gimple_stmt_iterator i)
2325Return @code{TRUE} if at the end of @code{I}.
2326@end deftypefn
2327
2328@deftypefn {GIMPLE function} bool gsi_one_before_end_p (gimple_stmt_iterator i)
2329Return @code{TRUE} if we're one statement before the end of @code{I}.
2330@end deftypefn
2331
2332@deftypefn {GIMPLE function} void gsi_next (gimple_stmt_iterator *i)
2333Advance the iterator to the next gimple statement.
2334@end deftypefn
2335
2336@deftypefn {GIMPLE function} void gsi_prev (gimple_stmt_iterator *i)
2337Advance the iterator to the previous gimple statement.
2338@end deftypefn
2339
2340@deftypefn {GIMPLE function} gimple gsi_stmt (gimple_stmt_iterator i)
2341Return the current stmt.
2342@end deftypefn
2343
2344@deftypefn {GIMPLE function} gimple_stmt_iterator gsi_after_labels (basic_block bb)
2345Return a block statement iterator that points to the first
2346non-label statement in block @code{BB}.
2347@end deftypefn
2348
2349@deftypefn {GIMPLE function} gimple *gsi_stmt_ptr (gimple_stmt_iterator *i)
2350Return a pointer to the current stmt.
2351@end deftypefn
2352
2353@deftypefn {GIMPLE function} basic_block gsi_bb (gimple_stmt_iterator i)
2354Return the basic block associated with this iterator.
2355@end deftypefn
2356
2357@deftypefn {GIMPLE function} gimple_seq gsi_seq (gimple_stmt_iterator i)
2358Return the sequence associated with this iterator.
2359@end deftypefn
2360
2361@deftypefn {GIMPLE function} void gsi_remove (gimple_stmt_iterator *i, bool remove_eh_info)
2362Remove the current stmt from the sequence.  The iterator is
2363updated to point to the next statement.  When @code{REMOVE_EH_INFO} is
2364true we remove the statement pointed to by iterator @code{I} from the @code{EH}
2365tables.  Otherwise we do not modify the @code{EH} tables.  Generally,
2366@code{REMOVE_EH_INFO} should be true when the statement is going to be
2367removed from the @code{IL} and not reinserted elsewhere.
2368@end deftypefn
2369
2370@deftypefn {GIMPLE function} void gsi_link_seq_before (gimple_stmt_iterator *i, gimple_seq seq, enum gsi_iterator_update mode)
2371Links the sequence of statements @code{SEQ} before the statement pointed
2372by iterator @code{I}.  @code{MODE} indicates what to do with the iterator
2373after insertion (see @code{enum gsi_iterator_update} above).
2374@end deftypefn
2375
2376@deftypefn {GIMPLE function} void gsi_link_before (gimple_stmt_iterator *i, gimple g, enum gsi_iterator_update mode)
2377Links statement @code{G} before the statement pointed-to by iterator @code{I}.
2378Updates iterator @code{I} according to @code{MODE}.
2379@end deftypefn
2380
2381@deftypefn {GIMPLE function} void gsi_link_seq_after (gimple_stmt_iterator *i, gimple_seq seq, enum gsi_iterator_update mode)
2382Links sequence @code{SEQ} after the statement pointed-to by iterator @code{I}.
2383@code{MODE} is as in @code{gsi_insert_after}.
2384@end deftypefn
2385
2386@deftypefn {GIMPLE function} void gsi_link_after (gimple_stmt_iterator *i, gimple g, enum gsi_iterator_update mode)
2387Links statement @code{G} after the statement pointed-to by iterator @code{I}.
2388@code{MODE} is as in @code{gsi_insert_after}.
2389@end deftypefn
2390
2391@deftypefn {GIMPLE function} gimple_seq gsi_split_seq_after (gimple_stmt_iterator i)
2392Move all statements in the sequence after @code{I} to a new sequence.
2393Return this new sequence.
2394@end deftypefn
2395
2396@deftypefn {GIMPLE function} gimple_seq gsi_split_seq_before (gimple_stmt_iterator *i)
2397Move all statements in the sequence before @code{I} to a new sequence.
2398Return this new sequence.
2399@end deftypefn
2400
2401@deftypefn {GIMPLE function} void gsi_replace (gimple_stmt_iterator *i, gimple stmt, bool update_eh_info)
2402Replace the statement pointed-to by @code{I} to @code{STMT}.  If @code{UPDATE_EH_INFO}
2403is true, the exception handling information of the original
2404statement is moved to the new statement.
2405@end deftypefn
2406
2407@deftypefn {GIMPLE function} void gsi_insert_before (gimple_stmt_iterator *i, gimple stmt, enum gsi_iterator_update mode)
2408Insert statement @code{STMT} before the statement pointed-to by iterator
2409@code{I}, update @code{STMT}'s basic block and scan it for new operands.  @code{MODE}
2410specifies how to update iterator @code{I} after insertion (see enum
2411@code{gsi_iterator_update}).
2412@end deftypefn
2413
2414@deftypefn {GIMPLE function} void gsi_insert_seq_before (gimple_stmt_iterator *i, gimple_seq seq, enum gsi_iterator_update mode)
2415Like @code{gsi_insert_before}, but for all the statements in @code{SEQ}.
2416@end deftypefn
2417
2418@deftypefn {GIMPLE function} void gsi_insert_after (gimple_stmt_iterator *i, gimple stmt, enum gsi_iterator_update mode)
2419Insert statement @code{STMT} after the statement pointed-to by iterator
2420@code{I}, update @code{STMT}'s basic block and scan it for new operands.  @code{MODE}
2421specifies how to update iterator @code{I} after insertion (see enum
2422@code{gsi_iterator_update}).
2423@end deftypefn
2424
2425@deftypefn {GIMPLE function} void gsi_insert_seq_after (gimple_stmt_iterator *i, gimple_seq seq, enum gsi_iterator_update mode)
2426Like @code{gsi_insert_after}, but for all the statements in @code{SEQ}.
2427@end deftypefn
2428
2429@deftypefn {GIMPLE function} gimple_stmt_iterator gsi_for_stmt (gimple stmt)
2430Finds iterator for @code{STMT}.
2431@end deftypefn
2432
2433@deftypefn {GIMPLE function} void gsi_move_after (gimple_stmt_iterator *from, gimple_stmt_iterator *to)
2434Move the statement at @code{FROM} so it comes right after the statement
2435at @code{TO}.
2436@end deftypefn
2437
2438@deftypefn {GIMPLE function} void gsi_move_before (gimple_stmt_iterator *from, gimple_stmt_iterator *to)
2439Move the statement at @code{FROM} so it comes right before the statement
2440at @code{TO}.
2441@end deftypefn
2442
2443@deftypefn {GIMPLE function} void gsi_move_to_bb_end (gimple_stmt_iterator *from, basic_block bb)
2444Move the statement at @code{FROM} to the end of basic block @code{BB}.
2445@end deftypefn
2446
2447@deftypefn {GIMPLE function} void gsi_insert_on_edge (edge e, gimple stmt)
2448Add @code{STMT} to the pending list of edge @code{E}.  No actual insertion is
2449made until a call to @code{gsi_commit_edge_inserts}() is made.
2450@end deftypefn
2451
2452@deftypefn {GIMPLE function} void gsi_insert_seq_on_edge (edge e, gimple_seq seq)
2453Add the sequence of statements in @code{SEQ} to the pending list of edge
2454@code{E}.  No actual insertion is made until a call to
2455@code{gsi_commit_edge_inserts}() is made.
2456@end deftypefn
2457
2458@deftypefn {GIMPLE function} basic_block gsi_insert_on_edge_immediate (edge e, gimple stmt)
2459Similar to @code{gsi_insert_on_edge}+@code{gsi_commit_edge_inserts}.  If a new
2460block has to be created, it is returned.
2461@end deftypefn
2462
2463@deftypefn {GIMPLE function} void gsi_commit_one_edge_insert (edge e, basic_block *new_bb)
2464Commit insertions pending at edge @code{E}.  If a new block is created,
2465set @code{NEW_BB} to this block, otherwise set it to @code{NULL}.
2466@end deftypefn
2467
2468@deftypefn {GIMPLE function} void gsi_commit_edge_inserts (void)
2469This routine will commit all pending edge insertions, creating
2470any new basic blocks which are necessary.
2471@end deftypefn
2472
2473
2474@node Adding a new GIMPLE statement code
2475@section Adding a new GIMPLE statement code
2476@cindex Adding a new GIMPLE statement code
2477
2478The first step in adding a new GIMPLE statement code, is
2479modifying the file @code{gimple.def}, which contains all the GIMPLE
2480codes.  Then you must add a corresponding structure, and an entry
2481in @code{union gimple_statement_d}, both of which are located in
2482@code{gimple.h}.  This in turn, will require you to add a corresponding
2483@code{GTY} tag in @code{gsstruct.def}, and code to handle this tag in
2484@code{gss_for_code} which is located in @code{gimple.c}.
2485
2486In order for the garbage collector to know the size of the
2487structure you created in @code{gimple.h}, you need to add a case to
2488handle your new GIMPLE statement in @code{gimple_size} which is located
2489in @code{gimple.c}.
2490
2491You will probably want to create a function to build the new
2492gimple statement in @code{gimple.c}.  The function should be called
2493@code{gimple_build_<@code{NEW_TUPLE_NAME}>}, and should return the new tuple
2494of type gimple.
2495
2496If your new statement requires accessors for any members or
2497operands it may have, put simple inline accessors in
2498@code{gimple.h} and any non-trivial accessors in @code{gimple.c} with a
2499corresponding prototype in @code{gimple.h}.
2500
2501
2502@node Statement and operand traversals
2503@section Statement and operand traversals
2504@cindex Statement and operand traversals
2505
2506There are two functions available for walking statements and
2507sequences: @code{walk_gimple_stmt} and @code{walk_gimple_seq},
2508accordingly, and a third function for walking the operands in a
2509statement: @code{walk_gimple_op}.
2510
2511@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)
2512This function is used to walk the current statement in @code{GSI},
2513optionally using traversal state stored in @code{WI}.  If @code{WI} is @code{NULL}, no
2514state is kept during the traversal.
2515
2516The callback @code{CALLBACK_STMT} is called.  If @code{CALLBACK_STMT} returns
2517true, it means that the callback function has handled all the
2518operands of the statement and it is not necessary to walk its
2519operands.
2520
2521If @code{CALLBACK_STMT} is @code{NULL} or it returns false, @code{CALLBACK_OP} is
2522called on each operand of the statement via @code{walk_gimple_op}.  If
2523@code{walk_gimple_op} returns non-@code{NULL} for any operand, the remaining
2524operands are not scanned.
2525
2526The return value is that returned by the last call to
2527@code{walk_gimple_op}, or @code{NULL_TREE} if no @code{CALLBACK_OP} is specified.
2528@end deftypefn
2529
2530
2531@deftypefn {GIMPLE function} tree walk_gimple_op (gimple stmt, walk_tree_fn callback_op, struct walk_stmt_info *wi)
2532Use this function to walk the operands of statement @code{STMT}.  Every
2533operand is walked via @code{walk_tree} with optional state information
2534in @code{WI}.
2535
2536@code{CALLBACK_OP} is called on each operand of @code{STMT} via @code{walk_tree}.
2537Additional parameters to @code{walk_tree} must be stored in @code{WI}.  For
2538each operand @code{OP}, @code{walk_tree} is called as:
2539
2540@smallexample
2541    walk_tree (&@code{OP}, @code{CALLBACK_OP}, @code{WI}, @code{WI}- @code{PSET})
2542@end smallexample
2543
2544If @code{CALLBACK_OP} returns non-@code{NULL} for an operand, the remaining
2545operands are not scanned.  The return value is that returned by
2546the last call to @code{walk_tree}, or @code{NULL_TREE} if no @code{CALLBACK_OP} is
2547specified.
2548@end deftypefn
2549
2550
2551@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)
2552This function walks all the statements in the sequence @code{SEQ}
2553calling @code{walk_gimple_stmt} on each one.  @code{WI} is as in
2554@code{walk_gimple_stmt}.  If @code{walk_gimple_stmt} returns non-@code{NULL}, the walk
2555is stopped and the value returned.  Otherwise, all the statements
2556are walked and @code{NULL_TREE} returned.
2557@end deftypefn
2558