LLVM API Documentation
#include <JIT.h>
Static Public Member Functions | |
static void | Register () |
static ExecutionEngine * | create (Module *M, std::string *Err, JITMemoryManager *JMM, CodeGenOpt::Level OptLevel=CodeGenOpt::Default, bool GVsWithCode=true, Reloc::Model RM=Reloc::Default, CodeModel::Model CMM=CodeModel::JITDefault) |
static void | CompilationCallback () |
static ExecutionEngine * | createJIT (Module *M, std::string *ErrorStr, JITMemoryManager *JMM, bool GVsWithCode, TargetMachine *TM) |
![]() | |
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) |
Protected Member Functions | |
virtual char * | getMemoryForGV (const GlobalVariable *GV) |
getMemoryforGV - Allocate memory for a global variable. More... | |
![]() | |
void | setDataLayout (const DataLayout *td) |
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) |
Additional Inherited Members | |
![]() | |
sys::Mutex | lock |
![]() | |
SmallVector< Module *, 1 > | Modules |
void *(* | LazyFunctionCreator )(const std::string &) |
![]() | |
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) |
Definition at line 53 of file lib/ExecutionEngine/JIT/JIT.h.
|
virtual |
addModule - Add a new Module to the JIT. If we previously removed the last Module, we need re-initialize jitstate with a valid Module.
Reimplemented from llvm::ExecutionEngine.
Definition at line 177 of file JIT.cpp.
References llvm::ExecutionEngine::addModule(), llvm::TargetMachine::addPassesToEmitMachineCode(), llvm::TargetMachine::getDataLayout(), llvm::ExecutionEngine::lock, llvm::ExecutionEngine::Modules, and llvm::report_fatal_error().
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 686 of file JIT.cpp.
References llvm::ExecutionEngine::lock.
void JIT::addPointerToBasicBlock | ( | const BasicBlock * | BB, |
void * | Addr | ||
) |
addPointerToBasicBlock - Adds address of the specific basic block.
Definition at line 533 of file JIT.cpp.
References llvm::sys::path::end(), llvm::ValueMap< KeyT, ValueT, Config >::find(), getBasicBlockAddressMap(), I, and llvm::ExecutionEngine::lock.
void JIT::clearPointerToBasicBlock | ( | const BasicBlock * | BB | ) |
clearPointerToBasicBlock - Removes address of specific basic block.
Definition at line 545 of file JIT.cpp.
References llvm::ValueMap< KeyT, ValueT, Config >::erase(), getBasicBlockAddressMap(), and llvm::ExecutionEngine::lock.
|
static |
|
inlinestatic |
create - Create an return a new JIT compiler if there is one available for the current target. Otherwise, return null.
Definition at line 97 of file lib/ExecutionEngine/JIT/JIT.h.
References llvm::ExecutionEngine::createJIT(), and llvm::NVPTX::PTXCvtMode::RM.
|
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.
Definition at line 73 of file JIT.cpp.
References llvm::TargetMachine::getJITInfo(), and llvm::sys::DynamicLibrary::LoadLibraryPermanently().
Referenced by Register().
|
virtual |
freeMachineCodeForFunction - deallocate memory used to code-generate this Function.
freeMachineCodeForFunction - release machine code memory for given Function.
Implements llvm::ExecutionEngine.
Definition at line 1244 of file JITEmitter.cpp.
References llvm::ExecutionEngine::updateGlobalMapping().
|
inline |
Definition at line 205 of file lib/ExecutionEngine/JIT/JIT.h.
Referenced by addPointerToBasicBlock(), clearPointerToBasicBlock(), and getPointerToBasicBlock().
|
inline |
getCodeEmitter - Return the code emitter this JIT is emitting into.
Definition at line 183 of file lib/ExecutionEngine/JIT/JIT.h.
Referenced by getPointerToFunctionOrStub().
|
inline |
getJITInfo - Return the target JIT information structure.
Definition at line 92 of file lib/ExecutionEngine/JIT/JIT.h.
|
protectedvirtual |
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 648 of file JIT.cpp.
References llvm::ARM_PROC::A, llvm::JITCodeEmitter::allocateGlobal(), llvm::TargetJITInfo::allocateSeparateGVMemory(), llvm::JITCodeEmitter::allocateSpace(), llvm::TargetJITInfo::allocateThreadLocalMemory(), llvm::ExecutionEngine::getDataLayout(), llvm::SequentialType::getElementType(), llvm::DataLayout::getPreferredAlignment(), llvm::GlobalValue::getType(), llvm::DataLayout::getTypeAllocSize(), llvm::GlobalVariable::isConstant(), llvm::ExecutionEngine::isGVCompilationDisabled(), llvm::GlobalVariable::isThreadLocal(), llvm::ExecutionEngine::lock, llvm::LibFunc::malloc, and llvm::report_fatal_error().
Referenced by getOrEmitGlobalVariable().
|
virtual |
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 591 of file JIT.cpp.
References llvm::ExecutionEngine::addGlobalMapping(), llvm::ExecutionEngine::EmitGlobalVariable(), getMemoryForGV(), llvm::Value::getName(), llvm::ExecutionEngine::getPointerToGlobalIfAvailable(), llvm::GlobalValue::hasAvailableExternallyLinkage(), llvm::GlobalValue::isDeclaration(), llvm::ExecutionEngine::lock, llvm::report_fatal_error(), and llvm::sys::DynamicLibrary::SearchForAddressOfSymbol().
|
virtual |
getPointerToBasicBlock - This returns the address of the specified basic block, assuming function is compiled.
Implements llvm::ExecutionEngine.
Definition at line 550 of file JIT.cpp.
References llvm::sys::path::end(), llvm::ValueMap< KeyT, ValueT, Config >::find(), getBasicBlockAddressMap(), llvm::BasicBlock::getParent(), getPointerToFunction(), I, llvm_unreachable, llvm::ExecutionEngine::lock, and llvm::ValueMapIterator< DenseMapT, KeyT >::ValueTypeProxy::second.
|
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 necessary.
Implements llvm::ExecutionEngine.
Definition at line 500 of file JIT.cpp.
References llvm::ExecutionEngine::addGlobalMapping(), llvm::Value::getName(), llvm::ExecutionEngine::getPointerToGlobalIfAvailable(), getPointerToNamedFunction(), llvm::GlobalValue::hasAvailableExternallyLinkage(), llvm::GlobalValue::hasExternalWeakLinkage(), llvm::GlobalValue::isDeclaration(), llvm::ExecutionEngine::lock, llvm::GlobalValue::Materialize(), and llvm::report_fatal_error().
Referenced by getPointerToBasicBlock(), recompileAndRelinkFunction(), and runFunction().
|
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 1217 of file JITEmitter.cpp.
References getCodeEmitter(), and llvm::ExecutionEngine::getPointerToGlobalIfAvailable().
|
virtual |
getPointerToNamedFunction - This method returns the address of the specified function by using the MemoryManager. 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 567 of file JIT.cpp.
References llvm::RTDyldMemoryManager::getPointerToNamedFunction(), llvm::ExecutionEngine::isSymbolSearchingDisabled(), llvm::ExecutionEngine::LazyFunctionCreator, llvm::report_fatal_error(), and llvm::NVPTX::PTXCvtMode::RP.
Referenced by getPointerToFunction().
void JIT::NotifyFreeingMachineCode | ( | void * | OldPtr | ) |
Definition at line 431 of file JIT.cpp.
References I, and llvm::ExecutionEngine::lock.
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 421 of file JIT.cpp.
References I, and llvm::ExecutionEngine::lock.
Referenced by runJITOnFunction().
|
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().
Implements llvm::ExecutionEngine.
Definition at line 625 of file JIT.cpp.
References llvm::ExecutionEngine::addGlobalMapping(), getPointerToFunction(), llvm::ExecutionEngine::getPointerToGlobalIfAvailable(), llvm::TargetJITInfo::replaceMachineCodeForFunction(), and runJITOnFunction().
|
inlinestatic |
Definition at line 86 of file lib/ExecutionEngine/JIT/JIT.h.
References createJIT(), and llvm::ExecutionEngine::JITCtor.
|
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 404 of file JIT.cpp.
References llvm::ExecutionEngine::lock.
Referenced by runJITOnFunction().
removeModule - Remove a Module from the list of modules. Returns true if M is found.
removeModule - If we are removing the last Module, invalidate the jitstate since the PassManager it contains references a released Module.
Reimplemented from llvm::ExecutionEngine.
Definition at line 203 of file JIT.cpp.
References llvm::TargetMachine::addPassesToEmitMachineCode(), llvm::TargetMachine::getDataLayout(), llvm::ExecutionEngine::lock, llvm::ExecutionEngine::Modules, llvm::ExecutionEngine::removeModule(), and llvm::report_fatal_error().
|
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 233 of file JIT.cpp.
References llvm::lltok::APFloat, llvm::CallingConv::C, llvm::BasicBlock::Create(), llvm::Function::Create(), llvm::CallInst::Create(), llvm::ReturnInst::Create(), llvm::Type::DoubleTyID, llvm::GenericValue::DoubleVal, llvm::Function::eraseFromParent(), llvm::Type::FloatTyID, llvm::GenericValue::FloatVal, llvm::Type::FP128TyID, llvm::ConstantInt::get(), llvm::FunctionType::get(), llvm::ConstantFP::get(), getBitWidth(), llvm::Function::getCallingConv(), llvm::Function::getContext(), llvm::Type::getFltSemantics(), 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::GVTOP(), llvm::Type::IntegerTyID, llvm::GlobalValue::InternalLinkage, 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::CallInst::setCallingConv(), llvm::CallInst::setTailCall(), llvm::Type::VoidTyID, and llvm::Type::X86_FP80TyID.
|
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 442 of file JIT.cpp.
References llvm::tgtok::Code, llvm::ExecutionEngine::lock, NotifyFunctionEmitted(), RegisterJITEventListener(), llvm::MachineCodeInfo::setAddress(), llvm::MachineCodeInfo::setSize(), and UnregisterJITEventListener().
Referenced by recompileAndRelinkFunction().
|
virtual |
Reimplemented from llvm::ExecutionEngine.
Definition at line 410 of file JIT.cpp.
References I, llvm::ExecutionEngine::lock, and std::swap().
Referenced by runJITOnFunction().