mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[lld][COFF][ELF][WebAssembly] Replace --[no-]threads /threads[:no] with --threads={1,2,...} /threads:{1,2,...}
--no-threads is a name copied from gold. gold has --no-thread, --thread-count and several other --thread-count-*. There are needs to customize the number of threads (running several lld processes concurrently or customizing the number of LTO threads). Having a single --threads=N is a straightforward replacement of gold's --no-threads + --thread-count. --no-threads is used rarely. So just delete --no-threads instead of keeping it for compatibility for a while. If --threads= is specified (ELF,wasm; COFF /threads: is similar), --thinlto-jobs= defaults to --threads=, otherwise all available hardware threads are used. There is currently no way to override a --threads={1,2,...}. It is still a debate whether we should use --threads=all. Reviewed By: rnk, aganea Differential Revision: https://reviews.llvm.org/D76885
This commit is contained in:
parent
75cce2aa1a
commit
e90f44b7eb
@ -12,6 +12,7 @@
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/Config/llvm-config.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/Threading.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <condition_variable>
|
||||
@ -33,6 +34,11 @@ struct is_execution_policy
|
||||
constexpr sequential_execution_policy seq{};
|
||||
constexpr parallel_execution_policy par{};
|
||||
|
||||
// Strategy for the default executor used by the parallel routines provided by
|
||||
// this file. It defaults to using all hardware threads and should be
|
||||
// initialized before the first use of parallel routines.
|
||||
extern ThreadPoolStrategy strategy;
|
||||
|
||||
namespace detail {
|
||||
|
||||
#if LLVM_ENABLE_THREADS
|
||||
|
@ -20,6 +20,8 @@
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
llvm::ThreadPoolStrategy llvm::parallel::strategy;
|
||||
|
||||
namespace llvm {
|
||||
namespace parallel {
|
||||
namespace detail {
|
||||
@ -78,6 +80,9 @@ public:
|
||||
T.join();
|
||||
}
|
||||
|
||||
struct Creator {
|
||||
static void *call() { return new ThreadPoolExecutor(strategy); }
|
||||
};
|
||||
struct Deleter {
|
||||
static void call(void *Ptr) { ((ThreadPoolExecutor *)Ptr)->stop(); }
|
||||
};
|
||||
@ -131,7 +136,8 @@ Executor *Executor::getDefaultExecutor() {
|
||||
// are more frequent with the debug static runtime.
|
||||
//
|
||||
// This also prevents intermittent deadlocks on exit with the MinGW runtime.
|
||||
static ManagedStatic<ThreadPoolExecutor, object_creator<ThreadPoolExecutor>,
|
||||
|
||||
static ManagedStatic<ThreadPoolExecutor, ThreadPoolExecutor::Creator,
|
||||
ThreadPoolExecutor::Deleter>
|
||||
ManagedExec;
|
||||
static std::unique_ptr<ThreadPoolExecutor> Exec(&(*ManagedExec));
|
||||
|
@ -39,7 +39,6 @@ static_library("Common") {
|
||||
"Reproduce.cpp",
|
||||
"Strings.cpp",
|
||||
"TargetOptionsCommandFlags.cpp",
|
||||
"Threads.cpp",
|
||||
"Timer.cpp",
|
||||
"Version.cpp",
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user