@@ -238,7 +238,9 @@ and can then use this to add `b_loop_cond`'s sole statement, via
.. code-block:: c++
- b_loop_cond.end_with_conditional (guard);
+ b_loop_cond.end_with_conditional (guard,
+ b_after_loop, // on_true
+ b_loop_body); // on_false
However :type:`gccjit::rvalue` has overloaded operators for this, so we
express the conditional as
@@ -247,14 +249,14 @@ express the conditional as
gccjit::rvalue guard = (i >= n);
-and hence write the block more concisely as:
+and hence we can write the block more concisely as:
.. code-block:: c++
b_loop_cond.end_with_conditional (
i >= n,
- b_after_loop,
- b_loop_body);
+ b_after_loop, // on_true
+ b_loop_body); // on_false
Next, we populate the body of the loop.
@@ -229,6 +229,7 @@ We build the comparison using :c:func:`gcc_jit_context_new_comparison`:
.. code-block:: c
+ /* (i >= n) */
gcc_jit_rvalue *guard =
gcc_jit_context_new_comparison (
ctxt, NULL,
@@ -241,7 +242,16 @@ and can then use this to add `b_loop_cond`'s sole statement, via
.. code-block:: c
- gcc_jit_block_end_with_conditional (b_loop_cond, NULL, guard);
+ /* Equivalent to:
+ if (guard)
+ goto after_loop;
+ else
+ goto loop_body; */
+ gcc_jit_block_end_with_conditional (
+ b_loop_cond, NULL,
+ guard,
+ b_after_loop, /* on_true */
+ b_loop_body); /* on_false */
Next, we populate the body of the loop.
@@ -37,7 +37,7 @@ In-memory compilation
This calls into GCC and builds the code, returning a
`gcc_jit_result *`.
- If this is non-NULL, the caller becomes responsible for
+ If the result is non-NULL, the caller becomes responsible for
calling :func:`gcc_jit_result_release` on it once they're done
with it.
@@ -138,7 +138,7 @@ be responsible for all of the rest:
If no errors occurred, this will be NULL.
If you are wrapping the C API for a higher-level language that supports
-exception-handling, you may instead by interested in the last error that
+exception-handling, you may instead be interested in the last error that
occurred on the context, so that you can embed this in an exception:
.. function:: const char *\
@@ -233,7 +233,7 @@ Binary Operation C equivalent
For pointer addition, use :c:func:`gcc_jit_context_new_array_access`.
-.. c:macro:: GCC_JIT_BINARY_OP_MINUS`
+.. c:macro:: GCC_JIT_BINARY_OP_MINUS
Subtraction of arithmetic values; analogous to: