This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Optimize incoming function arguments passed in multiple locations


On Dec 13, 2000, Alexandre Oliva <aoliva@redhat.com> wrote:

> from  Alexandre Oliva  <aoliva@redhat.com>

> 	* function.c (assign_parms): Optimize incoming PARALLELs into
> 	REGs if possible.

> Index: gcc/function.c
> ===================================================================
> RCS file: /cvs/gcc/egcs/gcc/function.c,v
> retrieving revision 1.233
> diff -u -p -r1.233 function.c
> --- gcc/function.c 2000/11/30 06:31:17 1.233
> +++ gcc/function.c 2000/12/13 21:19:59
> @@ -4549,6 +4549,26 @@ assign_parms (fndecl)
>  	  && nominal_mode != BLKmode && nominal_mode != passed_mode)
>  	stack_parm = 0;
 
> +      /* When an argument is passed in multiple locations, we can't
> +	 make use of this information, but we can save some copying if
> +	 the whole argument is passed in a single register.  */
> +      if (GET_CODE (entry_parm) == PARALLEL
> +	  && nominal_mode != BLKmode && passed_mode != BLKmode)
> +	{
> +	  int i, len = XVECLEN (entry_parm, 0);
> +
> +	  for (i = 0; i < len; i++)
> +	    if (XEXP (XVECEXP (entry_parm, 0, i), 0) != NULL_RTX
> +		&& GET_CODE (XEXP (XVECEXP (entry_parm, 0, i), 0)) == REG
> +		&& (GET_MODE (XEXP (XVECEXP (entry_parm, 0, i), 0))
> +		    == passed_mode)
> +		&& XINT (XEXP (XVECEXP (entry_parm, 0, i), 1), 0) == 0)
> +	      {
> +		entry_parm = XEXP (XVECEXP (entry_parm, 0, i), 0);
> +		break;
> +	      }
> +	}
> +
>        /* ENTRY_PARM is an RTX for the parameter as it arrives,
>  	 in the mode in which it arrives.
>  	 STACK_PARM is an RTX for a stack slot where the parameter can live

I've just noticed that at least DWARF2 debugging info generator isn't
prepared to handle PARALLELs in the DECL_INCOMING_RTL of a PARM_DECL.
In general, this shouldn't be necessary because, so far, all cases
that needed PARALLELs had declared_type != passed_type.
Unfortunately, that's not the case of the ABI I'm working on.

I simple fix was to copy entry_parm to DECL_INCOMING_RTL again (it had
been copied a couple of lines before), when modifying entry_parm.  Is
this additional change ok to install?  (Currently testing with the new
port; success so far)

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]