gcc/gcc/cilk.h

110 lines
4.8 KiB
C
Raw Normal View History

Added _Cilk_spawn and _Cilk_sync (2 cilk keywords) for C. gcc/ChangeLog: 2013-10-29 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 built-in 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_detect_spawn): Likewise. (LANG_HOOKS_DECLS): Added LANG_HOOKS_CILKPLUS. (LANG_HOOKS_CILKPLUS_DETECT_SPAWN_AND_UNWRAP): New #define. (LANG_HOOKS_CILKPLUS_FRAME_CLEANUP): Likewise. (LANG_HOOKS_CILKPLUS_GIMPLIFY_SPAWN): Likewise. (LANG_HOOKS_CILKPLUS): Likewise. * tree.h (CILK_SPAWN_FN): Likewise. * builtin.def (DEF_CILK_BUILTIN_STUB): Likewise. * Makefile.in (C_COMMON_OBJS): Added c-family/cilk.o. (OBJS): Added cilk-common.o. (CILK_H): Added a new define. (gimplify.o): Added CILK_H into dependency list. (builtins.o): Likewise. (ipa-inline.o): Likewise. (ipa-inline-analysis.o): Likewise. (BUILTINS_DEF): Added cilk-builtins.def. * langhooks.c (lhd_install_body_with_frame_cleanup): New function. (lhd_cilk_detect_spawn): Likewise. * langhooks.h (lang_hooks_for_cilkplus): New struct. (struct lang_hooks): Added new field called "cilkplus." * 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::calls_cilk_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): Added a CILK_SPAWN_STMT and CILK_SYNC_STMT case for gimplifying _Cilk_spawn and _Cilk_sync statements. (gimplify_return_expr): Added a check for _Cilk_spawn usage in function. If so, added a _Cilk_sync and gimplified it. (gimplify_modify_expr): Added a check for _Cilk_spawn in MODIFY and INIT_EXPRs. If so, then call gimplify_cilk_spawn. * 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. * 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/ChangeLog: 2013-10-29 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_FRAME_CLEANUP): Likewise. (LANG_HOOKS_CILKPLUS_DETECT_SPAWN_AND_UNWRAP): Likewise. * c-parser.c (c_parser_statement_after_labels): Added RID_CILK_SYNC case. (c_parser_postfix_expression): Added RID_CILK_SPAWN case. * c-typeck.c (build_compound_expr): Reject _Cilk_spawn in a comma expr. (c_finish_return): Added a check to reject _Cilk_spawn in return expression. (build_cilk_spawn): New function. (build_cilk_sync): Likewise. * Makefile.in (c-decl.o): Added cilk.h in dependency list. gcc/c-family/ChangeLog 2013-10-29 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.h (enum rid): Added RID_CILK_SPAWN and RID_CILK_SYNC. (insert_cilk_frame): New prototype. (cilk_init_builtins): Likewise. (gimplify_cilk_spawn): Likewise. (c_cilk_install_body_w_frame_cleanup): Likewise. (cilk_detect_spawn_and_unwrap): Likewise. (cilk_set_spawn_marker): Likewise. (build_cilk_sync): Likewise. (build_cilk_spawn): Likewise. * cilk.c: New file. gcc/lto/ChangeLog 2013-10-29 Balaji V. Iyer <balaji.v.iyer@intel.com> * Make-lang.in (lto/lto-lang.o): Added cilk.h in dependency list. * lto-lang.c (lto_init): Added a call to cilk_init_builtins if Cilk Plus is enabled. gcc/testsuite/ChangeLog 2013-10-29 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. * c-c++-common/cilk-plus/CK/invalid_spawn.c: Likewise. * c-c++-common/cilk-plus/CK/spawn_in_return.c: Likewise. * c-c++-common/cilk-plus/CK/fib_init_expr_xy.c: Likewise. * c-c++-common/cilk-plus/CK/fib_no_sync.c: Likewise. * c-c++-common/cilk-plus/CK/fib_no_return.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. From-SVN: r204172
2013-10-29 19:36:31 +01:00
/* This file is part of the Intel(R) Cilk(TM) Plus support
This file contains Cilk Support files.
Copyright (C) 2013-2016 Free Software Foundation, Inc.
Added _Cilk_spawn and _Cilk_sync (2 cilk keywords) for C. gcc/ChangeLog: 2013-10-29 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 built-in 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_detect_spawn): Likewise. (LANG_HOOKS_DECLS): Added LANG_HOOKS_CILKPLUS. (LANG_HOOKS_CILKPLUS_DETECT_SPAWN_AND_UNWRAP): New #define. (LANG_HOOKS_CILKPLUS_FRAME_CLEANUP): Likewise. (LANG_HOOKS_CILKPLUS_GIMPLIFY_SPAWN): Likewise. (LANG_HOOKS_CILKPLUS): Likewise. * tree.h (CILK_SPAWN_FN): Likewise. * builtin.def (DEF_CILK_BUILTIN_STUB): Likewise. * Makefile.in (C_COMMON_OBJS): Added c-family/cilk.o. (OBJS): Added cilk-common.o. (CILK_H): Added a new define. (gimplify.o): Added CILK_H into dependency list. (builtins.o): Likewise. (ipa-inline.o): Likewise. (ipa-inline-analysis.o): Likewise. (BUILTINS_DEF): Added cilk-builtins.def. * langhooks.c (lhd_install_body_with_frame_cleanup): New function. (lhd_cilk_detect_spawn): Likewise. * langhooks.h (lang_hooks_for_cilkplus): New struct. (struct lang_hooks): Added new field called "cilkplus." * 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::calls_cilk_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): Added a CILK_SPAWN_STMT and CILK_SYNC_STMT case for gimplifying _Cilk_spawn and _Cilk_sync statements. (gimplify_return_expr): Added a check for _Cilk_spawn usage in function. If so, added a _Cilk_sync and gimplified it. (gimplify_modify_expr): Added a check for _Cilk_spawn in MODIFY and INIT_EXPRs. If so, then call gimplify_cilk_spawn. * 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. * 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/ChangeLog: 2013-10-29 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_FRAME_CLEANUP): Likewise. (LANG_HOOKS_CILKPLUS_DETECT_SPAWN_AND_UNWRAP): Likewise. * c-parser.c (c_parser_statement_after_labels): Added RID_CILK_SYNC case. (c_parser_postfix_expression): Added RID_CILK_SPAWN case. * c-typeck.c (build_compound_expr): Reject _Cilk_spawn in a comma expr. (c_finish_return): Added a check to reject _Cilk_spawn in return expression. (build_cilk_spawn): New function. (build_cilk_sync): Likewise. * Makefile.in (c-decl.o): Added cilk.h in dependency list. gcc/c-family/ChangeLog 2013-10-29 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.h (enum rid): Added RID_CILK_SPAWN and RID_CILK_SYNC. (insert_cilk_frame): New prototype. (cilk_init_builtins): Likewise. (gimplify_cilk_spawn): Likewise. (c_cilk_install_body_w_frame_cleanup): Likewise. (cilk_detect_spawn_and_unwrap): Likewise. (cilk_set_spawn_marker): Likewise. (build_cilk_sync): Likewise. (build_cilk_spawn): Likewise. * cilk.c: New file. gcc/lto/ChangeLog 2013-10-29 Balaji V. Iyer <balaji.v.iyer@intel.com> * Make-lang.in (lto/lto-lang.o): Added cilk.h in dependency list. * lto-lang.c (lto_init): Added a call to cilk_init_builtins if Cilk Plus is enabled. gcc/testsuite/ChangeLog 2013-10-29 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. * c-c++-common/cilk-plus/CK/invalid_spawn.c: Likewise. * c-c++-common/cilk-plus/CK/spawn_in_return.c: Likewise. * c-c++-common/cilk-plus/CK/fib_init_expr_xy.c: Likewise. * c-c++-common/cilk-plus/CK/fib_no_sync.c: Likewise. * c-c++-common/cilk-plus/CK/fib_no_return.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. From-SVN: r204172
2013-10-29 19:36:31 +01:00
Contributed by Balaji V. Iyer <balaji.v.iyer@intel.com>,
Intel Corporation
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_CILK_H
#define GCC_CILK_H
/* Frame status bits known to compiler. */
#define CILK_FRAME_UNSYNCHED 0x02
#define CILK_FRAME_DETACHED 0x04
#define CILK_FRAME_EXCEPTING 0x10
#define CILK_FRAME_VERSION (1 << 24)
enum cilk_tree_index {
/* All the built-in functions for Cilk keywords. */
CILK_TI_F_WORKER = 0, /* __cilkrts_get_worker (). */
CILK_TI_F_SYNC, /* __cilkrts_sync (). */
CILK_TI_F_DETACH, /* __cilkrts_detach (...). */
CILK_TI_F_ENTER, /* __cilkrts_enter_frame (...). */
CILK_TI_F_ENTER_FAST, /* __cilkrts_enter_frame_fast (.). */
CILK_TI_F_LEAVE, /* __cilkrts_leave_frame (...). */
CILK_TI_F_POP, /* __cilkrts_pop_frame (...). */
CILK_TI_F_RETHROW, /* __cilkrts_rethrow (...). */
CILK_TI_F_SAVE_FP, /* __cilkrts_save_fp_ctrl_state (...). */
cilk-builtins.def (__cilkrts_cilk_for_32): New. gcc/ * cilk-builtins.def (__cilkrts_cilk_for_32): New. (__cilkrts_cilk_for_64): Likewise. * cilk-common.c (declare_cilk_for_builtin): New function. (cilk_init_builtins): Declare __cilkrts_cilk_for_32 and __cilkrts_cilk_for_64 bultins. * cilk.h (enum cilk_tree_index): Added CILK_TI_F_LOOP_32 and CILK_TI_F_LOOP_64. (cilk_for_32_fndecl): New define. (cilk_for_64_fndecl): Likewise. * gimple-pretty-print.c (dump_gimple_omp_for): Correct hadling of GF_OMP_FOR_KIND_CILKFOR cases; Added NE_EXPR case. * gimple.h (enum gf_mask): Added GF_OMP_FOR_KIND_CILKFOR; adjusted GF_OMP_FOR_KIND_MASK, GF_OMP_FOR_SIMD, GF_OMP_FOR_COMBINED, GF_OMP_FOR_COMBINED_INTO. * gimplify.c (gimplify_scan_omp_clauses): Added OMP_CLAUSE__CILK_FOR_COUNT_ case. (gimplify_adjust_omp_clauses): Ditto. (gimplify_omp_for): Added CILK_FOR case. (gimplify_expr): Ditto. * omp-low.c: Include cilk.h. (extract_omp_for_data): Set appropriate kind for GF_OMP_FOR_KIND_CILKFOR; added check for GF_OMP_FOR_KIND_CILKFOR. (scan_sharing_clauses): Added OMP_CLAUSE__CILK_FOR_COUNT_ cases. (create_omp_child_function_name): Added second argument to handle cilk_for case. (cilk_for_check_loop_diff_type): New function. (expand_cilk_for_call): Likewise. (expand_cilk_for): Likewise. (create_omp_child_function): Set cilk_for_count; handle the cases when it is true; call create_omp_child_function_name with second argument. (expand_omp_taskreg): Set is_cilk_for and handle cases when it's true. (expand_omp_for): Handle case of GF_OMP_FOR_KIND_CILKFOR. * tree-core.h (omp_clause_code): Added OMP_CLAUSE__CILK_FOR_COUNT_. * tree-nested.c (convert_nonlocal_omp_clauses): Added OMP_CLAUSE__CILK_FOR_COUNT_ case. (convert_local_omp_clauses): Ditto. * tree-pretty-print.c (dump_omp_clause): Added OMP_CLAUSE__CILK_FOR_COUNT_ and OMP_CLAUSE_SCHEDULE_CILKFOR cases. (dump_generic_node): Added CILK_FOR case. * tree.c (omp_clause_num_ops): New element OMP_CLAUSE__CILK_FOR_COUNT_ (1). (omp_clause_code_name): New element _Cilk_for_count_. (walk_tree_1): Added OMP_CLAUSE__CILK_FOR_COUNT_ case. * tree.def: Add tree code for CILK_FOR. gcc/c/ * c-parser.c (c_parser_cilk_for): New function. (c_parser_cilk_grainsize): Likewise. (c_get_temp_regvar): Likewise. (c_parser_statement_after_labels): Added RID_CILK_FOR case. (c_parser_pragma): Added PRAGMA_CILK_GRAINSIZE case. (c_parser_omp_for_loop): Added CILK_FOR and CILK_SIMD checks. * c-typeck.c (c_finish_omp_clauses): Added OMP_CLAUSE__CILK_FOR_COUNT_ case. gcc/cp/ * cp-cilkplus.c (cpp_validate_cilk_plus_loop_aux): Loc definition simplified. * parser.c (cp_parser_cilk_for): New function. (cp_parser_cilk_grainsize): Likewise. (cp_parser_statement): Added RID_CILK_FOR case. (cp_parser_omp_for_cond): Added CILK_FOR check. (cp_parser_omp_for_loop_init): Change function argument to accept tree_code instead just a bool flag; change the check to use that tree_code; check for initialization declaration in case of Cilk_for. (cp_parser_omp_for_loop): Added checks for CILK_FOR and RID_CILK_FOR; changed call to cp_parser_omp_for_loop_init according new arguments' list. (cp_parser_pragma): Added PRAGMA_CILK_GRAINSIZE case. * pt.c (tsubst_expr): Added CILK_FOR case. * semantics.c: Include convert.h. (finish_omp_clauses): Properly handle OMP_CLAUSE_SCHEDULE_CILKFOR case; added OMP_CLAUSE__CILK_FOR_COUNT_. (handle_omp_for_class_iterator): New argument lastp and its usage; added NE_EXPR case. (finish_omp_for): Changed call to handle_omp_for_class_iterator according new arguments' list; in case of Cilk_for save very first decl and create empty stmt_list block; use block to build correct statement tree. gcc/c-family/ * c-cilkplus.c (cilk_for_number_of_iterations): New function. * c-common.c (c_common_reswords): Added _Cilk_for. * c-common.h (enum rid): Added RID_CILK_FOR. (cilk_for_number_of_iterations): Add declaration. * c-omp.c (c_finish_omp_for): Added checks for CILK_SIMD and CILK_FOR. * c-pragma.c (init_pragma): Register "grainsize" pragma. * c-pragma.h (enum pragma_kind): Add PRAGMA_CILK_GRAINSIZE. gcc/testsuite/ * c-c++-common/cilk-plus/CK/cilk-fors.c: New test. * c-c++-common/cilk-plus/CK/cilk-for-2.c: New test. * c-c++-common/cilk-plus/CK/cilk-for-3.c: New test. * c-c++-common/cilk-plus/CK/cilk_for_errors.c: New test. * c-c++-common/cilk-plus/CK/cilk_for_grain.c: New test. * c-c++-common/cilk-plus/CK/cilk_for_grain_errors.c: New test. * c-c++-common/cilk-plus/CK/cilk_for_ptr_iter.c: New test. * c-c++-common/cilk-plus/CK/nested_cilk_for.c: New test. * g++.dg/cilk-plus/CK/cf3.cc: New test. * g++.dg/cilk-plus/CK/cilk-for-tplt.cc: New test. * g++.dg/cilk-plus/CK/for1.cc: New test. * g++.dg/cilk-plus/CK/stl_iter.cc: New test. * g++.dg/cilk-plus/CK/stl_rev_iter.cc: New test. * g++.dg/cilk-plus/CK/stl_test.cc: New test. Co-Authored-By: Balaji V. Iyer <balaji.v.iyer@intel.com> Co-Authored-By: Igor Zamyatin <igor.zamyatin@intel.com> From-SVN: r214818
2014-09-02 14:52:29 +02:00
CILK_TI_F_LOOP_32, /* __cilkrts_cilk_for_32 (...). */
CILK_TI_F_LOOP_64, /* __cilkrts_cilk_for_64 (...). */
Added _Cilk_spawn and _Cilk_sync (2 cilk keywords) for C. gcc/ChangeLog: 2013-10-29 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 built-in 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_detect_spawn): Likewise. (LANG_HOOKS_DECLS): Added LANG_HOOKS_CILKPLUS. (LANG_HOOKS_CILKPLUS_DETECT_SPAWN_AND_UNWRAP): New #define. (LANG_HOOKS_CILKPLUS_FRAME_CLEANUP): Likewise. (LANG_HOOKS_CILKPLUS_GIMPLIFY_SPAWN): Likewise. (LANG_HOOKS_CILKPLUS): Likewise. * tree.h (CILK_SPAWN_FN): Likewise. * builtin.def (DEF_CILK_BUILTIN_STUB): Likewise. * Makefile.in (C_COMMON_OBJS): Added c-family/cilk.o. (OBJS): Added cilk-common.o. (CILK_H): Added a new define. (gimplify.o): Added CILK_H into dependency list. (builtins.o): Likewise. (ipa-inline.o): Likewise. (ipa-inline-analysis.o): Likewise. (BUILTINS_DEF): Added cilk-builtins.def. * langhooks.c (lhd_install_body_with_frame_cleanup): New function. (lhd_cilk_detect_spawn): Likewise. * langhooks.h (lang_hooks_for_cilkplus): New struct. (struct lang_hooks): Added new field called "cilkplus." * 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::calls_cilk_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): Added a CILK_SPAWN_STMT and CILK_SYNC_STMT case for gimplifying _Cilk_spawn and _Cilk_sync statements. (gimplify_return_expr): Added a check for _Cilk_spawn usage in function. If so, added a _Cilk_sync and gimplified it. (gimplify_modify_expr): Added a check for _Cilk_spawn in MODIFY and INIT_EXPRs. If so, then call gimplify_cilk_spawn. * 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. * 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/ChangeLog: 2013-10-29 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_FRAME_CLEANUP): Likewise. (LANG_HOOKS_CILKPLUS_DETECT_SPAWN_AND_UNWRAP): Likewise. * c-parser.c (c_parser_statement_after_labels): Added RID_CILK_SYNC case. (c_parser_postfix_expression): Added RID_CILK_SPAWN case. * c-typeck.c (build_compound_expr): Reject _Cilk_spawn in a comma expr. (c_finish_return): Added a check to reject _Cilk_spawn in return expression. (build_cilk_spawn): New function. (build_cilk_sync): Likewise. * Makefile.in (c-decl.o): Added cilk.h in dependency list. gcc/c-family/ChangeLog 2013-10-29 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.h (enum rid): Added RID_CILK_SPAWN and RID_CILK_SYNC. (insert_cilk_frame): New prototype. (cilk_init_builtins): Likewise. (gimplify_cilk_spawn): Likewise. (c_cilk_install_body_w_frame_cleanup): Likewise. (cilk_detect_spawn_and_unwrap): Likewise. (cilk_set_spawn_marker): Likewise. (build_cilk_sync): Likewise. (build_cilk_spawn): Likewise. * cilk.c: New file. gcc/lto/ChangeLog 2013-10-29 Balaji V. Iyer <balaji.v.iyer@intel.com> * Make-lang.in (lto/lto-lang.o): Added cilk.h in dependency list. * lto-lang.c (lto_init): Added a call to cilk_init_builtins if Cilk Plus is enabled. gcc/testsuite/ChangeLog 2013-10-29 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. * c-c++-common/cilk-plus/CK/invalid_spawn.c: Likewise. * c-c++-common/cilk-plus/CK/spawn_in_return.c: Likewise. * c-c++-common/cilk-plus/CK/fib_init_expr_xy.c: Likewise. * c-c++-common/cilk-plus/CK/fib_no_sync.c: Likewise. * c-c++-common/cilk-plus/CK/fib_no_return.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. From-SVN: r204172
2013-10-29 19:36:31 +01:00
/* __cilkrts_stack_frame struct fields. */
CILK_TI_FRAME_FLAGS, /* stack_frame->flags. */
CILK_TI_FRAME_PARENT, /* stack_frame->parent. */
CILK_TI_FRAME_WORKER, /* stack_frame->worker. */
CILK_TI_FRAME_EXCEPTION, /* stack_frame->except_data. */
CILK_TI_FRAME_CONTEXT, /* stack_frame->context[4]. */
CILK_TI_FRAME_PEDIGREE, /* stack_frame->pedigree. */
/* __cilkrts_worker struct fields. */
CILK_TI_WORKER_CUR, /* worker->current_stack_frame. */
CILK_TI_WORKER_TAIL, /* worker->tail. */
CILK_TI_WORKER_PEDIGREE, /* worker->pedigree. */
/* __cilkrts_pedigree struct fields. */
CILK_TI_PEDIGREE_RANK, /* pedigree->rank. */
CILK_TI_PEDIGREE_PARENT, /* pedigree->parent. */
/* Types. */
CILK_TI_FRAME_TYPE, /* struct __cilkrts_stack_frame. */
CILK_TI_FRAME_PTR, /* __cilkrts_stack_frame *. */
CILK_TI_WORKER_TYPE, /* struct __cilkrts_worker. */
CILK_TI_PEDIGREE_TYPE, /* struct __cilkrts_pedigree. */
CILK_TI_MAX
};
extern GTY (()) tree cilk_trees[CILK_TI_MAX];
#define cilk_worker_fndecl cilk_trees[CILK_TI_F_WORKER]
#define cilk_sync_fndecl cilk_trees[CILK_TI_F_SYNC]
#define cilk_synched_fndecl cilk_trees[CILK_TI_F_SYNCED]
#define cilk_detach_fndecl cilk_trees[CILK_TI_F_DETACH]
#define cilk_enter_fndecl cilk_trees[CILK_TI_F_ENTER]
#define cilk_enter_fast_fndecl cilk_trees[CILK_TI_F_ENTER_FAST]
#define cilk_leave_fndecl cilk_trees[CILK_TI_F_LEAVE]
#define cilk_rethrow_fndecl cilk_trees[CILK_TI_F_RETHROW]
#define cilk_pop_fndecl cilk_trees[CILK_TI_F_POP]
#define cilk_save_fp_fndecl cilk_trees[CILK_TI_F_SAVE_FP]
cilk-builtins.def (__cilkrts_cilk_for_32): New. gcc/ * cilk-builtins.def (__cilkrts_cilk_for_32): New. (__cilkrts_cilk_for_64): Likewise. * cilk-common.c (declare_cilk_for_builtin): New function. (cilk_init_builtins): Declare __cilkrts_cilk_for_32 and __cilkrts_cilk_for_64 bultins. * cilk.h (enum cilk_tree_index): Added CILK_TI_F_LOOP_32 and CILK_TI_F_LOOP_64. (cilk_for_32_fndecl): New define. (cilk_for_64_fndecl): Likewise. * gimple-pretty-print.c (dump_gimple_omp_for): Correct hadling of GF_OMP_FOR_KIND_CILKFOR cases; Added NE_EXPR case. * gimple.h (enum gf_mask): Added GF_OMP_FOR_KIND_CILKFOR; adjusted GF_OMP_FOR_KIND_MASK, GF_OMP_FOR_SIMD, GF_OMP_FOR_COMBINED, GF_OMP_FOR_COMBINED_INTO. * gimplify.c (gimplify_scan_omp_clauses): Added OMP_CLAUSE__CILK_FOR_COUNT_ case. (gimplify_adjust_omp_clauses): Ditto. (gimplify_omp_for): Added CILK_FOR case. (gimplify_expr): Ditto. * omp-low.c: Include cilk.h. (extract_omp_for_data): Set appropriate kind for GF_OMP_FOR_KIND_CILKFOR; added check for GF_OMP_FOR_KIND_CILKFOR. (scan_sharing_clauses): Added OMP_CLAUSE__CILK_FOR_COUNT_ cases. (create_omp_child_function_name): Added second argument to handle cilk_for case. (cilk_for_check_loop_diff_type): New function. (expand_cilk_for_call): Likewise. (expand_cilk_for): Likewise. (create_omp_child_function): Set cilk_for_count; handle the cases when it is true; call create_omp_child_function_name with second argument. (expand_omp_taskreg): Set is_cilk_for and handle cases when it's true. (expand_omp_for): Handle case of GF_OMP_FOR_KIND_CILKFOR. * tree-core.h (omp_clause_code): Added OMP_CLAUSE__CILK_FOR_COUNT_. * tree-nested.c (convert_nonlocal_omp_clauses): Added OMP_CLAUSE__CILK_FOR_COUNT_ case. (convert_local_omp_clauses): Ditto. * tree-pretty-print.c (dump_omp_clause): Added OMP_CLAUSE__CILK_FOR_COUNT_ and OMP_CLAUSE_SCHEDULE_CILKFOR cases. (dump_generic_node): Added CILK_FOR case. * tree.c (omp_clause_num_ops): New element OMP_CLAUSE__CILK_FOR_COUNT_ (1). (omp_clause_code_name): New element _Cilk_for_count_. (walk_tree_1): Added OMP_CLAUSE__CILK_FOR_COUNT_ case. * tree.def: Add tree code for CILK_FOR. gcc/c/ * c-parser.c (c_parser_cilk_for): New function. (c_parser_cilk_grainsize): Likewise. (c_get_temp_regvar): Likewise. (c_parser_statement_after_labels): Added RID_CILK_FOR case. (c_parser_pragma): Added PRAGMA_CILK_GRAINSIZE case. (c_parser_omp_for_loop): Added CILK_FOR and CILK_SIMD checks. * c-typeck.c (c_finish_omp_clauses): Added OMP_CLAUSE__CILK_FOR_COUNT_ case. gcc/cp/ * cp-cilkplus.c (cpp_validate_cilk_plus_loop_aux): Loc definition simplified. * parser.c (cp_parser_cilk_for): New function. (cp_parser_cilk_grainsize): Likewise. (cp_parser_statement): Added RID_CILK_FOR case. (cp_parser_omp_for_cond): Added CILK_FOR check. (cp_parser_omp_for_loop_init): Change function argument to accept tree_code instead just a bool flag; change the check to use that tree_code; check for initialization declaration in case of Cilk_for. (cp_parser_omp_for_loop): Added checks for CILK_FOR and RID_CILK_FOR; changed call to cp_parser_omp_for_loop_init according new arguments' list. (cp_parser_pragma): Added PRAGMA_CILK_GRAINSIZE case. * pt.c (tsubst_expr): Added CILK_FOR case. * semantics.c: Include convert.h. (finish_omp_clauses): Properly handle OMP_CLAUSE_SCHEDULE_CILKFOR case; added OMP_CLAUSE__CILK_FOR_COUNT_. (handle_omp_for_class_iterator): New argument lastp and its usage; added NE_EXPR case. (finish_omp_for): Changed call to handle_omp_for_class_iterator according new arguments' list; in case of Cilk_for save very first decl and create empty stmt_list block; use block to build correct statement tree. gcc/c-family/ * c-cilkplus.c (cilk_for_number_of_iterations): New function. * c-common.c (c_common_reswords): Added _Cilk_for. * c-common.h (enum rid): Added RID_CILK_FOR. (cilk_for_number_of_iterations): Add declaration. * c-omp.c (c_finish_omp_for): Added checks for CILK_SIMD and CILK_FOR. * c-pragma.c (init_pragma): Register "grainsize" pragma. * c-pragma.h (enum pragma_kind): Add PRAGMA_CILK_GRAINSIZE. gcc/testsuite/ * c-c++-common/cilk-plus/CK/cilk-fors.c: New test. * c-c++-common/cilk-plus/CK/cilk-for-2.c: New test. * c-c++-common/cilk-plus/CK/cilk-for-3.c: New test. * c-c++-common/cilk-plus/CK/cilk_for_errors.c: New test. * c-c++-common/cilk-plus/CK/cilk_for_grain.c: New test. * c-c++-common/cilk-plus/CK/cilk_for_grain_errors.c: New test. * c-c++-common/cilk-plus/CK/cilk_for_ptr_iter.c: New test. * c-c++-common/cilk-plus/CK/nested_cilk_for.c: New test. * g++.dg/cilk-plus/CK/cf3.cc: New test. * g++.dg/cilk-plus/CK/cilk-for-tplt.cc: New test. * g++.dg/cilk-plus/CK/for1.cc: New test. * g++.dg/cilk-plus/CK/stl_iter.cc: New test. * g++.dg/cilk-plus/CK/stl_rev_iter.cc: New test. * g++.dg/cilk-plus/CK/stl_test.cc: New test. Co-Authored-By: Balaji V. Iyer <balaji.v.iyer@intel.com> Co-Authored-By: Igor Zamyatin <igor.zamyatin@intel.com> From-SVN: r214818
2014-09-02 14:52:29 +02:00
#define cilk_for_32_fndecl cilk_trees[CILK_TI_F_LOOP_32]
#define cilk_for_64_fndecl cilk_trees[CILK_TI_F_LOOP_64]
Added _Cilk_spawn and _Cilk_sync (2 cilk keywords) for C. gcc/ChangeLog: 2013-10-29 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 built-in 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_detect_spawn): Likewise. (LANG_HOOKS_DECLS): Added LANG_HOOKS_CILKPLUS. (LANG_HOOKS_CILKPLUS_DETECT_SPAWN_AND_UNWRAP): New #define. (LANG_HOOKS_CILKPLUS_FRAME_CLEANUP): Likewise. (LANG_HOOKS_CILKPLUS_GIMPLIFY_SPAWN): Likewise. (LANG_HOOKS_CILKPLUS): Likewise. * tree.h (CILK_SPAWN_FN): Likewise. * builtin.def (DEF_CILK_BUILTIN_STUB): Likewise. * Makefile.in (C_COMMON_OBJS): Added c-family/cilk.o. (OBJS): Added cilk-common.o. (CILK_H): Added a new define. (gimplify.o): Added CILK_H into dependency list. (builtins.o): Likewise. (ipa-inline.o): Likewise. (ipa-inline-analysis.o): Likewise. (BUILTINS_DEF): Added cilk-builtins.def. * langhooks.c (lhd_install_body_with_frame_cleanup): New function. (lhd_cilk_detect_spawn): Likewise. * langhooks.h (lang_hooks_for_cilkplus): New struct. (struct lang_hooks): Added new field called "cilkplus." * 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::calls_cilk_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): Added a CILK_SPAWN_STMT and CILK_SYNC_STMT case for gimplifying _Cilk_spawn and _Cilk_sync statements. (gimplify_return_expr): Added a check for _Cilk_spawn usage in function. If so, added a _Cilk_sync and gimplified it. (gimplify_modify_expr): Added a check for _Cilk_spawn in MODIFY and INIT_EXPRs. If so, then call gimplify_cilk_spawn. * 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. * 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/ChangeLog: 2013-10-29 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_FRAME_CLEANUP): Likewise. (LANG_HOOKS_CILKPLUS_DETECT_SPAWN_AND_UNWRAP): Likewise. * c-parser.c (c_parser_statement_after_labels): Added RID_CILK_SYNC case. (c_parser_postfix_expression): Added RID_CILK_SPAWN case. * c-typeck.c (build_compound_expr): Reject _Cilk_spawn in a comma expr. (c_finish_return): Added a check to reject _Cilk_spawn in return expression. (build_cilk_spawn): New function. (build_cilk_sync): Likewise. * Makefile.in (c-decl.o): Added cilk.h in dependency list. gcc/c-family/ChangeLog 2013-10-29 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.h (enum rid): Added RID_CILK_SPAWN and RID_CILK_SYNC. (insert_cilk_frame): New prototype. (cilk_init_builtins): Likewise. (gimplify_cilk_spawn): Likewise. (c_cilk_install_body_w_frame_cleanup): Likewise. (cilk_detect_spawn_and_unwrap): Likewise. (cilk_set_spawn_marker): Likewise. (build_cilk_sync): Likewise. (build_cilk_spawn): Likewise. * cilk.c: New file. gcc/lto/ChangeLog 2013-10-29 Balaji V. Iyer <balaji.v.iyer@intel.com> * Make-lang.in (lto/lto-lang.o): Added cilk.h in dependency list. * lto-lang.c (lto_init): Added a call to cilk_init_builtins if Cilk Plus is enabled. gcc/testsuite/ChangeLog 2013-10-29 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. * c-c++-common/cilk-plus/CK/invalid_spawn.c: Likewise. * c-c++-common/cilk-plus/CK/spawn_in_return.c: Likewise. * c-c++-common/cilk-plus/CK/fib_init_expr_xy.c: Likewise. * c-c++-common/cilk-plus/CK/fib_no_sync.c: Likewise. * c-c++-common/cilk-plus/CK/fib_no_return.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. From-SVN: r204172
2013-10-29 19:36:31 +01:00
#define cilk_worker_type_fndecl cilk_trees[CILK_TI_WORKER_TYPE]
#define cilk_frame_type_decl cilk_trees[CILK_TI_FRAME_TYPE]
#define cilk_frame_ptr_type_decl cilk_trees[CILK_TI_FRAME_PTR]
#define cilk_pedigree_type_decl cilk_trees[CILK_TI_PEDIGREE_TYPE]
extern void expand_builtin_cilk_detach (tree);
extern void expand_builtin_cilk_pop_frame (tree);
extern tree cilk_arrow (tree, int, bool);
extern tree cilk_dot (tree, int, bool);
extern void cilk_init_builtins (void);
extern void gimplify_cilk_sync (tree *, gimple_seq *);
extern tree cilk_call_setjmp (tree);
Added Compiler Support for _Cilk_spawn and _Cilk_sync for C++. gcc/c-family/ChangeLog 2013-12-11 Balaji V. Iyer <balaji.v.iyer@intel.com> * cilk.c (cilk_outline): Made this function non-static. (gimplify_cilk_spawn): Removed pre_p and post_p arguments. (create_cilk_wrapper): Added a new parameter: a function pointer. (c_install_body_w_frame_cleanup): Remove (extract_free_variables): Added VEC_INIT_EXPR and CONSTRUCTOR case. * c-common.h (cilk_outline): New prototype. (gimplify_cilk_spawn): Removed two parameters. (cilk_install_body_with_frame_cleanup): New prototype. * c-gimplify.c (c_gimplify_expr): Added MODIFY_EXPR, CALL_EXPR and CILK_SPAWN_STMT case. gcc/c/ChangeLog 2013-12-11 Balaji V. Iyer <balaji.v.iyer@intel.com> * c-objc-common.h (LANG_HOOKS_CILKPLUS_FRAME_CLEANUP): Remove. (LANG_HOOKS_CILKPLUS_DETECT_SPAWN_AND_UNWRAP): Likewise. (LANG_HOOKS_CILKPLUS_CILKPLUS_GIMPLIFY_SPAWN): Likewise. * c-typeck.c (cilk_install_body_with_frame_cleanup): New function. gcc/ChangeLog 2013-12-11 Balaji V. Iyer <balaji.v.iyer@intel.com> * langhooks.h (lang_hooks_for_decls): Remove lang_hooks_for_cilkplus. (lang_hooks_for_cilkplus): Remove. * langhooks.c (lhd_cilk_detect_spawn): Likewise. (lhd_install_body_with_frame_cleanup): Likewise. * langhooks-def.h (LANG_HOOKS_CILKPLUS_FRAME_CLEANUP): Likewise. (LANG_HOOKS_CILKPLUS_DETECT_SPAWN_AND_UNWRAP): Likewise. (LANG_HOOKS_CILKPLUS_CILKPLUS_GIMPLIFY_SPAWN): Likewise. (LANG_HOOKS_CILKPLUS): Likewise. (LANG_HOOKS_DECLS): Remove LANG_HOOKS_CILKPLUS. * gimplify.c (gimplify_expr): Removed CILK_SPAWN_STMT case. (gimplify_modify_expr): Removed handling of _Cilk_spawn in expr. (gimplify_call_expr): Likewise. gcc/cp/ChangeLog 2013-12-11 Balaji V. Iyer <balaji.v.iyer@intel.com> * cp-tree.h (cilk_valid_spawn): New prototype. (gimplify_cilk_spawn): Likewise. (create_try_catch_expr): Likewise. * decl.c (finish_function): Insert Cilk function-calls when a _Cilk_spawn is used in a function. * parser.c (cp_parser_postfix_expression): Added RID_CILK_SPAWN and RID_CILK_SYNC cases. * cp-cilkplus.c (set_cilk_except_flag): New function. (set_cilk_except_data): Likewise. (cilk_install_body_with_frame_cleanup): Likewise. * except.c (create_try_catch_expr): Likewise. * parser.h (IN_CILK_SPAWN): New #define. * pt.c (tsubst_expr): Added CILK_SPAWN_STMT and CILK_SYNC_STMT cases. * semantics.c (potential_constant_expression_1): Likewise. * typeck.c (cp_build_compound_expr): Reject a spawned function in a compound expression. (check_return_expr): Reject a spawned function in a return expression. * cp-gimplify.c (cp_gimplify_expr): Added a CILK_SPAWN_STMT and CALL_EXPR case. Added handling of spawned function in MODIFY_EXPR and INIT_EXPR. gcc/testsuite/ChangeLog 2013-12-11 Balaji V. Iyer <balaji.v.iyer@intel.com> * g++.dg/cilk-plus/CK/catch_exc.cc: New test case. * g++.dg/cilk-plus/CK/const_spawn.cc: Likewise. * g++.dg/cilk-plus/CK/fib-opr-overload.cc: Likewise. * g++.dg/cilk-plus/CK/fib-tplt.cc: Likewise. * g++.dg/cilk-plus/CK/lambda_spawns.cc: Likewise. * g++.dg/cilk-plus/CK/lambda_spawns_tplt.cc: Likewise. * g++.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. From-SVN: r205902
2013-12-11 19:23:27 +01:00
Added _Cilk_spawn and _Cilk_sync (2 cilk keywords) for C. gcc/ChangeLog: 2013-10-29 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 built-in 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_detect_spawn): Likewise. (LANG_HOOKS_DECLS): Added LANG_HOOKS_CILKPLUS. (LANG_HOOKS_CILKPLUS_DETECT_SPAWN_AND_UNWRAP): New #define. (LANG_HOOKS_CILKPLUS_FRAME_CLEANUP): Likewise. (LANG_HOOKS_CILKPLUS_GIMPLIFY_SPAWN): Likewise. (LANG_HOOKS_CILKPLUS): Likewise. * tree.h (CILK_SPAWN_FN): Likewise. * builtin.def (DEF_CILK_BUILTIN_STUB): Likewise. * Makefile.in (C_COMMON_OBJS): Added c-family/cilk.o. (OBJS): Added cilk-common.o. (CILK_H): Added a new define. (gimplify.o): Added CILK_H into dependency list. (builtins.o): Likewise. (ipa-inline.o): Likewise. (ipa-inline-analysis.o): Likewise. (BUILTINS_DEF): Added cilk-builtins.def. * langhooks.c (lhd_install_body_with_frame_cleanup): New function. (lhd_cilk_detect_spawn): Likewise. * langhooks.h (lang_hooks_for_cilkplus): New struct. (struct lang_hooks): Added new field called "cilkplus." * 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::calls_cilk_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): Added a CILK_SPAWN_STMT and CILK_SYNC_STMT case for gimplifying _Cilk_spawn and _Cilk_sync statements. (gimplify_return_expr): Added a check for _Cilk_spawn usage in function. If so, added a _Cilk_sync and gimplified it. (gimplify_modify_expr): Added a check for _Cilk_spawn in MODIFY and INIT_EXPRs. If so, then call gimplify_cilk_spawn. * 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. * 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/ChangeLog: 2013-10-29 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_FRAME_CLEANUP): Likewise. (LANG_HOOKS_CILKPLUS_DETECT_SPAWN_AND_UNWRAP): Likewise. * c-parser.c (c_parser_statement_after_labels): Added RID_CILK_SYNC case. (c_parser_postfix_expression): Added RID_CILK_SPAWN case. * c-typeck.c (build_compound_expr): Reject _Cilk_spawn in a comma expr. (c_finish_return): Added a check to reject _Cilk_spawn in return expression. (build_cilk_spawn): New function. (build_cilk_sync): Likewise. * Makefile.in (c-decl.o): Added cilk.h in dependency list. gcc/c-family/ChangeLog 2013-10-29 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.h (enum rid): Added RID_CILK_SPAWN and RID_CILK_SYNC. (insert_cilk_frame): New prototype. (cilk_init_builtins): Likewise. (gimplify_cilk_spawn): Likewise. (c_cilk_install_body_w_frame_cleanup): Likewise. (cilk_detect_spawn_and_unwrap): Likewise. (cilk_set_spawn_marker): Likewise. (build_cilk_sync): Likewise. (build_cilk_spawn): Likewise. * cilk.c: New file. gcc/lto/ChangeLog 2013-10-29 Balaji V. Iyer <balaji.v.iyer@intel.com> * Make-lang.in (lto/lto-lang.o): Added cilk.h in dependency list. * lto-lang.c (lto_init): Added a call to cilk_init_builtins if Cilk Plus is enabled. gcc/testsuite/ChangeLog 2013-10-29 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. * c-c++-common/cilk-plus/CK/invalid_spawn.c: Likewise. * c-c++-common/cilk-plus/CK/spawn_in_return.c: Likewise. * c-c++-common/cilk-plus/CK/fib_init_expr_xy.c: Likewise. * c-c++-common/cilk-plus/CK/fib_no_sync.c: Likewise. * c-c++-common/cilk-plus/CK/fib_no_return.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. From-SVN: r204172
2013-10-29 19:36:31 +01:00
/* Returns true if Cilk Plus is enabled and if F->cilk_frame_decl is not
NULL_TREE. */
inline bool
fn_contains_cilk_spawn_p (function *f)
{
Replace flag_enable_cilkplus with flag_cilkplus. gcc/ChangeLog +2014-01-24 Balaji V. Iyer <balaji.v.iyer@intel.com> + + * builtins.c (is_builtin_name): Renamed flag_enable_cilkplus to + flag_cilkplus. + * builtins.def: Likewise. + * cilk.h (fn_contains_cilk_spawn_p): Likewise. + * cppbuiltin.c (define_builtin_macros_for_compilation_flags): Likewise. + * ira.c (ira_setup_eliminable_regset): Likewise. + * omp-low.c (gate_expand_omp): Likewise. + (execute_lower_omp): Likewise. + (diagnose_sb_0): Likewise. + (gate_diagnose_omp_blocks): Likewise. + (simd_clone_clauses_extract): Likewise. + (gate): Likewise. + gcc/c-family/ChangeLog +2014-01-24 Balaji V. Iyer <balaji.v.iyer@intel.com> + + * c-common.c (c_define_builtins): Replaced flag_enable_cilkplus with + flag_cilkplus. + * c-pragma.c (init_pragma): Likewise. + * c.opt: Likewise. + gcc/c/ChangeLog +2014-01-24 Balaji V. Iyer <balaji.v.iyer@intel.com> + + * c-parser.c (c_parser_declaration_or_fndef): Replaced + flag_enable_cilkplus with flag_cilkplus. + (c_parser_direct_declarator_inner): Likewise. + (c_parser_attribute_any_word): Likewise. + (c_parser_attributes): Likewise. + (c_parser_compound_statement): Likewise. + (c_parser_statement_after_labels): Likewise. + (c_parser_if_statement): Likewise. + (c_parser_switch_statement): Likewise. + (c_parser_do_statement): Likewise. + (c_parser_for_statement): Likewise. + (c_parser_unary_expression): Likewise. + (c_parser_postfix_expression): Likewise. + (c_parser_postfix_expression_after_primary): Likewise. + (c_parser_postfix_expression_after_primary): Likewise. + (c_parser_omp_clause_name): Likewise. + (c_finish_omp_declare_simd): Likewise. + (c_parser_cilk_verify_simd): Likewise. + * c-typeck.c (build_array_ref): Likewise. + (build_function_call_vec): Likewise. + (convert_arguments): Likewise. + (build_compound_expr): Likewise. + (c_finish_return): Likewise. + (c_finish_if_stmt): Likewise. + (c_finish_loop): Likewise. + (build_binary_op): Likewise. + gcc/lto/ChangeLog +2014-01-24 Balaji V. Iyer <balaji.v.iyer@intel.com> + + * lto-lang.c (lto_init): Replaced flag_enable_cilkplus with + flag_cilkplus. + From-SVN: r207064
2014-01-25 00:13:49 +01:00
return (flag_cilkplus
Added _Cilk_spawn and _Cilk_sync (2 cilk keywords) for C. gcc/ChangeLog: 2013-10-29 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 built-in 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_detect_spawn): Likewise. (LANG_HOOKS_DECLS): Added LANG_HOOKS_CILKPLUS. (LANG_HOOKS_CILKPLUS_DETECT_SPAWN_AND_UNWRAP): New #define. (LANG_HOOKS_CILKPLUS_FRAME_CLEANUP): Likewise. (LANG_HOOKS_CILKPLUS_GIMPLIFY_SPAWN): Likewise. (LANG_HOOKS_CILKPLUS): Likewise. * tree.h (CILK_SPAWN_FN): Likewise. * builtin.def (DEF_CILK_BUILTIN_STUB): Likewise. * Makefile.in (C_COMMON_OBJS): Added c-family/cilk.o. (OBJS): Added cilk-common.o. (CILK_H): Added a new define. (gimplify.o): Added CILK_H into dependency list. (builtins.o): Likewise. (ipa-inline.o): Likewise. (ipa-inline-analysis.o): Likewise. (BUILTINS_DEF): Added cilk-builtins.def. * langhooks.c (lhd_install_body_with_frame_cleanup): New function. (lhd_cilk_detect_spawn): Likewise. * langhooks.h (lang_hooks_for_cilkplus): New struct. (struct lang_hooks): Added new field called "cilkplus." * 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::calls_cilk_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): Added a CILK_SPAWN_STMT and CILK_SYNC_STMT case for gimplifying _Cilk_spawn and _Cilk_sync statements. (gimplify_return_expr): Added a check for _Cilk_spawn usage in function. If so, added a _Cilk_sync and gimplified it. (gimplify_modify_expr): Added a check for _Cilk_spawn in MODIFY and INIT_EXPRs. If so, then call gimplify_cilk_spawn. * 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. * 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/ChangeLog: 2013-10-29 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_FRAME_CLEANUP): Likewise. (LANG_HOOKS_CILKPLUS_DETECT_SPAWN_AND_UNWRAP): Likewise. * c-parser.c (c_parser_statement_after_labels): Added RID_CILK_SYNC case. (c_parser_postfix_expression): Added RID_CILK_SPAWN case. * c-typeck.c (build_compound_expr): Reject _Cilk_spawn in a comma expr. (c_finish_return): Added a check to reject _Cilk_spawn in return expression. (build_cilk_spawn): New function. (build_cilk_sync): Likewise. * Makefile.in (c-decl.o): Added cilk.h in dependency list. gcc/c-family/ChangeLog 2013-10-29 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.h (enum rid): Added RID_CILK_SPAWN and RID_CILK_SYNC. (insert_cilk_frame): New prototype. (cilk_init_builtins): Likewise. (gimplify_cilk_spawn): Likewise. (c_cilk_install_body_w_frame_cleanup): Likewise. (cilk_detect_spawn_and_unwrap): Likewise. (cilk_set_spawn_marker): Likewise. (build_cilk_sync): Likewise. (build_cilk_spawn): Likewise. * cilk.c: New file. gcc/lto/ChangeLog 2013-10-29 Balaji V. Iyer <balaji.v.iyer@intel.com> * Make-lang.in (lto/lto-lang.o): Added cilk.h in dependency list. * lto-lang.c (lto_init): Added a call to cilk_init_builtins if Cilk Plus is enabled. gcc/testsuite/ChangeLog 2013-10-29 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. * c-c++-common/cilk-plus/CK/invalid_spawn.c: Likewise. * c-c++-common/cilk-plus/CK/spawn_in_return.c: Likewise. * c-c++-common/cilk-plus/CK/fib_init_expr_xy.c: Likewise. * c-c++-common/cilk-plus/CK/fib_no_sync.c: Likewise. * c-c++-common/cilk-plus/CK/fib_no_return.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. From-SVN: r204172
2013-10-29 19:36:31 +01:00
&& (f->calls_cilk_spawn || f->cilk_frame_decl != NULL_TREE));
}
Added Compiler Support for _Cilk_spawn and _Cilk_sync for C++. gcc/c-family/ChangeLog 2013-12-11 Balaji V. Iyer <balaji.v.iyer@intel.com> * cilk.c (cilk_outline): Made this function non-static. (gimplify_cilk_spawn): Removed pre_p and post_p arguments. (create_cilk_wrapper): Added a new parameter: a function pointer. (c_install_body_w_frame_cleanup): Remove (extract_free_variables): Added VEC_INIT_EXPR and CONSTRUCTOR case. * c-common.h (cilk_outline): New prototype. (gimplify_cilk_spawn): Removed two parameters. (cilk_install_body_with_frame_cleanup): New prototype. * c-gimplify.c (c_gimplify_expr): Added MODIFY_EXPR, CALL_EXPR and CILK_SPAWN_STMT case. gcc/c/ChangeLog 2013-12-11 Balaji V. Iyer <balaji.v.iyer@intel.com> * c-objc-common.h (LANG_HOOKS_CILKPLUS_FRAME_CLEANUP): Remove. (LANG_HOOKS_CILKPLUS_DETECT_SPAWN_AND_UNWRAP): Likewise. (LANG_HOOKS_CILKPLUS_CILKPLUS_GIMPLIFY_SPAWN): Likewise. * c-typeck.c (cilk_install_body_with_frame_cleanup): New function. gcc/ChangeLog 2013-12-11 Balaji V. Iyer <balaji.v.iyer@intel.com> * langhooks.h (lang_hooks_for_decls): Remove lang_hooks_for_cilkplus. (lang_hooks_for_cilkplus): Remove. * langhooks.c (lhd_cilk_detect_spawn): Likewise. (lhd_install_body_with_frame_cleanup): Likewise. * langhooks-def.h (LANG_HOOKS_CILKPLUS_FRAME_CLEANUP): Likewise. (LANG_HOOKS_CILKPLUS_DETECT_SPAWN_AND_UNWRAP): Likewise. (LANG_HOOKS_CILKPLUS_CILKPLUS_GIMPLIFY_SPAWN): Likewise. (LANG_HOOKS_CILKPLUS): Likewise. (LANG_HOOKS_DECLS): Remove LANG_HOOKS_CILKPLUS. * gimplify.c (gimplify_expr): Removed CILK_SPAWN_STMT case. (gimplify_modify_expr): Removed handling of _Cilk_spawn in expr. (gimplify_call_expr): Likewise. gcc/cp/ChangeLog 2013-12-11 Balaji V. Iyer <balaji.v.iyer@intel.com> * cp-tree.h (cilk_valid_spawn): New prototype. (gimplify_cilk_spawn): Likewise. (create_try_catch_expr): Likewise. * decl.c (finish_function): Insert Cilk function-calls when a _Cilk_spawn is used in a function. * parser.c (cp_parser_postfix_expression): Added RID_CILK_SPAWN and RID_CILK_SYNC cases. * cp-cilkplus.c (set_cilk_except_flag): New function. (set_cilk_except_data): Likewise. (cilk_install_body_with_frame_cleanup): Likewise. * except.c (create_try_catch_expr): Likewise. * parser.h (IN_CILK_SPAWN): New #define. * pt.c (tsubst_expr): Added CILK_SPAWN_STMT and CILK_SYNC_STMT cases. * semantics.c (potential_constant_expression_1): Likewise. * typeck.c (cp_build_compound_expr): Reject a spawned function in a compound expression. (check_return_expr): Reject a spawned function in a return expression. * cp-gimplify.c (cp_gimplify_expr): Added a CILK_SPAWN_STMT and CALL_EXPR case. Added handling of spawned function in MODIFY_EXPR and INIT_EXPR. gcc/testsuite/ChangeLog 2013-12-11 Balaji V. Iyer <balaji.v.iyer@intel.com> * g++.dg/cilk-plus/CK/catch_exc.cc: New test case. * g++.dg/cilk-plus/CK/const_spawn.cc: Likewise. * g++.dg/cilk-plus/CK/fib-opr-overload.cc: Likewise. * g++.dg/cilk-plus/CK/fib-tplt.cc: Likewise. * g++.dg/cilk-plus/CK/lambda_spawns.cc: Likewise. * g++.dg/cilk-plus/CK/lambda_spawns_tplt.cc: Likewise. * g++.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. From-SVN: r205902
2013-12-11 19:23:27 +01:00
Added _Cilk_spawn and _Cilk_sync (2 cilk keywords) for C. gcc/ChangeLog: 2013-10-29 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 built-in 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_detect_spawn): Likewise. (LANG_HOOKS_DECLS): Added LANG_HOOKS_CILKPLUS. (LANG_HOOKS_CILKPLUS_DETECT_SPAWN_AND_UNWRAP): New #define. (LANG_HOOKS_CILKPLUS_FRAME_CLEANUP): Likewise. (LANG_HOOKS_CILKPLUS_GIMPLIFY_SPAWN): Likewise. (LANG_HOOKS_CILKPLUS): Likewise. * tree.h (CILK_SPAWN_FN): Likewise. * builtin.def (DEF_CILK_BUILTIN_STUB): Likewise. * Makefile.in (C_COMMON_OBJS): Added c-family/cilk.o. (OBJS): Added cilk-common.o. (CILK_H): Added a new define. (gimplify.o): Added CILK_H into dependency list. (builtins.o): Likewise. (ipa-inline.o): Likewise. (ipa-inline-analysis.o): Likewise. (BUILTINS_DEF): Added cilk-builtins.def. * langhooks.c (lhd_install_body_with_frame_cleanup): New function. (lhd_cilk_detect_spawn): Likewise. * langhooks.h (lang_hooks_for_cilkplus): New struct. (struct lang_hooks): Added new field called "cilkplus." * 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::calls_cilk_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): Added a CILK_SPAWN_STMT and CILK_SYNC_STMT case for gimplifying _Cilk_spawn and _Cilk_sync statements. (gimplify_return_expr): Added a check for _Cilk_spawn usage in function. If so, added a _Cilk_sync and gimplified it. (gimplify_modify_expr): Added a check for _Cilk_spawn in MODIFY and INIT_EXPRs. If so, then call gimplify_cilk_spawn. * 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. * 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/ChangeLog: 2013-10-29 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_FRAME_CLEANUP): Likewise. (LANG_HOOKS_CILKPLUS_DETECT_SPAWN_AND_UNWRAP): Likewise. * c-parser.c (c_parser_statement_after_labels): Added RID_CILK_SYNC case. (c_parser_postfix_expression): Added RID_CILK_SPAWN case. * c-typeck.c (build_compound_expr): Reject _Cilk_spawn in a comma expr. (c_finish_return): Added a check to reject _Cilk_spawn in return expression. (build_cilk_spawn): New function. (build_cilk_sync): Likewise. * Makefile.in (c-decl.o): Added cilk.h in dependency list. gcc/c-family/ChangeLog 2013-10-29 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.h (enum rid): Added RID_CILK_SPAWN and RID_CILK_SYNC. (insert_cilk_frame): New prototype. (cilk_init_builtins): Likewise. (gimplify_cilk_spawn): Likewise. (c_cilk_install_body_w_frame_cleanup): Likewise. (cilk_detect_spawn_and_unwrap): Likewise. (cilk_set_spawn_marker): Likewise. (build_cilk_sync): Likewise. (build_cilk_spawn): Likewise. * cilk.c: New file. gcc/lto/ChangeLog 2013-10-29 Balaji V. Iyer <balaji.v.iyer@intel.com> * Make-lang.in (lto/lto-lang.o): Added cilk.h in dependency list. * lto-lang.c (lto_init): Added a call to cilk_init_builtins if Cilk Plus is enabled. gcc/testsuite/ChangeLog 2013-10-29 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. * c-c++-common/cilk-plus/CK/invalid_spawn.c: Likewise. * c-c++-common/cilk-plus/CK/spawn_in_return.c: Likewise. * c-c++-common/cilk-plus/CK/fib_init_expr_xy.c: Likewise. * c-c++-common/cilk-plus/CK/fib_no_sync.c: Likewise. * c-c++-common/cilk-plus/CK/fib_no_return.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. From-SVN: r204172
2013-10-29 19:36:31 +01:00
#endif