Patchwork Fix __builtin_va_start expansion after MEM_REF changes on ppc*/spu/s390* (PR target/46234)

login
register
mail settings
Submitter Jakub Jelinek
Date Nov. 4, 2010, 4:15 p.m.
Message ID <20101104161548.GW29412@tyan-ft48-01.lab.bos.redhat.com>
Download mbox | patch
Permalink /patch/70142/
State New
Headers show

Comments

Jakub Jelinek - Nov. 4, 2010, 4:15 p.m.
Hi!

While build_va_arg_indirect_ref is fine in va_arg gimplification, in
*_va_start expansion it is wrong, because the expander now no longer
handles INDIRECT_REF.  Fixed by calling build_simple_mem_ref instead,
which is what other targets are now doing.
Pat has bootstrapped/regtested this on PowerPC and Andreas tested it
on s390*.  Ok for trunk?

2010-11-04  Jakub Jelinek  <jakub@redhat.com>

	PR target/46234
	* config/rs6000/rs6000.c (rs6000_va_start): Use build_simple_mem_ref
	instead of build_va_arg_indirect_ref.
	* config/spu/spu.c (spu_va_start): Likewise.
	* config/s390/s390.c (s390_va_start): Likewise.


	Jakub
Andreas Krebbel - Nov. 4, 2010, 4:19 p.m.
On 11/04/2010 05:15 PM, Jakub Jelinek wrote:
> 2010-11-04  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR target/46234
> 	* config/rs6000/rs6000.c (rs6000_va_start): Use build_simple_mem_ref
> 	instead of build_va_arg_indirect_ref.
> 	* config/spu/spu.c (spu_va_start): Likewise.
> 	* config/s390/s390.c (s390_va_start): Likewise.

s390 bits are ok. Thanks!

-Andreas-
Richard Guenther - Nov. 4, 2010, 4:50 p.m.
On Thu, Nov 4, 2010 at 5:15 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> While build_va_arg_indirect_ref is fine in va_arg gimplification, in
> *_va_start expansion it is wrong, because the expander now no longer
> handles INDIRECT_REF.  Fixed by calling build_simple_mem_ref instead,
> which is what other targets are now doing.
> Pat has bootstrapped/regtested this on PowerPC and Andreas tested it
> on s390*.  Ok for trunk?

Ok.

Thanks,
Richard.

> 2010-11-04  Jakub Jelinek  <jakub@redhat.com>
>
>        PR target/46234
>        * config/rs6000/rs6000.c (rs6000_va_start): Use build_simple_mem_ref
>        instead of build_va_arg_indirect_ref.
>        * config/spu/spu.c (spu_va_start): Likewise.
>        * config/s390/s390.c (s390_va_start): Likewise.
>
> --- gcc/config/rs6000/rs6000.c.jj       2010-11-03 16:58:31.000000000 +0100
> +++ gcc/config/rs6000/rs6000.c  2010-11-03 18:15:24.000000000 +0100
> @@ -9252,7 +9252,7 @@ rs6000_va_start (tree valist, rtx nextar
>   f_ovf = DECL_CHAIN (f_res);
>   f_sav = DECL_CHAIN (f_ovf);
>
> -  valist = build_va_arg_indirect_ref (valist);
> +  valist = build_simple_mem_ref (valist);
>   gpr = build3 (COMPONENT_REF, TREE_TYPE (f_gpr), valist, f_gpr, NULL_TREE);
>   fpr = build3 (COMPONENT_REF, TREE_TYPE (f_fpr), unshare_expr (valist),
>                f_fpr, NULL_TREE);
> --- gcc/config/spu/spu.c.jj     2010-11-01 09:06:42.000000000 +0100
> +++ gcc/config/spu/spu.c        2010-11-03 18:16:08.000000000 +0100
> @@ -4154,7 +4154,7 @@ spu_va_start (tree valist, rtx nextarg)
>   f_args = TYPE_FIELDS (TREE_TYPE (va_list_type_node));
>   f_skip = DECL_CHAIN (f_args);
>
> -  valist = build_va_arg_indirect_ref (valist);
> +  valist = build_simple_mem_ref (valist);
>   args =
>     build3 (COMPONENT_REF, TREE_TYPE (f_args), valist, f_args, NULL_TREE);
>   skip =
> --- gcc/config/s390/s390.c.jj   2010-11-01 09:06:42.000000000 +0100
> +++ gcc/config/s390/s390.c      2010-11-03 18:15:47.000000000 +0100
> @@ -8719,7 +8719,7 @@ s390_va_start (tree valist, rtx nextarg
>   f_ovf = DECL_CHAIN (f_fpr);
>   f_sav = DECL_CHAIN (f_ovf);
>
> -  valist = build_va_arg_indirect_ref (valist);
> +  valist = build_simple_mem_ref (valist);
>   gpr = build3 (COMPONENT_REF, TREE_TYPE (f_gpr), valist, f_gpr, NULL_TREE);
>   fpr = build3 (COMPONENT_REF, TREE_TYPE (f_fpr), valist, f_fpr, NULL_TREE);
>   ovf = build3 (COMPONENT_REF, TREE_TYPE (f_ovf), valist, f_ovf, NULL_TREE);
>
>        Jakub
>

Patch

--- gcc/config/rs6000/rs6000.c.jj	2010-11-03 16:58:31.000000000 +0100
+++ gcc/config/rs6000/rs6000.c	2010-11-03 18:15:24.000000000 +0100
@@ -9252,7 +9252,7 @@  rs6000_va_start (tree valist, rtx nextar
   f_ovf = DECL_CHAIN (f_res);
   f_sav = DECL_CHAIN (f_ovf);
 
-  valist = build_va_arg_indirect_ref (valist);
+  valist = build_simple_mem_ref (valist);
   gpr = build3 (COMPONENT_REF, TREE_TYPE (f_gpr), valist, f_gpr, NULL_TREE);
   fpr = build3 (COMPONENT_REF, TREE_TYPE (f_fpr), unshare_expr (valist),
 		f_fpr, NULL_TREE);
--- gcc/config/spu/spu.c.jj	2010-11-01 09:06:42.000000000 +0100
+++ gcc/config/spu/spu.c	2010-11-03 18:16:08.000000000 +0100
@@ -4154,7 +4154,7 @@  spu_va_start (tree valist, rtx nextarg)
   f_args = TYPE_FIELDS (TREE_TYPE (va_list_type_node));
   f_skip = DECL_CHAIN (f_args);
 
-  valist = build_va_arg_indirect_ref (valist);
+  valist = build_simple_mem_ref (valist);
   args =
     build3 (COMPONENT_REF, TREE_TYPE (f_args), valist, f_args, NULL_TREE);
   skip =
--- gcc/config/s390/s390.c.jj	2010-11-01 09:06:42.000000000 +0100
+++ gcc/config/s390/s390.c	2010-11-03 18:15:47.000000000 +0100
@@ -8719,7 +8719,7 @@  s390_va_start (tree valist, rtx nextarg 
   f_ovf = DECL_CHAIN (f_fpr);
   f_sav = DECL_CHAIN (f_ovf);
 
-  valist = build_va_arg_indirect_ref (valist);
+  valist = build_simple_mem_ref (valist);
   gpr = build3 (COMPONENT_REF, TREE_TYPE (f_gpr), valist, f_gpr, NULL_TREE);
   fpr = build3 (COMPONENT_REF, TREE_TYPE (f_fpr), valist, f_fpr, NULL_TREE);
   ovf = build3 (COMPONENT_REF, TREE_TYPE (f_ovf), valist, f_ovf, NULL_TREE);