1 /* rts-common.h -*-C++-*-
3 *************************************************************************
6 * Copyright (C) 2009-2013, Intel Corporation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
14 * * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * * Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in
18 * the documentation and/or other materials provided with the
20 * * Neither the name of Intel Corporation nor the names of its
21 * contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
32 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
33 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
35 * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 **************************************************************************/
39 #ifndef INCLUDED_RTS_COMMON_DOT_H
40 #define INCLUDED_RTS_COMMON_DOT_H
42 /* Abbreviations API functions returning different types. By using these
43 * abbreviations instead of using CILK_API(ret) directly, etags and other
44 * tools can more easily recognize function signatures.
46 #define CILK_API_VOID CILK_API(void)
47 #define CILK_API_VOID_PTR CILK_API(void*)
48 #define CILK_API_INT CILK_API(int)
49 #define CILK_API_SIZET CILK_API(size_t)
50 #define CILK_API_TBB_RETCODE CILK_API(__cilk_tbb_retcode)
51 #define CILK_API_PEDIGREE CILK_API(__cilkrts_pedigree)
53 /* Abbreviations ABI functions returning different types. By using these
54 * abbreviations instead of using CILK_ABI(ret) directly, etags and other
55 * tools can more easily recognize function signatures.
57 #define CILK_ABI_VOID CILK_ABI(void)
58 #define CILK_ABI_WORKER_PTR CILK_ABI(__cilkrts_worker_ptr)
59 #define CILK_ABI_THROWS_VOID CILK_ABI_THROWS(void)
61 /* documentation aid to identify portable vs. nonportable
62 parts of the runtime. See README for definitions. */
63 #define COMMON_PORTABLE
67 #if !(defined __GNUC__ || defined __ICC)
68 # define __builtin_expect(a_, b_) a_
72 # define cilk_nothrow throw()
74 # define cilk_nothrow /*empty in C*/
78 # define NORETURN void __attribute__((noreturn))
80 # define NORETURN void __declspec(noreturn)
84 # define NOINLINE __attribute__((noinline))
86 # define NOINLINE __declspec(noinline)
90 # define __attribute__(X)
93 /* Microsoft CL accepts "inline" for C++, but not for C. It accepts
94 * __inline for both. Intel ICL accepts inline for C of /Qstd=c99
95 * is set. The Cilk runtime is assumed to be compiled with /Qstd=c99
97 #if defined(_MSC_VER) && ! defined(__INTEL_COMPILER)
99 # define inline __inline
102 /* Compilers that build the Cilk runtime are assumed to know about zero-cost
103 * intrinsics (__notify_intrinsic()). For those that don't, #undef the
104 * following definition:
106 //#define ENABLE_NOTIFY_ZC_INTRINSIC 1
108 #if defined(__INTEL_COMPILER)
109 /* The notify intrinsic was introduced in ICC 12.0. */
110 # if __INTEL_COMPILER <= 1200
111 # undef ENABLE_NOTIFY_ZC_INTRINSIC
113 #elif defined(__VXWORKS__)
114 # undef ENABLE_NOTIFY_ZC_INTRINSIC
115 #elif defined(__clang__)
116 # if !defined(__has_extension) || !__has_extension(notify_zc_intrinsic)
117 # undef ENABLE_NOTIFY_ZC_INTRINSIC
119 #elif defined(__arm__)
120 // __notify_zc_intrinsic not yet supported by gcc for ARM
121 # undef ENABLE_NOTIFY_ZC_INTRINSIC
124 // If ENABLE_NOTIFY_ZC_INTRINSIC is defined, use __notify_zc_intrisic
125 #ifdef ENABLE_NOTIFY_ZC_INTRINSIC
126 # define NOTIFY_ZC_INTRINSIC(annotation, data) \
127 __notify_zc_intrinsic(annotation, data)
129 # define NOTIFY_ZC_INTRINSIC(annotation, data)
132 #endif // ! defined(INCLUDED_RTS_COMMON_DOT_H)