PR c/64423
[official-gcc.git] / gcc / cilk.h
blob1fee929af19ccc3d40bf0b64af2df042c4a7c892
1 /* This file is part of the Intel(R) Cilk(TM) Plus support
2 This file contains Cilk Support files.
3 Copyright (C) 2013-2014 Free Software Foundation, Inc.
4 Contributed by Balaji V. Iyer <balaji.v.iyer@intel.com>,
5 Intel Corporation
7 This file is part of GCC.
9 GCC is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
12 any later version.
14 GCC is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING3. If not see
21 <http://www.gnu.org/licenses/>. */
23 #ifndef GCC_CILK_H
24 #define GCC_CILK_H
26 /* Frame status bits known to compiler. */
27 #define CILK_FRAME_UNSYNCHED 0x02
28 #define CILK_FRAME_DETACHED 0x04
29 #define CILK_FRAME_EXCEPTING 0x10
30 #define CILK_FRAME_VERSION (1 << 24)
32 enum cilk_tree_index {
33 /* All the built-in functions for Cilk keywords. */
34 CILK_TI_F_WORKER = 0, /* __cilkrts_get_worker (). */
35 CILK_TI_F_SYNC, /* __cilkrts_sync (). */
36 CILK_TI_F_DETACH, /* __cilkrts_detach (...). */
37 CILK_TI_F_ENTER, /* __cilkrts_enter_frame (...). */
38 CILK_TI_F_ENTER_FAST, /* __cilkrts_enter_frame_fast (.). */
39 CILK_TI_F_LEAVE, /* __cilkrts_leave_frame (...). */
40 CILK_TI_F_POP, /* __cilkrts_pop_frame (...). */
41 CILK_TI_F_RETHROW, /* __cilkrts_rethrow (...). */
42 CILK_TI_F_SAVE_FP, /* __cilkrts_save_fp_ctrl_state (...). */
43 CILK_TI_F_LOOP_32, /* __cilkrts_cilk_for_32 (...). */
44 CILK_TI_F_LOOP_64, /* __cilkrts_cilk_for_64 (...). */
46 /* __cilkrts_stack_frame struct fields. */
47 CILK_TI_FRAME_FLAGS, /* stack_frame->flags. */
48 CILK_TI_FRAME_PARENT, /* stack_frame->parent. */
49 CILK_TI_FRAME_WORKER, /* stack_frame->worker. */
50 CILK_TI_FRAME_EXCEPTION, /* stack_frame->except_data. */
51 CILK_TI_FRAME_CONTEXT, /* stack_frame->context[4]. */
52 CILK_TI_FRAME_PEDIGREE, /* stack_frame->pedigree. */
54 /* __cilkrts_worker struct fields. */
55 CILK_TI_WORKER_CUR, /* worker->current_stack_frame. */
56 CILK_TI_WORKER_TAIL, /* worker->tail. */
57 CILK_TI_WORKER_PEDIGREE, /* worker->pedigree. */
59 /* __cilkrts_pedigree struct fields. */
60 CILK_TI_PEDIGREE_RANK, /* pedigree->rank. */
61 CILK_TI_PEDIGREE_PARENT, /* pedigree->parent. */
63 /* Types. */
64 CILK_TI_FRAME_TYPE, /* struct __cilkrts_stack_frame. */
65 CILK_TI_FRAME_PTR, /* __cilkrts_stack_frame *. */
66 CILK_TI_WORKER_TYPE, /* struct __cilkrts_worker. */
67 CILK_TI_PEDIGREE_TYPE, /* struct __cilkrts_pedigree. */
68 CILK_TI_MAX
71 extern GTY (()) tree cilk_trees[CILK_TI_MAX];
73 #define cilk_worker_fndecl cilk_trees[CILK_TI_F_WORKER]
74 #define cilk_sync_fndecl cilk_trees[CILK_TI_F_SYNC]
75 #define cilk_synched_fndecl cilk_trees[CILK_TI_F_SYNCED]
76 #define cilk_detach_fndecl cilk_trees[CILK_TI_F_DETACH]
77 #define cilk_enter_fndecl cilk_trees[CILK_TI_F_ENTER]
78 #define cilk_enter_fast_fndecl cilk_trees[CILK_TI_F_ENTER_FAST]
79 #define cilk_leave_fndecl cilk_trees[CILK_TI_F_LEAVE]
80 #define cilk_rethrow_fndecl cilk_trees[CILK_TI_F_RETHROW]
81 #define cilk_pop_fndecl cilk_trees[CILK_TI_F_POP]
82 #define cilk_save_fp_fndecl cilk_trees[CILK_TI_F_SAVE_FP]
83 #define cilk_for_32_fndecl cilk_trees[CILK_TI_F_LOOP_32]
84 #define cilk_for_64_fndecl cilk_trees[CILK_TI_F_LOOP_64]
86 #define cilk_worker_type_fndecl cilk_trees[CILK_TI_WORKER_TYPE]
87 #define cilk_frame_type_decl cilk_trees[CILK_TI_FRAME_TYPE]
88 #define cilk_frame_ptr_type_decl cilk_trees[CILK_TI_FRAME_PTR]
89 #define cilk_pedigree_type_decl cilk_trees[CILK_TI_PEDIGREE_TYPE]
91 extern void expand_builtin_cilk_detach (tree);
92 extern void expand_builtin_cilk_pop_frame (tree);
93 extern tree cilk_arrow (tree, int, bool);
94 extern tree cilk_dot (tree, int, bool);
95 extern void cilk_init_builtins (void);
96 extern void gimplify_cilk_sync (tree *, gimple_seq *);
97 extern tree cilk_call_setjmp (tree);
99 /* Returns true if Cilk Plus is enabled and if F->cilk_frame_decl is not
100 NULL_TREE. */
102 inline bool
103 fn_contains_cilk_spawn_p (function *f)
105 return (flag_cilkplus
106 && (f->calls_cilk_spawn || f->cilk_frame_decl != NULL_TREE));
109 #endif