#include "llvm/Support/Parallel.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Threading.h"
#include <atomic>
#include <future>
#include <thread>
#include <vector>
llvm::ThreadPoolStrategy llvm::parallel::strategy;
namespace llvm {
namespace parallel {
#if LLVM_ENABLE_THREADS
#ifdef _WIN32
static thread_local unsigned threadIndex = UINT_MAX;
unsigned getThreadIndex() { GET_THREAD_INDEX_IMPL; }
#else
thread_local unsigned threadIndex = …;
#endif
namespace detail {
namespace {
class Executor { … };
class ThreadPoolExecutor : public Executor { … };
Executor *Executor::getDefaultExecutor() { … }
}
}
size_t getThreadCount() { … }
#endif
TaskGroup::TaskGroup()
#if LLVM_ENABLE_THREADS
: … { … }
#else
: Parallel(false) {}
#endif
TaskGroup::~TaskGroup() { … }
void TaskGroup::spawn(std::function<void()> F) { … }
}
}
void llvm::parallelFor(size_t Begin, size_t End,
llvm::function_ref<void(size_t)> Fn) { … }