Metadata handling
=================

Many of the structures in the 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. jit_function_set_meta, 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:

 -- Function: int jit_meta_set (jit_meta_t *LIST, int TYPE, void *DATA, jit_meta_free_func FREE_DATA, jit_function_t POOL_OWNER)
     Set a metadata value on a list.  If the TYPE is already present in the list, then its previous value will be freed.  The FREE_FUNC is called when the metadata value is freed with jit_meta_free or jit_meta_destroy.  Returns zero if out of memory.

     If 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.

 -- Function: void * jit_meta_get (jit_meta_t LIST, int TYPE)
     Get the value associated with TYPE in the specified LIST. Returns NULL if TYPE is not present.

 -- Function: void jit_meta_free (jit_meta_t *LIST, int TYPE)
     Free the metadata value in the LIST that has the specified TYPE.  Does nothing if the TYPE is not present.

 -- Function: void jit_meta_destroy (jit_meta_t *LIST)
     Destroy all of the metadata values in the specified LIST.