Hi Jeff et al., Did you get a chance to look at my _Cilk_for patch for C?
Thanks, Balaji V. Iyer. > -----Original Message----- > From: Iyer, Balaji V > Sent: Monday, November 18, 2013 4:51 PM > To: Aldy Hernandez > Cc: gcc-patches@gcc.gnu.org; Jeff Law; Jason Merrill (ja...@redhat.com); > r...@redhat.com > Subject: RE: [PATCH] _Cilk_for for C and C++ > > Hello Everyone, > Please see my comment below: > > > -----Original Message----- > > From: Aldy Hernandez [mailto:al...@redhat.com] > > Sent: Friday, November 15, 2013 4:51 PM > > To: Iyer, Balaji V > > Cc: gcc-patches@gcc.gnu.org; Jeff Law; Jason Merrill > > (ja...@redhat.com); r...@redhat.com > > Subject: Re: [PATCH] _Cilk_for for C and C++ > > > > On 11/15/13 12:23, Iyer, Balaji V wrote: > > > > > This patch is dependent on the following patches: > > > > > > #pragma simd work (they both share the same parser routines) > > > > I have just committed this to trunk, so it shouldn't be a blocker. > > > > Also, in the past 2 days the #pragma simd parsing has been merged with > > the OpenMP parsing routines, so please adjust your patch accordingly. > > Attached, please find a refreshed patches (one for C and 1 for C++). > The trunk was "diffed" after Aldy's check in of pragma simd was in. So, now > this patch is only dependent on _Cilk_spawn and _Cilk_sync (mostly for > execution of tests). They are tested on x86_64 and works successfully. > > Here are the fixed Changelog entries (C related changelogs are given first > then C++): > > C- Related Changes > ========================================================== > =========================== > gcc/ChangeLog. > 2013-11-18 Balaji V. Iyer <balaji.v.i...@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-18 Balaji V. Iyer <balaji.v.i...@intel.com> > > * c-cilkplus.c (c_check_cilk_loop_incr): New function. > (c_validate_cilk_plus_loop): Likewise. > (c_check_cilk_loop): Likewise. > (c_finish_cilk_for_loops): Likewise. > (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. > (c_validate_cilk_loop): Likewise. > (c_check_cilk_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-18 Balaji V. Iyer <balaji.v.i...@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-18 Balaji V. Iyer <balaji.v.i...@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. > > > ========================================================== > =================================== > > Here are the C++ related ChangeLogs: > > gcc/cp/ChangeLog. > 2013-11-18 Balaji V. Iyer <balaji.v.i...@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-18 Balaji V. Iyer <balaji.v.i...@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. > > Thanks, > > Balaji V. Iyer.