On 11/20/2012 10:29 AM, Jonas Bonn wrote:
On 11/20/2012 10:14 AM, Jeremy Bennett wrote:
On Tue, 2012-11-20 at 09:00 +0000, Jeremy Bennett wrote:
On Tue, 2012-11-20 at 09:28 +0100, Jonas Bonn wrote:
On Tue, 2012-11-20 at 08:11 +0000, Jeremy Bennett wrote:
On Tue, 2012-11-20 at 08:50 +0100, Jonas Bonn wrote:

This means we put X in r3 going into the function call and get X
in r11
coming out... what's the point?

Hi Jonas,

I asked Joern, who pointed out that in other circumstances, it is
convenient not to have register conflicts between incoming arguments and
the outgoing result.


Any chance we could get a couple of examples of "other circumstances"?

Sorry, I read that way too fast... I understand what you mean.

That said, this discussion isn't even about using r3 for the return value... just forget about that because it's not even on the table. This discussion is about not copying around a constant (the location of the struct).

The other arch's that we are talking about here effectively (using OR regs just for 'comparableness'):

i)   copy the struct location to r3
ii)  don't modify r3 during the function execution
iii) return the struct location in r3

...but they haven't actually copied the value around because it's always been in r3. But in doing so, they end up shifting the parameter registers as the first parameter ends up in r4.

We can achieve the same thing by using r11 in place of r3 as that gets us the zero-copy behaviour; plus we gain the elegance of not having the parameters shifted up a register position (whatever that's worth, but it appeals to me).

With our r3->r11 copy, we:
i)  introduce at lest one extra copy
ii) r3 and r11 are both call-clobbered regs and need to be handled accordingly

Switching to r11 gains us:
i)  one less call-clobbered paramter register (the r3 above)
ii) r11 effectively becomes callee-saved (but the save costs nothing, presumably, because this register is heavily used in the function filling the struct)

Anyway, some of the above is tantamount to bikeshedding, so I won't belabour this; but if this doesn't break things terribly, then I do think there are some subtle gains to be had from using r11.

Thanks for listening! :)
/Jonas
_______________________________________________
OpenRISC mailing list
[email protected]
http://lists.openrisc.net/listinfo/openrisc

Reply via email to