//===----------- ThreadSafeModule.h -- Layer interfaces ---------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // Thread safe wrappers and utilities for Module and LLVMContext. // //===----------------------------------------------------------------------===// #ifndef LLVM_EXECUTIONENGINE_ORC_THREADSAFEMODULE_H #define LLVM_EXECUTIONENGINE_ORC_THREADSAFEMODULE_H #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" #include "llvm/Support/Compiler.h" #include <functional> #include <memory> #include <mutex> namespace llvm { namespace orc { /// An LLVMContext together with an associated mutex that can be used to lock /// the context to prevent concurrent access by other threads. class ThreadSafeContext { … }; /// An LLVM Module together with a shared ThreadSafeContext. class ThreadSafeModule { … }; GVPredicate; GVModifier; /// Clones the given module on to a new context. ThreadSafeModule cloneToNewContext(const ThreadSafeModule &TSMW, GVPredicate ShouldCloneDef = GVPredicate(), GVModifier UpdateClonedDefSource = GVModifier()); } // End namespace orc } // End namespace llvm #endif // LLVM_EXECUTIONENGINE_ORC_THREADSAFEMODULE_H