From e807aeaae32697a203928a7900426d011c98dedc Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Wed, 1 Jul 2015 12:41:18 +0000 Subject: [PATCH] jit: document union types gcc/jit/ChangeLog: * docs/topics/types.rst (gcc_jit_context_new_union_type): Add documentation. * docs/_build/texinfo/libgccjit.texi: Regenerate. gcc/testsuite/ChangeLog: * jit.dg/test-accessing-union.c: Add comments for use by gcc/jit/docs/topics/types.rst. From-SVN: r225246 --- gcc/jit/ChangeLog | 6 + gcc/jit/docs/_build/texinfo/libgccjit.texi | 881 +++++++++++--------- gcc/jit/docs/topics/types.rst | 19 + gcc/testsuite/ChangeLog | 5 + gcc/testsuite/jit.dg/test-accessing-union.c | 4 + 5 files changed, 520 insertions(+), 395 deletions(-) diff --git a/gcc/jit/ChangeLog b/gcc/jit/ChangeLog index 469d1bc2dab..8a893707f06 100644 --- a/gcc/jit/ChangeLog +++ b/gcc/jit/ChangeLog @@ -1,3 +1,9 @@ +2015-07-01 David Malcolm + + * docs/topics/types.rst (gcc_jit_context_new_union_type): Add + documentation. + * docs/_build/texinfo/libgccjit.texi: Regenerate. + 2015-07-01 David Malcolm * docs/topics/contexts.rst (gcc_jit_context_set_bool_option): diff --git a/gcc/jit/docs/_build/texinfo/libgccjit.texi b/gcc/jit/docs/_build/texinfo/libgccjit.texi index f6ab632688d..bcb8066218a 100644 --- a/gcc/jit/docs/_build/texinfo/libgccjit.texi +++ b/gcc/jit/docs/_build/texinfo/libgccjit.texi @@ -6138,6 +6138,97 @@ Populate the fields of a formerly-opaque struct type. This can only be called once on a given struct type. @end deffn +@geindex gcc_jit_context_new_union_type (C function) +@anchor{topics/types gcc_jit_context_new_union_type}@anchor{87} +@deffn {C Function} gcc_jit_type * gcc_jit_context_new_union_type (gcc_jit_context@w{ }*ctxt, gcc_jit_location@w{ }*loc, const char@w{ }*name, int@w{ }num_fields, gcc_jit_field@w{ }**fields) + +Construct a new union type, with the given name and fields. + +The parameter @code{name} must be non-NULL. It is copied, so the input +buffer does not need to outlive the call. + +Example of use: + +@example + +union int_or_float +@{ + int as_int; + float as_float; +@}; + +void +create_code (gcc_jit_context *ctxt, void *user_data) +@{ + /* Let's try to inject the equivalent of: + float + test_union (int i) + @{ + union int_or_float u; + u.as_int = i; + return u.as_float; + @} + */ + gcc_jit_type *int_type = + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT); + gcc_jit_type *float_type = + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_FLOAT); + gcc_jit_field *as_int = + gcc_jit_context_new_field (ctxt, + NULL, + int_type, + "as_int"); + gcc_jit_field *as_float = + gcc_jit_context_new_field (ctxt, + NULL, + float_type, + "as_float"); + gcc_jit_field *fields[] = @{as_int, as_float@}; + gcc_jit_type *union_type = + gcc_jit_context_new_union_type (ctxt, NULL, + "int_or_float", 2, fields); + + /* Build the test function. */ + gcc_jit_param *param_i = + gcc_jit_context_new_param (ctxt, NULL, int_type, "i"); + gcc_jit_function *test_fn = + gcc_jit_context_new_function (ctxt, NULL, + GCC_JIT_FUNCTION_EXPORTED, + float_type, + "test_union", + 1, ¶m_i, + 0); + + gcc_jit_lvalue *u = + gcc_jit_function_new_local (test_fn, NULL, + union_type, "u"); + + gcc_jit_block *block = gcc_jit_function_new_block (test_fn, NULL); + + /* u.as_int = i; */ + gcc_jit_block_add_assignment ( + block, + NULL, + /* "u.as_int = ..." */ + gcc_jit_lvalue_access_field (u, + NULL, + as_int), + gcc_jit_param_as_rvalue (param_i)); + + /* return u.as_float; */ + gcc_jit_block_end_with_return ( + block, NULL, + gcc_jit_rvalue_access_field (gcc_jit_lvalue_as_rvalue (u), + NULL, + as_float)); +@} + + +@end example + +@noindent +@end deffn + @c Copyright (C) 2014-2015 Free Software Foundation, Inc. @c Originally contributed by David Malcolm @c @@ -6156,7 +6247,7 @@ This can only be called once on a given struct type. @c . @node Expressions,Creating and using functions,Types,Topic Reference -@anchor{topics/expressions expressions}@anchor{87}@anchor{topics/expressions doc}@anchor{88} +@anchor{topics/expressions expressions}@anchor{88}@anchor{topics/expressions doc}@anchor{89} @section Expressions @@ -6182,7 +6273,7 @@ Lvalues @node Rvalues,Lvalues,,Expressions -@anchor{topics/expressions rvalues}@anchor{89} +@anchor{topics/expressions rvalues}@anchor{8a} @subsection Rvalues @@ -6236,7 +6327,7 @@ Every rvalue has an associated type, and the API will check to ensure that types match up correctly (otherwise the context will emit an error). @geindex gcc_jit_rvalue_get_type (C function) -@anchor{topics/expressions gcc_jit_rvalue_get_type}@anchor{8a} +@anchor{topics/expressions gcc_jit_rvalue_get_type}@anchor{8b} @deffn {C Function} gcc_jit_type *gcc_jit_rvalue_get_type (gcc_jit_rvalue@w{ }*rvalue) Get the type of this rvalue. @@ -6260,7 +6351,7 @@ Upcast the given rvalue to be an object. @end menu @node Simple expressions,Unary Operations,,Rvalues -@anchor{topics/expressions simple-expressions}@anchor{8b} +@anchor{topics/expressions simple-expressions}@anchor{8c} @subsubsection Simple expressions @@ -6273,7 +6364,7 @@ the given constant @code{int} value. @end deffn @geindex gcc_jit_context_new_rvalue_from_long (C function) -@anchor{topics/expressions gcc_jit_context_new_rvalue_from_long}@anchor{8c} +@anchor{topics/expressions gcc_jit_context_new_rvalue_from_long}@anchor{8d} @deffn {C Function} gcc_jit_rvalue * gcc_jit_context_new_rvalue_from_long (gcc_jit_context@w{ }*ctxt, gcc_jit_type@w{ }*numeric_type, long@w{ }value) Given a numeric type (integer or floating point), build an rvalue for @@ -6317,14 +6408,14 @@ the given constant @code{double} value. @end deffn @geindex gcc_jit_context_new_rvalue_from_ptr (C function) -@anchor{topics/expressions gcc_jit_context_new_rvalue_from_ptr}@anchor{8d} +@anchor{topics/expressions gcc_jit_context_new_rvalue_from_ptr}@anchor{8e} @deffn {C Function} gcc_jit_rvalue * gcc_jit_context_new_rvalue_from_ptr (gcc_jit_context@w{ }*ctxt, gcc_jit_type@w{ }*pointer_type, void@w{ }*value) Given a pointer type, build an rvalue for the given address. @end deffn @geindex gcc_jit_context_null (C function) -@anchor{topics/expressions gcc_jit_context_null}@anchor{8e} +@anchor{topics/expressions gcc_jit_context_null}@anchor{8f} @deffn {C Function} gcc_jit_rvalue *gcc_jit_context_null (gcc_jit_context@w{ }*ctxt, gcc_jit_type@w{ }*pointer_type) Given a pointer type, build an rvalue for @code{NULL}. Essentially this @@ -6338,7 +6429,7 @@ gcc_jit_context_new_rvalue_from_ptr (ctxt, pointer_type, NULL) @end deffn @geindex gcc_jit_context_new_string_literal (C function) -@anchor{topics/expressions gcc_jit_context_new_string_literal}@anchor{8f} +@anchor{topics/expressions gcc_jit_context_new_string_literal}@anchor{90} @deffn {C Function} gcc_jit_rvalue * gcc_jit_context_new_string_literal (gcc_jit_context@w{ }*ctxt, const char@w{ }*value) Generate an rvalue for the given NIL-terminated string, of type @@ -6350,19 +6441,19 @@ buffer. @end deffn @node Unary Operations,Binary Operations,Simple expressions,Rvalues -@anchor{topics/expressions unary-operations}@anchor{90} +@anchor{topics/expressions unary-operations}@anchor{91} @subsubsection Unary Operations @geindex gcc_jit_context_new_unary_op (C function) -@anchor{topics/expressions gcc_jit_context_new_unary_op}@anchor{91} +@anchor{topics/expressions gcc_jit_context_new_unary_op}@anchor{92} @deffn {C Function} gcc_jit_rvalue * gcc_jit_context_new_unary_op (gcc_jit_context@w{ }*ctxt, gcc_jit_location@w{ }*loc, enum gcc_jit_unary_op@w{ }op, gcc_jit_type@w{ }*result_type, gcc_jit_rvalue@w{ }*rvalue) Build a unary operation out of an input rvalue. @end deffn @geindex gcc_jit_unary_op (C type) -@anchor{topics/expressions gcc_jit_unary_op}@anchor{92} +@anchor{topics/expressions gcc_jit_unary_op}@anchor{93} @deffn {C Type} enum gcc_jit_unary_op @end deffn @@ -6380,7 +6471,7 @@ C equivalent @item -@pxref{93,,GCC_JIT_UNARY_OP_MINUS} +@pxref{94,,GCC_JIT_UNARY_OP_MINUS} @tab @@ -6388,7 +6479,7 @@ C equivalent @item -@pxref{94,,GCC_JIT_UNARY_OP_BITWISE_NEGATE} +@pxref{95,,GCC_JIT_UNARY_OP_BITWISE_NEGATE} @tab @@ -6396,7 +6487,7 @@ C equivalent @item -@pxref{95,,GCC_JIT_UNARY_OP_LOGICAL_NEGATE} +@pxref{96,,GCC_JIT_UNARY_OP_LOGICAL_NEGATE} @tab @@ -6404,7 +6495,7 @@ C equivalent @item -@pxref{96,,GCC_JIT_UNARY_OP_ABS} +@pxref{97,,GCC_JIT_UNARY_OP_ABS} @tab @@ -6414,7 +6505,7 @@ C equivalent @geindex GCC_JIT_UNARY_OP_MINUS (C macro) -@anchor{topics/expressions GCC_JIT_UNARY_OP_MINUS}@anchor{93} +@anchor{topics/expressions GCC_JIT_UNARY_OP_MINUS}@anchor{94} @deffn {C Macro} GCC_JIT_UNARY_OP_MINUS Negate an arithmetic value; analogous to: @@ -6429,7 +6520,7 @@ in C. @end deffn @geindex GCC_JIT_UNARY_OP_BITWISE_NEGATE (C macro) -@anchor{topics/expressions GCC_JIT_UNARY_OP_BITWISE_NEGATE}@anchor{94} +@anchor{topics/expressions GCC_JIT_UNARY_OP_BITWISE_NEGATE}@anchor{95} @deffn {C Macro} GCC_JIT_UNARY_OP_BITWISE_NEGATE Bitwise negation of an integer value (one's complement); analogous @@ -6445,7 +6536,7 @@ in C. @end deffn @geindex GCC_JIT_UNARY_OP_LOGICAL_NEGATE (C macro) -@anchor{topics/expressions GCC_JIT_UNARY_OP_LOGICAL_NEGATE}@anchor{95} +@anchor{topics/expressions GCC_JIT_UNARY_OP_LOGICAL_NEGATE}@anchor{96} @deffn {C Macro} GCC_JIT_UNARY_OP_LOGICAL_NEGATE Logical negation of an arithmetic or pointer value; analogous to: @@ -6460,7 +6551,7 @@ in C. @end deffn @geindex GCC_JIT_UNARY_OP_ABS (C macro) -@anchor{topics/expressions GCC_JIT_UNARY_OP_ABS}@anchor{96} +@anchor{topics/expressions GCC_JIT_UNARY_OP_ABS}@anchor{97} @deffn {C Macro} GCC_JIT_UNARY_OP_ABS Absolute value of an arithmetic expression; analogous to: @@ -6475,7 +6566,7 @@ in C. @end deffn @node Binary Operations,Comparisons,Unary Operations,Rvalues -@anchor{topics/expressions binary-operations}@anchor{97} +@anchor{topics/expressions binary-operations}@anchor{98} @subsubsection Binary Operations @@ -6487,7 +6578,7 @@ Build a binary operation out of two constituent rvalues. @end deffn @geindex gcc_jit_binary_op (C type) -@anchor{topics/expressions gcc_jit_binary_op}@anchor{98} +@anchor{topics/expressions gcc_jit_binary_op}@anchor{99} @deffn {C Type} enum gcc_jit_binary_op @end deffn @@ -6505,7 +6596,7 @@ C equivalent @item -@pxref{99,,GCC_JIT_BINARY_OP_PLUS} +@pxref{9a,,GCC_JIT_BINARY_OP_PLUS} @tab @@ -6513,7 +6604,7 @@ C equivalent @item -@pxref{9a,,GCC_JIT_BINARY_OP_MINUS} +@pxref{9b,,GCC_JIT_BINARY_OP_MINUS} @tab @@ -6521,7 +6612,7 @@ C equivalent @item -@pxref{9b,,GCC_JIT_BINARY_OP_MULT} +@pxref{9c,,GCC_JIT_BINARY_OP_MULT} @tab @@ -6529,7 +6620,7 @@ C equivalent @item -@pxref{9c,,GCC_JIT_BINARY_OP_DIVIDE} +@pxref{9d,,GCC_JIT_BINARY_OP_DIVIDE} @tab @@ -6537,7 +6628,7 @@ C equivalent @item -@pxref{9d,,GCC_JIT_BINARY_OP_MODULO} +@pxref{9e,,GCC_JIT_BINARY_OP_MODULO} @tab @@ -6545,7 +6636,7 @@ C equivalent @item -@pxref{9e,,GCC_JIT_BINARY_OP_BITWISE_AND} +@pxref{9f,,GCC_JIT_BINARY_OP_BITWISE_AND} @tab @@ -6553,7 +6644,7 @@ C equivalent @item -@pxref{9f,,GCC_JIT_BINARY_OP_BITWISE_XOR} +@pxref{a0,,GCC_JIT_BINARY_OP_BITWISE_XOR} @tab @@ -6561,7 +6652,7 @@ C equivalent @item -@pxref{a0,,GCC_JIT_BINARY_OP_BITWISE_OR} +@pxref{a1,,GCC_JIT_BINARY_OP_BITWISE_OR} @tab @@ -6569,7 +6660,7 @@ C equivalent @item -@pxref{a1,,GCC_JIT_BINARY_OP_LOGICAL_AND} +@pxref{a2,,GCC_JIT_BINARY_OP_LOGICAL_AND} @tab @@ -6577,7 +6668,7 @@ C equivalent @item -@pxref{a2,,GCC_JIT_BINARY_OP_LOGICAL_OR} +@pxref{a3,,GCC_JIT_BINARY_OP_LOGICAL_OR} @tab @@ -6585,7 +6676,7 @@ C equivalent @item -@pxref{a3,,GCC_JIT_BINARY_OP_LSHIFT} +@pxref{a4,,GCC_JIT_BINARY_OP_LSHIFT} @tab @@ -6593,7 +6684,7 @@ C equivalent @item -@pxref{a4,,GCC_JIT_BINARY_OP_RSHIFT} +@pxref{a5,,GCC_JIT_BINARY_OP_RSHIFT} @tab @@ -6603,7 +6694,7 @@ C equivalent @geindex GCC_JIT_BINARY_OP_PLUS (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_PLUS}@anchor{99} +@anchor{topics/expressions GCC_JIT_BINARY_OP_PLUS}@anchor{9a} @deffn {C Macro} GCC_JIT_BINARY_OP_PLUS Addition of arithmetic values; analogous to: @@ -6616,11 +6707,11 @@ Addition of arithmetic values; analogous to: in C. -For pointer addition, use @pxref{a5,,gcc_jit_context_new_array_access()}. +For pointer addition, use @pxref{a6,,gcc_jit_context_new_array_access()}. @end deffn @geindex GCC_JIT_BINARY_OP_MINUS (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_MINUS}@anchor{9a} +@anchor{topics/expressions GCC_JIT_BINARY_OP_MINUS}@anchor{9b} @deffn {C Macro} GCC_JIT_BINARY_OP_MINUS Subtraction of arithmetic values; analogous to: @@ -6635,7 +6726,7 @@ in C. @end deffn @geindex GCC_JIT_BINARY_OP_MULT (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_MULT}@anchor{9b} +@anchor{topics/expressions GCC_JIT_BINARY_OP_MULT}@anchor{9c} @deffn {C Macro} GCC_JIT_BINARY_OP_MULT Multiplication of a pair of arithmetic values; analogous to: @@ -6650,7 +6741,7 @@ in C. @end deffn @geindex GCC_JIT_BINARY_OP_DIVIDE (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_DIVIDE}@anchor{9c} +@anchor{topics/expressions GCC_JIT_BINARY_OP_DIVIDE}@anchor{9d} @deffn {C Macro} GCC_JIT_BINARY_OP_DIVIDE Quotient of division of arithmetic values; analogous to: @@ -6669,7 +6760,7 @@ a floating-point result type indicates floating-point division. @end deffn @geindex GCC_JIT_BINARY_OP_MODULO (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_MODULO}@anchor{9d} +@anchor{topics/expressions GCC_JIT_BINARY_OP_MODULO}@anchor{9e} @deffn {C Macro} GCC_JIT_BINARY_OP_MODULO Remainder of division of arithmetic values; analogous to: @@ -6684,7 +6775,7 @@ in C. @end deffn @geindex GCC_JIT_BINARY_OP_BITWISE_AND (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_BITWISE_AND}@anchor{9e} +@anchor{topics/expressions GCC_JIT_BINARY_OP_BITWISE_AND}@anchor{9f} @deffn {C Macro} GCC_JIT_BINARY_OP_BITWISE_AND Bitwise AND; analogous to: @@ -6699,7 +6790,7 @@ in C. @end deffn @geindex GCC_JIT_BINARY_OP_BITWISE_XOR (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_BITWISE_XOR}@anchor{9f} +@anchor{topics/expressions GCC_JIT_BINARY_OP_BITWISE_XOR}@anchor{a0} @deffn {C Macro} GCC_JIT_BINARY_OP_BITWISE_XOR Bitwise exclusive OR; analogous to: @@ -6714,7 +6805,7 @@ in C. @end deffn @geindex GCC_JIT_BINARY_OP_BITWISE_OR (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_BITWISE_OR}@anchor{a0} +@anchor{topics/expressions GCC_JIT_BINARY_OP_BITWISE_OR}@anchor{a1} @deffn {C Macro} GCC_JIT_BINARY_OP_BITWISE_OR Bitwise inclusive OR; analogous to: @@ -6729,7 +6820,7 @@ in C. @end deffn @geindex GCC_JIT_BINARY_OP_LOGICAL_AND (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_LOGICAL_AND}@anchor{a1} +@anchor{topics/expressions GCC_JIT_BINARY_OP_LOGICAL_AND}@anchor{a2} @deffn {C Macro} GCC_JIT_BINARY_OP_LOGICAL_AND Logical AND; analogous to: @@ -6744,7 +6835,7 @@ in C. @end deffn @geindex GCC_JIT_BINARY_OP_LOGICAL_OR (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_LOGICAL_OR}@anchor{a2} +@anchor{topics/expressions GCC_JIT_BINARY_OP_LOGICAL_OR}@anchor{a3} @deffn {C Macro} GCC_JIT_BINARY_OP_LOGICAL_OR Logical OR; analogous to: @@ -6759,7 +6850,7 @@ in C. @end deffn @geindex GCC_JIT_BINARY_OP_LSHIFT (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_LSHIFT}@anchor{a3} +@anchor{topics/expressions GCC_JIT_BINARY_OP_LSHIFT}@anchor{a4} @deffn {C Macro} GCC_JIT_BINARY_OP_LSHIFT Left shift; analogous to: @@ -6774,7 +6865,7 @@ in C. @end deffn @geindex GCC_JIT_BINARY_OP_RSHIFT (C macro) -@anchor{topics/expressions GCC_JIT_BINARY_OP_RSHIFT}@anchor{a4} +@anchor{topics/expressions GCC_JIT_BINARY_OP_RSHIFT}@anchor{a5} @deffn {C Macro} GCC_JIT_BINARY_OP_RSHIFT Right shift; analogous to: @@ -6789,7 +6880,7 @@ in C. @end deffn @node Comparisons,Function calls,Binary Operations,Rvalues -@anchor{topics/expressions comparisons}@anchor{a6} +@anchor{topics/expressions comparisons}@anchor{a7} @subsubsection Comparisons @@ -6801,7 +6892,7 @@ Build a boolean rvalue out of the comparison of two other rvalues. @end deffn @geindex gcc_jit_comparison (C type) -@anchor{topics/expressions gcc_jit_comparison}@anchor{a7} +@anchor{topics/expressions gcc_jit_comparison}@anchor{a8} @deffn {C Type} enum gcc_jit_comparison @end deffn @@ -6867,12 +6958,12 @@ C equivalent @node Function calls,Type-coercion,Comparisons,Rvalues -@anchor{topics/expressions function-calls}@anchor{a8} +@anchor{topics/expressions function-calls}@anchor{a9} @subsubsection Function calls @geindex gcc_jit_context_new_call (C function) -@anchor{topics/expressions gcc_jit_context_new_call}@anchor{a9} +@anchor{topics/expressions gcc_jit_context_new_call}@anchor{aa} @deffn {C Function} gcc_jit_rvalue * gcc_jit_context_new_call (gcc_jit_context@w{ }*ctxt, gcc_jit_location@w{ }*loc, gcc_jit_function@w{ }*func, int@w{ }numargs, gcc_jit_rvalue@w{ }**args) Given a function and the given table of argument rvalues, construct a @@ -6880,7 +6971,7 @@ call to the function, with the result as an rvalue. @cartouche @quotation Note -@pxref{a9,,gcc_jit_context_new_call()} merely builds a +@pxref{aa,,gcc_jit_context_new_call()} merely builds a @pxref{13,,gcc_jit_rvalue} i.e. an expression that can be evaluated, perhaps as part of a more complicated expression. The call @emph{won't} happen unless you add a statement to a function @@ -6888,7 +6979,7 @@ that evaluates the expression. For example, if you want to call a function and discard the result (or to call a function with @code{void} return type), use -@pxref{aa,,gcc_jit_block_add_eval()}: +@pxref{ab,,gcc_jit_block_add_eval()}: @example /* Add "(void)printf (arg0, arg1);". */ @@ -6907,12 +6998,12 @@ gcc_jit_block_add_eval ( @end deffn @node Type-coercion,,Function calls,Rvalues -@anchor{topics/expressions type-coercion}@anchor{ab} +@anchor{topics/expressions type-coercion}@anchor{ac} @subsubsection Type-coercion @geindex gcc_jit_context_new_cast (C function) -@anchor{topics/expressions gcc_jit_context_new_cast}@anchor{ac} +@anchor{topics/expressions gcc_jit_context_new_cast}@anchor{ad} @deffn {C Function} gcc_jit_rvalue * gcc_jit_context_new_cast (gcc_jit_context@w{ }*ctxt, gcc_jit_location@w{ }*loc, gcc_jit_rvalue@w{ }*rvalue, gcc_jit_type@w{ }*type) Given an rvalue of T, construct another rvalue of another type. @@ -6937,7 +7028,7 @@ P* <-> Q*, for pointer types P and Q @end deffn @node Lvalues,Working with pointers structs and unions,Rvalues,Expressions -@anchor{topics/expressions lvalues}@anchor{ad} +@anchor{topics/expressions lvalues}@anchor{ae} @subsection Lvalues @@ -6951,21 +7042,21 @@ a storage area (such as a variable). It is also usable as an rvalue, where the rvalue is computed by reading from the storage area. @geindex gcc_jit_lvalue_as_object (C function) -@anchor{topics/expressions gcc_jit_lvalue_as_object}@anchor{ae} +@anchor{topics/expressions gcc_jit_lvalue_as_object}@anchor{af} @deffn {C Function} gcc_jit_object * gcc_jit_lvalue_as_object (gcc_jit_lvalue@w{ }*lvalue) Upcast an lvalue to be an object. @end deffn @geindex gcc_jit_lvalue_as_rvalue (C function) -@anchor{topics/expressions gcc_jit_lvalue_as_rvalue}@anchor{af} +@anchor{topics/expressions gcc_jit_lvalue_as_rvalue}@anchor{b0} @deffn {C Function} gcc_jit_rvalue * gcc_jit_lvalue_as_rvalue (gcc_jit_lvalue@w{ }*lvalue) Upcast an lvalue to be an rvalue. @end deffn @geindex gcc_jit_lvalue_get_address (C function) -@anchor{topics/expressions gcc_jit_lvalue_get_address}@anchor{b0} +@anchor{topics/expressions gcc_jit_lvalue_get_address}@anchor{b1} @deffn {C Function} gcc_jit_rvalue * gcc_jit_lvalue_get_address (gcc_jit_lvalue@w{ }*lvalue, gcc_jit_location@w{ }*loc) Take the address of an lvalue; analogous to: @@ -6985,12 +7076,12 @@ in C. @end menu @node Global variables,,,Lvalues -@anchor{topics/expressions global-variables}@anchor{b1} +@anchor{topics/expressions global-variables}@anchor{b2} @subsubsection Global variables @geindex gcc_jit_context_new_global (C function) -@anchor{topics/expressions gcc_jit_context_new_global}@anchor{b2} +@anchor{topics/expressions gcc_jit_context_new_global}@anchor{b3} @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. @@ -7003,22 +7094,22 @@ The "kind" parameter determines the visibility of the "global" outside of the @pxref{16,,gcc_jit_result}: @geindex gcc_jit_global_kind (C type) -@anchor{topics/expressions gcc_jit_global_kind}@anchor{b3} +@anchor{topics/expressions gcc_jit_global_kind}@anchor{b4} @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{b4} +@anchor{topics/expressions GCC_JIT_GLOBAL_EXPORTED}@anchor{b5} @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{b5,,gcc_jit_result_get_global()} (and this value is required for +@pxref{b6,,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{b6} +@anchor{topics/expressions GCC_JIT_GLOBAL_INTERNAL}@anchor{b7} @deffn {C Macro} GCC_JIT_GLOBAL_INTERNAL Global is defined by the client code, but is invisible @@ -7028,7 +7119,7 @@ context and within child contexts. @end deffn @geindex GCC_JIT_GLOBAL_IMPORTED (C macro) -@anchor{topics/expressions GCC_JIT_GLOBAL_IMPORTED}@anchor{b7} +@anchor{topics/expressions GCC_JIT_GLOBAL_IMPORTED}@anchor{b8} @deffn {C Macro} GCC_JIT_GLOBAL_IMPORTED Global is not defined by the client code; we're merely @@ -7038,12 +7129,12 @@ header file. @end deffn @node Working with pointers structs and unions,,Lvalues,Expressions -@anchor{topics/expressions working-with-pointers-structs-and-unions}@anchor{b8} +@anchor{topics/expressions working-with-pointers-structs-and-unions}@anchor{b9} @subsection Working with pointers, structs and unions @geindex gcc_jit_rvalue_dereference (C function) -@anchor{topics/expressions gcc_jit_rvalue_dereference}@anchor{b9} +@anchor{topics/expressions gcc_jit_rvalue_dereference}@anchor{ba} @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, @@ -7061,7 +7152,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{ba} +@anchor{topics/expressions gcc_jit_lvalue_access_field}@anchor{bb} @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, @@ -7077,7 +7168,7 @@ in C. @end deffn @geindex gcc_jit_rvalue_access_field (C function) -@anchor{topics/expressions gcc_jit_rvalue_access_field}@anchor{bb} +@anchor{topics/expressions gcc_jit_rvalue_access_field}@anchor{bc} @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 @@ -7093,7 +7184,7 @@ in C. @end deffn @geindex gcc_jit_rvalue_dereference_field (C function) -@anchor{topics/expressions gcc_jit_rvalue_dereference_field}@anchor{bc} +@anchor{topics/expressions gcc_jit_rvalue_dereference_field}@anchor{bd} @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 @@ -7109,7 +7200,7 @@ in C, itself equivalent to @code{(*EXPR).FIELD}. @end deffn @geindex gcc_jit_context_new_array_access (C function) -@anchor{topics/expressions gcc_jit_context_new_array_access}@anchor{a5} +@anchor{topics/expressions gcc_jit_context_new_array_access}@anchor{a6} @deffn {C Function} gcc_jit_lvalue * gcc_jit_context_new_array_access (gcc_jit_context@w{ }*ctxt, gcc_jit_location@w{ }*loc, gcc_jit_rvalue@w{ }*ptr, gcc_jit_rvalue@w{ }*index) Given an rvalue of pointer type @code{T *}, get at the element @cite{T} at @@ -7144,7 +7235,7 @@ in C (or, indeed, to @code{PTR + INDEX}). @c . @node Creating and using functions,Source Locations,Expressions,Topic Reference -@anchor{topics/functions doc}@anchor{bd}@anchor{topics/functions creating-and-using-functions}@anchor{be} +@anchor{topics/functions doc}@anchor{be}@anchor{topics/functions creating-and-using-functions}@anchor{bf} @section Creating and using functions @@ -7157,7 +7248,7 @@ in C (or, indeed, to @code{PTR + INDEX}). @end menu @node Params,Functions,,Creating and using functions -@anchor{topics/functions params}@anchor{bf} +@anchor{topics/functions params}@anchor{c0} @subsection Params @@ -7184,28 +7275,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{c0} +@anchor{topics/functions gcc_jit_param_as_lvalue}@anchor{c1} @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{c1} +@anchor{topics/functions gcc_jit_param_as_rvalue}@anchor{c2} @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{c2} +@anchor{topics/functions gcc_jit_param_as_object}@anchor{c3} @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{c3} +@anchor{topics/functions functions}@anchor{c4} @subsection Functions @@ -7224,7 +7315,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{c4} +@anchor{topics/functions gcc_jit_function_kind}@anchor{c5} @deffn {C Type} enum gcc_jit_function_kind @end deffn @@ -7234,7 +7325,7 @@ values: @quotation @geindex GCC_JIT_FUNCTION_EXPORTED (C macro) -@anchor{topics/functions GCC_JIT_FUNCTION_EXPORTED}@anchor{c5} +@anchor{topics/functions GCC_JIT_FUNCTION_EXPORTED}@anchor{c6} @deffn {C Macro} GCC_JIT_FUNCTION_EXPORTED Function is defined by the client code and visible @@ -7246,7 +7337,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{c6} +@anchor{topics/functions GCC_JIT_FUNCTION_INTERNAL}@anchor{c7} @deffn {C Macro} GCC_JIT_FUNCTION_INTERNAL Function is defined by the client code, but is invisible @@ -7254,7 +7345,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{c7} +@anchor{topics/functions GCC_JIT_FUNCTION_IMPORTED}@anchor{c8} @deffn {C Macro} GCC_JIT_FUNCTION_IMPORTED Function is not defined by the client code; we're merely @@ -7263,7 +7354,7 @@ header file. @end deffn @geindex GCC_JIT_FUNCTION_ALWAYS_INLINE (C macro) -@anchor{topics/functions GCC_JIT_FUNCTION_ALWAYS_INLINE}@anchor{c8} +@anchor{topics/functions GCC_JIT_FUNCTION_ALWAYS_INLINE}@anchor{c9} @deffn {C Macro} GCC_JIT_FUNCTION_ALWAYS_INLINE Function is only ever inlined into other functions, and is @@ -7284,19 +7375,19 @@ buffer. @end deffn @geindex gcc_jit_context_get_builtin_function (C function) -@anchor{topics/functions gcc_jit_context_get_builtin_function}@anchor{c9} +@anchor{topics/functions gcc_jit_context_get_builtin_function}@anchor{ca} @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{ca} +@anchor{topics/functions gcc_jit_function_as_object}@anchor{cb} @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{cb} +@anchor{topics/functions gcc_jit_function_get_param}@anchor{cc} @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). @@ -7322,7 +7413,7 @@ buffer. @end deffn @node Blocks,Statements,Functions,Creating and using functions -@anchor{topics/functions blocks}@anchor{cc} +@anchor{topics/functions blocks}@anchor{cd} @subsection Blocks @@ -7346,7 +7437,7 @@ one function. @end deffn @geindex gcc_jit_function_new_block (C function) -@anchor{topics/functions gcc_jit_function_new_block}@anchor{cd} +@anchor{topics/functions gcc_jit_function_new_block}@anchor{ce} @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 @@ -7368,26 +7459,26 @@ for (pc = 0; pc < fn->fn_num_ops; pc++) @end deffn @geindex gcc_jit_block_as_object (C function) -@anchor{topics/functions gcc_jit_block_as_object}@anchor{ce} +@anchor{topics/functions gcc_jit_block_as_object}@anchor{cf} @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{cf} +@anchor{topics/functions gcc_jit_block_get_function}@anchor{d0} @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{d0} +@anchor{topics/functions statements}@anchor{d1} @subsection Statements @geindex gcc_jit_block_add_eval (C function) -@anchor{topics/functions gcc_jit_block_add_eval}@anchor{aa} +@anchor{topics/functions gcc_jit_block_add_eval}@anchor{ab} @deffn {C Function} void gcc_jit_block_add_eval (gcc_jit_block@w{ }*block, gcc_jit_location@w{ }*loc, gcc_jit_rvalue@w{ }*rvalue) Add evaluation of an rvalue, discarding the result @@ -7496,7 +7587,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{d1} +@anchor{topics/functions gcc_jit_block_end_with_jump}@anchor{d2} @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. @@ -7511,7 +7602,7 @@ goto target; @end deffn @geindex gcc_jit_block_end_with_return (C function) -@anchor{topics/functions gcc_jit_block_end_with_return}@anchor{d2} +@anchor{topics/functions gcc_jit_block_end_with_return}@anchor{d3} @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. @@ -7526,7 +7617,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{d3} +@anchor{topics/functions gcc_jit_block_end_with_void_return}@anchor{d4} @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 @@ -7542,7 +7633,7 @@ return; @end deffn @geindex gcc_jit_block_end_with_switch (C function) -@anchor{topics/functions gcc_jit_block_end_with_switch}@anchor{d4} +@anchor{topics/functions gcc_jit_block_end_with_switch}@anchor{d5} @deffn {C Function} void gcc_jit_block_end_with_switch (gcc_jit_block@w{ }*block, gcc_jit_location@w{ }*loc, gcc_jit_rvalue@w{ }*expr, gcc_jit_block@w{ }*default_block, int@w{ }num_cases, gcc_jit_case@w{ }**cases) Terminate a block by adding evalation of an rvalue, then performing @@ -7590,17 +7681,17 @@ The API entrypoints relating to switch statements and cases: @itemize * @item -@pxref{d4,,gcc_jit_block_end_with_switch()} +@pxref{d5,,gcc_jit_block_end_with_switch()} @item -@pxref{d5,,gcc_jit_case_as_object()} +@pxref{d6,,gcc_jit_case_as_object()} @item -@pxref{d6,,gcc_jit_context_new_case()} +@pxref{d7,,gcc_jit_context_new_case()} @end itemize @end quotation -were added in @pxref{d7,,LIBGCCJIT_ABI_3}; you can test for their presence +were added in @pxref{d8,,LIBGCCJIT_ABI_3}; you can test for their presence using @example @@ -7610,20 +7701,20 @@ using @noindent @geindex gcc_jit_case (C type) -@anchor{topics/functions gcc_jit_case}@anchor{d8} +@anchor{topics/functions gcc_jit_case}@anchor{d9} @deffn {C Type} gcc_jit_case @end deffn A @cite{gcc_jit_case} represents a case within a switch statement, and is created within a particular @pxref{8,,gcc_jit_context} using -@pxref{d6,,gcc_jit_context_new_case()}. +@pxref{d7,,gcc_jit_context_new_case()}. Each case expresses a multivalued range of integer values. You can express single-valued cases by passing in the same value for both @cite{min_value} and @cite{max_value}. @geindex gcc_jit_context_new_case (C function) -@anchor{topics/functions gcc_jit_context_new_case}@anchor{d6} +@anchor{topics/functions gcc_jit_context_new_case}@anchor{d7} @deffn {C Function} gcc_jit_case * gcc_jit_context_new_case (gcc_jit_context@w{ }*ctxt, gcc_jit_rvalue@w{ }*min_value, gcc_jit_rvalue@w{ }*max_value, gcc_jit_block@w{ }*dest_block) Create a new gcc_jit_case instance for use in a switch statement. @@ -7635,7 +7726,7 @@ statement. @end deffn @geindex gcc_jit_case_as_object (C function) -@anchor{topics/functions gcc_jit_case_as_object}@anchor{d5} +@anchor{topics/functions gcc_jit_case_as_object}@anchor{d6} @deffn {C Function} gcc_jit_object * gcc_jit_case_as_object (gcc_jit_case@w{ }*case_) Upcast from a case to an object. @@ -7770,7 +7861,7 @@ create_code (gcc_jit_context *ctxt, void *user_data) @c . @node Source Locations,Compiling a context,Creating and using functions,Topic Reference -@anchor{topics/locations source-locations}@anchor{d9}@anchor{topics/locations doc}@anchor{da} +@anchor{topics/locations source-locations}@anchor{da}@anchor{topics/locations doc}@anchor{db} @section Source Locations @@ -7820,7 +7911,7 @@ on-stack buffer. @end menu @node Faking it,,,Source Locations -@anchor{topics/locations faking-it}@anchor{db} +@anchor{topics/locations faking-it}@anchor{dc} @subsection Faking it @@ -7858,7 +7949,7 @@ file, giving you @emph{something} you can step through in the debugger. @c . @node Compiling a context,ABI and API compatibility,Source Locations,Topic Reference -@anchor{topics/compilation compiling-a-context}@anchor{dc}@anchor{topics/compilation doc}@anchor{dd} +@anchor{topics/compilation compiling-a-context}@anchor{dd}@anchor{topics/compilation doc}@anchor{de} @section Compiling a context @@ -7877,7 +7968,7 @@ prevent any future compilation of that context. @end menu @node In-memory compilation,Ahead-of-time compilation,,Compiling a context -@anchor{topics/compilation in-memory-compilation}@anchor{de} +@anchor{topics/compilation in-memory-compilation}@anchor{df} @subsection In-memory compilation @@ -7912,7 +8003,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{c5,,GCC_JIT_FUNCTION_EXPORTED}: +@pxref{c6,,GCC_JIT_FUNCTION_EXPORTED}: @example gcc_jit_context_new_function (ctxt, @@ -7942,7 +8033,7 @@ to a segmentation fault. @end deffn @geindex gcc_jit_result_get_global (C function) -@anchor{topics/compilation gcc_jit_result_get_global}@anchor{b5} +@anchor{topics/compilation gcc_jit_result_get_global}@anchor{b6} @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. @@ -7950,8 +8041,8 @@ Locate a given global within the built machine code. Globals are looked up by name. For this to succeed, a global with a name matching @cite{name} must have been created on @cite{result}'s context (or a parent context) via a call to -@pxref{b2,,gcc_jit_context_new_global()} with @cite{kind} -@pxref{b4,,GCC_JIT_GLOBAL_EXPORTED}. +@pxref{b3,,gcc_jit_context_new_global()} with @cite{kind} +@pxref{b5,,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. @@ -7999,11 +8090,11 @@ Once we're done with the code, this unloads the built .so file. This cleans up the result; after calling this, it's no longer valid to use the result, or any code or globals that were obtained by calling @pxref{17,,gcc_jit_result_get_code()} or -@pxref{b5,,gcc_jit_result_get_global()} on it. +@pxref{b6,,gcc_jit_result_get_global()} on it. @end deffn @node Ahead-of-time compilation,,In-memory compilation,Compiling a context -@anchor{topics/compilation ahead-of-time-compilation}@anchor{df} +@anchor{topics/compilation ahead-of-time-compilation}@anchor{e0} @subsection Ahead-of-time compilation @@ -8032,7 +8123,7 @@ suffix of the output file when determining what to do. @end cartouche @geindex gcc_jit_output_kind (C type) -@anchor{topics/compilation gcc_jit_output_kind}@anchor{e0} +@anchor{topics/compilation gcc_jit_output_kind}@anchor{e1} @deffn {C Type} enum gcc_jit_output_kind @end deffn @@ -8050,7 +8141,7 @@ Typical suffix @item -@pxref{e1,,GCC_JIT_OUTPUT_KIND_ASSEMBLER} +@pxref{e2,,GCC_JIT_OUTPUT_KIND_ASSEMBLER} @tab @@ -8058,7 +8149,7 @@ Typical suffix @item -@pxref{e2,,GCC_JIT_OUTPUT_KIND_OBJECT_FILE} +@pxref{e3,,GCC_JIT_OUTPUT_KIND_OBJECT_FILE} @tab @@ -8066,7 +8157,7 @@ Typical suffix @item -@pxref{e3,,GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY} +@pxref{e4,,GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY} @tab @@ -8074,7 +8165,7 @@ Typical suffix @item -@pxref{e4,,GCC_JIT_OUTPUT_KIND_EXECUTABLE} +@pxref{e5,,GCC_JIT_OUTPUT_KIND_EXECUTABLE} @tab @@ -8084,21 +8175,21 @@ None, or .exe @geindex GCC_JIT_OUTPUT_KIND_ASSEMBLER (C macro) -@anchor{topics/compilation GCC_JIT_OUTPUT_KIND_ASSEMBLER}@anchor{e1} +@anchor{topics/compilation GCC_JIT_OUTPUT_KIND_ASSEMBLER}@anchor{e2} @deffn {C Macro} GCC_JIT_OUTPUT_KIND_ASSEMBLER Compile the context to an assembler file. @end deffn @geindex GCC_JIT_OUTPUT_KIND_OBJECT_FILE (C macro) -@anchor{topics/compilation GCC_JIT_OUTPUT_KIND_OBJECT_FILE}@anchor{e2} +@anchor{topics/compilation GCC_JIT_OUTPUT_KIND_OBJECT_FILE}@anchor{e3} @deffn {C Macro} GCC_JIT_OUTPUT_KIND_OBJECT_FILE Compile the context to an object file. @end deffn @geindex GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY (C macro) -@anchor{topics/compilation GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY}@anchor{e3} +@anchor{topics/compilation GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY}@anchor{e4} @deffn {C Macro} GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY Compile the context to a dynamic library. @@ -8108,7 +8199,7 @@ against. @end deffn @geindex GCC_JIT_OUTPUT_KIND_EXECUTABLE (C macro) -@anchor{topics/compilation GCC_JIT_OUTPUT_KIND_EXECUTABLE}@anchor{e4} +@anchor{topics/compilation GCC_JIT_OUTPUT_KIND_EXECUTABLE}@anchor{e5} @deffn {C Macro} GCC_JIT_OUTPUT_KIND_EXECUTABLE Compile the context to an executable. @@ -8135,7 +8226,7 @@ against. @c . @node ABI and API compatibility,,Compiling a context,Topic Reference -@anchor{topics/compatibility abi-and-api-compatibility}@anchor{e5}@anchor{topics/compatibility doc}@anchor{e6} +@anchor{topics/compatibility abi-and-api-compatibility}@anchor{e6}@anchor{topics/compatibility doc}@anchor{e7} @section ABI and API compatibility @@ -8202,7 +8293,7 @@ ABI symbol tags @node ABI symbol tags,,,ABI and API compatibility -@anchor{topics/compatibility abi-symbol-tags}@anchor{e7} +@anchor{topics/compatibility abi-symbol-tags}@anchor{e8} @subsection ABI symbol tags @@ -8219,7 +8310,7 @@ Newer releases use the following tags. @end menu @node LIBGCCJIT_ABI_0,LIBGCCJIT_ABI_1,,ABI symbol tags -@anchor{topics/compatibility libgccjit-abi-0}@anchor{e8}@anchor{topics/compatibility id1}@anchor{e9} +@anchor{topics/compatibility libgccjit-abi-0}@anchor{e9}@anchor{topics/compatibility id1}@anchor{ea} @subsubsection @code{LIBGCCJIT_ABI_0} @@ -8231,7 +8322,7 @@ continue to work, with this being handled transparently by the linker (see this post@footnote{https://gcc.gnu.org/ml/gcc-patches/2015-06/msg02126.html}) @node LIBGCCJIT_ABI_1,LIBGCCJIT_ABI_2,LIBGCCJIT_ABI_0,ABI symbol tags -@anchor{topics/compatibility libgccjit-abi-1}@anchor{71}@anchor{topics/compatibility id2}@anchor{ea} +@anchor{topics/compatibility libgccjit-abi-1}@anchor{71}@anchor{topics/compatibility id2}@anchor{eb} @subsubsection @code{LIBGCCJIT_ABI_1} @@ -8239,7 +8330,7 @@ continue to work, with this being handled transparently by the linker @pxref{70,,gcc_jit_context_add_command_line_option()} @node LIBGCCJIT_ABI_2,LIBGCCJIT_ABI_3,LIBGCCJIT_ABI_1,ABI symbol tags -@anchor{topics/compatibility libgccjit-abi-2}@anchor{6c}@anchor{topics/compatibility id3}@anchor{eb} +@anchor{topics/compatibility libgccjit-abi-2}@anchor{6c}@anchor{topics/compatibility id3}@anchor{ec} @subsubsection @code{LIBGCCJIT_ABI_2} @@ -8247,7 +8338,7 @@ continue to work, with this being handled transparently by the linker @pxref{6b,,gcc_jit_context_set_bool_allow_unreachable_blocks()} @node LIBGCCJIT_ABI_3,,LIBGCCJIT_ABI_2,ABI symbol tags -@anchor{topics/compatibility libgccjit-abi-3}@anchor{d7}@anchor{topics/compatibility id4}@anchor{ec} +@anchor{topics/compatibility libgccjit-abi-3}@anchor{d8}@anchor{topics/compatibility id4}@anchor{ed} @subsubsection @code{LIBGCCJIT_ABI_3} @@ -8260,13 +8351,13 @@ entrypoints: @itemize * @item -@pxref{d4,,gcc_jit_block_end_with_switch()} +@pxref{d5,,gcc_jit_block_end_with_switch()} @item -@pxref{d5,,gcc_jit_case_as_object()} +@pxref{d6,,gcc_jit_case_as_object()} @item -@pxref{d6,,gcc_jit_context_new_case()} +@pxref{d7,,gcc_jit_context_new_case()} @end itemize @end quotation @@ -8288,7 +8379,7 @@ entrypoints: @c . @node C++ bindings for libgccjit,Internals,Topic Reference,Top -@anchor{cp/index c-bindings-for-libgccjit}@anchor{ed}@anchor{cp/index doc}@anchor{ee} +@anchor{cp/index c-bindings-for-libgccjit}@anchor{ee}@anchor{cp/index doc}@anchor{ef} @chapter C++ bindings for libgccjit @@ -8436,7 +8527,7 @@ Compiling a context @node Tutorial<2>,Topic Reference<2>,,C++ bindings for libgccjit -@anchor{cp/intro/index doc}@anchor{ef}@anchor{cp/intro/index tutorial}@anchor{f0} +@anchor{cp/intro/index doc}@anchor{f0}@anchor{cp/intro/index tutorial}@anchor{f1} @section Tutorial @@ -8466,7 +8557,7 @@ Compiling a context @end menu @node Tutorial part 1 "Hello world"<2>,Tutorial part 2 Creating a trivial machine code function<2>,,Tutorial<2> -@anchor{cp/intro/tutorial01 doc}@anchor{f1}@anchor{cp/intro/tutorial01 tutorial-part-1-hello-world}@anchor{f2} +@anchor{cp/intro/tutorial01 doc}@anchor{f2}@anchor{cp/intro/tutorial01 tutorial-part-1-hello-world}@anchor{f3} @subsection Tutorial part 1: "Hello world" @@ -8636,7 +8727,7 @@ hello world @c . @node Tutorial part 2 Creating a trivial machine code function<2>,Tutorial part 3 Loops and variables<2>,Tutorial part 1 "Hello world"<2>,Tutorial<2> -@anchor{cp/intro/tutorial02 doc}@anchor{f3}@anchor{cp/intro/tutorial02 tutorial-part-2-creating-a-trivial-machine-code-function}@anchor{f4} +@anchor{cp/intro/tutorial02 doc}@anchor{f4}@anchor{cp/intro/tutorial02 tutorial-part-2-creating-a-trivial-machine-code-function}@anchor{f5} @subsection Tutorial part 2: Creating a trivial machine code function @@ -8665,7 +8756,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{f5,,gccjit;;context;;acquire()}: +Create one using @pxref{f6,,gccjit;;context;;acquire()}: @example gccjit::context ctxt; @@ -8678,7 +8769,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{f6,,gccjit;;context;;get_type()}: +@pxref{f7,,gccjit;;context;;get_type()}: @example gccjit::type int_type = ctxt.get_type (GCC_JIT_TYPE_INT); @@ -8691,7 +8782,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{f7,,gccjit;;context;;release()}: +@pxref{f8,,gccjit;;context;;release()}: @example ctxt.release (); @@ -8724,7 +8815,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{f8,,gccjit;;object;;get_debug_string()}: +@pxref{f9,,gccjit;;object;;get_debug_string()}: @example printf ("obj: %s\n", obj.get_debug_string ().c_str ()); @@ -8744,7 +8835,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{f9,,gccjit;;context;;new_param()}: +using @pxref{fa,,gccjit;;context;;new_param()}: @example gccjit::param param_i = ctxt.new_param (int_type, "i"); @@ -8793,7 +8884,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{fa,,gccjit;;context;;new_binary_op()}: +We can build the expression using @pxref{fb,,gccjit;;context;;new_binary_op()}: @example gccjit::rvalue expr = @@ -8806,7 +8897,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{f8,,gccjit;;object;;get_debug_string()}. +@pxref{f9,,gccjit;;object;;get_debug_string()}. @example printf ("expr: %s\n", expr.get_debug_string ().c_str ()); @@ -8843,7 +8934,7 @@ block.end_with_return (expr); @noindent OK, we've populated the context. We can now compile it using -@pxref{fb,,gccjit;;context;;compile()}: +@pxref{fc,,gccjit;;context;;compile()}: @example gcc_jit_result *result; @@ -8893,12 +8984,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{fc} +@anchor{cp/intro/tutorial02 options}@anchor{fd} @subsubsection Options To get more information on what's going on, you can set debugging flags -on the context using @pxref{fd,,gccjit;;context;;set_bool_option()}. +on the context using @pxref{fe,,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 @@ -8970,7 +9061,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{fe,,gccjit;;context;;set_int_option()} with +@pxref{ff,,gccjit;;context;;set_int_option()} with @pxref{1f,,GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL}: @example @@ -9004,7 +9095,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{ff} +@anchor{cp/intro/tutorial02 full-example}@anchor{100} @subsubsection Full example @@ -9147,7 +9238,7 @@ result: 25 @c . @node Tutorial part 3 Loops and variables<2>,Tutorial part 4 Adding JIT-compilation to a toy interpreter<2>,Tutorial part 2 Creating a trivial machine code function<2>,Tutorial<2> -@anchor{cp/intro/tutorial03 tutorial-part-3-loops-and-variables}@anchor{100}@anchor{cp/intro/tutorial03 doc}@anchor{101} +@anchor{cp/intro/tutorial03 tutorial-part-3-loops-and-variables}@anchor{101}@anchor{cp/intro/tutorial03 doc}@anchor{102} @subsection Tutorial part 3: Loops and variables @@ -9271,7 +9362,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{102} +@anchor{cp/intro/tutorial03 expressions-lvalues-and-rvalues}@anchor{103} @subsubsection Expressions: lvalues and rvalues @@ -9344,7 +9435,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{103,,gccjit;;function;;new_local()}, supplying a type and a name: +@pxref{104,,gccjit;;function;;new_local()}, supplying a type and a name: @example /* Build locals: */ @@ -9370,7 +9461,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{104} +@anchor{cp/intro/tutorial03 control-flow}@anchor{105} @subsubsection Control flow @@ -9409,8 +9500,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{105,,gccjit;;block;;add_assignment()} to add -an assignment statement, and using @pxref{106,,gccjit;;context;;zero()} to get +@pxref{106,,gccjit;;block;;add_assignment()} to add +an assignment statement, and using @pxref{107,,gccjit;;context;;zero()} to get the constant value @cite{0} for the relevant type for the right-hand side of the assignment: @@ -9437,7 +9528,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{107,,gccjit;;context;;new_comparison()}: +We could build the comparison using @pxref{108,,gccjit;;context;;new_comparison()}: @example gccjit::rvalue guard = @@ -9448,7 +9539,7 @@ gccjit::rvalue guard = @noindent and can then use this to add @cite{b_loop_cond}'s sole statement, via -@pxref{108,,gccjit;;block;;end_with_conditional()}: +@pxref{109,,gccjit;;block;;end_with_conditional()}: @example b_loop_cond.end_with_conditional (guard, @@ -9482,7 +9573,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{109,,gccjit;;block;;add_assignment_op()} to handle these operations: +@pxref{10a,,gccjit;;block;;add_assignment_op()} to handle these operations: @example /* sum += i * i */ @@ -9510,7 +9601,7 @@ b_loop_body.add_assignment_op (i, @cartouche @quotation Note For numeric constants other than 0 or 1, we could use -@pxref{10a,,gccjit;;context;;new_rvalue()}, which has overloads +@pxref{10b,,gccjit;;context;;new_rvalue()}, which has overloads for both @code{int} and @code{double}. @end quotation @end cartouche @@ -9586,12 +9677,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{10b} +@anchor{cp/intro/tutorial03 visualizing-the-control-flow-graph}@anchor{10c} @subsubsection Visualizing the control flow graph You can see the control flow graph of a function using -@pxref{10c,,gccjit;;function;;dump_to_dot()}: +@pxref{10d,,gccjit;;function;;dump_to_dot()}: @example func.dump_to_dot ("/tmp/sum-of-squares.dot"); @@ -9625,7 +9716,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{10d} +@anchor{cp/intro/tutorial03 full-example}@anchor{10e} @subsubsection Full example @@ -9808,7 +9899,7 @@ loop_test returned: 285 @c . @node Tutorial part 4 Adding JIT-compilation to a toy interpreter<2>,,Tutorial part 3 Loops and variables<2>,Tutorial<2> -@anchor{cp/intro/tutorial04 tutorial-part-4-adding-jit-compilation-to-a-toy-interpreter}@anchor{10e}@anchor{cp/intro/tutorial04 doc}@anchor{10f} +@anchor{cp/intro/tutorial04 tutorial-part-4-adding-jit-compilation-to-a-toy-interpreter}@anchor{10f}@anchor{cp/intro/tutorial04 doc}@anchor{110} @subsection Tutorial part 4: Adding JIT-compilation to a toy interpreter @@ -9830,7 +9921,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{110} +@anchor{cp/intro/tutorial04 our-toy-interpreter}@anchor{111} @subsubsection Our toy interpreter @@ -10238,7 +10329,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{111} +@anchor{cp/intro/tutorial04 compiling-to-machine-code}@anchor{112} @subsubsection Compiling to machine code @@ -10318,7 +10409,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{112} +@anchor{cp/intro/tutorial04 setting-things-up}@anchor{113} @subsubsection Setting things up @@ -10486,7 +10577,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{113} +@anchor{cp/intro/tutorial04 populating-the-function}@anchor{114} @subsubsection Populating the function @@ -10614,7 +10705,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{114,,gccjit;;block;;add_comment()} to add descriptive comments +@pxref{115,,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}: @@ -10763,14 +10854,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{115} +@anchor{cp/intro/tutorial04 verifying-the-control-flow-graph}@anchor{116} @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{10c,,gccjit;;function;;dump_to_dot()}: +using @pxref{10d,,gccjit;;function;;dump_to_dot()}: @example fn.dump_to_dot ("/tmp/factorial.dot"); @@ -10794,7 +10885,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{116} +@anchor{cp/intro/tutorial04 compiling-the-context}@anchor{117} @subsubsection Compiling the context @@ -10831,7 +10922,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{117} +@anchor{cp/intro/tutorial04 single-stepping-through-the-generated-code}@anchor{118} @subsubsection Single-stepping through the generated code @@ -10845,14 +10936,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{118,,gccjit;;context;;new_location()} and using the +calling @pxref{119,,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{fd,,gccjit;;context;;set_bool_option()}: +@pxref{fe,,gccjit;;context;;set_bool_option()}: @example ctxt.set_bool_option (GCC_JIT_BOOL_OPTION_DEBUGINFO, 1); @@ -10924,14 +11015,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{119} +@anchor{cp/intro/tutorial04 examining-the-generated-code}@anchor{11a} @subsubsection Examining the generated code How good is the optimized code? We can turn up optimizations, by calling -@pxref{fe,,gccjit;;context;;set_int_option()} with +@pxref{ff,,gccjit;;context;;set_int_option()} with @pxref{1f,,GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL}: @example @@ -11113,7 +11204,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{11a} +@anchor{cp/intro/tutorial04 putting-it-all-together}@anchor{11b} @subsubsection Putting it all together @@ -11146,7 +11237,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{11b} +@anchor{cp/intro/tutorial04 behind-the-curtain-how-does-our-code-get-optimized}@anchor{11c} @subsubsection Behind the curtain: How does our code get optimized? @@ -11347,7 +11438,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{11c} +@anchor{cp/intro/tutorial04 optimizing-away-stack-manipulation}@anchor{11d} @subsubsection Optimizing away stack manipulation @@ -11627,7 +11718,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{11d} +@anchor{cp/intro/tutorial04 elimination-of-tail-recursion}@anchor{11e} @subsubsection Elimination of tail recursion @@ -11714,7 +11805,7 @@ instr9: @c . @node Topic Reference<2>,,Tutorial<2>,C++ bindings for libgccjit -@anchor{cp/topics/index doc}@anchor{11e}@anchor{cp/topics/index topic-reference}@anchor{11f} +@anchor{cp/topics/index doc}@anchor{11f}@anchor{cp/topics/index topic-reference}@anchor{120} @section Topic Reference @@ -11804,22 +11895,22 @@ Compiling a context @node Compilation contexts<2>,Objects<2>,,Topic Reference<2> -@anchor{cp/topics/contexts compilation-contexts}@anchor{120}@anchor{cp/topics/contexts doc}@anchor{121} +@anchor{cp/topics/contexts compilation-contexts}@anchor{121}@anchor{cp/topics/contexts doc}@anchor{122} @subsection Compilation contexts @geindex gccjit;;context (C++ class) -@anchor{cp/topics/contexts gccjit context}@anchor{122} +@anchor{cp/topics/contexts gccjit context}@anchor{123} @deffn {C++ Class} gccjit::context @end deffn -The top-level of the C++ API is the @pxref{122,,gccjit;;context} type. +The top-level of the C++ API is the @pxref{123,,gccjit;;context} type. -A @pxref{122,,gccjit;;context} instance encapsulates the state of a +A @pxref{123,,gccjit;;context} instance encapsulates the state of a compilation. You can set up options on it, and add types, functions and code. -Invoking @pxref{fb,,gccjit;;context;;compile()} on it gives you a +Invoking @pxref{fc,,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 *}. @@ -11834,7 +11925,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{123} +@anchor{cp/topics/contexts lifetime-management}@anchor{124} @subsubsection Lifetime-management @@ -11843,16 +11934,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{f5} +@anchor{cp/topics/contexts gccjit context acquire}@anchor{f6} @deffn {C++ Function} gccjit::context gccjit::context::acquire () -This function acquires a new @pxref{122,,gccjit;;context} instance, +This function acquires a new @pxref{123,,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{f7} +@anchor{cp/topics/contexts gccjit context release}@anchor{f8} @deffn {C++ Function} void gccjit::context::release () This function releases all resources associated with the given context. @@ -11871,7 +11962,7 @@ ctxt.release (); @end deffn @geindex gccjit;;context;;new_child_context (C++ function) -@anchor{cp/topics/contexts gccjit context new_child_context}@anchor{124} +@anchor{cp/topics/contexts gccjit context new_child_context}@anchor{125} @deffn {C++ Function} gccjit::context gccjit::context::new_child_context () Given an existing JIT context, create a child context. @@ -11903,16 +11994,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{125} +@anchor{cp/topics/contexts thread-safety}@anchor{126} @subsubsection Thread-safety -Instances of @pxref{122,,gccjit;;context} created via -@pxref{f5,,gccjit;;context;;acquire()} are independent from each other: +Instances of @pxref{123,,gccjit;;context} created via +@pxref{f6,,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{124,,gccjit;;context;;new_child_context()} are +Contexts created via @pxref{125,,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, @@ -11920,7 +12011,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{126} +@anchor{cp/topics/contexts error-handling}@anchor{127} @subsubsection Error-handling @@ -11933,10 +12024,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{127,,gccjit;;context;;get_first_error()}. +@pxref{128,,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{127} +@anchor{cp/topics/contexts gccjit context get_first_error__gccjit contextP}@anchor{128} @deffn {C++ Function} const char* gccjit::context::get_first_error (gccjit::context* ctxt) Returns the first error message that occurred on the context. @@ -11948,18 +12039,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{128} +@anchor{cp/topics/contexts debugging}@anchor{129} @subsubsection Debugging @geindex gccjit;;context;;dump_to_file (C++ function) -@anchor{cp/topics/contexts gccjit context dump_to_file__ssCR i}@anchor{129} +@anchor{cp/topics/contexts gccjit context dump_to_file__ssCR i}@anchor{12a} @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{12a,,gccjit;;location} +If "update_locations" is true, then also set up @pxref{12b,,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 @@ -11967,7 +12058,7 @@ code in a debugger. @end deffn @geindex gccjit;;context;;dump_reproducer_to_file (C++ function) -@anchor{cp/topics/contexts gccjit context dump_reproducer_to_file__gcc_jit_contextP cCP}@anchor{12b} +@anchor{cp/topics/contexts gccjit context dump_reproducer_to_file__gcc_jit_contextP cCP}@anchor{12c} @deffn {C++ Function} void gccjit::context::dump_reproducer_to_file (gcc_jit_context* ctxt, const char* path) This is a thin wrapper around the C API @@ -11979,7 +12070,7 @@ for seeing what the C++ bindings are doing at the C level. @end deffn @node Options<4>,,Debugging<2>,Compilation contexts<2> -@anchor{cp/topics/contexts options}@anchor{12c} +@anchor{cp/topics/contexts options}@anchor{12d} @subsubsection Options @@ -11992,12 +12083,12 @@ for seeing what the C++ bindings are doing at the C level. @end menu @node String Options<2>,Boolean options<2>,,Options<4> -@anchor{cp/topics/contexts string-options}@anchor{12d} +@anchor{cp/topics/contexts string-options}@anchor{12e} @subsubsection String Options @geindex gccjit;;context;;set_str_option (C++ function) -@anchor{cp/topics/contexts gccjit context set_str_option__enum cCP}@anchor{12e} +@anchor{cp/topics/contexts gccjit context set_str_option__enum cCP}@anchor{12f} @deffn {C++ Function} void gccjit::context::set_str_option (enum gcc_jit_str_option, const char* value) Set a string option of the context. @@ -12008,12 +12099,12 @@ meaning. @end deffn @node Boolean options<2>,Integer options<2>,String Options<2>,Options<4> -@anchor{cp/topics/contexts boolean-options}@anchor{12f} +@anchor{cp/topics/contexts boolean-options}@anchor{130} @subsubsection Boolean options @geindex gccjit;;context;;set_bool_option (C++ function) -@anchor{cp/topics/contexts gccjit context set_bool_option__enum i}@anchor{fd} +@anchor{cp/topics/contexts gccjit context set_bool_option__enum i}@anchor{fe} @deffn {C++ Function} void gccjit::context::set_bool_option (enum gcc_jit_bool_option, int value) Set a boolean option of the context. @@ -12024,7 +12115,7 @@ meaning. @end deffn @geindex gccjit;;context;;set_bool_allow_unreachable_blocks (C++ function) -@anchor{cp/topics/contexts gccjit context set_bool_allow_unreachable_blocks__i}@anchor{130} +@anchor{cp/topics/contexts gccjit context set_bool_allow_unreachable_blocks__i}@anchor{131} @deffn {C++ Function} void gccjit::context::set_bool_allow_unreachable_blocks (int bool_value) By default, libgccjit will issue an error about unreachable blocks @@ -12045,12 +12136,12 @@ its presence using @end deffn @node Integer options<2>,Additional command-line options<2>,Boolean options<2>,Options<4> -@anchor{cp/topics/contexts integer-options}@anchor{131} +@anchor{cp/topics/contexts integer-options}@anchor{132} @subsubsection Integer options @geindex gccjit;;context;;set_int_option (C++ function) -@anchor{cp/topics/contexts gccjit context set_int_option__enum i}@anchor{fe} +@anchor{cp/topics/contexts gccjit context set_int_option__enum i}@anchor{ff} @deffn {C++ Function} void gccjit::context::set_int_option (enum gcc_jit_int_option, int value) Set an integer option of the context. @@ -12061,12 +12152,12 @@ meaning. @end deffn @node Additional command-line options<2>,,Integer options<2>,Options<4> -@anchor{cp/topics/contexts additional-command-line-options}@anchor{132} +@anchor{cp/topics/contexts additional-command-line-options}@anchor{133} @subsubsection Additional command-line options @geindex gccjit;;context;;add_command_line_option (C++ function) -@anchor{cp/topics/contexts gccjit context add_command_line_option__cCP}@anchor{133} +@anchor{cp/topics/contexts gccjit context add_command_line_option__cCP}@anchor{134} @deffn {C++ Function} void gccjit::context::add_command_line_option (const char* optname) Add an arbitrary gcc command-line option to the context for use @@ -12103,18 +12194,18 @@ its presence using @c . @node Objects<2>,Types<2>,Compilation contexts<2>,Topic Reference<2> -@anchor{cp/topics/objects objects}@anchor{134}@anchor{cp/topics/objects doc}@anchor{135} +@anchor{cp/topics/objects objects}@anchor{135}@anchor{cp/topics/objects doc}@anchor{136} @subsection Objects @geindex gccjit;;object (C++ class) -@anchor{cp/topics/objects gccjit object}@anchor{136} +@anchor{cp/topics/objects gccjit object}@anchor{137} @deffn {C++ Class} gccjit::object @end deffn Almost every entity in the API (with the exception of -@pxref{122,,gccjit;;context} and @pxref{16,,gcc_jit_result *}) is a -"contextual" object, a @pxref{136,,gccjit;;object}. +@pxref{123,,gccjit;;context} and @pxref{16,,gcc_jit_result *}) is a +"contextual" object, a @pxref{137,,gccjit;;object}. A JIT object: @@ -12124,7 +12215,7 @@ A JIT object: @itemize * @item -is associated with a @pxref{122,,gccjit;;context}. +is associated with a @pxref{123,,gccjit;;context}. @item is automatically cleaned up for you when its context is released so @@ -12151,17 +12242,17 @@ The C++ class hierarchy within the @code{gccjit} namespace looks like this: @noindent -The @pxref{136,,gccjit;;object} base class has the following operations: +The @pxref{137,,gccjit;;object} base class has the following operations: @geindex gccjit;;object;;get_context (C++ function) -@anchor{cp/topics/objects gccjit object get_contextC}@anchor{137} +@anchor{cp/topics/objects gccjit object get_contextC}@anchor{138} @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{f8} +@anchor{cp/topics/objects gccjit object get_debug_stringC}@anchor{f9} @deffn {C++ Function} std::string gccjit::object::get_debug_string () const Generate a human-readable description for the given object. @@ -12201,16 +12292,16 @@ obj: 4.0 * (float)i @c . @node Types<2>,Expressions<2>,Objects<2>,Topic Reference<2> -@anchor{cp/topics/types doc}@anchor{138}@anchor{cp/topics/types types}@anchor{139} +@anchor{cp/topics/types doc}@anchor{139}@anchor{cp/topics/types types}@anchor{13a} @subsection Types @geindex gccjit;;type (C++ class) -@anchor{cp/topics/types gccjit type}@anchor{13a} +@anchor{cp/topics/types gccjit type}@anchor{13b} @deffn {C++ Class} gccjit::type gccjit::type represents a type within the library. It is a subclass -of @pxref{136,,gccjit;;object}. +of @pxref{137,,gccjit;;object}. @end deffn Types can be created in several ways: @@ -12220,7 +12311,7 @@ Types can be created in several ways: @item fundamental types can be accessed using -@pxref{f6,,gccjit;;context;;get_type()}: +@pxref{f7,,gccjit;;context;;get_type()}: @example gccjit::type int_type = ctxt.get_type (GCC_JIT_TYPE_INT); @@ -12240,7 +12331,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{13b,,gccjit;;type;;get_pointer()} and @pxref{13c,,gccjit;;type;;get_const()}: +@pxref{13c,,gccjit;;type;;get_pointer()} and @pxref{13d,,gccjit;;type;;get_const()}: @example gccjit::type const_int_star = int_type.get_const ().get_pointer (); @@ -12261,12 +12352,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{13d} +@anchor{cp/topics/types standard-types}@anchor{13e} @subsubsection Standard types @geindex gccjit;;context;;get_type (C++ function) -@anchor{cp/topics/types gccjit context get_type__enum}@anchor{f6} +@anchor{cp/topics/types gccjit context get_type__enum}@anchor{f7} @deffn {C++ Function} gccjit::type gccjit::context::get_type (enum gcc_jit_types) Access a specific type. This is a thin wrapper around @@ -12274,14 +12365,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{13e} +@anchor{cp/topics/types gccjit context get_int_type__s i}@anchor{13f} @deffn {C++ Function} gccjit::type gccjit::context::get_int_type (size_t num_bytes, int is_signed) Access the integer type of the given size. @end deffn @geindex gccjit;;context;;get_int_type (C++ function) -@anchor{cp/topics/types gccjit context get_int_type T}@anchor{13f} +@anchor{cp/topics/types gccjit context get_int_type T}@anchor{140} @deffn {C++ Function} gccjit::type gccjit::context::get_int_type () Access the given integer type. For example, you could map the @@ -12295,12 +12386,12 @@ gccjit::type t = ctxt.get_int_type (); @end deffn @node Pointers const and volatile<2>,Structures and unions<2>,Standard types<2>,Types<2> -@anchor{cp/topics/types pointers-const-and-volatile}@anchor{140} +@anchor{cp/topics/types pointers-const-and-volatile}@anchor{141} @subsubsection Pointers, @cite{const}, and @cite{volatile} @geindex gccjit;;type;;get_pointer (C++ function) -@anchor{cp/topics/types gccjit type get_pointer}@anchor{13b} +@anchor{cp/topics/types gccjit type get_pointer}@anchor{13c} @deffn {C++ Function} gccjit::type gccjit::type::get_pointer () Given type "T", get type "T*". @@ -12309,21 +12400,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{13c} +@anchor{cp/topics/types gccjit type get_const}@anchor{13d} @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{141} +@anchor{cp/topics/types gccjit type get_volatile}@anchor{142} @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{142} +@anchor{cp/topics/types gccjit context new_array_type__gccjit type i gccjit location}@anchor{143} @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). @@ -12331,31 +12422,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{143} +@anchor{cp/topics/types structures-and-unions}@anchor{144} @subsubsection Structures and unions @geindex gccjit;;struct_ (C++ class) -@anchor{cp/topics/types gccjit struct_}@anchor{144} +@anchor{cp/topics/types gccjit struct_}@anchor{145} @deffn {C++ Class} gccjit::struct_ @end deffn A compound type analagous to a C @cite{struct}. -@pxref{144,,gccjit;;struct_} is a subclass of @pxref{13a,,gccjit;;type} (and thus -of @pxref{136,,gccjit;;object} in turn). +@pxref{145,,gccjit;;struct_} is a subclass of @pxref{13b,,gccjit;;type} (and thus +of @pxref{137,,gccjit;;object} in turn). @geindex gccjit;;field (C++ class) -@anchor{cp/topics/types gccjit field}@anchor{145} +@anchor{cp/topics/types gccjit field}@anchor{146} @deffn {C++ Class} gccjit::field @end deffn -A field within a @pxref{144,,gccjit;;struct_}. +A field within a @pxref{145,,gccjit;;struct_}. -@pxref{145,,gccjit;;field} is a subclass of @pxref{136,,gccjit;;object}. +@pxref{146,,gccjit;;field} is a subclass of @pxref{137,,gccjit;;object}. -You can model C @cite{struct} types by creating @pxref{144,,gccjit;;struct_} and -@pxref{145,,gccjit;;field} instances, in either order: +You can model C @cite{struct} types by creating @pxref{145,,gccjit;;struct_} and +@pxref{146,,gccjit;;field} instances, in either order: @itemize * @@ -12411,14 +12502,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{146} +@anchor{cp/topics/types gccjit context new_field__gccjit type cCP gccjit location}@anchor{147} @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{147} +@anchor{cp/topics/types gccjit context new_struct_type__ssCR std vector field R gccjit location}@anchor{148} @deffn {C++ Function} gccjit::struct_ gccjit::context::new_struct_type (const std::string& name, std::vector& fields, gccjit::location loc) @quotation @@ -12428,7 +12519,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{148} +@anchor{cp/topics/types gccjit context new_opaque_struct__ssCR gccjit location}@anchor{149} @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 @@ -12455,7 +12546,7 @@ size of the struct is not known), or later specified using @c . @node Expressions<2>,Creating and using functions<2>,Types<2>,Topic Reference<2> -@anchor{cp/topics/expressions expressions}@anchor{149}@anchor{cp/topics/expressions doc}@anchor{14a} +@anchor{cp/topics/expressions expressions}@anchor{14a}@anchor{cp/topics/expressions doc}@anchor{14b} @subsection Expressions @@ -12481,17 +12572,17 @@ Lvalues @node Rvalues<2>,Lvalues<2>,,Expressions<2> -@anchor{cp/topics/expressions rvalues}@anchor{14b} +@anchor{cp/topics/expressions rvalues}@anchor{14c} @subsubsection Rvalues @geindex gccjit;;rvalue (C++ class) -@anchor{cp/topics/expressions gccjit rvalue}@anchor{14c} +@anchor{cp/topics/expressions gccjit rvalue}@anchor{14d} @deffn {C++ Class} gccjit::rvalue @end deffn -A @pxref{14c,,gccjit;;rvalue} is an expression that can be computed. It is a -subclass of @pxref{136,,gccjit;;object}, and is a thin wrapper around +A @pxref{14d,,gccjit;;rvalue} is an expression that can be computed. It is a +subclass of @pxref{137,,gccjit;;object}, and is a thin wrapper around @pxref{13,,gcc_jit_rvalue *} from the C API. It can be simple, e.g.: @@ -12537,7 +12628,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{14d} +@anchor{cp/topics/expressions gccjit rvalue get_type}@anchor{14e} @deffn {C++ Function} gccjit::type gccjit::rvalue::get_type () Get the type of this rvalue. @@ -12554,12 +12645,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{14e} +@anchor{cp/topics/expressions simple-expressions}@anchor{14f} @subsubsection Simple expressions @geindex gccjit;;context;;new_rvalue (C++ function) -@anchor{cp/topics/expressions gccjit context new_rvalue__gccjit type iC}@anchor{10a} +@anchor{cp/topics/expressions gccjit context new_rvalue__gccjit type iC}@anchor{10b} @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 @@ -12567,7 +12658,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{14f} +@anchor{cp/topics/expressions gccjit context new_rvalue__gccjit type lC}@anchor{150} @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 @@ -12575,7 +12666,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{106} +@anchor{cp/topics/expressions gccjit context zero__gccjit typeC}@anchor{107} @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 @@ -12589,7 +12680,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{150} +@anchor{cp/topics/expressions gccjit context one__gccjit typeC}@anchor{151} @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 @@ -12603,7 +12694,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{151} +@anchor{cp/topics/expressions gccjit context new_rvalue__gccjit type doubleC}@anchor{152} @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 @@ -12611,14 +12702,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{152} +@anchor{cp/topics/expressions gccjit context new_rvalue__gccjit type voidPC}@anchor{153} @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{153} +@anchor{cp/topics/expressions gccjit context new_rvalue__ssCRC}@anchor{154} @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 @@ -12626,12 +12717,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{154} +@anchor{cp/topics/expressions unary-operations}@anchor{155} @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{155} +@anchor{cp/topics/expressions gccjit context new_unary_op__enum gccjit type gccjit rvalue gccjit location}@anchor{156} @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. @@ -12639,7 +12730,7 @@ Build a unary operation out of an input rvalue. Parameter @code{loc} is optional. This is a thin wrapper around the C API's -@pxref{91,,gcc_jit_context_new_unary_op()} and the available unary +@pxref{92,,gcc_jit_context_new_unary_op()} and the available unary operations are documented there. @end deffn @@ -12647,7 +12738,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{156} +@anchor{cp/topics/expressions gccjit context new_minus__gccjit type gccjit rvalue gccjit location}@anchor{157} @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: @@ -12668,7 +12759,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{157} +@anchor{cp/topics/expressions new_bitwise_negate__gccjit type gccjit rvalue gccjit location}@anchor{158} @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: @@ -12689,7 +12780,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{158} +@anchor{cp/topics/expressions new_logical_negate__gccjit type gccjit rvalue gccjit location}@anchor{159} @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: @@ -12712,7 +12803,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{159} +@anchor{cp/topics/expressions sub-operator__gccjit rvalue}@anchor{15a} @deffn {C++ Function} gccjit::rvalue operator- (gccjit::rvalue a) @example @@ -12723,7 +12814,7 @@ gccjit::rvalue negpi = -pi; @end deffn @geindex operator~ (C++ function) -@anchor{cp/topics/expressions inv-operator__gccjit rvalue}@anchor{15a} +@anchor{cp/topics/expressions inv-operator__gccjit rvalue}@anchor{15b} @deffn {C++ Function} gccjit::rvalue operator~ (gccjit::rvalue a) @example @@ -12734,7 +12825,7 @@ gccjit::rvalue mask = ~a; @end deffn @geindex operator! (C++ function) -@anchor{cp/topics/expressions not-operator__gccjit rvalue}@anchor{15b} +@anchor{cp/topics/expressions not-operator__gccjit rvalue}@anchor{15c} @deffn {C++ Function} gccjit::rvalue operator! (gccjit::rvalue a) @example @@ -12745,12 +12836,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{15c} +@anchor{cp/topics/expressions binary-operations}@anchor{15d} @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{fa} +@anchor{cp/topics/expressions gccjit context new_binary_op__enum gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{fb} @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. @@ -12766,59 +12857,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{15d} +@anchor{cp/topics/expressions gccjit context new_plus__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{15e} @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{15e} +@anchor{cp/topics/expressions gccjit context new_minus__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{15f} @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{15f} +@anchor{cp/topics/expressions gccjit context new_mult__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{160} @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{160} +@anchor{cp/topics/expressions gccjit context new_divide__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{161} @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{161} +@anchor{cp/topics/expressions gccjit context new_modulo__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{162} @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{162} +@anchor{cp/topics/expressions gccjit context new_bitwise_and__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{163} @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{163} +@anchor{cp/topics/expressions gccjit context new_bitwise_xor__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{164} @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{164} +@anchor{cp/topics/expressions gccjit context new_bitwise_or__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{165} @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{165} +@anchor{cp/topics/expressions gccjit context new_logical_and__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{166} @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{166} +@anchor{cp/topics/expressions gccjit context new_logical_or__gccjit type gccjit rvalue gccjit rvalue gccjit location}@anchor{167} @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{167} +@anchor{cp/topics/expressions add-operator__gccjit rvalue gccjit rvalue}@anchor{168} @deffn {C++ Function} gccjit::rvalue operator+ (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12829,7 +12920,7 @@ gccjit::rvalue sum = a + b; @end deffn @geindex operator- (C++ function) -@anchor{cp/topics/expressions sub-operator__gccjit rvalue gccjit rvalue}@anchor{168} +@anchor{cp/topics/expressions sub-operator__gccjit rvalue gccjit rvalue}@anchor{169} @deffn {C++ Function} gccjit::rvalue operator- (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12840,7 +12931,7 @@ gccjit::rvalue diff = a - b; @end deffn @geindex operator* (C++ function) -@anchor{cp/topics/expressions mul-operator__gccjit rvalue gccjit rvalue}@anchor{169} +@anchor{cp/topics/expressions mul-operator__gccjit rvalue gccjit rvalue}@anchor{16a} @deffn {C++ Function} gccjit::rvalue operator* (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12851,7 +12942,7 @@ gccjit::rvalue prod = a * b; @end deffn @geindex operator/ (C++ function) -@anchor{cp/topics/expressions div-operator__gccjit rvalue gccjit rvalue}@anchor{16a} +@anchor{cp/topics/expressions div-operator__gccjit rvalue gccjit rvalue}@anchor{16b} @deffn {C++ Function} gccjit::rvalue operator/ (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12862,7 +12953,7 @@ gccjit::rvalue result = a / b; @end deffn @geindex operator% (C++ function) -@anchor{cp/topics/expressions mod-operator__gccjit rvalue gccjit rvalue}@anchor{16b} +@anchor{cp/topics/expressions mod-operator__gccjit rvalue gccjit rvalue}@anchor{16c} @deffn {C++ Function} gccjit::rvalue operator% (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12873,7 +12964,7 @@ gccjit::rvalue mod = a % b; @end deffn @geindex operator& (C++ function) -@anchor{cp/topics/expressions and-operator__gccjit rvalue gccjit rvalue}@anchor{16c} +@anchor{cp/topics/expressions and-operator__gccjit rvalue gccjit rvalue}@anchor{16d} @deffn {C++ Function} gccjit::rvalue operator& (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12884,7 +12975,7 @@ gccjit::rvalue x = a & b; @end deffn @geindex operator^ (C++ function) -@anchor{cp/topics/expressions xor-operator__gccjit rvalue gccjit rvalue}@anchor{16d} +@anchor{cp/topics/expressions xor-operator__gccjit rvalue gccjit rvalue}@anchor{16e} @deffn {C++ Function} gccjit::rvalue operator^ (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12895,7 +12986,7 @@ gccjit::rvalue x = a ^ b; @end deffn @geindex operator| (C++ function) -@anchor{cp/topics/expressions or-operator__gccjit rvalue gccjit rvalue}@anchor{16e} +@anchor{cp/topics/expressions or-operator__gccjit rvalue gccjit rvalue}@anchor{16f} @deffn {C++ Function} gccjit::rvalue operator| (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12906,7 +12997,7 @@ gccjit::rvalue x = a | b; @end deffn @geindex operator&& (C++ function) -@anchor{cp/topics/expressions sand-operator__gccjit rvalue gccjit rvalue}@anchor{16f} +@anchor{cp/topics/expressions sand-operator__gccjit rvalue gccjit rvalue}@anchor{170} @deffn {C++ Function} gccjit::rvalue operator&& (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12917,7 +13008,7 @@ gccjit::rvalue cond = a && b; @end deffn @geindex operator|| (C++ function) -@anchor{cp/topics/expressions sor-operator__gccjit rvalue gccjit rvalue}@anchor{170} +@anchor{cp/topics/expressions sor-operator__gccjit rvalue gccjit rvalue}@anchor{171} @deffn {C++ Function} gccjit::rvalue operator|| (gccjit::rvalue a, gccjit::rvalue b) @example @@ -12940,12 +13031,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{171} +@anchor{cp/topics/expressions comparisons}@anchor{172} @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{107} +@anchor{cp/topics/expressions gccjit context new_comparison__enum gccjit rvalue gccjit rvalue gccjit location}@anchor{108} @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. @@ -12961,39 +13052,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{172} +@anchor{cp/topics/expressions gccjit context new_eq__gccjit rvalue gccjit rvalue gccjit location}@anchor{173} @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{173} +@anchor{cp/topics/expressions gccjit context new_ne__gccjit rvalue gccjit rvalue gccjit location}@anchor{174} @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{174} +@anchor{cp/topics/expressions gccjit context new_lt__gccjit rvalue gccjit rvalue gccjit location}@anchor{175} @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{175} +@anchor{cp/topics/expressions gccjit context new_le__gccjit rvalue gccjit rvalue gccjit location}@anchor{176} @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{176} +@anchor{cp/topics/expressions gccjit context new_gt__gccjit rvalue gccjit rvalue gccjit location}@anchor{177} @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{177} +@anchor{cp/topics/expressions gccjit context new_ge__gccjit rvalue gccjit rvalue gccjit location}@anchor{178} @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{178} +@anchor{cp/topics/expressions eq-operator__gccjit rvalue gccjit rvalue}@anchor{179} @deffn {C++ Function} gccjit::rvalue operator== (gccjit::rvalue a, gccjit::rvalue b) @example @@ -13004,7 +13095,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{179} +@anchor{cp/topics/expressions neq-operator__gccjit rvalue gccjit rvalue}@anchor{17a} @deffn {C++ Function} gccjit::rvalue operator!= (gccjit::rvalue a, gccjit::rvalue b) @example @@ -13015,7 +13106,7 @@ gccjit::rvalue cond = (i != j); @end deffn @geindex operator< (C++ function) -@anchor{cp/topics/expressions lt-operator__gccjit rvalue gccjit rvalue}@anchor{17a} +@anchor{cp/topics/expressions lt-operator__gccjit rvalue gccjit rvalue}@anchor{17b} @deffn {C++ Function} gccjit::rvalue operator< (gccjit::rvalue a, gccjit::rvalue b) @example @@ -13026,7 +13117,7 @@ gccjit::rvalue cond = i < n; @end deffn @geindex operator<= (C++ function) -@anchor{cp/topics/expressions lte-operator__gccjit rvalue gccjit rvalue}@anchor{17b} +@anchor{cp/topics/expressions lte-operator__gccjit rvalue gccjit rvalue}@anchor{17c} @deffn {C++ Function} gccjit::rvalue operator<= (gccjit::rvalue a, gccjit::rvalue b) @example @@ -13037,7 +13128,7 @@ gccjit::rvalue cond = i <= n; @end deffn @geindex operator> (C++ function) -@anchor{cp/topics/expressions gt-operator__gccjit rvalue gccjit rvalue}@anchor{17c} +@anchor{cp/topics/expressions gt-operator__gccjit rvalue gccjit rvalue}@anchor{17d} @deffn {C++ Function} gccjit::rvalue operator> (gccjit::rvalue a, gccjit::rvalue b) @example @@ -13048,7 +13139,7 @@ gccjit::rvalue cond = (ch > limit); @end deffn @geindex operator>= (C++ function) -@anchor{cp/topics/expressions gte-operator__gccjit rvalue gccjit rvalue}@anchor{17d} +@anchor{cp/topics/expressions gte-operator__gccjit rvalue gccjit rvalue}@anchor{17e} @deffn {C++ Function} gccjit::rvalue operator>= (gccjit::rvalue a, gccjit::rvalue b) @example @@ -13061,12 +13152,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{17e} +@anchor{cp/topics/expressions function-calls}@anchor{17f} @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{17f} +@anchor{cp/topics/expressions gcc_jit_context_new_call__gcc_jit_contextP gcc_jit_locationP gcc_jit_functionP i gcc_jit_rvaluePP}@anchor{180} @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 @@ -13075,14 +13166,14 @@ call to the function, with the result as an rvalue. @cartouche @quotation Note @code{gccjit::context::new_call()} merely builds a -@pxref{14c,,gccjit;;rvalue} i.e. an expression that can be evaluated, +@pxref{14d,,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{180,,gccjit;;block;;add_eval()}: +@pxref{181,,gccjit;;block;;add_eval()}: @example /* Add "(void)printf (arg0, arg1);". */ @@ -13095,12 +13186,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{181} +@anchor{cp/topics/expressions type-coercion}@anchor{182} @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{182} +@anchor{cp/topics/expressions gccjit context new_cast__gccjit rvalue gccjit type gccjit location}@anchor{183} @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. @@ -13125,24 +13216,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{183} +@anchor{cp/topics/expressions lvalues}@anchor{184} @subsubsection Lvalues @geindex gccjit;;lvalue (C++ class) -@anchor{cp/topics/expressions gccjit lvalue}@anchor{184} +@anchor{cp/topics/expressions gccjit lvalue}@anchor{185} @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{14c,,gccjit;;rvalue}, where the rvalue is computed by reading from the +@pxref{14d,,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{185} +@anchor{cp/topics/expressions gccjit lvalue get_address__gccjit location}@anchor{186} @deffn {C++ Function} gccjit::rvalue gccjit::lvalue::get_address (gccjit::location loc) Take the address of an lvalue; analogous to: @@ -13164,27 +13255,27 @@ Parameter "loc" is optional. @end menu @node Global variables<2>,,,Lvalues<2> -@anchor{cp/topics/expressions global-variables}@anchor{186} +@anchor{cp/topics/expressions global-variables}@anchor{187} @subsubsection Global variables @geindex gccjit;;context;;new_global (C++ function) -@anchor{cp/topics/expressions gccjit context new_global__enum gccjit type cCP gccjit location}@anchor{187} +@anchor{cp/topics/expressions gccjit context new_global__enum gccjit type cCP gccjit location}@anchor{188} @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{b2,,gcc_jit_context_new_global()} from +This is a thin wrapper around @pxref{b3,,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{188} +@anchor{cp/topics/expressions working-with-pointers-structs-and-unions}@anchor{189} @subsubsection Working with pointers, structs and unions @geindex gccjit;;rvalue;;dereference (C++ function) -@anchor{cp/topics/expressions gccjit rvalue dereference__gccjit location}@anchor{189} +@anchor{cp/topics/expressions gccjit rvalue dereference__gccjit location}@anchor{18a} @deffn {C++ Function} gccjit::lvalue gccjit::rvalue::dereference (gccjit::location loc) Given an rvalue of pointer type @code{T *}, dereferencing the pointer, @@ -13205,7 +13296,7 @@ If you don't need to specify the location, this can also be expressed using an overloaded operator: @geindex gccjit;;rvalue;;operator* (C++ function) -@anchor{cp/topics/expressions gccjit rvalue mul-operator}@anchor{18a} +@anchor{cp/topics/expressions gccjit rvalue mul-operator}@anchor{18b} @deffn {C++ Function} gccjit::lvalue gccjit::rvalue::operator* () @example @@ -13218,7 +13309,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{18b} +@anchor{cp/topics/expressions gccjit lvalue access_field__gccjit field gccjit location}@anchor{18c} @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, @@ -13234,7 +13325,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{18c} +@anchor{cp/topics/expressions gccjit rvalue access_field__gccjit field gccjit location}@anchor{18d} @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 @@ -13250,7 +13341,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{18d} +@anchor{cp/topics/expressions gccjit rvalue dereference_field__gccjit field gccjit location}@anchor{18e} @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 @@ -13266,7 +13357,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{18e} +@anchor{cp/topics/expressions gccjit context new_array_access__gccjit rvalue gccjit rvalue gccjit location}@anchor{18f} @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 @@ -13285,7 +13376,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{12a,,gccjit;;location}, +For array accesses where you don't need to specify a @pxref{12b,,gccjit;;location}, two overloaded operators are available: @quotation @@ -13325,7 +13416,7 @@ gccjit::lvalue element = array[0]; @c . @node Creating and using functions<2>,Source Locations<2>,Expressions<2>,Topic Reference<2> -@anchor{cp/topics/functions doc}@anchor{18f}@anchor{cp/topics/functions creating-and-using-functions}@anchor{190} +@anchor{cp/topics/functions doc}@anchor{190}@anchor{cp/topics/functions creating-and-using-functions}@anchor{191} @subsection Creating and using functions @@ -13338,36 +13429,36 @@ gccjit::lvalue element = array[0]; @end menu @node Params<2>,Functions<2>,,Creating and using functions<2> -@anchor{cp/topics/functions params}@anchor{191} +@anchor{cp/topics/functions params}@anchor{192} @subsubsection Params @geindex gccjit;;param (C++ class) -@anchor{cp/topics/functions gccjit param}@anchor{192} +@anchor{cp/topics/functions gccjit param}@anchor{193} @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{f9} +@anchor{cp/topics/functions gccjit context new_param__gccjit type cCP gccjit location}@anchor{fa} @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{192,,gccjit;;param} is a subclass of @pxref{184,,gccjit;;lvalue} (and thus -of @pxref{14c,,gccjit;;rvalue} and @pxref{136,,gccjit;;object}). It is a thin +@pxref{193,,gccjit;;param} is a subclass of @pxref{185,,gccjit;;lvalue} (and thus +of @pxref{14d,,gccjit;;rvalue} and @pxref{137,,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{193} +@anchor{cp/topics/functions functions}@anchor{194} @subsubsection Functions @geindex gccjit;;function (C++ class) -@anchor{cp/topics/functions gccjit function}@anchor{194} +@anchor{cp/topics/functions gccjit function}@anchor{195} @deffn {C++ Class} gccjit::function A @cite{gccjit::function} represents a function - either one that we're @@ -13375,7 +13466,7 @@ creating ourselves, or one that we're referencing. @end deffn @geindex gccjit;;context;;new_function (C++ function) -@anchor{cp/topics/functions gccjit context new_function__enum gccjit type cCP std vector param R i gccjit location}@anchor{195} +@anchor{cp/topics/functions gccjit context new_function__enum gccjit type cCP std vector param R i gccjit location}@anchor{196} @deffn {C++ Function} gccjit::function gccjit::context::new_function (enum gcc_jit_function_kind, gccjit::type return_type, const char* name, std::vector& params, int is_variadic, gccjit::location loc) Create a gcc_jit_function with the given name and parameters. @@ -13386,29 +13477,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{196} +@anchor{cp/topics/functions gccjit context get_builtin_function__cCP}@anchor{197} @deffn {C++ Function} gccjit::function gccjit::context::get_builtin_function (const char* name) This is a wrapper around the C API's -@pxref{c9,,gcc_jit_context_get_builtin_function()}. +@pxref{ca,,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{197} +@anchor{cp/topics/functions gccjit function get_param__iC}@anchor{198} @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{10c} +@anchor{cp/topics/functions gccjit function dump_to_dot__cCP}@anchor{10d} @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{103} +@anchor{cp/topics/functions gccjit function new_local__gccjit type cCP gccjit location}@anchor{104} @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 @@ -13416,19 +13507,19 @@ name. @end deffn @node Blocks<2>,Statements<2>,Functions<2>,Creating and using functions<2> -@anchor{cp/topics/functions blocks}@anchor{198} +@anchor{cp/topics/functions blocks}@anchor{199} @subsubsection Blocks @geindex gccjit;;block (C++ class) -@anchor{cp/topics/functions gccjit block}@anchor{199} +@anchor{cp/topics/functions gccjit block}@anchor{19a} @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{199,,gccjit;;block} is a subclass of @pxref{136,,gccjit;;object}. +@pxref{19a,,gccjit;;block} is a subclass of @pxref{137,,gccjit;;object}. The first basic block that you create within a function will be the entrypoint. @@ -13442,7 +13533,7 @@ one function. @end deffn @geindex gccjit;;function;;new_block (C++ function) -@anchor{cp/topics/functions gccjit function new_block__cCP}@anchor{19a} +@anchor{cp/topics/functions gccjit function new_block__cCP}@anchor{19b} @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 @@ -13452,12 +13543,12 @@ messages. @end deffn @node Statements<2>,,Blocks<2>,Creating and using functions<2> -@anchor{cp/topics/functions statements}@anchor{19b} +@anchor{cp/topics/functions statements}@anchor{19c} @subsubsection Statements @geindex gccjit;;block;;add_eval (C++ function) -@anchor{cp/topics/functions gccjit block add_eval__gccjit rvalue gccjit location}@anchor{180} +@anchor{cp/topics/functions gccjit block add_eval__gccjit rvalue gccjit location}@anchor{181} @deffn {C++ Function} void gccjit::block::add_eval (gccjit::rvalue rvalue, gccjit::location loc) Add evaluation of an rvalue, discarding the result @@ -13473,7 +13564,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{105} +@anchor{cp/topics/functions gccjit block add_assignment__gccjit lvalue gccjit rvalue gccjit location}@anchor{106} @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 @@ -13489,7 +13580,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{109} +@anchor{cp/topics/functions gccjit block add_assignment_op__gccjit lvalue enum gccjit rvalue gccjit location}@anchor{10a} @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 @@ -13519,7 +13610,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{114} +@anchor{cp/topics/functions gccjit block add_comment__cCP gccjit location}@anchor{115} @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 @@ -13533,7 +13624,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{108} +@anchor{cp/topics/functions gccjit block end_with_conditional__gccjit rvalue gccjit block gccjit block gccjit location}@anchor{109} @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 @@ -13554,7 +13645,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{19c} +@anchor{cp/topics/functions gccjit block end_with_jump__gccjit block gccjit location}@anchor{19d} @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. @@ -13569,7 +13660,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{19d} +@anchor{cp/topics/functions gccjit block end_with_return__gccjit rvalue gccjit location}@anchor{19e} @deffn {C++ Function} void gccjit::block::end_with_return (gccjit::rvalue rvalue, gccjit::location loc) Terminate a block. @@ -13603,7 +13694,7 @@ return; @end deffn @geindex gccjit;;block;;end_with_switch (C++ function) -@anchor{cp/topics/functions gccjit block end_with_switch__gccjit rvalue gccjit block std vector gccjit case_ gccjit location}@anchor{19e} +@anchor{cp/topics/functions gccjit block end_with_switch__gccjit rvalue gccjit block std vector gccjit case_ gccjit location}@anchor{19f} @deffn {C++ Function} void gccjit::block::end_with_switch (gccjit::rvalue expr, gccjit::block default_block, std::vector cases, gccjit::location loc) Terminate a block by adding evalation of an rvalue, then performing @@ -13646,14 +13737,14 @@ The API entrypoints relating to switch statements and cases: @itemize * @item -@pxref{19e,,gccjit;;block;;end_with_switch()} +@pxref{19f,,gccjit;;block;;end_with_switch()} @item -@pxref{19f,,gccjit;;context;;new_case()} +@pxref{1a0,,gccjit;;context;;new_case()} @end itemize @end quotation -were added in @pxref{d7,,LIBGCCJIT_ABI_3}; you can test for their presence +were added in @pxref{d8,,LIBGCCJIT_ABI_3}; you can test for their presence using @example @@ -13663,21 +13754,21 @@ using @noindent @geindex gccjit;;block;;end_with_switch;;gccjit;;case_ (C++ class) -@anchor{cp/topics/functions gccjit block end_with_switch gccjit case_}@anchor{1a0} +@anchor{cp/topics/functions gccjit block end_with_switch gccjit case_}@anchor{1a1} @deffn {C++ Class} gccjit::case_ @end deffn A @cite{gccjit::case_} represents a case within a switch statement, and -is created within a particular @pxref{122,,gccjit;;context} using -@pxref{19f,,gccjit;;context;;new_case()}. It is a subclass of -@pxref{136,,gccjit;;object}. +is created within a particular @pxref{123,,gccjit;;context} using +@pxref{1a0,,gccjit;;context;;new_case()}. It is a subclass of +@pxref{137,,gccjit;;object}. Each case expresses a multivalued range of integer values. You can express single-valued cases by passing in the same value for both @cite{min_value} and @cite{max_value}. @geindex gccjit;;block;;end_with_switch;;gccjit;;context;;new_case (C++ function) -@anchor{cp/topics/functions gccjit block end_with_switch gccjit context new_case__gccjit rvalue gccjit rvalue gccjit block}@anchor{19f} +@anchor{cp/topics/functions gccjit block end_with_switch gccjit context new_case__gccjit rvalue gccjit rvalue gccjit block}@anchor{1a0} @deffn {C++ Function} gccjit::case_* gccjit::context::new_case (gccjit::rvalue min_value, gccjit::rvalue max_value, gccjit::block dest_block) Create a new gccjit::case for use in a switch statement. @@ -13788,12 +13879,12 @@ create_code (gcc_jit_context *c_ctxt, void *user_data) @c . @node Source Locations<2>,Compiling a context<2>,Creating and using functions<2>,Topic Reference<2> -@anchor{cp/topics/locations source-locations}@anchor{1a1}@anchor{cp/topics/locations doc}@anchor{1a2} +@anchor{cp/topics/locations source-locations}@anchor{1a2}@anchor{cp/topics/locations doc}@anchor{1a3} @subsection Source Locations @geindex gccjit;;location (C++ class) -@anchor{cp/topics/locations gccjit location}@anchor{12a} +@anchor{cp/topics/locations gccjit location}@anchor{12b} @deffn {C++ Class} gccjit::location A @cite{gccjit::location} encapsulates a source code location, so that @@ -13804,10 +13895,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{118,,gccjit;;context;;new_location()}. +You can construct them using @pxref{119,,gccjit;;context;;new_location()}. You need to enable @pxref{42,,GCC_JIT_BOOL_OPTION_DEBUGINFO} on the -@pxref{122,,gccjit;;context} for these locations to actually be usable by +@pxref{123,,gccjit;;context} for these locations to actually be usable by the debugger: @example @@ -13818,7 +13909,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{118} +@anchor{cp/topics/locations gccjit context new_location__cCP i i}@anchor{119} @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 @@ -13831,13 +13922,13 @@ location. @end menu @node Faking it<2>,,,Source Locations<2> -@anchor{cp/topics/locations faking-it}@anchor{1a3} +@anchor{cp/topics/locations faking-it}@anchor{1a4} @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{129,,gccjit;;context;;dump_to_file()}: +your context using @pxref{12a,,gccjit;;context;;dump_to_file()}: @example ctxt.dump_to_file ("/tmp/something.c", @@ -13869,13 +13960,13 @@ file, giving you @emph{something} you can step through in the debugger. @c . @node Compiling a context<2>,,Source Locations<2>,Topic Reference<2> -@anchor{cp/topics/compilation compiling-a-context}@anchor{1a4}@anchor{cp/topics/compilation doc}@anchor{1a5} +@anchor{cp/topics/compilation compiling-a-context}@anchor{1a5}@anchor{cp/topics/compilation doc}@anchor{1a6} @subsection Compiling a context -Once populated, a @pxref{122,,gccjit;;context} can be compiled to -machine code, either in-memory via @pxref{fb,,gccjit;;context;;compile()} or -to disk via @pxref{1a6,,gccjit;;context;;compile_to_file()}. +Once populated, a @pxref{123,,gccjit;;context} can be compiled to +machine code, either in-memory via @pxref{fc,,gccjit;;context;;compile()} or +to disk via @pxref{1a7,,gccjit;;context;;compile_to_file()}. You can compile a context multiple times (using either form of compilation), although any errors that occur on the context will @@ -13888,12 +13979,12 @@ prevent any future compilation of that context. @end menu @node In-memory compilation<2>,Ahead-of-time compilation<2>,,Compiling a context<2> -@anchor{cp/topics/compilation in-memory-compilation}@anchor{1a7} +@anchor{cp/topics/compilation in-memory-compilation}@anchor{1a8} @subsubsection In-memory compilation @geindex gccjit;;context;;compile (C++ function) -@anchor{cp/topics/compilation gccjit context compile}@anchor{fb} +@anchor{cp/topics/compilation gccjit context compile}@anchor{fc} @deffn {C++ Function} gcc_jit_result* gccjit::context::compile () This calls into GCC and builds the code, returning a @@ -13904,19 +13995,19 @@ This is a thin wrapper around the @end deffn @node Ahead-of-time compilation<2>,,In-memory compilation<2>,Compiling a context<2> -@anchor{cp/topics/compilation ahead-of-time-compilation}@anchor{1a8} +@anchor{cp/topics/compilation ahead-of-time-compilation}@anchor{1a9} @subsubsection Ahead-of-time compilation Although libgccjit is primarily aimed at just-in-time compilation, it can also be used for implementing more traditional ahead-of-time -compilers, via the @pxref{1a6,,gccjit;;context;;compile_to_file()} method. +compilers, via the @pxref{1a7,,gccjit;;context;;compile_to_file()} method. @geindex gccjit;;context;;compile_to_file (C++ function) -@anchor{cp/topics/compilation gccjit context compile_to_file__enum cCP}@anchor{1a6} +@anchor{cp/topics/compilation gccjit context compile_to_file__enum cCP}@anchor{1a7} @deffn {C++ Function} void gccjit::context::compile_to_file (enum gcc_jit_output_kind, const char* output_path) -Compile the @pxref{122,,gccjit;;context} to a file of the given +Compile the @pxref{123,,gccjit;;context} to a file of the given kind. This is a thin wrapper around the @@ -13941,7 +14032,7 @@ This is a thin wrapper around the @c . @node Internals,Indices and tables,C++ bindings for libgccjit,Top -@anchor{internals/index internals}@anchor{1a9}@anchor{internals/index doc}@anchor{1aa} +@anchor{internals/index internals}@anchor{1aa}@anchor{internals/index doc}@anchor{1ab} @chapter Internals @@ -13956,7 +14047,7 @@ This is a thin wrapper around the @end menu @node Working on the JIT library,Running the test suite,,Internals -@anchor{internals/index working-on-the-jit-library}@anchor{1ab} +@anchor{internals/index working-on-the-jit-library}@anchor{1ac} @section Working on the JIT library @@ -13993,7 +14084,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{1ac} +@anchor{internals/index cmdoption--enable-host-shared}@anchor{1ad} @deffn {Option} --enable-host-shared Configuring with this option means that the compiler is built as @@ -14002,7 +14093,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{1ad} +@anchor{internals/index cmdoption--enable-languages}@anchor{1ae} @deffn {Option} --enable-languages=jit,c++ This specifies which frontends to build. The JIT library looks like @@ -14021,7 +14112,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{1ae} +@anchor{internals/index cmdoption--disable-bootstrap}@anchor{1af} @deffn {Option} --disable-bootstrap For hacking on the "jit" subdirectory, performing a full @@ -14031,7 +14122,7 @@ the compiler can still bootstrap itself. @end deffn @geindex command line option; --enable-checking=release -@anchor{internals/index cmdoption--enable-checking}@anchor{1af} +@anchor{internals/index cmdoption--enable-checking}@anchor{1b0} @deffn {Option} --enable-checking=release The compile can perform extensive self-checking as it runs, useful when @@ -14042,7 +14133,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{1b0} +@anchor{internals/index running-the-test-suite}@anchor{1b1} @section Running the test suite @@ -14105,7 +14196,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{1b1} +@anchor{internals/index running-under-valgrind}@anchor{1b2} @subsection Running under valgrind @@ -14153,7 +14244,7 @@ When running under valgrind, it's best to have configured gcc with various known false positives. @node Environment variables,Packaging notes,Running the test suite,Internals -@anchor{internals/index environment-variables}@anchor{1b2} +@anchor{internals/index environment-variables}@anchor{1b3} @section Environment variables @@ -14161,7 +14252,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{1b3} +@anchor{internals/index envvar-LD_LIBRARY_PATH}@anchor{1b4} @deffn {Environment Variable} LD_LIBRARY_PATH @quotation @@ -14183,7 +14274,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{1b4} +@anchor{internals/index envvar-PATH}@anchor{1b5} @deffn {Environment Variable} PATH The library uses a driver executable for converting from .s assembler @@ -14202,7 +14293,7 @@ of development. @end deffn @geindex environment variable; LIBRARY_PATH -@anchor{internals/index envvar-LIBRARY_PATH}@anchor{1b5} +@anchor{internals/index envvar-LIBRARY_PATH}@anchor{1b6} @deffn {Environment Variable} LIBRARY_PATH The driver executable invokes the linker, and the latter needs to locate @@ -14238,11 +14329,11 @@ hello world @noindent @node Packaging notes,Overview of code structure,Environment variables,Internals -@anchor{internals/index packaging-notes}@anchor{1b6} +@anchor{internals/index packaging-notes}@anchor{1b7} @section Packaging notes -The configure-time option @pxref{1ac,,--enable-host-shared} is needed when +The configure-time option @pxref{1ad,,--enable-host-shared} is needed when building the jit in order to get position-independent code. This will slow down the regular compiler by a few percent. Hence when packaging gcc with libgccjit, please configure and build twice: @@ -14253,10 +14344,10 @@ with libgccjit, please configure and build twice: @itemize * @item -once without @pxref{1ac,,--enable-host-shared} for most languages, and +once without @pxref{1ad,,--enable-host-shared} for most languages, and @item -once with @pxref{1ac,,--enable-host-shared} for the jit +once with @pxref{1ad,,--enable-host-shared} for the jit @end itemize @end quotation @@ -14300,7 +14391,7 @@ popd @noindent @node Overview of code structure,Design notes,Packaging notes,Internals -@anchor{internals/index overview-of-code-structure}@anchor{1b7} +@anchor{internals/index overview-of-code-structure}@anchor{1b8} @section Overview of code structure @@ -14766,7 +14857,7 @@ JIT: gcc::jit::logger::~logger() @noindent @node Design notes,,Overview of code structure,Internals -@anchor{internals/index design-notes}@anchor{1b8} +@anchor{internals/index design-notes}@anchor{1b9} @section Design notes @@ -14779,7 +14870,7 @@ close as possible to the error; failing that, a good place is within @code{recording::context::validate ()} in jit-recording.c. @node Indices and tables,Index,Internals,Top -@anchor{index indices-and-tables}@anchor{1b9} +@anchor{index indices-and-tables}@anchor{1ba} @unnumbered Indices and tables diff --git a/gcc/jit/docs/topics/types.rst b/gcc/jit/docs/topics/types.rst index 5bfba726c00..41fa40ef7db 100644 --- a/gcc/jit/docs/topics/types.rst +++ b/gcc/jit/docs/topics/types.rst @@ -230,3 +230,22 @@ You can model C `struct` types by creating :c:type:`gcc_jit_struct *` and Populate the fields of a formerly-opaque struct type. This can only be called once on a given struct type. + +.. function:: gcc_jit_type *\ + gcc_jit_context_new_union_type (gcc_jit_context *ctxt,\ + gcc_jit_location *loc,\ + const char *name,\ + int num_fields,\ + gcc_jit_field **fields) + + Construct a new union type, with the given name and fields. + + The parameter ``name`` must be non-NULL. It is copied, so the input + buffer does not need to outlive the call. + + Example of use: + + .. literalinclude:: ../../../testsuite/jit.dg/test-accessing-union.c + :start-after: /* Quote from here in docs/topics/types.rst. */ + :end-before: /* Quote up to here in docs/topics/types.rst. */ + :language: c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ca8c923b5de..ad2cb51838b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-07-01 David Malcolm + + * jit.dg/test-accessing-union.c: Add comments for use by + gcc/jit/docs/topics/types.rst. + 2015-07-01 Matthew Wahab * gcc.target/arm/armv8-sync-comp-swap.c: Replace diff --git a/gcc/testsuite/jit.dg/test-accessing-union.c b/gcc/testsuite/jit.dg/test-accessing-union.c index 658d1bc2eee..15656e9bd4c 100644 --- a/gcc/testsuite/jit.dg/test-accessing-union.c +++ b/gcc/testsuite/jit.dg/test-accessing-union.c @@ -5,6 +5,8 @@ #include "harness.h" +/* Quote from here in docs/topics/types.rst. */ + union int_or_float { int as_int; @@ -77,6 +79,8 @@ create_code (gcc_jit_context *ctxt, void *user_data) as_float)); } +/* Quote up to here in docs/topics/types.rst. */ + void verify_code (gcc_jit_context *ctxt, gcc_jit_result *result) { -- 2.30.2