]> git.unchartedbackwaters.co.uk Git - francis/libjit.git/commitdiff
Add a TODO() macro to print unimplemented warnings. Fix some
authorThomas Cort <linuxgeek@gmail.com>
Tue, 15 Aug 2006 01:08:59 +0000 (01:08 +0000)
committerThomas Cort <linuxgeek@gmail.com>
Tue, 15 Aug 2006 01:08:59 +0000 (01:08 +0000)
casting warnings. Implement _jit_gen_redirector(...). Fix
JIT_CDECL_WORD_REG_PARAMS to use the correct parameter
registers. Add some stack push and pop instructions.

ChangeLog
jit/jit-rules-alpha.c
jit/jit-rules-alpha.h
jit/jit-rules-alpha.ins

index 4cee899eaba416a907abbe3811d24126ab1926d7..ccee0292fb50c0f109d9ff357bc7aaf11b393cc8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-08-15  Thomas Cort  <linuxgeek@gmail.com>
+       * jit/jit-rules-alpha.c jit/jit-rules-alpha.h jit/jit-rules-alpha.ins
+       Add a TODO() macro to print unimplemented warnings. Fix some 
+       casting warnings. Implement _jit_gen_redirector(...). Fix
+       JIT_CDECL_WORD_REG_PARAMS to use the correct parameter 
+       registers. Add some stack push and pop instructions.
+
 2006-08-15  Kirill Kononenko  <Kirill.Kononenko@gmail.com>
 
        * configure.in: add --enable-signals option;
index af41e563e409306180087c330c53e4919f22a628..c4b621fed0431c6e37eeeff7d73737854f66c4a1 100644 (file)
@@ -108,6 +108,12 @@ void _jit_init_backend(void) {
        /* Nothing to do here */;
 }
 
+#define TODO()          \
+        do { \
+                fprintf(stderr, "TODO at %s, %d\n", __FILE__, (int)__LINE__); \
+        } while (0)
+
+
 /*
  * Get the ELF machine and ABI type information for this platform. The 
  * machine field should be set to one of the EM_* values in 
@@ -198,7 +204,7 @@ void _jit_gen_epilog(jit_gencode_t gen, jit_function_t func) {
                alpha_inst code = (alpha_inst) fixup;
                next     = (void **)(fixup[0]);
 
-               _alpha_li64(code,ALPHA_AT,inst);
+               _alpha_li64(code,ALPHA_AT,(long int)inst);
                alpha_jmp(code,ALPHA_ZERO,ALPHA_AT,1);
 
                fixup    = next;
@@ -293,7 +299,7 @@ int _jit_create_call_return_insns(jit_function_t func, jit_type_t signature, jit
  * stack location for a subsequent indirect call.
  */
 int _jit_setup_indirect_pointer(jit_function_t func, jit_value_t value) {
-       /* NOT IMPLEMENTED YET */
+       TODO();
        return 0;
 }
 
@@ -301,14 +307,14 @@ int _jit_setup_indirect_pointer(jit_function_t func, jit_value_t value) {
  * TODO: write what this function is supposed to do
  */
 void _jit_gen_spill_top(jit_gencode_t gen, int reg, jit_value_t value, int pop) {
-       /* NOT IMPLEMENTED YET */;
+       TODO();
 }
 
 /*
  * TODO: write what this function is supposed to do
  */
 void _jit_gen_spill_global(jit_gencode_t gen, int reg, jit_value_t value) {
-       /* NOT IMPLEMENTED YET */;
+       TODO();
 }
 
 /*
@@ -427,7 +433,7 @@ void _jit_gen_start_block(jit_gencode_t gen, jit_block_t block) {
                alpha_inst code = (alpha_inst) fixup;
                next     = (void **)(fixup[0]);
 
-               _alpha_li64(code,ALPHA_AT,(gen->posn.ptr));
+               _alpha_li64(code,ALPHA_AT,(long int)(gen->posn.ptr));
                alpha_jmp(code,ALPHA_ZERO,ALPHA_AT,1);
 
                fixup    = next;
@@ -533,11 +539,7 @@ void _jit_gen_load_value(jit_gencode_t gen, int reg, int other_reg, jit_value_t
 }
 
 void _jit_gen_load_global(jit_gencode_t gen, int reg, jit_value_t value) {
-/*
-       NOT IMPLEMENTED YET!
-       jit_cache_setup_output();
-       jit_cache_end_output();
-*/
+       TODO();
 }
 
 
