1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

38 Commits

Author SHA1 Message Date
Eugene Zelenko
181555a389 [ADT, Support, TableGen] Fix some Clang-tidy modernize-use-default and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 288424
2016-12-01 22:13:24 +00:00
Benjamin Kramer
d9782db93e [ManagedStatic] Reimplement double-checked locking with std::atomic.
This gets rid of the memory fence in the hot path (dereferencing the
ManagedStatic), trading for an extra mutex lock in the cold path (when
the ManagedStatic was uninitialized). Since this only happens on the
first accesses it shouldn't matter much. On strict architectures like
x86 this removes any atomic instructions from the hot path.

Also remove the tsan annotations, tsan knows how standard atomics work
so they should be unnecessary now.

llvm-svn: 274131
2016-06-29 15:04:07 +00:00
Justin Bogner
da5fbf58c8 Support: Give ManagedStatic's helper object library visibility
It doesn't make much sense to export these symbols.

llvm-svn: 261931
2016-02-25 22:05:19 +00:00
Peter Collingbourne
3ec59b51d4 Support: Clean up TSan annotations.
Remove support for Valgrind-based TSan, which hasn't been maintained for a
few years. We now use the TSan annotations only if LLVM is compiled with
-fsanitize=thread. We no longer need the weak function definitions as we
are guaranteed that our program is linked directly with the TSan runtime.

Differential Revision: http://reviews.llvm.org/D12121

llvm-svn: 245374
2015-08-18 22:31:24 +00:00
Alexander Kornienko
f993659b8f Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)
Apparently, the style needs to be agreed upon first.

llvm-svn: 240390
2015-06-23 09:49:53 +00:00
Alexander Kornienko
40cb19d802 Fixed/added namespace ending comments using clang-tidy. NFC
The patch is generated using this command:

tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \
  -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \
  llvm/lib/


Thanks to Eugene Kosov for the original patch!

llvm-svn: 240137
2015-06-19 15:57:42 +00:00
Benjamin Kramer
da144ed5a2 Canonicalize header guards into a common format.
Add header guards to files that were missing guards. Remove #endif comments
as they don't seem common in LLVM (we can easily add them back if we decide
they're useful)

Changes made by clang-tidy with minor tweaks.

llvm-svn: 215558
2014-08-13 16:26:38 +00:00
Chandler Carruth
35b7259047 Re-apply r211287: Remove support for LLVM runtime multi-threading.
I'll fix the problems in libclang and other projects in ways that don't
require <mutex> until we sort out the cygwin situation.

llvm-svn: 211900
2014-06-27 15:13:01 +00:00
NAKAMURA Takumi
5859670717 Revert r211287, "Remove support for LLVM runtime multi-threading."
libclang still requires it on cygming, lack of incomplete <mutex>.

llvm-svn: 211592
2014-06-24 13:36:31 +00:00
Zachary Turner
9a5ecb8c07 Remove support for LLVM runtime multi-threading.
After a number of previous small iterations, the functions
llvm_start_multithreaded() and llvm_stop_multithreaded() have
been reduced essentially to no-ops.  This change removes them
entirely.

Reviewed by: rnk, dblaikie

Differential Revision: http://reviews.llvm.org/D4216

llvm-svn: 211287
2014-06-19 18:18:23 +00:00
Zachary Turner
c472800bde Revert r211066, 211067, 211068, 211069, 211070.
These were committed accidentally from the wrong branch before having
a review sign-off.

llvm-svn: 211072
2014-06-16 22:49:41 +00:00
Zachary Turner
c24bca926c Remove some more code out into a separate CL.
llvm-svn: 211067
2014-06-16 22:40:17 +00:00
Zachary Turner
7f9340d9e1 Revert "Remove support for runtime multi-threading."
This reverts revision r210600.

llvm-svn: 210603
2014-06-10 23:15:43 +00:00
Zachary Turner
e87a554529 Remove support for runtime multi-threading.
This patch removes the functions llvm_start_multithreaded() and
llvm_stop_multithreaded(), and changes llvm_is_multithreaded()
to return a constant value based on the value of the compile-time
definition LLVM_ENABLE_THREADS.

Previously, it was possible to have compile-time support for
threads on, and runtime support for threads off, in which case
certain mutexes were not allocated or ever acquired.  Now, if the
build is created with threads enabled, mutexes are always acquired.

A test before/after patch of compiling a very large TU showed no
noticeable performance impact of this change.

Reviewers: rnk

Differential Revision: http://reviews.llvm.org/D4076

llvm-svn: 210600
2014-06-10 23:01:20 +00:00
Craig Topper
ee78063a54 [C++11] Make use of 'nullptr' in the Support library.
llvm-svn: 205697
2014-04-07 04:17:22 +00:00
Benjamin Kramer
6748fa3a23 Revert "[C++11] Replace LLVM atomics with std::atomic."
Breaks the MSVC build.
DataStream.cpp(44): error C2552: 'llvm::Statistic::Value' : non-aggregates cannot be initialized with initializer list

