This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Don't allow sibcalls on nested functions
- From: Richard Henderson <rth at redhat dot com>
- To: Olivier Hainque <hainque at ACT-Europe dot FR>
- Cc: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 30 Apr 2003 16:17:37 -0700
- Subject: Re: Don't allow sibcalls on nested functions
- References: <20030428125251.A12198@rome.int.act-europe.fr>
On Mon, Apr 28, 2003 at 12:52:51PM +0200, Olivier Hainque wrote:
> > The -O2 -gnatp asm output for histograms.adb shows the problem:
> >
> > histograms__display:
> > st %o0, [%sp+68] <========== (1)
> >
> > ld [%o1], %o0
> > sethi %hi(...__wrapper_for_check_zoom_factor.2), %g1
> > jmpl %g1 + %lo(...__wrapper_for_check_zoom_factor.2), %g0
>
> > histograms__display__wrapper_for_check_zoom_factor.2:
> > save %sp, -120, %sp
> > st %i0, [%fp+68] <========== (4)
Ok, I see now, thanks.
Yes, I agree that this can only happen with one nesting depth.
I also agree that this patch solves the problem.
Ideally we'd note if there are any DECL_NONLOCAL_P parameters
and variables in the outer function, and if there aren't, allow
the tail-call. This is non-trivial because of having to track
down all the decls involved.
An even further refinement would be to note which variables are
used by which subroutines, but then we're getting into IPA, and
there's *lots* of things we'd like to be able to do there. ;-)
r~