diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 21:25:48 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 21:25:48 +0000 | 
| commit | d88c1a5a572cdb661c111098831fa526e933756f (patch) | |
| tree | 97b32c3372106ac47ded3d1a99f9c023a8530073 /contrib/llvm/lib/Support/Threading.cpp | |
| parent | 715652a404ee99f10c09c0a5edbb5883961b8c25 (diff) | |
| parent | b915e9e0fc85ba6f398b3fab0db6a81a8913af94 (diff) | |
Notes
Diffstat (limited to 'contrib/llvm/lib/Support/Threading.cpp')
| -rw-r--r-- | contrib/llvm/lib/Support/Threading.cpp | 11 | 
1 files changed, 11 insertions, 0 deletions
| diff --git a/contrib/llvm/lib/Support/Threading.cpp b/contrib/llvm/lib/Support/Threading.cpp index e8f5622d0e5c..760f9e2c388b 100644 --- a/contrib/llvm/lib/Support/Threading.cpp +++ b/contrib/llvm/lib/Support/Threading.cpp @@ -15,6 +15,7 @@  #include "llvm/Support/Threading.h"  #include "llvm/Config/config.h"  #include "llvm/Support/Atomic.h" +#include "llvm/Support/Host.h"  #include "llvm/Support/Mutex.h"  #include "llvm/Support/thread.h"  #include <cassert> @@ -116,3 +117,13 @@ void llvm::llvm_execute_on_thread(void (*Fn)(void*), void *UserData,  }  #endif + +unsigned llvm::heavyweight_hardware_concurrency() { +#if !LLVM_ENABLE_THREADS +  return 1; +#endif +  int NumPhysical = sys::getHostNumPhysicalCores(); +  if (NumPhysical == -1) +    return thread::hardware_concurrency(); +  return NumPhysical; +} | 