@@ -548,8 +550,20 @@ void _jit_gen_load_global(jit_gencode_t gen, int reg, jit_value_t value) {
  * version after recompilation.
  */
 void *_jit_gen_redirector(jit_gencode_t gen, jit_function_t func) {
-       /* NOT IMPLEMENTED YET */
-       return NULL;
+       void *ptr, *entry;
+       alpha_inst inst = (alpha_inst) gen->posn.ptr;
+
+       if (!jit_cache_check_for_n(&(gen->posn), 8*6)) {
+               jit_cache_mark_full(&(gen->posn));
+               return NULL;
+       }
+
+       ptr = (void *)&(func->entry_point);
+       entry = gen->posn.ptr;
+
+       alpha_call(inst, ptr);
+
+       return entry;
 }
 
 /*
@@ -574,7 +588,7 @@ void _jit_gen_insn(jit_gencode_t gen, jit_function_t func, jit_block_t block, ji
  * TODO: write what this function is supposed to do
  */
 void _jit_gen_exch_top(jit_gencode_t gen, int reg, int pop) {
-       /* NOT IMPLEMENTED YET */;
+       TODO();
 }
 
 void _jit_gen_fix_value(jit_value_t value) {
index 74dc560b0f8b65b1728d9d9c2b00da9bd724f89b..adb8e035aa55ec9d092c83055bcb0f3c63758624 100644 (file)
@@ -198,10 +198,10 @@ extern    "C" {
 /*
  * Parameter passing rules.
  */
-#define JIT_CDECL_WORD_REG_PARAMS      {9,10,11,12,13,14,-1}
+#define JIT_CDECL_WORD_REG_PARAMS      {16,17,18,19,20,21,-1}
 #define JIT_MAX_WORD_REG_PARAMS                6
-#define JIT_INITIAL_STACK_OFFSET       0
-#define JIT_INITIAL_FRAME_SIZE                 (14*8)
+#define JIT_INITIAL_STACK_OFFSET       (14*8)
+#define JIT_INITIAL_FRAME_SIZE                 (sizeof(void*))
 
 #ifdef __cplusplus
 };
index 4d6ba61e4fc01dade85fb2287dbffd9a2e3cbc09..62b40e0f4555474fbdd728b9acf37c8dbf5455b9 100644 (file)
@@ -402,3 +402,38 @@ JIT_OP_CALL_EXTERNAL:
                alpha_call(inst, (insn->dest));
        }
 
+/*
+ * Stack pushes and pops.
+ */
+
+JIT_OP_RETURN_REG: manual
+        [] -> {
+               /* Nothing to do here */;
+       }
+
+JIT_OP_PUSH_INT: unary_note
+       [imm] -> {
+               alpha_li(inst,ALPHA_AT,$1);
+               alpha_stq(inst,ALPHA_AT,ALPHA_SP,0);
+               alpha_lda(inst,ALPHA_SP,ALPHA_SP,-8);
+       }
+       [reg] -> {
+               alpha_stq(inst,$1,ALPHA_SP,0);
+               alpha_lda(inst,ALPHA_SP,ALPHA_SP,-8);
+       }
+
+JIT_OP_PUSH_LONG: unary_note
+       [imm] -> {
+               alpha_li(inst,ALPHA_AT,$1);
+               alpha_stq(inst,ALPHA_AT,ALPHA_SP,0);
+               alpha_lda(inst,ALPHA_SP,ALPHA_SP,-8);
+       }
+       [reg] -> {
+               alpha_stq(inst,$1,ALPHA_SP,0);
+               alpha_lda(inst,ALPHA_SP,ALPHA_SP,-8);
+       }
+
+JIT_OP_POP_STACK:
+       [] -> {
+               alpha_lda(inst,ALPHA_SP,ALPHA_SP,insn->value1->address);
+       }