]> git.unchartedbackwaters.co.uk Git - francis/libjit.git/commitdiff
add jit_function_reserve_label function
authorAleksey Demakov <ademakov@gmail.com>
Sun, 7 Oct 2007 14:16:50 +0000 (14:16 +0000)
committerAleksey Demakov <ademakov@gmail.com>
Sun, 7 Oct 2007 14:16:50 +0000 (14:16 +0000)
ChangeLog
include/jit/jit-function.h
jit/jit-function.c

index 2554779205d19ba853fbbd6dfa9335106c78fe71..2c30f58b7d56305a3f41cd668f674eac966a708b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,10 @@
        * 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.
index b9d6db78b45ade77deee0f05a3a09dc5582f791c..d2851bb7ef971c31c5a137fbf5f12354029d8e09 100644 (file)
@@ -75,6 +75,7 @@ void jit_function_set_optimization_level
 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
 };
index 0c0bcfb2c4e4658af39b39d85cad2a47ef9b4267..b5afd9a0f0014a0244107bc5eb548c6338dfd3dc 100644 (file)
@@ -1635,3 +1635,23 @@ unsigned int jit_function_get_max_optimization_level(void)
        /* 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)++;
+}