On Fri, Jan 8, 2010 at 3:34 PM, Ian Lance Taylor <i...@google.com> wrote:
> "Paulo J. Matos" <pocma...@gmail.com> writes:
>
>> I just noticed that the pro_and_epilogue pass in gcc3.4.3 for certain
>> functions is ran multiple times with sibcalls enabled. Why is that?
>>
>> What I did was to put a printf on the epilogue and sibcall_epilogue
>> pattern so that during compilation it prints the name of the function
>> currently generating the epilogue for, however, I get a print in
>> epilogue and a print in sibcall_epilogue for the same function a
>> couple of times. Why?
>
> One obvious possibility is function cloning, but I can't remember
> whether gcc 3.4.3 did that.  Take a look at the dump file and see
> whether the function appears more than once.  If that doesn't help,
> run cc1 under a debugger and do a backtrace to find out where the
> calls are coming from.
>

Just checked and it happens with this example:
extern long foo(int *r, int d, long n);

long udiv3232(long n, long d)
{
    int q;

    if (d < 0)
        return foo(0, (int) d, n);

    return (long) q;
}

It calls sibcall_epilogue for foo and normal epilogue for returning q,
which is interesting and logic. So, now I am not so surprised.

Thanks,

Paulo Matos

> Ian
>



-- 
Paulo Jorge Matos - pocmatos at gmail.com
http://www.pmatos.net

Reply via email to