diff options
author | Tom de Vries <tom@codesourcery.com> | 2015-05-18 08:19:29 +0000 |
---|---|---|
committer | Tom de Vries <vries@gcc.gnu.org> | 2015-05-18 08:19:29 +0000 |
commit | 2fe1d762d6f04874d61e004a7400ab32e6e4ca6e (patch) | |
tree | 6fc922cafa797c756299ad1c165a14cb319e70a5 /gcc/tree-stdarg.c | |
parent | daf347dddd48faffdc5912c99ea1b52f19be867d (diff) | |
download | gcc-2fe1d762d6f04874d61e004a7400ab32e6e4ca6e.zip gcc-2fe1d762d6f04874d61e004a7400ab32e6e4ca6e.tar.gz gcc-2fe1d762d6f04874d61e004a7400ab32e6e4ca6e.tar.bz2 |
Move array-type va_list handling to build_va_arg
2015-05-18 Tom de Vries <tom@codesourcery.com>
* gimplify.c (gimplify_modify_expr): Remove do_deref handling.
(gimplify_va_arg_expr): Remove do_deref handling. Remove adding of
address operator to va_list operand.
* tree-stdarg.c (expand_ifn_va_arg_1): Do deref of va_list operand
unconditionally.
* config/i386/i386.c (ix86_gimplify_va_arg): Remove deref on va_list
operand.
* config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Same.
* config/s390/s390.c (s390_gimplify_va_arg): Same.
* config/spu/spu.c (spu_gimplify_va_arg_expr): Same.
* c-common.c (build_va_arg_1): New function.
(build_va_arg): Add address operator to va_list operand if necessary.
From-SVN: r223286
Diffstat (limited to 'gcc/tree-stdarg.c')
-rw-r--r-- | gcc/tree-stdarg.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c index f8ff70a..794b94a 100644 --- a/gcc/tree-stdarg.c +++ b/gcc/tree-stdarg.c @@ -1042,7 +1042,7 @@ expand_ifn_va_arg_1 (function *fun) for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i)) { gimple stmt = gsi_stmt (i); - tree ap, expr, lhs, type, do_deref; + tree ap, expr, lhs, type; gimple_seq pre = NULL, post = NULL; if (!gimple_call_ifn_va_arg_p (stmt)) @@ -1052,19 +1052,15 @@ expand_ifn_va_arg_1 (function *fun) type = TREE_TYPE (TREE_TYPE (gimple_call_arg (stmt, 1))); ap = gimple_call_arg (stmt, 0); - do_deref = gimple_call_arg (stmt, 2); - if (do_deref == integer_one_node) - ap = build_fold_indirect_ref (ap); + /* Balanced out the &ap, usually added by build_va_arg. */ + ap = build_fold_indirect_ref (ap); push_gimplify_context (false); /* Make it easier for the backends by protecting the valist argument from multiple evaluations. */ - if (do_deref == integer_one_node) - gimplify_expr (&ap, &pre, &post, is_gimple_min_lval, fb_lvalue); - else - gimplify_expr (&ap, &pre, &post, is_gimple_val, fb_rvalue); + gimplify_expr (&ap, &pre, &post, is_gimple_min_lval, fb_lvalue); expr = targetm.gimplify_va_arg_expr (ap, type, &pre, &post); @@ -1074,7 +1070,7 @@ expand_ifn_va_arg_1 (function *fun) unsigned int nargs = gimple_call_num_args (stmt); gcc_assert (useless_type_conversion_p (TREE_TYPE (lhs), type)); - if (nargs == 4) + if (nargs == 3) { /* We've transported the size of with WITH_SIZE_EXPR here as the last argument of the internal fn call. Now reinstate |