1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-21 19:20:21 +02:00

Add label predicates

* include/lightning.h, lib/lightning.c: Add three predicates
	to query information about labels. jit_forward_p(label)
	will return non zero if the label is "forward", that is
	need a call to jit_link(label), jit_indirect_p(label)
	that returns non zero if the label was created with the
	jit_indirect() call, and jit_target_p(label) that will
	return non zero if there is at least one jump patched
	to land at that label.
This commit is contained in:
pcpa 2014-10-21 15:32:24 -02:00
parent a43fb63055
commit 9c5e2b511e
3 changed files with 35 additions and 0 deletions

View file

@ -1127,6 +1127,24 @@ _jit_link(jit_state_t *_jit, jit_node_t *node)
++_jitc->blocks.offset;
}
jit_bool_t
_jit_forward_p(jit_state_t *_jit, jit_node_t *node)
{
return (node->code == jit_code_label && !node->next && node != _jitc->tail);
}
jit_bool_t
_jit_indirect_p(jit_state_t *_jit, jit_node_t *node)
{
return (node->code == jit_code_label && !!(node->flag & jit_flag_use));
}
jit_bool_t
_jit_target_p(jit_state_t *_jit, jit_node_t *node)
{
return (node->code == jit_code_label && !!node->link);
}
void
_jit_prepare(jit_state_t *_jit)
{