8000 [pstl] Allow customizing whether per-TU insulation is provided · dexonsmith/llvm-project@1b6d6e5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1b6d6e5

Browse files
committed
[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
1 parent 42b957a commit 1b6d6e5

22 files changed

+94
-0
lines changed

pstl/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ math(EXPR VERSION_PATCH "(${PARALLELSTL_VERSION_SOURCE} % 10)")
1717
project(ParallelSTL VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} LANGUAGES CXX)
1818

1919
set(PSTL_PARALLEL_BACKEND "serial" CACHE STRING "Threading backend to use. Valid choices are 'serial' and 'tbb'. The default is 'serial'.")
20+
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).")
21+
set(_PSTL_HIDE_FROM_ABI_PER_TU ${PSTL_HIDE_FROM_ABI_PER_TU}) # For __pstl_config_site
2022

2123
if (NOT TBB_DIR)
2224
get_filename_component(PSTL_DIR_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)

pstl/include/__pstl_config_site.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111

1212
#cmakedefine _PSTL_PAR_BACKEND_SERIAL
1313
#cmakedefine _PSTL_PAR_BACKEND_TBB
14+
#cmakedefine _PSTL_HIDE_FROM_ABI_PER_TU
1415

1516
#endif // __PSTL_CONFIG_SITE

pstl/include/pstl/internal/algorithm_fwd.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
#include "pstl_config.h"
1818

19+
_PSTL_HIDE_FROM_ABI_PUSH
20+
1921
namespace __pstl
2022
{
2123
namespace __internal
@@ -1254,4 +1256,7 @@ __pattern_lexicographical_compare(_ExecutionPolicy&&, _ForwardIterator1, _Forwar
12541256

12551257
} // namespace __internal
12561258
} // namespace __pstl
1259+
1260+
_PSTL_HIDE_FROM_ABI_POP
1261+
12571262
#endif /* _PSTL_ALGORITHM_FWD_H */

pstl/include/pstl/internal/algorithm_impl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#include "pstl_config.h"
2525
#include "unseq_backend_simd.h"
2626

27+
_PSTL_HIDE_FROM_ABI_PUSH
28+
2729
namespace __pstl
2830
{
2931
namespace __internal
@@ -3620,4 +3622,6 @@ __pattern_lexicographical_compare(_ExecutionPolicy&& __exec, _ForwardIterator1 _
36203622
} // namespace __internal
36213623
} // namespace __pstl
36223624

3625+
_PSTL_HIDE_FROM_ABI_POP
3626+
36233627
#endif /* _PSTL_ALGORITHM_IMPL_H */

pstl/include/pstl/internal/execution_defs.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
#include "pstl_config.h"
1616

17+
_PSTL_HIDE_FROM_ABI_PUSH
18+
1719
namespace __pstl
1820
{
1921
namespace execution
@@ -155,4 +157,6 @@ using __enable_if_execution_policy =
155157

156158
} // namespace __pstl
157159

160+
_PSTL_HIDE_FROM_ABI_POP
161+
158162
#endif /* _PSTL_EXECUTION_POLICY_DEFS_H */

pstl/include/pstl/internal/execution_impl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include "pstl_config.h"
1717
#include "execution_defs.h"
1818

19+
_PSTL_HIDE_FROM_ABI_PUSH
20+
1921
namespace __pstl
2022
{
2123
namespace __internal
@@ -159,4 +161,6 @@ struct __prefer_parallel_tag
159161
} // namespace __internal
160162
} // namespace __pstl
161163

164+
_PSTL_HIDE_FROM_ABI_POP
165+
162166
#endif /* _PSTL_EXECUTION_IMPL_H */

pstl/include/pstl/internal/glue_algorithm_defs.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include "execution_defs.h"
1717
#include "pstl_config.h"
1818

19+
_PSTL_HIDE_FROM_ABI_PUSH
20+
1921
namespace std
2022
{
2123

@@ -550,4 +552,7 @@ lexicographical_compare(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _
550552
_ForwardIterator2 __first2, _ForwardIterator2 __last2);
551553

552554
} // namespace std
555+
556+
_PSTL_HIDE_FROM_ABI_POP
557+
553558
#endif /* _PSTL_GLUE_ALGORITHM_DEFS_H */

pstl/include/pstl/internal/glue_algorithm_impl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
#include "execution_impl.h"
2323

24+
_PSTL_HIDE_FROM_ABI_PUSH
25+
2426
namespace std
2527
{
2628

@@ -1160,4 +1162,6 @@ lexicographical_compare(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _
11601162

11611163
} // namespace std
11621164

1165+
_PSTL_HIDE_FROM_ABI_POP
1166+
11631167
#endif /* _PSTL_GLUE_ALGORITHM_IMPL_H */

pstl/include/pstl/internal/glue_memory_defs.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include "execution_defs.h"
1414
#include "pstl_config.h"
1515

16+
_PSTL_HIDE_FROM_ABI_PUSH
17+
1618
namespace std
1719
{
1820

@@ -77,4 +79,7 @@ __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardItera
7779
uninitialized_value_construct_n(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Size __n);
7880

7981
} // namespace std
82+
83+
_PSTL_HIDE_FROM_ABI_POP
84+
8085
#endif /* _PSTL_GLUE_MEMORY_DEFS_H */

pstl/include/pstl/internal/glue_memory_impl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
#include "execution_impl.h"
2020

21+
_PSTL_HIDE_FROM_ABI_PUSH
22+
2123
namespace std
2224
{
2325

@@ -368,4 +370,6 @@ uninitialized_value_construct_n(_ExecutionPolicy&& __exec, _ForwardIterator __fi
368370

369371
} // namespace std
370372

373+
_PSTL_HIDE_FROM_ABI_POP
374+
371375
#endif /* _PSTL_GLUE_MEMORY_IMPL_H */

0 commit comments

Comments
 (0)
0