Re: nested function question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le 11/09/2012 15:25, Ian Lance Taylor a écrit :
> On Tue, Sep 11, 2012 at 2:15 AM, Aurelien Buhrig
> <aurelien.buhrig.gcc@xxxxxxxxx> wrote:
>>
>>
>>
>>> Hi,
>>>
>>> The gcc.c-torture/execute/nestfunc-3.c test fails on a private target. I
>>> suspect this is because the STATIC_CHAIN_REGNUM, which is not a call
>>> used register, is used by the caller function (main), modified by the
>>> trampoline, but not restored upon nested function return.
>>>
>>> Should the STATIC_CHAIN_REGNUM be defined so that
>>> CALL_USED_REGISTERS[STATIC_CHAIN_REGNUM] == 0?
>>
>> The question is rather:
>> Should the STATIC_CHAIN_REGNUM be defined so that
>> CALL_USED_REGISTERS[STATIC_CHAIN_REGNUM] == 1? Or is it possible to make
>> nested functions work if CALL_USED_REGISTERS[STATIC_CHAIN_REGNUM] == 0?
> 
> The static chain register is normally a call-used register or a fixed
> register or a stack location.  It may be possible to make it work with
> a call-saved register, but clearly it is essential that the call to
> the nested function restore the original value of the register before
> returning.
> 
> Ian
> 


Thank you Ian for your reply.

I think I will use last call-used register that was used for arg passing
before. So nested functions will have less arg registers, but a better
epilogue.

Aurélien




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux