Alien-LibJIT
view release on metacpan or search on metacpan
libjit/jit/jit-block.c view on Meta::CPAN
* Free metadata of a specific type on a block. Does nothing if
* the @var{type} does not have any metadata associated with it.
* @end deftypefun
@*/
void
jit_block_free_meta(jit_block_t block, int type)
{
jit_meta_free(&(block->meta), type);
}
/*@
* @deftypefun int jit_block_is_reachable (jit_block_t @var{block})
* Determine if a block is reachable from some other point in
* its function. Unreachable blocks can be discarded in their
* entirety. If the JIT is uncertain as to whether a block is
* reachable, or it does not wish to perform expensive flow
* analysis to find out, then it will err on the side of caution
* and assume that it is reachable.
* @end deftypefun
@*/
int
jit_block_is_reachable(jit_block_t block)
{
jit_block_t entry;
/* Simple-minded reachability analysis that bothers only with
fall-through control flow. The block is considered reachable
if a) it is the entry block b) it has any label c) there is
fall-through path to it from one of the above. */
entry = block->func->builder->entry_block;
while(block != entry && block->label == jit_label_undefined)
{
block = block->prev;
if(block->ends_in_dead)
{
/* There is no fall-through path from the prev block */
return 0;
}
}
return 1;
}
/*@
* @deftypefun int jit_block_ends_in_dead (jit_block_t @var{block})
* Determine if a block ends in a "dead" marker. That is, control
* will not fall out through the end of the block.
* @end deftypefun
@*/
int
jit_block_ends_in_dead(jit_block_t block)
{
return block->ends_in_dead;
}
/*@
* @deftypefun int jit_block_current_is_dead (jit_function_t @var{func})
* Determine if the current point in the function is dead. That is,
* there are no existing branches or fall-throughs to this point.
* This differs slightly from @code{jit_block_ends_in_dead} in that
* this can skip past zero-length blocks that may not appear to be
* dead to find the dead block at the head of a chain of empty blocks.
* @end deftypefun
@*/
int
jit_block_current_is_dead(jit_function_t func)
{
jit_block_t block = jit_block_previous(func, 0);
return !block || jit_block_ends_in_dead(block) || !jit_block_is_reachable(block);
}
( run in 0.546 second using v1.01-cache-2.11-cpan-3d66aa2751a )