LLVM API Documentation
#include <JIT.h>
Definition at line 52 of file lib/ExecutionEngine/JIT/JIT.h.
| static void llvm::JIT::Register | ( | ) | [inline, static] |
Definition at line 71 of file lib/ExecutionEngine/JIT/JIT.h.
References create(), and llvm::ExecutionEngine::JITCtor.
| TargetJITInfo& llvm::JIT::getJITInfo | ( | ) | const [inline] |
getJITInfo - Return the target JIT information structure.
Definition at line 77 of file lib/ExecutionEngine/JIT/JIT.h.
| static ExecutionEngine* llvm::JIT::create | ( | ModuleProvider * | MP, | |
| std::string * | Err, | |||
| JITMemoryManager * | JMM, | |||
| CodeGenOpt::Level | OptLevel = CodeGenOpt::Default, |
|||
| bool | GVsWithCode = true | |||
| ) | [inline, static] |
create - Create an return a new JIT compiler if there is one available for the current target. Otherwise, return null.
Definition at line 82 of file lib/ExecutionEngine/JIT/JIT.h.
References llvm::ExecutionEngine::createJIT().
Referenced by Register().
| void JIT::addModuleProvider | ( | ModuleProvider * | MP | ) | [virtual] |
addModuleProvider - Add a new ModuleProvider to the JIT. If we previously removed the last ModuleProvider, we need re-initialize jitstate with a valid ModuleProvider.
Reimplemented from llvm::ExecutionEngine.
Definition at line 281 of file JIT.cpp.
References llvm::FunctionPassManager::add(), llvm::ExecutionEngine::addModuleProvider(), llvm::TargetMachine::addPassesToEmitMachineCode(), llvm::CodeGenOpt::Default, llvm::FunctionPassManager::doInitialization(), llvm::TargetMachine::getTargetData(), llvm::llvm_report_error(), llvm::ExecutionEngine::lock, llvm::ExecutionEngine::Modules, and TM.
| Module * JIT::removeModuleProvider | ( | ModuleProvider * | MP, | |
| std::string * | E = 0 | |||
| ) | [virtual] |
removeModuleProvider - Remove a ModuleProvider from the list of modules. Relases the Module from the ModuleProvider, materializing it in the process, and returns the materialized Module.
removeModuleProvider - If we are removing the last ModuleProvider, invalidate the jitstate since the PassManager it contains references a released ModuleProvider.
Reimplemented from llvm::ExecutionEngine.
Definition at line 308 of file JIT.cpp.
References llvm::FunctionPassManager::add(), llvm::TargetMachine::addPassesToEmitMachineCode(), llvm::CodeGenOpt::Default, llvm::FunctionPassManager::doInitialization(), llvm::TargetMachine::getTargetData(), llvm::llvm_report_error(), llvm::ExecutionEngine::lock, llvm::ExecutionEngine::Modules, llvm::ExecutionEngine::removeModuleProvider(), and TM.
| void JIT::deleteModuleProvider | ( | ModuleProvider * | MP, | |
| std::string * | E = 0 | |||
| ) | [virtual] |
deleteModuleProvider - Remove a ModuleProvider from the list of modules, and deletes the ModuleProvider and owned Module. Avoids materializing the underlying module.
deleteModuleProvider - Remove a ModuleProvider from the list of modules, and deletes the ModuleProvider and owned Module. Avoids materializing the underlying module.
Reimplemented from llvm::ExecutionEngine.
Definition at line 339 of file JIT.cpp.
References llvm::FunctionPassManager::add(), llvm::TargetMachine::addPassesToEmitMachineCode(), llvm::CodeGenOpt::Default, llvm::ExecutionEngine::deleteModuleProvider(), llvm::FunctionPassManager::doInitialization(), llvm::TargetMachine::getTargetData(), llvm::llvm_report_error(), llvm::ExecutionEngine::lock, llvm::ExecutionEngine::Modules, and TM.
| GenericValue JIT::runFunction | ( | Function * | F, | |
| const std::vector< GenericValue > & | ArgValues | |||
| ) | [virtual] |
runFunction - Start execution with the specified function and arguments.
run - Start execution with the specified function and arguments.
Implements llvm::ExecutionEngine.
Definition at line 368 of file JIT.cpp.
References llvm::lltok::APFloat, llvm::Function::begin(), llvm::CallingConv::C, llvm::BasicBlock::Create(), llvm::ReturnInst::Create(), llvm::Function::Create(), llvm::CallInst::Create(), llvm::Type::DoubleTyID, llvm::GenericValue::DoubleVal, llvm::Type::FloatTyID, llvm::GenericValue::FloatVal, llvm::Type::FP128TyID, llvm::ConstantFP::get(), llvm::FunctionType::get(), llvm::ConstantInt::get(), llvm::Function::getCallingConv(), llvm::Function::getContext(), llvm::Function::getFunctionType(), llvm::Type::getInt32Ty(), llvm::Type::getInt64Ty(), llvm::ConstantExpr::getIntToPtr(), llvm::FunctionType::getNumParams(), llvm::FunctionType::getParamType(), llvm::GlobalValue::getParent(), getPointerToFunction(), llvm::FunctionType::getReturnType(), llvm::Value::getType(), llvm::Type::getTypeID(), llvm::Type::getVoidTy(), llvm::GVTOP(), llvm::Type::IntegerTyID, llvm::GlobalValue::InternalLinkage, llvm::GenericValue::IntVal, llvm::FunctionType::isVarArg(), llvm_unreachable, llvm::Type::PointerTyID, llvm::Type::PPC_FP128TyID, llvm::PTOGV(), llvm::RetTy, llvm::CallInst::setCallingConv(), llvm::CallInst::setTailCall(), Stub, llvm::Type::VoidTyID, and llvm::Type::X86_FP80TyID.
| void * JIT::getPointerToNamedFunction | ( | const std::string & | Name, | |
| bool | AbortOnFailure = true | |||
| ) |
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.
getPointerToNamedFunction - This method returns the address of the specified function by using the dynamic loader interface. As such it is only useful for resolving library symbols, not code generated symbols.
If a LazyFunctionCreator is installed, use it to get/create the function.
Definition at line 99 of file Intercept.cpp.
References llvm::ExecutionEngine::isSymbolSearchingDisabled(), jit_atexit(), jit_exit(), llvm::ExecutionEngine::LazyFunctionCreator, llvm::llvm_report_error(), llvm::cl::Prefix, and llvm::sys::DynamicLibrary::SearchForAddressOfSymbol().
Referenced by getPointerToFunction(), and getPointerToNamedFunction().
| static void llvm::JIT::CompilationCallback | ( | ) | [static] |
| void * JIT::getPointerToFunction | ( | Function * | F | ) | [virtual] |
getPointerToFunction - This returns the address of the specified function, compiling it if necessary.
getPointerToFunction - This method is used to get the address of the specified function, compiling it if neccesary.
Implements llvm::ExecutionEngine.
Definition at line 626 of file JIT.cpp.
References llvm::ExecutionEngine::addGlobalMapping(), llvm::ExecutionEngine::areDlsymStubsEnabled(), llvm::Value::getName(), llvm::GlobalValue::getParent(), llvm::ExecutionEngine::getPointerToGlobalIfAvailable(), getPointerToNamedFunction(), llvm::GlobalValue::hasExternalWeakLinkage(), llvm::GlobalValue::hasNotBeenReadFromBitcode(), llvm::Function::isDeclaration(), llvm::llvm_report_error(), llvm::ExecutionEngine::lock, M, llvm::ModuleProvider::materializeFunction(), and llvm::ExecutionEngine::Modules.
Referenced by getPointerToNamedFunction(), recompileAndRelinkFunction(), and runFunction().
| void * JIT::getOrEmitGlobalVariable | ( | const GlobalVariable * | GV | ) | [virtual] |
getOrEmitGlobalVariable - Return the address of the specified global variable, possibly emitting it to memory if needed. This is used by the Emitter.
getOrEmitGlobalVariable - Return the address of the specified global variable, possibly emitting it to memory if needed. This is used by the Emitter.
Reimplemented from llvm::ExecutionEngine.
Definition at line 680 of file JIT.cpp.
References llvm::ExecutionEngine::addGlobalMapping(), llvm::ExecutionEngine::areDlsymStubsEnabled(), llvm::ExecutionEngine::EmitGlobalVariable(), getMemoryForGV(), llvm::Value::getName(), llvm::ExecutionEngine::getPointerToGlobalIfAvailable(), llvm::GlobalVariable::isDeclaration(), llvm::llvm_report_error(), llvm::ExecutionEngine::lock, and llvm::sys::DynamicLibrary::SearchForAddressOfSymbol().
| void * JIT::getPointerToFunctionOrStub | ( | Function * | F | ) | [virtual] |
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.
Reimplemented from llvm::ExecutionEngine.
Definition at line 1415 of file JITEmitter.cpp.
References getCodeEmitter(), and llvm::ExecutionEngine::getPointerToGlobalIfAvailable().
| void * JIT::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 JIT::getPointerToFunction().
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 JIT::getPointerToFunction().
Implements llvm::ExecutionEngine.
Definition at line 714 of file JIT.cpp.
References llvm::ExecutionEngine::addGlobalMapping(), getPointerToFunction(), llvm::ExecutionEngine::getPointerToGlobalIfAvailable(), llvm::TargetJITInfo::replaceMachineCodeForFunction(), and runJITOnFunction().
| void JIT::freeMachineCodeForFunction | ( | Function * | F | ) | [virtual] |
freeMachineCodeForFunction - deallocate memory used to code-generate this Function.
freeMachineCodeForFunction - release machine code memory for given Function.
Implements llvm::ExecutionEngine.
Definition at line 1526 of file JITEmitter.cpp.
References NotifyFreeingMachineCode(), and llvm::ExecutionEngine::updateGlobalMapping().
| void JIT::addPendingFunction | ( | Function * | F | ) |
addPendingFunction - while jitting non-lazily, a called but non-codegen'd function was encountered. Add it to a pending list to be processed after the current function.
Definition at line 775 of file JIT.cpp.
References llvm::ExecutionEngine::lock.
| JITCodeEmitter* llvm::JIT::getCodeEmitter | ( | ) | const [inline] |
getCodeEmitter - Return the code emitter this JIT is emitting into.
Definition at line 162 of file lib/ExecutionEngine/JIT/JIT.h.
Referenced by getPointerToFunctionOrStub().
| TargetMachine * JIT::selectTarget | ( | ModuleProvider * | MP, | |
| std::string * | ErrorStr | |||
| ) | [static] |
selectTarget - Pick a target either via -march or by guessing the native arch. Add any CPU features specified via -mcpu or -mattr.
selectTarget - Pick a target either via -march or by guessing the native arch. Add any CPU features specified via -mcpu or -mattr.
Definition at line 45 of file TargetSelect.cpp.
References llvm::SubtargetFeatures::AddFeature(), llvm::TargetRegistry::begin(), llvm::Target::createTargetMachine(), llvm::TargetRegistry::end(), Error(), llvm::errs(), llvm::Triple::getArchTypeForLLVMName(), llvm::sys::getHostTriple(), llvm::ModuleProvider::getModule(), llvm::SubtargetFeatures::getString(), llvm::Module::getTargetTriple(), llvm::Target::hasJIT(), llvm::TargetRegistry::lookupTarget(), MArch, MAttrs, MCPU, Mod, llvm::SubtargetFeatures::setCPU(), and llvm::Triple::UnknownArch.
Referenced by createJIT().
| ExecutionEngine * JIT::createJIT | ( | ModuleProvider * | MP, | |
| std::string * | ErrorStr, | |||
| JITMemoryManager * | JMM, | |||
| CodeGenOpt::Level | OptLevel, | |||
| bool | GVsWithCode | |||
| ) | [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 ModuleProvider 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 provider.
Reimplemented from llvm::ExecutionEngine.
Definition at line 205 of file JIT.cpp.
References llvm::TargetMachine::getJITInfo(), llvm::EngineKind::JIT, llvm::sys::DynamicLibrary::LoadLibraryPermanently(), selectTarget(), and TM.
Referenced by llvm::ExecutionEngine::createJIT().
| void JIT::runJITOnFunction | ( | Function * | F, | |
| MachineCodeInfo * | MCI = 0 | |||
| ) | [virtual] |
runJITOnFunction - Run the FunctionPassManager full of just-in-time compilation passes on F, hopefully filling in GlobalAddress[F] with the address of F's machine code.
Reimplemented from llvm::ExecutionEngine.
Definition at line 570 of file JIT.cpp.
References llvm::ExecutionEngine::lock, NotifyFunctionEmitted(), RegisterJITEventListener(), llvm::MachineCodeInfo::setAddress(), llvm::MachineCodeInfo::setSize(), and UnregisterJITEventListener().
Referenced by recompileAndRelinkFunction().
| void JIT::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 532 of file JIT.cpp.
References llvm::ExecutionEngine::lock.
Referenced by runJITOnFunction().
| void JIT::UnregisterJITEventListener | ( | JITEventListener * | L | ) | [virtual] |
Reimplemented from llvm::ExecutionEngine.
Definition at line 538 of file JIT.cpp.
References llvm::ExecutionEngine::lock, and std::swap().
Referenced by runJITOnFunction().
| void JIT::NotifyFunctionEmitted | ( | const Function & | F, | |
| void * | Code, | |||
| size_t | Size, | |||
| const JITEvent_EmittedFunctionDetails & | Details | |||
| ) |
These functions correspond to the methods on JITEventListener. They iterate over the registered listeners and call the corresponding method on each.
Definition at line 549 of file JIT.cpp.
References llvm::ExecutionEngine::lock, and S.
Referenced by runJITOnFunction().
| void JIT::NotifyFreeingMachineCode | ( | const Function & | F, | |
| void * | OldPtr | |||
| ) |
Definition at line 559 of file JIT.cpp.
References llvm::ExecutionEngine::lock, and S.
Referenced by freeMachineCodeForFunction().
| char * JIT::getMemoryForGV | ( | const GlobalVariable * | GV | ) | [protected, virtual] |
getMemoryforGV - Allocate memory for a global variable.
getMemoryForGV - This method abstracts memory allocation of global variable so that the JIT can allocate thread local variables depending on the target.
Reimplemented from llvm::ExecutionEngine.
Definition at line 737 of file JIT.cpp.
References A, llvm::JITCodeEmitter::allocateGlobal(), llvm::TargetJITInfo::allocateSeparateGVMemory(), llvm::JITCodeEmitter::allocateSpace(), llvm::TargetJITInfo::allocateThreadLocalMemory(), llvm::SequentialType::getElementType(), llvm::TargetData::getPreferredAlignment(), llvm::ExecutionEngine::getTargetData(), llvm::GlobalValue::getType(), llvm::TargetData::getTypeAllocSize(), llvm::GlobalVariable::isConstant(), llvm::ExecutionEngine::isGVCompilationDisabled(), llvm::GlobalVariable::isThreadLocal(), llvm::llvm_report_error(), llvm::ExecutionEngine::lock, and S.
Referenced by getOrEmitGlobalVariable().