]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/doc/gimple.texi
Update copyright years.
[thirdparty/gcc.git] / gcc / doc / gimple.texi
index 2f398c850ccd6390dd259f40b2517645944c5d71..322c7609cf3159f5f908400440a21287c622c9fa 100644 (file)
@@ -1,4 +1,4 @@
-@c Copyright (C) 2008-2014 Free Software Foundation, Inc.
+@c Copyright (C) 2008-2023 Free Software Foundation, Inc.
 @c Free Software Foundation, Inc.
 @c This is part of the GCC manual.
 @c For copying conditions, see the file gcc.texi.
@@ -92,8 +92,8 @@ groups: a header describing the instruction and its locations,
 and a variable length body with all the operands. Tuples are
 organized into a hierarchy with 3 main classes of tuples.
 
-@subsection @code{gimple_statement_base} (gsbase)
-@cindex gimple_statement_base
+@subsection @code{gimple} (gsbase)
+@cindex gimple
 
 This is the root of the hierarchy, it holds basic information
 needed by most GIMPLE statements. There are some fields that
@@ -223,7 +223,7 @@ is then inherited from the other two tuples.
 
 @itemize @bullet
 @item @code{gsbase}
-Inherited from @code{struct gimple_statement_base}.
+Inherited from @code{struct gimple}.
 
 @item @code{def_ops}
 Array of pointers into the operand array indicating all the slots that
@@ -300,7 +300,7 @@ kinds, along with their relationships to @code{GSS_} values (layouts) and
 @code{GIMPLE_} values (codes):
 
 @smallexample
-   gimple_statement_base
+   gimple
      |    layout: GSS_BASE
      |    used for 4 codes: GIMPLE_ERROR_MARK
      |                      GIMPLE_NOP
@@ -682,8 +682,7 @@ more than two slots on the RHS.  For instance, a @code{COND_EXPR}
 expression of the form @code{(a op b) ? x : y} could be flattened
 out on the operand vector using 4 slots, but it would also
 require additional processing to distinguish @code{c = a op b}
-from @code{c = a op b ? x : y}.  Something similar occurs with
-@code{ASSERT_EXPR}.   In time, these special case tree
+from @code{c = a op b ? x : y}.  In time, these special case tree
 expressions should be flattened into the operand vector.
 @end itemize
 
@@ -793,7 +792,7 @@ the address of a function local variable).
 
 @deftypefn {GIMPLE function} bool is_gimple_ip_invariant (tree t)
 Return true if t is an interprocedural invariant.  This means that t
-is a valid invariant in all functions (e.g. it can be an address of a
+is a valid invariant in all functions (e.g.@: it can be an address of a
 global variable but not of a local one).
 @end deftypefn
 
@@ -831,6 +830,21 @@ expression to a variable.
 Return true if g is any of the OpenMP codes.
 @end deftypefn
 
+@deftypefn {GIMPLE function} bool gimple_debug_begin_stmt_p (gimple g)
+Return true if g is a @code{GIMPLE_DEBUG} that marks the beginning of
+a source statement.
+@end deftypefn
+
+@deftypefn {GIMPLE function} bool gimple_debug_inline_entry_p (gimple g)
+Return true if g is a @code{GIMPLE_DEBUG} that marks the entry
+point of an inlined function.
+@end deftypefn
+
+@deftypefn {GIMPLE function} bool gimple_debug_nonbind_marker_p (gimple g)
+Return true if g is a @code{GIMPLE_DEBUG} that marks a program location,
+without any variable binding.
+@end deftypefn
+
 @node Manipulating GIMPLE statements
 @section Manipulating GIMPLE statements
 @cindex Manipulating GIMPLE statements
@@ -853,14 +867,6 @@ Return the basic block to which statement @code{G} belongs to.
 Return the lexical scope block holding statement @code{G}.
 @end deftypefn
 
-@deftypefn {GIMPLE function} tree gimple_expr_type (gimple stmt)
-Return the type of the main expression computed by @code{STMT}. Return
-@code{void_type_node} if @code{STMT} computes nothing. This will only return
-something meaningful for @code{GIMPLE_ASSIGN}, @code{GIMPLE_COND} and
-@code{GIMPLE_CALL}.  For all other tuple codes, it will return
-@code{void_type_node}.
-@end deftypefn
-
 @deftypefn {GIMPLE function} {enum tree_code} gimple_expr_code (gimple stmt)
 Return the tree code for the expression computed by @code{STMT}.  This
 is only meaningful for @code{GIMPLE_CALL}, @code{GIMPLE_ASSIGN} and
@@ -1310,11 +1316,13 @@ operand is validated with @code{is_gimple_operand}).
 @end deftypefn
 
 
