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]

[patch] cilkplus: Array notation for C patch


Hello Joseph, Aldy et al.,
	Attached, please find a fixed patch (bzipped) that implements array notation for C. To my best knowledge, I have fixed all the changes Joseph and Aldy have mentioned in the previous email threads (http://gcc.gnu.org/ml/gcc-patches/2013-03/msg01182.html, http://gcc.gnu.org/ml/gcc-patches/2013-03/msg01173.html, http://gcc.gnu.org/ml/gcc-patches/2013-03/msg00748.html, etc). Is it OK for trunk?

Thanks,

Balaji V. Iyer.

Here are the Changelog entries:

gcc/ChangeLog
+2013-03-28  Balaji V. Iyer  <balaji.v.iyer@intel.com>
+
+       * doc/extend.texi (C Extensions): Added documentation about Cilk Plus
+       array notation built-in reduction functions.
+       * doc/passes.texi (Passes): Added documentation about changes done
+       for Cilk Plus.
+       * doc/invoke.texi (C Dialect Options): Added documentation about
+       the -fcilkplus flag.
+       * doc/generic.texi (Storage References): Added documentation for
+       ARRAY_NOTATION_REF storage.
+       * Makefile.in (C_COMMON_OBJS): Added c-family/array-notation-common.o.
+       * tree-pretty-print.c (dump_generic_node): Add case for
+       ARRAY_NOTATION_REF.
+       (BUILTINS_DEF): Depend on cilkplus.def.
+       * builtins.def: Include cilkplus.def.
+       Define DEF_CILKPLUS_BUILTIN.
+       * builtin-types.def: Define BT_FN_INT_PTR_PTR_PTR.
+       * cilkplus.def: New file.

gcc/c-family/ChangeLog
+2013-03-28  Balaji V. Iyer  <balaji.v.iyer@intel.com>
+
+	* c-common.c (c_define_builtins): When cilkplus is enabled, the
+	function array_notation_init_builtins is called.
+	(c_common_init_ts): Added ARRAY_NOTATION_REF as typed.
+	* c-common.def (ARRAY_NOTATION_REF): New tree.
+	* c-common.h (build_array_notation_expr): New function declaration.
+	(build_array_notation_ref): Likewise.
+	(extract_sec_implicit_index_arg): New extern declaration.
+	(is_sec_implicit_index_fn): Likewise.
+	(ARRAY_NOTATION_CHECK): New define.
+	(ARRAY_NOTATION_ARRAY): Likewise.
+	(ARRAY_NOTATION_START): Likewise.
+	(ARRAY_NOTATION_LENGTH): Likewise.
+	(ARRAY_NOTATION_STRIDE): Likewise.
+	(ARRAY_NOTATION_TYPE): Likewise.
+	* c-pretty-print.c (pp_c_postifix_expression): Added a new case for
+	ARRAY_NOTATION_REF.
+	(pp_c_expression): Likewise.
+	* c.opt (flag_enable_cilkplus): New flag.
+	* array-notation-common.c: New file.

gcc/c/ChangeLog
+2013-03-28  Balaji V. Iyer  <balaji.v.iyer@intel.com>
+
+	* c-typeck.c (build_array_ref): Added a check to see if array's
+	index is greater than one.  If true, then emit an error.
+	(build_function_call_vec): Exclude error reporting and checking
+	for builtin array-notation functions.
+	(convert_arguments): Likewise.
+	(c_finish_return): Added a check for array notations as a return
+	expression.  If true, then emit an error.
+	(c_finish_loop): Added a check for array notations in a loop
+	condition.  If true then emit an error.
+	(lvalue_p): Added a ARRAY_NOTATION_REF case.
+	(build_binary_op): Added a check for array notation expr inside
+	op1 and op0.  If present, we call another function to find correct
+	type.
+	* Make-lang.in (C_AND_OBJC_OBJS): Added c-array-notation.o.
+	* c-parser.c (c_parser_compound_statement): Check if array
+	notation code is used in tree, if so, then transform them into
+	appropriate C code.
+	(c_parser_expr_no_commas): Check if array notation is used in LHS
+	or RHS, if so, then build array notation expression instead of
+	regular modify.
+	(c_parser_postfix_expression_after_primary): Added a check for
+	colon(s) after square braces, if so then handle it like an array
+	notation.  Also, break up array notations in unary op if found.
+	(c_parser_direct_declarator_inner): Added a check for array
+	notation.
+	(c_parser_compound_statement): Added a check for array notation in
+	a stmt.  If one is present, then expand array notation expr.
+	(c_parser_if_statement): Likewise.
+	(c_parser_switch_statement): Added a check for array notations in
+	a switch statement's condition.  If true, then output an error.
+	(c_parser_while_statement): Similarly, but for a while.
+	(c_parser_do_statement): Similarly, but for a do-while.
+	(c_parser_for_statement): Similarly, but for a for-loop.
+	(c_parser_unary_expression): Check if array notation is used in a
+	pre-increment or pre-decrement expression.  If true, then expand
+	them.
+	(c_parser_array_notation): New function.
+	* c-array-notation.c: New file.
+	* c-tree.h (is_cilkplus_reduce_builtin): Protoize.


> -----Original Message-----
> From: Joseph Myers [mailto:joseph@codesourcery.com]
> Sent: Wednesday, March 27, 2013 6:11 PM
> To: Aldy Hernandez
> Cc: gcc-patches; Iyer, Balaji V
> Subject: Re: [cilkplus-merge] rewrite __sec_reduce* builtin handling to use
> <.def> infrastructure
> 
> On Wed, 27 Mar 2013, Aldy Hernandez wrote:
> 
> > Is this OK for the branch?  I'd like to get a nod of approval before
> > committing to the branch, as to aid in review, but if you prefer that
> > I just commit at will, and then post a big "cilk plus array notation"
> > patch to the list, I can do this instead.  It just seems easier to fix
> > stuff incrementally, as suggestions and fixes are piling up for both Balaji and
> myself.
> 
> I'm expecting the two of you to deal with reviews for the branch and then repost
> a big patch against trunk once you think all the comments have been addressed.
> But this looks like the sort of thing I was expecting for cleaning up the built-in
> function handling.
> 
> --
> Joseph S. Myers
> joseph@codesourcery.com

Attachment: array_notation_c_patch.txt.bz2
Description: array_notation_c_patch.txt.bz2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]