LLVM 22.0.0git
llvm::orc::ThreadSafeModule Class Reference

An LLVM Module together with a shared ThreadSafeContext. More...

#include "llvm/ExecutionEngine/Orc/ThreadSafeModule.h"

Public Member Functions

 ThreadSafeModule ()=default
 Default construct a ThreadSafeModule.
 ThreadSafeModule (ThreadSafeModule &&Other)=default
ThreadSafeModuleoperator= (ThreadSafeModule &&Other)
 ThreadSafeModule (std::unique_ptr< Module > M, std::unique_ptr< LLVMContext > Ctx)
 Construct a ThreadSafeModule from a unique_ptr<Module> and a unique_ptr<LLVMContext>.
 ThreadSafeModule (std::unique_ptr< Module > M, ThreadSafeContext TSCtx)
 Construct a ThreadSafeModule from a unique_ptr<Module> and an existing ThreadSafeContext.
 ~ThreadSafeModule ()
 operator bool () const
 Boolean conversion: This ThreadSafeModule will evaluate to true if it wraps a non-null module.
template<typename Func>
decltype(auto) withModuleDo (Func &&F)
 Locks the associated ThreadSafeContext and calls the given function on the contained Module.
template<typename Func>
decltype(auto) withModuleDo (Func &&F) const
 Locks the associated ThreadSafeContext and calls the given function on the contained Module.
template<typename Func>
decltype(auto) consumingModuleDo (Func &&F)
 Locks the associated ThreadSafeContext and calls the given function, passing the contained std::unique_ptr<Module>.
ModulegetModuleUnlocked ()
 Get a raw pointer to the contained module without locking the context.
const ModulegetModuleUnlocked () const
 Get a raw pointer to the contained module without locking the context.
ThreadSafeContext getContext () const
 Returns the context for this ThreadSafeModule.

Detailed Description

An LLVM Module together with a shared ThreadSafeContext.

Definition at line 70 of file ThreadSafeModule.h.

Constructor & Destructor Documentation

◆ ThreadSafeModule() [1/4]

llvm::orc::ThreadSafeModule::ThreadSafeModule ( )
default

Default construct a ThreadSafeModule.

This results in a null module and null context.

Referenced by operator=(), and ThreadSafeModule().

◆ ThreadSafeModule() [2/4]

llvm::orc::ThreadSafeModule::ThreadSafeModule ( ThreadSafeModule && Other)
default

References llvm::Other, and ThreadSafeModule().

◆ ThreadSafeModule() [3/4]

llvm::orc::ThreadSafeModule::ThreadSafeModule ( std::unique_ptr< Module > M,
std::unique_ptr< LLVMContext > Ctx )
inline

Construct a ThreadSafeModule from a unique_ptr<Module> and a unique_ptr<LLVMContext>.

This creates a new ThreadSafeContext from the given context.

Definition at line 94 of file ThreadSafeModule.h.

References llvm::move().

◆ ThreadSafeModule() [4/4]

llvm::orc::ThreadSafeModule::ThreadSafeModule ( std::unique_ptr< Module > M,
ThreadSafeContext TSCtx )
inline

Construct a ThreadSafeModule from a unique_ptr<Module> and an existing ThreadSafeContext.

Definition at line 99 of file ThreadSafeModule.h.

References llvm::move().

◆ ~ThreadSafeModule()

llvm::orc::ThreadSafeModule::~ThreadSafeModule ( )
inline

Definition at line 102 of file ThreadSafeModule.h.

Member Function Documentation

◆ consumingModuleDo()

template<typename Func>
decltype(auto) llvm::orc::ThreadSafeModule::consumingModuleDo ( Func && F)
inline

Locks the associated ThreadSafeContext and calls the given function, passing the contained std::unique_ptr<Module>.

The given function should consume the Module.

Definition at line 132 of file ThreadSafeModule.h.

References assert(), and F.

◆ getContext()

ThreadSafeContext llvm::orc::ThreadSafeModule::getContext ( ) const
inline

Returns the context for this ThreadSafeModule.

Definition at line 146 of file ThreadSafeModule.h.

◆ getModuleUnlocked() [1/2]

Module * llvm::orc::ThreadSafeModule::getModuleUnlocked ( )
inline

Get a raw pointer to the contained module without locking the context.

Definition at line 140 of file ThreadSafeModule.h.

Referenced by llvm::orc::IRMaterializationUnit::IRMaterializationUnit().

◆ getModuleUnlocked() [2/2]

const Module * llvm::orc::ThreadSafeModule::getModuleUnlocked ( ) const
inline

Get a raw pointer to the contained module without locking the context.

Definition at line 143 of file ThreadSafeModule.h.

◆ operator bool()

llvm::orc::ThreadSafeModule::operator bool ( ) const
inlineexplicit

Boolean conversion: This ThreadSafeModule will evaluate to true if it wraps a non-null module.

Definition at line 109 of file ThreadSafeModule.h.

◆ operator=()

ThreadSafeModule & llvm::orc::ThreadSafeModule::operator= ( ThreadSafeModule && Other)
inline

Definition at line 78 of file ThreadSafeModule.h.

References llvm::Other, and ThreadSafeModule().

◆ withModuleDo() [1/2]

template<typename Func>
decltype(auto) llvm::orc::ThreadSafeModule::withModuleDo ( Func && F)
inline

◆ withModuleDo() [2/2]

template<typename Func>
decltype(auto) llvm::orc::ThreadSafeModule::withModuleDo ( Func && F) const
inline

Locks the associated ThreadSafeContext and calls the given function on the contained Module.

Definition at line 122 of file ThreadSafeModule.h.

References assert(), and F.


The documentation for this class was generated from the following file: