]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
targhooks.c (std_gimplify_va_arg_expr): Properly handle case of when TARGET_SPLIT_COM...
authorChung-Lin Tang <cltang@codesourcery.com>
Mon, 20 Aug 2018 18:32:06 +0000 (18:32 +0000)
committerJeff Law <law@gcc.gnu.org>
Mon, 20 Aug 2018 18:32:06 +0000 (12:32 -0600)
* targhooks.c (std_gimplify_va_arg_expr): Properly handle case of when
TARGET_SPLIT_COMPLEX_ARG is defined.

From-SVN: r263671

gcc/ChangeLog
gcc/targhooks.c

index b1d08897f22e9c59d1ad18ff075367e15817b837..15bcc7fd147cd305ab94d238ead12d1b87a15323 100644 (file)
@@ -1,3 +1,8 @@
+2018-08-20  Chung-Lin Tang  <cltang@codesourcery.com>
+
+       * targhooks.c (std_gimplify_va_arg_expr): Properly handle case of when
+       TARGET_SPLIT_COMPLEX_ARG is defined.
+
 2018-08-20  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
        * expr.c (store_field): Change gcc_assert to gcc_checking_assert.
index 32b4993a1b16d2e3994ca02739ab3105be0797ad..afd56f3ec457ecac05ca03e89fb109a72c452a41 100644 (file)
@@ -2154,6 +2154,23 @@ std_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
   if (indirect)
     type = build_pointer_type (type);
 
+  if (targetm.calls.split_complex_arg
+      && TREE_CODE (type) == COMPLEX_TYPE
+      && targetm.calls.split_complex_arg (type))
+    {
+      tree real_part, imag_part;
+
+      real_part = std_gimplify_va_arg_expr (valist,
+                                           TREE_TYPE (type), pre_p, NULL);
+      real_part = get_initialized_tmp_var (real_part, pre_p, NULL);
+
+      imag_part = std_gimplify_va_arg_expr (unshare_expr (valist),
+                                           TREE_TYPE (type), pre_p, NULL);
+      imag_part = get_initialized_tmp_var (imag_part, pre_p, NULL);
+
+      return build2 (COMPLEX_EXPR, type, real_part, imag_part);
+   }
+
   align = PARM_BOUNDARY / BITS_PER_UNIT;
   boundary = targetm.calls.function_arg_boundary (TYPE_MODE (type), type);