aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c50
1 files changed, 36 insertions, 14 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index f5afc0d..93c06de 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -2281,6 +2281,9 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value)
/* Gimplify internal functions created in the FEs. */
if (CALL_EXPR_FN (*expr_p) == NULL_TREE)
{
+ if (want_value)
+ return GS_ALL_DONE;
+
nargs = call_expr_nargs (*expr_p);
enum internal_fn ifn = CALL_EXPR_IFN (*expr_p);
auto_vec<tree> vargs (nargs);
@@ -4644,22 +4647,41 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
{
/* Since the RHS is a CALL_EXPR, we need to create a GIMPLE_CALL
instead of a GIMPLE_ASSIGN. */
- tree fnptrtype = TREE_TYPE (CALL_EXPR_FN (*from_p));
- CALL_EXPR_FN (*from_p) = TREE_OPERAND (CALL_EXPR_FN (*from_p), 0);
- STRIP_USELESS_TYPE_CONVERSION (CALL_EXPR_FN (*from_p));
- tree fndecl = get_callee_fndecl (*from_p);
- if (fndecl
- && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_EXPECT
- && call_expr_nargs (*from_p) == 3)
- assign = gimple_build_call_internal (IFN_BUILTIN_EXPECT, 3,
- CALL_EXPR_ARG (*from_p, 0),
- CALL_EXPR_ARG (*from_p, 1),
- CALL_EXPR_ARG (*from_p, 2));
+ if (CALL_EXPR_FN (*from_p) == NULL_TREE)
+ {
+ /* Gimplify internal functions created in the FEs. */
+ int nargs = call_expr_nargs (*from_p), i;
+ enum internal_fn ifn = CALL_EXPR_IFN (*from_p);
+ auto_vec<tree> vargs (nargs);
+
+ for (i = 0; i < nargs; i++)
+ {
+ gimplify_arg (&CALL_EXPR_ARG (*from_p, i), pre_p,
+ EXPR_LOCATION (*from_p));
+ vargs.quick_push (CALL_EXPR_ARG (*from_p, i));
+ }
+ assign = gimple_build_call_internal_vec (ifn, vargs);
+ gimple_set_location (assign, EXPR_LOCATION (*expr_p));
+ }
else
{
- assign = gimple_build_call_from_tree (*from_p);
- gimple_call_set_fntype (assign, TREE_TYPE (fnptrtype));
+ tree fnptrtype = TREE_TYPE (CALL_EXPR_FN (*from_p));
+ CALL_EXPR_FN (*from_p) = TREE_OPERAND (CALL_EXPR_FN (*from_p), 0);
+ STRIP_USELESS_TYPE_CONVERSION (CALL_EXPR_FN (*from_p));
+ tree fndecl = get_callee_fndecl (*from_p);
+ if (fndecl
+ && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
+ && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_EXPECT
+ && call_expr_nargs (*from_p) == 3)
+ assign = gimple_build_call_internal (IFN_BUILTIN_EXPECT, 3,
+ CALL_EXPR_ARG (*from_p, 0),
+ CALL_EXPR_ARG (*from_p, 1),
+ CALL_EXPR_ARG (*from_p, 2));
+ else
+ {
+ assign = gimple_build_call_from_tree (*from_p);
+ gimple_call_set_fntype (assign, TREE_TYPE (fnptrtype));
+ }
}
notice_special_calls (assign);
if (!gimple_call_noreturn_p (assign))