LLVM API Documentation
Abstract interface for implementation execution of LLVM modules, designed to support both interpreter and just-in-time (JIT) compiler implementations. More...
#include <ExecutionEngine.h>
Static Public Member Functions | |
static ExecutionEngine * | create (Module *M, bool ForceInterpreter=false, std::string *ErrorStr=0, CodeGenOpt::Level OptLevel=CodeGenOpt::Default, bool GVsWithCode=true) |
static ExecutionEngine * | createJIT (Module *M, std::string *ErrorStr=0, JITMemoryManager *JMM=0, CodeGenOpt::Level OptLevel=CodeGenOpt::Default, bool GVsWithCode=true, Reloc::Model RM=Reloc::Default, CodeModel::Model CMM=CodeModel::JITDefault) |
Public Attributes | |
sys::Mutex | lock |
Protected Member Functions | |
void | setDataLayout (const DataLayout *td) |
virtual char * | getMemoryForGV (const GlobalVariable *GV) |
getMemoryforGV - Allocate memory for a global variable. More... | |
ExecutionEngine (Module *M) | |
void | emitGlobals () |
void | EmitGlobalVariable (const GlobalVariable *GV) |
GenericValue | getConstantValue (const Constant *C) |
Converts a Constant* into a GenericValue, including handling of ConstantExpr values. More... | |
void | LoadValueFromMemory (GenericValue &Result, GenericValue *Ptr, Type *Ty) |
Protected Attributes | |
SmallVector< Module *, 1 > | Modules |
void *(* | LazyFunctionCreator )(const std::string &) |
Static Protected Attributes | |
static ExecutionEngine *(* | JITCtor )(Module *M, std::string *ErrorStr, JITMemoryManager *JMM, bool GVsWithCode, TargetMachine *TM) |
static ExecutionEngine *(* | MCJITCtor )(Module *M, std::string *ErrorStr, RTDyldMemoryManager *MCJMM, bool GVsWithCode, TargetMachine *TM) |
static ExecutionEngine *(* | InterpCtor )(Module *M, std::string *ErrorStr) |
Friends | |
class | EngineBuilder |
Abstract interface for implementation execution of LLVM modules, designed to support both interpreter and just-in-time (JIT) compiler implementations.
Definition at line 100 of file ExecutionEngine/ExecutionEngine.h.
|
virtual |
Definition at line 73 of file ExecutionEngine.cpp.
References clearAllGlobalMappings(), and Modules.
|
explicitprotected |
Definition at line 63 of file ExecutionEngine.cpp.
References Modules.
void ExecutionEngine::addGlobalMapping | ( | const GlobalValue * | GV, |
void * | Addr | ||
) |
addGlobalMapping - Tell the execution engine that the specified global is at the specified location. This is used internally as functions are JIT'd and as global variables are laid out in memory. It can and should also be used by clients of the EE that want to have an LLVM global overlay existing data in memory. Mappings are automatically removed when their GlobalValue is destroyed.
Definition at line 154 of file ExecutionEngine.cpp.
References llvm::dbgs(), DEBUG, llvm::ExecutionEngineState::getGlobalAddressMap(), llvm::ExecutionEngineState::getGlobalAddressReverseMap(), llvm::Value::getName(), and lock.
Referenced by emitGlobals(), EmitGlobalVariable(), llvm::JIT::getOrEmitGlobalVariable(), llvm::JIT::getPointerToFunction(), llvm::MCJIT::getPointerToFunction(), and llvm::JIT::recompileAndRelinkFunction().
|
inlinevirtual |
addModule - Add a Module to the list of modules that we can JIT from. Note that this takes ownership of the Module: when the ExecutionEngine is destroyed, it destroys the Module as well.
Reimplemented in llvm::MCJIT, and llvm::JIT.
Definition at line 203 of file ExecutionEngine/ExecutionEngine.h.
References Modules.
Referenced by llvm::JIT::addModule().
void ExecutionEngine::clearAllGlobalMappings | ( | ) |
clearAllGlobalMappings - Clear all global mappings and start over again, for use in dynamic compilation scenarios to move globals.
Definition at line 172 of file ExecutionEngine.cpp.
References llvm::ValueMap< KeyT, ValueT, Config >::clear(), llvm::ExecutionEngineState::getGlobalAddressMap(), llvm::ExecutionEngineState::getGlobalAddressReverseMap(), and lock.
Referenced by ~ExecutionEngine().
void ExecutionEngine::clearGlobalMappingsFromModule | ( | Module * | M | ) |
clearGlobalMappingsFromModule - Clear all global mappings that came from a particular module, because it has been removed from the JIT.
Definition at line 179 of file ExecutionEngine.cpp.
References llvm::Module::begin(), llvm::Module::end(), llvm::A64CC::GE, llvm::Module::global_begin(), llvm::Module::global_end(), lock, and llvm::ExecutionEngineState::RemoveMapping().
Referenced by removeModule().
|
static |
create - This is the factory method for creating an execution engine which is appropriate for the current machine. This takes ownership of the module.
GVsWithCode | - Allocating globals with code breaks freeMachineCodeForFunction and is probably unsafe and bad for performance. However, we have clients who depend on this behavior, so we must support it. Eventually, when we're willing to break some backwards compatibility, this flag should be flipped to false, so that by default freeMachineCodeForFunction works. |
Definition at line 395 of file ExecutionEngine.cpp.
References llvm::EngineBuilder::create(), EngineBuilder, llvm::EngineKind::Interpreter, and llvm::EngineKind::JIT.
|
static |
createJIT - This is the factory method for creating a JIT for the current machine, it does not fall back to the interpreter. This takes ownership of the Module and JITMemoryManager if successful.
Clients should make sure to initialize targets prior to calling this function.
createJIT - This is the factory method for creating a JIT for the current machine, it does not fall back to the interpreter. This takes ownership of the module.
Definition at line 414 of file ExecutionEngine.cpp.
References llvm::EngineKind::JIT, JITCtor, llvm::EngineBuilder::selectTarget(), llvm::EngineBuilder::setAllocateGVsWithCode(), llvm::EngineBuilder::setCodeModel(), llvm::EngineBuilder::setEngineKind(), llvm::EngineBuilder::setErrorStr(), llvm::EngineBuilder::setJITMemoryManager(), llvm::EngineBuilder::setOptLevel(), llvm::EngineBuilder::setRelocationModel(), and llvm::SystemZISD::TM.
Referenced by llvm::JIT::create().
DisableGVCompilation - If called, the JIT will abort if it's asked to allocate space and populate a GlobalVariable that is not internal to the module.
Definition at line 461 of file ExecutionEngine/ExecutionEngine.h.
DisableLazyCompilation - When lazy compilation is off (the default), the JIT will eagerly compile every function reachable from the argument to getPointerToFunction. If lazy compilation is turned on, the JIT will only compile the one function and emit stubs to compile the rest when they're first called. If lazy compilation is turned off again while some lazy stubs are still around, and one of those stubs is called, the program will abort.
In order to safely compile lazily in a threaded program, the user must ensure that 1) only one thread at a time can call any particular lazy stub, and 2) any thread modifying LLVM IR must hold the JIT's lock (ExecutionEngine::lock) or otherwise ensure that no other thread calls a lazy stub. See http://llvm.org/PR5184 for details.
Definition at line 446 of file ExecutionEngine/ExecutionEngine.h.
DisableSymbolSearching - If called, the JIT will not try to lookup unknown symbols with dlsym. A client can still use InstallLazyFunctionCreator to resolve symbols in a custom way.
Definition at line 471 of file ExecutionEngine/ExecutionEngine.h.
|
protected |
EmitGlobals - Emit all of the global variables to memory, storing their addresses into GlobalAddress. This must make sure to copy the contents of their initializers into the memory.
Definition at line 1186 of file ExecutionEngine.cpp.
References addGlobalMapping(), EmitGlobalVariable(), getMemoryForGV(), llvm::Value::getName(), getPointerToGlobalIfAvailable(), llvm::GlobalValue::getType(), llvm::Module::global_begin(), llvm::Module::global_end(), llvm::GlobalValue::hasAppendingLinkage(), llvm::GlobalValue::hasDLLExportLinkage(), llvm::GlobalValue::hasDLLImportLinkage(), llvm::GlobalValue::hasExternalLinkage(), llvm::GlobalValue::hasExternalWeakLinkage(), llvm::GlobalValue::hasLocalLinkage(), llvm::Value::hasName(), I, llvm::GlobalValue::isDeclaration(), Modules, llvm::report_fatal_error(), and llvm::sys::DynamicLibrary::SearchForAddressOfSymbol().
Referenced by llvm::Interpreter::Interpreter().
|
protected |
Definition at line 1292 of file ExecutionEngine.cpp.
References addGlobalMapping(), getDataLayout(), llvm::SequentialType::getElementType(), llvm::GlobalVariable::getInitializer(), getMemoryForGV(), getPointerToGlobalIfAvailable(), llvm::GlobalValue::getType(), llvm::DataLayout::getTypeAllocSize(), InitializeMemory(), and llvm::GlobalVariable::isThreadLocal().
Referenced by emitGlobals(), llvm::JIT::getOrEmitGlobalVariable(), and getPointerToGlobal().
|
inlinevirtual |
finalizeObject - ensure the module is fully processed and is usable.
It is the user-level function for completing the process of making the object usable for execution. It should be called after sections within an object have been relocated using mapSectionAddress. When this method is called the MCJIT execution engine will reapply relocations for a loaded object. This method has no effect for the legacy JIT engine or the interpeter.
Reimplemented in llvm::MCJIT.
Definition at line 275 of file ExecutionEngine/ExecutionEngine.h.
|
virtual |
FindFunctionNamed - Search all of the active modules to find the one that defines FnName. This is very slow operation and shouldn't be used for general code.
Reimplemented in llvm::MCJIT.
Definition at line 127 of file ExecutionEngine.cpp.
|
pure virtual |
freeMachineCodeForFunction - Release memory in the ExecutionEngine corresponding to the machine code emitted to execute this function, useful for garbage-collecting generated code.
Implemented in llvm::MCJIT, llvm::JIT, and llvm::Interpreter.
|
inlinevirtual |
generateCodeForModule - Run code generationen for the specified module and load it into memory.
When this function has completed, all code and data for the specified module, and any module on which this module depends, will be generated and loaded into memory, but relocations will not yet have been applied and all memory will be readable and writable but not executable.
This function is primarily useful when generating code for an external target, allowing the client an opportunity to remap section addresses before relocations are applied. Clients that intend to execute code locally can use the getFunctionAddress call, which will generate code and apply final preparations all in one step.
This method has no effect for the legacy JIT engine or the interpeter.
Reimplemented in llvm::MCJIT.
Definition at line 265 of file ExecutionEngine/ExecutionEngine.h.
|
protected |
Converts a Constant* into a GenericValue, including handling of ConstantExpr values.
Definition at line 538 of file ExecutionEngine.cpp.
References llvm::APFloat::add(), llvm::GenericValue::AggregateVal, llvm::APIntOps::And(), llvm::lltok::APFloat, llvm::APFloat::bitcastToAPInt(), llvm::APInt::bitsToDouble(), llvm::APInt::bitsToFloat(), llvm::CallingConv::C, llvm::APFloat::convertFromAPInt(), llvm::APFloat::convertToInteger(), llvm::APFloat::divide(), llvm::APInt::doubleToBits(), llvm::Type::DoubleTyID, llvm::GenericValue::DoubleVal, llvm::dyn_cast(), F(), llvm::APInt::floatToBits(), llvm::Type::FloatTyID, llvm::GenericValue::FloatVal, llvm::LibFunc::fmod, llvm::Type::FP128TyID, llvm::UndefValue::get(), getBitWidth(), llvm::APInt::getBitWidth(), llvm::ConstantDataSequential::getElementAsDouble(), llvm::ConstantDataSequential::getElementAsFloat(), llvm::ConstantDataSequential::getElementAsInteger(), llvm::SequentialType::getElementType(), llvm::ConstantDataSequential::getElementType(), llvm::VectorType::getNumElements(), llvm::ConstantDataSequential::getNumElements(), llvm::User::getOperand(), getOrEmitGlobalVariable(), llvm::DataLayout::getPointerSizeInBits(), getPointerToBasicBlock(), getPointerToFunctionOrStub(), llvm::Type::getPrimitiveSizeInBits(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), llvm::Type::getTypeID(), llvm::DataLayout::getTypeSizeInBits(), llvm::APFloat::getZero(), llvm::APInt::getZExtValue(), llvm::Type::IntegerTyID, llvm::GenericValue::IntVal, llvm::Type::isAggregateType(), llvm::Type::isDoubleTy(), llvm::Type::isFloatingPointTy(), llvm::Type::isFloatTy(), llvm::Type::isIntegerTy(), llvm::Type::isPointerTy(), llvm::Type::isX86_FP80Ty(), llvm_unreachable, llvm::APFloat::mod(), llvm::APFloat::multiply(), llvm::APIntOps::Or(), llvm::Type::PointerTyID, llvm::GenericValue::PointerVal, llvm::Type::PPC_FP128TyID, llvm::PTOGV(), llvm::report_fatal_error(), llvm::APFloat::rmNearestTiesToEven, llvm::APFloat::rmTowardZero, llvm::APIntOps::RoundDoubleToAPInt(), llvm::APIntOps::RoundFloatToAPInt(), llvm::APInt::roundToDouble(), llvm::APInt::sdiv(), llvm::APInt::sext(), llvm::APInt::signedRoundToDouble(), llvm::APInt::srem(), llvm::raw_svector_ostream::str(), llvm::Type::StructTyID, llvm::APFloat::subtract(), llvm::APInt::trunc(), llvm::APInt::udiv(), llvm::APInt::urem(), llvm::Type::VectorTyID, llvm::Type::X86_FP80TyID, llvm::APFloat::x87DoubleExtended, llvm::APIntOps::Xor(), llvm::APInt::zext(), and llvm::APInt::zextOrTrunc().
Referenced by InitializeMemory().
|
inline |
Definition at line 209 of file ExecutionEngine/ExecutionEngine.h.
References TD.
Referenced by llvm::Interpreter::callExternalFunction(), EmitGlobalVariable(), getMemoryForGV(), llvm::JIT::getMemoryForGV(), InitializeMemory(), isTargetNullPtr(), lle_X_sprintf(), LoadValueFromMemory(), and StoreValueToMemory().
|
inlinevirtual |
getFunctionAddress - Return the address of the specified function. This may involve code generation.
Reimplemented in llvm::MCJIT.
Definition at line 375 of file ExecutionEngine/ExecutionEngine.h.
|
inlinevirtual |
getGlobalValueAddress - Return the address of the specified global value. This may involve code generation.
This function should not be called with the JIT or interpreter engines.
Reimplemented in llvm::MCJIT.
Definition at line 367 of file ExecutionEngine/ExecutionEngine.h.
const GlobalValue * ExecutionEngine::getGlobalValueAtAddress | ( | void * | Addr | ) |
getGlobalValueAtAddress - Return the LLVM global value object that starts at the specified address.
Definition at line 224 of file ExecutionEngine.cpp.
References llvm::ValueMap< KeyT, ValueT, Config >::begin(), llvm::ValueMap< KeyT, ValueT, Config >::end(), llvm::ExecutionEngineState::getGlobalAddressMap(), llvm::ExecutionEngineState::getGlobalAddressReverseMap(), I, and lock.
|
protectedvirtual |
getMemoryforGV - Allocate memory for a global variable.
Reimplemented in llvm::JIT.
Definition at line 110 of file ExecutionEngine.cpp.
References getDataLayout().
Referenced by emitGlobals(), and EmitGlobalVariable().
|
inlinevirtual |
getOrEmitGlobalVariable - Return the address of the specified global variable, possibly emitting it to memory if needed. This is used by the Emitter.
This function is deprecated for the MCJIT execution engine. Use getGlobalValueAddress instead.
Reimplemented in llvm::JIT.
Definition at line 416 of file ExecutionEngine/ExecutionEngine.h.
References getPointerToGlobal().
Referenced by getConstantValue().
|
pure virtual |
getPointerToBasicBlock - The different EE's represent basic blocks in different ways. Return the representation for a blockaddress of the specified block.
This function will not be implemented for the MCJIT execution engine.
Implemented in llvm::MCJIT, and llvm::JIT.
Referenced by getConstantValue().
|
pure virtual |
getPointerToFunction - The different EE's represent function bodies in different ways. They should each implement this to say what a function pointer should look like. When F is destroyed, the ExecutionEngine will remove its global mapping and free any machine code. Be sure no threads are running inside F when that happens.
This function is deprecated for the MCJIT execution engine. Use getFunctionAddress instead.
Implemented in llvm::MCJIT, and llvm::JIT.
Referenced by getPointerToFunctionOrStub(), and getPointerToGlobal().
|
inlinevirtual |
getPointerToFunctionOrStub - If the specified function has been code-gen'd, return a pointer to the function. If not, compile it, or use a stub to implement lazy compilation if available. See getPointerToFunction for the requirements on destroying F.
This function is deprecated for the MCJIT execution engine. Use getFunctionAddress instead.
Reimplemented in llvm::JIT.
Definition at line 358 of file ExecutionEngine/ExecutionEngine.h.
References getPointerToFunction().
Referenced by getConstantValue().
void * ExecutionEngine::getPointerToGlobal | ( | const GlobalValue * | GV | ) |
getPointerToGlobal - This returns the address of the specified global value. This may involve code generation if it's a function.
This function is deprecated for the MCJIT execution engine. Use getGlobalValueAddress instead.
Definition at line 518 of file ExecutionEngine.cpp.
References EmitGlobalVariable(), F(), llvm::ExecutionEngineState::getGlobalAddressMap(), getPointerToFunction(), llvm_unreachable, lock, and P.
Referenced by getOrEmitGlobalVariable().
void * ExecutionEngine::getPointerToGlobalIfAvailable | ( | const GlobalValue * | GV | ) |
getPointerToGlobalIfAvailable - This returns the address of the specified global value if it is has already been codegen'd, otherwise it returns null.
This function is deprecated for the MCJIT execution engine. It doesn't seem to be needed in that case, but an equivalent can be added if it is.
Definition at line 216 of file ExecutionEngine.cpp.
References llvm::ValueMap< KeyT, ValueT, Config >::end(), llvm::ValueMap< KeyT, ValueT, Config >::find(), llvm::ExecutionEngineState::getGlobalAddressMap(), I, lock, and llvm::ValueMapIterator< DenseMapT, KeyT >::ValueTypeProxy::second.
Referenced by llvm::Interpreter::callExternalFunction(), emitGlobals(), EmitGlobalVariable(), llvm::JIT::getOrEmitGlobalVariable(), llvm::JIT::getPointerToFunction(), llvm::JIT::getPointerToFunctionOrStub(), and llvm::JIT::recompileAndRelinkFunction().
|
pure virtual |
getPointerToNamedFunction - This method returns the address of the specified function by using the dlsym function call. As such it is only useful for resolving library symbols, not code generated symbols.
If AbortOnFailure is false and no function with the given name is found, this function silently returns a null pointer. Otherwise, it prints a message to stderr and aborts.
This function is deprecated for the MCJIT execution engine.
FIXME: the JIT and MCJIT interfaces should be disentangled or united again, if possible.
Implemented in llvm::MCJIT, llvm::JIT, and llvm::Interpreter.
void ExecutionEngine::InitializeMemory | ( | const Constant * | Init, |
void * | Addr | ||
) |
Definition at line 1130 of file ExecutionEngine.cpp.
References llvm::StringRef::data(), llvm::dbgs(), DEBUG, llvm::Value::dump(), getConstantValue(), getDataLayout(), llvm::StructLayout::getElementOffset(), llvm::DataLayout::getStructLayout(), llvm::Value::getType(), llvm::DataLayout::getTypeAllocSize(), llvm::Type::isFirstClassType(), llvm_unreachable, llvm::Intrinsic::memcpy, llvm::Intrinsic::memset, llvm::StringRef::size(), and StoreValueToMemory().
Referenced by EmitGlobalVariable().
|
inline |
InstallLazyFunctionCreator - If an unknown function is needed, the specified function pointer is invoked to create it. If it returns null, the JIT will abort.
Definition at line 481 of file ExecutionEngine/ExecutionEngine.h.
References LazyFunctionCreator, and P.
|
inline |
Definition at line 449 of file ExecutionEngine/ExecutionEngine.h.
|
inline |
Definition at line 464 of file ExecutionEngine/ExecutionEngine.h.
Referenced by llvm::JIT::getMemoryForGV().
|
inline |
Definition at line 454 of file ExecutionEngine/ExecutionEngine.h.
|
inline |
Definition at line 474 of file ExecutionEngine/ExecutionEngine.h.
Referenced by llvm::JIT::getPointerToNamedFunction(), and llvm::MCJIT::getPointerToNamedFunction().
|
protected |
FIXME: document
Definition at line 1069 of file ExecutionEngine.cpp.
References llvm::GenericValue::AggregateVal, llvm::Type::DoubleTyID, llvm::GenericValue::DoubleVal, llvm::Type::FloatTyID, llvm::GenericValue::FloatVal, getBitWidth(), getDataLayout(), llvm::SequentialType::getElementType(), llvm::VectorType::getNumElements(), llvm::Type::getTypeID(), llvm::DataLayout::getTypeStoreSize(), llvm::Type::IntegerTyID, llvm::GenericValue::IntVal, LoadIntFromMemory(), llvm::Intrinsic::memcpy, llvm::Type::PointerTyID, llvm::GenericValue::PointerVal, llvm::report_fatal_error(), llvm::raw_svector_ostream::str(), llvm::Type::VectorTyID, and llvm::Type::X86_FP80TyID.
Referenced by llvm::Interpreter::visitLoadInst().
|
inlinevirtual |
mapSectionAddress - map a section to its target address space value. Map the address of a JIT section as returned from the memory manager to the address in the target process as the running code will see it. This is the address which will be used for relocation resolution.
Reimplemented in llvm::MCJIT.
Definition at line 245 of file ExecutionEngine/ExecutionEngine.h.
References llvm_unreachable.
|
pure virtual |
recompileAndRelinkFunction - This method is used to force a function which has already been compiled to be compiled again, possibly after it has been modified. Then the entry to the old copy is overwritten with a branch to the new copy. If there was no old copy, this acts just like VM::getPointerToFunction().
Implemented in llvm::MCJIT, llvm::JIT, and llvm::Interpreter.
|
inlinevirtual |
Registers a listener to be called back on various events within the JIT. See JITEventListener.h for more details. Does not take ownership of the argument. The argument may be NULL, in which case these functions do nothing.
Reimplemented in llvm::MCJIT, and llvm::JIT.
Definition at line 424 of file ExecutionEngine/ExecutionEngine.h.
removeModule - Remove a Module from the list of modules. Returns true if M is found.
Reimplemented in llvm::MCJIT, and llvm::JIT.
Definition at line 114 of file ExecutionEngine.cpp.
References clearGlobalMappingsFromModule(), I, and Modules.
Referenced by llvm::JIT::removeModule().
|
pure virtual |
runFunction - Execute the specified function with the specified arguments, and return the result.
Implemented in llvm::MCJIT, llvm::JIT, and llvm::Interpreter.
Referenced by runFunctionAsMain(), and runStaticConstructorsDestructors().
int ExecutionEngine::runFunctionAsMain | ( | Function * | Fn, |
const std::vector< std::string > & | argv, | ||
const char *const * | envp | ||
) |
runFunctionAsMain - This is a helper function which wraps runFunction to handle the common task of starting up main with the specified argc, argv, and envp parameters.
Definition at line 348 of file ExecutionEngine.cpp.
References llvm::Function::getContext(), llvm::Function::getFunctionType(), llvm::Type::getInt8PtrTy(), llvm::FunctionType::getNumParams(), llvm::FunctionType::getParamType(), llvm::FunctionType::getReturnType(), llvm::APInt::getZExtValue(), llvm::GVTOP(), llvm::GenericValue::IntVal, llvm::Type::isIntegerTy(), isTargetNullPtr(), llvm::Type::isVoidTy(), llvm::PTOGV(), llvm::report_fatal_error(), and runFunction().
|
inlinevirtual |
Reimplemented in llvm::JIT.
Definition at line 382 of file ExecutionEngine/ExecutionEngine.h.
|
virtual |
runStaticConstructorsDestructors - This method is used to execute all of the static constructors or destructors for a program.
isDtors | - Run the destructors instead of constructors. |
Reimplemented in llvm::MCJIT.
Definition at line 331 of file ExecutionEngine.cpp.
References Modules.
runStaticConstructorsDestructors - This method is used to execute all of the static constructors or destructors for a particular module.
isDtors | - Run the destructors instead of constructors. |
Definition at line 292 of file ExecutionEngine.cpp.
References llvm::dyn_cast(), F(), llvm::GlobalVariable::getInitializer(), llvm::Module::getNamedGlobal(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::GlobalValue::hasLocalLinkage(), llvm::GlobalValue::isDeclaration(), llvm::Constant::isNullValue(), and runFunction().
|
inlineprotected |
Definition at line 128 of file ExecutionEngine/ExecutionEngine.h.
References TD.
Referenced by llvm::Interpreter::Interpreter().
|
inlinevirtual |
Sets the pre-compiled object cache. The ownership of the ObjectCache is not changed. Supported by MCJIT but not JIT.
Reimplemented in llvm::MCJIT.
Definition at line 429 of file ExecutionEngine/ExecutionEngine.h.
References llvm_unreachable.
void ExecutionEngine::StoreValueToMemory | ( | const GenericValue & | Val, |
GenericValue * | Ptr, | ||
Type * | Ty | ||
) |
StoreValueToMemory - Stores the data in Val of type Ty at address Ptr. Ptr is the address of the memory at which to store Val, cast to GenericValue *. It is not a pointer to a GenericValue containing the address at which to store Val.
Definition at line 993 of file ExecutionEngine.cpp.
References llvm::GenericValue::AggregateVal, llvm::dbgs(), llvm::Type::DoubleTyID, llvm::GenericValue::DoubleVal, llvm::Type::FloatTyID, llvm::GenericValue::FloatVal, getDataLayout(), llvm::APInt::getRawData(), llvm::Type::getTypeID(), llvm::DataLayout::getTypeStoreSize(), if(), llvm::Type::IntegerTyID, llvm::GenericValue::IntVal, llvm::sys::IsLittleEndianHost, llvm::Intrinsic::memcpy, llvm::Intrinsic::memset, llvm::Type::PointerTyID, llvm::GenericValue::PointerVal, StoreIntToMemory(), llvm::Type::VectorTyID, and llvm::Type::X86_FP80TyID.
Referenced by InitializeMemory(), and llvm::Interpreter::visitStoreInst().
|
inlinevirtual |
Reimplemented in llvm::MCJIT, and llvm::JIT.
Definition at line 425 of file ExecutionEngine/ExecutionEngine.h.
void * ExecutionEngine::updateGlobalMapping | ( | const GlobalValue * | GV, |
void * | Addr | ||
) |
updateGlobalMapping - Replace an existing mapping for GV with a new address. This updates both maps as required. If "Addr" is null, the entry for the global is removed from the mappings. This returns the old value of the pointer, or null if it was not in the map.
Definition at line 189 of file ExecutionEngine.cpp.
References llvm::ExecutionEngineState::getGlobalAddressMap(), llvm::ExecutionEngineState::getGlobalAddressReverseMap(), lock, and llvm::ExecutionEngineState::RemoveMapping().
Referenced by llvm::JIT::freeMachineCodeForFunction().
|
friend |
Definition at line 121 of file ExecutionEngine/ExecutionEngine.h.
Referenced by create().
|
staticprotected |
Definition at line 148 of file ExecutionEngine/ExecutionEngine.h.
Referenced by llvm::EngineBuilder::create(), and llvm::Interpreter::Register().
|
staticprotected |
Definition at line 136 of file ExecutionEngine/ExecutionEngine.h.
Referenced by llvm::EngineBuilder::create(), createJIT(), and llvm::JIT::Register().
|
protected |
LazyFunctionCreator - If an unknown function is needed, this function pointer is invoked to create it. If this returns null, the JIT will abort.
Definition at line 153 of file ExecutionEngine/ExecutionEngine.h.
Referenced by llvm::JIT::getPointerToNamedFunction(), llvm::MCJIT::getPointerToNamedFunction(), and InstallLazyFunctionCreator().
sys::Mutex llvm::ExecutionEngine::lock |
lock - This lock protects the ExecutionEngine, MCJIT, JIT, JITResolver and JITEmitter classes. It must be held while changing the internal state of any of those classes.
Definition at line 159 of file ExecutionEngine/ExecutionEngine.h.
Referenced by addGlobalMapping(), llvm::JIT::addModule(), llvm::MCJIT::addModule(), llvm::JIT::addPendingFunction(), llvm::JIT::addPointerToBasicBlock(), clearAllGlobalMappings(), clearGlobalMappingsFromModule(), llvm::JIT::clearPointerToBasicBlock(), llvm::MCJIT::emitObject(), llvm::MCJIT::finalizeLoadedModules(), llvm::MCJIT::finalizeModule(), llvm::MCJIT::finalizeObject(), llvm::MCJIT::findModuleForSymbol(), llvm::MCJIT::generateCodeForModule(), llvm::MCJIT::getFunctionAddress(), llvm::MCJIT::getGlobalValueAddress(), getGlobalValueAtAddress(), llvm::JIT::getMemoryForGV(), llvm::ExecutionEngineState::AddressMapConfig::getMutex(), llvm::JIT::getOrEmitGlobalVariable(), llvm::JIT::getPointerToBasicBlock(), llvm::JIT::getPointerToFunction(), llvm::MCJIT::getPointerToFunction(), getPointerToGlobal(), getPointerToGlobalIfAvailable(), llvm::MCJIT::getSymbolAddress(), llvm::JIT::NotifyFreeingMachineCode(), llvm::MCJIT::NotifyFreeingObject(), llvm::JIT::NotifyFunctionEmitted(), llvm::MCJIT::NotifyObjectEmitted(), llvm::JIT::RegisterJITEventListener(), llvm::MCJIT::RegisterJITEventListener(), llvm::JIT::removeModule(), llvm::MCJIT::removeModule(), llvm::JIT::runJITOnFunction(), llvm::MCJIT::setObjectCache(), llvm::JIT::UnregisterJITEventListener(), llvm::MCJIT::UnregisterJITEventListener(), updateGlobalMapping(), and llvm::MCJIT::~MCJIT().
|
staticprotected |
Definition at line 142 of file ExecutionEngine/ExecutionEngine.h.
Referenced by llvm::EngineBuilder::create(), and llvm::MCJIT::Register().
|
protected |
The list of Modules that we are JIT'ing from. We use a SmallVector to optimize for the case where there is only one module.
Definition at line 126 of file ExecutionEngine/ExecutionEngine.h.
Referenced by llvm::JIT::addModule(), addModule(), emitGlobals(), ExecutionEngine(), FindFunctionNamed(), llvm::JIT::removeModule(), removeModule(), runStaticConstructorsDestructors(), ~ExecutionEngine(), and llvm::MCJIT::~MCJIT().