16 #include "llvm/Config/config.h" 32 #if LLVM_ENABLE_THREADS != 0 39 #if LLVM_ENABLE_THREADS == 0 || \ 40 (!defined(_WIN32) && !defined(HAVE_PTHREAD_H)) 44 (void)StackSizeInBytes;
60 #if LLVM_ENABLE_THREADS == 0 65 (void)StackSizeInBytes;
74 (void)StackSizeInBytes;
90 if (NumPhysical == -1)
96 #if defined(HAVE_SCHED_GETAFFINITY) && defined(HAVE_CPU_COUNT) 98 if (sched_getaffinity(0,
sizeof(Set), &Set))
99 return CPU_COUNT(&Set);
108 struct SyncThreadInfo {
109 void (*UserFn)(
void *);
129 SyncThreadInfo
Info = {Fn, UserData};
130 llvm_execute_on_thread_impl(threadFuncSync, &Info, StackSizeInBytes,
131 JoiningPolicy::Join);
137 llvm_execute_on_thread_impl(&threadFuncAsync,
138 new AsyncThreadInfo(std::move(Func)),
139 StackSizeInBytes, JoiningPolicy::Detach);
void set_thread_name(const Twine &Name)
Set the name of the current thread.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
unsigned heavyweight_hardware_concurrency()
Get the amount of currency to use for tasks requiring significant memory or other resources...
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
void llvm_execute_on_thread(void(*UserFn)(void *), void *UserData, llvm::Optional< unsigned > StackSizeInBytes=llvm::None)
Execute the given UserFn on a separate thread, passing it the provided UserData and waits for thread ...
int getHostNumPhysicalCores()
Get the number of physical cores (as opposed to logical cores returned from thread::hardware_concurre...
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
uint32_t get_max_thread_name_length()
Get the maximum length of a thread name on this platform.
void get_thread_name(SmallVectorImpl< char > &Name)
Get the name of the current thread.
Analysis containing CSE Info
bool llvm_is_multithreaded()
Returns true if LLVM is compiled with support for multi-threading, and false otherwise.
uint64_t get_threadid()
Return the current thread id, as used in various OS system calls.
unsigned hardware_concurrency()
Get the number of threads that the current program can execute concurrently.
void llvm_execute_on_thread_async(llvm::unique_function< void()> Func, llvm::Optional< unsigned > StackSizeInBytes=llvm::None)
Schedule the given Func for execution on a separate thread, then return to the caller immediately...