llvm-svn: 202731
2014-03-03 18:02:34 +00:00
Benjamin Kramer
d55423bf4c [C++11] Replace LLVM atomics with std::atomic.
With C++11 we finally have a standardized way to specify atomic operations. Use
them to replace the existing custom implemention. Sadly the translation is not
entirely trivial as std::atomic allows more fine-grained control over the
atomicity. I tried to preserve the old semantics as well as possible.

Differential Revision: http://llvm-reviews.chandlerc.com/D2915

llvm-svn: 202730
2014-03-03 17:53:30 +00:00
Filip Pizlo
9a441082e4 Make PrettyStackTraceEntry use ManagedStatic for its ThreadLocal.
This was somewhat tricky because ~PrettyStackTraceEntry() may run after 
llvm_shutdown() has been called. This is rare and only happens for a common idiom 
used in the main() functions of command-line tools. This works around the idiom by 
skipping the stack clean-up if the PrettyStackTraceHead ManagedStatic is not 
constructed (i.e. llvm_shutdown() has been called).

llvm-svn: 190730
2013-09-13 22:59:47 +00:00
Nick Lewycky
53185e9016 Add support for tsan annotations (thread sanitizer, a valgrind-based tool).
These annotations are disabled entirely when either ENABLE_THREADS is off, or
building a release build. When enabled, they add calls to functions with no
statements to ManagedStatic's getters.

Use these annotations to inform tsan that the race used inside ManagedStatic
initialization is actually benign. Thanks to Kostya Serebryany for helping
write this patch!

llvm-svn: 144567
2011-11-14 20:50:16 +00:00
Michael J. Spencer
d5ec932c3a Merge System into Support.
llvm-svn: 120298
2010-11-29 18:16:10 +00:00
Owen Anderson
6c2af9f474 Remove dead code. ManagedCleanup is unused, and contained a serious bug in that
the provided cleanup function is never actually called.

llvm-svn: 113284
2010-09-07 20:53:39 +00:00
Alisdair Meredith
b74a1f546f Resolve undefined behaviour when ManagedStatic is instantiated with a fixed-length array type.
llvm-svn: 75149
2009-07-09 17:26:16 +00:00
Owen Anderson
64a3af667e Fences are expensive. Avoid doing them when we're not in multithreaded mode.
llvm-svn: 73777
2009-06-19 17:50:11 +00:00
Owen Anderson
a59f91c08d Move Threading.[h|cpp] from Support to System.
llvm-svn: 73707
2009-06-18 16:54:52 +00:00
Owen Anderson
b7cdd1a395 Split the thread-related APIs out into their own file, and add a few more
calls for convenience.

llvm-svn: 73512
2009-06-16 17:33:51 +00:00
Owen Anderson
4f6709ebd6 Have llvm_start_multithreaded return a bool indicating whether multithreaded
initialization succeeded or not, rather than just asserting.

llvm-svn: 72182
2009-05-20 21:03:06 +00:00
Owen Anderson
47460293cf Add llvm_start_multithreaded(), which starts up the LLVM internals in thread-safe mode. Provide double-check locking
initialization of ManagedStatic's when running in thread-safe mode.

llvm-svn: 72151
2009-05-20 00:39:20 +00:00
Owen Anderson
a5fc80c2c6 Back out the thread-safe ManagedStatic for now. Too many people have too many problems with it for the moment.
llvm-svn: 71931
2009-05-16 07:20:52 +00:00
Owen Anderson
f77567f7ac Factor out some common code, fix more typoes, and add a memory fence that might be needed.
llvm-svn: 71853
2009-05-15 08:22:07 +00:00
Owen Anderson
c69f0d9a11 Fix an unfortunate typo.
llvm-svn: 71852
2009-05-15 08:07:23 +00:00
Owen Anderson
7ded7b9a62 Now with working on Leopard!
llvm-svn: 71819
2009-05-15 00:01:40 +00:00
Owen Anderson
3451ee22e8 Make ManagedStatic threadsafe by using atomic operations.
llvm-svn: 71796
2009-05-14 21:26:50 +00:00
Misha Brukman
7ee4196e74 Removed trailing whitespace.
llvm-svn: 65196
2009-02-20 22:51:36 +00:00
Chris Lattner
e0b1ee937a Don't attribute in file headers anymore. See llvmdev for the
discussion of this change.  Boy are my fingers tired. ;-)

llvm-svn: 45411
2007-12-29 19:59:42 +00:00
Chris Lattner
08e1470365 add a way to register an arbitrary cleanup function.
llvm-svn: 34442
2007-02-20 06:08:37 +00:00
Chris Lattner
e5eb7d79d3 add helper method.
llvm-svn: 34155
2007-02-10 19:54:24 +00:00
Chris Lattner
30bf130327 add a helper to call llvm_shutdown()
llvm-svn: 32249
2006-12-06 01:01:14 +00:00
Chris Lattner
30da1ba0a2 new helper class to provide more explicit management of static ctor/dtors.
llvm-svn: 30638
2006-09-28 00:31:55 +00:00