Go to the documentation of this file.
13 #ifndef LLVM_EXECUTIONENGINE_ORC_THREADSAFEMODULE_H
14 #define LLVM_EXECUTIONENGINE_ORC_THREADSAFEMODULE_H
32 State(std::unique_ptr<LLVMContext> Ctx) : Ctx(
std::move(Ctx)) {}
34 std::unique_ptr<LLVMContext> Ctx;
35 std::recursive_mutex
Mutex;
45 std::shared_ptr<State>
S;
46 std::unique_lock<std::recursive_mutex> L;
54 : S(
std::make_shared<State>(
std::
move(NewCtx))) {
55 assert(S->Ctx !=
nullptr &&
56 "Can not construct a ThreadSafeContext from a nullptr");
68 assert(S &&
"Can not lock an empty ThreadSafeContext");
73 std::shared_ptr<State> S;
122 explicit operator bool()
const {
125 "Non-null module must have non-null context");
134 assert(M &&
"Can not call on null module");
142 assert(M &&
"Can not call on null module");
165 std::unique_ptr<Module> M;
181 #endif // LLVM_EXECUTIONENGINE_ORC_THREADSAFEMODULE_H
This is an optimization pass for GlobalISel generic memory operations.
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
ThreadSafeContext getContext() const
Returns the context for this ThreadSafeModule.
Module * getModuleUnlocked()
Get a raw pointer to the contained module without locking the context.
ThreadSafeContext()=default
Construct a null context.
const Module * getModuleUnlocked() const
Get a raw pointer to the contained module without locking the context.
ThreadSafeContext(std::unique_ptr< LLVMContext > NewCtx)
Construct a ThreadSafeContext from the given LLVMContext.
ThreadSafeModule(std::unique_ptr< Module > M, std::unique_ptr< LLVMContext > Ctx)
Construct a ThreadSafeModule from a unique_ptr<Module> and a unique_ptr<LLVMContext>.
const LLVMContext * getContext() const
Returns a pointer to the LLVMContext that was used to construct this instance, or null if the instanc...
ThreadSafeModule()=default
Default construct a ThreadSafeModule.
LLVMContext * getContext()
Returns a pointer to the LLVMContext that was used to construct this instance, or null if the instanc...
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
This is an important class for using LLVM in a threaded context.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
An LLVMContext together with an associated mutex that can be used to lock the context to prevent conc...
print Print MemDeps of function
A Module instance is used to store all the information related to an LLVM module.
decltype(auto) withModuleDo(Func &&F)
Locks the associated ThreadSafeContext and calls the given function on the contained Module.
Analysis the ScalarEvolution expression for r is this
decltype(auto) consumingModuleDo(Func &&F)
Locks the associated ThreadSafeContext and calls the given function, passing the contained std::uniqu...
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Lock(std::shared_ptr< State > S)
SmartMutex< false > Mutex
Mutex - A standard, always enforced mutex.
std::function< bool(const GlobalValue &)> GVPredicate
std::optional< std::vector< StOtherPiece > > Other
ThreadSafeModule(std::unique_ptr< Module > M, ThreadSafeContext TSCtx)
Construct a ThreadSafeModule from a unique_ptr<Module> and an existing ThreadSafeContext.
std::function< void(GlobalValue &)> GVModifier
An LLVM Module together with a shared ThreadSafeContext.
ThreadSafeModule & operator=(ThreadSafeModule &&Other)
ThreadSafeModule cloneToNewContext(const ThreadSafeModule &TSMW, GVPredicate ShouldCloneDef=GVPredicate(), GVModifier UpdateClonedDefSource=GVModifier())
Clones the given module on to a new context.