* freeze.adb (Freeze_Array_Type): Call Addressable predicate instead
[official-gcc.git] / libcilkrts / runtime / rts-common.h
blob75a5efe7dba43a6bd2ea82c6d9dd5aafad889582
1 /* rts-common.h -*-C++-*-
3 *************************************************************************
5 * Copyright (C) 2009-2016, Intel Corporation
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
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.
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.
35 * *********************************************************************
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.
46 * We welcome your contributions to this open source project. Thank you
47 * for your assistance in helping us improve Cilk Plus.
48 **************************************************************************/
50 #ifndef INCLUDED_RTS_COMMON_DOT_H
51 #define INCLUDED_RTS_COMMON_DOT_H
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.
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)
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.
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)
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
78 #if !(defined __GNUC__ || defined __ICC) || defined(_WRS_KERNEL)
79 # define __builtin_expect(a_, b_) (a_)
80 #endif
82 #ifdef __cplusplus
83 # define cilk_nothrow throw()
84 #else
85 # define cilk_nothrow /*empty in C*/
86 #endif
88 #ifdef __GNUC__
89 # define NORETURN void __attribute__((noreturn))
90 #else
91 # define NORETURN void __declspec(noreturn)
92 #endif
94 #ifdef __GNUC__
95 # define NOINLINE __attribute__((noinline))
96 #else
97 # define NOINLINE __declspec(noinline)
98 #endif
100 #ifndef __GNUC__
101 # define __attribute__(X)
102 #endif
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
108 #if defined(_MSC_VER) && ! defined(__INTEL_COMPILER)
109 # error define inline
110 # define inline __inline
111 #endif
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:
117 #define ENABLE_NOTIFY_ZC_INTRINSIC 1
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
126 #elif defined(__GNUC__)
127 # // GCC doesn't support the notify intrinsic as of 4.9
128 # undef ENABLE_NOTIFY_ZC_INTRINSIC
129 #elif defined(__clang__)
130 # if !defined(__has_extension) || !__has_extension(notify_zc_intrinsic)
131 # undef ENABLE_NOTIFY_ZC_INTRINSIC
132 # endif
133 #elif ! (defined(__x86_64__) || defined(__i386) \
134 || defined(_M_X64) || defined(_M_IX86))
135 // __notify_zc_intrinsic currently supported only for intel architecture
136 # undef ENABLE_NOTIFY_ZC_INTRINSIC
137 #endif
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
147 #endif // ! defined(INCLUDED_RTS_COMMON_DOT_H)