[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" */
			/* and move the data into it. */
			LOUT = ppc_op_mr(w, r);
			/* XXX Why isn't there a register swap? */
		/* Pin the register. */
		 * 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 )
		    LOUT = ppc_op_mr(w, r);

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) {
			insn_RRR(_ADDU, o, r, REG_i0);
			debug(("	mov	%s,%s\n", regname(o), regname(r)));
			r = o;

		resreg[res_idx++] = r;

Perhaps you should try without the rreg_ideal_int()?

>             Regards,
>             Kevin K.


More information about the kaffe mailing list