aboutsummaryrefslogtreecommitdiff
path: root/gcc/cilk-common.c
diff options
context:
space:
mode:
authorJulia Koval <julia.koval@intel.com>2017-11-28 11:35:37 +0100
committerJulia Koval <jkoval@gcc.gnu.org>2017-11-28 11:35:37 +0100
commit5e9d6aa4c2fd245837ec26de1d01ee8eb7786af3 (patch)
tree193e05dc5baa657f44264efe9cf165e8572a0ccc /gcc/cilk-common.c
parent1be49a38e45a80d1ee6854f262c94abeb621dfda (diff)
downloadgcc-5e9d6aa4c2fd245837ec26de1d01ee8eb7786af3.zip
gcc-5e9d6aa4c2fd245837ec26de1d01ee8eb7786af3.tar.gz
gcc-5e9d6aa4c2fd245837ec26de1d01ee8eb7786af3.tar.bz2
Remove Cilk Plus support.
* Makefile.def (target_modules): Remove libcilkrts. * Makefile.in: Ditto. * configure: Ditto. * configure.ac: Ditto. contrib/ * contrib/gcc_update: Ditto. gcc/ * Makefile.in (cilkplus.def, cilk-builtins.def, c-family/cilk.o, c-family/c-cilkplus.o, c-family/array-notation-common.o, cilk-common.o, cilk.h, cilk-common.c): Remove. * builtin-types.def (BT_FN_INT_PTR_PTR_PTR_FTYPE_BT_INT_BT_PTR_BT_PTR_BT_PTR): Remove. * builtins.c (is_builtin_name): Remove cilkplus condition. (BUILT_IN_CILK_DETACH, BUILT_IN_CILK_POP_FRAME): Remove. * builtins.def (DEF_CILK_BUILTIN_STUB, DEF_CILKPLUS_BUILTIN, cilk-builtins.def, cilkplus.def): Remove. * cif-code.def (CILK_SPAWN): Remove. * cilk-builtins.def: Delete. * cilk-common.c: Ditto. * cilk.h: Ditto. * cilkplus.def: Ditto. * config/darwin.h (fcilkplus): Delete. * cppbuiltin.c: Ditto. * doc/extend.texi: Remove cilkplus doc. * doc/generic.texi: Ditto. * doc/invoke.texi: Ditto. * doc/passes.texi: Ditto. * gcc.c (fcilkplus): Remove. * gengtype.c (cilk.h): Remove. * gimple-pretty-print.c (dump_gimple_omp_for): Remove cilkplus support. * gimple.h (GF_OMP_FOR_KIND_CILKFOR, GF_OMP_FOR_KIND_CILKSIMD): Remove. * gimplify.c (gimplify_return_expr, maybe_fold_stmt, gimplify_call_expr, is_gimple_stmt, gimplify_modify_expr, gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses, gimplify_omp_for, gimplify_expr): Remove cilkplus conditions. * ipa-fnsummary.c (ipa_dump_fn_summary, compute_fn_summary, inline_read_section): Ditto. * ipa-inline-analysis.c (cilk.h): Remove. * ira.c (ira_setup_eliminable_regset): Remove cilkplus support. * lto-wrapper.c (merge_and_complain, append_compiler_options, append_linker_options): Remove condition for fcilkplus. * lto/lto-lang.c (cilk.h): Remove. (lto_init): Remove condition for fcilkplus. * omp-expand.c (expand_cilk_for_call): Delete. (expand_omp_taskreg, expand_omp_for_static_chunk, expand_omp_for): Remove cilkplus conditions. (expand_cilk_for): Delete. * omp-general.c (omp_extract_for_data): Remove cilkplus support. * omp-low.c (scan_sharing_clauses, create_omp_child_function, execute_lower_omp, diagnose_sb_0): Ditto. * omp-simd-clone.c (simd_clone_clauses_extract): Ditto. * tree-core.h (OMP_CLAUSE__CILK_FOR_COUNT_): Delete. * tree-nested.c: Ditto. * tree-pretty-print.c (dump_omp_clause): Remove cilkplus support. (dump_generic_node): Ditto. * tree.c (OMP_CLAUSE__CILK_FOR_COUNT_): Delete. * tree.def (cilk_simd, cilk_for, cilk_spawn_stmt, cilk_sync_stmt): Delete. * tree.h (CILK_SPAWN_FN, EXPR_CILK_SPAWN): Delete. gcc/c-family/ * array-notation-common.c: Delete. * c-cilkplus.c: Ditto. * c-common.c (_Cilk_spawn, _Cilk_sync, _Cilk_for): Remove. * c-common.def (ARRAY_NOTATION_REF): Remove. * c-common.h (RID_CILK_SPAWN, build_array_notation_expr, build_array_notation_ref, C_ORT_CILK, c_check_cilk_loop, c_validate_cilk_plus_loop, cilkplus_an_parts, cilk_ignorable_spawn_rhs_op, cilk_recognize_spawn): Remove. * c-gimplify.c (CILK_SPAWN_STMT): Remove. * c-omp.c: Remove CILK_SIMD check. * c-pragma.c: Ditto. * c-pragma.h: Remove CILK related pragmas. * c-pretty-print.c (c_pretty_printer::postfix_expression): Remove ARRAY_NOTATION_REF condition. (c_pretty_printer::expression): Ditto. * c.opt (fcilkplus): Remove. * cilk.c: Delete. gcc/c/ * Make-lang.in (c/c-array-notation.o): Remove. * c-array-notation.c: Delete. * c-decl.c: Remove cilkplus condition. * c-parser.c (c_parser_cilk_simd, c_parser_cilk_for, c_parser_cilk_verify_simd, c_parser_array_notation, c_parser_cilk_clause_vectorlength, c_parser_cilk_grainsize, c_parser_cilk_simd_fn_vector_attrs, c_finish_cilk_simd_fn_tokens): Delete. (c_parser_declaration_or_fndef): Remove cilkplus condition. (c_parser_direct_declarator_inner): Ditto. (CILK_SIMD_FN_CLAUSE_MASK): Delete. (c_parser_attributes, c_parser_compound_statement, c_parser_statement_after_labels, c_parser_if_statement, c_parser_switch_statement, c_parser_while_statement, c_parser_do_statement, c_parser_for_statement, c_parser_unary_expression, c_parser_postfix_expression, c_parser_postfix_expression_after_primary, c_parser_pragma, c_parser_omp_clause_name, c_parser_omp_all_clauses, c_parser_omp_for_loop, c_finish_omp_declare_simd): Remove cilkplus support. * c-typeck.c (build_array_ref, build_function_call_vec, convert_arguments, lvalue_p, build_compound_expr, c_finish_return, c_finish_if_stmt, c_finish_loop, build_binary_op): Remove cilkplus support. gcc/cp/ * Make-lang.in (cp/cp-array-notation.o, cp/cp-cilkplus.o): Delete. * call.c (convert_for_arg_passing, build_cxx_call): Remove cilkplus. * constexpr.c (potential_constant_expression_1): Ditto. * cp-array-notation.c: Delete. * cp-cilkplus.c: Ditto. * cp-cilkplus.h: Ditto. * cp-gimplify.c (cp_gimplify_expr, cp_fold_r, cp_genericize): Remove cilkplus condition. * cp-objcp-common.c (ARRAY_NOTATION_REF): Delete. * cp-tree.h (cilkplus_an_triplet_types_ok_p): Delete. * decl.c (grokfndecl, finish_function): Remove cilkplus condition. * error.c (dump_decl, dump_expr): Remove ARRAY_NOTATION_REF condition. * lambda.c (cp-cilkplus.h): Remove. * parser.c (cp_parser_cilk_simd, cp_parser_cilk_for, cp_parser_cilk_simd_vectorlength): Delete. (cp_debug_parser, cp_parser_ctor_initializer_opt_and_function_body, cp_parser_postfix_expression, cp_parser_postfix_open_square_expression, cp_parser_statement, cp_parser_jump_statement, cp_parser_direct_declarator, cp_parser_late_return_type_opt, cp_parser_gnu_attribute_list, cp_parser_omp_clause_name, cp_parser_omp_clause_aligned, cp_parser_omp_clause_linear, cp_parser_omp_all_clauses, cp_parser_omp_flush, cp_parser_omp_for_cond, cp_parser_omp_for_incr, cp_parser_omp_for_loop_init, cp_parser_omp_for_loop, cp_parser_omp_declare_simd): Remove cilkplus support. (CILK_SIMD_FN_CLAUSE_MASK, cp_parser_late_parsing_cilk_simd_fn_info, cp_parser_cilk_grainsize): Remove. (cp_parser_pragma, c_parse_file): Remove cilkplus support. (cp_parser_cilk_simd_vectorlength, cp_parser_cilk_simd_linear, cp_parser_cilk_simd_clause_name, cp_parser_cilk_simd_all_clauses, cp_parser_cilk_simd, cp_parser_cilk_for): Remove. * parser.h (IN_CILK_SIMD_FOR, IN_CILK_SPAWN): Remove. * pt.c (tsubst_attribute, tsubst_expr, tsubst_copy_and_build): Remove cilkplus support. * semantics.c (finish_goto_stmt, begin_while_stmt, finish_do_body, finish_init_stmt, finish_switch_cond, simplify_aggr_init_expr, finish_omp_clauses, finish_omp_clauses, finish_omp_for): Remove cilkplus support. * tree.c (lvalue_kind): Remove ARRAY_NOTATION_REF conditon. * typeck.c (cp_build_array_ref, cp_build_compound_expr, check_return_expr): Remove cilkplus support. gcc/testsuite/ * c-c++-common/attr-simd-3.c: Delete. * c-c++-common/cilk-plus/AN/an-if.c: Delete. * c-c++-common/cilk-plus/AN/array_test1.c: Delete. * c-c++-common/cilk-plus/AN/array_test2.c: Delete. * c-c++-common/cilk-plus/AN/array_test_ND.c: Delete. * c-c++-common/cilk-plus/AN/builtin_fn_custom.c: Delete. * c-c++-common/cilk-plus/AN/builtin_fn_mutating.c: Delete. * c-c++-common/cilk-plus/AN/builtin_func_double.c: Delete. * c-c++-common/cilk-plus/AN/builtin_func_double2.c: Delete. * c-c++-common/cilk-plus/AN/comma_exp.c: Delete. * c-c++-common/cilk-plus/AN/conditional.c: Delete. * c-c++-common/cilk-plus/AN/decl-ptr-colon.c: Delete. * c-c++-common/cilk-plus/AN/dimensionless-arrays.c: Delete. * c-c++-common/cilk-plus/AN/exec-once.c: Delete. * c-c++-common/cilk-plus/AN/exec-once2.c: Delete. * c-c++-common/cilk-plus/AN/fn_ptr-2.c: Delete. * c-c++-common/cilk-plus/AN/fn_ptr.c: Delete. * c-c++-common/cilk-plus/AN/fp_triplet_values.c: Delete. * c-c++-common/cilk-plus/AN/gather-scatter-errors.c: Delete. * c-c++-common/cilk-plus/AN/gather_scatter.c: Delete. * c-c++-common/cilk-plus/AN/if_test.c: Delete. * c-c++-common/cilk-plus/AN/if_test_errors.c: Delete. * c-c++-common/cilk-plus/AN/misc.c: Delete. * c-c++-common/cilk-plus/AN/n-ptr-test.c: Delete. * c-c++-common/cilk-plus/AN/parser_errors.c: Delete. * c-c++-common/cilk-plus/AN/parser_errors2.c: Delete. * c-c++-common/cilk-plus/AN/parser_errors3.c: Delete. * c-c++-common/cilk-plus/AN/parser_errors4.c: Delete. * c-c++-common/cilk-plus/AN/pr57457-2.c: Delete. * c-c++-common/cilk-plus/AN/pr57457.c: Delete. * c-c++-common/cilk-plus/AN/pr57490.c: Delete. * c-c++-common/cilk-plus/AN/pr57541-2.c: Delete. * c-c++-common/cilk-plus/AN/pr57541.c: Delete. * c-c++-common/cilk-plus/AN/pr57577.c: Delete. * c-c++-common/cilk-plus/AN/pr58942.c: Delete. * c-c++-common/cilk-plus/AN/pr61191.c: Delete. * c-c++-common/cilk-plus/AN/pr61455-2.c: Delete. * c-c++-common/cilk-plus/AN/pr61455.c: Delete. * c-c++-common/cilk-plus/AN/pr61962.c: Delete. * c-c++-common/cilk-plus/AN/pr61963.c: Delete. * c-c++-common/cilk-plus/AN/pr62008.c: Delete. * c-c++-common/cilk-plus/AN/pr63884.c: Delete. * c-c++-common/cilk-plus/AN/rank_mismatch.c: Delete. * c-c++-common/cilk-plus/AN/rank_mismatch2.c: Delete. * c-c++-common/cilk-plus/AN/rank_mismatch3.c: Delete. * c-c++-common/cilk-plus/AN/sec_implicit.c: Delete. * c-c++-common/cilk-plus/AN/sec_implicit2.c: Delete. * c-c++-common/cilk-plus/AN/sec_implicit_ex.c: Delete. * c-c++-common/cilk-plus/AN/sec_reduce_ind_same_value.c: Delete. * c-c++-common/cilk-plus/AN/sec_reduce_max_min_ind.c: Delete. * c-c++-common/cilk-plus/AN/sec_reduce_return.c: Delete. * c-c++-common/cilk-plus/AN/side-effects-1.c: Delete. * c-c++-common/cilk-plus/AN/test_builtin_return.c: Delete. * c-c++-common/cilk-plus/AN/test_sec_limits.c: Delete. * c-c++-common/cilk-plus/AN/tst_lngth.c: Delete. * c-c++-common/cilk-plus/AN/vla.c: Delete. * c-c++-common/cilk-plus/CK/Wparentheses-1.c: Delete. * c-c++-common/cilk-plus/CK/cilk-for-2.c: Delete. * c-c++-common/cilk-plus/CK/cilk-for-3.c: Delete. * c-c++-common/cilk-plus/CK/cilk-fors.c: Delete. * c-c++-common/cilk-plus/CK/cilk_for_errors.c: Delete. * c-c++-common/cilk-plus/CK/cilk_for_grain.c: Delete. * c-c++-common/cilk-plus/CK/cilk_for_grain_errors.c: Delete. * c-c++-common/cilk-plus/CK/cilk_for_ptr_iter.c: Delete. * c-c++-common/cilk-plus/CK/compound_cilk_spawn.c: Delete. * c-c++-common/cilk-plus/CK/concec_cilk_spawn.c: Delete. * c-c++-common/cilk-plus/CK/errors.c: Delete. * c-c++-common/cilk-plus/CK/fib.c: Delete. * c-c++-common/cilk-plus/CK/fib_init_expr_xy.c: Delete. * c-c++-common/cilk-plus/CK/fib_no_return.c: Delete. * c-c++-common/cilk-plus/CK/fib_no_sync.c: Delete. * c-c++-common/cilk-plus/CK/invalid_spawns.c: Delete. * c-c++-common/cilk-plus/CK/invalid_sync.c: Delete.c * c-c++-common/cilk-plus/CK/nested_cilk_for.c: Delete. * c-c++-common/cilk-plus/CK/no_args_error.c: Delete. * c-c++-common/cilk-plus/CK/pr59631.c: Delete. * c-c++-common/cilk-plus/CK/pr60197-2.c: Delete. * c-c++-common/cilk-plus/CK/pr60197.c: Delete. * c-c++-common/cilk-plus/CK/pr60469.c: Delete. * c-c++-common/cilk-plus/CK/pr60586.c: Delete. * c-c++-common/cilk-plus/CK/pr63307.c: Delete. * c-c++-common/cilk-plus/CK/pr69826-1.c: Delete. * c-c++-common/cilk-plus/CK/pr69826-2.c: Delete. * c-c++-common/cilk-plus/CK/pr79428-4.c: Delete. * c-c++-common/cilk-plus/CK/pr79428-7.c: Delete. * c-c++-common/cilk-plus/CK/spawn_in_return.c: Delete. * c-c++-common/cilk-plus/CK/spawnee_inline.c: Delete. * c-c++-common/cilk-plus/CK/spawner_inline.c: Delete. * c-c++-common/cilk-plus/CK/spawning_arg.c: Delete. * c-c++-common/cilk-plus/CK/steal_check.c: Delete. * c-c++-common/cilk-plus/CK/sync_wo_spawn.c: Delete. * c-c++-common/cilk-plus/CK/test__cilk.c: Delete. * c-c++-common/cilk-plus/CK/varargs_test.c: Delete. * c-c++-common/cilk-plus/PS/Wparentheses-1.c: Delete. * c-c++-common/cilk-plus/PS/body.c: Delete. * c-c++-common/cilk-plus/PS/clauses1.c: Delete. * c-c++-common/cilk-plus/PS/clauses2.c: Delete. * c-c++-common/cilk-plus/PS/clauses3.c: Delete. * c-c++-common/cilk-plus/PS/clauses4.c: Delete. * c-c++-common/cilk-plus/PS/for1.c: Delete. * c-c++-common/cilk-plus/PS/for2.c: Delete. * c-c++-common/cilk-plus/PS/for3.c: Delete. * c-c++-common/cilk-plus/PS/pr69363.c: Delete. * c-c++-common/cilk-plus/PS/reduction-1.c: Delete. * c-c++-common/cilk-plus/PS/reduction-2.c: Delete. * c-c++-common/cilk-plus/PS/reduction-3.c: Delete. * c-c++-common/cilk-plus/PS/run-1.c: Delete. * c-c++-common/cilk-plus/PS/safelen.c: Delete. * c-c++-common/cilk-plus/PS/vectorlength-2.c: Delete. * c-c++-common/cilk-plus/PS/vectorlength-3.c: Delete. * c-c++-common/cilk-plus/PS/vectorlength.c: Delete. * c-c++-common/cilk-plus/SE/ef_error.c: Delete. * c-c++-common/cilk-plus/SE/ef_error2.c: Delete. * c-c++-common/cilk-plus/SE/ef_error3.c: Delete. * c-c++-common/cilk-plus/SE/ef_test.c: Delete. * c-c++-common/cilk-plus/SE/ef_test2.c: Delete. * c-c++-common/cilk-plus/SE/vlength_errors.c: Delete. * g++.dg/cilk-plus/AN/array_function.c: Delete. * g++.dg/cilk-plus/AN/array_test1_tplt.c: Delete. * g++.dg/cilk-plus/AN/array_test2_tplt.c: Delete. * g++.dg/cilk-plus/AN/array_test_ND_tplt.c: Delete. * g++.dg/cilk-plus/AN/braced_list.c: Delete. * g++.dg/cilk-plus/AN/builtin_fn_custom_tplt.c: Delete. * g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.c: Delete. * g++.dg/cilk-plus/AN/fp_triplet_values_tplt.c: Delete. * g++.dg/cilk-plus/AN/postincr_test.c: Delete. * g++.dg/cilk-plus/AN/preincr_test.c: Delete. * g++.dg/cilk-plus/CK/catch_exc.c: Delete. * g++.dg/cilk-plus/CK/cf3.c: Delete. * g++.dg/cilk-plus/CK/cilk-for-tplt.c: Delete. * g++.dg/cilk-plus/CK/const_spawn.c: Delete. * g++.dg/cilk-plus/CK/fib-opr-overload.c: Delete. * g++.dg/cilk-plus/CK/fib-tplt.c: Delete. * g++.dg/cilk-plus/CK/for1.c: Delete. * g++.dg/cilk-plus/CK/lambda_spawns.c: Delete. * g++.dg/cilk-plus/CK/lambda_spawns_tplt.c: Delete. * g++.dg/cilk-plus/CK/pr60586.c: Delete. * g++.dg/cilk-plus/CK/pr66326.c: Delete. * g++.dg/cilk-plus/CK/pr68001.c: Delete. * g++.dg/cilk-plus/CK/pr68997.c: Delete. * g++.dg/cilk-plus/CK/pr69024.c: Delete. * g++.dg/cilk-plus/CK/pr69048.c: Delete. * g++.dg/cilk-plus/CK/pr69267.c: Delete. * g++.dg/cilk-plus/CK/pr80038.c: Delete. * g++.dg/cilk-plus/CK/stl_iter.c: Delete. * g++.dg/cilk-plus/CK/stl_rev_iter.c: Delete. * g++.dg/cilk-plus/CK/stl_test.c: Delete. * g++.dg/cilk-plus/cilk-plus.exp * g++.dg/cilk-plus/ef_test.C: Delete. * g++.dg/cilk-plus/for.C: Delete. * g++.dg/cilk-plus/for2.C: Delete. * g++.dg/cilk-plus/for3.C: Delete. * g++.dg/cilk-plus/for4.C: Delete. * g++.dg/cilk-plus/pr60967.C: Delete. * g++.dg/cilk-plus/pr69028.C: Delete. * g++.dg/cilk-plus/pr70565.C: Delete. * g++.dg/pr57662.C: Delete. * gcc.dg/cilk-plus/cilk-plus.exp * gcc.dg/cilk-plus/for1.c: Delete. * gcc.dg/cilk-plus/for2.c: Delete. * gcc.dg/cilk-plus/jump-openmp.c: Delete. * gcc.dg/cilk-plus/jump.c: Delete. * gcc.dg/cilk-plus/pr69798-1.c: Delete. * gcc.dg/cilk-plus/pr69798-2.c: Delete. * gcc.dg/cilk-plus/pr78306.c: Delete. * gcc.dg/cilk-plus/pr79116.c: Delete. * gcc.dg/graphite/id-28.c: Delete. * lib/cilk-plus-dg.exp: Delete. * lib/target-supports.exp (cilkplus_runtime): Delete. Co-Authored-By: Sebastian Peryt <sebastian.peryt@intel.com> From-SVN: r255195
Diffstat (limited to 'gcc/cilk-common.c')
-rw-r--r--gcc/cilk-common.c571
1 files changed, 0 insertions, 571 deletions
diff --git a/gcc/cilk-common.c b/gcc/cilk-common.c
deleted file mode 100644
index edde471..0000000
--- a/gcc/cilk-common.c
+++ /dev/null
@@ -1,571 +0,0 @@
-/* This file is part of the Intel(R) Cilk(TM) Plus support
- This file contains the CilkPlus Intrinsics
- Copyright (C) 2013-2017 Free Software Foundation, Inc.
- 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/>. */
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "tm.h"
-#include "function.h"
-#include "rtl.h"
-#include "tree.h"
-#include "stringpool.h"
-#include "expmed.h"
-#include "optabs-query.h"
-#include "insn-config.h"
-#include "memmodel.h"
-#include "emit-rtl.h"
-#include "recog.h"
-#include "fold-const.h"
-#include "stor-layout.h"
-#include "langhooks.h"
-#include "explow.h"
-#include "profile-count.h"
-#include "expr.h"
-#include "tree-iterator.h"
-#include "gimplify.h"
-#include "cilk.h"
-
-/* This structure holds all the important fields of the internal structures,
- internal built-in functions, and Cilk-specific data types. Explanation of
- all the these fielsd are given in cilk.h. */
-tree cilk_trees[(int) CILK_TI_MAX];
-
-/* Returns the value in structure FRAME pointed by the FIELD_NUMBER
- (e.g. X.y).
- FIELD_NUMBER is an index to the structure FRAME_PTR. For details
- about these fields, refer to cilk_trees structure in cilk.h and
- cilk_init_builtins function in this file. Returns a TREE that is the type
- of the field represented by FIELD_NUMBER. If VOLATIL parameter is set
- to true then the returning field is set as volatile. */
-
-tree
-cilk_dot (tree frame, int field_number, bool volatil)
-{
- tree field = cilk_trees[field_number];
- field = fold_build3 (COMPONENT_REF, TREE_TYPE (field), frame, field,
- NULL_TREE);
- TREE_THIS_VOLATILE (field) = volatil;
- return field;
-}
-
-/* Returns the address of a field in FRAME_PTR, pointed by FIELD_NUMBER.
- (e.g. (&X)->y). Please see cilk_dot function for explanation of the
- FIELD_NUMBER. Returns a tree that is the type of the field represented
- by FIELD_NUMBER. If VOLATIL parameter is set to true then the returning
- field is set as volatile. */
-
-tree
-cilk_arrow (tree frame_ptr, int field_number, bool volatil)
-{
- return cilk_dot (build_simple_mem_ref (frame_ptr),
- field_number, volatil);
-}
-
-
-/* This function will add FIELD of type TYPE to a defined built-in
- structure. *NAME is the name of the field to be added. */
-
-static tree
-add_field (const char *name, tree type, tree fields)
-{
- tree t = get_identifier (name);
- tree field = build_decl (BUILTINS_LOCATION, FIELD_DECL, t, type);
- TREE_CHAIN (field) = fields;
- return field;
-}
-
-/* This function will define a built-in function of NAME, of type FNTYPE and
- register it under the built-in function code CODE. If PUBLISH is set then
- the declaration is pushed into the declaration list. CODE is the index
- to the cilk_trees array. *NAME is the name of the function to be added. */
-
-static tree
-install_builtin (const char *name, tree fntype, enum built_in_function code,
- bool publish)
-{
- tree fndecl = build_fn_decl (name, fntype);
- DECL_BUILT_IN_CLASS (fndecl) = BUILT_IN_NORMAL;
- DECL_FUNCTION_CODE (fndecl) = code;
- if (publish)
- {
- tree t = lang_hooks.decls.pushdecl (fndecl);
- if (t)
- fndecl = t;
- }
- set_builtin_decl (code, fndecl, true);
- return fndecl;
-}
-
-/* Returns a FUNCTION_DECL of type TYPE whose name is *NAME. */
-
-static tree
-declare_cilk_for_builtin (const char *name, tree type,
- enum built_in_function code)
-{
- tree cb, ft, fn;
-
- cb = build_function_type_list (void_type_node,
- ptr_type_node, type, type,
- NULL_TREE);
- cb = build_pointer_type (cb);
- ft = build_function_type_list (void_type_node,
- cb, ptr_type_node, type,
- integer_type_node, NULL_TREE);
- fn = install_builtin (name, ft, code, false);
- TREE_NOTHROW (fn) = 0;
-
- return fn;
-}
-
-/* Creates and initializes all the built-in Cilk keywords functions and three
- structures: __cilkrts_stack_frame, __cilkrts_pedigree and __cilkrts_worker.
- Detailed information about __cilkrts_stack_frame and
- __cilkrts_worker structures are given in libcilkrts/include/internal/abi.h.
- __cilkrts_pedigree is described in libcilkrts/include/cilk/common.h. */
-
-void
-cilk_init_builtins (void)
-{
- /* Now build the following __cilkrts_pedigree struct:
- struct __cilkrts_pedigree {
- uint64_t rank;
- struct __cilkrts_pedigree *parent;
- } */
-
- tree pedigree_type = lang_hooks.types.make_type (RECORD_TYPE);
- tree pedigree_ptr = build_pointer_type (pedigree_type);
- tree field = add_field ("rank", uint64_type_node, NULL_TREE);
- cilk_trees[CILK_TI_PEDIGREE_RANK] = field;
- field = add_field ("parent", pedigree_ptr, field);
- cilk_trees[CILK_TI_PEDIGREE_PARENT] = field;
- finish_builtin_struct (pedigree_type, "__cilkrts_pedigree_GCC", field,
- NULL_TREE);
- lang_hooks.types.register_builtin_type (pedigree_type,
- "__cilkrts_pedigree_t");
- cilk_pedigree_type_decl = pedigree_type;
-
- /* Build the Cilk Stack Frame:
- struct __cilkrts_stack_frame {
- uint32_t flags;
- uint32_t size;
- struct __cilkrts_stack_frame *call_parent;
- __cilkrts_worker *worker;
- void *except_data;
- void *ctx[4];
- uint32_t mxcsr;
- uint16_t fpcsr;
- uint16_t reserved;
- __cilkrts_pedigree pedigree;
- }; */
-
- tree frame = lang_hooks.types.make_type (RECORD_TYPE);
- tree frame_ptr = build_pointer_type (frame);
- tree worker_type = lang_hooks.types.make_type (RECORD_TYPE);
- tree worker_ptr = build_pointer_type (worker_type);
- tree s_type_node = build_int_cst (size_type_node, 4);
-
- tree flags = add_field ("flags", uint32_type_node, NULL_TREE);
- tree size = add_field ("size", uint32_type_node, flags);
- tree parent = add_field ("call_parent", frame_ptr, size);
- tree worker = add_field ("worker", worker_ptr, parent);
- tree except = add_field ("except_data", frame_ptr, worker);
- tree context = add_field ("ctx",
- build_array_type (ptr_type_node,
- build_index_type (s_type_node)),
- except);
- tree mxcsr = add_field ("mxcsr", uint32_type_node, context);
- tree fpcsr = add_field ("fpcsr", uint16_type_node, mxcsr);
- tree reserved = add_field ("reserved", uint16_type_node, fpcsr);
- tree pedigree = add_field ("pedigree", pedigree_type, reserved);
-
- /* Now add them to a common structure whose fields are #defined to something
- that is used at a later stage. */
- cilk_trees[CILK_TI_FRAME_FLAGS] = flags;
- cilk_trees[CILK_TI_FRAME_PARENT] = parent;
- cilk_trees[CILK_TI_FRAME_WORKER] = worker;
- cilk_trees[CILK_TI_FRAME_EXCEPTION] = except;
- cilk_trees[CILK_TI_FRAME_CONTEXT] = context;
- /* We don't care about reserved, so no need to store it in cilk_trees. */
- cilk_trees[CILK_TI_FRAME_PEDIGREE] = pedigree;
- TREE_ADDRESSABLE (frame) = 1;
-
- finish_builtin_struct (frame, "__cilkrts_st_frame_GCC", pedigree, NULL_TREE);
- cilk_frame_type_decl = frame;
- lang_hooks.types.register_builtin_type (frame, "__cilkrts_frame_t");
-
- cilk_frame_ptr_type_decl = build_qualified_type (frame_ptr,
- TYPE_QUAL_VOLATILE);
- /* Now let's do the following worker struct:
-
- struct __cilkrts_worker {
- __cilkrts_stack_frame *volatile *volatile tail;
- __cilkrts_stack_frame *volatile *volatile head;
- __cilkrts_stack_frame *volatile *volatile exc;
- __cilkrts_stack_frame *volatile *volatile protected_tail;
- __cilkrts_stack_frame *volatile *ltq_limit;
- int32_t self;
- global_state_t *g;
- local_state *l;
- cilkred_map *reducer_map;
- __cilkrts_stack_frame *current_stack_frame;
- void *reserved;
- __cilkrts_worker_sysdep_state *sysdep;
- __cilkrts_pedigree pedigree;
- } */
-
- tree fptr_volatil_type = build_qualified_type (frame_ptr, TYPE_QUAL_VOLATILE);
- tree fptr_volatile_ptr = build_pointer_type (fptr_volatil_type);
- tree fptr_vol_ptr_vol = build_qualified_type (fptr_volatile_ptr,
- TYPE_QUAL_VOLATILE);
- tree g = lang_hooks.types.make_type (RECORD_TYPE);
- finish_builtin_struct (g, "__cilkrts_global_state", NULL_TREE, NULL_TREE);
- tree l = lang_hooks.types.make_type (RECORD_TYPE);
- finish_builtin_struct (l, "__cilkrts_local_state", NULL_TREE, NULL_TREE);
- tree sysdep_t = lang_hooks.types.make_type (RECORD_TYPE);
- finish_builtin_struct (sysdep_t, "__cilkrts_worker_sysdep_state", NULL_TREE,
- NULL_TREE);
-
- field = add_field ("tail", fptr_vol_ptr_vol, NULL_TREE);
- cilk_trees[CILK_TI_WORKER_TAIL] = field;
- field = add_field ("head", fptr_vol_ptr_vol, field);
- field = add_field ("exc", fptr_vol_ptr_vol, field);
- field = add_field ("protected_tail", fptr_vol_ptr_vol, field);
- field = add_field ("ltq_limit", fptr_volatile_ptr, field);
- field = add_field ("self", integer_type_node, field);
- field = add_field ("g", build_pointer_type (g), field);
- field = add_field ("l", build_pointer_type (g), field);
- field = add_field ("reducer_map", ptr_type_node, field);
- field = add_field ("current_stack_frame", frame_ptr, field);
- cilk_trees[CILK_TI_WORKER_CUR] = field;
- field = add_field ("saved_protected_tail", fptr_volatile_ptr, field);
- field = add_field ("sysdep", build_pointer_type (sysdep_t), field);
- field = add_field ("pedigree", pedigree_type, field);
- cilk_trees[CILK_TI_WORKER_PEDIGREE] = field;
- finish_builtin_struct (worker_type, "__cilkrts_worker_GCC", field,
- NULL_TREE);
-
- tree fptr_arglist = tree_cons (NULL_TREE, frame_ptr, void_list_node);
- tree fptr_fun = build_function_type (void_type_node, fptr_arglist);
-
- /* void __cilkrts_enter_frame_1 (__cilkrts_stack_frame *); */
- cilk_enter_fndecl = install_builtin ("__cilkrts_enter_frame_1", fptr_fun,
- BUILT_IN_CILK_ENTER_FRAME, false);
-
- /* void __cilkrts_enter_frame_fast_1 (__cilkrts_stack_frame *); */
- cilk_enter_fast_fndecl =
- install_builtin ("__cilkrts_enter_frame_fast_1", fptr_fun,
- BUILT_IN_CILK_ENTER_FRAME_FAST, false);
-
- /* void __cilkrts_pop_frame (__cilkrts_stack_frame *); */
- cilk_pop_fndecl = install_builtin ("__cilkrts_pop_frame", fptr_fun,
- BUILT_IN_CILK_POP_FRAME, false);
-
- /* void __cilkrts_leave_frame (__cilkrts_stack_frame *); */
- cilk_leave_fndecl = install_builtin ("__cilkrts_leave_frame", fptr_fun,
- BUILT_IN_CILK_LEAVE_FRAME, false);
-
- /* void __cilkrts_sync (__cilkrts_stack_frame *); */
- cilk_sync_fndecl = install_builtin ("__cilkrts_sync", fptr_fun,
- BUILT_IN_CILK_SYNC, false);
-
- /* void __cilkrts_detach (__cilkrts_stack_frame *); */
- cilk_detach_fndecl = install_builtin ("__cilkrts_detach", fptr_fun,
- BUILT_IN_CILK_DETACH, false);
-
- /* __cilkrts_rethrow (struct stack_frame *); */
- cilk_rethrow_fndecl = install_builtin ("__cilkrts_rethrow", fptr_fun,
- BUILT_IN_CILK_RETHROW, false);
- TREE_NOTHROW (cilk_rethrow_fndecl) = 0;
-
- /* __cilkrts_save_fp_ctrl_state (__cilkrts_stack_frame *); */
- cilk_save_fp_fndecl = install_builtin ("__cilkrts_save_fp_ctrl_state",
- fptr_fun, BUILT_IN_CILK_SAVE_FP,
- false);
- /* __cilkrts_cilk_for_32 (...); */
- cilk_for_32_fndecl = declare_cilk_for_builtin ("__cilkrts_cilk_for_32",
- unsigned_intSI_type_node,
- BUILT_IN_CILK_FOR_32);
- /* __cilkrts_cilk_for_64 (...); */
- cilk_for_64_fndecl = declare_cilk_for_builtin ("__cilkrts_cilk_for_64",
- unsigned_intDI_type_node,
- BUILT_IN_CILK_FOR_64);
-}
-
-/* Get the appropriate frame arguments for CALL that is of type CALL_EXPR. */
-
-static tree
-get_frame_arg (tree call)
-{
- tree arg, argtype;
-
- gcc_assert (call_expr_nargs (call) >= 1);
-
- arg = CALL_EXPR_ARG (call, 0);
- argtype = TREE_TYPE (arg);
- gcc_assert (TREE_CODE (argtype) == POINTER_TYPE);
-
- argtype = TREE_TYPE (argtype);
-
- /* If it is passed in as an address, then just use the value directly
- since the function is inlined. */
- if (TREE_CODE (arg) == ADDR_EXPR)
- return TREE_OPERAND (arg, 0);
- return arg;
-}
-
-/* Expands the __cilkrts_pop_frame function call stored in EXP. */
-
-void
-expand_builtin_cilk_pop_frame (tree exp)
-{
- tree frame = get_frame_arg (exp);
- tree parent = cilk_dot (frame, CILK_TI_FRAME_PARENT, 0);
-
- tree clear_parent = build2 (MODIFY_EXPR, void_type_node, parent,
- build_int_cst (TREE_TYPE (parent), 0));
- expand_expr (clear_parent, const0_rtx, VOIDmode, EXPAND_NORMAL);
-
- /* During LTO, the is_cilk_function flag gets cleared.
- If __cilkrts_pop_frame is called, then this definitely must be a
- cilk function. */
- if (cfun)
- cfun->is_cilk_function = 1;
-}
-
-/* Expands the cilk_detach function call stored in EXP. */
-
-void
-expand_builtin_cilk_detach (tree exp)
-{
- rtx_insn *insn;
- tree fptr = get_frame_arg (exp);
-
- if (fptr == NULL_TREE)
- return;
-
- tree parent = cilk_dot (fptr, CILK_TI_FRAME_PARENT, 0);
- tree worker = cilk_dot (fptr, CILK_TI_FRAME_WORKER, 0);
- tree tail = cilk_arrow (worker, CILK_TI_WORKER_TAIL, 1);
-
- tree faddr = build1 (ADDR_EXPR, cilk_frame_ptr_type_decl, fptr);
- tree enter_frame = build_call_expr (cilk_enter_fast_fndecl, 1, faddr);
- expand_expr (enter_frame, const0_rtx, VOIDmode, EXPAND_NORMAL);
-
- tree pedigree = cilk_dot (fptr, CILK_TI_FRAME_PEDIGREE, 0);
- tree pedigree_rank = cilk_dot (pedigree, CILK_TI_PEDIGREE_RANK, 0);
- tree parent_pedigree = cilk_dot (pedigree, CILK_TI_PEDIGREE_PARENT, 0);
- tree pedigree_parent = cilk_arrow (parent, CILK_TI_FRAME_PEDIGREE, 0);
- tree pedigree_parent_rank = cilk_dot (pedigree_parent,
- CILK_TI_PEDIGREE_RANK, 0);
- tree pedigree_parent_parent = cilk_dot (pedigree_parent,
- CILK_TI_PEDIGREE_PARENT, 0);
- tree worker_pedigree = cilk_arrow (worker, CILK_TI_WORKER_PEDIGREE, 1);
- tree w_pedigree_rank = cilk_dot (worker_pedigree, CILK_TI_PEDIGREE_RANK, 0);
- tree w_pedigree_parent = cilk_dot (worker_pedigree,
- CILK_TI_PEDIGREE_PARENT, 0);
-
- rtx wreg = expand_expr (worker, NULL_RTX, Pmode, EXPAND_NORMAL);
- if (GET_CODE (wreg) != REG)
- wreg = copy_to_reg (wreg);
- rtx preg = expand_expr (parent, NULL_RTX, Pmode, EXPAND_NORMAL);
-
- /* sf.pedigree.rank = worker->pedigree.rank. */
- tree exp1 = build2 (MODIFY_EXPR, void_type_node, pedigree_rank,
- w_pedigree_rank);
- expand_expr (exp1, const0_rtx, VOIDmode, EXPAND_NORMAL);
-
- /* sf.pedigree.parent = worker->pedigree.parent. */
- exp1 = build2 (MODIFY_EXPR, void_type_node, parent_pedigree,
- w_pedigree_parent);
- expand_expr (exp1, const0_rtx, VOIDmode, EXPAND_NORMAL);
-
- /* sf.call_parent->pedigree.rank = worker->pedigree.rank. */
- exp1 = build2 (MODIFY_EXPR, void_type_node, pedigree_parent_rank,
- w_pedigree_rank);
- expand_expr (exp1, const0_rtx, VOIDmode, EXPAND_NORMAL);
-
- /* sf.call_parent->pedigree.parent = worker->pedigree.parent. */
- exp1 = build2 (MODIFY_EXPR, void_type_node, pedigree_parent_parent,
- w_pedigree_parent);
- expand_expr (exp1, const0_rtx, VOIDmode, EXPAND_NORMAL);
-
- /* sf->worker.pedigree.rank = 0. */
- exp1 = build2 (MODIFY_EXPR, void_type_node, w_pedigree_rank,
- build_zero_cst (uint64_type_node));
- expand_expr (exp1, const0_rtx, VOIDmode, EXPAND_NORMAL);
-
- /* sf->pedigree.parent = &sf->pedigree. */
- exp1 = build2 (MODIFY_EXPR, void_type_node, w_pedigree_parent,
- build1 (ADDR_EXPR,
- build_pointer_type (cilk_pedigree_type_decl),
- pedigree));
- expand_expr (exp1, const0_rtx, VOIDmode, EXPAND_NORMAL);
-
- /* TMP <- WORKER.TAIL
- *TMP <- PARENT
- TMP <- TMP + 1
- WORKER.TAIL <- TMP */
-
- HOST_WIDE_INT worker_tail_offset =
- tree_to_shwi (DECL_FIELD_OFFSET (cilk_trees[CILK_TI_WORKER_TAIL])) +
- tree_to_shwi (DECL_FIELD_BIT_OFFSET (cilk_trees[CILK_TI_WORKER_TAIL])) /
- BITS_PER_UNIT;
- rtx tmem0 = gen_rtx_MEM (Pmode,
- plus_constant (Pmode, wreg, worker_tail_offset));
- set_mem_attributes (tmem0, tail, 0);
- MEM_NOTRAP_P (tmem0) = 1;
- gcc_assert (MEM_VOLATILE_P (tmem0));
- rtx treg = copy_to_mode_reg (Pmode, tmem0);
- rtx tmem1 = gen_rtx_MEM (Pmode, treg);
- set_mem_attributes (tmem1, TREE_TYPE (TREE_TYPE (tail)), 0);
- MEM_NOTRAP_P (tmem1) = 1;
- emit_move_insn (tmem1, preg);
- emit_move_insn (treg, plus_constant (Pmode, treg, GET_MODE_SIZE (Pmode)));
-
- /* There is a release barrier (st8.rel, membar #StoreStore,
- sfence, lwsync, etc.) between the two stores. On x86
- normal volatile stores have proper semantics; the sfence
- would only be needed for nontemporal stores (which we
- could generate using the storent optab, for no benefit
- in this case).
-
- The predicate may return false even for a REG if this is
- the limited release operation that only stores 0. */
- enum insn_code icode = direct_optab_handler (sync_lock_release_optab, Pmode);
- if (icode != CODE_FOR_nothing
- && insn_data[icode].operand[1].predicate (treg, Pmode)
- && (insn = GEN_FCN (icode) (tmem0, treg)) != NULL_RTX)
- emit_insn (insn);
- else
- emit_move_insn (tmem0, treg);
-
- /* The memory barrier inserted above should not prevent
- the load of flags from being moved before the stores,
- but in practice it does because it is implemented with
- unspec_volatile. In-order RISC machines should
- explicitly load flags earlier. */
-
- tree flags = cilk_dot (fptr, CILK_TI_FRAME_FLAGS, 0);
- expand_expr (build2 (MODIFY_EXPR, void_type_node, flags,
- build2 (BIT_IOR_EXPR, TREE_TYPE (flags), flags,
- build_int_cst (TREE_TYPE (flags),
- CILK_FRAME_DETACHED))),
- const0_rtx, VOIDmode, EXPAND_NORMAL);
-}
-
-/* Returns a setjmp CALL_EXPR with FRAME->context as its parameter. */
-
-tree
-cilk_call_setjmp (tree frame)
-{
- tree c = cilk_dot (frame, CILK_TI_FRAME_CONTEXT, false);
- c = build1 (ADDR_EXPR, build_pointer_type (ptr_type_node), c);
- return build_call_expr (builtin_decl_implicit (BUILT_IN_SETJMP), 1, c);
-}
-
-/* This function will expand the _Cilk_sync keyword. */
-
-static tree
-expand_cilk_sync (void)
-{
- tree frame = cfun->cilk_frame_decl;
-
- /* Cilk_sync is converted to the following code:
-
- sf.pedigree = sf.worker->pedigree;
- if (frame.flags & CILK_FRAME_UNSYNCHED)
- {
- __cilkrts_save_fp_state (&sf);
- if (!builtin_setjmp (sf.ctx)
- __cilkrts_sync (&sf);
- else
- if (sf.flags & CILK_FRAME_EXCEPTING)
- __cilkrts_rethrow (&sf);
- }
- sf.worker->pedigree.rank = sf.worker->pedigree.rank + 1; */
-
- tree flags = cilk_dot (frame, CILK_TI_FRAME_FLAGS, false);
-
- tree unsynched = fold_build2 (BIT_AND_EXPR, TREE_TYPE (flags), flags,
- build_int_cst (TREE_TYPE (flags),
- CILK_FRAME_UNSYNCHED));
-
- unsynched = fold_build2 (NE_EXPR, TREE_TYPE (unsynched), unsynched,
- build_int_cst (TREE_TYPE (unsynched), 0));
-
- tree frame_addr = build1 (ADDR_EXPR, cilk_frame_ptr_type_decl, frame);
-
- /* Check if exception (0x10) bit is set in the sf->flags. */
- tree except_flag = fold_build2 (BIT_AND_EXPR, TREE_TYPE (flags), flags,
- build_int_cst (TREE_TYPE (flags),
- CILK_FRAME_EXCEPTING));
- except_flag = fold_build2 (NE_EXPR, TREE_TYPE (except_flag), except_flag,
- build_int_cst (TREE_TYPE (except_flag), 0));
-
- /* If the exception flag is set then call the __cilkrts_rethrow (&sf). */
- tree except_cond = fold_build3 (COND_EXPR, void_type_node, except_flag,
- build_call_expr (cilk_rethrow_fndecl, 1,
- frame_addr),
- build_empty_stmt (EXPR_LOCATION (unsynched)));
-
- tree sync_expr = build_call_expr (cilk_sync_fndecl, 1, frame_addr);
- tree setjmp_expr = cilk_call_setjmp (frame);
- setjmp_expr = fold_build2 (EQ_EXPR, TREE_TYPE (setjmp_expr), setjmp_expr,
- build_int_cst (TREE_TYPE (setjmp_expr), 0));
-
- setjmp_expr = fold_build3 (COND_EXPR, void_type_node, setjmp_expr,
- sync_expr, except_cond);
- tree sync_list = alloc_stmt_list ();
- append_to_statement_list (build_call_expr (cilk_save_fp_fndecl, 1,
- frame_addr), &sync_list);
- append_to_statement_list (setjmp_expr, &sync_list);
- tree sync = fold_build3 (COND_EXPR, void_type_node, unsynched, sync_list,
- build_empty_stmt (EXPR_LOCATION (unsynched)));
- tree parent_pedigree = cilk_dot (frame, CILK_TI_FRAME_PEDIGREE, false);
- tree worker = cilk_dot (frame, CILK_TI_FRAME_WORKER, false);
- tree worker_pedigree = cilk_arrow (worker, CILK_TI_WORKER_PEDIGREE, false);
- tree assign_pedigree = fold_build2 (MODIFY_EXPR, void_type_node,
- parent_pedigree, worker_pedigree);
- tree w_ped_rank = cilk_dot (unshare_expr (worker_pedigree),
- CILK_TI_PEDIGREE_RANK, false);
- tree incr_ped_rank = fold_build2 (PLUS_EXPR, TREE_TYPE (w_ped_rank),
- w_ped_rank,
- build_one_cst (TREE_TYPE (w_ped_rank)));
- incr_ped_rank = fold_build2 (MODIFY_EXPR, void_type_node, w_ped_rank,
- incr_ped_rank);
- tree ret_sync_exp = alloc_stmt_list ();
- append_to_statement_list (assign_pedigree, &ret_sync_exp);
- append_to_statement_list (sync, &ret_sync_exp);
- append_to_statement_list (incr_ped_rank, &ret_sync_exp);
- return ret_sync_exp;
-}
-
-/* Gimplifies the cilk_sync expression passed in *EXPR_P. Returns GS_ALL_DONE
- when finished. */
-
-void
-gimplify_cilk_sync (tree *expr_p, gimple_seq *pre_p)
-{
- tree sync_expr = expand_cilk_sync ();
- *expr_p = NULL_TREE;
- gimplify_and_add (sync_expr, pre_p);
-}