LLVM: llvm::orc::ReOptimizeLayer Class Reference (original) (raw)

#include "[llvm/ExecutionEngine/Orc/ReOptimizeLayer.h](ReOptimizeLayer%5F8h%5Fsource.html)"

Public Types
using ReOptMaterializationUnitID = uint64_t
using AddProfilerFunc
AddProfilerFunc will be called when ReOptimizeLayer emits the first version of a materialization unit in order to inject profiling code and reoptimization request code.
using ReOptimizeFunc
ReOptimizeFunc will be called when ReOptimizeLayer reoptimization of a materialization unit was requested in order to reoptimize the IR module based on profile data.
Public Member Functions
ReOptimizeLayer (ExecutionSession &ES, DataLayout &DL, IRLayer &BaseLayer, RedirectableSymbolManager &RM)
void setReoptimizeFunc (ReOptimizeFunc ReOptFunc)
void setAddProfilerFunc (AddProfilerFunc ProfilerFunc)
Error reigsterRuntimeFunctions (JITDylib &PlatformJD)
Registers reoptimize runtime dispatch handlers to given PlatformJD.
void emit (std::unique_ptr< MaterializationResponsibility > R, ThreadSafeModule TSM) override
Emits the given module.
Error handleRemoveResources (JITDylib &JD, ResourceKey K) override
This function will be called outside the session lock.
void handleTransferResources (JITDylib &JD, ResourceKey DstK, ResourceKey SrcK) override
This function will be called inside the session lock.
Public Member Functions inherited from llvm::orc::IRLayer
IRLayer (ExecutionSession &ES, const IRSymbolMapper::ManglingOptions *&MO)
virtual ~IRLayer ()
ExecutionSession & getExecutionSession ()
Returns the ExecutionSession for this layer.
const IRSymbolMapper::ManglingOptions *& getManglingOptions () const
Get the mangling options for this layer.
void setCloneToNewContextOnEmit (bool CloneToNewContextOnEmit)
Sets the CloneToNewContextOnEmit flag (false by default).
bool getCloneToNewContextOnEmit () const
Returns the current value of the CloneToNewContextOnEmit flag.
virtual Error add (ResourceTrackerSP RT, ThreadSafeModule TSM)
Add a MaterializatinoUnit representing the given IR to the JITDylib targeted by the given tracker.
Error add (JITDylib &JD, ThreadSafeModule TSM)
Adds a MaterializationUnit representing the given IR to the given JITDylib.
Public Member Functions inherited from llvm::orc::ResourceManager
virtual ~ResourceManager ()

Definition at line 28 of file ReOptimizeLayer.h.

AddProfilerFunc

Initial value:

ReOptimizeLayer &Parent, ReOptMaterializationUnitID MUID,

ReOptimizeLayer(ExecutionSession &ES, DataLayout &DL, IRLayer &BaseLayer, RedirectableSymbolManager &RM)

uint64_t ReOptMaterializationUnitID

An LLVM Module together with a shared ThreadSafeContext.

unique_function is a type-erasing functor similar to std::function.

AddProfilerFunc will be called when ReOptimizeLayer emits the first version of a materialization unit in order to inject profiling code and reoptimization request code.

Definition at line 35 of file ReOptimizeLayer.h.

ReOptimizeFunc

Initial value:

ReOptimizeLayer &Parent, ReOptMaterializationUnitID MUID,

IntrusiveRefCntPtr< ResourceTracker > ResourceTrackerSP

ReOptimizeFunc will be called when ReOptimizeLayer reoptimization of a materialization unit was requested in order to reoptimize the IR module based on profile data.

OldRT is the ResourceTracker that tracks the old function definitions. The OldRT must be kept alive until it can be guaranteed that every invocation of the old function definitions has been terminated.

Definition at line 45 of file ReOptimizeLayer.h.

ReOptMaterializationUnitID

createReoptimizeCall()

emit()

handleRemoveResources()

handleTransferResources()

identity()

reigsterRuntimeFunctions()

Error ReOptimizeLayer::reigsterRuntimeFunctions ( JITDylib & PlatformJD )

Registers reoptimize runtime dispatch handlers to given PlatformJD.

The reoptimization request will not be handled if dispatch handler is not registered by using this function.

Definition at line 29 of file ReOptimizeLayer.cpp.

reoptimizeIfCallFrequent()

Basic AddProfilerFunc that reoptimizes the function when the call count exceeds CallCountThreshold.

Definition at line 82 of file ReOptimizeLayer.cpp.

References CallCountThreshold, llvm::IRBuilderBase::CreateAdd(), llvm::IRBuilderBase::CreateICmpEQ(), llvm::IRBuilderBase::CreateLoad(), createReoptimizeCall(), llvm::IRBuilderBase::CreateStore(), F, llvm::Type::getInt64Ty(), llvm::Constant::getNullValue(), llvm::GlobalValue::InternalLinkage, ReOptimizeLayer(), llvm::SplitBlockAndInsertIfThen(), llvm::Error::success(), and llvm::orc::ThreadSafeModule::withModuleDo().

Referenced by ReOptimizeLayer().

setAddProfilerFunc()

void llvm::orc::ReOptimizeLayer::setAddProfilerFunc ( AddProfilerFunc ProfilerFunc) inline

setReoptimizeFunc()

void llvm::orc::ReOptimizeLayer::setReoptimizeFunc ( ReOptimizeFunc ReOptFunc) inline

CallCountThreshold

const uint64_t llvm::orc::ReOptimizeLayer::CallCountThreshold = 10 static

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