/* 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
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;
* 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;
}
* 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();
}
/*
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;
}
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();
}
* 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;
}
/*
* 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) {
/*
* 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
};
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);
+ }