-@deftypefn {GIMPLE function} gcall *gimple_build_call_from_tree (tree call_expr)
-Build a @code{GIMPLE_CALL} from a @code{CALL_EXPR} node.  The arguments and the
-function are taken from the expression directly.  This routine
-assumes that @code{call_expr} is already in GIMPLE form.  That is, its
-operands are GIMPLE values and the function call needs no further
+@deftypefn {GIMPLE function} gcall *gimple_build_call_from_tree (tree call_expr, @
+tree fnptrtype)
+Build a @code{GIMPLE_CALL} from a @code{CALL_EXPR} node.  The arguments
+and the function are taken from the expression directly.  The type of the
+@code{GIMPLE_CALL} is set from the second parameter passed by a caller.
+This routine assumes that @code{call_expr} is already in GIMPLE form.
+That is, its operands are GIMPLE values and the function call needs no further
 simplification.  All the call flags in @code{call_expr} are copied over
 to the new @code{GIMPLE_CALL}.
 @end deftypefn
@@ -1528,10 +1536,12 @@ Set the conditional @code{COND_STMT} to be of the form 'if (1 == 1)'.
 @subsection @code{GIMPLE_DEBUG}
 @cindex @code{GIMPLE_DEBUG}
 @cindex @code{GIMPLE_DEBUG_BIND}
+@cindex @code{GIMPLE_DEBUG_BEGIN_STMT}
+@cindex @code{GIMPLE_DEBUG_INLINE_ENTRY}
 
 @deftypefn {GIMPLE function} gdebug *gimple_build_debug_bind (tree var, @
 tree value, gimple stmt)
-Build a @code{GIMPLE_DEBUG} statement with @code{GIMPLE_DEBUG_BIND} of
+Build a @code{GIMPLE_DEBUG} statement with @code{GIMPLE_DEBUG_BIND}
 @code{subcode}.  The effect of this statement is to tell debug
 information generation machinery that the value of user variable
 @code{var} is given by @code{value} at that point, and to remain with
@@ -1602,6 +1612,29 @@ Return @code{TRUE} if @code{stmt} binds a user variable to a value,
 and @code{FALSE} if it unbinds the variable.
 @end deftypefn
 
+@deftypefn {GIMPLE function} gimple gimple_build_debug_begin_stmt (tree block, location_t location)
+Build a @code{GIMPLE_DEBUG} statement with
+@code{GIMPLE_DEBUG_BEGIN_STMT} @code{subcode}.  The effect of this
+statement is to tell debug information generation machinery that the
+user statement at the given @code{location} and @code{block} starts at
+the point at which the statement is inserted.  The intent is that side
+effects (e.g.@: variable bindings) of all prior user statements are
+observable, and that none of the side effects of subsequent user
+statements are.
+@end deftypefn
+
+@deftypefn {GIMPLE function} gimple gimple_build_debug_inline_entry (tree block, location_t location)
+Build a @code{GIMPLE_DEBUG} statement with
+@code{GIMPLE_DEBUG_INLINE_ENTRY} @code{subcode}.  The effect of this
+statement is to tell debug information generation machinery that a
+function call at @code{location} underwent inline substitution, that
+@code{block} is the enclosing lexical block created for the
+substitution, and that at the point of the program in which the stmt is
+inserted, all parameters for the inlined function are bound to the
+respective arguments, and none of the side effects of its stmts are
+observable.
+@end deftypefn
+
 @node @code{GIMPLE_EH_FILTER}
 @subsection @code{GIMPLE_EH_FILTER}
 @cindex @code{GIMPLE_EH_FILTER}
@@ -1828,9 +1861,8 @@ Set @code{NAME} to be the name associated with @code{OMP} critical statement @co
 tree clauses, tree index, tree initial, tree final, tree incr, @
 gimple_seq pre_body, enum tree_code omp_for_cond)
 Build a @code{GIMPLE_OMP_FOR} statement. @code{BODY} is sequence of statements
