LLVM: llvm::Interpreter Class Reference (original) (raw)
Public Member Functions
Interpreter (std::unique_ptr< Module > M)
~Interpreter () override
void
runAtExitHandlers - Run any functions registered by the program's calls to atexit(3), which we intercept and store in AtExitHandlers.
runFunction (Function *F, ArrayRef< GenericValue > ArgValues) override
run - Start execution with the specified function and arguments.
void *
getPointerToNamedFunction (StringRef Name, bool AbortOnFailure=true) override
getPointerToNamedFunction - This method returns the address of the specified function by using the dlsym function call.
void
callFunction (Function *F, ArrayRef< GenericValue > ArgVals)
void
run ()
void
visitReturnInst (ReturnInst &I)
void
visitBranchInst (BranchInst &I)
void
visitSwitchInst (SwitchInst &I)
void
visitIndirectBrInst (IndirectBrInst &I)
void
visitUnaryOperator (UnaryOperator &I)
void
visitBinaryOperator (BinaryOperator &I)
void
void
void
visitAllocaInst (AllocaInst &I)
void
void
void
visitGetElementPtrInst (GetElementPtrInst &I)
void
visitPHINode (PHINode &PN)
void
void
void
void
visitFPTruncInst (FPTruncInst &I)
void
void
visitUIToFPInst (UIToFPInst &I)
void
visitSIToFPInst (SIToFPInst &I)
void
visitFPToUIInst (FPToUIInst &I)
void
visitFPToSIInst (FPToSIInst &I)
void
visitPtrToIntInst (PtrToIntInst &I)
void
visitIntToPtrInst (IntToPtrInst &I)
void
visitBitCastInst (BitCastInst &I)
void
visitSelectInst (SelectInst &I)
void
visitVAStartInst (VAStartInst &I)
void
void
visitVACopyInst (VACopyInst &I)
void
visitIntrinsicInst (IntrinsicInst &I)
void
void
visitUnreachableInst (UnreachableInst &I)
void
void
void
void
void
visitExtractElementInst (ExtractElementInst &I)
void
visitInsertElementInst (InsertElementInst &I)
void
visitShuffleVectorInst (ShuffleVectorInst &I)
void
visitExtractValueInst (ExtractValueInst &I)
void
visitInsertValueInst (InsertValueInst &I)
void
visitInstruction (Instruction &I)
callExternalFunction (Function *F, ArrayRef< GenericValue > ArgVals)
void
exitCalled (GenericValue GV)
void
addAtExitHandler (Function *F)
Public Member Functions inherited from llvm::ExecutionEngine
virtual
virtual void
addModule (std::unique_ptr< Module > M)
Add a Module to the list of modules that we can JIT from.
virtual void
addObjectFile (std::unique_ptr< object::ObjectFile > O)
addObjectFile - Add an ObjectFile to the execution engine.
virtual void
addObjectFile (object::OwningBinary< object::ObjectFile > O)
virtual void
addArchive (object::OwningBinary< object::Archive > A)
addArchive - Add an Archive to the execution engine.
virtual bool
removeModule (Module *M)
removeModule - Removes a Module from the list of modules, but does not free the module's memory.
virtual Function *
FindFunctionNamed (StringRef FnName)
FindFunctionNamed - Search all of the active modules to find the function that defines FnName.
virtual GlobalVariable *
FindGlobalVariableNamed (StringRef Name, bool AllowInternal=false)
FindGlobalVariableNamed - Search all of the active modules to find the global variable that defines Name.
virtual void
mapSectionAddress (const void *LocalAddress, uint64_t TargetAddress)
mapSectionAddress - map a section to its target address space value.
virtual void
generateCodeForModule (Module *M)
generateCodeForModule - Run code generation for the specified module and load it into memory.
virtual void
finalizeObject - ensure the module is fully processed and is usable.
Returns true if an error has been recorded.
void
Clear the error message.
const std::string &
Returns the most recent error message.
virtual void
runStaticConstructorsDestructors (bool isDtors)
runStaticConstructorsDestructors - This method is used to execute all of the static constructors or destructors for a program.
void
runStaticConstructorsDestructors (Module &module, bool isDtors)
This method is used to execute all of the static constructors or destructors for a particular module.
int
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.
void
addGlobalMapping (const GlobalValue *GV, void *Addr)
addGlobalMapping - Tell the execution engine that the specified global is at the specified location.
void
addGlobalMapping (StringRef Name, uint64_t Addr)
void
clearAllGlobalMappings - Clear all global mappings and start over again, for use in dynamic compilation scenarios to move globals.
void
clearGlobalMappingsFromModule (Module *M)
clearGlobalMappingsFromModule - Clear all global mappings that came from a particular module, because it has been removed from the JIT.
updateGlobalMapping (const GlobalValue *GV, void *Addr)
updateGlobalMapping - Replace an existing mapping for GV with a new address.
updateGlobalMapping (StringRef Name, uint64_t Addr)
getAddressToGlobalIfAvailable (StringRef S)
getAddressToGlobalIfAvailable - This returns the address of the specified global symbol.
void *
getPointerToGlobalIfAvailable (StringRef S)
getPointerToGlobalIfAvailable - This returns the address of the specified global value if it is has already been codegen'd, otherwise it returns null.
void *
getPointerToGlobalIfAvailable (const GlobalValue *GV)
void *
getPointerToGlobal (const GlobalValue *GV)
getPointerToGlobal - This returns the address of the specified global value.
virtual void *
getPointerToFunctionOrStub (Function *F)
getPointerToFunctionOrStub - If the specified function has been code-gen'd, return a pointer to the function.
virtual uint64_t
getGlobalValueAddress (const std::string &Name)
getGlobalValueAddress - Return the address of the specified global value.
virtual uint64_t
getFunctionAddress (const std::string &Name)
getFunctionAddress - Return the address of the specified function.
getGlobalValueAtAddress (void *Addr)
getGlobalValueAtAddress - Return the LLVM global value object that starts at the specified address.
void
StoreValueToMemory (const GenericValue &Val, GenericValue *Ptr, Type *Ty)
StoreValueToMemory - Stores the data in Val of type Ty at address Ptr.
void
InitializeMemory (const Constant *Init, void *Addr)
virtual void *
getOrEmitGlobalVariable (const GlobalVariable *GV)
getOrEmitGlobalVariable - Return the address of the specified global variable, possibly emitting it to memory if needed.
virtual void
RegisterJITEventListener (JITEventListener *)
Registers a listener to be called back on various events within the JIT.
virtual void
UnregisterJITEventListener (JITEventListener *)
virtual void
setObjectCache (ObjectCache *)
Sets the pre-compiled object cache.
virtual void
setProcessAllSections (bool ProcessAllSections)
setProcessAllSections (MCJIT Only): By default, only sections that are "required for execution" are passed to the RTDyldMemoryManager, and other sections are discarded.
virtual TargetMachine *
Return the target machine (if available).
void
DisableLazyCompilation (bool Disabled=true)
DisableLazyCompilation - When lazy compilation is off (the default), the JIT will eagerly compile every function reachable from the argument to getPointerToFunction.
void
DisableGVCompilation (bool Disabled=true)
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.
isGVCompilationDisabled () const
void
DisableSymbolSearching (bool Disabled=true)
DisableSymbolSearching - If called, the JIT will not try to lookup unknown symbols with dlsym.
isSymbolSearchingDisabled () const
void
setVerifyModules (bool Verify)
Enable/Disable IR module verification.
void
InstallLazyFunctionCreator (FunctionCreator C)
InstallLazyFunctionCreator - If an unknown function is needed, the specified function pointer is invoked to create it.
Public Member Functions inherited from llvm::InstVisitor< Interpreter >
void
visit (Iterator Start, Iterator End)
void
visitModule (Module &M)
void
void
visitBasicBlock (BasicBlock &BB)
void
void
void
visitAllocaInst (AllocaInst &I)
void
void
void
visitAtomicCmpXchgInst (AtomicCmpXchgInst &I)
void
visitAtomicRMWInst (AtomicRMWInst &I)
void
void
visitGetElementPtrInst (GetElementPtrInst &I)
void
visitPHINode (PHINode &I)
void
void
void
void
visitFPTruncInst (FPTruncInst &I)
void
void
visitFPToUIInst (FPToUIInst &I)
void
visitFPToSIInst (FPToSIInst &I)
void
visitUIToFPInst (UIToFPInst &I)
void
visitSIToFPInst (SIToFPInst &I)
void
visitPtrToIntInst (PtrToIntInst &I)
void
visitPtrToAddrInst (PtrToAddrInst &I)
void
visitIntToPtrInst (IntToPtrInst &I)
void
visitBitCastInst (BitCastInst &I)
void
visitAddrSpaceCastInst (AddrSpaceCastInst &I)
void
visitSelectInst (SelectInst &I)
void
void
visitExtractElementInst (ExtractElementInst &I)
void
visitInsertElementInst (InsertElementInst &I)
void
visitShuffleVectorInst (ShuffleVectorInst &I)
void
visitExtractValueInst (ExtractValueInst &I)
void
visitInsertValueInst (InsertValueInst &I)
void
visitLandingPadInst (LandingPadInst &I)
void
visitFuncletPadInst (FuncletPadInst &I)
void
visitCleanupPadInst (CleanupPadInst &I)
void
visitCatchPadInst (CatchPadInst &I)
void
visitFreezeInst (FreezeInst &I)
void
visitMemSetInst (MemSetInst &I)
void
visitMemSetPatternInst (MemSetPatternInst &I)
void
visitMemCpyInst (MemCpyInst &I)
void
visitMemMoveInst (MemMoveInst &I)
void
visitMemTransferInst (MemTransferInst &I)
void
visitMemIntrinsic (MemIntrinsic &I)
void
visitVAStartInst (VAStartInst &I)
void
void
visitVACopyInst (VACopyInst &I)
void
visitIntrinsicInst (IntrinsicInst &I)
void
void
visitInvokeInst (InvokeInst &I)
void
visitCallBrInst (CallBrInst &I)
void
visitReturnInst (ReturnInst &I)
void
visitBranchInst (BranchInst &I)
void
visitSwitchInst (SwitchInst &I)
void
visitIndirectBrInst (IndirectBrInst &I)
void
visitResumeInst (ResumeInst &I)
void
visitUnreachableInst (UnreachableInst &I)
void
visitCleanupReturnInst (CleanupReturnInst &I)
void
visitCatchReturnInst (CatchReturnInst &I)
void
visitCatchSwitchInst (CatchSwitchInst &I)
void
visitTerminator (Instruction &I)
void
void
visitUnaryOperator (UnaryOperator &I)
void
visitBinaryOperator (BinaryOperator &I)
void
visitCmpInst (CmpInst &I)
void
visitUnaryInstruction (UnaryInstruction &I)
void
void
visitInstruction (Instruction &I)
Additional Inherited Members
Public Attributes inherited from llvm::ExecutionEngine
lock - This lock protects the ExecutionEngine and MCJIT classes.
Protected Member Functions inherited from llvm::ExecutionEngine
virtual char *
getMemoryForGV (const GlobalVariable *GV)
getMemoryforGV - Allocate memory for a global variable.
std::string
getMangledName (const GlobalValue *GV)
getMangledName - Get mangled name.
ExecutionEngine (DataLayout DL)
ExecutionEngine (DataLayout DL, std::unique_ptr< Module > M)
ExecutionEngine (std::unique_ptr< Module > M)
void
emitGlobals ()
EmitGlobals - Emit all of the global variables to memory, storing their addresses into GlobalAddress.
void
emitGlobalVariable (const GlobalVariable *GV)
getConstantValue (const Constant *C)
Converts a Constant* into a GenericValue, including handling of ConstantExpr values.
void
LoadValueFromMemory (GenericValue &Result, GenericValue *Ptr, Type *Ty)
FIXME: document.
Protected Attributes inherited from llvm::ExecutionEngine
SmallVector< std::unique_ptr< Module >, 1 >
The list of Modules that we are JIT'ing from.
LazyFunctionCreator - If an unknown function is needed, this function pointer is invoked to create it.
std::string
Static Protected Attributes inherited from llvm::ExecutionEngine
static ExecutionEngine *(*
MCJITCtor )(std::unique_ptr< Module > M, std::string *ErrorStr, std::shared_ptr< MCJITMemoryManager > MM, std::shared_ptr< LegacyJITSymbolResolver > SR, std::unique_ptr< TargetMachine > TM) = nullptr
static ExecutionEngine *(*
InterpCtor )(std::unique_ptr< Module > M, std::string *ErrorStr) =nullptr
Definition at line 74 of file Interpreter.h.
| void * llvm::Interpreter::getPointerToNamedFunction ( StringRef Name, bool AbortOnFailure = true ) | inlineoverridevirtual |
|---|
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.
Implements llvm::ExecutionEngine.
Definition at line 109 of file Interpreter.h.