summaryrefslogtreecommitdiff
path: root/pstl
diff options
context:
space:
mode:
authorLouis Dionne <ldionne@apple.com>2019-08-13 12:49:00 +0000
committerLouis Dionne <ldionne@apple.com>2019-08-13 12:49:00 +0000
commit1b6d6e595b5e27566579c03923667aaab58bd3cd (patch)
treec934a113548dc7ca016682f8fd14ea1edaa25a5e /pstl
parent42b957aad7b293eef34ed5c2da7ebde4fab997c9 (diff)
downloadllvm-1b6d6e595b5e27566579c03923667aaab58bd3cd.tar.gz
[pstl] Allow customizing whether per-TU insulation is provided
Like we do in libc++, PSTL needs the ability to constrain ABI-unstable symbols to each translation unit. This is OFF by default (like for libc++), because most people don't care about this and there is a cost associated to enabling the option (code bloat because templates are not deduped across TUs). I'm using '#pragma clang attribute push' to avoid marking each declaration with an attribute, which quickly becomes difficult to maintain. llvm-svn: 368684
Diffstat (limited to 'pstl')
-rw-r--r--pstl/CMakeLists.txt2
-rw-r--r--pstl/include/__pstl_config_site.in1
-rw-r--r--pstl/include/pstl/internal/algorithm_fwd.h5
-rw-r--r--pstl/include/pstl/internal/algorithm_impl.h4
-rw-r--r--pstl/include/pstl/internal/execution_defs.h4
-rw-r--r--pstl/include/pstl/internal/execution_impl.h4
-rw-r--r--pstl/include/pstl/internal/glue_algorithm_defs.h5
-rw-r--r--pstl/include/pstl/internal/glue_algorithm_impl.h4
-rw-r--r--pstl/include/pstl/internal/glue_memory_defs.h5
-rw-r--r--pstl/include/pstl/internal/glue_memory_impl.h4
-rw-r--r--pstl/include/pstl/internal/glue_numeric_defs.h5
-rw-r--r--pstl/include/pstl/internal/glue_numeric_impl.h4
-rw-r--r--pstl/include/pstl/internal/memory_impl.h4
-rw-r--r--pstl/include/pstl/internal/numeric_fwd.h5
-rw-r--r--pstl/include/pstl/internal/numeric_impl.h4
-rw-r--r--pstl/include/pstl/internal/parallel_backend_serial.h4
-rw-r--r--pstl/include/pstl/internal/parallel_backend_tbb.h4
-rw-r--r--pstl/include/pstl/internal/parallel_backend_utils.h4
-rw-r--r--pstl/include/pstl/internal/parallel_impl.h4
-rw-r--r--pstl/include/pstl/internal/pstl_config.h9
-rw-r--r--pstl/include/pstl/internal/unseq_backend_simd.h5
-rw-r--r--pstl/include/pstl/internal/utils.h4
22 files changed, 94 insertions, 0 deletions
diff --git a/pstl/CMakeLists.txt b/pstl/CMakeLists.txt
index 62451b23dba1..dd601bc58a4f 100644
--- a/pstl/CMakeLists.txt
+++ b/pstl/CMakeLists.txt
@@ -17,6 +17,8 @@ math(EXPR VERSION_PATCH "(${PARALLELSTL_VERSION_SOURCE} % 10)")
project(ParallelSTL VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} LANGUAGES CXX)
set(PSTL_PARALLEL_BACKEND "serial" CACHE STRING "Threading backend to use. Valid choices are 'serial' and 'tbb'. The default is 'serial'.")
+set(PSTL_HIDE_FROM_ABI_PER_TU OFF CACHE BOOL "Whether to constrain ABI-unstable symbols to each translation unit (basically, mark them with C's static keyword).")
+set(_PSTL_HIDE_FROM_ABI_PER_TU ${PSTL_HIDE_FROM_ABI_PER_TU}) # For __pstl_config_site
if (NOT TBB_DIR)
get_filename_component(PSTL_DIR_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
diff --git a/pstl/include/__pstl_config_site.in b/pstl/include/__pstl_config_site.in
index f92c695bad50..7bfdb7477753 100644
--- a/pstl/include/__pstl_config_site.in
+++ b/pstl/include/__pstl_config_site.in
@@ -11,5 +11,6 @@
#cmakedefine _PSTL_PAR_BACKEND_SERIAL
#cmakedefine _PSTL_PAR_BACKEND_TBB
+#cmakedefine _PSTL_HIDE_FROM_ABI_PER_TU
#endif // __PSTL_CONFIG_SITE
diff --git a/pstl/include/pstl/internal/algorithm_fwd.h b/pstl/include/pstl/internal/algorithm_fwd.h
index 2f9f13e5ce60..d3986de11e2a 100644
--- a/pstl/include/pstl/internal/algorithm_fwd.h
+++ b/pstl/include/pstl/internal/algorithm_fwd.h
@@ -16,6 +16,8 @@
#include "pstl_config.h"
+_PSTL_HIDE_FROM_ABI_PUSH
+
namespace __pstl
{
namespace __internal
@@ -1254,4 +1256,7 @@ __pattern_lexicographical_compare(_ExecutionPolicy&&, _ForwardIterator1, _Forwar
} // namespace __internal
} // namespace __pstl
+
+_PSTL_HIDE_FROM_ABI_POP
+
#endif /* _PSTL_ALGORITHM_FWD_H */
diff --git a/pstl/include/pstl/internal/algorithm_impl.h b/pstl/include/pstl/internal/algorithm_impl.h
index 883f03d8247d..5bfa8ee585e9 100644
--- a/pstl/include/pstl/internal/algorithm_impl.h
+++ b/pstl/include/pstl/internal/algorithm_impl.h
@@ -24,6 +24,8 @@
#include "pstl_config.h"
#include "unseq_backend_simd.h"
+_PSTL_HIDE_FROM_ABI_PUSH
+
namespace __pstl
{
namespace __internal
@@ -3620,4 +3622,6 @@ __pattern_lexicographical_compare(_ExecutionPolicy&& __exec, _ForwardIterator1 _
} // namespace __internal
} // namespace __pstl
+_PSTL_HIDE_FROM_ABI_POP
+
#endif /* _PSTL_ALGORITHM_IMPL_H */
diff --git a/pstl/include/pstl/internal/execution_defs.h b/pstl/include/pstl/internal/execution_defs.h
index cb9cf69b1887..28e89f5aa4e8 100644
--- a/pstl/include/pstl/internal/execution_defs.h
+++ b/pstl/include/pstl/internal/execution_defs.h
@@ -14,6 +14,8 @@
#include "pstl_config.h"
+_PSTL_HIDE_FROM_ABI_PUSH
+
namespace __pstl
{
namespace execution
@@ -155,4 +157,6 @@ using __enable_if_execution_policy =
} // namespace __pstl
+_PSTL_HIDE_FROM_ABI_POP
+
#endif /* _PSTL_EXECUTION_POLICY_DEFS_H */
diff --git a/pstl/include/pstl/internal/execution_impl.h b/pstl/include/pstl/internal/execution_impl.h
index 26f4c7df4c63..af3b0836c30e 100644
--- a/pstl/include/pstl/internal/execution_impl.h
+++ b/pstl/include/pstl/internal/execution_impl.h
@@ -16,6 +16,8 @@
#include "pstl_config.h"
#include "execution_defs.h"
+_PSTL_HIDE_FROM_ABI_PUSH
+
namespace __pstl
{
namespace __internal
@@ -159,4 +161,6 @@ struct __prefer_parallel_tag
} // namespace __internal
} // namespace __pstl
+_PSTL_HIDE_FROM_ABI_POP
+
#endif /* _PSTL_EXECUTION_IMPL_H */
diff --git a/pstl/include/pstl/internal/glue_algorithm_defs.h b/pstl/include/pstl/internal/glue_algorithm_defs.h
index d5e4d4aa53f5..28a7f92163b1 100644
--- a/pstl/include/pstl/internal/glue_algorithm_defs.h
+++ b/pstl/include/pstl/internal/glue_algorithm_defs.h
@@ -16,6 +16,8 @@
#include "execution_defs.h"
#include "pstl_config.h"
+_PSTL_HIDE_FROM_ABI_PUSH
+
namespace std
{
@@ -550,4 +552,7 @@ lexicographical_compare(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _
_ForwardIterator2 __first2, _ForwardIterator2 __last2);
} // namespace std
+
+_PSTL_HIDE_FROM_ABI_POP
+
#endif /* _PSTL_GLUE_ALGORITHM_DEFS_H */
diff --git a/pstl/include/pstl/internal/glue_algorithm_impl.h b/pstl/include/pstl/internal/glue_algorithm_impl.h
index 47c39a5b87d6..9b4c56c6f755 100644
--- a/pstl/include/pstl/internal/glue_algorithm_impl.h
+++ b/pstl/include/pstl/internal/glue_algorithm_impl.h
@@ -21,6 +21,8 @@
#include "execution_impl.h"
+_PSTL_HIDE_FROM_ABI_PUSH
+
namespace std
{
@@ -1160,4 +1162,6 @@ lexicographical_compare(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _
} // namespace std
+_PSTL_HIDE_FROM_ABI_POP
+
#endif /* _PSTL_GLUE_ALGORITHM_IMPL_H */
diff --git a/pstl/include/pstl/internal/glue_memory_defs.h b/pstl/include/pstl/internal/glue_memory_defs.h
index bf32c927d068..ae523339d52d 100644
--- a/pstl/include/pstl/internal/glue_memory_defs.h
+++ b/pstl/include/pstl/internal/glue_memory_defs.h
@@ -13,6 +13,8 @@
#include "execution_defs.h"
#include "pstl_config.h"
+_PSTL_HIDE_FROM_ABI_PUSH
+
namespace std
{
@@ -77,4 +79,7 @@ __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardItera
uninitialized_value_construct_n(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Size __n);
} // namespace std
+
+_PSTL_HIDE_FROM_ABI_POP
+
#endif /* _PSTL_GLUE_MEMORY_DEFS_H */
diff --git a/pstl/include/pstl/internal/glue_memory_impl.h b/pstl/include/pstl/internal/glue_memory_impl.h
index 5401690a3f49..5c96e3045125 100644
--- a/pstl/include/pstl/internal/glue_memory_impl.h
+++ b/pstl/include/pstl/internal/glue_memory_impl.h
@@ -18,6 +18,8 @@
#include "execution_impl.h"
+_PSTL_HIDE_FROM_ABI_PUSH
+
namespace std
{
@@ -368,4 +370,6 @@ uninitialized_value_construct_n(_ExecutionPolicy&& __exec, _ForwardIterator __fi
} // namespace std
+_PSTL_HIDE_FROM_ABI_POP
+
#endif /* _PSTL_GLUE_MEMORY_IMPL_H */
diff --git a/pstl/include/pstl/internal/glue_numeric_defs.h b/pstl/include/pstl/internal/glue_numeric_defs.h
index 1a9cd074179b..f997b542362e 100644
--- a/pstl/include/pstl/internal/glue_numeric_defs.h
+++ b/pstl/include/pstl/internal/glue_numeric_defs.h
@@ -15,6 +15,8 @@
#include "execution_defs.h"
#include "pstl_config.h"
+_PSTL_HIDE_FROM_ABI_PUSH
+
namespace std
{
// [reduce]
@@ -116,4 +118,7 @@ adjacent_difference(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _Forwa
_ForwardIterator2 __d_first);
} // namespace std
+
+_PSTL_HIDE_FROM_ABI_POP
+
#endif /* _PSTL_GLUE_NUMERIC_DEFS_H */
diff --git a/pstl/include/pstl/internal/glue_numeric_impl.h b/pstl/include/pstl/internal/glue_numeric_impl.h
index 2b3bf7330241..18b337133515 100644
--- a/pstl/include/pstl/internal/glue_numeric_impl.h
+++ b/pstl/include/pstl/internal/glue_numeric_impl.h
@@ -18,6 +18,8 @@
#include "numeric_fwd.h"
#include "execution_impl.h"
+_PSTL_HIDE_FROM_ABI_PUSH
+
namespace std
{
@@ -228,4 +230,6 @@ adjacent_difference(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _Forwa
} // namespace std
+_PSTL_HIDE_FROM_ABI_POP
+
#endif /* _PSTL_GLUE_NUMERIC_IMPL_H_ */
diff --git a/pstl/include/pstl/internal/memory_impl.h b/pstl/include/pstl/internal/memory_impl.h
index 2140ba9f2623..241f00a1033f 100644
--- a/pstl/include/pstl/internal/memory_impl.h
+++ b/pstl/include/pstl/internal/memory_impl.h
@@ -15,6 +15,8 @@
#include "pstl_config.h"
#include "unseq_backend_simd.h"
+_PSTL_HIDE_FROM_ABI_PUSH
+
namespace __pstl
{
namespace __internal
@@ -54,4 +56,6 @@ __brick_uninitialized_move(_ForwardIterator __first, _ForwardIterator __last, _O
} // namespace __internal
} // namespace __pstl
+_PSTL_HIDE_FROM_ABI_POP
+
#endif /* _PSTL_MEMORY_IMPL_H */
diff --git a/pstl/include/pstl/internal/numeric_fwd.h b/pstl/include/pstl/internal/numeric_fwd.h
index 4d52164adc40..07d7f07e1349 100644
--- a/pstl/include/pstl/internal/numeric_fwd.h
+++ b/pstl/include/pstl/internal/numeric_fwd.h
@@ -15,6 +15,8 @@
#include "pstl_config.h"
+_PSTL_HIDE_FROM_ABI_PUSH
+
namespace __pstl
{
namespace __internal
@@ -135,4 +137,7 @@ __pattern_adjacent_difference(_ExecutionPolicy&&, _ForwardIterator, _ForwardIter
} // namespace __internal
} // namespace __pstl
+
+_PSTL_HIDE_FROM_ABI_POP
+
#endif /* _PSTL_NUMERIC_FWD_H */
diff --git a/pstl/include/pstl/internal/numeric_impl.h b/pstl/include/pstl/internal/numeric_impl.h
index fe1f222d437e..c288111eb391 100644
--- a/pstl/include/pstl/internal/numeric_impl.h
+++ b/pstl/include/pstl/internal/numeric_impl.h
@@ -20,6 +20,8 @@
#include "unseq_backend_simd.h"
#include "algorithm_fwd.h"
+_PSTL_HIDE_FROM_ABI_PUSH
+
namespace __pstl
{
namespace __internal
@@ -351,4 +353,6 @@ __pattern_adjacent_difference(_ExecutionPolicy&& __exec, _ForwardIterator1 __fir
} // namespace __internal
} // namespace __pstl
+_PSTL_HIDE_FROM_ABI_POP
+
#endif /* _PSTL_NUMERIC_IMPL_H */
diff --git a/pstl/include/pstl/internal/parallel_backend_serial.h b/pstl/include/pstl/internal/parallel_backend_serial.h
index 969f19931502..65033c9f5ea4 100644
--- a/pstl/include/pstl/internal/parallel_backend_serial.h
+++ b/pstl/include/pstl/internal/parallel_backend_serial.h
@@ -18,6 +18,8 @@
#include "pstl_config.h"
+_PSTL_HIDE_FROM_ABI_PUSH
+
namespace __pstl
{
namespace __serial_backend
@@ -129,4 +131,6 @@ __parallel_invoke(_ExecutionPolicy&&, _F1&& __f1, _F2&& __f2)
} // namespace __serial_backend
} // namespace __pstl
+_PSTL_HIDE_FROM_ABI_POP
+
#endif /* _PSTL_PARALLEL_BACKEND_SERIAL_H */
diff --git a/pstl/include/pstl/internal/parallel_backend_tbb.h b/pstl/include/pstl/internal/parallel_backend_tbb.h
index 6e7cb66077e6..244ab4c657bf 100644
--- a/pstl/include/pstl/internal/parallel_backend_tbb.h
+++ b/pstl/include/pstl/internal/parallel_backend_tbb.h
@@ -30,6 +30,8 @@
# error Intel(R) Threading Building Blocks 2018 is required; older versions are not supported.
#endif
+_PSTL_HIDE_FROM_ABI_PUSH
+
namespace __pstl
{
namespace __tbb_backend
@@ -1052,4 +1054,6 @@ __parallel_invoke(_ExecutionPolicy&&, _F1&& __f1, _F2&& __f2)
} // namespace __tbb_backend
} // namespace __pstl
+_PSTL_HIDE_FROM_ABI_POP
+
#endif /* _PSTL_PARALLEL_BACKEND_TBB_H */
diff --git a/pstl/include/pstl/internal/parallel_backend_utils.h b/pstl/include/pstl/internal/parallel_backend_utils.h
index c94cdc45a4a5..5728b48b1cf7 100644
--- a/pstl/include/pstl/internal/parallel_backend_utils.h
+++ b/pstl/include/pstl/internal/parallel_backend_utils.h
@@ -17,6 +17,8 @@
#include "pstl_config.h"
+_PSTL_HIDE_FROM_ABI_PUSH
+
namespace __pstl
{
@@ -139,4 +141,6 @@ struct __serial_move_merge
} // namespace __utils
} // namespace __pstl
+_PSTL_HIDE_FROM_ABI_POP
+
#endif /* _PSTL_PARALLEL_BACKEND_UTILS_H */
diff --git a/pstl/include/pstl/internal/parallel_impl.h b/pstl/include/pstl/internal/parallel_impl.h
index 523b9259b62a..247ff44c9556 100644
--- a/pstl/include/pstl/internal/parallel_impl.h
+++ b/pstl/include/pstl/internal/parallel_impl.h
@@ -16,6 +16,8 @@
// This header defines the minimum set of parallel routines required to support Parallel STL,
// implemented on top of Intel(R) Threading Building Blocks (Intel(R) TBB) library
+_PSTL_HIDE_FROM_ABI_PUSH
+
namespace __pstl
{
namespace __internal
@@ -80,4 +82,6 @@ __parallel_or(_ExecutionPolicy&& __exec, _Index __first, _Index __last, _Brick _
} // namespace __internal
} // namespace __pstl
+_PSTL_HIDE_FROM_ABI_POP
+
#endif /* _PSTL_PARALLEL_IMPL_H */
diff --git a/pstl/include/pstl/internal/pstl_config.h b/pstl/include/pstl/internal/pstl_config.h
index c2a737b42739..534692967690 100644
--- a/pstl/include/pstl/internal/pstl_config.h
+++ b/pstl/include/pstl/internal/pstl_config.h
@@ -42,6 +42,15 @@
#define _PSTL_STRING(x) _PSTL_STRING_AUX(x)
#define _PSTL_STRING_CONCAT(x, y) x #y
+#ifdef _PSTL_HIDE_FROM_ABI_PER_TU
+# define _PSTL_HIDE_FROM_ABI_PUSH \
+ _Pragma("clang attribute push(__attribute__((internal_linkage)), apply_to=any(function,record))")
+# define _PSTL_HIDE_FROM_ABI_POP _Pragma("clang attribute pop")
+#else
+# define _PSTL_HIDE_FROM_ABI_PUSH /* nothing */
+# define _PSTL_HIDE_FROM_ABI_POP /* nothing */
+#endif
+
// note that when ICC or Clang is in use, _PSTL_GCC_VERSION might not fully match
// the actual GCC version on the system.
#define _PSTL_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
diff --git a/pstl/include/pstl/internal/unseq_backend_simd.h b/pstl/include/pstl/internal/unseq_backend_simd.h
index 96e099ca01c4..7916d8088a43 100644
--- a/pstl/include/pstl/internal/unseq_backend_simd.h
+++ b/pstl/include/pstl/internal/unseq_backend_simd.h
@@ -17,6 +17,9 @@
// This header defines the minimum set of vector routines required
// to support parallel STL.
+
+_PSTL_HIDE_FROM_ABI_PUSH
+
namespace __pstl
{
namespace __unseq_backend
@@ -854,4 +857,6 @@ __simd_remove_if(_RandomAccessIterator __first, _DifferenceType __n, _UnaryPredi
} // namespace __unseq_backend
} // namespace __pstl
+_PSTL_HIDE_FROM_ABI_POP
+
#endif /* _PSTL_UNSEQ_BACKEND_SIMD_H */
diff --git a/pstl/include/pstl/internal/utils.h b/pstl/include/pstl/internal/utils.h
index 0f5b83449898..4911165c6b2d 100644
--- a/pstl/include/pstl/internal/utils.h
+++ b/pstl/include/pstl/internal/utils.h
@@ -13,6 +13,8 @@
#include <new>
#include <iterator>
+_PSTL_HIDE_FROM_ABI_PUSH
+
namespace __pstl
{
namespace __internal
@@ -170,4 +172,6 @@ __cmp_iterators_by_values(_ForwardIterator __a, _ForwardIterator __b, _Compare _
} // namespace __internal
} // namespace __pstl
+_PSTL_HIDE_FROM_ABI_POP
+
#endif /* _PSTL_UTILS_H */