[kaffe] mipsel JIT3

Timothy Stack stack at cs.utah.edu
Fri Mar 5 15:15:03 PST 2004


> >      *Maybe* the register functions need to be a little smarter, by
> >      first choosing any register whose regno field matches the ideal
> >      number, then choosing the best register out of that set that fits
> >      the other criteria best.
> > 
> >      (This is all crash-course hacking I'm doing, so I might be
> >      totally mistaken).
> 
> The "rreg_ideal" functions did more-or-less that, if I recall (it's been
> about a year since I did the same crash course your're doing now).

Hmm, I think I ran into a similar problem rreg_ideal_int()... Here is an
excerpt from the "pusharg_int" section of the PowerPC backend:

	if( (w = next_arg_register(a, Rint, &r_count)) != -1 )
	{
#if 0
		/*
		 * We can pass the arg in a register.  Ask for the register
		 * we were given (rreg_int(1)) to be mapped to the one we
		 * want (w).
		 */
		r = rreg_ideal_int(1, w);
		if( r != w )
		{
			/* They weren't the same, flush whatever is in "w" */
			clobberRegister(w);
			/* and move the data into it. */
			LOUT = ppc_op_mr(w, r);
			/* XXX Why isn't there a register swap? */
		}
		/* Pin the register. */
		register_reserve(w);
#else
		/*
		 * can't use rreg_ideal_int because of brokeness.  its possible
		 * for this to create a move between a callee saved register
		 * and a caller saved regsiter.  And, since the pushargs are
		 * run after the function_sync that does the spill, we can lose
		 * the data in the register.
		 */
		r = rreg_int(1);
		if( r != w )
		{
		    clobberRegister(w);
		    LOUT = ppc_op_mr(w, r);
		}
		register_reserve(w);
#endif


And, here is the analogous section of the mips jitter:

	if (arg_idx < NR_ARGUMENTS) {
		o = REG_i4 + arg_idx;
		r = rreg_ideal_int(1, o);

		/* We might not get the ideal register (if the slot is global)
		 * so handle this.
		 */
		if (r != o) {
			clobberRegister(o);
			insn_RRR(_ADDU, o, r, REG_i0);
			debug(("	mov	%s,%s\n", regname(o), regname(r)));
			r = o;
		}

		register_reserve(r);
		resreg[res_idx++] = r;


Perhaps you should try without the rreg_ideal_int()?

>             Regards,
> 
>             Kevin K.

tim




More information about the kaffe mailing list