* jit/jit-rules-x86.ins (JIT_OP_JUMP_TABLE): fix jump table code
generation.
+ * include/jit/jit-function.h:
+ * jit/jit-function.c (jit_function_reserve_label): add new function
+ to create labels for jump tables.
+
2007-06-11 Aleksey Demakov <ademakov@gmail.com>
* jit/jit-insn.c (accumulate_relative_offset): remove.
unsigned int jit_function_get_optimization_level
(jit_function_t func) JIT_NOTHROW;
unsigned int jit_function_get_max_optimization_level(void) JIT_NOTHROW;
+jit_label_t jit_function_reserve_label(jit_function_t func) JIT_NOTHROW;
#ifdef __cplusplus
};
/* TODO - implement more than basic optimization */
return 0;
}
+
+/*@
+ * @deftypefun {jit_label_t} jit_function_reserve_label (jit_function_t func)
+ * Allocate a new label for later use within the function @code{func}. Most
+ * instructions that require a label could perform label allocation themselves.
+ * A separate label allocation could be useful to fill a jump table with
+ * identical entries.
+ * @end deftypefun
+@*/
+jit_label_t
+jit_function_reserve_label(jit_function_t func)
+{
+ /* Ensure that we have a function builder */
+ if(!_jit_function_ensure_builder(func))
+ {
+ return jit_label_undefined;
+ }
+
+ return (func->builder->next_label)++;
+}