
@c Extracted automatically from ../jit/jit-meta.c - DO NOT EDIT


@section Metadata handling
@cindex Metadata handling
@cindex jit-meta.h

Many of the structures in the @code{libjit} library can have user-supplied
metadata associated with them.  Metadata may be used to store dependency
graphs, branch prediction information, or any other information that is
useful to optimizers or code generators.

Metadata can also be used by higher level user code to store information
about the structures that is specific to the user's virtual machine or
language.

The library structures have special-purpose metadata routines associated
with them (e.g. @code{jit_function_set_meta}, @code{jit_block_get_meta}).
However, sometimes you may wish to create your own metadata lists and
attach them to your own structures.  The functions below enable you
to do this:


@deftypefun int jit_meta_set (jit_meta_t *@var{list}, int @var{type}, void *@var{data}, jit_meta_free_func @var{free_data}, jit_function_t @var{pool_owner})
Set a metadata value on a list.  If the @var{type} is already present
in the list, then its previous value will be freed.  The @var{free_func}
is called when the metadata value is freed with @code{jit_meta_free}
or @code{jit_meta_destroy}.  Returns zero if out of memory.

If @var{pool_owner} is not NULL, then the metadata value will persist
until the specified function is finished building.  Normally you would
set this to NULL.

Metadata type values of 10000 or greater are reserved for internal use.
They should never be used by external user code.
@end deftypefun

@deftypefun {void *} jit_meta_get (jit_meta_t @var{list}, int @var{type})
Get the value associated with @var{type} in the specified @var{list}.
Returns NULL if @var{type} is not present.
@end deftypefun

@deftypefun void jit_meta_free (jit_meta_t *@var{list}, int @var{type})
Free the metadata value in the @var{list} that has the
specified @var{type}.  Does nothing if the @var{type}
is not present.
@end deftypefun

@deftypefun void jit_meta_destroy (jit_meta_t *@var{list})
Destroy all of the metadata values in the specified @var{list}.
@end deftypefun

