This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hello Richard et al., Attached, please find a patch that will implement _Cilk_spawn and _Cilk_sync for the C compiler. To run a program that uses _Cilk_spawn and _Cilk_sync requires a Cilk Runtime library. I will send that out as a separate patch. Is this patch OK for trunk? Here are the Changelog entries: gcc/ChangeLog 2013-07-31 Balaji V. Iyer <balaji.v.iyer@intel.com> * builtins.c (is_builtin_name): Added a check for __cilkrts_detach and __cilkrts_pop_frame. If matched, then return true for builtin function name. (expand_builtin): Added BUILT_IN_CILK_DETACH and BUILT_IN_CILK_POP_FRAME case. * langhooks-def.h (lhd_install_body_with_frame_cleanup): New prototype. (lhs_cilk_valid_spawn): Likewise. (LANG_HOOKS_DECLS): Added LANG_HOOKS_CILKPLUS. (LANG_HOOKS_CILKPLUS_SPAWNABLE_CTOR): New #define. (LANG_HOOKS_CILKPLUS_RECOGNIZE_SPAWN): Likewise. (LANG_HOOKS_CILKPLUS_VALID_SPAWN): Likewise. (LANG_HOOKS_CILKPLUS_FRAME_CLEANUP): Likewise. (LANG_HOOKS_CILKPLUS_GIMPLIFY_SPAWN): Likewise. (LANG_HOOKS_CILKPLUS_GIMPLIFY_SYNC): Likewise. (LANG_HOOKS_CILKPLUS): Likewise. * builtin.def (DEF_CILK_BUILTIN_STUB): Likewise. * Makefile.in (C_COMMON_OBJS): Added c-family/cilk.o. (OBJS): Added cilk-common.o. * langhooks.c (lhd_install_body_with_frame_cleanup): New function. (lhd_cilk_valid_spawn): Likewise. * langhooks.h (lang_hooks_for_cilkplus): New struct. (struct lang_hooks): Added new field called "cilkplus." * expr.c (expand_expr_real_1): Added an INDIRECT_REF case. * cilk-common.c: New file. * cilk.h: Likewise. * cilk-builtins.def: Likewise. * cppbuiltin.c (define_builtin_macros_for_compilation_flags): Added "__cilk" macro and set it to 200. * function.h (struct function::cilk_frame_decl): New field. (struct function::is_cilk_function): Likewise. (struct function::is_cilk_helper_function): Likewise. (struct function::calls_spawn): Likewise. * gimplify.c (gimplify_call_expr): Added a check if the function call being gimplified is a spawn detach point. If so, then add pop_frame and detach function calls. (gimplify_expr): If a function call is a valid spawned function, then gimplify it using gimplify_cilk_spawn function call. Also, added a CILK_SYNC_STMT case for gimplifying _Cilk_sync statement. * ipa-inline-analysis (initialize_inline_failed): Prevent inlining of spawner function. (can_inline_edge_p): Prevent inling of spawnee function. * ira.c (ira_setup_eliminable_regset): Force usage of frame pointer for functions that use Cilk keywords. * tree-inline.h (struct copy_body_data::remap_var_for_cilk): New field. * tree-pretty-print.c (dump_generic_node): Added CILK_SPAWN_STMT and CILK_SYNC_STMT cases. * tree.def (DEFTREECODE): Added CILK_SPAWN_STMT and CILK_SYNC_STMT trees. * tree.h (enum built_in_class::BUILT_IN_CILK): New enum. value. (struct tree_base::is_cilk_spawn): New field. (struct tree_base::is_cilk_helper_fn): Likewise. (SPAWN_CALL_P): New #define. (CILK_FN_P): Likewise. (SPAWN_DETACH_POINT): Likewise. (tree_function_decl::built_in_class): Changed bitfield size. * generic.texi (CILK_SPAWN_STMT): Added documentation for _Cilk_spawn. (CILK_SYNC_STMT): Added documentation for _Cilk_sync. * passes.texi (Cilk Keywords): New section that describes the compiler code changes for handling Cilk Keywords. gcc/c-family/ChangeLog 2013-07-31 Balaji V. Iyer <balaji.v.iyer@intel.com> * c-common.c (c_common_reswords[]): Added _Cilk_spawn and _Cilk_sync fields. (c_define_builtins): Called cilk_init_builtins if Cilk Plus is enabled. (c_common_init_ts): Marked CILK_SPAWN_STMT and CILK_SYNC_STMT as typed. * c-common.h (enum rid): Added RID_CILK_SPAWN and RID_CILK_SYNC. (insert_cilk_frame): New prototype. (cilk_init_builtins): Likewise. (gimplify_cilk_spawn): Likewise. (gimplify_cilk_sync): Likewise. (c_install_body_with_frame_cleanup): Likewise. (cilk_valid_spawn): Likewise. (cilk_set_spawn_marker): Likewise. * cilk.c: New file. gcc/c/ChangeLog 2013-07-31 Balaji V. Iyer <balaji.v.iyer@intel.com> * c-decl.c (finish_function): Added a call for insert_cilk_frame when a spawning function is found. * c-objc-common.h (LANG_HOOKS_CILKPLUS_GIMPLIFY_SPAWN): New #define. (LANG_HOOKS_CILKPLUS_GIMPLIFY_SYNC): Likewise. (LANG_HOOKS_CILKPLUS_FRAME_CLEANUP): Likewise. (LANG_HOOKS_CILKPLUS_VALID_SPAWN): Likewise. * c-parser.c (c_parser_statement_after_labels): Added RID_CILK_SYNC case. (c_parser_postfix_expression): Added RID_CILK_SPAWN case. * c-tree.h (c_build_sync): New prototype. (c_build_spawn): Likewise. * c-typeck.c (build_compound_expr): Reject _Cilk_spawn in a comma expr. (c_build_spawns): New function. (c_build_sync): Likewise. gcc/testsuite/ChangeLog 2013-07-31 Balaji V. Iyer <balaji.v.iyer@intel.com> * c-c++-common/cilk-plus/CK/compound_cilk_spawn.c: New test. * c-c++-common/cilk-plus/CK/concec_cilk_spawn.c: Likewise. * c-c++-common/cilk-plus/CK/fib.c: Likewise. * c-c++-common/cilk-plus/CK/no_args_error.c: Likewise. * c-c++-common/cilk-plus/CK/spawnee_inline.c: Likewise. * c-c++-common/cilk-plus/CK/spawner_inline.c: Likewise. * c-c++-common/cilk-plus/CK/spawning_arg.c: Likewise. * c-c++-common/cilk-plus/CK/steal_check.c: Likewise. * c-c++-common/cilk-plus/CK/test__cilk.c: Likewise. * c-c++-common/cilk-plus/CK/varargs_test.c: Likewise. * c-c++-common/cilk-plus/CK/sync_wo_spawn.c: Likewise. * gcc.dg/cilk-plus/cilk-plus.exp: Added support to run Cilk Keywords test stored in c-c++-common. Also, added the Cilk runtime's library to the ld_library_path. Thanks, Balaji V. Iyer.
Attachment:
patch.txt
Description: patch.txt
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |