diff options
author | bviyer <bviyer@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-28 19:55:10 +0000 |
---|---|---|
committer | bviyer <bviyer@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-28 19:55:10 +0000 |
commit | 3c6d419718bbe307410cf2e03db130fa6dfc3556 (patch) | |
tree | 7bd32114bcd1a25d4a1caa95b66d2894e6e75dc7 /gcc/cilkplus.def | |
parent | 979283e66183007af813e1fb09329c378629cc20 (diff) | |
download | gcc-3c6d419718bbe307410cf2e03db130fa6dfc3556.tar.gz |
Implemented Cilk Plus Array Notation for C Compiler.
gcc/ChangeLog
2013-05-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.
* Makefile.in (C_COMMON_OBJS): Added
c-family/array-notation-common.o.
(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-05-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.
* 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-05-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.
gcc/testsuite/ChangeLog
2013-05-28 Balaji V. Iyer <balaji.v.iyer@intel.com>
* c-c++-common/cilk-plus/AN/array_test1.c: New test.
* c-c++-common/cilk-plus/AN/array_test2.c: Likewise.
* c-c++-common/cilk-plus/AN/array_test_ND.c: Likewise.
* c-c++-common/cilk-plus/AN/builtin_func_double.c: Likewise.
* c-c++-common/cilk-plus/AN/builtin_func_double2.c: Likewise.
* c-c++-common/cilk-plus/AN/gather-scatter-errors.c: Likewise.
* c-c++-common/cilk-plus/AN/if_test.c: Likewise.
* c-c++-common/cilk-plus/AN/sec_implicit_ex.c: Likewise.
* c-c++-common/cilk-plus/AN/decl-ptr-colon.c: Likewise.
* c-c++-common/cilk-plus/AN/dimensionless-arrays.c: Likewise.
* c-c++-common/cilk-plus/AN/fn_ptr.c: Likewise.
* c-c++-common/cilk-plus/AN/fp_triplet_values.c: Likewise.
* c-c++-common/cilk-plus/AN/gather-scatter.c: Likewise.
* c-c++-common/cilk-plus/AN/misc.c: Likewise.
* c-c++-common/cilk-plus/AN/parser_errors.c: Likewise.
* c-c++-common/cilk-plus/AN/parser_errors2.c: Likewise.
* c-c++-common/cilk-plus/AN/parser_errors3.c: Likewise.
* c-c++-common/cilk-plus/AN/parser_errors4.c: Likewise.
* c-c++-common/cilk-plus/AN/rank_mismatch.c: Likewise.
* c-c++-common/cilk-plus/AN/rank_mismatch2.c: Likewise.
* c-c++-common/cilk-plus/AN/rank_mismatch3.c: Likewise.
* c-c++-common/cilk-plus/AN/sec_implicit.c: Likewise.
* c-c++-common/cilk-plus/AN/sec_implicit2.c: Likewise.
* c-c++-common/cilk-plus/AN/sec_reduce_max_min_ind.c: Likewise.
* c-c++-common/cilk-plus/AN/tst_lngth.c: Likewise.
* c-c++-common/cilk-plus/AN/vla.c: Likewise.
* c-c++-common/cilk-plus/AN/an-if.c: Likewise.
* c-c++-common/cilk-plus/AN/builtin_fn_custom.c: Likewise.
* c-c++-common/cilk-plus/AN/builtin_fn_mutating.c: Likewise.
* c-c++-common/cilk-plus/AN/comma_exp.c: Likewise.
* c-c++-common/cilk-plus/AN/conditional.c: Likewise.
* c-c++-common/cilk-plus/AN/exec-once.c: Likewise.
* c-c++-common/cilk-plus/AN/exec-once2.c: Likewise.
* c-c++-common/cilk-plus/AN/gather_scatter.c: Likewise.
* c-c++-common/cilk-plus/AN/n-ptr-test.c: Likewise.
* c-c++-common/cilk-plus/AN/side-effects-1.c: Likewise.
* c-c++-common/cilk-plus/AN/test_builtin_return.c: Likewise.
* c-c++-common/cilk-plus/AN/test_sec_limits.c: Likewise.
* gcc.dg/cilk-plus/cilk-plus.exp: New script.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@199389 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cilkplus.def')
-rw-r--r-- | gcc/cilkplus.def | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/gcc/cilkplus.def b/gcc/cilkplus.def new file mode 100644 index 00000000000..cb3824f4ee6 --- /dev/null +++ b/gcc/cilkplus.def @@ -0,0 +1,59 @@ +/* This file contains the definitions and documentation for the + CilkPlus builtins used in the GNU compiler. + Copyright (C) 2013 Free Software Foundation, Inc. + +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/>. */ + +/* Before including this file, you should define a macro: + + DEF_CILKPLUS_BUILTIN (ENUM, NAME, TYPE, ATTRS) + + See builtins.def for details. */ + +DEF_CILKPLUS_BUILTIN (BUILT_IN_CILKPLUS_SEC_REDUCE_ADD, + "__sec_reduce_add", BT_FN_INT_PTR, ATTR_NULL) +DEF_CILKPLUS_BUILTIN (BUILT_IN_CILKPLUS_SEC_REDUCE_MUL, + "__sec_reduce_mul", BT_FN_INT_PTR, ATTR_NULL) +DEF_CILKPLUS_BUILTIN (BUILT_IN_CILKPLUS_SEC_REDUCE_ALL_ZERO, + "__sec_reduce_all_zero", BT_FN_INT_PTR, ATTR_NULL) +DEF_CILKPLUS_BUILTIN (BUILT_IN_CILKPLUS_SEC_REDUCE_ANY_ZERO, + "__sec_reduce_any_zero", BT_FN_INT_PTR, ATTR_NULL) +DEF_CILKPLUS_BUILTIN (BUILT_IN_CILKPLUS_SEC_REDUCE_MAX, + "__sec_reduce_max", BT_FN_INT_PTR, ATTR_NULL) +DEF_CILKPLUS_BUILTIN (BUILT_IN_CILKPLUS_SEC_REDUCE_MIN, + "__sec_reduce_min", BT_FN_INT_PTR, ATTR_NULL) +DEF_CILKPLUS_BUILTIN (BUILT_IN_CILKPLUS_SEC_REDUCE_MIN_IND, + "__sec_reduce_min_ind", BT_FN_INT_PTR, ATTR_NULL) +DEF_CILKPLUS_BUILTIN (BUILT_IN_CILKPLUS_SEC_REDUCE_MAX_IND, + "__sec_reduce_max_ind", BT_FN_INT_PTR, ATTR_NULL) +DEF_CILKPLUS_BUILTIN (BUILT_IN_CILKPLUS_SEC_REDUCE_ANY_NONZERO, + "__sec_reduce_any_nonzero", BT_FN_INT_PTR, ATTR_NULL) +DEF_CILKPLUS_BUILTIN (BUILT_IN_CILKPLUS_SEC_REDUCE_ALL_NONZERO, + "__sec_reduce_all_nonzero", BT_FN_INT_PTR, ATTR_NULL) +DEF_CILKPLUS_BUILTIN (BUILT_IN_CILKPLUS_SEC_REDUCE, + "__sec_reduce", BT_FN_INT_PTR_PTR_PTR, ATTR_NULL) +DEF_CILKPLUS_BUILTIN (BUILT_IN_CILKPLUS_SEC_REDUCE_MUTATING, + "__sec_reduce_mutating", BT_FN_INT_PTR_PTR_PTR, ATTR_NULL) +// FIXME: This probably needs to be rewritten as a keyword. +DEF_CILKPLUS_BUILTIN (BUILT_IN_CILKPLUS_SEC_IMPLICIT_INDEX, + "__sec_implicit_index", BT_FN_INT_INT, ATTR_NULL) + +/* +Local variables: +mode:c +End: +*/ |