rts-common.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. #ifndef INCLUDED_RTS_COMMON_DOT_H
  39. #define INCLUDED_RTS_COMMON_DOT_H
  40. /* Abbreviations API functions returning different types. By using these
  41. * abbreviations instead of using CILK_API(ret) directly, etags and other
  42. * tools can more easily recognize function signatures.
  43. */
  44. #define CILK_API_VOID CILK_API(void)
  45. #define CILK_API_VOID_PTR CILK_API(void*)
  46. #define CILK_API_INT CILK_API(int)
  47. #define CILK_API_SIZET CILK_API(size_t)
  48. #define CILK_API_TBB_RETCODE CILK_API(__cilk_tbb_retcode)
  49. #define CILK_API_PEDIGREE CILK_API(__cilkrts_pedigree)
  50. /* Abbreviations ABI functions returning different types. By using these
  51. * abbreviations instead of using CILK_ABI(ret) directly, etags and other
  52. * tools can more easily recognize function signatures.
  53. */
  54. #define CILK_ABI_VOID CILK_ABI(void)
  55. #define CILK_ABI_WORKER_PTR CILK_ABI(__cilkrts_worker_ptr)
  56. #define CILK_ABI_THROWS_VOID CILK_ABI_THROWS(void)
  57. /* documentation aid to identify portable vs. nonportable
  58. parts of the runtime. See README for definitions. */
  59. #define COMMON_PORTABLE
  60. #define COMMON_SYSDEP
  61. #define NON_COMMON
  62. #if !(defined __GNUC__ || defined __ICC)
  63. # define __builtin_expect(a_, b_) a_
  64. #endif
  65. #ifdef __cplusplus
  66. # define cilk_nothrow throw()
  67. #else
  68. # define cilk_nothrow /*empty in C*/
  69. #endif
  70. #ifdef __GNUC__
  71. # define NORETURN void __attribute__((noreturn))
  72. #else
  73. # define NORETURN void __declspec(noreturn)
  74. #endif
  75. #ifdef __GNUC__
  76. # define NOINLINE __attribute__((noinline))
  77. #else
  78. # define NOINLINE __declspec(noinline)
  79. #endif
  80. #ifndef __GNUC__
  81. # define __attribute__(X)
  82. #endif
  83. /* Microsoft CL accepts "inline" for C++, but not for C. It accepts
  84. * __inline for both. Intel ICL accepts inline for C of /Qstd=c99
  85. * is set. The Cilk runtime is assumed to be compiled with /Qstd=c99
  86. */
  87. #if defined(_MSC_VER) && ! defined(__INTEL_COMPILER)
  88. # error define inline
  89. # define inline __inline
  90. #endif
  91. /* Compilers that build the Cilk runtime are assumed to know about zero-cost
  92. * intrinsics (__notify_intrinsic()). For those that don't, #undef the
  93. * following definition:
  94. */
  95. //#define ENABLE_NOTIFY_ZC_INTRINSIC 1
  96. #if defined(__INTEL_COMPILER)
  97. /* The notify intrinsic was introduced in ICC 12.0. */
  98. # if __INTEL_COMPILER <= 1200
  99. # undef ENABLE_NOTIFY_ZC_INTRINSIC
  100. # endif
  101. #elif defined(__VXWORKS__)
  102. # undef ENABLE_NOTIFY_ZC_INTRINSIC
  103. #elif defined(__clang__)
  104. # if !defined(__has_extension) || !__has_extension(notify_zc_intrinsic)
  105. # undef ENABLE_NOTIFY_ZC_INTRINSIC
  106. # endif
  107. #elif defined(__arm__)
  108. // __notify_zc_intrinsic not yet supported by gcc for ARM
  109. # undef ENABLE_NOTIFY_ZC_INTRINSIC
  110. #endif
  111. // If ENABLE_NOTIFY_ZC_INTRINSIC is defined, use __notify_zc_intrisic
  112. #ifdef ENABLE_NOTIFY_ZC_INTRINSIC
  113. # define NOTIFY_ZC_INTRINSIC(annotation, data) \
  114. __notify_zc_intrinsic(annotation, data)
  115. #else
  116. # define NOTIFY_ZC_INTRINSIC(annotation, data)
  117. #endif
  118. #endif // ! defined(INCLUDED_RTS_COMMON_DOT_H)