From: David Malcolm Date: Tue, 30 Jun 2015 19:38:12 +0000 (+0000) Subject: PR jit/66546: Add gcc_jit_context_set_bool_allow_unreachable_blocks X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6a3603e356e14096e9554ceef57916fd03d9072b;p=gcc.git PR jit/66546: Add gcc_jit_context_set_bool_allow_unreachable_blocks gcc/jit/ChangeLog: PR jit/66546 * docs/cp/topics/contexts.rst (gccjit::context::set_bool_allow_unreachable_blocks): New. * docs/topics/compatibility.rst (LIBGCCJIT_ABI_2): New. * docs/topics/contexts.rst (Options): Add notes discussing the transition from enums to entrypoints for new options. (gcc_jit_context_set_bool_allow_unreachable_blocks): New. * docs/_build/texinfo/libgccjit.texi: Regenerate. * jit-common.h (gcc::jit::inner_bool_option): New enum. * jit-recording.c: Within namespace gcc::jit... (recording::context::context): Handle m_inner_bool_options. (recording::context::set_inner_bool_option): New. (inner_bool_option_reproducer_strings): New. (recording::context::log_all_options): Log the "inner" bool options. (recording::context::log_inner_bool_option): New. (recording::context::dump_reproducer_to_file): Write initializers for "inner" bool options. (recording::function::validate): Don't check for block reachability if INNER_BOOL_OPTION_ALLOW_UNREACHABLE_BLOCKS is set. * jit-recording.h: Within namespace gcc::jit... (recording::context::set_inner_bool_option): New. (recording::context::get_inner_bool_option): New. (recording::context::log_inner_bool_option): New. (recording::context::m_inner_bool_options): New. * libgccjit++.h (gccjit::context::set_bool_allow_unreachable_blocks): New. * libgccjit.c (gcc_jit_context_set_bool_allow_unreachable_blocks): New. * libgccjit.h: Add note about options present in the initial release of libgccjit. (gcc_jit_context_set_bool_allow_unreachable_blocks): New API entrypoint. (LIBGCCJIT_HAVE_gcc_jit_context_set_bool_allow_unreachable_blocks): New macro. * libgccjit.map (LIBGCCJIT_ABI_2): New, containing... (gcc_jit_context_set_bool_allow_unreachable_blocks): ...this new entrypoint. gcc/testsuite/ChangeLog: PR jit/66546 * jit.dg/all-non-failing-tests.h: Add note about test-validly-unreachable-block.c. * jit.dg/test-validly-unreachable-block.c: New file. From-SVN: r225206 --- diff --git a/gcc/jit/ChangeLog b/gcc/jit/ChangeLog index b4b66346693..439f24813ce 100644 --- a/gcc/jit/ChangeLog +++ b/gcc/jit/ChangeLog @@ -1,3 +1,44 @@ +2015-06-30 David Malcolm + + PR jit/66546 + * docs/cp/topics/contexts.rst + (gccjit::context::set_bool_allow_unreachable_blocks): New. + * docs/topics/compatibility.rst (LIBGCCJIT_ABI_2): New. + * docs/topics/contexts.rst (Options): Add notes discussing the + transition from enums to entrypoints for new options. + (gcc_jit_context_set_bool_allow_unreachable_blocks): New. + * docs/_build/texinfo/libgccjit.texi: Regenerate. + * jit-common.h (gcc::jit::inner_bool_option): New enum. + * jit-recording.c: Within namespace gcc::jit... + (recording::context::context): Handle m_inner_bool_options. + (recording::context::set_inner_bool_option): New. + (inner_bool_option_reproducer_strings): New. + (recording::context::log_all_options): Log the "inner" bool + options. + (recording::context::log_inner_bool_option): New. + (recording::context::dump_reproducer_to_file): Write initializers + for "inner" bool options. + (recording::function::validate): Don't check for block + reachability if INNER_BOOL_OPTION_ALLOW_UNREACHABLE_BLOCKS is set. + * jit-recording.h: Within namespace gcc::jit... + (recording::context::set_inner_bool_option): New. + (recording::context::get_inner_bool_option): New. + (recording::context::log_inner_bool_option): New. + (recording::context::m_inner_bool_options): New. + * libgccjit++.h + (gccjit::context::set_bool_allow_unreachable_blocks): New. + * libgccjit.c + (gcc_jit_context_set_bool_allow_unreachable_blocks): New. + * libgccjit.h: Add note about options present in the + initial release of libgccjit. + (gcc_jit_context_set_bool_allow_unreachable_blocks): New API + entrypoint. + (LIBGCCJIT_HAVE_gcc_jit_context_set_bool_allow_unreachable_blocks): + New macro. + * libgccjit.map (LIBGCCJIT_ABI_2): New, containing... + (gcc_jit_context_set_bool_allow_unreachable_blocks): ...this new + entrypoint. + 2015-06-30 David Malcolm PR jit/66628 diff --git a/gcc/jit/docs/_build/texinfo/libgccjit.texi b/gcc/jit/docs/_build/texinfo/libgccjit.texi index 3bc69afe78c..522ce76d42d 100644 --- a/gcc/jit/docs/_build/texinfo/libgccjit.texi +++ b/gcc/jit/docs/_build/texinfo/libgccjit.texi @@ -234,6 +234,7 @@ ABI symbol tags * LIBGCCJIT_ABI_0:: * LIBGCCJIT_ABI_1:: +* LIBGCCJIT_ABI_2:: C++ bindings for libgccjit @@ -4914,6 +4915,7 @@ ABI symbol tags * LIBGCCJIT_ABI_0:: * LIBGCCJIT_ABI_1:: +* LIBGCCJIT_ABI_2:: @end menu @@ -5250,6 +5252,15 @@ It exists primarily for writing the library's own test suite. @subsection Options +Options present in the initial release of libgccjit were handled using +enums, whereas those added subsequently have their own per-option API +entrypoints. + +Adding entrypoints for each new option means that client code that use +the new options can be identified directly from binary metadata, which +would not be possible if we instead extended the various +@code{enum gcc_jit_*_option}. + @menu * String Options:: * Boolean options:: @@ -5274,7 +5285,7 @@ Set a string option of the context. @deffn {C Type} enum gcc_jit_str_option @end deffn -There is currently just one string option: +There is just one string option specified this way: @geindex GCC_JIT_STR_OPTION_PROGNAME (C macro) @anchor{topics/contexts GCC_JIT_STR_OPTION_PROGNAME}@anchor{63} @@ -5452,8 +5463,27 @@ written to the filesystem, and will display their location on stderr. @end deffn @end deffn +@geindex gcc_jit_context_set_bool_allow_unreachable_blocks (C function) +@anchor{topics/contexts gcc_jit_context_set_bool_allow_unreachable_blocks}@anchor{6b} +@deffn {C Function} void gcc_jit_context_set_bool_allow_unreachable_blocks (gcc_jit_context@w{ }*ctxt, int@w{ }bool_value) + +By default, libgccjit will issue an error about unreachable blocks +within a function. + +This entrypoint can be used to disable that error. + +This entrypoint was added in @pxref{6c,,LIBGCCJIT_ABI_2}; you can test for +its presence using + +@example +#ifdef LIBGCCJIT_HAVE_gcc_jit_context_set_bool_allow_unreachable_blocks +@end example + +@noindent +@end deffn + @node Integer options,Additional command-line options,Boolean options,Options<2> -@anchor{topics/contexts integer-options}@anchor{6b} +@anchor{topics/contexts integer-options}@anchor{6d} @subsubsection Integer options @@ -5464,11 +5494,11 @@ written to the filesystem, and will display their location on stderr. Set an integer option of the context. @geindex gcc_jit_int_option (C type) -@anchor{topics/contexts gcc_jit_int_option}@anchor{6c} +@anchor{topics/contexts gcc_jit_int_option}@anchor{6e} @deffn {C Type} enum gcc_jit_int_option @end deffn -There is currently just one integer option: +There is just one integer option specified this way: @geindex GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL (C macro) @anchor{topics/contexts GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL}@anchor{1f} @@ -5484,12 +5514,12 @@ The default value is 0 (unoptimized). @end deffn @node Additional command-line options,,Integer options,Options<2> -@anchor{topics/contexts additional-command-line-options}@anchor{6d} +@anchor{topics/contexts additional-command-line-options}@anchor{6f} @subsubsection Additional command-line options @geindex gcc_jit_context_add_command_line_option (C function) -@anchor{topics/contexts gcc_jit_context_add_command_line_option}@anchor{6e} +@anchor{topics/contexts gcc_jit_context_add_command_line_option}@anchor{70} @deffn {C Function} void gcc_jit_context_add_command_line_option (gcc_jit_context@w{ }*ctxt, const char@w{ }*optname) Add an arbitrary gcc command-line option to the context, for use @@ -5517,7 +5547,7 @@ Note that only some options are likely to be meaningful; there is no "frontend" within libgccjit, so typically only those affecting optimization and code-generation are likely to be useful. -This entrypoint was added in @pxref{6f,,LIBGCCJIT_ABI_1}; you can test for +This entrypoint was added in @pxref{71,,LIBGCCJIT_ABI_1}; you can test for its presence using @example @@ -5545,7 +5575,7 @@ its presence using @c . @node Objects,Types,Compilation contexts,Topic Reference -@anchor{topics/objects objects}@anchor{70}@anchor{topics/objects doc}@anchor{71} +@anchor{topics/objects objects}@anchor{72}@anchor{topics/objects doc}@anchor{73} @section Objects @@ -5605,7 +5635,7 @@ gcc_jit_object *obj = gcc_jit_type_as_object (int_type); The object "base class" has the following operations: @geindex gcc_jit_object_get_context (C function) -@anchor{topics/objects gcc_jit_object_get_context}@anchor{72} +@anchor{topics/objects gcc_jit_object_get_context}@anchor{74} @deffn {C Function} gcc_jit_context *gcc_jit_object_get_context (gcc_jit_object@w{ }*obj) Which context is "obj" within? @@ -5661,7 +5691,7 @@ object's context is released. @c . @node Types,Expressions,Objects,Topic Reference -@anchor{topics/types doc}@anchor{73}@anchor{topics/types types}@anchor{74} +@anchor{topics/types doc}@anchor{75}@anchor{topics/types types}@anchor{76} @section Types @@ -5698,7 +5728,7 @@ See @pxref{b,,gcc_jit_context_get_type()} for the available types. @item derived types can be accessed by using functions such as -@pxref{75,,gcc_jit_type_get_pointer()} and @pxref{76,,gcc_jit_type_get_const()}: +@pxref{77,,gcc_jit_type_get_pointer()} and @pxref{78,,gcc_jit_type_get_const()}: @example gcc_jit_type *const_int_star = gcc_jit_type_get_pointer (gcc_jit_type_get_const (int_type)); @@ -5719,7 +5749,7 @@ by creating structures (see below). @end menu @node Standard types,Pointers const and volatile,,Types -@anchor{topics/types standard-types}@anchor{77} +@anchor{topics/types standard-types}@anchor{79} @subsection Standard types @@ -5924,66 +5954,66 @@ C99's @code{_Complex long double} @end deffn @geindex gcc_jit_context_get_int_type (C function) -@anchor{topics/types gcc_jit_context_get_int_type}@anchor{78} +@anchor{topics/types gcc_jit_context_get_int_type}@anchor{7a} @deffn {C Function} gcc_jit_type * gcc_jit_context_get_int_type (gcc_jit_context@w{ }*ctxt, int@w{ }num_bytes, int@w{ }is_signed) Access the integer type of the given size. @end deffn @node Pointers const and volatile,Structures and unions,Standard types,Types -@anchor{topics/types pointers-const-and-volatile}@anchor{79} +@anchor{topics/types pointers-const-and-volatile}@anchor{7b} @subsection Pointers, @cite{const}, and @cite{volatile} @geindex gcc_jit_type_get_pointer (C function) -@anchor{topics/types gcc_jit_type_get_pointer}@anchor{75} +@anchor{topics/types gcc_jit_type_get_pointer}@anchor{77} @deffn {C Function} gcc_jit_type *gcc_jit_type_get_pointer (gcc_jit_type@w{ }*type) Given type "T", get type "T*". @end deffn @geindex gcc_jit_type_get_const (C function) -@anchor{topics/types gcc_jit_type_get_const}@anchor{76} +@anchor{topics/types gcc_jit_type_get_const}@anchor{78} @deffn {C Function} gcc_jit_type *gcc_jit_type_get_const (gcc_jit_type@w{ }*type) Given type "T", get type "const T". @end deffn @geindex gcc_jit_type_get_volatile (C function) -@anchor{topics/types gcc_jit_type_get_volatile}@anchor{7a} +@anchor{topics/types gcc_jit_type_get_volatile}@anchor{7c} @deffn {C Function} gcc_jit_type *gcc_jit_type_get_volatile (gcc_jit_type@w{ }*type) Given type "T", get type "volatile T". @end deffn @geindex gcc_jit_context_new_array_type (C function) -@anchor{topics/types gcc_jit_context_new_array_type}@anchor{7b} +@anchor{topics/types gcc_jit_context_new_array_type}@anchor{7d} @deffn {C Function} gcc_jit_type * gcc_jit_context_new_array_type (gcc_jit_context@w{ }*ctxt, gcc_jit_location@w{ }*loc, gcc_jit_type@w{ }*element_type, int@w{ }num_elements) Given type "T", get type "T[N]" (for a constant N). @end deffn @node Structures and unions,,Pointers const and volatile,Types -@anchor{topics/types structures-and-unions}@anchor{7c} +@anchor{topics/types structures-and-unions}@anchor{7e} @subsection Structures and unions @geindex gcc_jit_struct (C type) -@anchor{topics/types gcc_jit_struct}@anchor{7d} +@anchor{topics/types gcc_jit_struct}@anchor{7f} @deffn {C Type} gcc_jit_struct @end deffn A compound type analagous to a C @cite{struct}. @geindex gcc_jit_field (C type) -@anchor{topics/types gcc_jit_field}@anchor{7e} +@anchor{topics/types gcc_jit_field}@anchor{80} @deffn {C Type} gcc_jit_field @end deffn -A field within a @pxref{7d,,gcc_jit_struct}. +A field within a @pxref{7f,,gcc_jit_struct}. -You can model C @cite{struct} types by creating @pxref{7d,,gcc_jit_struct *} and -@pxref{7e,,gcc_jit_field} instances, in either order: +You can model C @cite{struct} types by creating @pxref{7f,,gcc_jit_struct *} and +@pxref{80,,gcc_jit_field} instances, in either order: @itemize * @@ -6040,21 +6070,21 @@ gcc_jit_struct_set_fields (node, NULL, 2, fields); @end itemize @geindex gcc_jit_context_new_field (C function) -@anchor{topics/types gcc_jit_context_new_field}@anchor{7f} +@anchor{topics/types gcc_jit_context_new_field}@anchor{81} @deffn {C Function} gcc_jit_field * gcc_jit_context_new_field (gcc_jit_context@w{ }*ctxt, gcc_jit_location@w{ }*loc, gcc_jit_type@w{ }*type, const char@w{ }*name) Construct a new field, with the given type and name. @end deffn @geindex gcc_jit_field_as_object (C function) -@anchor{topics/types gcc_jit_field_as_object}@anchor{80} +@anchor{topics/types gcc_jit_field_as_object}@anchor{82} @deffn {C Function} gcc_jit_object * gcc_jit_field_as_object (gcc_jit_field@w{ }*field) Upcast from field to object. @end deffn @geindex gcc_jit_context_new_struct_type (C function) -@anchor{topics/types gcc_jit_context_new_struct_type}@anchor{81} +@anchor{topics/types gcc_jit_context_new_struct_type}@anchor{83} @deffn {C Function} gcc_jit_struct *gcc_jit_context_new_struct_type (gcc_jit_context@w{ }*ctxt, gcc_jit_location@w{ }*loc, const char@w{ }*name, int@w{ }num_fields, gcc_jit_field@w{ }**fields) @quotation @@ -6064,24 +6094,24 @@ Construct a new struct type, with the given name and fields. @end deffn @geindex gcc_jit_context_new_opaque_struct (C function) -@anchor{topics/types gcc_jit_context_new_opaque_struct}@anchor{82} +@anchor{topics/types gcc_jit_context_new_opaque_struct}@anchor{84} @deffn {C Function} gcc_jit_struct * gcc_jit_context_new_opaque_struct (gcc_jit_context@w{ }*ctxt, gcc_jit_location@w{ }*loc, const char@w{ }*name) Construct a new struct type, with the given name, but without specifying the fields. The fields can be omitted (in which case the size of the struct is not known), or later specified using -@pxref{83,,gcc_jit_struct_set_fields()}. +@pxref{85,,gcc_jit_struct_set_fields()}. @end deffn @geindex gcc_jit_struct_as_type (C function) -@anchor{topics/types gcc_jit_struct_as_type}@anchor{84} +@anchor{topics/types gcc_jit_struct_as_type}@anchor{86} @deffn {C Function} gcc_jit_type * gcc_jit_struct_as_type (gcc_jit_struct@w{ }*struct_type) Upcast from struct to type. @end deffn @geindex gcc_jit_struct_set_fields (C function) -@anchor{topics/types gcc_jit_struct_set_fields}@anchor{83} +@anchor{topics/types gcc_jit_struct_set_fields}@anchor{85} @deffn {C Function} void gcc_jit_struct_set_fields (gcc_jit_struct@w{ }*struct_type, gcc_jit_location@w{ }*loc, int@w{ }num_fields, gcc_jit_field@w{ }**fields) Populate the fields of a formerly-opaque struct type. @@ -6107,7 +6137,7 @@ This can only be called once on a given struct type. @c . @node Expressions,Creating and using functions,Types,Topic Reference -@anchor{topics/expressions expressions}@anchor{85}@anchor{topics/expressions doc}@anchor{86} +@anchor{topics/expressions expressions}@anchor{87}@anchor{topics/expressions doc}@anchor{88} @section Expressions @@ -6133,7 +6163,7 @@ Lvalues @node Rvalues,Lvalues,,Expressions -@anchor{topics/expressions rvalues}@anchor{87} +@anchor{topics/expressions rvalues}@anchor{89} @subsection Rvalues @@ -6187,7 +6217,7 @@ Every rvalue has an associated type, and the API will check to ensure that types match up correctly (otherwise the context will emit an error). @geindex gcc_jit_rvalue_get_type (C function) -@anchor{topics/expressions gcc_jit_rvalue_get_type}@anchor{88} +@anchor{topics/expressions gcc_jit_rvalue_get_type}@anchor{8a} @deffn {C Function} gcc_jit_type *gcc_jit_rvalue_get_type (gcc_jit_rvalue@w{ }*rvalue) Get the type of this rvalue. @@ -6211,7 +6241,7 @@ Upcast the given rvalue to be an object. @end menu @node Simple expressions,Unary Operations,,Rvalues -@anchor{topics/expressions simple-expressions}@anchor{89} +@anchor{topics/expressions simple-expressions}@anchor{8b} @subsubsection Simple expressions @@ -6224,7 +6254,7 @@ the given constant @code{int} value. @end deffn @geindex gcc_jit_context_new_rvalue_from_long (C function) -@anchor{topics/expressions gcc_jit_context_new_rvalue_from_long}@anchor{8a} +@anchor{topics/expressions gcc_jit_context_new_rvalue_from_long}@anchor{8c} @deffn {C Function} gcc_jit_rvalue * gcc_jit_context_new_rvalue_from_long (gcc_jit_context@w{ }*ctxt, gcc_jit_type@w{ }*numeric_type, long@w{ }value) Given a numeric type (integer or floating point), build an rvalue for @@ -6268,14 +6298,14 @@ the given constant @code{double} value. @end deffn @geindex gcc_jit_context_new_rvalue_from_ptr (C function) -@anchor{topics/expressions gcc_jit_context_new_rvalue_from_ptr}@anchor{8b} +@anchor{topics/expressions gcc_jit_context_new_rvalue_from_ptr}@anchor{8d} @deffn {C Function} gcc_jit_rvalue * gcc_jit_context_new_rvalue_from_ptr (gcc_jit_context@w{ }*ctxt, gcc_jit_type@w{ }*pointer_type, void@w{ }*value) Given a pointer type, build an rvalue for the given address. @end deffn @geindex gcc_jit_context_null (C function) -@anchor{topics/expressions gcc_jit_context_null}@anchor{8c} +@anchor{topics/expressions gcc_jit_context_null}@anchor{8e} @deffn {C Function} gcc_jit_rvalue *gcc_jit_context_null (gcc_jit_context@w{ }*ctxt, gcc_jit_type@w{ }*pointer_type) Given a pointer type, build an rvalue for @code{NULL}. Essentially this @@ -6289,7 +6319,7 @@ gcc_jit_context_new_rvalue_from_ptr (ctxt, pointer_type, NULL) @end deffn @geindex gcc_jit_context_new_string_literal (C function) -@anchor{topics/expressions gcc_jit_context_new_string_literal}@anchor{8d} +@anchor{topics/expressions gcc_jit_context_new_string_literal}@anchor{8f} @deffn {C Function} gcc_jit_rvalue * gcc_jit_context_new_string_literal (gcc_jit_context@w{ }*ctxt, const char@w{ }*value) Generate an rvalue for the given NIL-terminated string, of type @@ -6297,19 +6327,19 @@ Generate an rvalue for the given NIL-terminated string, of type @end deffn @node Unary Operations,Binary Operations,Simple expressions,Rvalues -@anchor{topics/expressions unary-operations}@anchor{8e} +@anchor{topics/expressions unary-operations}@anchor{90} @subsubsection Unary Operations @geindex gcc_jit_context_new_unary_op (C function) -@anchor{topics/expressions gcc_jit_context_new_unary_op}@anchor{8f} +@anchor{topics/expressions gcc_jit_context_new_unary_op}@anchor{91} @deffn {C Function} gcc_jit_rvalue * gcc_jit_context_new_unary_op (gcc_jit_context@w{ }*ctxt, gcc_jit_location@w{ }*loc, enum gcc_jit_unary_op@w{ }op, gcc_jit_type@w{ }*result_type, gcc_jit_rvalue@w{ }*rvalue) Build a unary operation out of an input rvalue. @end deffn @geindex gcc_jit_unary_op (C type) -@anchor{topics/expressions gcc_jit_unary_op}@anchor{90} +@anchor{topics/expressions gcc_jit_unary_op}@anchor{92} @deffn {C Type} enum gcc_jit_unary_op @end deffn @@ -6327,7 +6357,7 @@ C equivalent @item -@pxref{91,,GCC_JIT_UNARY_OP_MINUS} +@pxref{93,,GCC_JIT_UNARY_OP_MINUS} @tab @@ -6335,7 +6365,7 @@ C equivalent @item -@pxref{92,,GCC_JIT_UNARY_OP_BITWISE_NEGATE} +@pxref{94,,GCC_JIT_UNARY_OP_BITWISE_NEGATE} @tab @@ -6343,7 +6373,7 @@ C equivalent @item -@pxref{93,,GCC_JIT_UNARY_OP_LOGICAL_NEGATE} +@pxref{95,,GCC_JIT_UNARY_OP_LOGICAL_NEGATE} @tab @@ -6351,7 +6381,7 @@ C equivalent @item -@pxref{94,,GCC_JIT_UNARY_OP_ABS} +@pxref{96,,GCC_JIT_UNARY_OP_ABS} @tab @@ -6361,7 +6391,7 @@ C equivalent @geindex GCC_JIT_UNARY_OP_MINUS (C macro) -@anchor{topics/expressions GCC_JIT_UNARY_OP_MINUS}@anchor{91} +@anchor{topics/expressions GCC_JIT_UNARY_OP_MINUS}@anchor{93} @deffn {C Macro} GCC_JIT_UNARY_OP_MINUS Negate an arithmetic value; analogous to: @@ -6376,7 +6406,7 @@ in C. @end deffn @geindex GCC_JIT_UNARY_OP_BITWISE_NEGATE (C macro) -@anchor{topics/expressions GCC_JIT_UNARY_OP_BITWISE_NEGATE}@anchor{92} +@anchor{topics/expressions GCC_JIT_UNARY_OP_BITWISE_NEGATE}@anchor{94} @deffn {C Macro} GCC_JIT_UNARY_OP_BITWISE_NEGATE Bitwise negation of an integer value (one's complement); analogous @@ -6392,7 +6422,7 @@ in C. @end deffn @geindex GCC_JIT_UNARY_OP_LOGICAL_NEGATE (C macro) -@anchor{topics/expressions GCC_JIT_UNARY_OP_LOGICAL_NEGATE}@anchor{93} +@anchor{topics/expressions GCC_JIT_UNARY_OP_LOGICAL_NEGATE}@anchor{95} @deffn {C Macro} GCC_JIT_UNARY_OP_LOGICAL_NEGATE Logical negation of an arithmetic or pointer value; analogous to: @@ -6407,7 +6437,7 @@ in C. @end deffn @geindex GCC_JIT_UNARY_OP_ABS (C macro) -@anchor{topics/expressions GCC_JIT_UNARY_OP_ABS}@anchor{94} +@anchor{topics/expressions GCC_JIT_UNARY_OP_ABS}@anchor{96} @deffn {C Macro} GCC_JIT_UNARY_OP_ABS Absolute value of an arithmetic expression; analogous to: @@ -6422,7 +6452,7 @@ in C. @end deffn @node Binary Operations,Comparisons,Unary Operations,Rvalues -@anchor{topics/expressions binary-operations}@anchor{95} +@anchor{topics/expressions binary-operations}@anchor{97} @subsubsection Binary Operations @@ -6434,7 +6464,7 @@ Build a binary operation out of two constituent rvalues. @end deffn @geindex gcc_jit_binary_op (C type) -@anchor{topics/expressions gcc_jit_binary_op}@anchor{96} +@anchor{topics/expressions gcc_jit_binary_op}@anchor{98} @deffn {C Type} enum gcc_jit_binary_op @end deffn @@ -6452,7 +6482,7 @@ C equivalent @item -@pxref{97,,GCC_JIT_BINARY_OP_PLUS} +@pxref{99,,GCC_JIT_BINARY_OP_PLUS} @tab @@ -6460,7 +6490,7 @@ C equivalent @item -@pxref{98,,GCC_JIT_BINARY_OP_MINUS} +@pxref{9a,,GCC_JIT_BINARY_OP_MINUS} @tab @@ -6468,7 +6498,7 @@ C equivalent @item -@pxref{99,,GCC_JIT_BINARY_OP_MULT} +@pxref{9b,,GCC_JIT_BINARY_OP_MULT} @tab @@ -6476,7 +6506,7 @@ C equivalent @item -@pxref{9a,,GCC_JIT_BINARY_OP_DIVIDE} +@pxref{9c,,GCC_JIT_BINARY_OP_DIVIDE} @tab @@ -6484,7 +6514,7 @@ C equivalent @item -@pxref{9b,,GCC_JIT_BINARY_OP_MODULO} +@pxref{9d,,GCC_JIT_BINARY_OP_MODULO} @tab @@ -6492,7 +6522,7 @@ C equivalent @item -@pxref{9c,,GCC_JIT_BINARY_OP_BITWISE_AND} +@pxref{9e,,GCC_JIT_BINARY_OP_BITWISE_AND} @tab @@ -6500,7 +6530,7 @@ C equivalent @item -@pxref{9d,,GCC_JIT_BINARY_OP_BITWISE_XOR} +@pxref{9f,,GCC_JIT_BINARY_OP_BITWISE_XOR} @tab @@ -6508,7 +6538,7 @@ C equivalent @item -@pxref{9e,,GCC_JIT_BINARY_OP_BITWISE_OR} +@pxref{a0,,GCC_JIT_BINARY_OP_BITWISE_OR} @tab @@ -6516,7 +6546,7 @@ C equivalent @item -@pxref{9f,,GCC_JIT_BINARY_OP_LOGICAL_AND} +@pxref{a1,,GCC_JIT_BINARY_OP_LOGICAL_AND} @tab @@ -6524,7 +6554,7 @@ C equivalent @item -@pxref{a0,,GCC_JIT_BINARY_OP_LOGICAL_OR} +@pxref{a2,,GCC_JIT_BINARY_OP_LOGICAL_OR} @tab @@ -6532,7 +6562,7 @@ C equivalent @item -@pxref{a1,,GCC_JIT_BINARY_OP_LSHIFT} +@pxref{a3,,GCC_JIT_BINARY_OP_LSHIFT} @tab @@ -6540,7 +6570,7 @@ C equivalent @item -@pxref{a2,,GCC_JIT_BINARY_OP_RSHIFT} +@pxref{a4,,GCC_JIT_BINARY_OP_RSHIFT} @tab @@ -6550,7 +6580,7 @@ C equivalent @geindex GCC_JIT_BINARY_OP_PLUS (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_PLUS}@anchor{97} +@anchor{topics/expressions GCC_JIT_BINARY_OP_PLUS}@anchor{99} @deffn {C Macro} GCC_JIT_BINARY_OP_PLUS Addition of arithmetic values; analogous to: @@ -6563,11 +6593,11 @@ Addition of arithmetic values; analogous to: in C. -For pointer addition, use @pxref{a3,,gcc_jit_context_new_array_access()}. +For pointer addition, use @pxref{a5,,gcc_jit_context_new_array_access()}. @end deffn @geindex GCC_JIT_BINARY_OP_MINUS (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_MINUS}@anchor{98} +@anchor{topics/expressions GCC_JIT_BINARY_OP_MINUS}@anchor{9a} @deffn {C Macro} GCC_JIT_BINARY_OP_MINUS Subtraction of arithmetic values; analogous to: @@ -6582,7 +6612,7 @@ in C. @end deffn @geindex GCC_JIT_BINARY_OP_MULT (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_MULT}@anchor{99} +@anchor{topics/expressions GCC_JIT_BINARY_OP_MULT}@anchor{9b} @deffn {C Macro} GCC_JIT_BINARY_OP_MULT Multiplication of a pair of arithmetic values; analogous to: @@ -6597,7 +6627,7 @@ in C. @end deffn @geindex GCC_JIT_BINARY_OP_DIVIDE (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_DIVIDE}@anchor{9a} +@anchor{topics/expressions GCC_JIT_BINARY_OP_DIVIDE}@anchor{9c} @deffn {C Macro} GCC_JIT_BINARY_OP_DIVIDE Quotient of division of arithmetic values; analogous to: @@ -6616,7 +6646,7 @@ a floating-point result type indicates floating-point division. @end deffn @geindex GCC_JIT_BINARY_OP_MODULO (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_MODULO}@anchor{9b} +@anchor{topics/expressions GCC_JIT_BINARY_OP_MODULO}@anchor{9d} @deffn {C Macro} GCC_JIT_BINARY_OP_MODULO Remainder of division of arithmetic values; analogous to: @@ -6631,7 +6661,7 @@ in C. @end deffn @geindex GCC_JIT_BINARY_OP_BITWISE_AND (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_BITWISE_AND}@anchor{9c} +@anchor{topics/expressions GCC_JIT_BINARY_OP_BITWISE_AND}@anchor{9e} @deffn {C Macro} GCC_JIT_BINARY_OP_BITWISE_AND Bitwise AND; analogous to: @@ -6646,7 +6676,7 @@ in C. @end deffn @geindex GCC_JIT_BINARY_OP_BITWISE_XOR (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_BITWISE_XOR}@anchor{9d} +@anchor{topics/expressions GCC_JIT_BINARY_OP_BITWISE_XOR}@anchor{9f} @deffn {C Macro} GCC_JIT_BINARY_OP_BITWISE_XOR Bitwise exclusive OR; analogous to: @@ -6661,7 +6691,7 @@ in C. @end deffn @geindex GCC_JIT_BINARY_OP_BITWISE_OR (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_BITWISE_OR}@anchor{9e} +@anchor{topics/expressions GCC_JIT_BINARY_OP_BITWISE_OR}@anchor{a0} @deffn {C Macro} GCC_JIT_BINARY_OP_BITWISE_OR Bitwise inclusive OR; analogous to: @@ -6676,7 +6706,7 @@ in C. @end deffn @geindex GCC_JIT_BINARY_OP_LOGICAL_AND (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_LOGICAL_AND}@anchor{9f} +@anchor{topics/expressions GCC_JIT_BINARY_OP_LOGICAL_AND}@anchor{a1} @deffn {C Macro} GCC_JIT_BINARY_OP_LOGICAL_AND Logical AND; analogous to: @@ -6691,7 +6721,7 @@ in C. @end deffn @geindex GCC_JIT_BINARY_OP_LOGICAL_OR (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_LOGICAL_OR}@anchor{a0} +@anchor{topics/expressions GCC_JIT_BINARY_OP_LOGICAL_OR}@anchor{a2} @deffn {C Macro} GCC_JIT_BINARY_OP_LOGICAL_OR Logical OR; analogous to: @@ -6706,7 +6736,7 @@ in C. @end deffn @geindex GCC_JIT_BINARY_OP_LSHIFT (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_LSHIFT}@anchor{a1} +@anchor{topics/expressions GCC_JIT_BINARY_OP_LSHIFT}@anchor{a3} @deffn {C Macro} GCC_JIT_BINARY_OP_LSHIFT Left shift; analogous to: @@ -6721,7 +6751,7 @@ in C. @end deffn @geindex GCC_JIT_BINARY_OP_RSHIFT (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_RSHIFT}@anchor{a2} +@anchor{topics/expressions GCC_JIT_BINARY_OP_RSHIFT}@anchor{a4} @deffn {C Macro} GCC_JIT_BINARY_OP_RSHIFT Right shift; analogous to: @@ -6736,7 +6766,7 @@ in C. @end deffn @node Comparisons,Function calls,Binary Operations,Rvalues -@anchor{topics/expressions comparisons}@anchor{a4} +@anchor{topics/expressions comparisons}@anchor{a6} @subsubsection Comparisons @@ -6748,7 +6778,7 @@ Build a boolean rvalue out of the comparison of two other rvalues. @end deffn @geindex gcc_jit_comparison (C type) -@anchor{topics/expressions gcc_jit_comparison}@anchor{a5} +@anchor{topics/expressions gcc_jit_comparison}@anchor{a7} @deffn {C Type} enum gcc_jit_comparison @end deffn @@ -6814,12 +6844,12 @@ C equivalent @node Function calls,Type-coercion,Comparisons,Rvalues -@anchor{topics/expressions function-calls}@anchor{a6} +@anchor{topics/expressions function-calls}@anchor{a8} @subsubsection Function calls @geindex gcc_jit_context_new_call (C function) -@anchor{topics/expressions gcc_jit_context_new_call}@anchor{a7} +@anchor{topics/expressions gcc_jit_context_new_call}@anchor{a9} @deffn {C Function} gcc_jit_rvalue * gcc_jit_context_new_call (gcc_jit_context@w{ }*ctxt, gcc_jit_location@w{ }*loc, gcc_jit_function@w{ }*func, int@w{ }numargs, gcc_jit_rvalue@w{ }**args) Given a function and the given table of argument rvalues, construct a @@ -6827,7 +6857,7 @@ call to the function, with the result as an rvalue. @cartouche @quotation Note -@pxref{a7,,gcc_jit_context_new_call()} merely builds a +@pxref{a9,,gcc_jit_context_new_call()} merely builds a @pxref{13,,gcc_jit_rvalue} i.e. an expression that can be evaluated, perhaps as part of a more complicated expression. The call @emph{won't} happen unless you add a statement to a function @@ -6835,7 +6865,7 @@ that evaluates the expression. For example, if you want to call a function and discard the result (or to call a function with @code{void} return type), use -@pxref{a8,,gcc_jit_block_add_eval()}: +@pxref{aa,,gcc_jit_block_add_eval()}: @example /* Add "(void)printf (arg0, arg1);". */ @@ -6854,12 +6884,12 @@ gcc_jit_block_add_eval ( @end deffn @node Type-coercion,,Function calls,Rvalues -@anchor{topics/expressions type-coercion}@anchor{a9} +@anchor{topics/expressions type-coercion}@anchor{ab} @subsubsection Type-coercion @geindex gcc_jit_context_new_cast (C function) -@anchor{topics/expressions gcc_jit_context_new_cast}@anchor{aa} +@anchor{topics/expressions gcc_jit_context_new_cast}@anchor{ac} @deffn {C Function} gcc_jit_rvalue * gcc_jit_context_new_cast (gcc_jit_context@w{ }*ctxt, gcc_jit_location@w{ }*loc, gcc_jit_rvalue@w{ }*rvalue, gcc_jit_type@w{ }*type) Given an rvalue of T, construct another rvalue of another type. @@ -6884,7 +6914,7 @@ P* <-> Q*, for pointer types P and Q @end deffn @node Lvalues,Working with pointers structs and unions,Rvalues,Expressions -@anchor{topics/expressions lvalues}@anchor{ab} +@anchor{topics/expressions lvalues}@anchor{ad} @subsection Lvalues @@ -6898,21 +6928,21 @@ a storage area (such as a variable). It is also usable as an rvalue, where the rvalue is computed by reading from the storage area. @geindex gcc_jit_lvalue_as_object (C function) -@anchor{topics/expressions gcc_jit_lvalue_as_object}@anchor{ac} +@anchor{topics/expressions gcc_jit_lvalue_as_object}@anchor{ae} @deffn {C Function} gcc_jit_object * gcc_jit_lvalue_as_object (gcc_jit_lvalue@w{ }*lvalue) Upcast an lvalue to be an object. @end deffn @geindex gcc_jit_lvalue_as_rvalue (C function) -@anchor{topics/expressions gcc_jit_lvalue_as_rvalue}@anchor{ad} +@anchor{topics/expressions gcc_jit_lvalue_as_rvalue}@anchor{af} @deffn {C Function} gcc_jit_rvalue * gcc_jit_lvalue_as_rvalue (gcc_jit_lvalue@w{ }*lvalue) Upcast an lvalue to be an rvalue. @end deffn @geindex gcc_jit_lvalue_get_address (C function) -@anchor{topics/expressions gcc_jit_lvalue_get_address}@anchor{ae} +@anchor{topics/expressions gcc_jit_lvalue_get_address}@anchor{b0} @deffn {C Function} gcc_jit_rvalue * gcc_jit_lvalue_get_address (gcc_jit_lvalue@w{ }*lvalue, gcc_jit_location@w{ }*loc) Take the address of an lvalue; analogous to: @@ -6932,12 +6962,12 @@ in C. @end menu @node Global variables,,,Lvalues -@anchor{topics/expressions global-variables}@anchor{af} +@anchor{topics/expressions global-variables}@anchor{b1} @subsubsection Global variables @geindex gcc_jit_context_new_global (C function) -@anchor{topics/expressions gcc_jit_context_new_global}@anchor{b0} +@anchor{topics/expressions gcc_jit_context_new_global}@anchor{b2} @deffn {C Function} gcc_jit_lvalue * gcc_jit_context_new_global (gcc_jit_context@w{ }*ctxt, gcc_jit_location@w{ }*loc, enum gcc_jit_global_kind@w{ }kind, gcc_jit_type@w{ }*type, const char@w{ }*name) Add a new global variable of the given type and name to the context. @@ -6946,22 +6976,22 @@ The "kind" parameter determines the visibility of the "global" outside of the @pxref{16,,gcc_jit_result}: @geindex gcc_jit_global_kind (C type) -@anchor{topics/expressions gcc_jit_global_kind}@anchor{b1} +@anchor{topics/expressions gcc_jit_global_kind}@anchor{b3} @deffn {C Type} enum gcc_jit_global_kind @end deffn @geindex GCC_JIT_GLOBAL_EXPORTED (C macro) -@anchor{topics/expressions GCC_JIT_GLOBAL_EXPORTED}@anchor{b2} +@anchor{topics/expressions GCC_JIT_GLOBAL_EXPORTED}@anchor{b4} @deffn {C Macro} GCC_JIT_GLOBAL_EXPORTED Global is defined by the client code and is visible by name outside of this JIT context via -@pxref{b3,,gcc_jit_result_get_global()} (and this value is required for +@pxref{b5,,gcc_jit_result_get_global()} (and this value is required for the global to be accessible via that entrypoint). @end deffn @geindex GCC_JIT_GLOBAL_INTERNAL (C macro) -@anchor{topics/expressions GCC_JIT_GLOBAL_INTERNAL}@anchor{b4} +@anchor{topics/expressions GCC_JIT_GLOBAL_INTERNAL}@anchor{b6} @deffn {C Macro} GCC_JIT_GLOBAL_INTERNAL Global is defined by the client code, but is invisible @@ -6971,7 +7001,7 @@ context and within child contexts. @end deffn @geindex GCC_JIT_GLOBAL_IMPORTED (C macro) -@anchor{topics/expressions GCC_JIT_GLOBAL_IMPORTED}@anchor{b5} +@anchor{topics/expressions GCC_JIT_GLOBAL_IMPORTED}@anchor{b7} @deffn {C Macro} GCC_JIT_GLOBAL_IMPORTED Global is not defined by the client code; we're merely @@ -6981,12 +7011,12 @@ header file. @end deffn @node Working with pointers structs and unions,,Lvalues,Expressions -@anchor{topics/expressions working-with-pointers-structs-and-unions}@anchor{b6} +@anchor{topics/expressions working-with-pointers-structs-and-unions}@anchor{b8} @subsection Working with pointers, structs and unions @geindex gcc_jit_rvalue_dereference (C function) -@anchor{topics/expressions gcc_jit_rvalue_dereference}@anchor{b7} +@anchor{topics/expressions gcc_jit_rvalue_dereference}@anchor{b9} @deffn {C Function} gcc_jit_lvalue * gcc_jit_rvalue_dereference (gcc_jit_rvalue@w{ }*rvalue, gcc_jit_location@w{ }*loc) Given an rvalue of pointer type @code{T *}, dereferencing the pointer, @@ -7004,7 +7034,7 @@ in C. Field access is provided separately for both lvalues and rvalues. @geindex gcc_jit_lvalue_access_field (C function) -@anchor{topics/expressions gcc_jit_lvalue_access_field}@anchor{b8} +@anchor{topics/expressions gcc_jit_lvalue_access_field}@anchor{ba} @deffn {C Function} gcc_jit_lvalue * gcc_jit_lvalue_access_field (gcc_jit_lvalue@w{ }*struct_, gcc_jit_location@w{ }*loc, gcc_jit_field@w{ }*field) Given an lvalue of struct or union type, access the given field, @@ -7020,7 +7050,7 @@ in C. @end deffn @geindex gcc_jit_rvalue_access_field (C function) -@anchor{topics/expressions gcc_jit_rvalue_access_field}@anchor{b9} +@anchor{topics/expressions gcc_jit_rvalue_access_field}@anchor{bb} @deffn {C Function} gcc_jit_rvalue * gcc_jit_rvalue_access_field (gcc_jit_rvalue@w{ }*struct_, gcc_jit_location@w{ }*loc, gcc_jit_field@w{ }*field) Given an rvalue of struct or union type, access the given field @@ -7036,7 +7066,7 @@ in C. @end deffn @geindex gcc_jit_rvalue_dereference_field (C function) -@anchor{topics/expressions gcc_jit_rvalue_dereference_field}@anchor{ba} +@anchor{topics/expressions gcc_jit_rvalue_dereference_field}@anchor{bc} @deffn {C Function} gcc_jit_lvalue * gcc_jit_rvalue_dereference_field (gcc_jit_rvalue@w{ }*ptr, gcc_jit_location@w{ }*loc, gcc_jit_field@w{ }*field) Given an rvalue of pointer type @code{T *} where T is of struct or union @@ -7052,7 +7082,7 @@ in C, itself equivalent to @code{(*EXPR).FIELD}. @end deffn @geindex gcc_jit_context_new_array_access (C function) -@anchor{topics/expressions gcc_jit_context_new_array_access}@anchor{a3} +@anchor{topics/expressions gcc_jit_context_new_array_access}@anchor{a5} @deffn {C Function} gcc_jit_lvalue * gcc_jit_context_new_array_access (gcc_jit_context@w{ }*ctxt, gcc_jit_location@w{ }*loc, gcc_jit_rvalue@w{ }*ptr, gcc_jit_rvalue@w{ }*index) Given an rvalue of pointer type @code{T *}, get at the element @cite{T} at @@ -7087,7 +7117,7 @@ in C (or, indeed, to @code{PTR + INDEX}). @c . @node Creating and using functions,Source Locations,Expressions,Topic Reference -@anchor{topics/functions doc}@anchor{bb}@anchor{topics/functions creating-and-using-functions}@anchor{bc} +@anchor{topics/functions doc}@anchor{bd}@anchor{topics/functions creating-and-using-functions}@anchor{be} @section Creating and using functions @@ -7100,7 +7130,7 @@ in C (or, indeed, to @code{PTR + INDEX}). @end menu @node Params,Functions,,Creating and using functions -@anchor{topics/functions params}@anchor{bd} +@anchor{topics/functions params}@anchor{bf} @subsection Params @@ -7123,28 +7153,28 @@ Parameters are lvalues, and thus are also rvalues (and objects), so the following upcasts are available: @geindex gcc_jit_param_as_lvalue (C function) -@anchor{topics/functions gcc_jit_param_as_lvalue}@anchor{be} +@anchor{topics/functions gcc_jit_param_as_lvalue}@anchor{c0} @deffn {C Function} gcc_jit_lvalue * gcc_jit_param_as_lvalue (gcc_jit_param@w{ }*param) Upcasting from param to lvalue. @end deffn @geindex gcc_jit_param_as_rvalue (C function) -@anchor{topics/functions gcc_jit_param_as_rvalue}@anchor{bf} +@anchor{topics/functions gcc_jit_param_as_rvalue}@anchor{c1} @deffn {C Function} gcc_jit_rvalue * gcc_jit_param_as_rvalue (gcc_jit_param@w{ }*param) Upcasting from param to rvalue. @end deffn @geindex gcc_jit_param_as_object (C function) -@anchor{topics/functions gcc_jit_param_as_object}@anchor{c0} +@anchor{topics/functions gcc_jit_param_as_object}@anchor{c2} @deffn {C Function} gcc_jit_object * gcc_jit_param_as_object (gcc_jit_param@w{ }*param) Upcasting from param to object. @end deffn @node Functions,Blocks,Params,Creating and using functions -@anchor{topics/functions functions}@anchor{c1} +@anchor{topics/functions functions}@anchor{c3} @subsection Functions @@ -7163,7 +7193,7 @@ creating ourselves, or one that we're referencing. Create a gcc_jit_function with the given name and parameters. @geindex gcc_jit_function_kind (C type) -@anchor{topics/functions gcc_jit_function_kind}@anchor{c2} +@anchor{topics/functions gcc_jit_function_kind}@anchor{c4} @deffn {C Type} enum gcc_jit_function_kind @end deffn @@ -7173,7 +7203,7 @@ values: @quotation @geindex GCC_JIT_FUNCTION_EXPORTED (C macro) -@anchor{topics/functions GCC_JIT_FUNCTION_EXPORTED}@anchor{c3} +@anchor{topics/functions GCC_JIT_FUNCTION_EXPORTED}@anchor{c5} @deffn {C Macro} GCC_JIT_FUNCTION_EXPORTED Function is defined by the client code and visible @@ -7185,7 +7215,7 @@ for this function from a @pxref{16,,gcc_jit_result} via @end deffn @geindex GCC_JIT_FUNCTION_INTERNAL (C macro) -@anchor{topics/functions GCC_JIT_FUNCTION_INTERNAL}@anchor{c4} +@anchor{topics/functions GCC_JIT_FUNCTION_INTERNAL}@anchor{c6} @deffn {C Macro} GCC_JIT_FUNCTION_INTERNAL Function is defined by the client code, but is invisible @@ -7193,7 +7223,7 @@ outside of the JIT. Analogous to a "static" function. @end deffn @geindex GCC_JIT_FUNCTION_IMPORTED (C macro) -@anchor{topics/functions GCC_JIT_FUNCTION_IMPORTED}@anchor{c5} +@anchor{topics/functions GCC_JIT_FUNCTION_IMPORTED}@anchor{c7} @deffn {C Macro} GCC_JIT_FUNCTION_IMPORTED Function is not defined by the client code; we're merely @@ -7202,7 +7232,7 @@ header file. @end deffn @geindex GCC_JIT_FUNCTION_ALWAYS_INLINE (C macro) -@anchor{topics/functions GCC_JIT_FUNCTION_ALWAYS_INLINE}@anchor{c6} +@anchor{topics/functions GCC_JIT_FUNCTION_ALWAYS_INLINE}@anchor{c8} @deffn {C Macro} GCC_JIT_FUNCTION_ALWAYS_INLINE Function is only ever inlined into other functions, and is @@ -7219,19 +7249,19 @@ same as GCC_JIT_FUNCTION_INTERNAL. @end deffn @geindex gcc_jit_context_get_builtin_function (C function) -@anchor{topics/functions gcc_jit_context_get_builtin_function}@anchor{c7} +@anchor{topics/functions gcc_jit_context_get_builtin_function}@anchor{c9} @deffn {C Function} gcc_jit_function *gcc_jit_context_get_builtin_function (gcc_jit_context@w{ }*ctxt, const char@w{ }*name) @end deffn @geindex gcc_jit_function_as_object (C function) -@anchor{topics/functions gcc_jit_function_as_object}@anchor{c8} +@anchor{topics/functions gcc_jit_function_as_object}@anchor{ca} @deffn {C Function} gcc_jit_object * gcc_jit_function_as_object (gcc_jit_function@w{ }*func) Upcasting from function to object. @end deffn @geindex gcc_jit_function_get_param (C function) -@anchor{topics/functions gcc_jit_function_get_param}@anchor{c9} +@anchor{topics/functions gcc_jit_function_get_param}@anchor{cb} @deffn {C Function} gcc_jit_param * gcc_jit_function_get_param (gcc_jit_function@w{ }*func, int@w{ }index) Get the param of the given index (0-based). @@ -7253,7 +7283,7 @@ name. @end deffn @node Blocks,Statements,Functions,Creating and using functions -@anchor{topics/functions blocks}@anchor{ca} +@anchor{topics/functions blocks}@anchor{cc} @subsection Blocks @@ -7276,7 +7306,7 @@ one function. @end deffn @geindex gcc_jit_function_new_block (C function) -@anchor{topics/functions gcc_jit_function_new_block}@anchor{cb} +@anchor{topics/functions gcc_jit_function_new_block}@anchor{cd} @deffn {C Function} gcc_jit_block * gcc_jit_function_new_block (gcc_jit_function@w{ }*func, const char@w{ }*name) Create a basic block of the given name. The name may be NULL, but @@ -7286,26 +7316,26 @@ messages. @end deffn @geindex gcc_jit_block_as_object (C function) -@anchor{topics/functions gcc_jit_block_as_object}@anchor{cc} +@anchor{topics/functions gcc_jit_block_as_object}@anchor{ce} @deffn {C Function} gcc_jit_object * gcc_jit_block_as_object (gcc_jit_block@w{ }*block) Upcast from block to object. @end deffn @geindex gcc_jit_block_get_function (C function) -@anchor{topics/functions gcc_jit_block_get_function}@anchor{cd} +@anchor{topics/functions gcc_jit_block_get_function}@anchor{cf} @deffn {C Function} gcc_jit_function * gcc_jit_block_get_function (gcc_jit_block@w{ }*block) Which function is this block within? @end deffn @node Statements,,Blocks,Creating and using functions -@anchor{topics/functions statements}@anchor{ce} +@anchor{topics/functions statements}@anchor{d0} @subsection Statements @geindex gcc_jit_block_add_eval (C function) -@anchor{topics/functions gcc_jit_block_add_eval}@anchor{a8} +@anchor{topics/functions gcc_jit_block_add_eval}@anchor{aa} @deffn {C Function} void gcc_jit_block_add_eval (gcc_jit_block@w{ }*block, gcc_jit_location@w{ }*loc, gcc_jit_rvalue@w{ }*rvalue) Add evaluation of an rvalue, discarding the result @@ -7401,7 +7431,7 @@ block, boolval, on_true, and on_false must be non-NULL. @end deffn @geindex gcc_jit_block_end_with_jump (C function) -@anchor{topics/functions gcc_jit_block_end_with_jump}@anchor{cf} +@anchor{topics/functions gcc_jit_block_end_with_jump}@anchor{d1} @deffn {C Function} void gcc_jit_block_end_with_jump (gcc_jit_block@w{ }*block, gcc_jit_location@w{ }*loc, gcc_jit_block@w{ }*target) Terminate a block by adding a jump to the given target block. @@ -7416,7 +7446,7 @@ goto target; @end deffn @geindex gcc_jit_block_end_with_return (C function) -@anchor{topics/functions gcc_jit_block_end_with_return}@anchor{d0} +@anchor{topics/functions gcc_jit_block_end_with_return}@anchor{d2} @deffn {C Function} void gcc_jit_block_end_with_return (gcc_jit_block@w{ }*block, gcc_jit_location@w{ }*loc, gcc_jit_rvalue@w{ }*rvalue) Terminate a block by adding evaluation of an rvalue, returning the value. @@ -7431,7 +7461,7 @@ return expression; @end deffn @geindex gcc_jit_block_end_with_void_return (C function) -@anchor{topics/functions gcc_jit_block_end_with_void_return}@anchor{d1} +@anchor{topics/functions gcc_jit_block_end_with_void_return}@anchor{d3} @deffn {C Function} void gcc_jit_block_end_with_void_return (gcc_jit_block@w{ }*block, gcc_jit_location@w{ }*loc) Terminate a block by adding a valueless return, for use within a function @@ -7464,7 +7494,7 @@ return; @c . @node Source Locations,Compiling a context,Creating and using functions,Topic Reference -@anchor{topics/locations source-locations}@anchor{d2}@anchor{topics/locations doc}@anchor{d3} +@anchor{topics/locations source-locations}@anchor{d4}@anchor{topics/locations doc}@anchor{d5} @section Source Locations @@ -7510,7 +7540,7 @@ location. @end menu @node Faking it,,,Source Locations -@anchor{topics/locations faking-it}@anchor{d4} +@anchor{topics/locations faking-it}@anchor{d6} @subsection Faking it @@ -7548,7 +7578,7 @@ file, giving you @emph{something} you can step through in the debugger. @c . @node Compiling a context,ABI and API compatibility,Source Locations,Topic Reference -@anchor{topics/compilation compiling-a-context}@anchor{d5}@anchor{topics/compilation doc}@anchor{d6} +@anchor{topics/compilation compiling-a-context}@anchor{d7}@anchor{topics/compilation doc}@anchor{d8} @section Compiling a context @@ -7567,7 +7597,7 @@ prevent any future compilation of that context. @end menu @node In-memory compilation,Ahead-of-time compilation,,Compiling a context -@anchor{topics/compilation in-memory-compilation}@anchor{d7} +@anchor{topics/compilation in-memory-compilation}@anchor{d9} @subsection In-memory compilation @@ -7602,7 +7632,7 @@ Functions are looked up by name. For this to succeed, a function with a name matching @cite{funcname} must have been created on @cite{result}'s context (or a parent context) via a call to @pxref{11,,gcc_jit_context_new_function()} with @cite{kind} -@pxref{c3,,GCC_JIT_FUNCTION_EXPORTED}: +@pxref{c5,,GCC_JIT_FUNCTION_EXPORTED}: @example gcc_jit_context_new_function (ctxt, @@ -7632,7 +7662,7 @@ to a segmentation fault. @end deffn @geindex gcc_jit_result_get_global (C function) -@anchor{topics/compilation gcc_jit_result_get_global}@anchor{b3} +@anchor{topics/compilation gcc_jit_result_get_global}@anchor{b5} @deffn {C Function} void * gcc_jit_result_get_global (gcc_jit_result@w{ }*result, const char@w{ }*name) Locate a given global within the built machine code. @@ -7640,8 +7670,8 @@ Locate a given global within the built machine code. Globals are looked up by name. For this to succeed, a global with a name matching @cite{name} must have been created on @cite{result}'s context (or a parent context) via a call to -@pxref{b0,,gcc_jit_context_new_global()} with @cite{kind} -@pxref{b2,,GCC_JIT_GLOBAL_EXPORTED}. +@pxref{b2,,gcc_jit_context_new_global()} with @cite{kind} +@pxref{b4,,GCC_JIT_GLOBAL_EXPORTED}. If the global is found, the result will need to be cast to a pointer of the correct type before it can be called. @@ -7689,11 +7719,11 @@ Once we're done with the code, this unloads the built .so file. This cleans up the result; after calling this, it's no longer valid to use the result, or any code or globals that were obtained by calling @pxref{17,,gcc_jit_result_get_code()} or -@pxref{b3,,gcc_jit_result_get_global()} on it. +@pxref{b5,,gcc_jit_result_get_global()} on it. @end deffn @node Ahead-of-time compilation,,In-memory compilation,Compiling a context -@anchor{topics/compilation ahead-of-time-compilation}@anchor{d8} +@anchor{topics/compilation ahead-of-time-compilation}@anchor{da} @subsection Ahead-of-time compilation @@ -7722,7 +7752,7 @@ suffix of the output file when determining what to do. @end cartouche @geindex gcc_jit_output_kind (C type) -@anchor{topics/compilation gcc_jit_output_kind}@anchor{d9} +@anchor{topics/compilation gcc_jit_output_kind}@anchor{db} @deffn {C Type} enum gcc_jit_output_kind @end deffn @@ -7740,7 +7770,7 @@ Typical suffix @item -@pxref{da,,GCC_JIT_OUTPUT_KIND_ASSEMBLER} +@pxref{dc,,GCC_JIT_OUTPUT_KIND_ASSEMBLER} @tab @@ -7748,7 +7778,7 @@ Typical suffix @item -@pxref{db,,GCC_JIT_OUTPUT_KIND_OBJECT_FILE} +@pxref{dd,,GCC_JIT_OUTPUT_KIND_OBJECT_FILE} @tab @@ -7756,7 +7786,7 @@ Typical suffix @item -@pxref{dc,,GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY} +@pxref{de,,GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY} @tab @@ -7764,7 +7794,7 @@ Typical suffix @item -@pxref{dd,,GCC_JIT_OUTPUT_KIND_EXECUTABLE} +@pxref{df,,GCC_JIT_OUTPUT_KIND_EXECUTABLE} @tab @@ -7774,21 +7804,21 @@ None, or .exe @geindex GCC_JIT_OUTPUT_KIND_ASSEMBLER (C macro) -@anchor{topics/compilation GCC_JIT_OUTPUT_KIND_ASSEMBLER}@anchor{da} +@anchor{topics/compilation GCC_JIT_OUTPUT_KIND_ASSEMBLER}@anchor{dc} @deffn {C Macro} GCC_JIT_OUTPUT_KIND_ASSEMBLER Compile the context to an assembler file. @end deffn @geindex GCC_JIT_OUTPUT_KIND_OBJECT_FILE (C macro) -@anchor{topics/compilation GCC_JIT_OUTPUT_KIND_OBJECT_FILE}@anchor{db} +@anchor{topics/compilation GCC_JIT_OUTPUT_KIND_OBJECT_FILE}@anchor{dd} @deffn {C Macro} GCC_JIT_OUTPUT_KIND_OBJECT_FILE Compile the context to an object file. @end deffn @geindex GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY (C macro) -@anchor{topics/compilation GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY}@anchor{dc} +@anchor{topics/compilation GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY}@anchor{de} @deffn {C Macro} GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY Compile the context to a dynamic library. @@ -7798,7 +7828,7 @@ against. @end deffn @geindex GCC_JIT_OUTPUT_KIND_EXECUTABLE (C macro) -@anchor{topics/compilation GCC_JIT_OUTPUT_KIND_EXECUTABLE}@anchor{dd} +@anchor{topics/compilation GCC_JIT_OUTPUT_KIND_EXECUTABLE}@anchor{df} @deffn {C Macro} GCC_JIT_OUTPUT_KIND_EXECUTABLE Compile the context to an executable. @@ -7825,7 +7855,7 @@ against. @c . @node ABI and API compatibility,,Compiling a context,Topic Reference -@anchor{topics/compatibility abi-and-api-compatibility}@anchor{de}@anchor{topics/compatibility doc}@anchor{df} +@anchor{topics/compatibility abi-and-api-compatibility}@anchor{e0}@anchor{topics/compatibility doc}@anchor{e1} @section ABI and API compatibility @@ -7847,7 +7877,7 @@ it. For ABI compatiblity, we avoid bumping the SONAME, and instead use symbol versioning to tag each symbol, so that a binary linked against libgccjit.so is tagged according to the symbols that it uses. -For example, @pxref{6e,,gcc_jit_context_add_command_line_option()} was added in +For example, @pxref{70,,gcc_jit_context_add_command_line_option()} was added in @code{LIBGCCJIT_ABI_1}. If a client program uses it, this can be detected from metadata by using @code{objdump}: @@ -7886,12 +7916,13 @@ ABI symbol tags * LIBGCCJIT_ABI_0:: * LIBGCCJIT_ABI_1:: +* LIBGCCJIT_ABI_2:: @end menu @node ABI symbol tags,,,ABI and API compatibility -@anchor{topics/compatibility abi-symbol-tags}@anchor{e0} +@anchor{topics/compatibility abi-symbol-tags}@anchor{e2} @subsection ABI symbol tags @@ -7902,11 +7933,12 @@ Newer releases use the following tags. @menu * LIBGCCJIT_ABI_0:: * LIBGCCJIT_ABI_1:: +* LIBGCCJIT_ABI_2:: @end menu @node LIBGCCJIT_ABI_0,LIBGCCJIT_ABI_1,,ABI symbol tags -@anchor{topics/compatibility libgccjit-abi-0}@anchor{e1}@anchor{topics/compatibility id1}@anchor{e2} +@anchor{topics/compatibility libgccjit-abi-0}@anchor{e3}@anchor{topics/compatibility id1}@anchor{e4} @subsubsection @code{LIBGCCJIT_ABI_0} @@ -7917,13 +7949,21 @@ Binaries built against older copies of @code{libgccjit.so} should continue to work, with this being handled transparently by the linker (see this post@footnote{https://gcc.gnu.org/ml/gcc-patches/2015-06/msg02126.html}) -@node LIBGCCJIT_ABI_1,,LIBGCCJIT_ABI_0,ABI symbol tags -@anchor{topics/compatibility libgccjit-abi-1}@anchor{6f}@anchor{topics/compatibility id2}@anchor{e3} +@node LIBGCCJIT_ABI_1,LIBGCCJIT_ABI_2,LIBGCCJIT_ABI_0,ABI symbol tags +@anchor{topics/compatibility libgccjit-abi-1}@anchor{71}@anchor{topics/compatibility id2}@anchor{e5} @subsubsection @code{LIBGCCJIT_ABI_1} @code{LIBGCCJIT_ABI_1} covers the addition of -@pxref{6e,,gcc_jit_context_add_command_line_option()} +@pxref{70,,gcc_jit_context_add_command_line_option()} + +@node LIBGCCJIT_ABI_2,,LIBGCCJIT_ABI_1,ABI symbol tags +@anchor{topics/compatibility libgccjit-abi-2}@anchor{6c}@anchor{topics/compatibility id3}@anchor{e6} +@subsubsection @code{LIBGCCJIT_ABI_2} + + +@code{LIBGCCJIT_ABI_2} covers the addition of +@pxref{6b,,gcc_jit_context_set_bool_allow_unreachable_blocks()} @c Copyright (C) 2014-2015 Free Software Foundation, Inc. @c Originally contributed by David Malcolm @@ -7943,7 +7983,7 @@ continue to work, with this being handled transparently by the linker @c . @node C++ bindings for libgccjit,Internals,Topic Reference,Top -@anchor{cp/index c-bindings-for-libgccjit}@anchor{e4}@anchor{cp/index doc}@anchor{e5} +@anchor{cp/index c-bindings-for-libgccjit}@anchor{e7}@anchor{cp/index doc}@anchor{e8} @chapter C++ bindings for libgccjit @@ -8091,7 +8131,7 @@ Compiling a context @node Tutorial<2>,Topic Reference<2>,,C++ bindings for libgccjit -@anchor{cp/intro/index doc}@anchor{e6}@anchor{cp/intro/index tutorial}@anchor{e7} +@anchor{cp/intro/index doc}@anchor{e9}@anchor{cp/intro/index tutorial}@anchor{ea} @section Tutorial @@ -8121,7 +8161,7 @@ Compiling a context @end menu @node Tutorial part 1 "Hello world"<2>,Tutorial part 2 Creating a trivial machine code function<2>,,Tutorial<2> -@anchor{cp/intro/tutorial01 doc}@anchor{e8}@anchor{cp/intro/tutorial01 tutorial-part-1-hello-world}@anchor{e9} +@anchor{cp/intro/tutorial01 doc}@anchor{eb}@anchor{cp/intro/tutorial01 tutorial-part-1-hello-world}@anchor{ec} @subsection Tutorial part 1: "Hello world" @@ -8291,7 +8331,7 @@ hello world @c . @node Tutorial part 2 Creating a trivial machine code function<2>,Tutorial part 3 Loops and variables<2>,Tutorial part 1 "Hello world"<2>,Tutorial<2> -@anchor{cp/intro/tutorial02 doc}@anchor{ea}@anchor{cp/intro/tutorial02 tutorial-part-2-creating-a-trivial-machine-code-function}@anchor{eb} +@anchor{cp/intro/tutorial02 doc}@anchor{ed}@anchor{cp/intro/tutorial02 tutorial-part-2-creating-a-trivial-machine-code-function}@anchor{ee} @subsection Tutorial part 2: Creating a trivial machine code function @@ -8320,7 +8360,7 @@ All state associated with compilation is associated with a @code{gccjit::context}, which is a thin C++ wrapper around the C API's @pxref{8,,gcc_jit_context *}. -Create one using @pxref{ec,,gccjit;;context;;acquire()}: +Create one using @pxref{ef,,gccjit;;context;;acquire()}: @example gccjit::context ctxt; @@ -8333,7 +8373,7 @@ The JIT library has a system of types. It is statically-typed: every expression is of a specific type, fixed at compile-time. In our example, all of the expressions are of the C @cite{int} type, so let's obtain this from the context, as a @code{gccjit::type}, using -@pxref{ed,,gccjit;;context;;get_type()}: +@pxref{f0,,gccjit;;context;;get_type()}: @example gccjit::type int_type = ctxt.get_type (GCC_JIT_TYPE_INT); @@ -8346,7 +8386,7 @@ entity in the API is associated with a @code{gccjit::context}. Memory management is easy: all such "contextual" objects are automatically cleaned up for you when the context is released, using -@pxref{ee,,gccjit;;context;;release()}: +@pxref{f1,,gccjit;;context;;release()}: @example ctxt.release (); @@ -8379,7 +8419,7 @@ The C++ class hierarchy within the @code{gccjit} namespace looks like this: One thing you can do with a @code{gccjit::object} is to ask it for a human-readable description as a @code{std::string}, using -@pxref{ef,,gccjit;;object;;get_debug_string()}: +@pxref{f2,,gccjit;;object;;get_debug_string()}: @example printf ("obj: %s\n", obj.get_debug_string ().c_str ()); @@ -8399,7 +8439,7 @@ This is invaluable when debugging. Let's create the function. To do so, we first need to construct its single parameter, specifying its type and giving it a name, -using @pxref{f0,,gccjit;;context;;new_param()}: +using @pxref{f3,,gccjit;;context;;new_param()}: @example gccjit::param param_i = ctxt.new_param (int_type, "i"); @@ -8448,7 +8488,7 @@ gccjit::block block = func.new_block (); Our basic block is relatively simple: it immediately terminates by returning the value of an expression. -We can build the expression using @pxref{f1,,gccjit;;context;;new_binary_op()}: +We can build the expression using @pxref{f4,,gccjit;;context;;new_binary_op()}: @example gccjit::rvalue expr = @@ -8461,7 +8501,7 @@ gccjit::rvalue expr = A @code{gccjit::rvalue} is another example of a @code{gccjit::object} subclass. As before, we can print it with -@pxref{ef,,gccjit;;object;;get_debug_string()}. +@pxref{f2,,gccjit;;object;;get_debug_string()}. @example printf ("expr: %s\n", expr.get_debug_string ().c_str ()); @@ -8498,7 +8538,7 @@ block.end_with_return (expr); @noindent OK, we've populated the context. We can now compile it using -@pxref{f2,,gccjit;;context;;compile()}: +@pxref{f5,,gccjit;;context;;compile()}: @example gcc_jit_result *result; @@ -8548,12 +8588,12 @@ result: 25 @end menu @node Options<3>,Full example<3>,,Tutorial part 2 Creating a trivial machine code function<2> -@anchor{cp/intro/tutorial02 options}@anchor{f3} +@anchor{cp/intro/tutorial02 options}@anchor{f6} @subsubsection Options To get more information on what's going on, you can set debugging flags -on the context using @pxref{f4,,gccjit;;context;;set_bool_option()}. +on the context using @pxref{f7,,gccjit;;context;;set_bool_option()}. @c (I'm deliberately not mentioning @c :c:macro:`GCC_JIT_BOOL_OPTION_DUMP_INITIAL_TREE` here since I think @@ -8625,7 +8665,7 @@ square: By default, no optimizations are performed, the equivalent of GCC's @cite{-O0} option. We can turn things up to e.g. @cite{-O3} by calling -@pxref{f5,,gccjit;;context;;set_int_option()} with +@pxref{f8,,gccjit;;context;;set_int_option()} with @pxref{1f,,GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL}: @example @@ -8659,7 +8699,7 @@ square: Naturally this has only a small effect on such a trivial function. @node Full example<3>,,Options<3>,Tutorial part 2 Creating a trivial machine code function<2> -@anchor{cp/intro/tutorial02 full-example}@anchor{f6} +@anchor{cp/intro/tutorial02 full-example}@anchor{f9} @subsubsection Full example @@ -8802,7 +8842,7 @@ result: 25 @c . @node Tutorial part 3 Loops and variables<2>,Tutorial part 4 Adding JIT-compilation to a toy interpreter<2>,Tutorial part 2 Creating a trivial machine code function<2>,Tutorial<2> -@anchor{cp/intro/tutorial03 tutorial-part-3-loops-and-variables}@anchor{f7}@anchor{cp/intro/tutorial03 doc}@anchor{f8} +@anchor{cp/intro/tutorial03 tutorial-part-3-loops-and-variables}@anchor{fa}@anchor{cp/intro/tutorial03 doc}@anchor{fb} @subsection Tutorial part 3: Loops and variables @@ -8926,7 +8966,7 @@ gccjit::function func = @end menu @node Expressions lvalues and rvalues<2>,Control flow<2>,,Tutorial part 3 Loops and variables<2> -@anchor{cp/intro/tutorial03 expressions-lvalues-and-rvalues}@anchor{f9} +@anchor{cp/intro/tutorial03 expressions-lvalues-and-rvalues}@anchor{fc} @subsubsection Expressions: lvalues and rvalues @@ -8999,7 +9039,7 @@ body of a function. Our new example has a new kind of expression: we have two local variables. We create them by calling -@pxref{fa,,gccjit;;function;;new_local()}, supplying a type and a name: +@pxref{fd,,gccjit;;function;;new_local()}, supplying a type and a name: @example /* Build locals: */ @@ -9025,7 +9065,7 @@ Instead, having added the local to the function, we have to separately add an assignment of @cite{0} to @cite{local_i} at the beginning of the function. @node Control flow<2>,Visualizing the control flow graph<2>,Expressions lvalues and rvalues<2>,Tutorial part 3 Loops and variables<2> -@anchor{cp/intro/tutorial03 control-flow}@anchor{fb} +@anchor{cp/intro/tutorial03 control-flow}@anchor{fe} @subsubsection Control flow @@ -9064,8 +9104,8 @@ We now populate each block with statements. The entry block @cite{b_initial} consists of initializations followed by a jump to the conditional. We assign @cite{0} to @cite{i} and to @cite{sum}, using -@pxref{fc,,gccjit;;block;;add_assignment()} to add -an assignment statement, and using @pxref{fd,,gccjit;;context;;zero()} to get +@pxref{ff,,gccjit;;block;;add_assignment()} to add +an assignment statement, and using @pxref{100,,gccjit;;context;;zero()} to get the constant value @cite{0} for the relevant type for the right-hand side of the assignment: @@ -9092,7 +9132,7 @@ C example. It contains a single statement: a conditional, which jumps to one of two destination blocks depending on a boolean @code{gccjit::rvalue}, in this case the comparison of @cite{i} and @cite{n}. -We could build the comparison using @pxref{fe,,gccjit;;context;;new_comparison()}: +We could build the comparison using @pxref{101,,gccjit;;context;;new_comparison()}: @example gccjit::rvalue guard = @@ -9103,7 +9143,7 @@ gccjit::rvalue guard = @noindent and can then use this to add @cite{b_loop_cond}'s sole statement, via -@pxref{ff,,gccjit;;block;;end_with_conditional()}: +@pxref{102,,gccjit;;block;;end_with_conditional()}: @example b_loop_cond.end_with_conditional (guard, @@ -9137,7 +9177,7 @@ Next, we populate the body of the loop. The C statement @cite{sum += i * i;} is an assignment operation, where an lvalue is modified "in-place". We use -@pxref{100,,gccjit;;block;;add_assignment_op()} to handle these operations: +@pxref{103,,gccjit;;block;;add_assignment_op()} to handle these operations: @example /* sum += i * i */ @@ -9165,7 +9205,7 @@ b_loop_body.add_assignment_op (i, @cartouche @quotation Note For numeric constants other than 0 or 1, we could use -@pxref{101,,gccjit;;context;;new_rvalue()}, which has overloads +@pxref{104,,gccjit;;context;;new_rvalue()}, which has overloads for both @code{int} and @code{double}. @end quotation @end cartouche @@ -9241,12 +9281,12 @@ result: 285 @noindent @node Visualizing the control flow graph<2>,Full example<4>,Control flow<2>,Tutorial part 3 Loops and variables<2> -@anchor{cp/intro/tutorial03 visualizing-the-control-flow-graph}@anchor{102} +@anchor{cp/intro/tutorial03 visualizing-the-control-flow-graph}@anchor{105} @subsubsection Visualizing the control flow graph You can see the control flow graph of a function using -@pxref{103,,gccjit;;function;;dump_to_dot()}: +@pxref{106,,gccjit;;function;;dump_to_dot()}: @example func.dump_to_dot ("/tmp/sum-of-squares.dot"); @@ -9280,7 +9320,7 @@ install it with @cite{yum install python-xdot}): @end quotation @node Full example<4>,,Visualizing the control flow graph<2>,Tutorial part 3 Loops and variables<2> -@anchor{cp/intro/tutorial03 full-example}@anchor{104} +@anchor{cp/intro/tutorial03 full-example}@anchor{107} @subsubsection Full example @@ -9463,7 +9503,7 @@ loop_test returned: 285 @c . @node Tutorial part 4 Adding JIT-compilation to a toy interpreter<2>,,Tutorial part 3 Loops and variables<2>,Tutorial<2> -@anchor{cp/intro/tutorial04 tutorial-part-4-adding-jit-compilation-to-a-toy-interpreter}@anchor{105}@anchor{cp/intro/tutorial04 doc}@anchor{106} +@anchor{cp/intro/tutorial04 tutorial-part-4-adding-jit-compilation-to-a-toy-interpreter}@anchor{108}@anchor{cp/intro/tutorial04 doc}@anchor{109} @subsection Tutorial part 4: Adding JIT-compilation to a toy interpreter @@ -9485,7 +9525,7 @@ to it. @end menu @node Our toy interpreter<2>,Compiling to machine code<2>,,Tutorial part 4 Adding JIT-compilation to a toy interpreter<2> -@anchor{cp/intro/tutorial04 our-toy-interpreter}@anchor{107} +@anchor{cp/intro/tutorial04 our-toy-interpreter}@anchor{10a} @subsubsection Our toy interpreter @@ -9893,7 +9933,7 @@ toyvm_function::interpret (int arg, FILE *trace) @end quotation @node Compiling to machine code<2>,Setting things up<2>,Our toy interpreter<2>,Tutorial part 4 Adding JIT-compilation to a toy interpreter<2> -@anchor{cp/intro/tutorial04 compiling-to-machine-code}@anchor{108} +@anchor{cp/intro/tutorial04 compiling-to-machine-code}@anchor{10b} @subsubsection Compiling to machine code @@ -9973,7 +10013,7 @@ This means our compiler has the following state: @end quotation @node Setting things up<2>,Populating the function<2>,Compiling to machine code<2>,Tutorial part 4 Adding JIT-compilation to a toy interpreter<2> -@anchor{cp/intro/tutorial04 setting-things-up}@anchor{109} +@anchor{cp/intro/tutorial04 setting-things-up}@anchor{10c} @subsubsection Setting things up @@ -10141,7 +10181,7 @@ We create the locals within the function. @end quotation @node Populating the function<2>,Verifying the control flow graph<2>,Setting things up<2>,Tutorial part 4 Adding JIT-compilation to a toy interpreter<2> -@anchor{cp/intro/tutorial04 populating-the-function}@anchor{10a} +@anchor{cp/intro/tutorial04 populating-the-function}@anchor{10d} @subsubsection Populating the function @@ -10269,7 +10309,7 @@ stack into @code{y} instead erroneously assigned it to @code{x}, leaving @code{y uninitialized. To track this kind of thing down, we can use -@pxref{10b,,gccjit;;block;;add_comment()} to add descriptive comments +@pxref{10e,,gccjit;;block;;add_comment()} to add descriptive comments to the internal representation. This is invaluable when looking through the generated IR for, say @code{factorial}: @@ -10418,14 +10458,14 @@ to the next block. This is analogous to simply incrementing the program counter. @node Verifying the control flow graph<2>,Compiling the context<2>,Populating the function<2>,Tutorial part 4 Adding JIT-compilation to a toy interpreter<2> -@anchor{cp/intro/tutorial04 verifying-the-control-flow-graph}@anchor{10c} +@anchor{cp/intro/tutorial04 verifying-the-control-flow-graph}@anchor{10f} @subsubsection Verifying the control flow graph Having finished looping over the blocks, the context is complete. As before, we can verify that the control flow and statements are sane by -using @pxref{103,,gccjit;;function;;dump_to_dot()}: +using @pxref{106,,gccjit;;function;;dump_to_dot()}: @example fn.dump_to_dot ("/tmp/factorial.dot"); @@ -10449,7 +10489,7 @@ errors in our compiler. @end quotation @node Compiling the context<2>,Single-stepping through the generated code<2>,Verifying the control flow graph<2>,Tutorial part 4 Adding JIT-compilation to a toy interpreter<2> -@anchor{cp/intro/tutorial04 compiling-the-context}@anchor{10d} +@anchor{cp/intro/tutorial04 compiling-the-context}@anchor{110} @subsubsection Compiling the context @@ -10486,7 +10526,7 @@ We can now run the result: @end quotation @node Single-stepping through the generated code<2>,Examining the generated code<2>,Compiling the context<2>,Tutorial part 4 Adding JIT-compilation to a toy interpreter<2> -@anchor{cp/intro/tutorial04 single-stepping-through-the-generated-code}@anchor{10e} +@anchor{cp/intro/tutorial04 single-stepping-through-the-generated-code}@anchor{111} @subsubsection Single-stepping through the generated code @@ -10500,14 +10540,14 @@ It's possible to debug the generated code. To do this we need to both: @item Set up source code locations for our statements, so that we can meaningfully step through the code. We did this above by -calling @pxref{10f,,gccjit;;context;;new_location()} and using the +calling @pxref{112,,gccjit;;context;;new_location()} and using the results. @item Enable the generation of debugging information, by setting @pxref{42,,GCC_JIT_BOOL_OPTION_DEBUGINFO} on the @code{gccjit::context} via -@pxref{f4,,gccjit;;context;;set_bool_option()}: +@pxref{f7,,gccjit;;context;;set_bool_option()}: @example ctxt.set_bool_option (GCC_JIT_BOOL_OPTION_DEBUGINFO, 1); @@ -10579,14 +10619,14 @@ optimization level in a regular compiler. @end cartouche @node Examining the generated code<2>,Putting it all together<2>,Single-stepping through the generated code<2>,Tutorial part 4 Adding JIT-compilation to a toy interpreter<2> -@anchor{cp/intro/tutorial04 examining-the-generated-code}@anchor{110} +@anchor{cp/intro/tutorial04 examining-the-generated-code}@anchor{113} @subsubsection Examining the generated code How good is the optimized code? We can turn up optimizations, by calling -@pxref{f5,,gccjit;;context;;set_int_option()} with +@pxref{f8,,gccjit;;context;;set_int_option()} with @pxref{1f,,GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL}: @example @@ -10768,7 +10808,7 @@ Note that the stack pushing and popping have been eliminated, as has the recursive call (in favor of an iteration). @node Putting it all together<2>,Behind the curtain How does our code get optimized?<2>,Examining the generated code<2>,Tutorial part 4 Adding JIT-compilation to a toy interpreter<2> -@anchor{cp/intro/tutorial04 putting-it-all-together}@anchor{111} +@anchor{cp/intro/tutorial04 putting-it-all-together}@anchor{114} @subsubsection Putting it all together @@ -10801,7 +10841,7 @@ compiler result: 55 @noindent @node Behind the curtain How does our code get optimized?<2>,,Putting it all together<2>,Tutorial part 4 Adding JIT-compilation to a toy interpreter<2> -@anchor{cp/intro/tutorial04 behind-the-curtain-how-does-our-code-get-optimized}@anchor{112} +@anchor{cp/intro/tutorial04 behind-the-curtain-how-does-our-code-get-optimized}@anchor{115} @subsubsection Behind the curtain: How does our code get optimized? @@ -11002,7 +11042,7 @@ representation: @code{initial}, @code{instr4} and @code{instr9}. @end menu @node Optimizing away stack manipulation<2>,Elimination of tail recursion<2>,,Behind the curtain How does our code get optimized?<2> -@anchor{cp/intro/tutorial04 optimizing-away-stack-manipulation}@anchor{113} +@anchor{cp/intro/tutorial04 optimizing-away-stack-manipulation}@anchor{116} @subsubsection Optimizing away stack manipulation @@ -11282,7 +11322,7 @@ instr9: @noindent @node Elimination of tail recursion<2>,,Optimizing away stack manipulation<2>,Behind the curtain How does our code get optimized?<2> -@anchor{cp/intro/tutorial04 elimination-of-tail-recursion}@anchor{114} +@anchor{cp/intro/tutorial04 elimination-of-tail-recursion}@anchor{117} @subsubsection Elimination of tail recursion @@ -11369,7 +11409,7 @@ instr9: @c . @node Topic Reference<2>,,Tutorial<2>,C++ bindings for libgccjit -@anchor{cp/topics/index doc}@anchor{115}@anchor{cp/topics/index topic-reference}@anchor{116} +@anchor{cp/topics/index doc}@anchor{118}@anchor{cp/topics/index topic-reference}@anchor{119} @section Topic Reference @@ -11459,22 +11499,22 @@ Compiling a context @node Compilation contexts<2>,Objects<2>,,Topic Reference<2> -@anchor{cp/topics/contexts compilation-contexts}@anchor{117}@anchor{cp/topics/contexts doc}@anchor{118} +@anchor{cp/topics/contexts compilation-contexts}@anchor{11a}@anchor{cp/topics/contexts doc}@anchor{11b} @subsection Compilation contexts @geindex gccjit;;context (C++ class) -@anchor{cp/topics/contexts gccjit context}@anchor{119} +@anchor{cp/topics/contexts gccjit context}@anchor{11c} @deffn {C++ Class} gccjit::context @end deffn -The top-level of the C++ API is the @pxref{119,,gccjit;;context} type. +The top-level of the C++ API is the @pxref{11c,,gccjit;;context} type. -A @pxref{119,,gccjit;;context} instance encapsulates the state of a +A @pxref{11c,,gccjit;;context} instance encapsulates the state of a compilation. You can set up options on it, and add types, functions and code. -Invoking @pxref{f2,,gccjit;;context;;compile()} on it gives you a +Invoking @pxref{f5,,gccjit;;context;;compile()} on it gives you a @pxref{16,,gcc_jit_result *}. It is a thin wrapper around the C API's @pxref{8,,gcc_jit_context *}. @@ -11489,7 +11529,7 @@ It is a thin wrapper around the C API's @pxref{8,,gcc_jit_context *}. @end menu @node Lifetime-management<2>,Thread-safety<2>,,Compilation contexts<2> -@anchor{cp/topics/contexts lifetime-management}@anchor{11a} +@anchor{cp/topics/contexts lifetime-management}@anchor{11d} @subsubsection Lifetime-management @@ -11498,16 +11538,16 @@ have their lifetime bounded by the context they are created within, and cleanup of such objects is done for you when the context is released. @geindex gccjit;;context;;acquire (C++ function) -@anchor{cp/topics/contexts gccjit context acquire}@anchor{ec} +@anchor{cp/topics/contexts gccjit context acquire}@anchor{ef} @deffn {C++ Function} gccjit::context gccjit::context::acquire () -This function acquires a new @pxref{119,,gccjit;;context} instance, +This function acquires a new @pxref{11c,,gccjit;;context} instance, which is independent of any others that may be present within this process. @end deffn @geindex gccjit;;context;;release (C++ function) -@anchor{cp/topics/contexts gccjit context release}@anchor{ee} +@anchor{cp/topics/contexts gccjit context release}@anchor{f1} @deffn {C++ Function} void gccjit::context::release () This function releases all resources associated with the given context. @@ -11526,7 +11566,7 @@ ctxt.release (); @end deffn @geindex gccjit;;context;;new_child_context (C++ function) -@anchor{cp/topics/contexts gccjit context new_child_context}@anchor{11b} +@anchor{cp/topics/contexts gccjit context new_child_context}@anchor{11e} @deffn {C++ Function} gccjit::context gccjit::context::new_child_context () Given an existing JIT context, create a child context. @@ -11558,16 +11598,16 @@ there will likely be a performance hit for such nesting. @end deffn @node Thread-safety<2>,Error-handling<3>,Lifetime-management<2>,Compilation contexts<2> -@anchor{cp/topics/contexts thread-safety}@anchor{11c} +@anchor{cp/topics/contexts thread-safety}@anchor{11f} @subsubsection Thread-safety -Instances of @pxref{119,,gccjit;;context} created via -@pxref{ec,,gccjit;;context;;acquire()} are independent from each other: +Instances of @pxref{11c,,gccjit;;context} created via +@pxref{ef,,gccjit;;context;;acquire()} are independent from each other: only one thread may use a given context at once, but multiple threads could each have their own contexts without needing locks. -Contexts created via @pxref{11b,,gccjit;;context;;new_child_context()} are +Contexts created via @pxref{11e,,gccjit;;context;;new_child_context()} are related to their parent context. They can be partitioned by their ultimate ancestor into independent "family trees". Only one thread within a process may use a given "family tree" of such contexts at once, @@ -11575,7 +11615,7 @@ and if you're using multiple threads you should provide your own locking around entire such context partitions. @node Error-handling<3>,Debugging<2>,Thread-safety<2>,Compilation contexts<2> -@anchor{cp/topics/contexts error-handling}@anchor{11d} +@anchor{cp/topics/contexts error-handling}@anchor{120} @subsubsection Error-handling @@ -11588,10 +11628,10 @@ NULL. You don't have to check everywhere for NULL results, since the API gracefully handles a NULL being passed in for any argument. Errors are printed on stderr and can be queried using -@pxref{11e,,gccjit;;context;;get_first_error()}. +@pxref{121,,gccjit;;context;;get_first_error()}. @geindex gccjit;;context;;get_first_error (C++ function) -@anchor{cp/topics/contexts gccjit context get_first_error__gccjit contextP}@anchor{11e} +@anchor{cp/topics/contexts gccjit context get_first_error__gccjit contextP}@anchor{121} @deffn {C++ Function} const char* gccjit::context::get_first_error (gccjit::context* ctxt) Returns the first error message that occurred on the context. @@ -11603,18 +11643,18 @@ If no errors occurred, this will be NULL. @end deffn @node Debugging<2>,Options<4>,Error-handling<3>,Compilation contexts<2> -@anchor{cp/topics/contexts debugging}@anchor{11f} +@anchor{cp/topics/contexts debugging}@anchor{122} @subsubsection Debugging @geindex gccjit;;context;;dump_to_file (C++ function) -@anchor{cp/topics/contexts gccjit context dump_to_file__ssCR i}@anchor{120} +@anchor{cp/topics/contexts gccjit context dump_to_file__ssCR i}@anchor{123} @deffn {C++ Function} void gccjit::context::dump_to_file (const std::string& path, int update_locations) To help with debugging: dump a C-like representation to the given path, describing what's been set up on the context. -If "update_locations" is true, then also set up @pxref{121,,gccjit;;location} +If "update_locations" is true, then also set up @pxref{124,,gccjit;;location} information throughout the context, pointing at the dump file as if it were a source file. This may be of use in conjunction with @code{GCCJIT::BOOL_OPTION_DEBUGINFO} to allow stepping through the @@ -11622,7 +11662,7 @@ code in a debugger. @end deffn @geindex gccjit;;context;;dump_reproducer_to_file (C++ function) -@anchor{cp/topics/contexts gccjit context dump_reproducer_to_file__gcc_jit_contextP cCP}@anchor{122} +@anchor{cp/topics/contexts gccjit context dump_reproducer_to_file__gcc_jit_contextP cCP}@anchor{125} @deffn {C++ Function} void gccjit::context::dump_reproducer_to_file (gcc_jit_context* ctxt, const char* path) This is a thin wrapper around the C API @@ -11634,7 +11674,7 @@ for seeing what the C++ bindings are doing at the C level. @end deffn @node Options<4>,,Debugging<2>,Compilation contexts<2> -@anchor{cp/topics/contexts options}@anchor{123} +@anchor{cp/topics/contexts options}@anchor{126} @subsubsection Options @@ -11647,12 +11687,12 @@ for seeing what the C++ bindings are doing at the C level. @end menu @node String Options<2>,Boolean options<2>,,Options<4> -@anchor{cp/topics/contexts string-options}@anchor{124} +@anchor{cp/topics/contexts string-options}@anchor{127} @subsubsection String Options @geindex gccjit;;context;;set_str_option (C++ function) -@anchor{cp/topics/contexts gccjit context set_str_option__enum cCP}@anchor{125} +@anchor{cp/topics/contexts gccjit context set_str_option__enum cCP}@anchor{128} @deffn {C++ Function} void gccjit::context::set_str_option (enum gcc_jit_str_option, const char* value) Set a string option of the context. @@ -11663,12 +11703,12 @@ meaning. @end deffn @node Boolean options<2>,Integer options<2>,String Options<2>,Options<4> -@anchor{cp/topics/contexts boolean-options}@anchor{126} +@anchor{cp/topics/contexts boolean-options}@anchor{129} @subsubsection Boolean options @geindex gccjit;;context;;set_bool_option (C++ function) -@anchor{cp/topics/contexts gccjit context set_bool_option__enum i}@anchor{f4} +@anchor{cp/topics/contexts gccjit context set_bool_option__enum i}@anchor{f7} @deffn {C++ Function} void gccjit::context::set_bool_option (enum gcc_jit_bool_option, int value) Set a boolean option of the context. @@ -11678,13 +11718,34 @@ This is a thin wrapper around the C API meaning. @end deffn +@geindex gccjit;;context;;set_bool_allow_unreachable_blocks (C++ function) +@anchor{cp/topics/contexts gccjit context set_bool_allow_unreachable_blocks__i}@anchor{12a} +@deffn {C++ Function} void gccjit::context::set_bool_allow_unreachable_blocks (int bool_value) + +By default, libgccjit will issue an error about unreachable blocks +within a function. + +This entrypoint can be used to disable that error; it is a thin wrapper +around the C API +@pxref{6b,,gcc_jit_context_set_bool_allow_unreachable_blocks()}. + +This entrypoint was added in @pxref{6c,,LIBGCCJIT_ABI_2}; you can test for +its presence using + +@example +#ifdef LIBGCCJIT_HAVE_gcc_jit_context_set_bool_allow_unreachable_blocks +@end example + +@noindent +@end deffn + @node Integer options<2>,Additional command-line options<2>,Boolean options<2>,Options<4> -@anchor{cp/topics/contexts integer-options}@anchor{127} +@anchor{cp/topics/contexts integer-options}@anchor{12b} @subsubsection Integer options @geindex gccjit;;context;;set_int_option (C++ function) -@anchor{cp/topics/contexts gccjit context set_int_option__enum i}@anchor{f5} +@anchor{cp/topics/contexts gccjit context set_int_option__enum i}@anchor{f8} @deffn {C++ Function} void gccjit::context::set_int_option (enum gcc_jit_int_option, int value) Set an integer option of the context. @@ -11695,21 +11756,21 @@ meaning. @end deffn @node Additional command-line options<2>,,Integer options<2>,Options<4> -@anchor{cp/topics/contexts additional-command-line-options}@anchor{128} +@anchor{cp/topics/contexts additional-command-line-options}@anchor{12c} @subsubsection Additional command-line options @geindex gccjit;;context;;add_command_line_option (C++ function) -@anchor{cp/topics/contexts gccjit context add_command_line_option__cCP}@anchor{129} +@anchor{cp/topics/contexts gccjit context add_command_line_option__cCP}@anchor{12d} @deffn {C++ Function} void gccjit::context::add_command_line_option (const char* optname) Add an arbitrary gcc command-line option to the context for use when compiling. This is a thin wrapper around the C API -@pxref{6e,,gcc_jit_context_add_command_line_option()}. +@pxref{70,,gcc_jit_context_add_command_line_option()}. -This entrypoint was added in @pxref{6f,,LIBGCCJIT_ABI_1}; you can test for +This entrypoint was added in @pxref{71,,LIBGCCJIT_ABI_1}; you can test for its presence using @example @@ -11737,18 +11798,18 @@ its presence using @c . @node Objects<2>,Types<2>,Compilation contexts<2>,Topic Reference<2> -@anchor{cp/topics/objects objects}@anchor{12a}@anchor{cp/topics/objects doc}@anchor{12b} +@anchor{cp/topics/objects objects}@anchor{12e}@anchor{cp/topics/objects doc}@anchor{12f} @subsection Objects @geindex gccjit;;object (C++ class) -@anchor{cp/topics/objects gccjit object}@anchor{12c} +@anchor{cp/topics/objects gccjit object}@anchor{130} @deffn {C++ Class} gccjit::object @end deffn Almost every entity in the API (with the exception of -@pxref{119,,gccjit;;context} and @pxref{16,,gcc_jit_result *}) is a -"contextual" object, a @pxref{12c,,gccjit;;object}. +@pxref{11c,,gccjit;;context} and @pxref{16,,gcc_jit_result *}) is a +"contextual" object, a @pxref{130,,gccjit;;object}. A JIT object: @@ -11758,7 +11819,7 @@ A JIT object: @itemize * @item -is associated with a @pxref{119,,gccjit;;context}. +is associated with a @pxref{11c,,gccjit;;context}. @item is automatically cleaned up for you when its context is released so @@ -11784,17 +11845,17 @@ The C++ class hierarchy within the @code{gccjit} namespace looks like this: @noindent -The @pxref{12c,,gccjit;;object} base class has the following operations: +The @pxref{130,,gccjit;;object} base class has the following operations: @geindex gccjit;;object;;get_context (C++ function) -@anchor{cp/topics/objects gccjit object get_contextC}@anchor{12d} +@anchor{cp/topics/objects gccjit object get_contextC}@anchor{131} @deffn {C++ Function} gccjit::context gccjit::object::get_context () const Which context is the obj within? @end deffn @geindex gccjit;;object;;get_debug_string (C++ function) -@anchor{cp/topics/objects gccjit object get_debug_stringC}@anchor{ef} +@anchor{cp/topics/objects gccjit object get_debug_stringC}@anchor{f2} @deffn {C++ Function} std::string gccjit::object::get_debug_string () const Generate a human-readable description for the given object. @@ -11834,16 +11895,16 @@ obj: 4.0 * (float)i @c . @node Types<2>,Expressions<2>,Objects<2>,Topic Reference<2> -@anchor{cp/topics/types doc}@anchor{12e}@anchor{cp/topics/types types}@anchor{12f} +@anchor{cp/topics/types doc}@anchor{132}@anchor{cp/topics/types types}@anchor{133} @subsection Types @geindex gccjit;;type (C++ class) -@anchor{cp/topics/types gccjit type}@anchor{130} +@anchor{cp/topics/types gccjit type}@anchor{134} @deffn {C++ Class} gccjit::type gccjit::type represents a type within the library. It is a subclass -of @pxref{12c,,gccjit;;object}. +of @pxref{130,,gccjit;;object}. @end deffn Types can be created in several ways: @@ -11853,7 +11914,7 @@ Types can be created in several ways: @item fundamental types can be accessed using -@pxref{ed,,gccjit;;context;;get_type()}: +@pxref{f0,,gccjit;;context;;get_type()}: @example gccjit::type int_type = ctxt.get_type (GCC_JIT_TYPE_INT); @@ -11873,7 +11934,7 @@ See @pxref{b,,gcc_jit_context_get_type()} for the available types. @item derived types can be accessed by using functions such as -@pxref{131,,gccjit;;type;;get_pointer()} and @pxref{132,,gccjit;;type;;get_const()}: +@pxref{135,,gccjit;;type;;get_pointer()} and @pxref{136,,gccjit;;type;;get_const()}: @example gccjit::type const_int_star = int_type.get_const ().get_pointer (); @@ -11894,12 +11955,12 @@ by creating structures (see below). @end menu @node Standard types<2>,Pointers const and volatile<2>,,Types<2> -@anchor{cp/topics/types standard-types}@anchor{133} +@anchor{cp/topics/types standard-types}@anchor{137} @subsubsection Standard types @geindex gccjit;;context;;get_type (C++ function) -@anchor{cp/topics/types gccjit context get_type__enum}@anchor{ed} +@anchor{cp/topics/types gccjit context get_type__enum}@anchor{f0} @deffn {C++ Function} gccjit::type gccjit::context::get_type (enum gcc_jit_types) Access a specific type. This is a thin wrapper around @@ -11907,14 +11968,14 @@ Access a specific type. This is a thin wrapper around @end deffn @geindex gccjit;;context;;get_int_type (C++ function) -@anchor{cp/topics/types gccjit context get_int_type__s i}@anchor{134} +@anchor{cp/topics/types gccjit context get_int_type__s i}@anchor{138} @deffn {C++ Function} gccjit::type gccjit::context::get_int_type (size_t num_bytes, int is_signed) Access the integer type of the given size. @end deffn @geindex gccjit;;context;;get_int_type (C++ function) -@anchor{cp/topics/types gccjit context get_int_type T}@anchor{135} +@anchor{cp/topics/types gccjit context get_int_type T}@anchor{139} @deffn {C++ Function} gccjit::type gccjit::context::get_int_type () Access the given integer type. For example, you could map the @@ -11928,12 +11989,12 @@ gccjit::type t = ctxt.get_int_type (); @end deffn @node Pointers const and volatile<2>,Structures and unions<2>,Standard types<2>,Types<2> -@anchor{cp/topics/types pointers-const-and-volatile}@anchor{136} +@anchor{cp/topics/types pointers-const-and-volatile}@anchor{13a} @subsubsection Pointers, @cite{const}, and @cite{volatile} @geindex gccjit;;type;;get_pointer (C++ function) -@anchor{cp/topics/types gccjit type get_pointer}@anchor{131} +@anchor{cp/topics/types gccjit type get_pointer}@anchor{135} @deffn {C++ Function} gccjit::type gccjit::type::get_pointer () Given type "T", get type "T*". @@ -11942,21 +12003,21 @@ Given type "T", get type "T*". @c FIXME: get_const doesn't seem to exist @geindex gccjit;;type;;get_const (C++ function) -@anchor{cp/topics/types gccjit type get_const}@anchor{132} +@anchor{cp/topics/types gccjit type get_const}@anchor{136} @deffn {C++ Function} gccjit::type gccjit::type::get_const () Given type "T", get type "const T". @end deffn @geindex gccjit;;type;;get_volatile (C++ function) -@anchor{cp/topics/types gccjit type get_volatile}@anchor{137} +@anchor{cp/topics/types gccjit type get_volatile}@anchor{13b} @deffn {C++ Function} gccjit::type gccjit::type::get_volatile () Given type "T", get type "volatile T". @end deffn @geindex gccjit;;context;;new_array_type (C++ function) -@anchor{cp/topics/types gccjit context new_array_type__gccjit type i gccjit location}@anchor{138} +@anchor{cp/topics/types gccjit context new_array_type__gccjit type i gccjit location}@anchor{13c} @deffn {C++ Function} gccjit::type gccjit::context::new_array_type (gccjit::type element_type, int num_elements, gccjit::location loc) Given type "T", get type "T[N]" (for a constant N). @@ -11964,31 +12025,31 @@ Param "loc" is optional. @end deffn @node Structures and unions<2>,,Pointers const and volatile<2>,Types<2> -@anchor{cp/topics/types structures-and-unions}@anchor{139} +@anchor{cp/topics/types structures-and-unions}@anchor{13d} @subsubsection Structures and unions @geindex gccjit;;struct_ (C++ class) -@anchor{cp/topics/types gccjit struct_}@anchor{13a} +@anchor{cp/topics/types gccjit struct_}@anchor{13e} @deffn {C++ Class} gccjit::struct_ @end deffn A compound type analagous to a C @cite{struct}. -@pxref{13a,,gccjit;;struct_} is a subclass of @pxref{130,,gccjit;;type} (and thus -of @pxref{12c,,gccjit;;object} in turn). +@pxref{13e,,gccjit;;struct_} is a subclass of @pxref{134,,gccjit;;type} (and thus +of @pxref{130,,gccjit;;object} in turn). @geindex gccjit;;field (C++ class) -@anchor{cp/topics/types gccjit field}@anchor{13b} +@anchor{cp/topics/types gccjit field}@anchor{13f} @deffn {C++ Class} gccjit::field @end deffn -A field within a @pxref{13a,,gccjit;;struct_}. +A field within a @pxref{13e,,gccjit;;struct_}. -@pxref{13b,,gccjit;;field} is a subclass of @pxref{12c,,gccjit;;object}. +@pxref{13f,,gccjit;;field} is a subclass of @pxref{130,,gccjit;;object}. -You can model C @cite{struct} types by creating @pxref{13a,,gccjit;;struct_} and -@pxref{13b,,gccjit;;field} instances, in either order: +You can model C @cite{struct} types by creating @pxref{13e,,gccjit;;struct_} and +@pxref{13f,,gccjit;;field} instances, in either order: @itemize * @@ -12044,14 +12105,14 @@ node.set_fields (fields); @c FIXME: the above API doesn't seem to exist yet @geindex gccjit;;context;;new_field (C++ function) -@anchor{cp/topics/types gccjit context new_field__gccjit type cCP gccjit location}@anchor{13c} +@anchor{cp/topics/types gccjit context new_field__gccjit type cCP gccjit location}@anchor{140} @deffn {C++ Function} gccjit::field gccjit::context::new_field (gccjit::type type, const char* name, gccjit::location loc) Construct a new field, with the given type and name. @end deffn @geindex gccjit;;context;;new_struct_type (C++ function) -@anchor{cp/topics/types gccjit context new_struct_type__ssCR std vector field R gccjit location}@anchor{13d} +@anchor{cp/topics/types gccjit context new_struct_type__ssCR std vector field R gccjit location}@anchor{141} @deffn {C++ Function} gccjit::struct_ gccjit::context::new_struct_type (const std::string& name, std::vector& fields, gccjit::location loc) @quotation @@ -12061,13 +12122,13 @@ Construct a new struct type, with the given name and fields. @end deffn @geindex gccjit;;context;;new_opaque_struct (C++ function) -@anchor{cp/topics/types gccjit context new_opaque_struct__ssCR gccjit location}@anchor{13e} +@anchor{cp/topics/types gccjit context new_opaque_struct__ssCR gccjit location}@anchor{142} @deffn {C++ Function} gccjit::struct_ gccjit::context::new_opaque_struct (const std::string& name, gccjit::location loc) Construct a new struct type, with the given name, but without specifying the fields. The fields can be omitted (in which case the size of the struct is not known), or later specified using -@pxref{83,,gcc_jit_struct_set_fields()}. +@pxref{85,,gcc_jit_struct_set_fields()}. @end deffn @c Copyright (C) 2014-2015 Free Software Foundation, Inc. @@ -12088,7 +12149,7 @@ size of the struct is not known), or later specified using @c . @node Expressions<2>,Creating and using functions<2>,Types<2>,Topic Reference<2> -@anchor{cp/topics/expressions expressions}@anchor{13f}@anchor{cp/topics/expressions doc}@anchor{140} +@anchor{cp/topics/expressions expressions}@anchor{143}@anchor{cp/topics/expressions doc}@anchor{144} @subsection Expressions @@ -12114,17 +12175,17 @@ Lvalues @node Rvalues<2>,Lvalues<2>,,Expressions<2> -@anchor{cp/topics/expressions rvalues}@anchor{141} +@anchor{cp/topics/expressions rvalues}@anchor{145} @subsubsection Rvalues @geindex gccjit;;rvalue (C++ class) -@anchor{cp/topics/expressions gccjit rvalue}@anchor{142} +@anchor{cp/topics/expressions gccjit rvalue}@anchor{146} @deffn {C++ Class} gccjit::rvalue @end deffn -A @pxref{142,,gccjit;;rvalue} is an expression that can be computed. It is a -subclass of @pxref{12c,,gccjit;;object}, and is a thin wrapper around +A @pxref{146,,gccjit;;rvalue} is an expression that can be computed. It is a +subclass of @pxref{130,,gccjit;;object}, and is a thin wrapper around @pxref{13,,gcc_jit_rvalue *} from the C API. It can be simple, e.g.: @@ -12170,7 +12231,7 @@ Every rvalue has an associated type, and the API will check to ensure that types match up correctly (otherwise the context will emit an error). @geindex gccjit;;rvalue;;get_type (C++ function) -@anchor{cp/topics/expressions gccjit rvalue get_type}@anchor{143} +@anchor{cp/topics/expressions gccjit rvalue get_type}@anchor{147} @deffn {C++ Function} gccjit::type gccjit::rvalue::get_type () Get the type of this rvalue. @@ -12187,12 +12248,12 @@ Get the type of this rvalue. @end menu @node Simple expressions<2>,Unary Operations<2>,,Rvalues<2> -@anchor{cp/topics/expressions simple-expressions}@anchor{144} +@anchor{cp/topics/expressions simple-expressions}@anchor{148} @subsubsection Simple expressions @geindex gccjit;;context;;new_rvalue (C++ function) -@anchor{cp/topics/expressions gccjit context new_rvalue__gccjit type iC}@anchor{101} +@anchor{cp/topics/expressions gccjit context new_rvalue__gccjit type iC}@anchor{104} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_rvalue (gccjit::type numeric_type, int value) const Given a numeric type (integer or floating point), build an rvalue for @@ -12200,7 +12261,7 @@ the given constant @code{int} value. @end deffn @geindex gccjit;;context;;new_rvalue (C++ function) -@anchor{cp/topics/expressions gccjit context new_rvalue__gccjit type lC}@anchor{145} +@anchor{cp/topics/expressions gccjit context new_rvalue__gccjit type lC}@anchor{149} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_rvalue (gccjit::type numeric_type, long value) const Given a numeric type (integer or floating point), build an rvalue for @@ -12208,7 +12269,7 @@ the given constant @code{long} value. @end deffn @geindex gccjit;;context;;zero (C++ function) -@anchor{cp/topics/expressions gccjit context zero__gccjit typeC}@anchor{fd} +@anchor{cp/topics/expressions gccjit context zero__gccjit typeC}@anchor{100} @deffn {C++ Function} gccjit::rvalue gccjit::context::zero (gccjit::type numeric_type) const Given a numeric type (integer or floating point), get the rvalue for @@ -12222,7 +12283,7 @@ ctxt.new_rvalue (numeric_type, 0) @end deffn @geindex gccjit;;context;;one (C++ function) -@anchor{cp/topics/expressions gccjit context one__gccjit typeC}@anchor{146} +@anchor{cp/topics/expressions gccjit context one__gccjit typeC}@anchor{14a} @deffn {C++ Function} gccjit::rvalue gccjit::context::one (gccjit::type numeric_type) const Given a numeric type (integer or floating point), get the rvalue for @@ -12236,7 +12297,7 @@ ctxt.new_rvalue (numeric_type, 1) @end deffn @geindex gccjit;;context;;new_rvalue (C++ function) -@anchor{cp/topics/expressions gccjit context new_rvalue__gccjit type doubleC}@anchor{147} +@anchor{cp/topics/expressions gccjit context new_rvalue__gccjit type doubleC}@anchor{14b} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_rvalue (gccjit::type numeric_type, double value) const Given a numeric type (integer or floating point), build an rvalue for @@ -12244,14 +12305,14 @@ the given constant @code{double} value. @end deffn @geindex gccjit;;context;;new_rvalue (C++ function) -@anchor{cp/topics/expressions gccjit context new_rvalue__gccjit type voidPC}@anchor{148} +@anchor{cp/topics/expressions gccjit context new_rvalue__gccjit type voidPC}@anchor{14c} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_rvalue (gccjit::type pointer_type, void* value) const Given a pointer type, build an rvalue for the given address. @end deffn @geindex gccjit;;context;;new_rvalue (C++ function) -@anchor{cp/topics/expressions gccjit context new_rvalue__ssCRC}@anchor{149} +@anchor{cp/topics/expressions gccjit context new_rvalue__ssCRC}@anchor{14d} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_rvalue (const std::string& value) const Generate an rvalue of type @code{GCC_JIT_TYPE_CONST_CHAR_PTR} for @@ -12259,12 +12320,12 @@ the given string. This is akin to a string literal. @end deffn @node Unary Operations<2>,Binary Operations<2>,Simple expressions<2>,Rvalues<2> -@anchor{cp/topics/expressions unary-operations}@anchor{14a} +@anchor{cp/topics/expressions unary-operations}@anchor{14e} @subsubsection Unary Operations @geindex gccjit;;context;;new_unary_op (C++ function) -@anchor{cp/topics/expressions gccjit context new_unary_op__enum gccjit type gccjit rvalue gccjit location}@anchor{14b} +@anchor{cp/topics/expressions gccjit context new_unary_op__enum gccjit type gccjit rvalue gccjit location}@anchor{14f} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_unary_op (enum gcc_jit_unary_op, gccjit::type result_type, gccjit::rvalue rvalue, gccjit::location loc) Build a unary operation out of an input rvalue. @@ -12272,7 +12333,7 @@ Build a unary operation out of an input rvalue. Parameter @code{loc} is optional. This is a thin wrapper around the C API's -@pxref{8f,,gcc_jit_context_new_unary_op()} and the available unary +@pxref{91,,gcc_jit_context_new_unary_op()} and the available unary operations are documented there. @end deffn @@ -12280,7 +12341,7 @@ There are shorter ways to spell the various specific kinds of unary operation: @geindex gccjit;;context;;new_minus (C++ function) -@anchor{cp/topics/expressions gccjit context new_minus__gccjit type gccjit rvalue gccjit location}@anchor{14c} +@anchor{cp/topics/expressions gccjit context new_minus__gccjit type gccjit rvalue gccjit location}@anchor{150} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_minus (gccjit::type result_type, gccjit::rvalue a, gccjit::location loc) Negate an arithmetic value; for example: @@ -12301,7 +12362,7 @@ builds the equivalent of this C expression: @end deffn @geindex new_bitwise_negate (C++ function) -@anchor{cp/topics/expressions new_bitwise_negate__gccjit type gccjit rvalue gccjit location}@anchor{14d} +@anchor{cp/topics/expressions new_bitwise_negate__gccjit type gccjit rvalue gccjit location}@anchor{151} @deffn {C++ Function} gccjit::rvalue new_bitwise_negate (gccjit::type result_type, gccjit::rvalue a, gccjit::location loc) Bitwise negation of an integer value (one's complement); for example: @@ -12322,7 +12383,7 @@ builds the equivalent of this C expression: @end deffn @geindex new_logical_negate (C++ function) -@anchor{cp/topics/expressions new_logical_negate__gccjit type gccjit rvalue gccjit location}@anchor{14e} +@anchor{cp/topics/expressions new_logical_negate__gccjit type gccjit rvalue gccjit location}@anchor{152} @deffn {C++ Function} gccjit::rvalue new_logical_negate (gccjit::type result_type, gccjit::rvalue a, gccjit::location loc) Logical negation of an arithmetic or pointer value; for example: @@ -12345,7 +12406,7 @@ builds the equivalent of this C expression: The most concise way to spell them is with overloaded operators: @geindex operator- (C++ function) -@anchor{cp/topics/expressions sub-operator__gccjit rvalue}@anchor{14f} +@anchor{cp/topics/expressions sub-operator__gccjit rvalue}@anchor{153} @deffn {C++ Function} gccjit::rvalue operator- (gccjit::rvalue a) @example @@ -12356,7 +12417,7 @@ gccjit::rvalue negpi = -pi; @end deffn @geindex operator~ (C++ function) -@anchor{cp/topics/expressions inv-operator__gccjit rvalue}@anchor{150} +@anchor{cp/topics/expressions inv-operator__gccjit rvalue}@anchor{154} @deffn {C++ Function} gccjit::rvalue operator~ (gccjit::rvalue a) @example @@ -12367,7 +12428,7 @@ gccjit::rvalue mask = ~a; @end deffn @geindex operator! (C++ function) -@anchor{cp/topics/expressions not-operator__gccjit rvalue}@anchor{151} +@anchor{cp/topics/expressions not-operator__gccjit rvalue}@anchor{155} @deffn {C++ Function} gccjit::rvalue operator! (gccjit::rvalue a) @example @@ -12378,12 +12439,12 @@ gccjit::rvalue guard = !cond; @end deffn @node Binary Operations<2>,Comparisons<2>,Unary Operations<2>,Rvalues<2> -@anchor{cp/topics/expressions binary-operations}@anchor{152} +@anchor{cp/topics/expressions binary-operations}@anchor{156} @subsubsection Binary Operations @geindex gccjit;;context;;new_binary_op (C++ function) -@anchor{cp/topics/expressions gccjit context new_binary_op__enum gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{f1} +@anchor{cp/topics/expressions gccjit context new_binary_op__enum gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{f4} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_binary_op (enum gcc_jit_binary_op, gccjit::type result_type, gccjit::rvalue a, gccjit::rvalue b, gccjit::location loc) Build a binary operation out of two constituent rvalues. @@ -12399,59 +12460,59 @@ There are shorter ways to spell the various specific kinds of binary operation: @geindex gccjit;;context;;new_plus (C++ function) -@anchor{cp/topics/expressions gccjit context new_plus__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{153} +@anchor{cp/topics/expressions gccjit context new_plus__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{157} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_plus (gccjit::type result_type, gccjit::rvalue a, gccjit::rvalue b, gccjit::location loc) @end deffn @geindex gccjit;;context;;new_minus (C++ function) -@anchor{cp/topics/expressions gccjit context new_minus__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{154} +@anchor{cp/topics/expressions gccjit context new_minus__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{158} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_minus (gccjit::type result_type, gccjit::rvalue a, gccjit::rvalue b, gccjit::location loc) @end deffn @geindex gccjit;;context;;new_mult (C++ function) -@anchor{cp/topics/expressions gccjit context new_mult__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{155} +@anchor{cp/topics/expressions gccjit context new_mult__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{159} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_mult (gccjit::type result_type, gccjit::rvalue a, gccjit::rvalue b, gccjit::location loc) @end deffn @geindex gccjit;;context;;new_divide (C++ function) -@anchor{cp/topics/expressions gccjit context new_divide__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{156} +@anchor{cp/topics/expressions gccjit context new_divide__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{15a} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_divide (gccjit::type result_type, gccjit::rvalue a, gccjit::rvalue b, gccjit::location loc) @end deffn @geindex gccjit;;context;;new_modulo (C++ function) -@anchor{cp/topics/expressions gccjit context new_modulo__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{157} +@anchor{cp/topics/expressions gccjit context new_modulo__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{15b} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_modulo (gccjit::type result_type, gccjit::rvalue a, gccjit::rvalue b, gccjit::location loc) @end deffn @geindex gccjit;;context;;new_bitwise_and (C++ function) -@anchor{cp/topics/expressions gccjit context new_bitwise_and__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{158} +@anchor{cp/topics/expressions gccjit context new_bitwise_and__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{15c} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_bitwise_and (gccjit::type result_type, gccjit::rvalue a, gccjit::rvalue b, gccjit::location loc) @end deffn @geindex gccjit;;context;;new_bitwise_xor (C++ function) -@anchor{cp/topics/expressions gccjit context new_bitwise_xor__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{159} +@anchor{cp/topics/expressions gccjit context new_bitwise_xor__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{15d} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_bitwise_xor (gccjit::type result_type, gccjit::rvalue a, gccjit::rvalue b, gccjit::location loc) @end deffn @geindex gccjit;;context;;new_bitwise_or (C++ function) -@anchor{cp/topics/expressions gccjit context new_bitwise_or__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{15a} +@anchor{cp/topics/expressions gccjit context new_bitwise_or__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{15e} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_bitwise_or (gccjit::type result_type, gccjit::rvalue a, gccjit::rvalue b, gccjit::location loc) @end deffn @geindex gccjit;;context;;new_logical_and (C++ function) -@anchor{cp/topics/expressions gccjit context new_logical_and__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{15b} +@anchor{cp/topics/expressions gccjit context new_logical_and__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{15f} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_logical_and (gccjit::type result_type, gccjit::rvalue a, gccjit::rvalue b, gccjit::location loc) @end deffn @geindex gccjit;;context;;new_logical_or (C++ function) -@anchor{cp/topics/expressions gccjit context new_logical_or__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{15c} +@anchor{cp/topics/expressions gccjit context new_logical_or__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{160} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_logical_or (gccjit::type result_type, gccjit::rvalue a, gccjit::rvalue b, gccjit::location loc) @end deffn The most concise way to spell them is with overloaded operators: @geindex operator+ (C++ function) -@anchor{cp/topics/expressions add-operator__gccjit rvalue gccjit rvalue}@anchor{15d} +@anchor{cp/topics/expressions add-operator__gccjit rvalue gccjit rvalue}@anchor{161} @deffn {C++ Function} gccjit::rvalue operator+ (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12462,7 +12523,7 @@ gccjit::rvalue sum = a + b; @end deffn @geindex operator- (C++ function) -@anchor{cp/topics/expressions sub-operator__gccjit rvalue gccjit rvalue}@anchor{15e} +@anchor{cp/topics/expressions sub-operator__gccjit rvalue gccjit rvalue}@anchor{162} @deffn {C++ Function} gccjit::rvalue operator- (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12473,7 +12534,7 @@ gccjit::rvalue diff = a - b; @end deffn @geindex operator* (C++ function) -@anchor{cp/topics/expressions mul-operator__gccjit rvalue gccjit rvalue}@anchor{15f} +@anchor{cp/topics/expressions mul-operator__gccjit rvalue gccjit rvalue}@anchor{163} @deffn {C++ Function} gccjit::rvalue operator* (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12484,7 +12545,7 @@ gccjit::rvalue prod = a * b; @end deffn @geindex operator/ (C++ function) -@anchor{cp/topics/expressions div-operator__gccjit rvalue gccjit rvalue}@anchor{160} +@anchor{cp/topics/expressions div-operator__gccjit rvalue gccjit rvalue}@anchor{164} @deffn {C++ Function} gccjit::rvalue operator/ (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12495,7 +12556,7 @@ gccjit::rvalue result = a / b; @end deffn @geindex operator% (C++ function) -@anchor{cp/topics/expressions mod-operator__gccjit rvalue gccjit rvalue}@anchor{161} +@anchor{cp/topics/expressions mod-operator__gccjit rvalue gccjit rvalue}@anchor{165} @deffn {C++ Function} gccjit::rvalue operator% (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12506,7 +12567,7 @@ gccjit::rvalue mod = a % b; @end deffn @geindex operator& (C++ function) -@anchor{cp/topics/expressions and-operator__gccjit rvalue gccjit rvalue}@anchor{162} +@anchor{cp/topics/expressions and-operator__gccjit rvalue gccjit rvalue}@anchor{166} @deffn {C++ Function} gccjit::rvalue operator& (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12517,7 +12578,7 @@ gccjit::rvalue x = a & b; @end deffn @geindex operator^ (C++ function) -@anchor{cp/topics/expressions xor-operator__gccjit rvalue gccjit rvalue}@anchor{163} +@anchor{cp/topics/expressions xor-operator__gccjit rvalue gccjit rvalue}@anchor{167} @deffn {C++ Function} gccjit::rvalue operator^ (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12528,7 +12589,7 @@ gccjit::rvalue x = a ^ b; @end deffn @geindex operator| (C++ function) -@anchor{cp/topics/expressions or-operator__gccjit rvalue gccjit rvalue}@anchor{164} +@anchor{cp/topics/expressions or-operator__gccjit rvalue gccjit rvalue}@anchor{168} @deffn {C++ Function} gccjit::rvalue operator| (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12539,7 +12600,7 @@ gccjit::rvalue x = a | b; @end deffn @geindex operator&& (C++ function) -@anchor{cp/topics/expressions sand-operator__gccjit rvalue gccjit rvalue}@anchor{165} +@anchor{cp/topics/expressions sand-operator__gccjit rvalue gccjit rvalue}@anchor{169} @deffn {C++ Function} gccjit::rvalue operator&& (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12550,7 +12611,7 @@ gccjit::rvalue cond = a && b; @end deffn @geindex operator|| (C++ function) -@anchor{cp/topics/expressions sor-operator__gccjit rvalue gccjit rvalue}@anchor{166} +@anchor{cp/topics/expressions sor-operator__gccjit rvalue gccjit rvalue}@anchor{16a} @deffn {C++ Function} gccjit::rvalue operator|| (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12573,12 +12634,12 @@ gccjit::rvalue discriminant = (b * b) - (four * a * c); @end quotation @node Comparisons<2>,Function calls<2>,Binary Operations<2>,Rvalues<2> -@anchor{cp/topics/expressions comparisons}@anchor{167} +@anchor{cp/topics/expressions comparisons}@anchor{16b} @subsubsection Comparisons @geindex gccjit;;context;;new_comparison (C++ function) -@anchor{cp/topics/expressions gccjit context new_comparison__enum gccjit rvalue gccjit rvalue gccjit location}@anchor{fe} +@anchor{cp/topics/expressions gccjit context new_comparison__enum gccjit rvalue gccjit rvalue gccjit location}@anchor{101} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_comparison (enum gcc_jit_comparison, gccjit::rvalue a, gccjit::rvalue b, gccjit::location loc) Build a boolean rvalue out of the comparison of two other rvalues. @@ -12594,39 +12655,39 @@ There are shorter ways to spell the various specific kinds of binary operation: @geindex gccjit;;context;;new_eq (C++ function) -@anchor{cp/topics/expressions gccjit context new_eq__gccjit rvalue gccjit rvalue gccjit location}@anchor{168} +@anchor{cp/topics/expressions gccjit context new_eq__gccjit rvalue gccjit rvalue gccjit location}@anchor{16c} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_eq (gccjit::rvalue a, gccjit::rvalue b, gccjit::location loc) @end deffn @geindex gccjit;;context;;new_ne (C++ function) -@anchor{cp/topics/expressions gccjit context new_ne__gccjit rvalue gccjit rvalue gccjit location}@anchor{169} +@anchor{cp/topics/expressions gccjit context new_ne__gccjit rvalue gccjit rvalue gccjit location}@anchor{16d} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_ne (gccjit::rvalue a, gccjit::rvalue b, gccjit::location loc) @end deffn @geindex gccjit;;context;;new_lt (C++ function) -@anchor{cp/topics/expressions gccjit context new_lt__gccjit rvalue gccjit rvalue gccjit location}@anchor{16a} +@anchor{cp/topics/expressions gccjit context new_lt__gccjit rvalue gccjit rvalue gccjit location}@anchor{16e} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_lt (gccjit::rvalue a, gccjit::rvalue b, gccjit::location loc) @end deffn @geindex gccjit;;context;;new_le (C++ function) -@anchor{cp/topics/expressions gccjit context new_le__gccjit rvalue gccjit rvalue gccjit location}@anchor{16b} +@anchor{cp/topics/expressions gccjit context new_le__gccjit rvalue gccjit rvalue gccjit location}@anchor{16f} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_le (gccjit::rvalue a, gccjit::rvalue b, gccjit::location loc) @end deffn @geindex gccjit;;context;;new_gt (C++ function) -@anchor{cp/topics/expressions gccjit context new_gt__gccjit rvalue gccjit rvalue gccjit location}@anchor{16c} +@anchor{cp/topics/expressions gccjit context new_gt__gccjit rvalue gccjit rvalue gccjit location}@anchor{170} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_gt (gccjit::rvalue a, gccjit::rvalue b, gccjit::location loc) @end deffn @geindex gccjit;;context;;new_ge (C++ function) -@anchor{cp/topics/expressions gccjit context new_ge__gccjit rvalue gccjit rvalue gccjit location}@anchor{16d} +@anchor{cp/topics/expressions gccjit context new_ge__gccjit rvalue gccjit rvalue gccjit location}@anchor{171} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_ge (gccjit::rvalue a, gccjit::rvalue b, gccjit::location loc) @end deffn The most concise way to spell them is with overloaded operators: @geindex operator== (C++ function) -@anchor{cp/topics/expressions eq-operator__gccjit rvalue gccjit rvalue}@anchor{16e} +@anchor{cp/topics/expressions eq-operator__gccjit rvalue gccjit rvalue}@anchor{172} @deffn {C++ Function} gccjit::rvalue operator== (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12637,7 +12698,7 @@ gccjit::rvalue cond = (a == ctxt.zero (t_int)); @end deffn @geindex operator!= (C++ function) -@anchor{cp/topics/expressions neq-operator__gccjit rvalue gccjit rvalue}@anchor{16f} +@anchor{cp/topics/expressions neq-operator__gccjit rvalue gccjit rvalue}@anchor{173} @deffn {C++ Function} gccjit::rvalue operator!= (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12648,7 +12709,7 @@ gccjit::rvalue cond = (i != j); @end deffn @geindex operator< (C++ function) -@anchor{cp/topics/expressions lt-operator__gccjit rvalue gccjit rvalue}@anchor{170} +@anchor{cp/topics/expressions lt-operator__gccjit rvalue gccjit rvalue}@anchor{174} @deffn {C++ Function} gccjit::rvalue operator< (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12659,7 +12720,7 @@ gccjit::rvalue cond = i < n; @end deffn @geindex operator<= (C++ function) -@anchor{cp/topics/expressions lte-operator__gccjit rvalue gccjit rvalue}@anchor{171} +@anchor{cp/topics/expressions lte-operator__gccjit rvalue gccjit rvalue}@anchor{175} @deffn {C++ Function} gccjit::rvalue operator<= (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12670,7 +12731,7 @@ gccjit::rvalue cond = i <= n; @end deffn @geindex operator> (C++ function) -@anchor{cp/topics/expressions gt-operator__gccjit rvalue gccjit rvalue}@anchor{172} +@anchor{cp/topics/expressions gt-operator__gccjit rvalue gccjit rvalue}@anchor{176} @deffn {C++ Function} gccjit::rvalue operator> (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12681,7 +12742,7 @@ gccjit::rvalue cond = (ch > limit); @end deffn @geindex operator>= (C++ function) -@anchor{cp/topics/expressions gte-operator__gccjit rvalue gccjit rvalue}@anchor{173} +@anchor{cp/topics/expressions gte-operator__gccjit rvalue gccjit rvalue}@anchor{177} @deffn {C++ Function} gccjit::rvalue operator>= (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12694,12 +12755,12 @@ gccjit::rvalue cond = (score >= ctxt.new_rvalue (t_int, 100)); @c TODO: beyond this point @node Function calls<2>,Type-coercion<2>,Comparisons<2>,Rvalues<2> -@anchor{cp/topics/expressions function-calls}@anchor{174} +@anchor{cp/topics/expressions function-calls}@anchor{178} @subsubsection Function calls @geindex gcc_jit_context_new_call (C++ function) -@anchor{cp/topics/expressions gcc_jit_context_new_call__gcc_jit_contextP gcc_jit_locationP gcc_jit_functionP i gcc_jit_rvaluePP}@anchor{175} +@anchor{cp/topics/expressions gcc_jit_context_new_call__gcc_jit_contextP gcc_jit_locationP gcc_jit_functionP i gcc_jit_rvaluePP}@anchor{179} @deffn {C++ Function} gcc_jit_rvalue* gcc_jit_context_new_call (gcc_jit_context* ctxt, gcc_jit_location* loc, gcc_jit_function* func, int numargs, gcc_jit_rvalue** args) Given a function and the given table of argument rvalues, construct a @@ -12708,14 +12769,14 @@ call to the function, with the result as an rvalue. @cartouche @quotation Note @code{gccjit::context::new_call()} merely builds a -@pxref{142,,gccjit;;rvalue} i.e. an expression that can be evaluated, +@pxref{146,,gccjit;;rvalue} i.e. an expression that can be evaluated, perhaps as part of a more complicated expression. The call @emph{won't} happen unless you add a statement to a function that evaluates the expression. For example, if you want to call a function and discard the result (or to call a function with @code{void} return type), use -@pxref{176,,gccjit;;block;;add_eval()}: +@pxref{17a,,gccjit;;block;;add_eval()}: @example /* Add "(void)printf (arg0, arg1);". */ @@ -12728,12 +12789,12 @@ block.add_eval (ctxt.new_call (printf_func, arg0, arg1)); @end deffn @node Type-coercion<2>,,Function calls<2>,Rvalues<2> -@anchor{cp/topics/expressions type-coercion}@anchor{177} +@anchor{cp/topics/expressions type-coercion}@anchor{17b} @subsubsection Type-coercion @geindex gccjit;;context;;new_cast (C++ function) -@anchor{cp/topics/expressions gccjit context new_cast__gccjit rvalue gccjit type gccjit location}@anchor{178} +@anchor{cp/topics/expressions gccjit context new_cast__gccjit rvalue gccjit type gccjit location}@anchor{17c} @deffn {C++ Function} gccjit::rvalue gccjit::context::new_cast (gccjit::rvalue rvalue, gccjit::type type, gccjit::location loc) Given an rvalue of T, construct another rvalue of another type. @@ -12758,24 +12819,24 @@ P* <-> Q*, for pointer types P and Q @end deffn @node Lvalues<2>,Working with pointers structs and unions<2>,Rvalues<2>,Expressions<2> -@anchor{cp/topics/expressions lvalues}@anchor{179} +@anchor{cp/topics/expressions lvalues}@anchor{17d} @subsubsection Lvalues @geindex gccjit;;lvalue (C++ class) -@anchor{cp/topics/expressions gccjit lvalue}@anchor{17a} +@anchor{cp/topics/expressions gccjit lvalue}@anchor{17e} @deffn {C++ Class} gccjit::lvalue @end deffn An lvalue is something that can of the @emph{left}-hand side of an assignment: a storage area (such as a variable). It is a subclass of -@pxref{142,,gccjit;;rvalue}, where the rvalue is computed by reading from the +@pxref{146,,gccjit;;rvalue}, where the rvalue is computed by reading from the storage area. It iss a thin wrapper around @pxref{24,,gcc_jit_lvalue *} from the C API. @geindex gccjit;;lvalue;;get_address (C++ function) -@anchor{cp/topics/expressions gccjit lvalue get_address__gccjit location}@anchor{17b} +@anchor{cp/topics/expressions gccjit lvalue get_address__gccjit location}@anchor{17f} @deffn {C++ Function} gccjit::rvalue gccjit::lvalue::get_address (gccjit::location loc) Take the address of an lvalue; analogous to: @@ -12797,27 +12858,27 @@ Parameter "loc" is optional. @end menu @node Global variables<2>,,,Lvalues<2> -@anchor{cp/topics/expressions global-variables}@anchor{17c} +@anchor{cp/topics/expressions global-variables}@anchor{180} @subsubsection Global variables @geindex gccjit;;context;;new_global (C++ function) -@anchor{cp/topics/expressions gccjit context new_global__enum gccjit type cCP gccjit location}@anchor{17d} +@anchor{cp/topics/expressions gccjit context new_global__enum gccjit type cCP gccjit location}@anchor{181} @deffn {C++ Function} gccjit::lvalue gccjit::context::new_global (enum gcc_jit_global_kind, gccjit::type type, const char* name, gccjit::location loc) Add a new global variable of the given type and name to the context. -This is a thin wrapper around @pxref{b0,,gcc_jit_context_new_global()} from +This is a thin wrapper around @pxref{b2,,gcc_jit_context_new_global()} from the C API; the "kind" parameter has the same meaning as there. @end deffn @node Working with pointers structs and unions<2>,,Lvalues<2>,Expressions<2> -@anchor{cp/topics/expressions working-with-pointers-structs-and-unions}@anchor{17e} +@anchor{cp/topics/expressions working-with-pointers-structs-and-unions}@anchor{182} @subsubsection Working with pointers, structs and unions @geindex gccjit;;rvalue;;dereference (C++ function) -@anchor{cp/topics/expressions gccjit rvalue dereference__gccjit location}@anchor{17f} +@anchor{cp/topics/expressions gccjit rvalue dereference__gccjit location}@anchor{183} @deffn {C++ Function} gccjit::lvalue gccjit::rvalue::dereference (gccjit::location loc) Given an rvalue of pointer type @code{T *}, dereferencing the pointer, @@ -12838,7 +12899,7 @@ If you don't need to specify the location, this can also be expressed using an overloaded operator: @geindex gccjit;;rvalue;;operator* (C++ function) -@anchor{cp/topics/expressions gccjit rvalue mul-operator}@anchor{180} +@anchor{cp/topics/expressions gccjit rvalue mul-operator}@anchor{184} @deffn {C++ Function} gccjit::lvalue gccjit::rvalue::operator* () @example @@ -12851,7 +12912,7 @@ gccjit::lvalue content = *ptr; Field access is provided separately for both lvalues and rvalues: @geindex gccjit;;lvalue;;access_field (C++ function) -@anchor{cp/topics/expressions gccjit lvalue access_field__gccjit field gccjit location}@anchor{181} +@anchor{cp/topics/expressions gccjit lvalue access_field__gccjit field gccjit location}@anchor{185} @deffn {C++ Function} gccjit::lvalue gccjit::lvalue::access_field (gccjit::field field, gccjit::location loc) Given an lvalue of struct or union type, access the given field, @@ -12867,7 +12928,7 @@ in C. @end deffn @geindex gccjit;;rvalue;;access_field (C++ function) -@anchor{cp/topics/expressions gccjit rvalue access_field__gccjit field gccjit location}@anchor{182} +@anchor{cp/topics/expressions gccjit rvalue access_field__gccjit field gccjit location}@anchor{186} @deffn {C++ Function} gccjit::rvalue gccjit::rvalue::access_field (gccjit::field field, gccjit::location loc) Given an rvalue of struct or union type, access the given field @@ -12883,7 +12944,7 @@ in C. @end deffn @geindex gccjit;;rvalue;;dereference_field (C++ function) -@anchor{cp/topics/expressions gccjit rvalue dereference_field__gccjit field gccjit location}@anchor{183} +@anchor{cp/topics/expressions gccjit rvalue dereference_field__gccjit field gccjit location}@anchor{187} @deffn {C++ Function} gccjit::lvalue gccjit::rvalue::dereference_field (gccjit::field field, gccjit::location loc) Given an rvalue of pointer type @code{T *} where T is of struct or union @@ -12899,7 +12960,7 @@ in C, itself equivalent to @code{(*EXPR).FIELD}. @end deffn @geindex gccjit;;context;;new_array_access (C++ function) -@anchor{cp/topics/expressions gccjit context new_array_access__gccjit rvalue gccjit rvalue gccjit location}@anchor{184} +@anchor{cp/topics/expressions gccjit context new_array_access__gccjit rvalue gccjit rvalue gccjit location}@anchor{188} @deffn {C++ Function} gccjit::lvalue gccjit::context::new_array_access (gccjit::rvalue ptr, gccjit::rvalue index, gccjit::location loc) Given an rvalue of pointer type @code{T *}, get at the element @cite{T} at @@ -12918,7 +12979,7 @@ in C (or, indeed, to @code{PTR + INDEX}). Parameter "loc" is optional. @end deffn -For array accesses where you don't need to specify a @pxref{121,,gccjit;;location}, +For array accesses where you don't need to specify a @pxref{124,,gccjit;;location}, two overloaded operators are available: @quotation @@ -12958,7 +13019,7 @@ gccjit::lvalue element = array[0]; @c . @node Creating and using functions<2>,Source Locations<2>,Expressions<2>,Topic Reference<2> -@anchor{cp/topics/functions doc}@anchor{185}@anchor{cp/topics/functions creating-and-using-functions}@anchor{186} +@anchor{cp/topics/functions doc}@anchor{189}@anchor{cp/topics/functions creating-and-using-functions}@anchor{18a} @subsection Creating and using functions @@ -12971,36 +13032,36 @@ gccjit::lvalue element = array[0]; @end menu @node Params<2>,Functions<2>,,Creating and using functions<2> -@anchor{cp/topics/functions params}@anchor{187} +@anchor{cp/topics/functions params}@anchor{18b} @subsubsection Params @geindex gccjit;;param (C++ class) -@anchor{cp/topics/functions gccjit param}@anchor{188} +@anchor{cp/topics/functions gccjit param}@anchor{18c} @deffn {C++ Class} gccjit::param A @cite{gccjit::param} represents a parameter to a function. @end deffn @geindex gccjit;;context;;new_param (C++ function) -@anchor{cp/topics/functions gccjit context new_param__gccjit type cCP gccjit location}@anchor{f0} +@anchor{cp/topics/functions gccjit context new_param__gccjit type cCP gccjit location}@anchor{f3} @deffn {C++ Function} gccjit::param gccjit::context::new_param (gccjit::type type, const char* name, gccjit::location loc) In preparation for creating a function, create a new parameter of the given type and name. @end deffn -@pxref{188,,gccjit;;param} is a subclass of @pxref{17a,,gccjit;;lvalue} (and thus -of @pxref{142,,gccjit;;rvalue} and @pxref{12c,,gccjit;;object}). It is a thin +@pxref{18c,,gccjit;;param} is a subclass of @pxref{17e,,gccjit;;lvalue} (and thus +of @pxref{146,,gccjit;;rvalue} and @pxref{130,,gccjit;;object}). It is a thin wrapper around the C API's @pxref{25,,gcc_jit_param *}. @node Functions<2>,Blocks<2>,Params<2>,Creating and using functions<2> -@anchor{cp/topics/functions functions}@anchor{189} +@anchor{cp/topics/functions functions}@anchor{18d} @subsubsection Functions @geindex gccjit;;function (C++ class) -@anchor{cp/topics/functions gccjit function}@anchor{18a} +@anchor{cp/topics/functions gccjit function}@anchor{18e} @deffn {C++ Class} gccjit::function A @cite{gccjit::function} represents a function - either one that we're @@ -13008,7 +13069,7 @@ creating ourselves, or one that we're referencing. @end deffn @geindex gccjit;;context;;new_function (C++ function) -@anchor{cp/topics/functions gccjit context new_function__enum gccjit type cCP std vector param R i gccjit location}@anchor{18b} +@anchor{cp/topics/functions gccjit context new_function__enum gccjit type cCP std vector param R i gccjit location}@anchor{18f} @deffn {C++ Function} gccjit::function gccjit::context::new_function (enum gcc_jit_function_kind, gccjit::type return_type, const char* name, std::vector& params, int is_variadic, gccjit::location loc) Create a gcc_jit_function with the given name and parameters. @@ -13019,29 +13080,29 @@ This is a wrapper around the C API's @pxref{11,,gcc_jit_context_new_function()}. @end deffn @geindex gccjit;;context;;get_builtin_function (C++ function) -@anchor{cp/topics/functions gccjit context get_builtin_function__cCP}@anchor{18c} +@anchor{cp/topics/functions gccjit context get_builtin_function__cCP}@anchor{190} @deffn {C++ Function} gccjit::function gccjit::context::get_builtin_function (const char* name) This is a wrapper around the C API's -@pxref{c7,,gcc_jit_context_get_builtin_function()}. +@pxref{c9,,gcc_jit_context_get_builtin_function()}. @end deffn @geindex gccjit;;function;;get_param (C++ function) -@anchor{cp/topics/functions gccjit function get_param__iC}@anchor{18d} +@anchor{cp/topics/functions gccjit function get_param__iC}@anchor{191} @deffn {C++ Function} gccjit::param gccjit::function::get_param (int index) const Get the param of the given index (0-based). @end deffn @geindex gccjit;;function;;dump_to_dot (C++ function) -@anchor{cp/topics/functions gccjit function dump_to_dot__cCP}@anchor{103} +@anchor{cp/topics/functions gccjit function dump_to_dot__cCP}@anchor{106} @deffn {C++ Function} void gccjit::function::dump_to_dot (const char* path) Emit the function in graphviz format to the given path. @end deffn @geindex gccjit;;function;;new_local (C++ function) -@anchor{cp/topics/functions gccjit function new_local__gccjit type cCP gccjit location}@anchor{fa} +@anchor{cp/topics/functions gccjit function new_local__gccjit type cCP gccjit location}@anchor{fd} @deffn {C++ Function} gccjit::lvalue gccjit::function::new_local (gccjit::type type, const char* name, gccjit::location loc) Create a new local variable within the function, of the given type and @@ -13049,19 +13110,19 @@ name. @end deffn @node Blocks<2>,Statements<2>,Functions<2>,Creating and using functions<2> -@anchor{cp/topics/functions blocks}@anchor{18e} +@anchor{cp/topics/functions blocks}@anchor{192} @subsubsection Blocks @geindex gccjit;;block (C++ class) -@anchor{cp/topics/functions gccjit block}@anchor{18f} +@anchor{cp/topics/functions gccjit block}@anchor{193} @deffn {C++ Class} gccjit::block A @cite{gccjit::block} represents a basic block within a function i.e. a sequence of statements with a single entry point and a single exit point. -@pxref{18f,,gccjit;;block} is a subclass of @pxref{12c,,gccjit;;object}. +@pxref{193,,gccjit;;block} is a subclass of @pxref{130,,gccjit;;object}. The first basic block that you create within a function will be the entrypoint. @@ -13074,7 +13135,7 @@ one function. @end deffn @geindex gccjit;;function;;new_block (C++ function) -@anchor{cp/topics/functions gccjit function new_block__cCP}@anchor{190} +@anchor{cp/topics/functions gccjit function new_block__cCP}@anchor{194} @deffn {C++ Function} gccjit::block gccjit::function::new_block (const char* name) Create a basic block of the given name. The name may be NULL, but @@ -13084,12 +13145,12 @@ messages. @end deffn @node Statements<2>,,Blocks<2>,Creating and using functions<2> -@anchor{cp/topics/functions statements}@anchor{191} +@anchor{cp/topics/functions statements}@anchor{195} @subsubsection Statements @geindex gccjit;;block;;add_eval (C++ function) -@anchor{cp/topics/functions gccjit block add_eval__gccjit rvalue gccjit location}@anchor{176} +@anchor{cp/topics/functions gccjit block add_eval__gccjit rvalue gccjit location}@anchor{17a} @deffn {C++ Function} void gccjit::block::add_eval (gccjit::rvalue rvalue, gccjit::location loc) Add evaluation of an rvalue, discarding the result @@ -13105,7 +13166,7 @@ This is equivalent to this C code: @end deffn @geindex gccjit;;block;;add_assignment (C++ function) -@anchor{cp/topics/functions gccjit block add_assignment__gccjit lvalue gccjit rvalue gccjit location}@anchor{fc} +@anchor{cp/topics/functions gccjit block add_assignment__gccjit lvalue gccjit rvalue gccjit location}@anchor{ff} @deffn {C++ Function} void gccjit::block::add_assignment (gccjit::lvalue lvalue, gccjit::rvalue rvalue, gccjit::location loc) Add evaluation of an rvalue, assigning the result to the given @@ -13121,7 +13182,7 @@ lvalue = rvalue; @end deffn @geindex gccjit;;block;;add_assignment_op (C++ function) -@anchor{cp/topics/functions gccjit block add_assignment_op__gccjit lvalue enum gccjit rvalue gccjit location}@anchor{100} +@anchor{cp/topics/functions gccjit block add_assignment_op__gccjit lvalue enum gccjit rvalue gccjit location}@anchor{103} @deffn {C++ Function} void gccjit::block::add_assignment_op (gccjit::lvalue lvalue, enum gcc_jit_binary_op, gccjit::rvalue rvalue, gccjit::location loc) Add evaluation of an rvalue, using the result to modify an @@ -13151,7 +13212,7 @@ loop_body.add_assignment_op ( @end deffn @geindex gccjit;;block;;add_comment (C++ function) -@anchor{cp/topics/functions gccjit block add_comment__cCP gccjit location}@anchor{10b} +@anchor{cp/topics/functions gccjit block add_comment__cCP gccjit location}@anchor{10e} @deffn {C++ Function} void gccjit::block::add_comment (const char* text, gccjit::location loc) Add a no-op textual comment to the internal representation of the @@ -13165,7 +13226,7 @@ Parameter "loc" is optional. @end deffn @geindex gccjit;;block;;end_with_conditional (C++ function) -@anchor{cp/topics/functions gccjit block end_with_conditional__gccjit rvalue gccjit block gccjit block gccjit location}@anchor{ff} +@anchor{cp/topics/functions gccjit block end_with_conditional__gccjit rvalue gccjit block gccjit block gccjit location}@anchor{102} @deffn {C++ Function} void gccjit::block::end_with_conditional (gccjit::rvalue boolval, gccjit::block on_true, gccjit::block on_false, gccjit::location loc) Terminate a block by adding evaluation of an rvalue, branching on the @@ -13186,7 +13247,7 @@ block, boolval, on_true, and on_false must be non-NULL. @end deffn @geindex gccjit;;block;;end_with_jump (C++ function) -@anchor{cp/topics/functions gccjit block end_with_jump__gccjit block gccjit location}@anchor{192} +@anchor{cp/topics/functions gccjit block end_with_jump__gccjit block gccjit location}@anchor{196} @deffn {C++ Function} void gccjit::block::end_with_jump (gccjit::block target, gccjit::location loc) Terminate a block by adding a jump to the given target block. @@ -13201,7 +13262,7 @@ goto target; @end deffn @geindex gccjit;;block;;end_with_return (C++ function) -@anchor{cp/topics/functions gccjit block end_with_return__gccjit rvalue gccjit location}@anchor{193} +@anchor{cp/topics/functions gccjit block end_with_return__gccjit rvalue gccjit location}@anchor{197} @deffn {C++ Function} void gccjit::block::end_with_return (gccjit::rvalue rvalue, gccjit::location loc) Terminate a block. @@ -13252,12 +13313,12 @@ return; @c . @node Source Locations<2>,Compiling a context<2>,Creating and using functions<2>,Topic Reference<2> -@anchor{cp/topics/locations source-locations}@anchor{194}@anchor{cp/topics/locations doc}@anchor{195} +@anchor{cp/topics/locations source-locations}@anchor{198}@anchor{cp/topics/locations doc}@anchor{199} @subsection Source Locations @geindex gccjit;;location (C++ class) -@anchor{cp/topics/locations gccjit location}@anchor{121} +@anchor{cp/topics/locations gccjit location}@anchor{124} @deffn {C++ Class} gccjit::location A @cite{gccjit::location} encapsulates a source code location, so that @@ -13268,10 +13329,10 @@ single-step through your language. @cite{gccjit::location} instances are optional: you can always omit them from any C++ API entrypoint accepting one. -You can construct them using @pxref{10f,,gccjit;;context;;new_location()}. +You can construct them using @pxref{112,,gccjit;;context;;new_location()}. You need to enable @pxref{42,,GCC_JIT_BOOL_OPTION_DEBUGINFO} on the -@pxref{119,,gccjit;;context} for these locations to actually be usable by +@pxref{11c,,gccjit;;context} for these locations to actually be usable by the debugger: @example @@ -13282,7 +13343,7 @@ ctxt.set_bool_option (GCC_JIT_BOOL_OPTION_DEBUGINFO, 1); @end deffn @geindex gccjit;;context;;new_location (C++ function) -@anchor{cp/topics/locations gccjit context new_location__cCP i i}@anchor{10f} +@anchor{cp/topics/locations gccjit context new_location__cCP i i}@anchor{112} @deffn {C++ Function} gccjit::location gccjit::context::new_location (const char* filename, int line, int column) Create a @cite{gccjit::location} instance representing the given source @@ -13295,13 +13356,13 @@ location. @end menu @node Faking it<2>,,,Source Locations<2> -@anchor{cp/topics/locations faking-it}@anchor{196} +@anchor{cp/topics/locations faking-it}@anchor{19a} @subsubsection Faking it If you don't have source code for your internal representation, but need to debug, you can generate a C-like representation of the functions in -your context using @pxref{120,,gccjit;;context;;dump_to_file()}: +your context using @pxref{123,,gccjit;;context;;dump_to_file()}: @example ctxt.dump_to_file ("/tmp/something.c", @@ -13333,13 +13394,13 @@ file, giving you @emph{something} you can step through in the debugger. @c . @node Compiling a context<2>,,Source Locations<2>,Topic Reference<2> -@anchor{cp/topics/compilation compiling-a-context}@anchor{197}@anchor{cp/topics/compilation doc}@anchor{198} +@anchor{cp/topics/compilation compiling-a-context}@anchor{19b}@anchor{cp/topics/compilation doc}@anchor{19c} @subsection Compiling a context -Once populated, a @pxref{119,,gccjit;;context} can be compiled to -machine code, either in-memory via @pxref{f2,,gccjit;;context;;compile()} or -to disk via @pxref{199,,gccjit;;context;;compile_to_file()}. +Once populated, a @pxref{11c,,gccjit;;context} can be compiled to +machine code, either in-memory via @pxref{f5,,gccjit;;context;;compile()} or +to disk via @pxref{19d,,gccjit;;context;;compile_to_file()}. You can compile a context multiple times (using either form of compilation), although any errors that occur on the context will @@ -13352,12 +13413,12 @@ prevent any future compilation of that context. @end menu @node In-memory compilation<2>,Ahead-of-time compilation<2>,,Compiling a context<2> -@anchor{cp/topics/compilation in-memory-compilation}@anchor{19a} +@anchor{cp/topics/compilation in-memory-compilation}@anchor{19e} @subsubsection In-memory compilation @geindex gccjit;;context;;compile (C++ function) -@anchor{cp/topics/compilation gccjit context compile}@anchor{f2} +@anchor{cp/topics/compilation gccjit context compile}@anchor{f5} @deffn {C++ Function} gcc_jit_result* gccjit::context::compile () This calls into GCC and builds the code, returning a @@ -13368,19 +13429,19 @@ This is a thin wrapper around the @end deffn @node Ahead-of-time compilation<2>,,In-memory compilation<2>,Compiling a context<2> -@anchor{cp/topics/compilation ahead-of-time-compilation}@anchor{19b} +@anchor{cp/topics/compilation ahead-of-time-compilation}@anchor{19f} @subsubsection Ahead-of-time compilation Although libgccjit is primarily aimed at just-in-time compilation, it can also be used for implementing more traditional ahead-of-time -compilers, via the @pxref{199,,gccjit;;context;;compile_to_file()} method. +compilers, via the @pxref{19d,,gccjit;;context;;compile_to_file()} method. @geindex gccjit;;context;;compile_to_file (C++ function) -@anchor{cp/topics/compilation gccjit context compile_to_file__enum cCP}@anchor{199} +@anchor{cp/topics/compilation gccjit context compile_to_file__enum cCP}@anchor{19d} @deffn {C++ Function} void gccjit::context::compile_to_file (enum gcc_jit_output_kind, const char* output_path) -Compile the @pxref{119,,gccjit;;context} to a file of the given +Compile the @pxref{11c,,gccjit;;context} to a file of the given kind. This is a thin wrapper around the @@ -13405,7 +13466,7 @@ This is a thin wrapper around the @c . @node Internals,Indices and tables,C++ bindings for libgccjit,Top -@anchor{internals/index internals}@anchor{19c}@anchor{internals/index doc}@anchor{19d} +@anchor{internals/index internals}@anchor{1a0}@anchor{internals/index doc}@anchor{1a1} @chapter Internals @@ -13420,7 +13481,7 @@ This is a thin wrapper around the @end menu @node Working on the JIT library,Running the test suite,,Internals -@anchor{internals/index working-on-the-jit-library}@anchor{19e} +@anchor{internals/index working-on-the-jit-library}@anchor{1a2} @section Working on the JIT library @@ -13457,7 +13518,7 @@ gcc/libgccjit.so.0.0.1: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), Here's what those configuration options mean: @geindex command line option; --enable-host-shared -@anchor{internals/index cmdoption--enable-host-shared}@anchor{19f} +@anchor{internals/index cmdoption--enable-host-shared}@anchor{1a3} @deffn {Option} --enable-host-shared Configuring with this option means that the compiler is built as @@ -13466,7 +13527,7 @@ but it necessary for a shared library. @end deffn @geindex command line option; --enable-languages=jit@comma{}c++ -@anchor{internals/index cmdoption--enable-languages}@anchor{1a0} +@anchor{internals/index cmdoption--enable-languages}@anchor{1a4} @deffn {Option} --enable-languages=jit,c++ This specifies which frontends to build. The JIT library looks like @@ -13485,7 +13546,7 @@ c++: error trying to exec 'cc1plus': execvp: No such file or directory @end deffn @geindex command line option; --disable-bootstrap -@anchor{internals/index cmdoption--disable-bootstrap}@anchor{1a1} +@anchor{internals/index cmdoption--disable-bootstrap}@anchor{1a5} @deffn {Option} --disable-bootstrap For hacking on the "jit" subdirectory, performing a full @@ -13495,7 +13556,7 @@ the compiler can still bootstrap itself. @end deffn @geindex command line option; --enable-checking=release -@anchor{internals/index cmdoption--enable-checking}@anchor{1a2} +@anchor{internals/index cmdoption--enable-checking}@anchor{1a6} @deffn {Option} --enable-checking=release The compile can perform extensive self-checking as it runs, useful when @@ -13506,7 +13567,7 @@ disable this self-checking. @end deffn @node Running the test suite,Environment variables,Working on the JIT library,Internals -@anchor{internals/index running-the-test-suite}@anchor{1a3} +@anchor{internals/index running-the-test-suite}@anchor{1a7} @section Running the test suite @@ -13569,7 +13630,7 @@ and once a test has been compiled, you can debug it directly: @end menu @node Running under valgrind,,,Running the test suite -@anchor{internals/index running-under-valgrind}@anchor{1a4} +@anchor{internals/index running-under-valgrind}@anchor{1a8} @subsection Running under valgrind @@ -13617,7 +13678,7 @@ When running under valgrind, it's best to have configured gcc with various known false positives. @node Environment variables,Packaging notes,Running the test suite,Internals -@anchor{internals/index environment-variables}@anchor{1a5} +@anchor{internals/index environment-variables}@anchor{1a9} @section Environment variables @@ -13625,7 +13686,7 @@ When running client code against a locally-built libgccjit, three environment variables need to be set up: @geindex environment variable; LD_LIBRARY_PATH -@anchor{internals/index envvar-LD_LIBRARY_PATH}@anchor{1a6} +@anchor{internals/index envvar-LD_LIBRARY_PATH}@anchor{1aa} @deffn {Environment Variable} LD_LIBRARY_PATH @quotation @@ -13647,7 +13708,7 @@ libgccjit.so.0.0.1: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), @end deffn @geindex environment variable; PATH -@anchor{internals/index envvar-PATH}@anchor{1a7} +@anchor{internals/index envvar-PATH}@anchor{1ab} @deffn {Environment Variable} PATH The library uses a driver executable for converting from .s assembler @@ -13666,7 +13727,7 @@ of development. @end deffn @geindex environment variable; LIBRARY_PATH -@anchor{internals/index envvar-LIBRARY_PATH}@anchor{1a8} +@anchor{internals/index envvar-LIBRARY_PATH}@anchor{1ac} @deffn {Environment Variable} LIBRARY_PATH The driver executable invokes the linker, and the latter needs to locate @@ -13702,11 +13763,11 @@ hello world @noindent @node Packaging notes,Overview of code structure,Environment variables,Internals -@anchor{internals/index packaging-notes}@anchor{1a9} +@anchor{internals/index packaging-notes}@anchor{1ad} @section Packaging notes -The configure-time option @pxref{19f,,--enable-host-shared} is needed when +The configure-time option @pxref{1a3,,--enable-host-shared} is needed when building the jit in order to get position-independent code. This will slow down the regular compiler by a few percent. Hence when packaging gcc with libgccjit, please configure and build twice: @@ -13717,10 +13778,10 @@ with libgccjit, please configure and build twice: @itemize * @item -once without @pxref{19f,,--enable-host-shared} for most languages, and +once without @pxref{1a3,,--enable-host-shared} for most languages, and @item -once with @pxref{19f,,--enable-host-shared} for the jit +once with @pxref{1a3,,--enable-host-shared} for the jit @end itemize @end quotation @@ -13764,7 +13825,7 @@ popd @noindent @node Overview of code structure,Design notes,Packaging notes,Internals -@anchor{internals/index overview-of-code-structure}@anchor{1aa} +@anchor{internals/index overview-of-code-structure}@anchor{1ae} @section Overview of code structure @@ -14228,7 +14289,7 @@ JIT: gcc::jit::logger::~logger() @noindent @node Design notes,,Overview of code structure,Internals -@anchor{internals/index design-notes}@anchor{1ab} +@anchor{internals/index design-notes}@anchor{1af} @section Design notes @@ -14241,7 +14302,7 @@ close as possible to the error; failing that, a good place is within @code{recording::context::validate ()} in jit-recording.c. @node Indices and tables,Index,Internals,Top -@anchor{index indices-and-tables}@anchor{1ac} +@anchor{index indices-and-tables}@anchor{1b0} @unnumbered Indices and tables diff --git a/gcc/jit/docs/cp/topics/contexts.rst b/gcc/jit/docs/cp/topics/contexts.rst index b26a29d0e52..162e4aec8f3 100644 --- a/gcc/jit/docs/cp/topics/contexts.rst +++ b/gcc/jit/docs/cp/topics/contexts.rst @@ -184,6 +184,23 @@ Boolean options :c:func:`gcc_jit_context_set_bool_option`; the options have the same meaning. +.. function:: void \ + gccjit::context::set_bool_allow_unreachable_blocks (int bool_value) + + By default, libgccjit will issue an error about unreachable blocks + within a function. + + This entrypoint can be used to disable that error; it is a thin wrapper + around the C API + :c:func:`gcc_jit_context_set_bool_allow_unreachable_blocks`. + + This entrypoint was added in :ref:`LIBGCCJIT_ABI_2`; you can test for + its presence using + + .. code-block:: c + + #ifdef LIBGCCJIT_HAVE_gcc_jit_context_set_bool_allow_unreachable_blocks + Integer options *************** diff --git a/gcc/jit/docs/topics/compatibility.rst b/gcc/jit/docs/topics/compatibility.rst index dff1d0b7424..91bbb05790b 100644 --- a/gcc/jit/docs/topics/compatibility.rst +++ b/gcc/jit/docs/topics/compatibility.rst @@ -88,3 +88,10 @@ continue to work, with this being handled transparently by the linker ------------------- ``LIBGCCJIT_ABI_1`` covers the addition of :func:`gcc_jit_context_add_command_line_option` + +.. _LIBGCCJIT_ABI_2: + +``LIBGCCJIT_ABI_2`` +------------------- +``LIBGCCJIT_ABI_2`` covers the addition of +:func:`gcc_jit_context_set_bool_allow_unreachable_blocks` diff --git a/gcc/jit/docs/topics/contexts.rst b/gcc/jit/docs/topics/contexts.rst index b0f4fb87eee..1dd4685a4c8 100644 --- a/gcc/jit/docs/topics/contexts.rst +++ b/gcc/jit/docs/topics/contexts.rst @@ -293,6 +293,15 @@ future activies on a context to the given `FILE *`. Options ------- +Options present in the initial release of libgccjit were handled using +enums, whereas those added subsequently have their own per-option API +entrypoints. + +Adding entrypoints for each new option means that client code that use +the new options can be identified directly from binary metadata, which +would not be possible if we instead extended the various +``enum gcc_jit_*_option``. + String Options ************** @@ -304,7 +313,7 @@ String Options .. type:: enum gcc_jit_str_option - There is currently just one string option: + There is just one string option specified this way: .. macro:: GCC_JIT_STR_OPTION_PROGNAME @@ -441,6 +450,22 @@ Boolean options If true, the :type:`gcc_jit_context` will not clean up intermediate files written to the filesystem, and will display their location on stderr. +.. function:: void \ + gcc_jit_context_set_bool_allow_unreachable_blocks (gcc_jit_context *ctxt, \ + int bool_value) + + By default, libgccjit will issue an error about unreachable blocks + within a function. + + This entrypoint can be used to disable that error. + + This entrypoint was added in :ref:`LIBGCCJIT_ABI_2`; you can test for + its presence using + + .. code-block:: c + + #ifdef LIBGCCJIT_HAVE_gcc_jit_context_set_bool_allow_unreachable_blocks + Integer options *************** @@ -452,7 +477,7 @@ Integer options .. type:: enum gcc_jit_int_option - There is currently just one integer option: + There is just one integer option specified this way: .. macro:: GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL diff --git a/gcc/jit/jit-common.h b/gcc/jit/jit-common.h index e5e1a1e688a..edf8d2cfa5f 100644 --- a/gcc/jit/jit-common.h +++ b/gcc/jit/jit-common.h @@ -185,6 +185,16 @@ private: FILE *m_file; }; +/* A hidden enum of boolean options that are only exposed via API + entrypoints, rather than via gcc_jit_context_set_bool_option. */ + +enum inner_bool_option +{ + INNER_BOOL_OPTION_ALLOW_UNREACHABLE_BLOCKS, + + NUM_INNER_BOOL_OPTIONS +}; + } // namespace gcc::jit } // namespace gcc diff --git a/gcc/jit/jit-recording.c b/gcc/jit/jit-recording.c index 3d7d5712c5d..ad13aaa498b 100644 --- a/gcc/jit/jit-recording.c +++ b/gcc/jit/jit-recording.c @@ -489,6 +489,9 @@ recording::context::context (context *parent_ctxt) memcpy (m_bool_options, parent_ctxt->m_bool_options, sizeof (m_bool_options)); + memcpy (m_inner_bool_options, + parent_ctxt->m_inner_bool_options, + sizeof (m_inner_bool_options)); set_logger (parent_ctxt->get_logger ()); } else @@ -496,6 +499,7 @@ recording::context::context (context *parent_ctxt) memset (m_str_options, 0, sizeof (m_str_options)); memset (m_int_options, 0, sizeof (m_int_options)); memset (m_bool_options, 0, sizeof (m_bool_options)); + memset (m_inner_bool_options, 0, sizeof (m_inner_bool_options)); } memset (m_basic_types, 0, sizeof (m_basic_types)); @@ -1141,6 +1145,16 @@ recording::context::set_bool_option (enum gcc_jit_bool_option opt, log_bool_option (opt); } +void +recording::context::set_inner_bool_option (enum inner_bool_option inner_opt, + int value) +{ + gcc_assert (inner_opt >= 0 && inner_opt < NUM_INNER_BOOL_OPTIONS); + m_inner_bool_options[inner_opt] = value ? true : false; + log_inner_bool_option (inner_opt); +} + + /* Add the given optname to this context's list of extra options. Implements the post-error-checking part of @@ -1418,6 +1432,10 @@ static const char * const "GCC_JIT_BOOL_OPTION_KEEP_INTERMEDIATES" }; +static const char * const + inner_bool_option_reproducer_strings[NUM_INNER_BOOL_OPTIONS] = { + "gcc_jit_context_set_bool_allow_unreachable_blocks" +}; /* Write the current value of all options to the log file (if any). */ @@ -1437,6 +1455,8 @@ recording::context::log_all_options () const for (opt_idx = 0; opt_idx < GCC_JIT_NUM_BOOL_OPTIONS; opt_idx++) log_bool_option ((enum gcc_jit_bool_option)opt_idx); + for (opt_idx = 0; opt_idx < NUM_INNER_BOOL_OPTIONS; opt_idx++) + log_inner_bool_option ((enum inner_bool_option)opt_idx); } /* Write the current value of the given string option to the @@ -1484,6 +1504,19 @@ recording::context::log_bool_option (enum gcc_jit_bool_option opt) const m_bool_options[opt] ? "true" : "false"); } +/* Write the current value of the given "inner" bool option to the + log file (if any). */ + +void +recording::context::log_inner_bool_option (enum inner_bool_option opt) const +{ + gcc_assert (opt < NUM_INNER_BOOL_OPTIONS); + if (get_logger ()) + log ("%s: %s", + inner_bool_option_reproducer_strings[opt], + m_inner_bool_options[opt] ? "true" : "false"); +} + /* Write C source code to PATH that attempts to replay the API calls made to this context (and its parents), for use in minimizing test cases for libgccjit. @@ -1623,6 +1656,11 @@ recording::context::dump_reproducer_to_file (const char *path) r.get_identifier (contexts[ctxt_idx]), bool_option_reproducer_strings[opt_idx], m_bool_options[opt_idx]); + for (int opt_idx = 0; opt_idx < NUM_INNER_BOOL_OPTIONS; opt_idx++) + r.write (" %s (%s, %i);\n", + inner_bool_option_reproducer_strings[opt_idx], + r.get_identifier (contexts[ctxt_idx]), + m_inner_bool_options[opt_idx]); if (!m_command_line_options.is_empty ()) { @@ -3452,7 +3490,9 @@ recording::function::validate () } /* Check that all blocks are reachable. */ - if (m_blocks.length () > 0 && 0 == num_invalid_blocks) + if (!m_ctxt->get_inner_bool_option + (INNER_BOOL_OPTION_ALLOW_UNREACHABLE_BLOCKS) + && m_blocks.length () > 0 && 0 == num_invalid_blocks) { /* Iteratively walk the graph of blocks, marking their "m_is_reachable" flag, starting at the initial block. */ diff --git a/gcc/jit/jit-recording.h b/gcc/jit/jit-recording.h index 8cd2289b34e..a9bcbb5d632 100644 --- a/gcc/jit/jit-recording.h +++ b/gcc/jit/jit-recording.h @@ -195,6 +195,10 @@ public: set_bool_option (enum gcc_jit_bool_option opt, int value); + void + set_inner_bool_option (enum inner_bool_option inner_opt, + int value); + void add_command_line_option (const char *optname); @@ -223,6 +227,12 @@ public: return m_bool_options[opt]; } + int + get_inner_bool_option (enum inner_bool_option opt) const + { + return m_inner_bool_options[opt]; + } + result * compile (); @@ -266,6 +276,7 @@ private: void log_str_option (enum gcc_jit_str_option opt) const; void log_int_option (enum gcc_jit_int_option opt) const; void log_bool_option (enum gcc_jit_bool_option opt) const; + void log_inner_bool_option (enum inner_bool_option opt) const; void validate (); @@ -287,6 +298,7 @@ private: char *m_str_options[GCC_JIT_NUM_STR_OPTIONS]; int m_int_options[GCC_JIT_NUM_INT_OPTIONS]; bool m_bool_options[GCC_JIT_NUM_BOOL_OPTIONS]; + bool m_inner_bool_options[NUM_INNER_BOOL_OPTIONS]; auto_vec m_command_line_options; /* Dumpfiles that were requested via gcc_jit_context_enable_dump. */ diff --git a/gcc/jit/libgccjit++.h b/gcc/jit/libgccjit++.h index a5353cafd40..cbdc96fbd47 100644 --- a/gcc/jit/libgccjit++.h +++ b/gcc/jit/libgccjit++.h @@ -120,6 +120,8 @@ namespace gccjit void set_bool_option (enum gcc_jit_bool_option opt, int value); + void set_bool_allow_unreachable_blocks (int bool_value); + void add_command_line_option (const char *optname); location @@ -602,7 +604,13 @@ context::set_bool_option (enum gcc_jit_bool_option opt, int value) { gcc_jit_context_set_bool_option (m_inner_ctxt, opt, value); +} +inline void +context::set_bool_allow_unreachable_blocks (int bool_value) +{ + gcc_jit_context_set_bool_allow_unreachable_blocks (m_inner_ctxt, + bool_value); } inline void diff --git a/gcc/jit/libgccjit.c b/gcc/jit/libgccjit.c index 44791abdfc4..7e0bfa66915 100644 --- a/gcc/jit/libgccjit.c +++ b/gcc/jit/libgccjit.c @@ -2182,6 +2182,23 @@ gcc_jit_context_set_bool_option (gcc_jit_context *ctxt, ctxt->set_bool_option (opt, value); } +/* Public entrypoint. See description in libgccjit.h. + + After error-checking, the real work is done by the + gcc::jit::recording::context::set_inner_bool_option method in + jit-recording.c. */ + +void +gcc_jit_context_set_bool_allow_unreachable_blocks (gcc_jit_context *ctxt, + int bool_value) +{ + RETURN_IF_FAIL (ctxt, NULL, NULL, "NULL context"); + JIT_LOG_FUNC (ctxt->get_logger ()); + ctxt->set_inner_bool_option ( + gcc::jit::INNER_BOOL_OPTION_ALLOW_UNREACHABLE_BLOCKS, + bool_value); +} + /* Public entrypoint. See description in libgccjit.h. After error-checking, the real work is done by the diff --git a/gcc/jit/libgccjit.h b/gcc/jit/libgccjit.h index 8b906e75d29..e33900c5ea0 100644 --- a/gcc/jit/libgccjit.h +++ b/gcc/jit/libgccjit.h @@ -140,6 +140,9 @@ gcc_jit_context_acquire (void); extern void gcc_jit_context_release (gcc_jit_context *ctxt); +/* Options present in the initial release of libgccjit. + These were handled using enums. */ + /* Options taking string values. */ enum gcc_jit_str_option { @@ -243,6 +246,31 @@ gcc_jit_context_set_bool_option (gcc_jit_context *ctxt, enum gcc_jit_bool_option opt, int value); +/* Options added after the initial release of libgccjit. + These are handled by providing an entrypoint per option, + rather than by extending the enum gcc_jit_*_option, + so that client code that use these new options can be identified + from binary metadata. */ + +/* By default, libgccjit will issue an error about unreachable blocks + within a function. + + This option can be used to disable that error. + + This entrypoint was added in LIBGCCJIT_ABI_2; you can test for + its presence using + #ifdef LIBGCCJIT_HAVE_gcc_jit_context_set_bool_allow_unreachable_blocks +*/ + +extern void +gcc_jit_context_set_bool_allow_unreachable_blocks (gcc_jit_context *ctxt, + int bool_value); + +/* Pre-canned feature macro to indicate the presence of + gcc_jit_context_set_bool_allow_unreachable_blocks. This can be + tested for with #ifdef. */ +#define LIBGCCJIT_HAVE_gcc_jit_context_set_bool_allow_unreachable_blocks + /* Add an arbitrary gcc command-line option to the context. The context takes a copy of the string, so the (const char *) optname is not needed anymore after the call diff --git a/gcc/jit/libgccjit.map b/gcc/jit/libgccjit.map index a42bc74d07d..b55df1e3e42 100644 --- a/gcc/jit/libgccjit.map +++ b/gcc/jit/libgccjit.map @@ -114,3 +114,9 @@ LIBGCCJIT_ABI_1 { global: gcc_jit_context_add_command_line_option; } LIBGCCJIT_ABI_0; + +# Add support for disabling the check for unreachable blocks (PR jit/66546). +LIBGCCJIT_ABI_2 { + global: + gcc_jit_context_set_bool_allow_unreachable_blocks; +} LIBGCCJIT_ABI_1; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e8544998776..3b4879d7076 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2015-06-30 David Malcolm + + PR jit/66546 + * jit.dg/all-non-failing-tests.h: Add note about + test-validly-unreachable-block.c. + * jit.dg/test-validly-unreachable-block.c: New file. + 2015-06-30 David Malcolm PR jit/66628 diff --git a/gcc/testsuite/jit.dg/all-non-failing-tests.h b/gcc/testsuite/jit.dg/all-non-failing-tests.h index a54041ff23b..67a16de9b08 100644 --- a/gcc/testsuite/jit.dg/all-non-failing-tests.h +++ b/gcc/testsuite/jit.dg/all-non-failing-tests.h @@ -189,6 +189,10 @@ #undef create_code #undef verify_code +/* test-validly-unreachable-block.c: We don't use this one, since the use + of gcc_jit_context_set_bool_allow_unreachable_blocks affects the whole + context. */ + /* test-volatile.c */ #define create_code create_code_volatile #define verify_code verify_code_volatile diff --git a/gcc/testsuite/jit.dg/test-validly-unreachable-block.c b/gcc/testsuite/jit.dg/test-validly-unreachable-block.c new file mode 100644 index 00000000000..2664818992a --- /dev/null +++ b/gcc/testsuite/jit.dg/test-validly-unreachable-block.c @@ -0,0 +1,51 @@ +#include +#include +#include + +#include "libgccjit.h" + +#include "harness.h" + +void +create_code (gcc_jit_context *ctxt, void *user_data) +{ + /* Let's try to inject the equivalent of: + void + test_fn () + { + return; + + return; + } + where the second block is unreachable, but have it + survive validation (PR jit/66546). + */ + gcc_jit_context_set_bool_allow_unreachable_blocks (ctxt, 1); + + gcc_jit_type *void_t = + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_VOID); + + /* Build the test_fn. */ + gcc_jit_function *test_fn = + gcc_jit_context_new_function (ctxt, NULL, + GCC_JIT_FUNCTION_EXPORTED, + void_t, + "test_fn", + 0, NULL, + 0); + gcc_jit_block *initial = + gcc_jit_function_new_block (test_fn, "a"); + gcc_jit_block *unreachable = + gcc_jit_function_new_block (test_fn, "b"); + + gcc_jit_block_end_with_void_return (initial, NULL); + + gcc_jit_block_end_with_void_return (unreachable, NULL); +} + +void +verify_code (gcc_jit_context *ctxt, gcc_jit_result *result) +{ + /* Ensure that the "unreachable blocks" validator was ignored. */ + CHECK_NON_NULL (result); +}