This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [arm, patch] Remove redundant promotion of function arguments
On Fri, 2004-04-16 at 12:28, Paul Brook wrote:
> > There's a problem with the ARM implementation. Specifically, you've
> > changed the ABI for the 'ATPCS' and APCS. Previously those ABIs would
> > promote things somewhat randomly (varies depending on the -march value)
> > at the caller side, so you need TARGET_PROMOTE_PROTOTYPES to return TRUE
> > when the ABI is not AAPCS conformant.
>
> Ok. I only tested current gcc, which seemed to do the right thing.
>
> > You should also poison PROMOTE_FOR_CALL_ONLY.
>
> The patch below does both these.
> It also catches some uses of PROMOTE_FOR_CALL_ONLY that I missed.
>
> Tested on sparc-sun-solaris2.8 and cross-compiler to arm-none-elf.
> Ok?
>
> Paul
>
> 2004-04-15 Paul Brook <paul@codesourcery.com>
>
> * calls.c (precompute_arguments): Change ifdef PROMOTE_FOR_CALL_ONLY
> to !PROMOTE_MODE.
> * function.c (assign_temp): Ditto.
> * system.h (PROMOTE_FOR_CALL_ONLY): Poison.
> * config/arm/arm.c (arm_promote_prototypes): New function.
> (TARGET_PROMOTE_PROTOTYPES): Use it.
This is OK.
However,
> Index: calls.c
> ===================================================================
> RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/calls.c,v
> retrieving revision 1.329
> diff -u -p -r1.329 calls.c
> --- a/calls.c 5 Apr 2004 12:24:59 -0000 1.329
> +++ b/calls.c 15 Apr 2004 14:19:49 -0000
> @@ -1407,7 +1407,7 @@ precompute_arguments (int flags, int num
> args[i].value
> = convert_modes (args[i].mode, mode,
> args[i].value, args[i].unsignedp);
> -#ifdef PROMOTE_FOR_CALL_ONLY
> +#ifndef PROMOTE_MODE
> /* CSE will replace this only if it contains args[i].value
> pseudo, so convert it down to the declared mode using
> a SUBREG. */
The logic of this code (not the change you are making) escapes me. Why
would we only want to do this if PROMOTE_FOR_CALL_ONLY (in the old
logic)? It seems to me that we should do it for any promotion.
R.