diff options
author | Zachary Turner <zturner@google.com> | 2014-06-16 22:40:17 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2014-06-16 22:40:17 +0000 |
commit | 0f2c641f865b60afbb0739bc85974c923dc5862a (patch) | |
tree | dce6c29c4f8960e9db1407b75e00ff17dc018fb6 /llvm/lib | |
parent | b344f057d0557e11b1535a45af2346b7cd8c4184 (diff) | |
download | bcm5719-llvm-0f2c641f865b60afbb0739bc85974c923dc5862a.tar.gz bcm5719-llvm-0f2c641f865b60afbb0739bc85974c923dc5862a.zip |
Remove some more code out into a separate CL.
llvm-svn: 211067
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/IR/Core.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/Support/ManagedStatic.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Support/Threading.cpp | 29 | ||||
-rw-r--r-- | llvm/lib/Support/Timer.cpp | 2 |
4 files changed, 6 insertions, 32 deletions
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp index 197b6cb9054..68b9baa2baa 100644 --- a/llvm/lib/IR/Core.cpp +++ b/llvm/lib/IR/Core.cpp @@ -2702,11 +2702,10 @@ void LLVMDisposePassManager(LLVMPassManagerRef PM) { /*===-- Threading ------------------------------------------------------===*/ LLVMBool LLVMStartMultithreaded() { - return llvm_start_multithreaded(); + return LLVMIsMultithreaded(); } void LLVMStopMultithreaded() { - llvm_stop_multithreaded(); } LLVMBool LLVMIsMultithreaded() { diff --git a/llvm/lib/Support/ManagedStatic.cpp b/llvm/lib/Support/ManagedStatic.cpp index 6f5cf6bcb1a..76f86e398de 100644 --- a/llvm/lib/Support/ManagedStatic.cpp +++ b/llvm/lib/Support/ManagedStatic.cpp @@ -24,7 +24,7 @@ void ManagedStaticBase::RegisterManagedStatic(void *(*Creator)(), void (*Deleter)(void*)) const { assert(Creator); if (llvm_is_multithreaded()) { - llvm::MutexGuard Lock(llvm::llvm_get_global_lock()); + llvm::MutexGuard Lock(llvm_get_global_lock()); if (!Ptr) { void* tmp = Creator(); @@ -76,6 +76,4 @@ void ManagedStaticBase::destroy() const { void llvm::llvm_shutdown() { while (StaticList) StaticList->destroy(); - - if (llvm_is_multithreaded()) llvm_stop_multithreaded(); } diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp index 33943efcd68..ff591aaa1d8 100644 --- a/llvm/lib/Support/Threading.cpp +++ b/llvm/lib/Support/Threading.cpp @@ -7,7 +7,8 @@ // //===----------------------------------------------------------------------===// // -// This file implements llvm_start_multithreaded() and friends. +// This file implements helper functions for running LLVM in a multi-threaded +// environment. // //===----------------------------------------------------------------------===// @@ -19,43 +20,19 @@ using namespace llvm; -static bool multithreaded_mode = false; - sys::Mutex& llvm::llvm_get_global_lock() { static sys::Mutex global_lock; return global_lock; } -bool llvm::llvm_start_multithreaded() { +bool llvm::llvm_is_multithreaded() { #if LLVM_ENABLE_THREADS != 0 - assert(!multithreaded_mode && "Already multithreaded!"); - multithreaded_mode = true; - - // We fence here to ensure that all initialization is complete BEFORE we - // return from llvm_start_multithreaded(). - sys::MemoryFence(); return true; #else return false; #endif } -void llvm::llvm_stop_multithreaded() { -#if LLVM_ENABLE_THREADS != 0 - assert(multithreaded_mode && "Not currently multithreaded!"); - - // We fence here to insure that all threaded operations are complete BEFORE we - // return from llvm_stop_multithreaded(). - sys::MemoryFence(); - - multithreaded_mode = false; -#endif -} - -bool llvm::llvm_is_multithreaded() { - return multithreaded_mode; -} - #if LLVM_ENABLE_THREADS != 0 && defined(HAVE_PTHREAD_H) #include <pthread.h> diff --git a/llvm/lib/Support/Timer.cpp b/llvm/lib/Support/Timer.cpp index 417ac8d6bb4..c7427260bff 100644 --- a/llvm/lib/Support/Timer.cpp +++ b/llvm/lib/Support/Timer.cpp @@ -18,7 +18,7 @@ #include "llvm/Support/FileSystem.h" #include "llvm/Support/Format.h" #include "llvm/Support/ManagedStatic.h" -#include "llvm/support/MutexGuard.h" +#include "llvm/Support/MutexGuard.h" #include "llvm/Support/Process.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; |