summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/lib/Support/Threading.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2017-01-24 08:32:59 +0000
committerpatrick <patrick@openbsd.org>2017-01-24 08:32:59 +0000
commit53d771aafdbe5b919f264f53cba3788e2c4cffd2 (patch)
tree7eca39498be0ff1e3a6daf583cd9ca5886bb2636 /gnu/llvm/lib/Support/Threading.cpp
parentIn preparation of compiling our kernels with -ffreestanding, explicitly map (diff)
downloadwireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.tar.xz
wireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.zip
Import LLVM 4.0.0 rc1 including clang and lld to help the current
development effort on OpenBSD/arm64.
Diffstat (limited to 'gnu/llvm/lib/Support/Threading.cpp')
-rw-r--r--gnu/llvm/lib/Support/Threading.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/gnu/llvm/lib/Support/Threading.cpp b/gnu/llvm/lib/Support/Threading.cpp
index e8f5622d0e5..760f9e2c388 100644
--- a/gnu/llvm/lib/Support/Threading.cpp
+++ b/gnu/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;
+}