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


The @code{libjit} library provides a number of functions for
performing register allocation within basic blocks so that you
mostly don't have to worry about it:


@deftypefun void _jit_regs_lookup (char *name)
Get the pseudo register by its name.
@end deftypefun

@deftypefun int _jit_regs_needs_long_pair (jit_type_t type)
Determine if a type requires a long register pair.
@end deftypefun

@deftypefun int _jit_regs_get_cpu (jit_gencode_t gen, int reg, int *other_reg)
Get the CPU register that corresponds to a pseudo register.
"other_reg" will be set to the other register in a pair,
or -1 if the register is not part of a pair.
@end deftypefun

@deftypefun void _jit_regs_alloc_global (jit_gencode_t gen, jit_function_t func)
Perform global register allocation on the values in @code{func}.
This is called during function compilation just after variable
liveness has been computed.
@end deftypefun

@deftypefun void _jit_regs_init_for_block (jit_gencode_t gen)
Initialize the register allocation state for a new block.
@end deftypefun

@deftypefun void _jit_regs_spill_all (jit_gencode_t gen)
Spill all of the temporary registers to memory locations.
Normally used at the end of a block, but may also be used in
situations where a value must be in a certain register and
it is too hard to swap things around to put it there.
@end deftypefun

@deftypefun void _jit_regs_set_incoming (jit_gencode_t gen, int reg, jit_value_t value)
Set pseudo register @code{reg} to record that it currently holds the
contents of @code{value}.  The register must not contain any other
live value at this point.
@end deftypefun

@deftypefun void _jit_regs_set_outgoing (jit_gencode_t gen, int reg, jit_value_t value)
Load the contents of @code{value} into pseudo register @code{reg},
spilling out the current contents.  This is used to set up outgoing
parameters for a function call.
@end deftypefun

@deftypefun void _jit_regs_force_out (jit_gencode_t gen, jit_value_t value, int is_dest)
If @code{value} is currently in a register, then force its value out
into the stack frame.  The @code{is_dest} flag indicates that the value
will be a destination, so we don't care about the original value.
@end deftypefun

@deftypefun int _jit_regs_load_value (jit_gencode_t gen, jit_value_t value, int destroy, int used_again)
Load a value into any register that is suitable and return that register.
If the value needs a long pair, then this will return the first register
in the pair.  Returns -1 if the value will not fit into any register.

If @code{destroy} is non-zero, then we are about to destroy the register,
so the system must make sure that such destruction will not side-effect
@code{value} or any of the other values currently in that register.

If @code{used_again} is non-zero, then it indicates that the value is
used again further down the block.
@end deftypefun

