LLVM API Documentation
#include <MCJIT.h>


Public Member Functions | |
| ~MCJIT () | |
ExecutionEngine interface implementation | |
| virtual void | setObjectCache (ObjectCache *manager) |
| Sets the object manager that MCJIT should use to avoid compilation. | |
| virtual void | finalizeObject () |
| virtual void * | getPointerToBasicBlock (BasicBlock *BB) |
| virtual void * | getPointerToFunction (Function *F) |
| virtual void * | recompileAndRelinkFunction (Function *F) |
| virtual void | freeMachineCodeForFunction (Function *F) |
| virtual GenericValue | runFunction (Function *F, const std::vector< GenericValue > &ArgValues) |
| virtual void * | getPointerToNamedFunction (const std::string &Name, bool AbortOnFailure=true) |
| virtual void | mapSectionAddress (const void *LocalAddress, uint64_t TargetAddress) |
| virtual void | RegisterJITEventListener (JITEventListener *L) |
| virtual void | UnregisterJITEventListener (JITEventListener *L) |
Static Public Member Functions | |
(Private) Registration Interfaces | |
| static void | Register () |
| static ExecutionEngine * | createJIT (Module *M, std::string *ErrorStr, RTDyldMemoryManager *MemMgr, bool GVsWithCode, TargetMachine *TM) |
Protected Member Functions | |
| ObjectBufferStream * | emitObject (Module *M) |
| void | loadObject (Module *M) |
| void | NotifyObjectEmitted (const ObjectImage &Obj) |
| void | NotifyFreeingObject (const ObjectImage &Obj) |
Definition at line 27 of file lib/ExecutionEngine/MCJIT/MCJIT.h.
| MCJIT::~MCJIT | ( | ) |
Definition at line 62 of file MCJIT.cpp.
References llvm::OwningPtr< T >::get(), and NotifyFreeingObject().
| ExecutionEngine * MCJIT::createJIT | ( | Module * | M, |
| std::string * | ErrorStr, | ||
| RTDyldMemoryManager * | MemMgr, | ||
| bool | GVsWithCode, | ||
| TargetMachine * | TM | ||
| ) | [static] |
Definition at line 40 of file MCJIT.cpp.
References llvm::sys::DynamicLibrary::LoadLibraryPermanently().
Referenced by Register().
| ObjectBufferStream * MCJIT::emitObject | ( | Module * | M | ) | [protected] |
emitObject -- Generate a JITed object in memory from the specified module Currently, MCJIT only supports a single module and the module passed to this function call is expected to be the contained module. The module is passed as a parameter here to prepare for multiple module support in the future.
Currently, MCJIT only supports a single module and the module passed to this function call is expected to be the contained module. The module is passed as a parameter here to prepare for multiple module support in the future.
Definition at line 73 of file MCJIT.cpp.
References llvm::PassManager::add(), llvm::TargetMachine::addPassesToEmitMC(), llvm::TargetMachine::getDataLayout(), llvm::ExecutionEngine::lock, llvm::ObjectCache::notifyObjectCompiled(), llvm::report_fatal_error(), llvm::PassManager::run(), and llvm::OwningPtr< T >::take().
Referenced by loadObject().
| void MCJIT::finalizeObject | ( | ) | [virtual] |
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.
Reimplemented from llvm::ExecutionEngine.
Definition at line 165 of file MCJIT.cpp.
References llvm::StringRef::empty(), llvm::RTDyldMemoryManager::finalizeMemory(), llvm::RuntimeDyld::getEHFrameSection(), loadObject(), llvm::RTDyldMemoryManager::registerEHFrames(), and llvm::RuntimeDyld::resolveRelocations().
| void MCJIT::freeMachineCodeForFunction | ( | Function * | F | ) | [virtual] |
freeMachineCodeForFunction - Release memory in the ExecutionEngine corresponding to the machine code emitted to execute this function, useful for garbage-collecting generated code.
Implements llvm::ExecutionEngine.
Definition at line 221 of file MCJIT.cpp.
References llvm::report_fatal_error().
| void * MCJIT::getPointerToBasicBlock | ( | BasicBlock * | BB | ) | [virtual] |
getPointerToBasicBlock - The different EE's represent basic blocks in different ways. Return the representation for a blockaddress of the specified block.
Implements llvm::ExecutionEngine.
Definition at line 184 of file MCJIT.cpp.
References llvm::report_fatal_error().
| void * MCJIT::getPointerToFunction | ( | Function * | F | ) | [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.
Implements llvm::ExecutionEngine.
Definition at line 188 of file MCJIT.cpp.
References llvm::ExecutionEngine::addGlobalMapping(), llvm::MCAsmInfo::getGlobalPrefix(), llvm::TargetMachine::getMCAsmInfo(), llvm::Value::getName(), getPointerToNamedFunction(), llvm::RuntimeDyld::getSymbolLoadAddress(), llvm::GlobalValue::hasAvailableExternallyLinkage(), llvm::GlobalValue::hasExternalWeakLinkage(), llvm::GlobalValue::isDeclaration(), loadObject(), and llvm::StringRef::substr().
Referenced by runFunction().
| void * MCJIT::getPointerToNamedFunction | ( | const std::string & | Name, |
| bool | AbortOnFailure = true |
||
| ) | [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.
If a LazyFunctionCreator is installed, use it to get/create the function.
Implements llvm::ExecutionEngine.
Definition at line 325 of file MCJIT.cpp.
References llvm::RTDyldMemoryManager::getPointerToNamedFunction(), llvm::ExecutionEngine::isSymbolSearchingDisabled(), llvm::ExecutionEngine::LazyFunctionCreator, loadObject(), and llvm::report_fatal_error().
Referenced by getPointerToFunction().
| void MCJIT::loadObject | ( | Module * | M | ) | [protected] |
Definition at line 118 of file MCJIT.cpp.
References emitObject(), llvm::OwningPtr< T >::get(), llvm::RuntimeDyld::getErrorString(), llvm::ObjectCache::getObjectCopy(), llvm::RuntimeDyld::loadObject(), llvm::ExecutionEngine::lock, NotifyObjectEmitted(), llvm::report_fatal_error(), llvm::OwningPtr< T >::reset(), llvm::RuntimeDyld::resolveRelocations(), and llvm::OwningPtr< T >::take().
Referenced by finalizeObject(), getPointerToFunction(), and getPointerToNamedFunction().
| virtual void llvm::MCJIT::mapSectionAddress | ( | const void * | LocalAddress, |
| uint64_t | TargetAddress | ||
| ) | [inline, virtual] |
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 from llvm::ExecutionEngine.
Definition at line 90 of file lib/ExecutionEngine/MCJIT/MCJIT.h.
References llvm::RuntimeDyld::mapSectionAddress().
| void MCJIT::NotifyFreeingObject | ( | const ObjectImage & | Obj | ) | [protected] |
Definition at line 372 of file MCJIT.cpp.
References I, llvm::ExecutionEngine::lock, and llvm::SmallVectorTemplateCommon< T, typename >::size().
Referenced by ~MCJIT().
| void MCJIT::NotifyObjectEmitted | ( | const ObjectImage & | Obj | ) | [protected] |
Definition at line 366 of file MCJIT.cpp.
References I, llvm::ExecutionEngine::lock, and llvm::SmallVectorTemplateCommon< T, typename >::size().
Referenced by loadObject().
| void * MCJIT::recompileAndRelinkFunction | ( | Function * | F | ) | [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().
Implements llvm::ExecutionEngine.
Definition at line 217 of file MCJIT.cpp.
References llvm::report_fatal_error().
| static void llvm::MCJIT::Register | ( | ) | [inline, static] |
Definition at line 102 of file lib/ExecutionEngine/MCJIT/MCJIT.h.
References createJIT(), and llvm::ExecutionEngine::MCJITCtor.
| void MCJIT::RegisterJITEventListener | ( | JITEventListener * | ) | [virtual] |
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 from llvm::ExecutionEngine.
Definition at line 349 of file MCJIT.cpp.
References llvm::ExecutionEngine::lock, and llvm::SmallVectorTemplateBase< T, isPodLike >::push_back().
| GenericValue MCJIT::runFunction | ( | Function * | F, |
| const std::vector< GenericValue > & | ArgValues | ||
| ) | [virtual] |
runFunction - Execute the specified function with the specified arguments, and return the result.
Implements llvm::ExecutionEngine.
Definition at line 225 of file MCJIT.cpp.
References llvm::Type::DoubleTyID, llvm::GenericValue::DoubleVal, llvm::Type::FloatTyID, llvm::GenericValue::FloatVal, llvm::Type::FP128TyID, getBitWidth(), llvm::Function::getFunctionType(), llvm::FunctionType::getNumParams(), llvm::FunctionType::getParamType(), getPointerToFunction(), llvm::FunctionType::getReturnType(), llvm::Type::getTypeID(), llvm::GVTOP(), llvm::Type::IntegerTyID, llvm::GenericValue::IntVal, llvm::tgtok::IntVal, llvm::Type::isIntegerTy(), llvm::Type::isPointerTy(), llvm::FunctionType::isVarArg(), llvm::Type::isVoidTy(), llvm_unreachable, llvm::Type::PointerTyID, llvm::Type::PPC_FP128TyID, llvm::PTOGV(), llvm::RetTy, llvm::Type::VoidTyID, and llvm::Type::X86_FP80TyID.
| void MCJIT::setObjectCache | ( | ObjectCache * | manager | ) | [virtual] |
Sets the object manager that MCJIT should use to avoid compilation.
Reimplemented from llvm::ExecutionEngine.
| void MCJIT::UnregisterJITEventListener | ( | JITEventListener * | L | ) | [virtual] |
Reimplemented from llvm::ExecutionEngine.
Definition at line 355 of file MCJIT.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::back(), I, llvm::ExecutionEngine::lock, llvm::SmallVectorTemplateBase< T, isPodLike >::pop_back(), llvm::SmallVectorTemplateCommon< T, typename >::rbegin(), llvm::SmallVectorTemplateCommon< T, typename >::rend(), and llvm::swap().