This is the mail archive of the gcc@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: Sibcall on recursive functions


On Thu, Jan 14, 2010 at 3:12 AM, Paulo J. Matos <pocmatos@gmail.com> wrote:
> Gcc4.3.4 when I compile functions with : -Os -fno-inline-functions
> -fno-inline-small-functions
> calls TARGET_FUNCTION_OK_FOR_SIBCALL for the fact_aux call in facti,
> but it does not Âcall TARGET_FUNCTION_OK_FOR_SIBCALL for the fact_aux
> recursive call, why?

Because it is not really sibcalled but rather turned into a loop via
tail recursion.  This is almost always profitable and never changes
how many times the stack gets restored (unless there is an alloca in
the function which is checked for inside the optimization).

Thanks,
Andrew Pinski


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