This is the mail archive of the 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 Wed, Apr 30, 2003 at 09:29:03PM -0400, Richard Kenner wrote:
> So
>     procedure Shift (Value : in out Natural ) is
>     begin
>       Value := Value + By;
>     end;
> becomes
>    int Shift (int Value) { return Value + By; }

I eventually discovered this.

Personally, I think it would make the most sense for this to
be exposed to the compiler earlier.  I.e. the Ada front end
should generate

	tmp = Shift(Point.X);
	Point.X = tmp;

In this way, the store into Point.X won't be hidden inside the
CALL_PLACEHOLDER, and optimize_sibling_and_tail_recursive_calls
will notice that the call is not the last thing performed by
the function.

If we are to leave things as-is, one would also have to worry
about hard register destinations such as

	register int my_global __asm__("$9");
	int bar(void);
	void foo(void)
	  my_global = bar();

So we can only generate the sibcall when target & valreg are
identical, or target is a known-dead value such as a pseudo.


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