-inside the for loop.  @code{CLAUSES}, are any of the @code{OMP} loop
-construct's clauses: private, firstprivate,  lastprivate,
-reductions, ordered, schedule, and nowait.  @code{PRE_BODY} is the
+inside the for loop.  @code{CLAUSES}, are any of the loop
+construct's clauses.  @code{PRE_BODY} is the
 sequence of statements that are loop invariant.  @code{INDEX} is the
 index variable.  @code{INITIAL} is the initial value of @code{INDEX}.  @code{FINAL} is
 final value of @code{INDEX}.  OMP_FOR_COND is the predicate used to
@@ -1932,11 +1964,10 @@ statements to be executed by just the master.
 
 @deftypefn {GIMPLE function} gimple gimple_build_omp_ordered (gimple_seq body)
 Build a @code{GIMPLE_OMP_ORDERED} statement.
-@end deftypefn
 
 @code{BODY} is the sequence of statements inside a loop that will
 executed in sequence.
-
+@end deftypefn
 
 @node @code{GIMPLE_OMP_PARALLEL}
 @subsection @code{GIMPLE_OMP_PARALLEL}
@@ -1945,12 +1976,12 @@ executed in sequence.
 @deftypefn {GIMPLE function} gomp_parallel *gimple_build_omp_parallel (@
 gimple_seq body, tree clauses, tree child_fn, tree data_arg)
 Build a @code{GIMPLE_OMP_PARALLEL} statement.
-@end deftypefn
 
 @code{BODY} is sequence of statements which are executed in parallel.
 @code{CLAUSES}, are the @code{OMP} parallel construct's clauses.  @code{CHILD_FN} is
 the function created for the parallel threads to execute.
 @code{DATA_ARG} are the shared data argument(s).
+@end deftypefn
 
 @deftypefn {GIMPLE function} bool gimple_omp_parallel_combined_p (gimple g)
 Return true if @code{OMP} parallel statement @code{G} has the
@@ -2044,9 +2075,9 @@ Return true if @code{OMP} return statement @code{G} has the
 
 @deftypefn {GIMPLE function} gimple gimple_build_omp_section (gimple_seq body)
 Build a @code{GIMPLE_OMP_SECTION} statement for a sections statement.
-@end deftypefn
 
 @code{BODY} is the sequence of statements in the section.
+@end deftypefn
 
 @deftypefn {GIMPLE function} bool gimple_omp_section_last_p (gimple g)
 Return true if @code{OMP} section statement @code{G} has the
@@ -2655,24 +2686,24 @@ any new basic blocks which are necessary.
 
 The first step in adding a new GIMPLE statement code, is
 modifying the file @code{gimple.def}, which contains all the GIMPLE
-codes.  Then you must add a corresponding gimple_statement_base subclass
+codes.  Then you must add a corresponding gimple subclass
 located in @code{gimple.h}.  This in turn, will require you to add a
 corresponding @code{GTY} tag in @code{gsstruct.def}, and code to handle
-this tag in @code{gss_for_code} which is located in @code{gimple.c}.
+this tag in @code{gss_for_code} which is located in @code{gimple.cc}.
 
 In order for the garbage collector to know the size of the
 structure you created in @code{gimple.h}, you need to add a case to
 handle your new GIMPLE statement in @code{gimple_size} which is located
-in @code{gimple.c}.
+in @code{gimple.cc}.
 
 You will probably want to create a function to build the new
-gimple statement in @code{gimple.c}.  The function should be called
+gimple statement in @code{gimple.cc}.  The function should be called
 @code{gimple_build_@var{new-tuple-name}}, and should return the new tuple
-as a pointer to the appropriate gimple_statement_base subclass.
+as a pointer to the appropriate gimple subclass.
 
 If your new statement requires accessors for any members or
 operands it may have, put simple inline accessors in
-@code{gimple.h} and any non-trivial accessors in @code{gimple.c} with a
+@code{gimple.h} and any non-trivial accessors in @code{gimple.cc} with a
 corresponding prototype in @code{gimple.h}.
 
 You should add the new statement subclass to the class hierarchy diagram