1 /* rts-common.h -*-C++-*- 2 * 3 ************************************************************************* 4 * 5 * @copyright 6 * Copyright (C) 2009-2013, Intel Corporation 7 * All rights reserved. 8 * 9 * @copyright 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 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 19 * distribution. 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. 23 * 24 * @copyright 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 **************************************************************************/ 38 39 #ifndef INCLUDED_RTS_COMMON_DOT_H 40 #define INCLUDED_RTS_COMMON_DOT_H 41 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. 45 */ 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) 52 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. 56 */ 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) 60 61 /* documentation aid to identify portable vs. nonportable 62 parts of the runtime. See README for definitions. */ 63 #define COMMON_PORTABLE 64 #define COMMON_SYSDEP 65 #define NON_COMMON 66 67 #if !(defined __GNUC__ || defined __ICC) 68 # define __builtin_expect(a_, b_) a_ 69 #endif 70 71 #ifdef __cplusplus 72 # define cilk_nothrow throw() 73 #else 74 # define cilk_nothrow /*empty in C*/ 75 #endif 76 77 #ifdef __GNUC__ 78 # define NORETURN void __attribute__((noreturn)) 79 #else 80 # define NORETURN void __declspec(noreturn) 81 #endif 82 83 #ifdef __GNUC__ 84 # define NOINLINE __attribute__((noinline)) 85 #else 86 # define NOINLINE __declspec(noinline) 87 #endif 88 89 #ifndef __GNUC__ 90 # define __attribute__(X) 91 #endif 92 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 96 */ 97 #if defined(_MSC_VER) && ! defined(__INTEL_COMPILER) 98 # error define inline 99 # define inline __inline 100 #endif 101 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: 105 */ 106 //#define ENABLE_NOTIFY_ZC_INTRINSIC 1 107 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 112 # endif 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 118 # endif 119 #elif defined(__arm__) 120 // __notify_zc_intrinsic not yet supported by gcc for ARM 121 # undef ENABLE_NOTIFY_ZC_INTRINSIC 122 #endif 123 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) 128 #else 129 # define NOTIFY_ZC_INTRINSIC(annotation, data) 130 #endif 131 132 #endif // ! defined(INCLUDED_RTS_COMMON_DOT_H) 133