Create a basic block of the given name.
The name may be none
, but providing meaningful names is often helpful
when debugging: it may show up in dumps of the internal representation,
and in error messages.
Upcast from block to object.
Get the associated Func
of the Block
Add evaluation of an rvalue, discarding the result (e.g. a function call that “returns” void).
This is equivalent to this C code:
(void)rvalue;
Add evaluation of an rvalue, assigning the result to the given lvalue.
This is roughly equivalent to this C code:
lvalue = rvalue;
Add evaluation of an rvalue, using the result to modify an lvalue.
This is analogous to +=
and friends:
lvalue += rvalue;
lvalue *= rvalue;
lvalue /= rvalues
// ...
Add a no-op textual comment to the internal representation of the code.
It will be optimized away, but will be visible in the dumps seen via
BoolOption.DumpInitialTree
and BoolOption.DumpInitialGimple
,
and thus may be of use when debugging how your project’s internal representation
gets converted to the libgccjit IR.
Terminate a block by adding evaluation of an rvalue, branching on the result to the appropriate successor block.
This is roughly equivalent to this C code:
if (bval)
goto on_true;
else
goto on_false;
Terminate a block by adding a jump to the given target block.
This is roughly equivalent to this C code:
goto target;
Terminate a block by adding evaluation of an rvalue, returning the value.
This is roughly equivalent to this C code:
return expression;
Terminate a block by adding a valueless return, for use within a function with void
return type.
This is equivalent to this C code:
return;
Terminate a block by adding evalation of an rvalue, then performing a multiway branch.
This is roughly equivalent to this C code:
switch (expr)
{
default:
goto default_block;
case C0.min_value ... C0.max_value:
goto C0.dest_block;
case C1.min_value ... C1.max_value:
goto C1.dest_block;
/*...etc...*/
case C[N - 1].min_value ... C[N - 1].max_value:
goto C[N - 1].dest_block;
}
Note #
expr
must be of the same integer type as all of themin_value
andmax_value
within the cases.- The ranges of the
cases
must not overlap (or have duplicate values).
Create an ExtendedAsm
for an extended asm statement that may perform jumps, and use it to terminate
the given block. This is equivalent to the goto
qualifier in C’s extended asm syntax.
Note #
fallthrough
can benone
. If it issome
, it specifies the block to fall through to after the statement.- This is needed since each
Block
must have a single exit point, as a basic block: you can’t jump from the middle of a block. - A
goto
is implicitly added after the asm to handle the fallthrough case, which is equivalent to what would have happened in the C case.