This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix problem with late insns in sibcall
- From: Richard Henderson <rth at redhat dot com>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: gcc-patches at gcc dot gnu dot org, hainque at act-europe dot fr
- Date: Wed, 30 Apr 2003 19:37:25 -0700
- Subject: Re: Fix problem with late insns in sibcall
- References: <10305010129.AA20761@vlsi1.ultra.nyu.edu>
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
Shift(Point.X);
==>
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.
r~