diff options
Diffstat (limited to 'llvm/lib/Support/Threading.cpp')
-rw-r--r-- | llvm/lib/Support/Threading.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp index 39de058..4bf373d 100644 --- a/llvm/lib/Support/Threading.cpp +++ b/llvm/lib/Support/Threading.cpp @@ -94,26 +94,6 @@ unsigned llvm::ThreadPoolStrategy::compute_thread_count() const { return MaxThreadCount; } -Optional<ThreadPoolStrategy> -llvm::get_threadpool_strategy(StringRef Num, ThreadPoolStrategy Default) { - if (Num == "all") - return llvm::hardware_concurrency(); - if (Num.empty()) - return Default; - unsigned V; - if (Num.getAsInteger(10, V)) - return None; // malformed 'Num' value - if (V == 0) - return Default; - - // Do not take the Default into account. This effectively disables - // heavyweight_hardware_concurrency() if the user asks for any number of - // threads on the cmd-line. - ThreadPoolStrategy S = llvm::hardware_concurrency(); - S.ThreadsRequested = V; - return S; -} - namespace { struct SyncThreadInfo { void (*UserFn)(void *); @@ -150,3 +130,23 @@ void llvm::llvm_execute_on_thread_async( } #endif + +Optional<ThreadPoolStrategy> +llvm::get_threadpool_strategy(StringRef Num, ThreadPoolStrategy Default) { + if (Num == "all") + return llvm::hardware_concurrency(); + if (Num.empty()) + return Default; + unsigned V; + if (Num.getAsInteger(10, V)) + return None; // malformed 'Num' value + if (V == 0) + return Default; + + // Do not take the Default into account. This effectively disables + // heavyweight_hardware_concurrency() if the user asks for any number of + // threads on the cmd-line. + ThreadPoolStrategy S = llvm::hardware_concurrency(); + S.ThreadsRequested = V; + return S; +} |