diff options
Diffstat (limited to 'llvm/include/llvm/Support')
| -rw-r--r-- | llvm/include/llvm/Support/Casting.h | 16 | ||||
| -rw-r--r-- | llvm/include/llvm/Support/TargetOpcodes.def | 3 | ||||
| -rw-r--r-- | llvm/include/llvm/Support/ThreadPool.h | 23 | ||||
| -rw-r--r-- | llvm/include/llvm/Support/thread.h | 4 |
4 files changed, 26 insertions, 20 deletions
diff --git a/llvm/include/llvm/Support/Casting.h b/llvm/include/llvm/Support/Casting.h index a6435a2..af283e2 100644 --- a/llvm/include/llvm/Support/Casting.h +++ b/llvm/include/llvm/Support/Casting.h @@ -878,18 +878,18 @@ inline constexpr detail::IsaAndPresentCheckPredicate<Types...> IsaAndPresentPred{}; /// Function objects corresponding to the Cast types defined above. -template <typename From> -inline constexpr detail::StaticCastFunc<From> StaticCastTo{}; +template <typename To> +inline constexpr detail::StaticCastFunc<To> StaticCastTo{}; -template <typename From> inline constexpr detail::CastFunc<From> CastTo{}; +template <typename To> inline constexpr detail::CastFunc<To> CastTo{}; -template <typename From> -inline constexpr detail::CastIfPresentFunc<From> CastIfPresentTo{}; +template <typename To> +inline constexpr detail::CastIfPresentFunc<To> CastIfPresentTo{}; -template <typename From> -inline constexpr detail::DynCastIfPresentFunc<From> DynCastIfPresentTo{}; +template <typename To> +inline constexpr detail::DynCastIfPresentFunc<To> DynCastIfPresentTo{}; -template <typename From> inline constexpr detail::DynCastFunc<From> DynCastTo{}; +template <typename To> inline constexpr detail::DynCastFunc<To> DynCastTo{}; } // end namespace llvm diff --git a/llvm/include/llvm/Support/TargetOpcodes.def b/llvm/include/llvm/Support/TargetOpcodes.def index e5531456..fb20da3 100644 --- a/llvm/include/llvm/Support/TargetOpcodes.def +++ b/llvm/include/llvm/Support/TargetOpcodes.def @@ -233,6 +233,9 @@ HANDLE_TARGET_OPCODE(MEMBARRIER) // using. HANDLE_TARGET_OPCODE(JUMP_TABLE_DEBUG_INFO) +// Issue a no-op relocation against a given symbol at the current location. +HANDLE_TARGET_OPCODE(RELOC_NONE) + HANDLE_TARGET_OPCODE(CONVERGENCECTRL_ENTRY) HANDLE_TARGET_OPCODE(CONVERGENCECTRL_ANCHOR) HANDLE_TARGET_OPCODE(CONVERGENCECTRL_LOOP) diff --git a/llvm/include/llvm/Support/ThreadPool.h b/llvm/include/llvm/Support/ThreadPool.h index c20efc7..d3276a1 100644 --- a/llvm/include/llvm/Support/ThreadPool.h +++ b/llvm/include/llvm/Support/ThreadPool.h @@ -14,6 +14,7 @@ #define LLVM_SUPPORT_THREADPOOL_H #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/FunctionExtras.h" #include "llvm/Config/llvm-config.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Jobserver.h" @@ -51,7 +52,7 @@ class ThreadPoolTaskGroup; class LLVM_ABI ThreadPoolInterface { /// The actual method to enqueue a task to be defined by the concrete /// implementation. - virtual void asyncEnqueue(std::function<void()> Task, + virtual void asyncEnqueue(llvm::unique_function<void()> Task, ThreadPoolTaskGroup *Group) = 0; public: @@ -95,22 +96,22 @@ public: /// used to wait for the task to finish and is *non-blocking* on destruction. template <typename Func> auto async(Func &&F) -> std::shared_future<decltype(F())> { - return asyncImpl(std::function<decltype(F())()>(std::forward<Func>(F)), - nullptr); + return asyncImpl( + llvm::unique_function<decltype(F())()>(std::forward<Func>(F)), nullptr); } template <typename Func> auto async(ThreadPoolTaskGroup &Group, Func &&F) -> std::shared_future<decltype(F())> { - return asyncImpl(std::function<decltype(F())()>(std::forward<Func>(F)), - &Group); + return asyncImpl( + llvm::unique_function<decltype(F())()>(std::forward<Func>(F)), &Group); } private: /// Asynchronous submission of a task to the pool. The returned future can be /// used to wait for the task to finish and is *non-blocking* on destruction. template <typename ResTy> - std::shared_future<ResTy> asyncImpl(std::function<ResTy()> Task, + std::shared_future<ResTy> asyncImpl(llvm::unique_function<ResTy()> Task, ThreadPoolTaskGroup *Group) { auto Future = std::async(std::launch::deferred, std::move(Task)).share(); asyncEnqueue([Future]() { Future.wait(); }, Group); @@ -160,7 +161,7 @@ private: /// Asynchronous submission of a task to the pool. The returned future can be /// used to wait for the task to finish and is *non-blocking* on destruction. - void asyncEnqueue(std::function<void()> Task, + void asyncEnqueue(llvm::unique_function<void()> Task, ThreadPoolTaskGroup *Group) override { int requestedThreads; { @@ -189,7 +190,8 @@ private: mutable llvm::sys::RWMutex ThreadsLock; /// Tasks waiting for execution in the pool. - std::deque<std::pair<std::function<void()>, ThreadPoolTaskGroup *>> Tasks; + std::deque<std::pair<llvm::unique_function<void()>, ThreadPoolTaskGroup *>> + Tasks; /// Locking and signaling for accessing the Tasks queue. std::mutex QueueLock; @@ -239,13 +241,14 @@ public: private: /// Asynchronous submission of a task to the pool. The returned future can be /// used to wait for the task to finish and is *non-blocking* on destruction. - void asyncEnqueue(std::function<void()> Task, + void asyncEnqueue(llvm::unique_function<void()> Task, ThreadPoolTaskGroup *Group) override { Tasks.emplace_back(std::make_pair(std::move(Task), Group)); } /// Tasks waiting for execution in the pool. - std::deque<std::pair<std::function<void()>, ThreadPoolTaskGroup *>> Tasks; + std::deque<std::pair<llvm::unique_function<void()>, ThreadPoolTaskGroup *>> + Tasks; }; #if LLVM_ENABLE_THREADS diff --git a/llvm/include/llvm/Support/thread.h b/llvm/include/llvm/Support/thread.h index ecde62d..51873e7 100644 --- a/llvm/include/llvm/Support/thread.h +++ b/llvm/include/llvm/Support/thread.h @@ -34,7 +34,7 @@ typedef PVOID HANDLE; namespace llvm { -#if LLVM_ON_UNIX || _WIN32 +#if defined(LLVM_ON_UNIX) || defined(_WIN32) /// LLVM thread following std::thread interface with added constructor to /// specify stack size. @@ -49,7 +49,7 @@ class thread { } public: -#if LLVM_ON_UNIX +#ifdef LLVM_ON_UNIX using native_handle_type = pthread_t; using id = pthread_t; using start_routine_type = void *(*)(void *); |
