From 647c5e3ea774f96c7f84b3ebacf1cb180aa2fbc5 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Wed, 16 Jan 2019 16:33:34 +0100 Subject: [PATCH] alpha.c (alpha_gimplify_va_arg): Handle split indirect COMPLEX_TYPE arguments. * config/alpha/alpha.c (alpha_gimplify_va_arg): Handle split indirect COMPLEX_TYPE arguments. From-SVN: r267973 --- gcc/ChangeLog | 5 +++++ gcc/config/alpha/alpha.c | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 78983572b23..c0a7e237b1f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-01-16 Uroš Bizjak + + * config/alpha/alpha.c (alpha_gimplify_va_arg): + Handle split indirect COMPLEX_TYPE arguments. + 2019-01-16 Richard Earnshaw PR target/86891 diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index ce45c54eeb7..f0e8124797f 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -6378,8 +6378,40 @@ alpha_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p, offset = get_initialized_tmp_var (t, pre_p, NULL); indirect = pass_by_reference (NULL, TYPE_MODE (type), type, false); + if (indirect) - type = build_pointer_type_for_mode (type, ptr_mode, true); + { + if (TREE_CODE (type) == COMPLEX_TYPE + && targetm.calls.split_complex_arg (type)) + { + tree real_part, imag_part, real_temp; + + tree ptr_type = build_pointer_type_for_mode (TREE_TYPE (type), + ptr_mode, true); + + real_part = alpha_gimplify_va_arg_1 (ptr_type, base, + offset, pre_p); + real_part = build_va_arg_indirect_ref (real_part); + + /* Copy the value into a new temporary, lest the formal temporary + be reused out from under us. */ + real_temp = get_initialized_tmp_var (real_part, pre_p, NULL); + + imag_part = alpha_gimplify_va_arg_1 (ptr_type, base, + offset, pre_p); + imag_part = build_va_arg_indirect_ref (imag_part); + + r = build2 (COMPLEX_EXPR, type, real_temp, imag_part); + + /* Stuff the offset temporary back into its field. */ + gimplify_assign (unshare_expr (offset_field), + fold_convert (TREE_TYPE (offset_field), offset), + pre_p); + return r; + } + else + type = build_pointer_type_for_mode (type, ptr_mode, true); + } /* Find the value. Note that this will be a stable indirection, or a composite of stable indirections in the case of complex. */ -- 2.30.2