This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix problem with late insns in sibcall


On Tue, Apr 29, 2003 at 06:03:34PM -0400, Richard Kenner wrote:
>    procedure
>      Shift (Point : in out Point_T)
>    is
>       procedure
>         Shift (Value : in out Natural )
>       is
>       begin
>          Value := Value + 1;
>       end;
>    begin
>       Shift (Point.X);
>    end;

I'm a bit confused about the calling conventions here.  I would
have expected an in-out parameter to be treated like a reference
type in C++.  That is, the bit that gets put into the hard register
is the *address* of the data.

Certainly we have no problem converting

	struct Point_T {
	  int X, Y;
	};

	void Shift(int &Value)
	{
	  Value += 1;
	}

	void Shift(Point_T &Point)
	{
	  Shift(Point.X);
	}

to use sibcalls.  Indeed, the later function compiles to

_Z5ShiftR7Point_T:
        jmp     _Z5ShiftRi

which is exactly what you'd hope for.


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]