]>
Commit | Line | Data |
---|---|---|
4710dd51 | 1 | /* rts-common.h -*-C++-*- |
2 | * | |
3 | ************************************************************************* | |
4 | * | |
0657c20f | 5 | * Copyright (C) 2009-2016, Intel Corporation |
4710dd51 | 6 | * All rights reserved. |
7 | * | |
4710dd51 | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | |
11 | * | |
12 | * * Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | |
14 | * * Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in | |
16 | * the documentation and/or other materials provided with the | |
17 | * distribution. | |
18 | * * Neither the name of Intel Corporation nor the names of its | |
19 | * contributors may be used to endorse or promote products derived | |
20 | * from this software without specific prior written permission. | |
21 | * | |
4710dd51 | 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
23 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
24 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
25 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
26 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | |
27 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
28 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |
29 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | |
30 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY | |
32 | * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
33 | * POSSIBILITY OF SUCH DAMAGE. | |
0657c20f | 34 | * |
35 | * ********************************************************************* | |
36 | * | |
37 | * PLEASE NOTE: This file is a downstream copy of a file mainitained in | |
38 | * a repository at cilkplus.org. Changes made to this file that are not | |
39 | * submitted through the contribution process detailed at | |
40 | * http://www.cilkplus.org/submit-cilk-contribution will be lost the next | |
41 | * time that a new version is released. Changes only submitted to the | |
42 | * GNU compiler collection or posted to the git repository at | |
43 | * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are | |
44 | * not tracked. | |
45 | * | |
46 | * We welcome your contributions to this open source project. Thank you | |
47 | * for your assistance in helping us improve Cilk Plus. | |
4710dd51 | 48 | **************************************************************************/ |
49 | ||
50 | #ifndef INCLUDED_RTS_COMMON_DOT_H | |
51 | #define INCLUDED_RTS_COMMON_DOT_H | |
52 | ||
53 | /* Abbreviations API functions returning different types. By using these | |
54 | * abbreviations instead of using CILK_API(ret) directly, etags and other | |
55 | * tools can more easily recognize function signatures. | |
56 | */ | |
57 | #define CILK_API_VOID CILK_API(void) | |
58 | #define CILK_API_VOID_PTR CILK_API(void*) | |
59 | #define CILK_API_INT CILK_API(int) | |
60 | #define CILK_API_SIZET CILK_API(size_t) | |
61 | #define CILK_API_TBB_RETCODE CILK_API(__cilk_tbb_retcode) | |
62 | #define CILK_API_PEDIGREE CILK_API(__cilkrts_pedigree) | |
63 | ||
64 | /* Abbreviations ABI functions returning different types. By using these | |
65 | * abbreviations instead of using CILK_ABI(ret) directly, etags and other | |
66 | * tools can more easily recognize function signatures. | |
67 | */ | |
68 | #define CILK_ABI_VOID CILK_ABI(void) | |
69 | #define CILK_ABI_WORKER_PTR CILK_ABI(__cilkrts_worker_ptr) | |
70 | #define CILK_ABI_THROWS_VOID CILK_ABI_THROWS(void) | |
71 | ||
72 | /* documentation aid to identify portable vs. nonportable | |
73 | parts of the runtime. See README for definitions. */ | |
74 | #define COMMON_PORTABLE | |
75 | #define COMMON_SYSDEP | |
76 | #define NON_COMMON | |
77 | ||
0657c20f | 78 | #if !(defined __GNUC__ || defined __ICC) || defined(_WRS_KERNEL) |
79 | # define __builtin_expect(a_, b_) (a_) | |
4710dd51 | 80 | #endif |
81 | ||
82 | #ifdef __cplusplus | |
83 | # define cilk_nothrow throw() | |
84 | #else | |
85 | # define cilk_nothrow /*empty in C*/ | |
86 | #endif | |
87 | ||
88 | #ifdef __GNUC__ | |
89 | # define NORETURN void __attribute__((noreturn)) | |
90 | #else | |
91 | # define NORETURN void __declspec(noreturn) | |
92 | #endif | |
93 | ||
94 | #ifdef __GNUC__ | |
95 | # define NOINLINE __attribute__((noinline)) | |
96 | #else | |
97 | # define NOINLINE __declspec(noinline) | |
98 | #endif | |
99 | ||
100 | #ifndef __GNUC__ | |
101 | # define __attribute__(X) | |
102 | #endif | |
103 | ||
104 | /* Microsoft CL accepts "inline" for C++, but not for C. It accepts | |
105 | * __inline for both. Intel ICL accepts inline for C of /Qstd=c99 | |
106 | * is set. The Cilk runtime is assumed to be compiled with /Qstd=c99 | |
107 | */ | |
108 | #if defined(_MSC_VER) && ! defined(__INTEL_COMPILER) | |
109 | # error define inline | |
110 | # define inline __inline | |
111 | #endif | |
112 | ||
113 | /* Compilers that build the Cilk runtime are assumed to know about zero-cost | |
114 | * intrinsics (__notify_intrinsic()). For those that don't, #undef the | |
115 | * following definition: | |
116 | */ | |
0657c20f | 117 | #define ENABLE_NOTIFY_ZC_INTRINSIC 1 |
4710dd51 | 118 | |
119 | #if defined(__INTEL_COMPILER) | |
120 | /* The notify intrinsic was introduced in ICC 12.0. */ | |
121 | # if __INTEL_COMPILER <= 1200 | |
122 | # undef ENABLE_NOTIFY_ZC_INTRINSIC | |
123 | # endif | |
124 | #elif defined(__VXWORKS__) | |
125 | # undef ENABLE_NOTIFY_ZC_INTRINSIC | |
0657c20f | 126 | #elif defined(__GNUC__) |
127 | # // GCC doesn't support the notify intrinsic as of 4.9 | |
128 | # undef ENABLE_NOTIFY_ZC_INTRINSIC | |
4710dd51 | 129 | #elif defined(__clang__) |
130 | # if !defined(__has_extension) || !__has_extension(notify_zc_intrinsic) | |
131 | # undef ENABLE_NOTIFY_ZC_INTRINSIC | |
132 | # endif | |
0657c20f | 133 | #elif ! (defined(__x86_64__) || defined(__i386) \ |
134 | || defined(_M_X64) || defined(_M_IX86)) | |
135 | // __notify_zc_intrinsic currently supported only for intel architecture | |
4710dd51 | 136 | # undef ENABLE_NOTIFY_ZC_INTRINSIC |
137 | #endif | |
138 | ||
139 | // If ENABLE_NOTIFY_ZC_INTRINSIC is defined, use __notify_zc_intrisic | |
140 | #ifdef ENABLE_NOTIFY_ZC_INTRINSIC | |
141 | # define NOTIFY_ZC_INTRINSIC(annotation, data) \ | |
142 | __notify_zc_intrinsic(annotation, data) | |
143 | #else | |
144 | # define NOTIFY_ZC_INTRINSIC(annotation, data) | |
145 | #endif | |
146 | ||
147 | #endif // ! defined(INCLUDED_RTS_COMMON_DOT_H) |