On Tue, 2012-11-20 at 09:36 +0200, Stefan Kristiansson wrote: > On Tue, Nov 20, 2012 at 09:23:30AM +0200, Stefan Kristiansson wrote: > > On Tue, Nov 20, 2012 at 08:08:01AM +0100, Jonas Bonn wrote: > > > > > Why did we choose r3 for the struct return location? > > > > > > > It was not so much "us" choosing it. > > gcc has done it all along, creating a "defacto" standard for it, > > now we are just documenting it. > > That said, I don't see using r3 as a bad choice, do you? > >
The register that immediately jumps out at me as a natural choice is r11... that register then becomes an IN/OUT parameter and doesn't disrupt the regular allocation of parameter registers where r3 usually is the first parameter. But I've given this about 3 minutes of thought; maybe r3 is better. I would, however, be curious to know why in that case... > > After actually checking what had changed I understand your question, > that text was supposed to be _added_ to what already was in the > section "Functions Returning Structures or Unions", not replace it. > The new text clarifies structures returned by _value_ > > Julius, the section should be like this in it's whole: > > 16.2.5 Functions Returning Structures or Unions > > A function that returns a structure or union places the address of the > structure or > union in the general-purpose RV register. > > A function that returns a structure by value expects the location > where that > structure is to be placed to be supplied in function parameter word 0 (R3). This means we put X in r3 going into the function call and get X in r11 coming out... what's the point? /Jonas _______________________________________________ OpenRISC mailing list [email protected] http://lists.openrisc.net/listinfo/openrisc
