From: Tom de Vries Date: Wed, 13 May 2015 09:06:18 +0000 (+0000) Subject: Gimplify va_arg ap based on do_deref X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fcd424cecbe8874404fc92520954ec806e7886fc;p=gcc.git Gimplify va_arg ap based on do_deref 2015-05-13 Tom de Vries PR tree-optimization/66010 * gimplify.h (gimplify_va_arg_internal): Remove declaration. * gimplify.c (gimplify_va_arg_internal): Remove and inline into ... * tree-stdarg.c (expand_ifn_va_arg_1): ... here. Choose between lval and rval based on do_deref. From-SVN: r223120 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2bb07a57023..c6288325524 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2015-05-13 Tom de Vries + + PR tree-optimization/66010 + * gimplify.h (gimplify_va_arg_internal): Remove declaration. + * gimplify.c (gimplify_va_arg_internal): Remove and inline into ... + * tree-stdarg.c (expand_ifn_va_arg_1): ... here. Choose between lval + and rval based on do_deref. + 2015-05-13 Ilya Enkovich PR target/65103 diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 322d0ba6ba1..484647896e2 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -9302,32 +9302,6 @@ dummy_object (tree type) return build2 (MEM_REF, type, t, t); } -/* Call the target expander for evaluating a va_arg call of VALIST - and TYPE. */ - -tree -gimplify_va_arg_internal (tree valist, tree type, gimple_seq *pre_p, - gimple_seq *post_p) -{ - tree have_va_type = TREE_TYPE (valist); - tree cano_type = targetm.canonical_va_list_type (have_va_type); - - if (cano_type != NULL_TREE) - have_va_type = cano_type; - - /* Make it easier for the backends by protecting the valist argument - from multiple evaluations. */ - if (TREE_CODE (have_va_type) == ARRAY_TYPE) - { - gcc_assert (TREE_CODE (TREE_TYPE (valist)) != ARRAY_TYPE); - gimplify_expr (&valist, pre_p, post_p, is_gimple_val, fb_rvalue); - } - else - gimplify_expr (&valist, pre_p, post_p, is_gimple_min_lval, fb_lvalue); - - return targetm.gimplify_va_arg_expr (valist, type, pre_p, post_p); -} - /* Gimplify __builtin_va_arg, aka VA_ARG_EXPR, which is not really a builtin function, but a very special sort of operator. */ diff --git a/gcc/gimplify.h b/gcc/gimplify.h index 83bf52572bd..615925c1a78 100644 --- a/gcc/gimplify.h +++ b/gcc/gimplify.h @@ -82,7 +82,6 @@ extern void gimplify_function_tree (tree); extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *, gimple_seq *); gimple gimplify_assign (tree, tree, gimple_seq *); -extern tree gimplify_va_arg_internal (tree, tree, gimple_seq *, gimple_seq *); /* Return true if gimplify_one_sizepos doesn't need to gimplify expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c index 3bede7efd6e..f8ff70ae38f 100644 --- a/gcc/tree-stdarg.c +++ b/gcc/tree-stdarg.c @@ -1059,7 +1059,14 @@ expand_ifn_va_arg_1 (function *fun) push_gimplify_context (false); - expr = gimplify_va_arg_internal (ap, type, &pre, &post); + /* 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); + + expr = targetm.gimplify_va_arg_expr (ap, type, &pre, &post); lhs = gimple_call_lhs (stmt); if (lhs != NULL_TREE)