This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
apply_result_size vs FUNCTION_VALUE_REGNO_P
- From: Eric Botcazou <ebotcazou at libertysurf dot fr>
- To: Eric Christopher <echristo at redhat dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 7 Apr 2005 15:49:01 +0200
- Subject: apply_result_size vs FUNCTION_VALUE_REGNO_P
Hi Eric,
The __builtin_apply/__builtin_return mechanism is broken on SPARC in 4.x
because of
2004-03-17 Eric Christopher <echristo@redhat.com>
* 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