bool cilk_recognize_spawn (tree exp, tree *exp0) { bool spawn_found = false; if (TREE_CODE (exp) == CILK_SPAWN_STMT) { /* Remove the CALL_EXPR from CILK_SPAWN_STMT wrapper. */ exp = CILK_SPAWN_FN (exp); walk_tree (exp0, unwrap_cilk_spawn_stmt, NULL, NULL); spawn_found = true; } /* _Cilk_spawn can't be wrapped in expression such as PLUS_EXPR. */ else if (contains_cilk_spawn_stmt (exp)) { location_t loc = EXPR_LOCATION (exp); if (loc == UNKNOWN_LOCATION) { tree stmt = walk_tree (&exp, contains_cilk_spawn_stmt_walker, NULL, NULL); gcc_assert (stmt != NULL_TREE); loc = EXPR_LOCATION (stmt); } error_at (loc, "invalid use of %<_Cilk_spawn%>"); } return spawn_found; }
static tree unwrap_cilk_spawn_stmt (tree *tp, int *walk_subtrees, void *) { if (TREE_CODE (*tp) == CILK_SPAWN_STMT) { *tp = CILK_SPAWN_FN (*tp); *walk_subtrees = 0; } return NULL_TREE; }
static bool recognize_spawn (tree exp, tree *exp0) { bool spawn_found = false; if (TREE_CODE (exp) == CILK_SPAWN_STMT) { /* Remove the CALL_EXPR from CILK_SPAWN_STMT wrapper. */ exp = CILK_SPAWN_FN (exp); walk_tree (exp0, unwrap_cilk_spawn_stmt, NULL, NULL); spawn_found = true; } return spawn_found; }
static bool recognize_spawn (tree exp, tree *exp0) { bool spawn_found = false; if (TREE_CODE (exp) == CILK_SPAWN_STMT) { /* Remove the CALL_EXPR from CILK_SPAWN_STMT wrapper. */ exp = CILK_SPAWN_FN (exp); walk_tree (exp0, unwrap_cilk_spawn_stmt, NULL, NULL); spawn_found = true; } /* _Cilk_spawn can't be wrapped in expression such as PLUS_EXPR. */ else if (contains_cilk_spawn_stmt (exp)) error_at (EXPR_LOCATION (exp), "invalid use of %<_Cilk_spawn%>"); return spawn_found; }