summaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2017-05-01 22:26:02 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2017-05-01 22:26:02 +0000
commit92bc38e7ad16abbb654ad2ef2b533e05c0e95f97 (patch)
treea8a033d722da210460642c7a397ad087d9c87d1f /gcc/gimplify.c
parentbe45049f886ed00e3a02ec46de135e02ef161cc4 (diff)
downloadgcc-92bc38e7ad16abbb654ad2ef2b533e05c0e95f97.tar.gz
2017-05-01 Xi Ruoyao <ryxi@stu.xidian.edu.cn>
PR c++/80038 * cilk_common.c (expand_builtin_cilk_detach): Move pedigree operations here. * gimplify.c (gimplify_cilk_detach): New function. (gimplify_call_expr, gimplify_modify_expr): Call it as needed. * tree-core.h: Document EXPR_CILK_SPAWN. * tree.h (EXPR_CILK_SPAWN): Define. PR c++/80038 * c-common.h (cilk_gimplify_call_params_in_spawned_fn): Remove prototype. (cilk_install_body_pedigree_operations): Likewise. * cilk.c (cilk_set_spawn_marker): Mark functions that should be detatched. (cilk_gimplify_call_params_in_spawned_fn): Remove. (cilk_install_body_pedigree_operations): Likewise. (gimplify_cilk_spawn): Add EXPR_STMT and CLEANUP_POINT_EXPR unwrapping. PR c++/80038 * c-gimplify.c (c_gimplify_expr): Remove calls to cilk_gimplifY_call_params_in_spawned_fn. PR c++/80038 * cp-cilkplus.c (cilk_install_body_with_frame_cleanup): Don't add pedigree operation and detach call here. * cp-gimplify.c (cp_gimplify_expr): Remove the calls to cilk_cp_gimplify_call_params_in_spawned_fn. (cilk_cp_gimplify_call_params_in_spawned_fn): Remove function. * semantics.c (simplify_aggr_init_expr): Copy EXPR_CILK_SPAWN. PR c++/80038 * lto-lang.c (lto_init): Set in_lto_p earlier. PR c++/80038 * g++.dg/cilk-plus/CK/pr80038.cc: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@247446 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index c69d5b93534..fd27eb1523f 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -3071,6 +3071,19 @@ maybe_fold_stmt (gimple_stmt_iterator *gsi)
return fold_stmt (gsi);
}
+/* Add a gimple call to __builtin_cilk_detach to GIMPLE sequence PRE_P,
+ with the pointer to the proper cilk frame. */
+static void
+gimplify_cilk_detach (gimple_seq *pre_p)
+{
+ tree frame = cfun->cilk_frame_decl;
+ tree ptrf = build1 (ADDR_EXPR, cilk_frame_ptr_type_decl,
+ frame);
+ gcall *detach = gimple_build_call (cilk_detach_fndecl, 1,
+ ptrf);
+ gimplify_seq_add_stmt(pre_p, detach);
+}
+
/* Gimplify the CALL_EXPR node *EXPR_P into the GIMPLE sequence PRE_P.
WANT_VALUE is true if the result of the call is desired. */
@@ -3107,6 +3120,9 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value)
EXPR_LOCATION (*expr_p));
vargs.quick_push (CALL_EXPR_ARG (*expr_p, i));
}
+
+ if (EXPR_CILK_SPAWN (*expr_p))
+ gimplify_cilk_detach (pre_p);
gimple *call = gimple_build_call_internal_vec (ifn, vargs);
gimplify_seq_add_stmt (pre_p, call);
return GS_ALL_DONE;
@@ -3338,6 +3354,8 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value)
call = gimple_build_call_from_tree (*expr_p);
gimple_call_set_fntype (call, TREE_TYPE (fnptrtype));
notice_special_calls (call);
+ if (EXPR_CILK_SPAWN (*expr_p))
+ gimplify_cilk_detach (pre_p);
gimplify_seq_add_stmt (pre_p, call);
gsi = gsi_last (*pre_p);
maybe_fold_stmt (&gsi);
@@ -5620,6 +5638,9 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
SSA name w/o a definition. We may have uses in the GIMPLE IL.
??? This doesn't make it a default-def. */
SSA_NAME_DEF_STMT (*to_p) = gimple_build_nop ();
+
+ if (EXPR_CILK_SPAWN (*from_p))
+ gimplify_cilk_detach (pre_p);
assign = call_stmt;
}
else