tutorial/t2.c, tutorial/t5.c: implement tail calls from a
function to itself.
+ * jit/jit-function.c, jit/jit-reg-alloc.c, jit/jit-rules-arm.c,
+ jit/jit-rules-interp.c, jit/jit-rules-x86.c, jit/jit-rules.h:
+ implement global register allocation for parameters in stack slots.
+
2004-06-10 Rhys Weatherley <rweather@southern-storm.com.au>
* jit/jit-apply-arm.c, jit/jit-gen-arm.c, jit/jit-gen-arm.h,
insn->value1->frame_offset =
jit_value_get_nint_constant(insn->value2);
insn->value1->in_register = 0;
- insn->value1->in_frame = 1;
insn->value1->has_frame_offset = 1;
- insn->value1->has_global_register = 0; /* Disable globals */
+ if(insn->value1->has_global_register)
+ {
+ insn->value1->in_global_register = 1;
+ _jit_gen_load_global(gen, insn->value1);
+ }
+ else
+ {
+ insn->value1->in_frame = 1;
+ }
}
break;
value = (jit_value_t)(block->data + posn *
sizeof(struct _jit_value));
if(value->global_candidate && value->usage_count >= JIT_MIN_USED &&
- !(value->is_addressable) && !(value->is_volatile) &&
- (!(value->is_parameter) || value->is_reg_parameter))
+ !(value->is_addressable) && !(value->is_volatile))
{
/* Insert this candidate into the list, ordered on count */
index = 0;
jit_cache_end_output();
}
+void _jit_gen_load_global(jit_gencode_t gen, jit_value_t value)
+{
+ jit_cache_setup_output(32);
+ arm_load_membase(inst, _jit_reg_info[value->global_reg].cpu_reg,
+ ARM_FP, value->frame_offset);
+ jit_cache_end_output();
+}
+
void _jit_gen_fix_value(jit_value_t value)
{
if(!(value->has_frame_offset) && !(value->is_constant))
adjust_working(gen, 1);
}
+/*@
+ * @deftypefun void _jit_gen_load_global (jit_gencode_t gen, jit_value_t value)
+ * Load the contents of @code{value} into its corresponding global register.
+ * This is used at the head of a function to pull parameters out of stack
+ * slots into their global register copies.
+ * @end deftypefun
+@*/
+void _jit_gen_load_global(jit_gencode_t gen, jit_value_t value)
+{
+ /* Global registers are not used in the interpreted back end */
+}
+
/*@
* @deftypefun void _jit_gen_fix_value (jit_value_t value)
* Fix the position of a value within the local variable frame.
jit_cache_end_output();
}
+void _jit_gen_load_global(jit_gencode_t gen, jit_value_t value)
+{
+ jit_cache_setup_output(16);
+ x86_mov_reg_membase(inst, _jit_reg_info[value->global_reg].cpu_reg,
+ X86_EBP, value->frame_offset, sizeof(void *));
+ jit_cache_end_output();
+}
+
void _jit_gen_fix_value(jit_value_t value)
{
if(!(value->has_frame_offset) && !(value->is_constant))
int other_reg, int value_used);
void _jit_gen_load_value
(jit_gencode_t gen, int reg, int other_reg, jit_value_t value);
+void _jit_gen_load_global(jit_gencode_t gen, jit_value_t value);
void _jit_gen_fix_value(jit_value_t value);
void _jit_gen_insn(jit_gencode_t gen, jit_function_t func,
jit_block_t block, jit_insn_t insn);