]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
jit: API change to gcc_jit_context_new_global
authorDavid Malcolm <dmalcolm@redhat.com>
Mon, 12 Jan 2015 17:14:02 +0000 (17:14 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Mon, 12 Jan 2015 17:14:02 +0000 (17:14 +0000)
gcc/jit/ChangeLog:
* docs/cp/topics/expressions.rst (Global variables): Add
enum gcc_jit_global_kind param to gccjit::context::new_global.
* docs/topics/expressions.rst (Global variables): Likewise.
Document the new enum.
* docs/topics/results.rst (Compilation results): Document
globals-handling.
* dummy-frontend.c (jit_langhook_write_globals): Call into the
playback context's write_global_decls_1 and write_global_decls_2
before and after calling symtab->finalize_compilation_unit ().
* jit-playback.c: Include "debug.h".
(gcc::jit::playback::context::new_global): Add "kind" param and
use it to set TREE_PUBLIC, TREE_STATIC and DECL_EXTERNAL on the
underlying VAR_DECL.  Call varpool_node::get_create on the
VAR_DECL, and add it to m_globals.
(gcc::jit::playback::context::write_global_decls_1): New function.
(gcc::jit::playback::context::write_global_decls_2): New function.
* jit-playback.h (gcc::jit::playback::context::context): Call
create on m_globals.
(gcc::jit::playback::context::new_global): Add "kind" param.
(gcc::jit::playback::context::write_global_decls_1): New function.
(gcc::jit::playback::context::write_global_decls_2): New function.
(gcc::jit::playback::context::m_globals): New field.
* jit-recording.c (gcc::jit::recording::context::context):
Initialize m_globals.
(gcc::jit::recording::context::new_global): Add param "kind".
Add the new global to m_globals.
(gcc::jit::recording::context::dump_to_file): Dump the globals.
(gcc::jit::recording::global::replay_into): Add field m_kind.
(gcc::jit::recording::global::write_to_dump): New override.
* jit-recording.h (gcc::jit::recording::context::new_global): Add
param "kind".
(gcc::jit::recording::context::m_globals): New field.
(gcc::jit::recording::global::global): Add param kind.
(gcc::jit::recording::global::write_to_dump): New override.
(gcc::jit::recording::global::m_kind): New field.
* jit-result.c (gcc::jit::result::get_global): New function.
* jit-result.h (gcc::jit::result::get_global): New function.
* libgccjit++.h (gccjit::context::new_global): Add "kind" param.
* libgccjit.c (gcc_jit_context_new_global): Likewise.
(gcc_jit_result_get_global): New API entrypoint.
* libgccjit.h (gcc_jit_result_get_global): New API entrypoint.
(enum gcc_jit_global_kind): New enum.
(gcc_jit_context_new_global): API change: add "kind" param.
* libgccjit.map (gcc_jit_result_get_global): New symbol.

gcc/testsuite/ChangeLog:
* jit.dg/test-array-as-pointer.c (create_code): Update call
to gcc_jit_context_new_global by setting "kind" to
GCC_JIT_GLOBAL_IMPORTED.
* jit.dg/test-error-array-as-pointer.c: Likewise.
* jit.dg/test-expressions.c (make_test_of_get_address): Likewise.
* jit.dg/test-fuzzer.c (make_random_global): Likewise, but
setting kind to GCC_JIT_GLOBAL_EXPORTED.
* jit.dg/test-using-global.c (the_global): Rename to...
(imported_global): ...this.
(create_code): Update to test the three kinds of global.
(verify_code): Likewise.

From-SVN: r219480

22 files changed:
gcc/jit/ChangeLog
gcc/jit/docs/_build/texinfo/libgccjit.texi
gcc/jit/docs/cp/topics/expressions.rst
gcc/jit/docs/topics/expressions.rst
gcc/jit/docs/topics/results.rst
gcc/jit/dummy-frontend.c
gcc/jit/jit-playback.c
gcc/jit/jit-playback.h
gcc/jit/jit-recording.c
gcc/jit/jit-recording.h
gcc/jit/jit-result.c
gcc/jit/jit-result.h
gcc/jit/libgccjit++.h
gcc/jit/libgccjit.c
gcc/jit/libgccjit.h
gcc/jit/libgccjit.map
gcc/testsuite/ChangeLog
gcc/testsuite/jit.dg/test-array-as-pointer.c
gcc/testsuite/jit.dg/test-error-array-as-pointer.c
gcc/testsuite/jit.dg/test-expressions.c
gcc/testsuite/jit.dg/test-fuzzer.c
gcc/testsuite/jit.dg/test-using-global.c

index 5553d904eacdd26541f5dfd4eb1a8202ec2983ff..1b79198a7f45b5fe4657796c9d669cacaaadf136 100644 (file)
@@ -1,3 +1,51 @@
+2015-01-12  David Malcolm  <dmalcolm@redhat.com>
+
+       * docs/cp/topics/expressions.rst (Global variables): Add
+       enum gcc_jit_global_kind param to gccjit::context::new_global.
+       * docs/topics/expressions.rst (Global variables): Likewise.
+       Document the new enum.
+       * docs/topics/results.rst (Compilation results): Document
+       globals-handling.
+       * docs/_build/texinfo/libgccjit.texi: Regenerate.
+       * dummy-frontend.c (jit_langhook_write_globals): Call into the
+       playback context's write_global_decls_1 and write_global_decls_2
+       before and after calling symtab->finalize_compilation_unit ().
+       * jit-playback.c: Include "debug.h".
+       (gcc::jit::playback::context::new_global): Add "kind" param and
+       use it to set TREE_PUBLIC, TREE_STATIC and DECL_EXTERNAL on the
+       underlying VAR_DECL.  Call varpool_node::get_create on the
+       VAR_DECL, and add it to m_globals.
+       (gcc::jit::playback::context::write_global_decls_1): New function.
+       (gcc::jit::playback::context::write_global_decls_2): New function.
+       * jit-playback.h (gcc::jit::playback::context::context): Call
+       create on m_globals.
+       (gcc::jit::playback::context::new_global): Add "kind" param.
+       (gcc::jit::playback::context::write_global_decls_1): New function.
+       (gcc::jit::playback::context::write_global_decls_2): New function.
+       (gcc::jit::playback::context::m_globals): New field.
+       * jit-recording.c (gcc::jit::recording::context::context):
+       Initialize m_globals.
+       (gcc::jit::recording::context::new_global): Add param "kind".
+       Add the new global to m_globals.
+       (gcc::jit::recording::context::dump_to_file): Dump the globals.
+       (gcc::jit::recording::global::replay_into): Add field m_kind.
+       (gcc::jit::recording::global::write_to_dump): New override.
+       * jit-recording.h (gcc::jit::recording::context::new_global): Add
+       param "kind".
+       (gcc::jit::recording::context::m_globals): New field.
+       (gcc::jit::recording::global::global): Add param kind.
+       (gcc::jit::recording::global::write_to_dump): New override.
+       (gcc::jit::recording::global::m_kind): New field.
+       * jit-result.c (gcc::jit::result::get_global): New function.
+       * jit-result.h (gcc::jit::result::get_global): New function.
+       * libgccjit++.h (gccjit::context::new_global): Add "kind" param.
+       * libgccjit.c (gcc_jit_context_new_global): Likewise.
+       (gcc_jit_result_get_global): New API entrypoint.
+       * libgccjit.h (gcc_jit_result_get_global): New API entrypoint.
+       (enum gcc_jit_global_kind): New enum.
+       (gcc_jit_context_new_global): API change: add "kind" param.
+       * libgccjit.map (gcc_jit_result_get_global): New symbol.
+
 2015-01-09  David Malcolm  <dmalcolm@redhat.com>
 
        * dummy-frontend.c: Include "fixed-value.h", "alias.h", "flags.h",
index 1f5fcd059264f4d75acaccffaa9785377f5f8c3d..07c93085442fb573b544830654d0906f19585cb9 100644 (file)
@@ -19,7 +19,7 @@
 
 @copying
 @quotation
-libgccjit 5.0.0 (experimental 20150109), January 09, 2015
+libgccjit 5.0.0 (experimental 20150112), January 12, 2015
 
 David Malcolm
 
@@ -5977,18 +5977,55 @@ in C.
 
 @geindex gcc_jit_context_new_global (C function)
 @anchor{topics/expressions gcc_jit_context_new_global}@anchor{a4}
-@deffn {C Function} gcc_jit_lvalue *           gcc_jit_context_new_global (gcc_jit_context@w{ }*ctxt, gcc_jit_location@w{ }*loc, gcc_jit_type@w{ }*type, const char@w{ }*name)
+@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.
+
+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{a5}
+@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{a6}
+@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{a7,,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{a8}
+@deffn {C Macro} GCC_JIT_GLOBAL_INTERNAL
+
+Global is defined by the client code, but is invisible
+outside of it.  Analogous to a "static" global within a .c file.
+Specifically, the variable will only be visible within this
+context and within child contexts.
+@end deffn
+
+@geindex GCC_JIT_GLOBAL_IMPORTED (C macro)
+@anchor{topics/expressions GCC_JIT_GLOBAL_IMPORTED}@anchor{a9}
+@deffn {C Macro} GCC_JIT_GLOBAL_IMPORTED
+
+Global is not defined by the client code; we're merely
+referring to it.  Analogous to using an "extern" global from a
+header file.
+@end deffn
 @end deffn
 
 @node Working with pointers structs and unions,,Lvalues,Expressions
-@anchor{topics/expressions working-with-pointers-structs-and-unions}@anchor{a5}
+@anchor{topics/expressions working-with-pointers-structs-and-unions}@anchor{aa}
 @subsection Working with pointers, structs and unions
 
 
 @geindex gcc_jit_rvalue_dereference (C function)
-@anchor{topics/expressions gcc_jit_rvalue_dereference}@anchor{a6}
+@anchor{topics/expressions gcc_jit_rvalue_dereference}@anchor{ab}
 @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,
@@ -6006,7 +6043,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{a7}
+@anchor{topics/expressions gcc_jit_lvalue_access_field}@anchor{ac}
 @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,
@@ -6022,7 +6059,7 @@ in C.
 @end deffn
 
 @geindex gcc_jit_rvalue_access_field (C function)
-@anchor{topics/expressions gcc_jit_rvalue_access_field}@anchor{a8}
+@anchor{topics/expressions gcc_jit_rvalue_access_field}@anchor{ad}
 @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
@@ -6038,7 +6075,7 @@ in C.
 @end deffn
 
 @geindex gcc_jit_rvalue_dereference_field (C function)
-@anchor{topics/expressions gcc_jit_rvalue_dereference_field}@anchor{a9}
+@anchor{topics/expressions gcc_jit_rvalue_dereference_field}@anchor{ae}
 @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
@@ -6089,7 +6126,7 @@ in C (or, indeed, to @code{PTR + INDEX}).
 @c <http://www.gnu.org/licenses/>.
 
 @node Creating and using functions,Source Locations,Expressions,Topic Reference
-@anchor{topics/functions doc}@anchor{aa}@anchor{topics/functions creating-and-using-functions}@anchor{ab}
+@anchor{topics/functions doc}@anchor{af}@anchor{topics/functions creating-and-using-functions}@anchor{b0}
 @section Creating and using functions
 
 
@@ -6102,7 +6139,7 @@ in C (or, indeed, to @code{PTR + INDEX}).
 @end menu
 
 @node Params,Functions,,Creating and using functions
-@anchor{topics/functions params}@anchor{ac}
+@anchor{topics/functions params}@anchor{b1}
 @subsection Params
 
 
@@ -6125,28 +6162,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{ad}
+@anchor{topics/functions gcc_jit_param_as_lvalue}@anchor{b2}
 @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{ae}
+@anchor{topics/functions gcc_jit_param_as_rvalue}@anchor{b3}
 @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{af}
+@anchor{topics/functions gcc_jit_param_as_object}@anchor{b4}
 @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{b0}
+@anchor{topics/functions functions}@anchor{b5}
 @subsection Functions
 
 
@@ -6165,7 +6202,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{b1}
+@anchor{topics/functions gcc_jit_function_kind}@anchor{b6}
 @deffn {C Type} enum gcc_jit_function_kind
 @end deffn
 
@@ -6175,7 +6212,7 @@ values:
 @quotation
 
 @geindex GCC_JIT_FUNCTION_EXPORTED (C macro)
-@anchor{topics/functions GCC_JIT_FUNCTION_EXPORTED}@anchor{b2}
+@anchor{topics/functions GCC_JIT_FUNCTION_EXPORTED}@anchor{b7}
 @deffn {C Macro} GCC_JIT_FUNCTION_EXPORTED
 
 Function is defined by the client code and visible
@@ -6187,7 +6224,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{b3}
+@anchor{topics/functions GCC_JIT_FUNCTION_INTERNAL}@anchor{b8}
 @deffn {C Macro} GCC_JIT_FUNCTION_INTERNAL
 
 Function is defined by the client code, but is invisible
@@ -6195,7 +6232,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{b4}
+@anchor{topics/functions GCC_JIT_FUNCTION_IMPORTED}@anchor{b9}
 @deffn {C Macro} GCC_JIT_FUNCTION_IMPORTED
 
 Function is not defined by the client code; we're merely
@@ -6204,7 +6241,7 @@ header file.
 @end deffn
 
 @geindex GCC_JIT_FUNCTION_ALWAYS_INLINE (C macro)
-@anchor{topics/functions GCC_JIT_FUNCTION_ALWAYS_INLINE}@anchor{b5}
+@anchor{topics/functions GCC_JIT_FUNCTION_ALWAYS_INLINE}@anchor{ba}
 @deffn {C Macro} GCC_JIT_FUNCTION_ALWAYS_INLINE
 
 Function is only ever inlined into other functions, and is
@@ -6221,19 +6258,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{b6}
+@anchor{topics/functions gcc_jit_context_get_builtin_function}@anchor{bb}
 @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{b7}
+@anchor{topics/functions gcc_jit_function_as_object}@anchor{bc}
 @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{b8}
+@anchor{topics/functions gcc_jit_function_get_param}@anchor{bd}
 @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).
@@ -6255,7 +6292,7 @@ name.
 @end deffn
 
 @node Blocks,Statements,Functions,Creating and using functions
-@anchor{topics/functions blocks}@anchor{b9}
+@anchor{topics/functions blocks}@anchor{be}
 @subsection Blocks
 
 
@@ -6278,7 +6315,7 @@ one function.
 @end deffn
 
 @geindex gcc_jit_function_new_block (C function)
-@anchor{topics/functions gcc_jit_function_new_block}@anchor{ba}
+@anchor{topics/functions gcc_jit_function_new_block}@anchor{bf}
 @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
@@ -6288,21 +6325,21 @@ messages.
 @end deffn
 
 @geindex gcc_jit_block_as_object (C function)
-@anchor{topics/functions gcc_jit_block_as_object}@anchor{bb}
+@anchor{topics/functions gcc_jit_block_as_object}@anchor{c0}
 @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{bc}
+@anchor{topics/functions gcc_jit_block_get_function}@anchor{c1}
 @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{bd}
+@anchor{topics/functions statements}@anchor{c2}
 @subsection Statements
 
 
@@ -6403,7 +6440,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{be}
+@anchor{topics/functions gcc_jit_block_end_with_jump}@anchor{c3}
 @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.
@@ -6418,7 +6455,7 @@ goto target;
 @end deffn
 
 @geindex gcc_jit_block_end_with_return (C function)
-@anchor{topics/functions gcc_jit_block_end_with_return}@anchor{bf}
+@anchor{topics/functions gcc_jit_block_end_with_return}@anchor{c4}
 @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.
@@ -6433,7 +6470,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{c0}
+@anchor{topics/functions gcc_jit_block_end_with_void_return}@anchor{c5}
 @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
@@ -6466,7 +6503,7 @@ return;
 @c <http://www.gnu.org/licenses/>.
 
 @node Source Locations,Compilation results,Creating and using functions,Topic Reference
-@anchor{topics/locations source-locations}@anchor{c1}@anchor{topics/locations doc}@anchor{c2}
+@anchor{topics/locations source-locations}@anchor{c6}@anchor{topics/locations doc}@anchor{c7}
 @section Source Locations
 
 
@@ -6512,7 +6549,7 @@ location.
 @end menu
 
 @node Faking it,,,Source Locations
-@anchor{topics/locations faking-it}@anchor{c3}
+@anchor{topics/locations faking-it}@anchor{c8}
 @subsection Faking it
 
 
@@ -6550,7 +6587,7 @@ file, giving you @emph{something} you can step through in the debugger.
 @c <http://www.gnu.org/licenses/>.
 
 @node Compilation results,,Source Locations,Topic Reference
-@anchor{topics/results compilation-results}@anchor{c4}@anchor{topics/results doc}@anchor{c5}
+@anchor{topics/results compilation-results}@anchor{c9}@anchor{topics/results doc}@anchor{ca}
 @section Compilation results
 
 
@@ -6559,8 +6596,8 @@ file, giving you @emph{something} you can step through in the debugger.
 @deffn {C Type} gcc_jit_result
 
 A @cite{gcc_jit_result} encapsulates the result of compiling a context,
-and the lifetimes of any machine code functions that are
-returned.
+and the lifetimes of any machine code functions or globals that are
+within it.
 @end deffn
 
 @geindex gcc_jit_context_compile (C function)
@@ -6569,6 +6606,10 @@ returned.
 
 This calls into GCC and builds the code, returning a
 @cite{gcc_jit_result *}.
+
+If this is non-NULL, the caller becomes responsible for
+calling @pxref{39,,gcc_jit_result_release()} on it once they're done
+with it.
 @end deffn
 
 @geindex gcc_jit_result_get_code (C function)
@@ -6581,7 +6622,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{b2,,GCC_JIT_FUNCTION_EXPORTED}:
+@pxref{b7,,GCC_JIT_FUNCTION_EXPORTED}:
 
 @example
 gcc_jit_context_new_function (ctxt,
@@ -6606,7 +6647,57 @@ function pointer of the correct type before it can be called.
 
 Note that the resulting machine code becomes invalid after
 @pxref{39,,gcc_jit_result_release()} is called on the
-@cite{gcc_jit_result *}; attempting to call it after that may lead
+@pxref{16,,gcc_jit_result *}; attempting to call it after that may lead
+to a segmentation fault.
+@end deffn
+
+@geindex gcc_jit_result_get_global (C function)
+@anchor{topics/results gcc_jit_result_get_global}@anchor{a7}
+@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.
+
+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{a4,,gcc_jit_context_new_global()} with @cite{kind}
+@pxref{a6,,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.
+
+This is a @emph{pointer} to the global, so e.g. for an @code{int} this is
+an @code{int *}.
+
+For example, given an @code{int foo;} created this way:
+
+@example
+gcc_jit_lvalue *exported_global =
+  gcc_jit_context_new_global (ctxt,
+  any_location, /* or NULL */
+  GCC_JIT_GLOBAL_EXPORTED,
+  int_type,
+  "foo");
+@end example
+
+@noindent
+
+we can access it like this:
+
+@example
+int *ptr_to_foo =
+  (int *)gcc_jit_result_get_global (result, "foo");
+@end example
+
+@noindent
+
+If such a global is not found (or @cite{result} or @cite{name} are
+@code{NULL}), an error message will be emitted on stderr and
+@code{NULL} will be returned.
+
+Note that the resulting address becomes invalid after
+@pxref{39,,gcc_jit_result_release()} is called on the
+@pxref{16,,gcc_jit_result *}; attempting to use it after that may lead
 to a segmentation fault.
 @end deffn
 
@@ -6616,8 +6707,9 @@ to a segmentation fault.
 
 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 that was obtained by calling
-@pxref{17,,gcc_jit_result_get_code()} on it.
+valid to use the result, or any code or globals that were obtained
+by calling @pxref{17,,gcc_jit_result_get_code()} or
+@pxref{a7,,gcc_jit_result_get_global()} on it.
 @end deffn
 
 @c Copyright (C) 2014 Free Software Foundation, Inc.
@@ -6638,7 +6730,7 @@ valid to use the result, or any code that was obtained by calling
 @c <http://www.gnu.org/licenses/>.
 
 @node C++ bindings for libgccjit,Internals,Topic Reference,Top
-@anchor{cp/index c-bindings-for-libgccjit}@anchor{c6}@anchor{cp/index doc}@anchor{c7}
+@anchor{cp/index c-bindings-for-libgccjit}@anchor{cb}@anchor{cp/index doc}@anchor{cc}
 @chapter C++ bindings for libgccjit
 
 
@@ -6780,7 +6872,7 @@ Source Locations
 
 
 @node Tutorial<2>,Topic Reference<2>,,C++ bindings for libgccjit
-@anchor{cp/intro/index doc}@anchor{c8}@anchor{cp/intro/index tutorial}@anchor{c9}
+@anchor{cp/intro/index doc}@anchor{cd}@anchor{cp/intro/index tutorial}@anchor{ce}
 @section Tutorial
 
 
@@ -6810,7 +6902,7 @@ Source Locations
 @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{ca}@anchor{cp/intro/tutorial01 tutorial-part-1-hello-world}@anchor{cb}
+@anchor{cp/intro/tutorial01 doc}@anchor{cf}@anchor{cp/intro/tutorial01 tutorial-part-1-hello-world}@anchor{d0}
 @subsection Tutorial part 1: "Hello world"
 
 
@@ -6980,7 +7072,7 @@ hello world
 @c <http://www.gnu.org/licenses/>.
 
 @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{cc}@anchor{cp/intro/tutorial02 tutorial-part-2-creating-a-trivial-machine-code-function}@anchor{cd}
+@anchor{cp/intro/tutorial02 doc}@anchor{d1}@anchor{cp/intro/tutorial02 tutorial-part-2-creating-a-trivial-machine-code-function}@anchor{d2}
 @subsection Tutorial part 2: Creating a trivial machine code function
 
 
@@ -7009,7 +7101,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{ce,,gccjit;;context;;acquire()}:
+Create one using @pxref{d3,,gccjit;;context;;acquire()}:
 
 @example
 gccjit::context ctxt;
@@ -7022,7 +7114,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{cf,,gccjit;;context;;get_type()}:
+@pxref{d4,,gccjit;;context;;get_type()}:
 
 @example
 gccjit::type int_type = ctxt.get_type (GCC_JIT_TYPE_INT);
@@ -7035,7 +7127,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{d0,,gccjit;;context;;release()}:
+@pxref{d5,,gccjit;;context;;release()}:
 
 @example
 ctxt.release ();
@@ -7068,7 +7160,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{d1,,gccjit;;object;;get_debug_string()}:
+@pxref{d6,,gccjit;;object;;get_debug_string()}:
 
 @example
 printf ("obj: %s\n", obj.get_debug_string ().c_str ());
@@ -7088,7 +7180,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{d2,,gccjit;;context;;new_param()}:
+using @pxref{d7,,gccjit;;context;;new_param()}:
 
 @example
 gccjit::param param_i = ctxt.new_param (int_type, "i");
@@ -7137,7 +7229,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{d3,,gccjit;;context;;new_binary_op()}:
+We can build the expression using @pxref{d8,,gccjit;;context;;new_binary_op()}:
 
 @example
 gccjit::rvalue expr =
@@ -7150,7 +7242,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{d1,,gccjit;;object;;get_debug_string()}.
+@pxref{d6,,gccjit;;object;;get_debug_string()}.
 
 @example
 printf ("expr: %s\n", expr.get_debug_string ().c_str ());
@@ -7187,7 +7279,7 @@ block.end_with_return (expr);
 @noindent
 
 OK, we've populated the context.  We can now compile it using
-@pxref{d4,,gccjit;;context;;compile()}:
+@pxref{d9,,gccjit;;context;;compile()}:
 
 @example
 gcc_jit_result *result;
@@ -7237,12 +7329,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{d5}
+@anchor{cp/intro/tutorial02 options}@anchor{da}
 @subsubsection Options
 
 
 To get more information on what's going on, you can set debugging flags
-on the context using @pxref{d6,,gccjit;;context;;set_bool_option()}.
+on the context using @pxref{db,,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
@@ -7314,7 +7406,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{d7,,gccjit;;context;;set_int_option()} with
+@pxref{dc,,gccjit;;context;;set_int_option()} with
 @pxref{1f,,GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL}:
 
 @example
@@ -7348,7 +7440,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{d8}
+@anchor{cp/intro/tutorial02 full-example}@anchor{dd}
 @subsubsection Full example
 
 
@@ -7491,7 +7583,7 @@ result: 25
 @c <http://www.gnu.org/licenses/>.
 
 @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{d9}@anchor{cp/intro/tutorial03 doc}@anchor{da}
+@anchor{cp/intro/tutorial03 tutorial-part-3-loops-and-variables}@anchor{de}@anchor{cp/intro/tutorial03 doc}@anchor{df}
 @subsection Tutorial part 3: Loops and variables
 
 
@@ -7615,7 +7707,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{db}
+@anchor{cp/intro/tutorial03 expressions-lvalues-and-rvalues}@anchor{e0}
 @subsubsection Expressions: lvalues and rvalues
 
 
@@ -7688,7 +7780,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{dc,,gccjit;;function;;new_local()}, supplying a type and a name:
+@pxref{e1,,gccjit;;function;;new_local()}, supplying a type and a name:
 
 @example
 /* Build locals:  */
@@ -7714,7 +7806,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{dd}
+@anchor{cp/intro/tutorial03 control-flow}@anchor{e2}
 @subsubsection Control flow
 
 
@@ -7753,8 +7845,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{de,,gccjit;;block;;add_assignment()} to add
-an assignment statement, and using @pxref{df,,gccjit;;context;;zero()} to get
+@pxref{e3,,gccjit;;block;;add_assignment()} to add
+an assignment statement, and using @pxref{e4,,gccjit;;context;;zero()} to get
 the constant value @cite{0} for the relevant type for the right-hand side of
 the assignment:
 
@@ -7781,7 +7873,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{e0,,gccjit;;context;;new_comparison()}:
+We could build the comparison using @pxref{e5,,gccjit;;context;;new_comparison()}:
 
 @example
 gccjit::rvalue guard =
@@ -7792,7 +7884,7 @@ gccjit::rvalue guard =
 @noindent
 
 and can then use this to add @cite{b_loop_cond}'s sole statement, via
-@pxref{e1,,gccjit;;block;;end_with_conditional()}:
+@pxref{e6,,gccjit;;block;;end_with_conditional()}:
 
 @example
 b_loop_cond.end_with_conditional (guard);
@@ -7824,7 +7916,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{e2,,gccjit;;block;;add_assignment_op()} to handle these operations:
+@pxref{e7,,gccjit;;block;;add_assignment_op()} to handle these operations:
 
 @example
 /* sum += i * i */
@@ -7852,7 +7944,7 @@ b_loop_body.add_assignment_op (i,
 @cartouche
 @quotation Note 
 For numeric constants other than 0 or 1, we could use
-@pxref{e3,,gccjit;;context;;new_rvalue()}, which has overloads
+@pxref{e8,,gccjit;;context;;new_rvalue()}, which has overloads
 for both @code{int} and @code{double}.
 @end quotation
 @end cartouche
@@ -7928,12 +8020,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{e4}
+@anchor{cp/intro/tutorial03 visualizing-the-control-flow-graph}@anchor{e9}
 @subsubsection Visualizing the control flow graph
 
 
 You can see the control flow graph of a function using
-@pxref{e5,,gccjit;;function;;dump_to_dot()}:
+@pxref{ea,,gccjit;;function;;dump_to_dot()}:
 
 @example
 func.dump_to_dot ("/tmp/sum-of-squares.dot");
@@ -7967,7 +8059,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{e6}
+@anchor{cp/intro/tutorial03 full-example}@anchor{eb}
 @subsubsection Full example
 
 
@@ -8150,7 +8242,7 @@ loop_test returned: 285
 @c <http://www.gnu.org/licenses/>.
 
 @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{e7}@anchor{cp/intro/tutorial04 doc}@anchor{e8}
+@anchor{cp/intro/tutorial04 tutorial-part-4-adding-jit-compilation-to-a-toy-interpreter}@anchor{ec}@anchor{cp/intro/tutorial04 doc}@anchor{ed}
 @subsection Tutorial part 4: Adding JIT-compilation to a toy interpreter
 
 
@@ -8172,7 +8264,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{e9}
+@anchor{cp/intro/tutorial04 our-toy-interpreter}@anchor{ee}
 @subsubsection Our toy interpreter
 
 
@@ -8580,7 +8672,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{ea}
+@anchor{cp/intro/tutorial04 compiling-to-machine-code}@anchor{ef}
 @subsubsection Compiling to machine code
 
 
@@ -8660,7 +8752,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{eb}
+@anchor{cp/intro/tutorial04 setting-things-up}@anchor{f0}
 @subsubsection Setting things up
 
 
@@ -8828,7 +8920,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{ec}
+@anchor{cp/intro/tutorial04 populating-the-function}@anchor{f1}
 @subsubsection Populating the function
 
 
@@ -8956,7 +9048,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{ed,,gccjit;;block;;add_comment()} to add descriptive comments
+@pxref{f2,,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}:
 
@@ -9105,14 +9197,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{ee}
+@anchor{cp/intro/tutorial04 verifying-the-control-flow-graph}@anchor{f3}
 @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{e5,,gccjit;;function;;dump_to_dot()}:
+using @pxref{ea,,gccjit;;function;;dump_to_dot()}:
 
 @example
 fn.dump_to_dot ("/tmp/factorial.dot");
@@ -9136,7 +9228,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{ef}
+@anchor{cp/intro/tutorial04 compiling-the-context}@anchor{f4}
 @subsubsection Compiling the context
 
 
@@ -9173,7 +9265,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{f0}
+@anchor{cp/intro/tutorial04 single-stepping-through-the-generated-code}@anchor{f5}
 @subsubsection Single-stepping through the generated code
 
 
@@ -9187,14 +9279,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{f1,,gccjit;;context;;new_location()} and using the
+calling @pxref{f6,,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{d6,,gccjit;;context;;set_bool_option()}:
+@pxref{db,,gccjit;;context;;set_bool_option()}:
 
 @example
 ctxt.set_bool_option (GCC_JIT_BOOL_OPTION_DEBUGINFO, 1);
@@ -9266,14 +9358,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{f2}
+@anchor{cp/intro/tutorial04 examining-the-generated-code}@anchor{f7}
 @subsubsection Examining the generated code
 
 
 How good is the optimized code?
 
 We can turn up optimizations, by calling
-@pxref{d7,,gccjit;;context;;set_int_option()} with
+@pxref{dc,,gccjit;;context;;set_int_option()} with
 @pxref{1f,,GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL}:
 
 @example
@@ -9455,7 +9547,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{f3}
+@anchor{cp/intro/tutorial04 putting-it-all-together}@anchor{f8}
 @subsubsection Putting it all together
 
 
@@ -9488,7 +9580,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{f4}
+@anchor{cp/intro/tutorial04 behind-the-curtain-how-does-our-code-get-optimized}@anchor{f9}
 @subsubsection Behind the curtain: How does our code get optimized?
 
 
@@ -9689,7 +9781,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{f5}
+@anchor{cp/intro/tutorial04 optimizing-away-stack-manipulation}@anchor{fa}
 @subsubsection Optimizing away stack manipulation
 
 
@@ -9969,7 +10061,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{f6}
+@anchor{cp/intro/tutorial04 elimination-of-tail-recursion}@anchor{fb}
 @subsubsection Elimination of tail recursion
 
 
@@ -10056,7 +10148,7 @@ instr9:
 @c <http://www.gnu.org/licenses/>.
 
 @node Topic Reference<2>,,Tutorial<2>,C++ bindings for libgccjit
-@anchor{cp/topics/index doc}@anchor{f7}@anchor{cp/topics/index topic-reference}@anchor{f8}
+@anchor{cp/topics/index doc}@anchor{fc}@anchor{cp/topics/index topic-reference}@anchor{fd}
 @section Topic Reference
 
 
@@ -10140,22 +10232,22 @@ Source Locations
 
 
 @node Compilation contexts<2>,Objects<2>,,Topic Reference<2>
-@anchor{cp/topics/contexts compilation-contexts}@anchor{f9}@anchor{cp/topics/contexts doc}@anchor{fa}
+@anchor{cp/topics/contexts compilation-contexts}@anchor{fe}@anchor{cp/topics/contexts doc}@anchor{ff}
 @subsection Compilation contexts
 
 
 @geindex gccjit;;context (C++ class)
-@anchor{cp/topics/contexts gccjit context}@anchor{fb}
+@anchor{cp/topics/contexts gccjit context}@anchor{100}
 @deffn {C++ Class} gccjit::context
 @end deffn
 
-The top-level of the C++ API is the @pxref{fb,,gccjit;;context} type.
+The top-level of the C++ API is the @pxref{100,,gccjit;;context} type.
 
-A @pxref{fb,,gccjit;;context} instance encapsulates the state of a
+A @pxref{100,,gccjit;;context} instance encapsulates the state of a
 compilation.
 
 You can set up options on it, and add types, functions and code.
-Invoking @pxref{d4,,gccjit;;context;;compile()} on it gives you a
+Invoking @pxref{d9,,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 *}.
@@ -10170,7 +10262,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{fc}
+@anchor{cp/topics/contexts lifetime-management}@anchor{101}
 @subsubsection Lifetime-management
 
 
@@ -10179,16 +10271,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{ce}
+@anchor{cp/topics/contexts gccjit context acquire}@anchor{d3}
 @deffn {C++ Function} gccjit::context gccjit::context::acquire ()
 
-This function acquires a new @pxref{fb,,gccjit;;context} instance,
+This function acquires a new @pxref{100,,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{d0}
+@anchor{cp/topics/contexts gccjit context release}@anchor{d5}
 @deffn {C++ Function} void gccjit::context::release ()
 
 This function releases all resources associated with the given context.
@@ -10207,7 +10299,7 @@ ctxt.release ();
 @end deffn
 
 @geindex gccjit;;context;;new_child_context (C++ function)
-@anchor{cp/topics/contexts gccjit context new_child_context}@anchor{fd}
+@anchor{cp/topics/contexts gccjit context new_child_context}@anchor{102}
 @deffn {C++ Function} gccjit::context gccjit::context::new_child_context ()
 
 Given an existing JIT context, create a child context.
@@ -10239,16 +10331,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{fe}
+@anchor{cp/topics/contexts thread-safety}@anchor{103}
 @subsubsection Thread-safety
 
 
-Instances of @pxref{fb,,gccjit;;context} created via
-@pxref{ce,,gccjit;;context;;acquire()} are independent from each other:
+Instances of @pxref{100,,gccjit;;context} created via
+@pxref{d3,,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{fd,,gccjit;;context;;new_child_context()} are
+Contexts created via @pxref{102,,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,
@@ -10256,7 +10348,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{ff}
+@anchor{cp/topics/contexts error-handling}@anchor{104}
 @subsubsection Error-handling
 
 
@@ -10269,10 +10361,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{100,,gccjit;;context;;get_first_error()}.
+@pxref{105,,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{100}
+@anchor{cp/topics/contexts gccjit context get_first_error__gccjit contextP}@anchor{105}
 @deffn {C++ Function} const char* gccjit::context::get_first_error (gccjit::context* ctxt)
 
 Returns the first error message that occurred on the context.
@@ -10284,18 +10376,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{101}
+@anchor{cp/topics/contexts debugging}@anchor{106}
 @subsubsection Debugging
 
 
 @geindex gccjit;;context;;dump_to_file (C++ function)
-@anchor{cp/topics/contexts gccjit context dump_to_file__ssCR i}@anchor{102}
+@anchor{cp/topics/contexts gccjit context dump_to_file__ssCR i}@anchor{107}
 @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{103,,gccjit;;location}
+If "update_locations" is true, then also set up @pxref{108,,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
@@ -10303,7 +10395,7 @@ code in a debugger.
 @end deffn
 
 @node Options<4>,,Debugging<2>,Compilation contexts<2>
-@anchor{cp/topics/contexts options}@anchor{104}
+@anchor{cp/topics/contexts options}@anchor{109}
 @subsubsection Options
 
 
@@ -10315,12 +10407,12 @@ code in a debugger.
 @end menu
 
 @node String Options<2>,Boolean options<2>,,Options<4>
-@anchor{cp/topics/contexts string-options}@anchor{105}
+@anchor{cp/topics/contexts string-options}@anchor{10a}
 @subsubsection String Options
 
 
 @geindex gccjit;;context;;set_str_option (C++ function)
-@anchor{cp/topics/contexts gccjit context set_str_option__enum cCP}@anchor{106}
+@anchor{cp/topics/contexts gccjit context set_str_option__enum cCP}@anchor{10b}
 @deffn {C++ Function} void gccjit::context::set_str_option (enum gcc_jit_str_option, const char* value)
 
 Set a string option of the context.
@@ -10331,12 +10423,12 @@ meaning.
 @end deffn
 
 @node Boolean options<2>,Integer options<2>,String Options<2>,Options<4>
-@anchor{cp/topics/contexts boolean-options}@anchor{107}
+@anchor{cp/topics/contexts boolean-options}@anchor{10c}
 @subsubsection Boolean options
 
 
 @geindex gccjit;;context;;set_bool_option (C++ function)
-@anchor{cp/topics/contexts gccjit context set_bool_option__enum i}@anchor{d6}
+@anchor{cp/topics/contexts gccjit context set_bool_option__enum i}@anchor{db}
 @deffn {C++ Function} void gccjit::context::set_bool_option (enum gcc_jit_bool_option, int value)
 
 Set a boolean option of the context.
@@ -10347,12 +10439,12 @@ meaning.
 @end deffn
 
 @node Integer options<2>,,Boolean options<2>,Options<4>
-@anchor{cp/topics/contexts integer-options}@anchor{108}
+@anchor{cp/topics/contexts integer-options}@anchor{10d}
 @subsubsection Integer options
 
 
 @geindex gccjit;;context;;set_int_option (C++ function)
-@anchor{cp/topics/contexts gccjit context set_int_option__enum i}@anchor{d7}
+@anchor{cp/topics/contexts gccjit context set_int_option__enum i}@anchor{dc}
 @deffn {C++ Function} void gccjit::context::set_int_option (enum gcc_jit_int_option, int value)
 
 Set an integer option of the context.
@@ -10380,18 +10472,18 @@ meaning.
 @c <http://www.gnu.org/licenses/>.
 
 @node Objects<2>,Types<2>,Compilation contexts<2>,Topic Reference<2>
-@anchor{cp/topics/objects objects}@anchor{109}@anchor{cp/topics/objects doc}@anchor{10a}
+@anchor{cp/topics/objects objects}@anchor{10e}@anchor{cp/topics/objects doc}@anchor{10f}
 @subsection Objects
 
 
 @geindex gccjit;;object (C++ class)
-@anchor{cp/topics/objects gccjit object}@anchor{10b}
+@anchor{cp/topics/objects gccjit object}@anchor{110}
 @deffn {C++ Class} gccjit::object
 @end deffn
 
 Almost every entity in the API (with the exception of
-@pxref{fb,,gccjit;;context} and @pxref{16,,gcc_jit_result *}) is a
-"contextual" object, a @pxref{10b,,gccjit;;object}.
+@pxref{100,,gccjit;;context} and @pxref{16,,gcc_jit_result *}) is a
+"contextual" object, a @pxref{110,,gccjit;;object}.
 
 A JIT object:
 
@@ -10401,7 +10493,7 @@ A JIT object:
 @itemize *
 
 @item 
-is associated with a @pxref{fb,,gccjit;;context}.
+is associated with a @pxref{100,,gccjit;;context}.
 
 @item 
 is automatically cleaned up for you when its context is released so
@@ -10427,17 +10519,17 @@ The C++ class hierarchy within the @code{gccjit} namespace looks like this:
 
 @noindent
 
-The @pxref{10b,,gccjit;;object} base class has the following operations:
+The @pxref{110,,gccjit;;object} base class has the following operations:
 
 @geindex gccjit;;object;;get_context (C++ function)
-@anchor{cp/topics/objects gccjit object get_contextC}@anchor{10c}
+@anchor{cp/topics/objects gccjit object get_contextC}@anchor{111}
 @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{d1}
+@anchor{cp/topics/objects gccjit object get_debug_stringC}@anchor{d6}
 @deffn {C++ Function} std::string gccjit::object::get_debug_string () const
 
 Generate a human-readable description for the given object.
@@ -10477,16 +10569,16 @@ obj: 4.0 * (float)i
 @c <http://www.gnu.org/licenses/>.
 
 @node Types<2>,Expressions<2>,Objects<2>,Topic Reference<2>
-@anchor{cp/topics/types doc}@anchor{10d}@anchor{cp/topics/types types}@anchor{10e}
+@anchor{cp/topics/types doc}@anchor{112}@anchor{cp/topics/types types}@anchor{113}
 @subsection Types
 
 
 @geindex gccjit;;type (C++ class)
-@anchor{cp/topics/types gccjit type}@anchor{10f}
+@anchor{cp/topics/types gccjit type}@anchor{114}
 @deffn {C++ Class} gccjit::type
 
 gccjit::type represents a type within the library.  It is a subclass
-of @pxref{10b,,gccjit;;object}.
+of @pxref{110,,gccjit;;object}.
 @end deffn
 
 Types can be created in several ways:
@@ -10496,7 +10588,7 @@ Types can be created in several ways:
 
 @item 
 fundamental types can be accessed using
-@pxref{cf,,gccjit;;context;;get_type()}:
+@pxref{d4,,gccjit;;context;;get_type()}:
 
 @example
 gccjit::type int_type = ctxt.get_type (GCC_JIT_TYPE_INT);
@@ -10516,7 +10608,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{110,,gccjit;;type;;get_pointer()} and @pxref{111,,gccjit;;type;;get_const()}:
+@pxref{115,,gccjit;;type;;get_pointer()} and @pxref{116,,gccjit;;type;;get_const()}:
 
 @example
 gccjit::type const_int_star = int_type.get_const ().get_pointer ();
@@ -10537,12 +10629,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{112}
+@anchor{cp/topics/types standard-types}@anchor{117}
 @subsubsection Standard types
 
 
 @geindex gccjit;;context;;get_type (C++ function)
-@anchor{cp/topics/types gccjit context get_type__enum}@anchor{cf}
+@anchor{cp/topics/types gccjit context get_type__enum}@anchor{d4}
 @deffn {C++ Function} gccjit::type gccjit::context::get_type (enum gcc_jit_types)
 
 Access a specific type.  This is a thin wrapper around
@@ -10550,14 +10642,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{113}
+@anchor{cp/topics/types gccjit context get_int_type__s i}@anchor{118}
 @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<T> (C++ function)
-@anchor{cp/topics/types gccjit context get_int_type T}@anchor{114}
+@anchor{cp/topics/types gccjit context get_int_type T}@anchor{119}
 @deffn {C++ Function} gccjit::type gccjit::context::get_int_type<T> ()
 
 Access the given integer type.  For example, you could map the
@@ -10571,12 +10663,12 @@ gccjit::type t = ctxt.get_int_type <unsigned short> ();
 @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{115}
+@anchor{cp/topics/types pointers-const-and-volatile}@anchor{11a}
 @subsubsection Pointers, @cite{const}, and @cite{volatile}
 
 
 @geindex gccjit;;type;;get_pointer (C++ function)
-@anchor{cp/topics/types gccjit type get_pointer}@anchor{110}
+@anchor{cp/topics/types gccjit type get_pointer}@anchor{115}
 @deffn {C++ Function} gccjit::type gccjit::type::get_pointer ()
 
 Given type "T", get type "T*".
@@ -10585,21 +10677,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{111}
+@anchor{cp/topics/types gccjit type get_const}@anchor{116}
 @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{116}
+@anchor{cp/topics/types gccjit type get_volatile}@anchor{11b}
 @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{117}
+@anchor{cp/topics/types gccjit context new_array_type__gccjit type i gccjit location}@anchor{11c}
 @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).
@@ -10607,31 +10699,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{118}
+@anchor{cp/topics/types structures-and-unions}@anchor{11d}
 @subsubsection Structures and unions
 
 
 @geindex gccjit;;struct_ (C++ class)
-@anchor{cp/topics/types gccjit struct_}@anchor{119}
+@anchor{cp/topics/types gccjit struct_}@anchor{11e}
 @deffn {C++ Class} gccjit::struct_
 @end deffn
 
 A compound type analagous to a C @cite{struct}.
 
-@pxref{119,,gccjit;;struct_} is a subclass of @pxref{10f,,gccjit;;type} (and thus
-of @pxref{10b,,gccjit;;object} in turn).
+@pxref{11e,,gccjit;;struct_} is a subclass of @pxref{114,,gccjit;;type} (and thus
+of @pxref{110,,gccjit;;object} in turn).
 
 @geindex gccjit;;field (C++ class)
-@anchor{cp/topics/types gccjit field}@anchor{11a}
+@anchor{cp/topics/types gccjit field}@anchor{11f}
 @deffn {C++ Class} gccjit::field
 @end deffn
 
-A field within a @pxref{119,,gccjit;;struct_}.
+A field within a @pxref{11e,,gccjit;;struct_}.
 
-@pxref{11a,,gccjit;;field} is a subclass of @pxref{10b,,gccjit;;object}.
+@pxref{11f,,gccjit;;field} is a subclass of @pxref{110,,gccjit;;object}.
 
-You can model C @cite{struct} types by creating @pxref{119,,gccjit;;struct_} and
-@pxref{11a,,gccjit;;field} instances, in either order:
+You can model C @cite{struct} types by creating @pxref{11e,,gccjit;;struct_} and
+@pxref{11f,,gccjit;;field} instances, in either order:
 
 
 @itemize *
@@ -10687,14 +10779,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{11b}
+@anchor{cp/topics/types gccjit context new_field__gccjit type cCP gccjit location}@anchor{120}
 @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{11c}
+@anchor{cp/topics/types gccjit context new_struct_type__ssCR std vector field R gccjit location}@anchor{121}
 @deffn {C++ Function} gccjit::struct_ gccjit::context::new_struct_type (const std::string& name, std::vector<field>& fields, gccjit::location loc)
 
 @quotation
@@ -10704,7 +10796,7 @@ 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{11d}
+@anchor{cp/topics/types gccjit context new_opaque_struct__ssCR gccjit location}@anchor{122}
 @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
@@ -10731,7 +10823,7 @@ size of the struct is not known), or later specified using
 @c <http://www.gnu.org/licenses/>.
 
 @node Expressions<2>,Creating and using functions<2>,Types<2>,Topic Reference<2>
-@anchor{cp/topics/expressions expressions}@anchor{11e}@anchor{cp/topics/expressions doc}@anchor{11f}
+@anchor{cp/topics/expressions expressions}@anchor{123}@anchor{cp/topics/expressions doc}@anchor{124}
 @subsection Expressions
 
 
@@ -10757,17 +10849,17 @@ Lvalues
 
 
 @node Rvalues<2>,Lvalues<2>,,Expressions<2>
-@anchor{cp/topics/expressions rvalues}@anchor{120}
+@anchor{cp/topics/expressions rvalues}@anchor{125}
 @subsubsection Rvalues
 
 
 @geindex gccjit;;rvalue (C++ class)
-@anchor{cp/topics/expressions gccjit rvalue}@anchor{121}
+@anchor{cp/topics/expressions gccjit rvalue}@anchor{126}
 @deffn {C++ Class} gccjit::rvalue
 @end deffn
 
-A @pxref{121,,gccjit;;rvalue} is an expression that can be computed.  It is a
-subclass of @pxref{10b,,gccjit;;object}, and is a thin wrapper around
+A @pxref{126,,gccjit;;rvalue} is an expression that can be computed.  It is a
+subclass of @pxref{110,,gccjit;;object}, and is a thin wrapper around
 @pxref{13,,gcc_jit_rvalue *} from the C API.
 
 It can be simple, e.g.:
@@ -10813,7 +10905,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{122}
+@anchor{cp/topics/expressions gccjit rvalue get_type}@anchor{127}
 @deffn {C++ Function} gccjit::type gccjit::rvalue::get_type ()
 
 Get the type of this rvalue.
@@ -10830,12 +10922,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{123}
+@anchor{cp/topics/expressions simple-expressions}@anchor{128}
 @subsubsection Simple expressions
 
 
 @geindex gccjit;;context;;new_rvalue (C++ function)
-@anchor{cp/topics/expressions gccjit context new_rvalue__gccjit type iC}@anchor{e3}
+@anchor{cp/topics/expressions gccjit context new_rvalue__gccjit type iC}@anchor{e8}
 @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
@@ -10843,7 +10935,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{124}
+@anchor{cp/topics/expressions gccjit context new_rvalue__gccjit type lC}@anchor{129}
 @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
@@ -10851,7 +10943,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{df}
+@anchor{cp/topics/expressions gccjit context zero__gccjit typeC}@anchor{e4}
 @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
@@ -10865,7 +10957,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{125}
+@anchor{cp/topics/expressions gccjit context one__gccjit typeC}@anchor{12a}
 @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
@@ -10879,7 +10971,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{126}
+@anchor{cp/topics/expressions gccjit context new_rvalue__gccjit type doubleC}@anchor{12b}
 @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
@@ -10887,14 +10979,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{127}
+@anchor{cp/topics/expressions gccjit context new_rvalue__gccjit type voidPC}@anchor{12c}
 @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{128}
+@anchor{cp/topics/expressions gccjit context new_rvalue__ssCRC}@anchor{12d}
 @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
@@ -10902,12 +10994,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{129}
+@anchor{cp/topics/expressions unary-operations}@anchor{12e}
 @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{12a}
+@anchor{cp/topics/expressions gccjit context new_unary_op__enum gccjit type gccjit rvalue gccjit location}@anchor{12f}
 @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.
@@ -10923,7 +11015,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{12b}
+@anchor{cp/topics/expressions gccjit context new_minus__gccjit type gccjit rvalue gccjit location}@anchor{130}
 @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:
@@ -10944,7 +11036,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{12c}
+@anchor{cp/topics/expressions new_bitwise_negate__gccjit type gccjit rvalue gccjit location}@anchor{131}
 @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:
@@ -10965,7 +11057,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{12d}
+@anchor{cp/topics/expressions new_logical_negate__gccjit type gccjit rvalue gccjit location}@anchor{132}
 @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:
@@ -10988,7 +11080,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{12e}
+@anchor{cp/topics/expressions sub-operator__gccjit rvalue}@anchor{133}
 @deffn {C++ Function} gccjit::rvalue operator- (gccjit::rvalue a)
 
 @example
@@ -10999,7 +11091,7 @@ gccjit::rvalue negpi = -pi;
 @end deffn
 
 @geindex operator~ (C++ function)
-@anchor{cp/topics/expressions inv-operator__gccjit rvalue}@anchor{12f}
+@anchor{cp/topics/expressions inv-operator__gccjit rvalue}@anchor{134}
 @deffn {C++ Function} gccjit::rvalue operator~ (gccjit::rvalue a)
 
 @example
@@ -11010,7 +11102,7 @@ gccjit::rvalue mask = ~a;
 @end deffn
 
 @geindex operator! (C++ function)
-@anchor{cp/topics/expressions not-operator__gccjit rvalue}@anchor{130}
+@anchor{cp/topics/expressions not-operator__gccjit rvalue}@anchor{135}
 @deffn {C++ Function} gccjit::rvalue operator! (gccjit::rvalue a)
 
 @example
@@ -11021,12 +11113,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{131}
+@anchor{cp/topics/expressions binary-operations}@anchor{136}
 @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{d3}
+@anchor{cp/topics/expressions gccjit context new_binary_op__enum gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{d8}
 @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.
@@ -11042,59 +11134,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{132}
+@anchor{cp/topics/expressions gccjit context new_plus__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{137}
 @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{133}
+@anchor{cp/topics/expressions gccjit context new_minus__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{138}
 @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{134}
+@anchor{cp/topics/expressions gccjit context new_mult__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{139}
 @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{135}
+@anchor{cp/topics/expressions gccjit context new_divide__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{13a}
 @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{136}
+@anchor{cp/topics/expressions gccjit context new_modulo__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{13b}
 @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{137}
+@anchor{cp/topics/expressions gccjit context new_bitwise_and__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{13c}
 @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{138}
+@anchor{cp/topics/expressions gccjit context new_bitwise_xor__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{13d}
 @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{139}
+@anchor{cp/topics/expressions gccjit context new_bitwise_or__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{13e}
 @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{13a}
+@anchor{cp/topics/expressions gccjit context new_logical_and__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{13f}
 @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{13b}
+@anchor{cp/topics/expressions gccjit context new_logical_or__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{140}
 @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{13c}
+@anchor{cp/topics/expressions add-operator__gccjit rvalue gccjit rvalue}@anchor{141}
 @deffn {C++ Function} gccjit::rvalue operator+ (gccjit::rvalue a, gccjit::rvalue b)
 
 @example
@@ -11105,7 +11197,7 @@ gccjit::rvalue sum = a + b;
 @end deffn
 
 @geindex operator- (C++ function)
-@anchor{cp/topics/expressions sub-operator__gccjit rvalue gccjit rvalue}@anchor{13d}
+@anchor{cp/topics/expressions sub-operator__gccjit rvalue gccjit rvalue}@anchor{142}
 @deffn {C++ Function} gccjit::rvalue operator- (gccjit::rvalue a, gccjit::rvalue b)
 
 @example
@@ -11116,7 +11208,7 @@ gccjit::rvalue diff = a - b;
 @end deffn
 
 @geindex operator* (C++ function)
-@anchor{cp/topics/expressions mul-operator__gccjit rvalue gccjit rvalue}@anchor{13e}
+@anchor{cp/topics/expressions mul-operator__gccjit rvalue gccjit rvalue}@anchor{143}
 @deffn {C++ Function} gccjit::rvalue operator* (gccjit::rvalue a, gccjit::rvalue b)
 
 @example
@@ -11127,7 +11219,7 @@ gccjit::rvalue prod = a * b;
 @end deffn
 
 @geindex operator/ (C++ function)
-@anchor{cp/topics/expressions div-operator__gccjit rvalue gccjit rvalue}@anchor{13f}
+@anchor{cp/topics/expressions div-operator__gccjit rvalue gccjit rvalue}@anchor{144}
 @deffn {C++ Function} gccjit::rvalue operator/ (gccjit::rvalue a, gccjit::rvalue b)
 
 @example
@@ -11138,7 +11230,7 @@ gccjit::rvalue result = a / b;
 @end deffn
 
 @geindex operator% (C++ function)
-@anchor{cp/topics/expressions mod-operator__gccjit rvalue gccjit rvalue}@anchor{140}
+@anchor{cp/topics/expressions mod-operator__gccjit rvalue gccjit rvalue}@anchor{145}
 @deffn {C++ Function} gccjit::rvalue operator% (gccjit::rvalue a, gccjit::rvalue b)
 
 @example
@@ -11149,7 +11241,7 @@ gccjit::rvalue mod = a % b;
 @end deffn
 
 @geindex operator& (C++ function)
-@anchor{cp/topics/expressions and-operator__gccjit rvalue gccjit rvalue}@anchor{141}
+@anchor{cp/topics/expressions and-operator__gccjit rvalue gccjit rvalue}@anchor{146}
 @deffn {C++ Function} gccjit::rvalue operator& (gccjit::rvalue a, gccjit::rvalue b)
 
 @example
@@ -11160,7 +11252,7 @@ gccjit::rvalue x = a & b;
 @end deffn
 
 @geindex operator^ (C++ function)
-@anchor{cp/topics/expressions xor-operator__gccjit rvalue gccjit rvalue}@anchor{142}
+@anchor{cp/topics/expressions xor-operator__gccjit rvalue gccjit rvalue}@anchor{147}
 @deffn {C++ Function} gccjit::rvalue operator^ (gccjit::rvalue a, gccjit::rvalue b)
 
 @example
@@ -11171,7 +11263,7 @@ gccjit::rvalue x = a ^ b;
 @end deffn
 
 @geindex operator| (C++ function)
-@anchor{cp/topics/expressions or-operator__gccjit rvalue gccjit rvalue}@anchor{143}
+@anchor{cp/topics/expressions or-operator__gccjit rvalue gccjit rvalue}@anchor{148}
 @deffn {C++ Function} gccjit::rvalue operator| (gccjit::rvalue a, gccjit::rvalue b)
 
 @example
@@ -11182,7 +11274,7 @@ gccjit::rvalue x = a | b;
 @end deffn
 
 @geindex operator&& (C++ function)
-@anchor{cp/topics/expressions sand-operator__gccjit rvalue gccjit rvalue}@anchor{144}
+@anchor{cp/topics/expressions sand-operator__gccjit rvalue gccjit rvalue}@anchor{149}
 @deffn {C++ Function} gccjit::rvalue operator&& (gccjit::rvalue a, gccjit::rvalue b)
 
 @example
@@ -11193,7 +11285,7 @@ gccjit::rvalue cond = a && b;
 @end deffn
 
 @geindex operator|| (C++ function)
-@anchor{cp/topics/expressions sor-operator__gccjit rvalue gccjit rvalue}@anchor{145}
+@anchor{cp/topics/expressions sor-operator__gccjit rvalue gccjit rvalue}@anchor{14a}
 @deffn {C++ Function} gccjit::rvalue operator|| (gccjit::rvalue a, gccjit::rvalue b)
 
 @example
@@ -11216,12 +11308,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{146}
+@anchor{cp/topics/expressions comparisons}@anchor{14b}
 @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{e0}
+@anchor{cp/topics/expressions gccjit context new_comparison__enum gccjit rvalue gccjit rvalue gccjit location}@anchor{e5}
 @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.
@@ -11237,39 +11329,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{147}
+@anchor{cp/topics/expressions gccjit context new_eq__gccjit rvalue gccjit rvalue gccjit location}@anchor{14c}
 @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{148}
+@anchor{cp/topics/expressions gccjit context new_ne__gccjit rvalue gccjit rvalue gccjit location}@anchor{14d}
 @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{149}
+@anchor{cp/topics/expressions gccjit context new_lt__gccjit rvalue gccjit rvalue gccjit location}@anchor{14e}
 @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{14a}
+@anchor{cp/topics/expressions gccjit context new_le__gccjit rvalue gccjit rvalue gccjit location}@anchor{14f}
 @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{14b}
+@anchor{cp/topics/expressions gccjit context new_gt__gccjit rvalue gccjit rvalue gccjit location}@anchor{150}
 @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{14c}
+@anchor{cp/topics/expressions gccjit context new_ge__gccjit rvalue gccjit rvalue gccjit location}@anchor{151}
 @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{14d}
+@anchor{cp/topics/expressions eq-operator__gccjit rvalue gccjit rvalue}@anchor{152}
 @deffn {C++ Function} gccjit::rvalue operator== (gccjit::rvalue a, gccjit::rvalue b)
 
 @example
@@ -11280,7 +11372,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{14e}
+@anchor{cp/topics/expressions neq-operator__gccjit rvalue gccjit rvalue}@anchor{153}
 @deffn {C++ Function} gccjit::rvalue operator!= (gccjit::rvalue a, gccjit::rvalue b)
 
 @example
@@ -11291,7 +11383,7 @@ gccjit::rvalue cond = (i != j);
 @end deffn
 
 @geindex operator< (C++ function)
-@anchor{cp/topics/expressions lt-operator__gccjit rvalue gccjit rvalue}@anchor{14f}
+@anchor{cp/topics/expressions lt-operator__gccjit rvalue gccjit rvalue}@anchor{154}
 @deffn {C++ Function} gccjit::rvalue operator< (gccjit::rvalue a, gccjit::rvalue b)
 
 @example
@@ -11302,7 +11394,7 @@ gccjit::rvalue cond = i < n;
 @end deffn
 
 @geindex operator<= (C++ function)
-@anchor{cp/topics/expressions lte-operator__gccjit rvalue gccjit rvalue}@anchor{150}
+@anchor{cp/topics/expressions lte-operator__gccjit rvalue gccjit rvalue}@anchor{155}
 @deffn {C++ Function} gccjit::rvalue operator<= (gccjit::rvalue a, gccjit::rvalue b)
 
 @example
@@ -11313,7 +11405,7 @@ gccjit::rvalue cond = i <= n;
 @end deffn
 
 @geindex operator> (C++ function)
-@anchor{cp/topics/expressions gt-operator__gccjit rvalue gccjit rvalue}@anchor{151}
+@anchor{cp/topics/expressions gt-operator__gccjit rvalue gccjit rvalue}@anchor{156}
 @deffn {C++ Function} gccjit::rvalue operator> (gccjit::rvalue a, gccjit::rvalue b)
 
 @example
@@ -11324,7 +11416,7 @@ gccjit::rvalue cond = (ch > limit);
 @end deffn
 
 @geindex operator>= (C++ function)
-@anchor{cp/topics/expressions gte-operator__gccjit rvalue gccjit rvalue}@anchor{152}
+@anchor{cp/topics/expressions gte-operator__gccjit rvalue gccjit rvalue}@anchor{157}
 @deffn {C++ Function} gccjit::rvalue operator>= (gccjit::rvalue a, gccjit::rvalue b)
 
 @example
@@ -11337,12 +11429,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{153}
+@anchor{cp/topics/expressions function-calls}@anchor{158}
 @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{154}
+@anchor{cp/topics/expressions gcc_jit_context_new_call__gcc_jit_contextP gcc_jit_locationP gcc_jit_functionP i gcc_jit_rvaluePP}@anchor{159}
 @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
@@ -11351,14 +11443,14 @@ call to the function, with the result as an rvalue.
 @cartouche
 @quotation Note 
 @code{gccjit::context::new_call()} merely builds a
-@pxref{121,,gccjit;;rvalue} i.e. an expression that can be evaluated,
+@pxref{126,,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{155,,gccjit;;block;;add_eval()}:
+@pxref{15a,,gccjit;;block;;add_eval()}:
 
 @example
 /* Add "(void)printf (arg0, arg1);".  */
@@ -11371,12 +11463,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{156}
+@anchor{cp/topics/expressions type-coercion}@anchor{15b}
 @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{157}
+@anchor{cp/topics/expressions gccjit context new_cast__gccjit rvalue gccjit type gccjit location}@anchor{15c}
 @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.
@@ -11401,24 +11493,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{158}
+@anchor{cp/topics/expressions lvalues}@anchor{15d}
 @subsubsection Lvalues
 
 
 @geindex gccjit;;lvalue (C++ class)
-@anchor{cp/topics/expressions gccjit lvalue}@anchor{159}
+@anchor{cp/topics/expressions gccjit lvalue}@anchor{15e}
 @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{121,,gccjit;;rvalue}, where the rvalue is computed by reading from the
+@pxref{126,,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{15a}
+@anchor{cp/topics/expressions gccjit lvalue get_address__gccjit location}@anchor{15f}
 @deffn {C++ Function} gccjit::rvalue gccjit::lvalue::get_address (gccjit::location loc)
 
 Take the address of an lvalue; analogous to:
@@ -11440,24 +11532,27 @@ Parameter "loc" is optional.
 @end menu
 
 @node Global variables<2>,,,Lvalues<2>
-@anchor{cp/topics/expressions global-variables}@anchor{15b}
+@anchor{cp/topics/expressions global-variables}@anchor{160}
 @subsubsection Global variables
 
 
 @geindex gccjit;;context;;new_global (C++ function)
-@anchor{cp/topics/expressions gccjit context new_global__gccjit type cCP gccjit location}@anchor{15c}
-@deffn {C++ Function} gccjit::lvalue gccjit::context::new_global (gccjit::type type, const char* name, gccjit::location loc)
+@anchor{cp/topics/expressions gccjit context new_global__enum gccjit type cCP gccjit location}@anchor{161}
+@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{a4,,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{15d}
+@anchor{cp/topics/expressions working-with-pointers-structs-and-unions}@anchor{162}
 @subsubsection Working with pointers, structs and unions
 
 
 @geindex gccjit;;rvalue;;dereference (C++ function)
-@anchor{cp/topics/expressions gccjit rvalue dereference__gccjit location}@anchor{15e}
+@anchor{cp/topics/expressions gccjit rvalue dereference__gccjit location}@anchor{163}
 @deffn {C++ Function} gccjit::lvalue gccjit::rvalue::dereference (gccjit::location loc)
 
 Given an rvalue of pointer type @code{T *}, dereferencing the pointer,
@@ -11490,7 +11585,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{15f}
+@anchor{cp/topics/expressions gccjit lvalue access_field__gccjit field gccjit location}@anchor{164}
 @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,
@@ -11506,7 +11601,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{160}
+@anchor{cp/topics/expressions gccjit rvalue access_field__gccjit field gccjit location}@anchor{165}
 @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
@@ -11522,7 +11617,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{161}
+@anchor{cp/topics/expressions gccjit rvalue dereference_field__gccjit field gccjit location}@anchor{166}
 @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
@@ -11538,7 +11633,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{162}
+@anchor{cp/topics/expressions gccjit context new_array_access__gccjit rvalue gccjit rvalue gccjit location}@anchor{167}
 @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
@@ -11557,7 +11652,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{103,,gccjit;;location},
+For array accesses where you don't need to specify a @pxref{108,,gccjit;;location},
 two overloaded operators are available:
 
 @quotation
@@ -11597,7 +11692,7 @@ gccjit::lvalue element = array[0];
 @c <http://www.gnu.org/licenses/>.
 
 @node Creating and using functions<2>,Source Locations<2>,Expressions<2>,Topic Reference<2>
-@anchor{cp/topics/functions doc}@anchor{163}@anchor{cp/topics/functions creating-and-using-functions}@anchor{164}
+@anchor{cp/topics/functions doc}@anchor{168}@anchor{cp/topics/functions creating-and-using-functions}@anchor{169}
 @subsection Creating and using functions
 
 
@@ -11610,36 +11705,36 @@ gccjit::lvalue element = array[0];
 @end menu
 
 @node Params<2>,Functions<2>,,Creating and using functions<2>
-@anchor{cp/topics/functions params}@anchor{165}
+@anchor{cp/topics/functions params}@anchor{16a}
 @subsubsection Params
 
 
 @geindex gccjit;;param (C++ class)
-@anchor{cp/topics/functions gccjit param}@anchor{166}
+@anchor{cp/topics/functions gccjit param}@anchor{16b}
 @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{d2}
+@anchor{cp/topics/functions gccjit context new_param__gccjit type cCP gccjit location}@anchor{d7}
 @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{166,,gccjit;;param} is a subclass of @pxref{159,,gccjit;;lvalue} (and thus
-of @pxref{121,,gccjit;;rvalue} and @pxref{10b,,gccjit;;object}).  It is a thin
+@pxref{16b,,gccjit;;param} is a subclass of @pxref{15e,,gccjit;;lvalue} (and thus
+of @pxref{126,,gccjit;;rvalue} and @pxref{110,,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{167}
+@anchor{cp/topics/functions functions}@anchor{16c}
 @subsubsection Functions
 
 
 @geindex gccjit;;function (C++ class)
-@anchor{cp/topics/functions gccjit function}@anchor{168}
+@anchor{cp/topics/functions gccjit function}@anchor{16d}
 @deffn {C++ Class} gccjit::function
 
 A @cite{gccjit::function} represents a function - either one that we're
@@ -11657,29 +11752,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{169}
+@anchor{cp/topics/functions gccjit context get_builtin_function__cCP}@anchor{16e}
 @deffn {C++ Function} gccjit::function gccjit::context::get_builtin_function (const char* name)
 
 This is a wrapper around the C API's
-@pxref{b6,,gcc_jit_context_get_builtin_function()}.
+@pxref{bb,,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{16a}
+@anchor{cp/topics/functions gccjit function get_param__iC}@anchor{16f}
 @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{e5}
+@anchor{cp/topics/functions gccjit function dump_to_dot__cCP}@anchor{ea}
 @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{dc}
+@anchor{cp/topics/functions gccjit function new_local__gccjit type cCP gccjit location}@anchor{e1}
 @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
@@ -11687,19 +11782,19 @@ name.
 @end deffn
 
 @node Blocks<2>,Statements<2>,Functions<2>,Creating and using functions<2>
-@anchor{cp/topics/functions blocks}@anchor{16b}
+@anchor{cp/topics/functions blocks}@anchor{170}
 @subsubsection Blocks
 
 
 @geindex gccjit;;block (C++ class)
-@anchor{cp/topics/functions gccjit block}@anchor{16c}
+@anchor{cp/topics/functions gccjit block}@anchor{171}
 @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{16c,,gccjit;;block} is a subclass of @pxref{10b,,gccjit;;object}.
+@pxref{171,,gccjit;;block} is a subclass of @pxref{110,,gccjit;;object}.
 
 The first basic block that you create within a function will
 be the entrypoint.
@@ -11712,7 +11807,7 @@ one function.
 @end deffn
 
 @geindex gccjit;;function;;new_block (C++ function)
-@anchor{cp/topics/functions gccjit function new_block__cCP}@anchor{16d}
+@anchor{cp/topics/functions gccjit function new_block__cCP}@anchor{172}
 @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
@@ -11722,12 +11817,12 @@ messages.
 @end deffn
 
 @node Statements<2>,,Blocks<2>,Creating and using functions<2>
-@anchor{cp/topics/functions statements}@anchor{16e}
+@anchor{cp/topics/functions statements}@anchor{173}
 @subsubsection Statements
 
 
 @geindex gccjit;;block;;add_eval (C++ function)
-@anchor{cp/topics/functions gccjit block add_eval__gccjit rvalue gccjit location}@anchor{155}
+@anchor{cp/topics/functions gccjit block add_eval__gccjit rvalue gccjit location}@anchor{15a}
 @deffn {C++ Function} void gccjit::block::add_eval (gccjit::rvalue rvalue, gccjit::location loc)
 
 Add evaluation of an rvalue, discarding the result
@@ -11743,7 +11838,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{de}
+@anchor{cp/topics/functions gccjit block add_assignment__gccjit lvalue gccjit rvalue gccjit location}@anchor{e3}
 @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
@@ -11759,7 +11854,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{e2}
+@anchor{cp/topics/functions gccjit block add_assignment_op__gccjit lvalue enum gccjit rvalue gccjit location}@anchor{e7}
 @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
@@ -11789,7 +11884,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{ed}
+@anchor{cp/topics/functions gccjit block add_comment__cCP gccjit location}@anchor{f2}
 @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
@@ -11803,7 +11898,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{e1}
+@anchor{cp/topics/functions gccjit block end_with_conditional__gccjit rvalue gccjit block gccjit block gccjit location}@anchor{e6}
 @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
@@ -11824,7 +11919,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{16f}
+@anchor{cp/topics/functions gccjit block end_with_jump__gccjit block gccjit location}@anchor{174}
 @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.
@@ -11839,7 +11934,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{170}
+@anchor{cp/topics/functions gccjit block end_with_return__gccjit rvalue gccjit location}@anchor{175}
 @deffn {C++ Function} void gccjit::block::end_with_return (gccjit::rvalue rvalue, gccjit::location loc)
 
 Terminate a block.
@@ -11890,12 +11985,12 @@ return;
 @c <http://www.gnu.org/licenses/>.
 
 @node Source Locations<2>,Compilation results<2>,Creating and using functions<2>,Topic Reference<2>
-@anchor{cp/topics/locations source-locations}@anchor{171}@anchor{cp/topics/locations doc}@anchor{172}
+@anchor{cp/topics/locations source-locations}@anchor{176}@anchor{cp/topics/locations doc}@anchor{177}
 @subsection Source Locations
 
 
 @geindex gccjit;;location (C++ class)
-@anchor{cp/topics/locations gccjit location}@anchor{103}
+@anchor{cp/topics/locations gccjit location}@anchor{108}
 @deffn {C++ Class} gccjit::location
 
 A @cite{gccjit::location} encapsulates a source code location, so that
@@ -11906,10 +12001,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{f1,,gccjit;;context;;new_location()}.
+You can construct them using @pxref{f6,,gccjit;;context;;new_location()}.
 
 You need to enable @pxref{42,,GCC_JIT_BOOL_OPTION_DEBUGINFO} on the
-@pxref{fb,,gccjit;;context} for these locations to actually be usable by
+@pxref{100,,gccjit;;context} for these locations to actually be usable by
 the debugger:
 
 @example
@@ -11920,7 +12015,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{f1}
+@anchor{cp/topics/locations gccjit context new_location__cCP i i}@anchor{f6}
 @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
@@ -11933,13 +12028,13 @@ location.
 @end menu
 
 @node Faking it<2>,,,Source Locations<2>
-@anchor{cp/topics/locations faking-it}@anchor{173}
+@anchor{cp/topics/locations faking-it}@anchor{178}
 @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{102,,gccjit;;context;;dump_to_file()}:
+your context using @pxref{107,,gccjit;;context;;dump_to_file()}:
 
 @example
 ctxt.dump_to_file ("/tmp/something.c",
@@ -11971,27 +12066,27 @@ file, giving you @emph{something} you can step through in the debugger.
 @c <http://www.gnu.org/licenses/>.
 
 @node Compilation results<2>,,Source Locations<2>,Topic Reference<2>
-@anchor{cp/topics/results compilation-results}@anchor{174}@anchor{cp/topics/results doc}@anchor{175}
+@anchor{cp/topics/results compilation-results}@anchor{179}@anchor{cp/topics/results doc}@anchor{17a}
 @subsection Compilation results
 
 
 @geindex gcc_jit_result (C++ type)
-@anchor{cp/topics/results gcc_jit_result}@anchor{176}
+@anchor{cp/topics/results gcc_jit_result}@anchor{17b}
 @deffn {C++ Type} gcc_jit_result
 
 A @cite{gcc_jit_result} encapsulates the result of compiling a context.
 @end deffn
 
 @geindex gccjit;;context;;compile (C++ function)
-@anchor{cp/topics/results gccjit context compile}@anchor{d4}
-@deffn {C++ Function} @pxref{176,,gcc_jit_result*} gccjit::context::compile ()
+@anchor{cp/topics/results gccjit context compile}@anchor{d9}
+@deffn {C++ Function} @pxref{17b,,gcc_jit_result*} gccjit::context::compile ()
 
 This calls into GCC and builds the code, returning a
 @cite{gcc_jit_result *}.
 @end deffn
 
 @geindex gcc_jit_result_get_code (C++ function)
-@anchor{cp/topics/results gcc_jit_result_get_code__gcc_jit_resultP cCP}@anchor{177}
+@anchor{cp/topics/results gcc_jit_result_get_code__gcc_jit_resultP cCP}@anchor{17c}
 @deffn {C++ Function} void* gcc_jit_result_get_code (gcc_jit_result* result, const char* funcname)
 
 Locate a given function within the built machine code.
@@ -12000,7 +12095,7 @@ correct type before it can be called.
 @end deffn
 
 @geindex gcc_jit_result_release (C++ function)
-@anchor{cp/topics/results gcc_jit_result_release__gcc_jit_resultP}@anchor{178}
+@anchor{cp/topics/results gcc_jit_result_release__gcc_jit_resultP}@anchor{17d}
 @deffn {C++ Function} void gcc_jit_result_release (gcc_jit_result* result)
 
 Once we're done with the code, this unloads the built .so file.
@@ -12026,7 +12121,7 @@ valid to use the result.
 @c <http://www.gnu.org/licenses/>.
 
 @node Internals,Indices and tables,C++ bindings for libgccjit,Top
-@anchor{internals/index internals}@anchor{179}@anchor{internals/index doc}@anchor{17a}
+@anchor{internals/index internals}@anchor{17e}@anchor{internals/index doc}@anchor{17f}
 @chapter Internals
 
 
@@ -12039,7 +12134,7 @@ valid to use the result.
 @end menu
 
 @node Working on the JIT library,Running the test suite,,Internals
-@anchor{internals/index working-on-the-jit-library}@anchor{17b}
+@anchor{internals/index working-on-the-jit-library}@anchor{180}
 @section Working on the JIT library
 
 
@@ -12076,7 +12171,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{17c}
+@anchor{internals/index cmdoption--enable-host-shared}@anchor{181}
 @deffn {Option} --enable-host-shared
 
 Configuring with this option means that the compiler is built as
@@ -12085,7 +12180,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{17d}
+@anchor{internals/index cmdoption--enable-languages}@anchor{182}
 @deffn {Option} --enable-languages=jit,c++
 
 This specifies which frontends to build.  The JIT library looks like
@@ -12104,7 +12199,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{17e}
+@anchor{internals/index cmdoption--disable-bootstrap}@anchor{183}
 @deffn {Option} --disable-bootstrap
 
 For hacking on the "jit" subdirectory, performing a full
@@ -12114,7 +12209,7 @@ the compiler can still bootstrap itself.
 @end deffn
 
 @geindex command line option; --enable-checking=release
-@anchor{internals/index cmdoption--enable-checking}@anchor{17f}
+@anchor{internals/index cmdoption--enable-checking}@anchor{184}
 @deffn {Option} --enable-checking=release
 
 The compile can perform extensive self-checking as it runs, useful when
@@ -12125,7 +12220,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{180}
+@anchor{internals/index running-the-test-suite}@anchor{185}
 @section Running the test suite
 
 
@@ -12188,7 +12283,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{181}
+@anchor{internals/index running-under-valgrind}@anchor{186}
 @subsection Running under valgrind
 
 
@@ -12236,7 +12331,7 @@ When running under valgrind, it's best to have configured gcc with
 various known false positives.
 
 @node Environment variables,Overview of code structure,Running the test suite,Internals
-@anchor{internals/index environment-variables}@anchor{182}
+@anchor{internals/index environment-variables}@anchor{187}
 @section Environment variables
 
 
@@ -12244,7 +12339,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{183}
+@anchor{internals/index envvar-LD_LIBRARY_PATH}@anchor{188}
 @deffn {Environment Variable} LD_LIBRARY_PATH
 
 @quotation
@@ -12266,7 +12361,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{184}
+@anchor{internals/index envvar-PATH}@anchor{189}
 @deffn {Environment Variable} PATH
 
 The library uses a driver executable for converting from .s assembler
@@ -12285,7 +12380,7 @@ of development.
 @end deffn
 
 @geindex environment variable; LIBRARY_PATH
-@anchor{internals/index envvar-LIBRARY_PATH}@anchor{185}
+@anchor{internals/index envvar-LIBRARY_PATH}@anchor{18a}
 @deffn {Environment Variable} LIBRARY_PATH
 
 The driver executable invokes the linker, and the latter needs to locate
@@ -12321,7 +12416,7 @@ hello world
 @noindent
 
 @node Overview of code structure,,Environment variables,Internals
-@anchor{internals/index overview-of-code-structure}@anchor{186}
+@anchor{internals/index overview-of-code-structure}@anchor{18b}
 @section Overview of code structure
 
 
@@ -12740,7 +12835,7 @@ JIT: gcc::jit::logger::~logger()
 @noindent
 
 @node Indices and tables,Index,Internals,Top
-@anchor{index indices-and-tables}@anchor{187}
+@anchor{index indices-and-tables}@anchor{18c}
 @unnumbered Indices and tables
 
 
index b58eeff8ff1819b1c4cce7dc08f960f7325899c4..84ff741a9339180376aa51eb930c42cce4ee8325 100644 (file)
@@ -504,12 +504,15 @@ Global variables
 ****************
 
 .. function:: gccjit::lvalue \
-              gccjit::context::new_global (gccjit::type type, \
+              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 :c:func:`gcc_jit_context_new_global` from
+   the C API; the "kind" parameter has the same meaning as there.
 
 Working with pointers, structs and unions
 -----------------------------------------
index 13a28e895d9304005f6b143e18c1b2ce83cb1d84..b56a1dba8e279dd49f9e02fbb989868e793a8987 100644 (file)
@@ -460,11 +460,36 @@ Global variables
 .. function:: gcc_jit_lvalue *\
               gcc_jit_context_new_global (gcc_jit_context *ctxt,\
                                           gcc_jit_location *loc,\
+                                          enum gcc_jit_global_kind kind,\
                                           gcc_jit_type *type,\
                                           const char *name)
 
    Add a new global variable of the given type and name to the context.
 
+   The "kind" parameter determines the visibility of the "global" outside
+   of the :c:type:`gcc_jit_result`:
+
+   .. type:: enum gcc_jit_global_kind
+
+   .. c:macro:: GCC_JIT_GLOBAL_EXPORTED
+
+      Global is defined by the client code and is visible
+      by name outside of this JIT context via
+      :c:func:`gcc_jit_result_get_global` (and this value is required for
+      the global to be accessible via that entrypoint).
+
+   .. c:macro:: GCC_JIT_GLOBAL_INTERNAL
+
+      Global is defined by the client code, but is invisible
+      outside of it.  Analogous to a "static" global within a .c file.
+      Specifically, the variable will only be visible within this
+      context and within child contexts.
+
+   .. c:macro:: GCC_JIT_GLOBAL_IMPORTED
+
+      Global is not defined by the client code; we're merely
+      referring to it.  Analogous to using an "extern" global from a
+      header file.
 
 Working with pointers, structs and unions
 -----------------------------------------
index 99044959a21f30bfe2a0b0fba4c1fc87a1e2680e..aa5ea8be28e910e7681bf40065f4d63d3c0bc850 100644 (file)
@@ -23,8 +23,8 @@ Compilation results
 .. type:: gcc_jit_result
 
   A `gcc_jit_result` encapsulates the result of compiling a context,
-  and the lifetimes of any machine code functions that are
-  returned.
+  and the lifetimes of any machine code functions or globals that are
+  within it.
 
 .. function:: gcc_jit_result *\
               gcc_jit_context_compile (gcc_jit_context *ctxt)
@@ -32,6 +32,9 @@ Compilation results
    This calls into GCC and builds the code, returning a
    `gcc_jit_result *`.
 
+   If this is non-NULL, the caller becomes responsible for
+   calling :func:`gcc_jit_result_release` on it once they're done
+   with it.
 
 .. function:: void *\
               gcc_jit_result_get_code (gcc_jit_result *result,\
@@ -66,14 +69,59 @@ Compilation results
 
    Note that the resulting machine code becomes invalid after
    :func:`gcc_jit_result_release` is called on the
-   `gcc_jit_result *`; attempting to call it after that may lead
+   :type:`gcc_jit_result *`; attempting to call it after that may lead
    to a segmentation fault.
 
+.. function:: void *\
+              gcc_jit_result_get_global (gcc_jit_result *result,\
+                                         const char *name)
+
+   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 `name` must have been created on
+   `result`'s context (or a parent context) via a call to
+   :func:`gcc_jit_context_new_global` with `kind`
+   :macro:`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.
+
+   This is a *pointer* to the global, so e.g. for an :c:type:`int` this is
+   an :c:type:`int *`.
+
+   For example, given an ``int foo;`` created this way:
+
+   .. code-block:: c
+
+     gcc_jit_lvalue *exported_global =
+       gcc_jit_context_new_global (ctxt,
+       any_location, /* or NULL */
+       GCC_JIT_GLOBAL_EXPORTED,
+       int_type,
+       "foo");
+
+   we can access it like this:
+
+   .. code-block:: c
+
+      int *ptr_to_foo =
+        (int *)gcc_jit_result_get_global (result, "foo");
+
+   If such a global is not found (or `result` or `name` are
+   ``NULL``), an error message will be emitted on stderr and
+   ``NULL`` will be returned.
+
+   Note that the resulting address becomes invalid after
+   :func:`gcc_jit_result_release` is called on the
+   :type:`gcc_jit_result *`; attempting to use it after that may lead
+   to a segmentation fault.
 
 .. function:: void\
               gcc_jit_result_release (gcc_jit_result *result)
 
    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 that was obtained by calling
-   :func:`gcc_jit_result_get_code` on it.
+   valid to use the result, or any code or globals that were obtained
+   by calling :func:`gcc_jit_result_get_code` or
+   :func:`gcc_jit_result_get_global` on it.
index a4dae3ead32ecdf859ac9a6439e85b12a3a9039e..9f799d302677b0963673c0605b60f479b8636c3c 100644 (file)
@@ -221,11 +221,16 @@ jit_langhook_getdecls (void)
 static void
 jit_langhook_write_globals (void)
 {
-  gcc_assert (gcc::jit::active_playback_ctxt);
-  JIT_LOG_SCOPE (gcc::jit::active_playback_ctxt->get_logger ());
+  gcc::jit::playback::context *ctxt = gcc::jit::active_playback_ctxt;
+  gcc_assert (ctxt);
+  JIT_LOG_SCOPE (ctxt->get_logger ());
+
+  ctxt->write_global_decls_1 ();
 
   /* This is the hook that runs the middle and backends: */
   symtab->finalize_compilation_unit ();
+
+  ctxt->write_global_decls_2 ();
 }
 
 #undef LANG_HOOKS_NAME
index 1baf9c544c478f125f26fad18946dd946f53ae47..0e45e0267e3880cf5c93b8b42d055a99194597c2 100644 (file)
@@ -62,6 +62,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "attribs.h"
 #include "context.h"
 #include "fold-const.h"
+#include "debug.h"
 
 #include "jit-common.h"
 #include "jit-logging.h"
@@ -109,6 +110,7 @@ playback::context::context (recording::context *ctxt)
 {
   JIT_LOG_SCOPE (get_logger ());
   m_functions.create (0);
+  m_globals.create (0);
   m_source_files.create (0);
   m_cached_locations.create (0);
 }
@@ -482,6 +484,7 @@ new_function (location *loc,
 playback::lvalue *
 playback::context::
 new_global (location *loc,
+           enum gcc_jit_global_kind kind,
            type *type,
            const char *name)
 {
@@ -490,13 +493,33 @@ new_global (location *loc,
   tree inner = build_decl (UNKNOWN_LOCATION, VAR_DECL,
                           get_identifier (name),
                           type->as_tree ());
-  TREE_PUBLIC (inner) = 1;
+  TREE_PUBLIC (inner) = (kind != GCC_JIT_GLOBAL_INTERNAL);
   DECL_COMMON (inner) = 1;
-  DECL_EXTERNAL (inner) = 1;
+  switch (kind)
+    {
+    default:
+      gcc_unreachable ();
+
+    case GCC_JIT_GLOBAL_EXPORTED:
+      TREE_STATIC (inner) = 1;
+      break;
+
+    case GCC_JIT_GLOBAL_INTERNAL:
+      TREE_STATIC (inner) = 1;
+      break;
+
+    case GCC_JIT_GLOBAL_IMPORTED:
+      DECL_EXTERNAL (inner) = 1;
+      break;
+    }
 
   if (loc)
     set_tree_location (inner, loc);
 
+  varpool_node::get_create (inner);
+
+  m_globals.safe_push (inner);
+
   return new lvalue (this, inner);
 }
 
@@ -649,6 +672,45 @@ as_truth_value (tree expr, location *loc)
   return expr;
 }
 
+/* For use by jit_langhook_write_globals.
+   Calls varpool_node::finalize_decl on each global.  */
+
+void
+playback::context::
+write_global_decls_1 ()
+{
+  /* Compare with e.g. the C frontend's c_write_global_declarations.  */
+  JIT_LOG_SCOPE (get_logger ());
+
+  int i;
+  tree decl;
+  FOR_EACH_VEC_ELT (m_globals, i, decl)
+    {
+      gcc_assert (TREE_CODE (decl) == VAR_DECL);
+      varpool_node::finalize_decl (decl);
+    }
+}
+
+/* For use by jit_langhook_write_globals.
+   Calls debug_hooks->global_decl on each global.  */
+
+void
+playback::context::
+write_global_decls_2 ()
+{
+  /* Compare with e.g. the C frontend's c_write_global_declarations_2. */
+  JIT_LOG_SCOPE (get_logger ());
+
+  int i;
+  tree decl;
+  FOR_EACH_VEC_ELT (m_globals, i, decl)
+    {
+      gcc_assert (TREE_CODE (decl) == VAR_DECL);
+      debug_hooks->global_decl (decl);
+    }
+}
+
+
 /* Construct a playback::rvalue instance (wrapping a tree) for a
    unary op.  */
 
index 07d030e8c300ffde5694d35957a76539a8921a16..8efd506ff895e7333dc911997e1f1dc3b4434457 100644 (file)
@@ -90,6 +90,7 @@ public:
 
   lvalue *
   new_global (location *loc,
+             enum gcc_jit_global_kind kind,
              type *type,
              const char *name);
 
@@ -206,6 +207,10 @@ public:
     return m_recording_ctxt->errors_occurred ();
   }
 
+  /* For use by jit_langhook_write_globals.  */
+  void write_global_decls_1 ();
+  void write_global_decls_2 ();
+
 private:
   void dump_generated_code ();
 
@@ -259,6 +264,7 @@ private:
   tempdir *m_tempdir;
 
   auto_vec<function *> m_functions;
+  auto_vec<tree> m_globals;
   tree m_char_array_type_node;
   tree m_const_char_ptr;
 
index 8da7f763ad359a3934693d420aeb04d6eb825362..20fd2d2f82b860f1ada6d4bffd114ae10fe5c177 100644 (file)
@@ -177,6 +177,7 @@ recording::context::context (context *parent_ctxt)
     m_owns_last_error_str (false),
     m_mementos (),
     m_compound_types (),
+    m_globals (),
     m_functions (),
     m_FILE_type (NULL),
     m_builtins_manager(NULL)
@@ -636,12 +637,15 @@ recording::context::get_builtin_function (const char *name)
 
 recording::lvalue *
 recording::context::new_global (recording::location *loc,
+                               enum gcc_jit_global_kind kind,
                                recording::type *type,
                                const char *name)
 {
-  recording::lvalue *result =
-    new recording::global (this, loc, type, new_string (name));
+  recording::global *result =
+    new recording::global (this, loc, kind, type, new_string (name));
   record (result);
+  m_globals.safe_push (result);
+
   return result;
 }
 
@@ -1016,6 +1020,15 @@ recording::context::dump_to_file (const char *path, bool update_locations)
        d.write ("\n");
       }
 
+  /* Globals.  */
+  global *g;
+  FOR_EACH_VEC_ELT (m_globals, i, g)
+    {
+      g->write_to_dump (d);
+    }
+  if (!m_globals.is_empty ())
+    d.write ("\n");
+
   function *fn;
   FOR_EACH_VEC_ELT (m_functions, i, fn)
     {
@@ -2648,10 +2661,57 @@ void
 recording::global::replay_into (replayer *r)
 {
   set_playback_obj (r->new_global (playback_location (r, m_loc),
+                                  m_kind,
                                   m_type->playback_type (),
                                   playback_string (m_name)));
 }
 
+/* Override the default implementation of
+   recording::memento::write_to_dump for globals.
+   This will be of the form:
+
+   GCC_JIT_GLOBAL_EXPORTED:
+      "TYPE NAME;"
+      e.g. "int foo;"
+
+   GCC_JIT_GLOBAL_INTERNAL:
+      "static TYPE NAME;"
+      e.g. "static int foo;"
+
+   GCC_JIT_GLOBAL_IMPORTED:
+      "extern TYPE NAME;"
+      e.g. "extern int foo;"
+
+   These are written to the top of the dump by
+   recording::context::dump_to_file.  */
+
+void
+recording::global::write_to_dump (dump &d)
+{
+  if (d.update_locations ())
+    m_loc = d.make_location ();
+
+  switch (m_kind)
+    {
+    default:
+      gcc_unreachable ();
+
+    case GCC_JIT_GLOBAL_EXPORTED:
+      break;
+
+    case GCC_JIT_GLOBAL_INTERNAL:
+      d.write ("static ");
+      break;
+
+    case GCC_JIT_GLOBAL_IMPORTED:
+      d.write ("extern ");
+      break;
+    }
+  d.write ("%s %s;\n",
+          m_type->get_debug_string (),
+          get_debug_string ());
+}
+
 /* The implementation of the various const-handling classes:
    gcc::jit::recording::memento_of_new_rvalue_from_const <HOST_TYPE>.  */
 
index 8d1548743668e09a0fad99ce033e5fe874e91950..43e99bae0fda88db011f3c83ba1dfdad806b9c44 100644 (file)
@@ -132,6 +132,7 @@ public:
 
   lvalue *
   new_global (location *loc,
+             enum gcc_jit_global_kind kind,
              type *type,
              const char *name);
 
@@ -272,6 +273,7 @@ private:
 
   /* Specific recordings, for use by dump_to_file.  */
   auto_vec<compound_type *> m_compound_types;
+  auto_vec<global *> m_globals;
   auto_vec<function *> m_functions;
 
   type *m_basic_types[NUM_GCC_JIT_TYPES];
@@ -1051,18 +1053,23 @@ class global : public lvalue
 public:
   global (context *ctxt,
          location *loc,
+         enum gcc_jit_global_kind kind,
          type *type,
          string *name)
   : lvalue (ctxt, loc, type),
+    m_kind (kind),
     m_name (name)
   {}
 
   void replay_into (replayer *);
 
+  void write_to_dump (dump &d);
+
 private:
   string * make_debug_string () { return m_name; }
 
 private:
+  enum gcc_jit_global_kind m_kind;
   string *m_name;
 };
 
index a9330e591c53d034e42f4219706f0581254af4a9..30acdc663db7e6992fc195000074b0b353e7f52d 100644 (file)
@@ -86,6 +86,33 @@ get_code (const char *funcname)
   return code;
 }
 
+/* Attempt to locate the given global by name within the
+   playback::result, using dlsym.
+
+   Implements the post-error-checking part of
+   gcc_jit_result_get_global.  */
+
+void *
+result::
+get_global (const char *name)
+{
+  JIT_LOG_SCOPE (get_logger ());
+
+  void *global;
+  const char *error;
+
+  /* Clear any existing error.  */
+  dlerror ();
+
+  global = dlsym (m_dso_handle, name);
+
+  if ((error = dlerror()) != NULL)  {
+    fprintf(stderr, "%s\n", error);
+  }
+
+  return global;
+}
+
 } // namespace gcc::jit
 
 } // namespace gcc
index d9073f2694512a938a59a0efbaa45bced0fc0501..b2d179dec53be623da83d35cc929bb4eaee61509 100644 (file)
@@ -36,6 +36,9 @@ public:
   void *
   get_code (const char *funcname);
 
+  void *
+  get_global (const char *name);
+
 private:
   void *m_dso_handle;
   tempdir *m_tempdir;
index 84144e51126f065c63d90ed78fa2f4cfee66370f..79320f676f7c5e65420646d30392d9191c589a7b 100644 (file)
@@ -155,7 +155,8 @@ namespace gccjit
 
     function get_builtin_function (const std::string &name);
 
-    lvalue new_global (type type_,
+    lvalue new_global (enum gcc_jit_global_kind kind,
+                      type type_,
                       const std::string &name,
                       location loc = location ());
 
@@ -707,12 +708,14 @@ context::get_builtin_function (const std::string &name)
 }
 
 inline lvalue
-context::new_global (type type_,
+context::new_global (enum gcc_jit_global_kind kind,
+                    type type_,
                     const std::string &name,
                     location loc)
 {
   return lvalue (gcc_jit_context_new_global (m_inner_ctxt,
                                             loc.get_inner_location (),
+                                            kind,
                                             type_.get_inner_type (),
                                             name.c_str ()));
 }
index 62d3edf9e1c5e36d863e97b1ed47e4fa4dac9f46..d596d08cd3e060e3a8f8476c551741148bbf4474 100644 (file)
@@ -987,16 +987,23 @@ gcc_jit_block_get_function (gcc_jit_block *block)
 gcc_jit_lvalue *
 gcc_jit_context_new_global (gcc_jit_context *ctxt,
                            gcc_jit_location *loc,
+                           enum gcc_jit_global_kind kind,
                            gcc_jit_type *type,
                            const char *name)
 {
   RETURN_NULL_IF_FAIL (ctxt, NULL, loc, "NULL context");
   JIT_LOG_FUNC (ctxt->get_logger ());
   /* LOC can be NULL.  */
+  RETURN_NULL_IF_FAIL_PRINTF1 (
+    ((kind >= GCC_JIT_GLOBAL_EXPORTED)
+     && (kind <= GCC_JIT_GLOBAL_IMPORTED)),
+    ctxt, loc,
+    "unrecognized value for enum gcc_jit_global_kind: %i",
+    kind);
   RETURN_NULL_IF_FAIL (type, ctxt, loc, "NULL type");
   RETURN_NULL_IF_FAIL (name, ctxt, loc, "NULL name");
 
-  return (gcc_jit_lvalue *)ctxt->new_global (loc, type, name);
+  return (gcc_jit_lvalue *)ctxt->new_global (loc, kind, type, name);
 }
 
 /* Public entrypoint.  See description in libgccjit.h.
@@ -2213,6 +2220,25 @@ gcc_jit_result_get_code (gcc_jit_result *result,
   return code;
 }
 
+/* Public entrypoint.  See description in libgccjit.h.
+
+   After error-checking, the real work is done by the
+   gcc::jit::result::get_global method in jit-result.c.  */
+
+void *
+gcc_jit_result_get_global (gcc_jit_result *result,
+                          const char *name)
+{
+  RETURN_NULL_IF_FAIL (result, NULL, NULL, "NULL result");
+  JIT_LOG_FUNC (result->get_logger ());
+  RETURN_NULL_IF_FAIL (name, NULL, NULL, "NULL name");
+
+  void *global = result->get_global (name);
+  result->log ("%s: returning (void *)%p", __func__, global);
+
+  return global;
+}
+
 /* Public entrypoint.  See description in libgccjit.h.
 
    After error-checking, this is essentially a wrapper around the
index 92eed37fb521ecb93a1cc355305f291a276b70a4..41c76eacdecba70558e41915430f8b0f4ea7aeca 100644 (file)
@@ -299,6 +299,13 @@ extern void *
 gcc_jit_result_get_code (gcc_jit_result *result,
                         const char *funcname);
 
+/* Locate a given global within the built machine code.
+   It must have been created using GCC_JIT_GLOBAL_EXPORTED.
+   This is a ptr to the global, so e.g. for an int this is an int *.  */
+extern void *
+gcc_jit_result_get_global (gcc_jit_result *result,
+                          const char *name);
+
 /* 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.  */
@@ -606,10 +613,26 @@ gcc_jit_block_get_function (gcc_jit_block *block);
 /**********************************************************************
  lvalues, rvalues and expressions.
  **********************************************************************/
+enum gcc_jit_global_kind
+{
+  /* Global is defined by the client code and visible
+     by name outside of this JIT context via gcc_jit_result_get_global.  */
+  GCC_JIT_GLOBAL_EXPORTED,
+
+  /* Global is defined by the client code, but is invisible
+     outside of this JIT context.  Analogous to a "static" global.  */
+  GCC_JIT_GLOBAL_INTERNAL,
+
+  /* Global is not defined by the client code; we're merely
+     referring to it.  Analogous to using an "extern" global from a
+     header file.  */
+  GCC_JIT_GLOBAL_IMPORTED
+};
 
 extern gcc_jit_lvalue *
 gcc_jit_context_new_global (gcc_jit_context *ctxt,
                            gcc_jit_location *loc,
+                           enum gcc_jit_global_kind kind,
                            gcc_jit_type *type,
                            const char *name);
 
index bc6eb1afaa6eebc4ceafce1c959121079facd179..3ab88fda4b5adcf9fd722a093adebd76b961e4ab 100644 (file)
@@ -87,6 +87,7 @@
     gcc_jit_param_as_object;
     gcc_jit_param_as_rvalue;
     gcc_jit_result_get_code;
+    gcc_jit_result_get_global;
     gcc_jit_result_release;
     gcc_jit_rvalue_access_field;
     gcc_jit_rvalue_as_object;
index c8d9235799dded0d3a35774be4d2bfe8f1cf5d94..3c267d8c8c82bfa334bf296999367bd1b2c50b5c 100644 (file)
@@ -1,3 +1,17 @@
+2015-01-12  David Malcolm  <dmalcolm@redhat.com>
+
+       * jit.dg/test-array-as-pointer.c (create_code): Update call
+       to gcc_jit_context_new_global by setting "kind" to
+       GCC_JIT_GLOBAL_IMPORTED.
+       * jit.dg/test-error-array-as-pointer.c: Likewise.
+       * jit.dg/test-expressions.c (make_test_of_get_address): Likewise.
+       * jit.dg/test-fuzzer.c (make_random_global): Likewise, but
+       setting kind to GCC_JIT_GLOBAL_EXPORTED.
+       * jit.dg/test-using-global.c (the_global): Rename to...
+       (imported_global): ...this.
+       (create_code): Update to test the three kinds of global.
+       (verify_code): Likewise.
+
 2015-01-12  Marc Glisse  <marc.glisse@inria.fr>
 
        PR testsuite/64427
index 1a240ac552cfa715b41d40ef6964aa8bf88ad8e8..6b1f9adfcef8ae80edfe3543de9511bd8617f191 100644 (file)
@@ -62,7 +62,8 @@ create_code (gcc_jit_context *ctxt, void *user_data)
                                  0);
 
   gcc_jit_lvalue *buffer =
-    gcc_jit_context_new_global (ctxt, NULL, buf_type, "test_buffer");
+    gcc_jit_context_new_global (ctxt, NULL, GCC_JIT_GLOBAL_IMPORTED,
+                               buf_type, "test_buffer");
 
   gcc_jit_block *block = gcc_jit_function_new_block(test_fn, "entry");
 
index cd2b7f8c57cc5984b65df52e6576646ce402ffc6..d2c07b34e911841e695c44402a6419fb0b1e5ab3 100644 (file)
@@ -62,7 +62,10 @@ create_code (gcc_jit_context *ctxt, void *user_data)
                                  0);
 
   gcc_jit_lvalue *buffer =
-    gcc_jit_context_new_global (ctxt, NULL, buf_type, "test_buffer");
+    gcc_jit_context_new_global (ctxt, NULL,
+                               GCC_JIT_GLOBAL_IMPORTED,
+                               buf_type,
+                               "test_buffer");
 
   gcc_jit_block *block = gcc_jit_function_new_block(test_fn, "entry");
 
index 7e33b56b772e2f7f43aeaf17b4155114f48922f8..548cfa2f195b61c11bb6eb8875cb693b09ee00a4 100644 (file)
@@ -884,6 +884,7 @@ make_test_of_get_address (gcc_jit_context *ctxt)
     gcc_jit_context_new_global (
       ctxt,
       NULL,
+      GCC_JIT_GLOBAL_IMPORTED,
       int_type,
       "test_global");
 
index b5017923c4a56df47e0b3fa519e445d935b84028..6943d3ed232d6b1d9e7466e8e49deb8a31c9eb1e 100644 (file)
@@ -238,6 +238,7 @@ make_random_global (fuzzer *f)
   sprintf (global_name, "g%i", f->num_globals);
   return gcc_jit_context_new_global (f->ctxt,
                                     get_random_location (f),
+                                    GCC_JIT_GLOBAL_EXPORTED,
                                     get_random_type (f),
                                     global_name);
 }
index 3ec949f76a38bd8687d02211b58aae693a3c35f7..8ac9780d2b130d95206b4dc6fdb9caec4563860e 100644 (file)
@@ -9,7 +9,7 @@
 extern "C" {
 #endif
 
-  extern int the_global;
+  extern int imported_global;
 
 #ifdef __cplusplus
 }
@@ -19,24 +19,47 @@ void
 create_code (gcc_jit_context *ctxt, void *user_data)
 {
   /* Let's try to inject the equivalent of:
-     extern int the_global;
 
-     void
+     int exported_global;
+     extern int imported_global;
+     static int internal_global;
+
+     int
      test_using_global (void)
      {
-       the_global += 1;
+       exported_global += 1;
+       imported_global += 1;
+       internal_global += 1;
+       return internal_global;
      }
   */
-  gcc_jit_type *void_type =
-    gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_VOID);
   gcc_jit_type *int_type =
     gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT);
 
+  gcc_jit_lvalue *exported_global =
+    gcc_jit_context_new_global (ctxt,
+                               NULL,
+                               GCC_JIT_GLOBAL_EXPORTED,
+                               int_type,
+                               "exported_global");
+  gcc_jit_lvalue *imported_global =
+    gcc_jit_context_new_global (ctxt,
+                               NULL,
+                               GCC_JIT_GLOBAL_IMPORTED,
+                               int_type,
+                               "imported_global");
+  gcc_jit_lvalue *internal_global =
+    gcc_jit_context_new_global (ctxt,
+                               NULL,
+                               GCC_JIT_GLOBAL_INTERNAL,
+                               int_type,
+                               "internal_global");
+
   /* Build the test_fn.  */
   gcc_jit_function *test_fn =
     gcc_jit_context_new_function (ctxt, NULL,
                                  GCC_JIT_FUNCTION_EXPORTED,
-                                 void_type,
+                                 int_type,
                                  "test_using_global",
                                  0, NULL,
                                  0);
@@ -44,30 +67,64 @@ create_code (gcc_jit_context *ctxt, void *user_data)
 
   gcc_jit_block_add_assignment_op (
     block, NULL,
-    gcc_jit_context_new_global (ctxt, NULL, int_type, "the_global"),
+    exported_global,
+    GCC_JIT_BINARY_OP_PLUS,
+    gcc_jit_context_one (ctxt, int_type));
+  gcc_jit_block_add_assignment_op (
+    block, NULL,
+    imported_global,
+    GCC_JIT_BINARY_OP_PLUS,
+    gcc_jit_context_one (ctxt, int_type));
+  gcc_jit_block_add_assignment_op (
+    block, NULL,
+    internal_global,
     GCC_JIT_BINARY_OP_PLUS,
     gcc_jit_context_one (ctxt, int_type));
-  gcc_jit_block_end_with_void_return (block, NULL);
+  gcc_jit_block_end_with_return (block,
+                                NULL,
+                                gcc_jit_lvalue_as_rvalue (internal_global));
 }
 
-int the_global;
+int imported_global;
 
 void
 verify_code (gcc_jit_context *ctxt, gcc_jit_result *result)
 {
-  typedef void (*fn_type) (void);
+  typedef int (*fn_type) (void);
   CHECK_NON_NULL (result);
 
   fn_type test_using_global =
     (fn_type)gcc_jit_result_get_code (result, "test_using_global");
   CHECK_NON_NULL (test_using_global);
 
-  the_global = 42;
+  /* The exported global should be visible.  */
+  int *exported_global = (int *)gcc_jit_result_get_global (result, "exported_global");
+  CHECK_NON_NULL (exported_global);
+  /* ...and should be zero-initialized.  */
+  CHECK_VALUE (*exported_global, 0);
+
+  /* Set some nonzero values.  */
+  *exported_global = 11;
+  imported_global = 42;
+
+  /* The internal global shouldn't be visible.  */
+  int *internal_global = (int *)gcc_jit_result_get_global (result, "internal_global");
+  CHECK_VALUE (internal_global, NULL);
 
   /* Call the JIT-generated function.  */
-  test_using_global ();
+  int call_count = test_using_global ();
+
+  /* Verify that it correctly modified imported_global and exported_global.  */
+  CHECK_VALUE (*exported_global, 12);
+  CHECK_VALUE (imported_global, 43);
+  CHECK_VALUE (call_count, 1);
+
+  /* Try calling it again.  */
+  call_count = test_using_global ();
 
-  /* Verify that it correctly modified the_global.  */
-  CHECK_VALUE (the_global, 43);
+  /* Verify the new values.  */
+  CHECK_VALUE (*exported_global, 13);
+  CHECK_VALUE (imported_global, 44);
+  CHECK_VALUE (call_count, 2);
 }