Hi Eric,

The __builtin_apply/__builtin_return mechanism is broken on SPARC in 4.x 
because of

2004-03-17  Eric Christopher  <[EMAIL PROTECTED]>

        * builtins.c (apply_args_size): Use reg_raw_mode.
        (apply_result_size): Ditto.

http://gcc.gnu.org/ml/gcc-patches/2004-03/msg01422.html


I think the change breaks  __builtin_apply/__builtin_return on every platform 
that can return values in several contiguous registers, because the entry for 
FUNCTION_VALUE_REGNO_P in the manual reads:

 -- Macro: FUNCTION_VALUE_REGNO_P (REGNO)
     A C expression that is nonzero if REGNO is the number of a hard
     register in which the values of called function may come back.

     A register whose use for returning values is limited to serving as
     the second of a pair (for a value of type `double', say) need not
     be recognized by this macro.  So for most machines, this definition
     suffices:

          #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)


The SPARC port follows this recommendation and, consequently, the return value 
is only partially reloaded when its mode is larger than the reg_raw_mode.


A solution could be to change the definition of FUNCTION_VALUE_REGNO_P and 
require all potential return registers to be recognized by the macro.  But 
FUNCTION_VALUE_REGNO_P is used outside of builtins.c, in lcm.c and rtlanal.c, 
so this could pessimize the common case.

What do you think?

Thanks in advance.

-- 
Eric Botcazou

Reply via email to