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] |
[Sorry if you received multiple copies, the first one I had forgotten to CC gcc-patches] Hello Everyone, Attached, please find two patches for implementing _Cilk_for for C and C++. I am attaching both of them in the same email because they both share a lot of common routines and the C++ require certain quick fix-ups that C doesn't need and vice-versa. So, if you could see both the patches then these kind of things are easier to see (at least for me it is). This patch is dependent on the following patches: #pragma simd work (they both share the same parser routines) _Cilk_spawn and _Cilk_sync for C++: The Runtime that supports _Cilk_for requires a C++ compiler with _Cilk_spawn and _Cilk_sync support, and the Runtime is required to execute _Cilk_for tests: http://gcc.gnu.org/ml/gcc-patches/2013-10/msg01807.html. The C part is approved but C++ work is still under review. One small thing that I have not done that Jakub and several other have asked me before is that, there are no tests in c-c++-common for _Cilk_for. The reason being that the syntax between C and C++ implementations are different. In C++, the induction variable must be defined in the initializer (e.g. it should start wth _Cilk_for (int ii = 0....)). In C, this is not allowed (e.g. it should start as _Cilk_for (ii = 0; ii < 10; ii++)). Here are the ChangeLog entries: gcc/ChangeLog. 2013-11-15 Balaji V. Iyer <balaji.v.iyer@intel.com> * cilk-builtins.def: Added 2 builtin functions: __cilkrts_cilk_for_64 and __cilkrts_cilk_for_32. * cilk-common.c (cilk_declare_looper): New function. (cilk_init_builtins): Added two calls to cilk_declare_looper. * cilk.h (enum cilk_tree_index): Added two enums: CILK_TI_F_LOOP_32 and CILK_TI_F_LOOP_64. (enum add_variable_type): Moved here from c-family/cilk.c (enum cilk_block_type): Likewise. (struct wrapper_data): Likewise. (struct cilk_for_desc): New struct. (cilk_for_32_fndecl): New #define. (cilk_for_64_fndecl): Likewise. * tree.h (CILK_FOR_INIT): Likewise. (CILK_FOR_COND): Likewise. (CILK_FOR_EXPR): Likewise. (CILK_FOR_BODY): Likewise. (CILK_FOR_SCOPE): Likewise. (CILK_FOR_GRAIN): Likewise. (CILK_FOR_VAR): Likewise. * gimplify.c (gimplify_expr): Added CILK_FOR_STMT case. * tree-pretty-print.c (dump_generic_node): Likewise. * langhooks-def.h (LANG_HOOKS_CILKPLUS_GIMPLIFY_CILK_FOR): New #define. (LANG_HOOKS_CILKPLUS): Added LANG_HOOKS_CILKPLUS_GIMPLIFY_FOR field. * langhooks.h (struct lang_hooks_for_cilkplus): Added a new field gimplify_cilk_for. * tree.def: Added a new tree CILK_FOR_STMT. gcc/c-family/ChangeLog. 2013-11-15 Balaji V. Iyer <balaji.v.iyer@intel.com> * c-cilkplus.c (c_check_cilk_loop_incr): Added a check for INDIRECT_REF, CLEANUP_POINT_EXPR and TARGET_EXPR. Added PLUS_EXPR and POINTER_PLUS EXPR cases for MODIFY_EXPR case. Added a CALL_EXPR case. (c_validate_cilk_plus_loop): Added "_Cilk_for loops" in the error reporting string. (c_check_cilk_loop): Added 2 new boolean parameters. Added handling of CALL_EXPR and removed unwanted wrappers from the condition params. (c_finish_cilk_for_loops): New function. (cp_finish_cilk_for_loops): Likewise. * c-common.c (c_common_resword): Added _Cilk_for keyword. * c-common.h (enum rid): Added RID_CILK_FOR. (cp_finish_cilk_for_loop): New prototype. (c_finish_cilk_for_loop): Likewise. (cilk_init_fd): Likewise. (cilk_extract_free_variables): Likewise. (cilk_create_cilk_helper_decl): Likewise. (cilk_call_graph_add_fn): Likewise. (cilk_outline_body): Likewise. (cilk_check_loop_difference_type): Likewise. (declare_cilk_for_parms): Likewise. (declare_cilk_for_vars): Likewise. (cilk_loop_convert): Likewise. (cilk_divide_count): Likewise. (cilk_calc_forward_div_op): Likewise. (cilk_compute_loop_count): Likewise. (insert_cilk_for_nested_fn): Likewise. (cilk_compute_loop_var): Likewise. (cilk_set_inclusive_and_direction): Likewise. (cilk_set_iter_difftype): Likewise. (cilk_set_incr_info): Likewise. (cilk_set_init_info): Likewise. (clk_simplify_tree): Likewise. (cilk_find_code_from_call): Likewise. (cilk_tree_operand_noconv): Likewise. (cilk_resolve_continue_stmts): Likewise. * c-pragma.c (init_pragma): Added pragma grainsize. * c-pragma.h (enum pragma_kind): Added PRAGMA_CILK_GRAINSIZE. * cilk.c (enum add_variable_type): Moved to ../cilk.h. (enum cilk_block_type): Likewise. (struct wrapper_data): Likewise. (cilk_call_graph_add_fn): New function. (cilk_create_cilk_helper_decl): Likewise. (cilk_outline): Renamed to cilk_outline_body. Also added a parameter to hold throw flag for C++. (cilk_create_wrapper_body): Renamed create_cilk_helper_decl, call_graph_add_fn and cilk_outline to cilk_create_cilk_helper_decl, cilk_call_graph_add_fn, and cilk_outline_body, respectively. (create_cilk_wrapper): Renamed extact_free_variables to cilk_extract_free_variables. (extract_free_variables): Likewise. (cilk_init_cfd): New function. (find_cilk_for_library_fn): Likewise. (cilk_compute_incr_direction): Likewise. (cilk_check_loop_difference_type): Likewise. (cilk_simplify_tree): Likewise. (declare_cilk_for_vars): Likewise. (declare_cilk_for_parms): Likewise. (cilk_loop_convert): Likewise. (cilk_divide_count): Likewise. (cilk_calc_forward_div_op): Likewise. (cilk_compute_loop_count): Likewise. (insert_cilk_for_nested_fn): Likewise. (cilk_compute_loop_var): Likewise. (cilk_tree_operand_noconv): Likewise. (cilk_find_code_from_call): Likewise. (cilk_set_init_info): Likewise. (cilk_set_inclusive_and_direction): Likewise. (cilk_set_iter_difftype): Likewise. (cilk_set_incr_info): Likewise. gcc/c/ChangeLog. 2013-11-15 Balaji V. Iyer <balaji.v.iyer@intel.com> * Make-lang.in (C_AND_OBJC_OBJS): Added c/c-cilk.o. * c-cilk.c: New file. * c-objc-common.h (LANG_HOOKS_CILKPLUS_GIMPLIFY_CILK_FOR): New #define. * c-parser.c (c_parser_cilk_for_statement): New function prototype. (c_parser_cilk_grainsize): New function prototype and function. (c_parser_statement_after_labels): Added RID_CILK_FOR case. (c_parser_pragma): Added PRAGMA_CILK_GRAINSIZE case. (c_parser_cilk_for_statement): Renamed a parameter. Added code to accomodate RID_CILK_FOR tree (i.e. to parse _Cilk_for statements). * c-tree.h (c_gimplify_cilk_for): New prototype. gcc/testsuite/ChangeLog. 2013-11-15 Balaji V. Iyer <balaji.v.iyer@intel.com> * gcc.dg/cilk-plus/CK/cilk-for.c: New test. * gcc.dg/cilk-plus/CK/cilk_for_decr.c: Likewise. * gcc.dg/cilk-plus/CK/cilk_for_errors.c: Likewise. * gcc.dg/cilk-plus/CK/cilk_for_grain.c: Likewise. * gcc.dg/cilk-plus/CK/cilk_for_grain_errors.c: Likewise. * gcc.dg/cilk-plus/CK/cilk_for_ptr_iter.c: Likewise. * gcc.dg/cilk-plus/CK/cilk_for_warning.c: Likewise. * gcc.dg/cilk-plus/cilk-plus.exp: Added support to call _Cilk_for testcodes. gcc/cp/ChangeLog. 2013-11-15 Balaji V. Iyer <balaji.v.iyer@intel.com> * cp-cilk.c: Added langhooks.h and tree.h. (callable): New function. (calc_count_up_count_down): Likewise. (compute_loop_var_cp_iter_hdl): Likewise. (cp_create_cilk_for_body): Likewise. (create_cilk_for_nested_fn): Likewise. (gimplify_cilk_for_1): Likewise. (cp_extract_cilk_for_fields): Likewise. (cp_gimplify_cilk_for): Likewise. * cp-gimplify.c (genericize_cilk_for_stmt): Likewise. (cp_genericize_r): Added a check for CILK_FOR_STMT. * cp-objcp-common.h (LANG_HOOKS_CILKPLUS_GIMPLIFY_CILK_FOR): New #define. * cp-tree.h (begin_cilk_for_stmt): New prototype. (finish_cilk_for_stmt): Likewise. (finish_cilk_for_init_stmt): Likewise. (cp_gimplify_cilk_for): Likewise. * name-lookup.c (begin_scope): Added sk_cilk_for case. * name-lookup.h (enum scope_kind): Added sk_cilk_for. * parser.c (cp_parser_cilk_grainsize): New function and prototype. (cp_parser_init_declarator): Added a new parameter to hold the initial value. (cp_parser_statement): Added RID_CILK_FOR case. (cp_parser_iteration_statement): Likewise. (cp_parser_jump_statement): Added IN_CILK_FOR_STMT case (twice). (cp_parser_pragma): Added PRAGMA_CILK_GRAINSIZE case. (cp_parser_cilk_for_init_statement): New function. (cp_parser_cilk_for): Renamed a parameter and added support for parsing _Cilk_for loops that are part of Cilk keywords. * parser.h (IN_CILK_FOR_STMT): New #define. * pt.c (tsubst_expr): Added CILK_FOR_STMT case. * semantics.c (begin_for_scope): Added "_Cilk_for statement" in the header comment. (finish_for_expr): Added support for CILK_FOR_STMT to use this function. (finish_cilk_for_cond): Added support for processing templates. (begin_cilk_for_stmt): New function. (finish_cilk_for_init_stmt): Likewise. (finish_clk_for_stmt): Likewise. gcc/testsuite/ChangeLog. 2013-11-15 Balaji V. Iyer <balaji.v.iyer@intel.com> * g++.dg/cilk-plus/CK/cilk-for-start-at-5.cc: New test. * g++.dg/cilk-plus/CK/cilk-for-tplt.cc: Likewise. * g++.dg/cilk-plus/CK/cilk-for.cc: Likewise. * g++.dg/cilk-plus/CK/cilk_for_cont_inside_for.cc: Likewise. * g++.dg/cilk-plus/CK/cilk_for_cont_with_for.cc: Likewise. * g++.dg/cilk-plus/CK/cilk_for_cont_with_if.cc: Likewise. * g++.dg/cilk-plus/CK/cilk_for_cont_with_while.cc: Likewise. * g++.dg/cilk-plus/CK/cilk_for_genricize_test.cc: Likewise. * g++.dg/cilk-plus/CK/cilk_for_grainsize.cc: Likewise. * g++.dg/cilk-plus/CK/cilk_for_p_errors.cc: Likewise. * g++.dg/cilk-plus/CK/cilk_for_t_errors.cc: Likewise. * g++.dg/cilk-plus/CK/explicit_ctor.cc: Likewise. * g++.dg/cilk-plus/CK/label_test.cc: Likewise. * g++.dg/cilk-plus/CK/no-opp-overload-error.cc: Likewise. * g++.dg/cilk-plus/CK/plus-equal-one.cc: Likewise. * g++.dg/cilk-plus/CK/plus-equal-test.cc: Likewise. * g++.dg/cilk-plus/CK/stl_iter.cc: Likewise. * g++.dg/cilk-plus/CK/stl_test.cc: Likewise. * g++.dg/cilk-plus/cilk-plus.exp: Added support to call _Cilk_for testcodes. Thanking You, Yours Sincerely, Balaji V. Iyer.
Attachment:
diff_cilk_for_c.txt
Description: diff_cilk_for_c.txt
Attachment:
diff_cilk_for_c++.txt
Description: diff_cilk_for_c++.txt
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |