LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | List of all members
llvm::Interpreter Class Reference

#include <Interpreter.h>

Inheritance diagram for llvm::Interpreter:
Inheritance graph
[legend]
Collaboration diagram for llvm::Interpreter:
Collaboration graph
[legend]

Public Member Functions

 Interpreter (Module *M)
 
 ~Interpreter ()
 
void runAtExitHandlers ()
 
virtual GenericValue runFunction (Function *F, const std::vector< GenericValue > &ArgValues)
 
virtual void * getPointerToNamedFunction (const std::string &Name, bool AbortOnFailure=true)
 
virtual void * recompileAndRelinkFunction (Function *F)
 
void freeMachineCodeForFunction (Function *F)
 
void callFunction (Function *F, const std::vector< GenericValue > &ArgVals)
 
void run ()
 
void visitReturnInst (ReturnInst &I)
 
void visitBranchInst (BranchInst &I)
 
void visitSwitchInst (SwitchInst &I)
 
void visitIndirectBrInst (IndirectBrInst &I)
 
void visitBinaryOperator (BinaryOperator &I)
 
void visitICmpInst (ICmpInst &I)
 
void visitFCmpInst (FCmpInst &I)
 
void visitAllocaInst (AllocaInst &I)
 
void visitLoadInst (LoadInst &I)
 
void visitStoreInst (StoreInst &I)
 
void visitGetElementPtrInst (GetElementPtrInst &I)
 
void visitPHINode (PHINode &PN)
 
void visitTruncInst (TruncInst &I)
 
void visitZExtInst (ZExtInst &I)
 
void visitSExtInst (SExtInst &I)
 
void visitFPTruncInst (FPTruncInst &I)
 
void visitFPExtInst (FPExtInst &I)
 
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 visitCallSite (CallSite CS)
 
void visitCallInst (CallInst &I)
 
void visitInvokeInst (InvokeInst &I)
 
void visitUnreachableInst (UnreachableInst &I)
 
void visitShl (BinaryOperator &I)
 
void visitLShr (BinaryOperator &I)
 
void visitAShr (BinaryOperator &I)
 
void visitVAArgInst (VAArgInst &I)
 
void visitExtractElementInst (ExtractElementInst &I)
 
void visitInsertElementInst (InsertElementInst &I)
 
void visitShuffleVectorInst (ShuffleVectorInst &I)
 
void visitExtractValueInst (ExtractValueInst &I)
 
void visitInsertValueInst (InsertValueInst &I)
 
void visitInstruction (Instruction &I)
 
GenericValue callExternalFunction (Function *F, const std::vector< GenericValue > &ArgVals)
 
void exitCalled (GenericValue GV)
 
void addAtExitHandler (Function *F)
 
GenericValuegetFirstVarArg ()
 
- Public Member Functions inherited from llvm::ExecutionEngine
virtual ~ExecutionEngine ()
 
virtual void addModule (Module *M)
 
const DataLayoutgetDataLayout () const
 
virtual bool removeModule (Module *M)
 
virtual FunctionFindFunctionNamed (const char *FnName)
 
virtual void mapSectionAddress (const void *LocalAddress, uint64_t TargetAddress)
 
virtual void generateCodeForModule (Module *M)
 
virtual void finalizeObject ()
 
virtual void runStaticConstructorsDestructors (bool isDtors)
 
void runStaticConstructorsDestructors (Module *module, bool isDtors)
 
int runFunctionAsMain (Function *Fn, const std::vector< std::string > &argv, const char *const *envp)
 
void addGlobalMapping (const GlobalValue *GV, void *Addr)
 
void clearAllGlobalMappings ()
 
void clearGlobalMappingsFromModule (Module *M)
 
void * updateGlobalMapping (const GlobalValue *GV, void *Addr)
 
void * getPointerToGlobalIfAvailable (const GlobalValue *GV)
 
void * getPointerToGlobal (const GlobalValue *GV)
 
virtual void * getPointerToFunctionOrStub (Function *F)
 
virtual uint64_t getGlobalValueAddress (const std::string &Name)
 
virtual uint64_t getFunctionAddress (const std::string &Name)
 
virtual void runJITOnFunction (Function *, MachineCodeInfo *=0)
 
const GlobalValuegetGlobalValueAtAddress (void *Addr)
 
void StoreValueToMemory (const GenericValue &Val, GenericValue *Ptr, Type *Ty)
 
void InitializeMemory (const Constant *Init, void *Addr)
 
virtual void * getOrEmitGlobalVariable (const GlobalVariable *GV)
 
virtual void RegisterJITEventListener (JITEventListener *)
 
virtual void UnregisterJITEventListener (JITEventListener *)
 
virtual void setObjectCache (ObjectCache *)
 
void DisableLazyCompilation (bool Disabled=true)
 
bool isCompilingLazily () const
 
bool isLazyCompilationDisabled () const
 
void DisableGVCompilation (bool Disabled=true)
 
bool isGVCompilationDisabled () const
 
void DisableSymbolSearching (bool Disabled=true)
 
bool isSymbolSearchingDisabled () const
 
void InstallLazyFunctionCreator (void *(*P)(const std::string &))
 
- Public Member Functions inherited from llvm::InstVisitor< Interpreter >
void visit (Iterator Start, Iterator End)
 
void visit (Module &M)
 
void visit (Function &F)
 
void visit (BasicBlock &BB)
 
void visit (Module *M)
 
void visit (Function *F)
 
void visit (BasicBlock *BB)
 
void visit (Instruction *I)
 
void visit (Instruction &I)
 
void visitModule (Module &M)
 
void visitFunction (Function &F)
 
void visitBasicBlock (BasicBlock &BB)
 
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 visitICmpInst (ICmpInst &I)
 
void visitFCmpInst (FCmpInst &I)
 
void visitAllocaInst (AllocaInst &I)
 
void visitLoadInst (LoadInst &I)
 
void visitStoreInst (StoreInst &I)
 
void visitAtomicCmpXchgInst (AtomicCmpXchgInst &I)
 
void visitAtomicRMWInst (AtomicRMWInst &I)
 
void visitFenceInst (FenceInst &I)
 
void visitGetElementPtrInst (GetElementPtrInst &I)
 
void visitPHINode (PHINode &I)
 
void visitTruncInst (TruncInst &I)
 
void visitZExtInst (ZExtInst &I)
 
void visitSExtInst (SExtInst &I)
 
void visitFPTruncInst (FPTruncInst &I)
 
void visitFPExtInst (FPExtInst &I)
 
void visitFPToUIInst (FPToUIInst &I)
 
void visitFPToSIInst (FPToSIInst &I)
 
void visitUIToFPInst (UIToFPInst &I)
 
void visitSIToFPInst (SIToFPInst &I)
 
void visitPtrToIntInst (PtrToIntInst &I)
 
void visitIntToPtrInst (IntToPtrInst &I)
 
void visitBitCastInst (BitCastInst &I)
 
void visitAddrSpaceCastInst (AddrSpaceCastInst &I)
 
void visitSelectInst (SelectInst &I)
 
void visitVAArgInst (VAArgInst &I)
 
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 visitDbgDeclareInst (DbgDeclareInst &I)
 
void visitDbgValueInst (DbgValueInst &I)
 
void visitDbgInfoIntrinsic (DbgInfoIntrinsic &I)
 
void visitMemSetInst (MemSetInst &I)
 
void visitMemCpyInst (MemCpyInst &I)
 
void visitMemMoveInst (MemMoveInst &I)
 
void visitMemTransferInst (MemTransferInst &I)
 
void visitMemIntrinsic (MemIntrinsic &I)
 
void visitVAStartInst (VAStartInst &I)
 
void visitVAEndInst (VAEndInst &I)
 
void visitVACopyInst (VACopyInst &I)
 
void visitIntrinsicInst (IntrinsicInst &I)
 
void visitCallInst (CallInst &I)
 
void visitInvokeInst (InvokeInst &I)
 
void visitCastInst (CastInst &I)
 
void visitBinaryOperator (BinaryOperator &I)
 
void visitCmpInst (CmpInst &I)
 
void visitTerminatorInst (TerminatorInst &I)
 
void visitUnaryInstruction (UnaryInstruction &I)
 
void visitCallSite (CallSite CS)
 
void visitInstruction (Instruction &I)
 

Static Public Member Functions

static void Register ()
 
static ExecutionEnginecreate (Module *M, std::string *ErrorStr=0)
 
- Static Public Member Functions inherited from llvm::ExecutionEngine
static ExecutionEnginecreate (Module *M, bool ForceInterpreter=false, std::string *ErrorStr=0, CodeGenOpt::Level OptLevel=CodeGenOpt::Default, bool GVsWithCode=true)
 
static ExecutionEnginecreateJIT (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)
 

Additional Inherited Members

- Public Attributes inherited from llvm::ExecutionEngine
sys::Mutex lock
 
- Protected Member Functions inherited from llvm::ExecutionEngine
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 inherited from llvm::ExecutionEngine
SmallVector< Module *, 1 > Modules
 
void *(* LazyFunctionCreator )(const std::string &)
 
- Static Protected Attributes inherited from llvm::ExecutionEngine
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)
 

Detailed Description

Definition at line 83 of file lib/ExecutionEngine/Interpreter/Interpreter.h.

Constructor & Destructor Documentation

Interpreter::Interpreter ( Module M)
explicit
Interpreter::~Interpreter ( )

Definition at line 60 of file Interpreter.cpp.

Member Function Documentation

void llvm::Interpreter::addAtExitHandler ( Function F)
inline

Definition at line 197 of file lib/ExecutionEngine/Interpreter/Interpreter.h.

Referenced by lle_X_atexit().

GenericValue Interpreter::callExternalFunction ( Function F,
const std::vector< GenericValue > &  ArgVals 
)
void Interpreter::callFunction ( Function F,
const std::vector< GenericValue > &  ArgVals 
)
ExecutionEngine * Interpreter::create ( Module M,
std::string *  ErrStr = 0 
)
static

create - Create an interpreter ExecutionEngine. This can never fail.

create - Create a new interpreter object. This can never fail.

Definition at line 35 of file Interpreter.cpp.

References Interpreter(), and llvm::Module::MaterializeAllPermanently().

Referenced by Register().

void Interpreter::exitCalled ( GenericValue  GV)
void llvm::Interpreter::freeMachineCodeForFunction ( Function F)
inlinevirtual

freeMachineCodeForFunction - The interpreter does not generate any code.

Implements llvm::ExecutionEngine.

Definition at line 133 of file lib/ExecutionEngine/Interpreter/Interpreter.h.

GenericValue* llvm::Interpreter::getFirstVarArg ( )
inline
virtual void* llvm::Interpreter::getPointerToNamedFunction ( const std::string &  Name,
bool  AbortOnFailure = true 
)
inlinevirtual

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.

Implements llvm::ExecutionEngine.

Definition at line 118 of file lib/ExecutionEngine/Interpreter/Interpreter.h.

virtual void* llvm::Interpreter::recompileAndRelinkFunction ( Function F)
inlinevirtual

recompileAndRelinkFunction - For the interpreter, functions are always up-to-date.

Implements llvm::ExecutionEngine.

Definition at line 127 of file lib/ExecutionEngine/Interpreter/Interpreter.h.

static void llvm::Interpreter::Register ( )
inlinestatic
void Interpreter::run ( )
void Interpreter::runAtExitHandlers ( )

runAtExitHandlers - Run any functions registered by the program's calls to atexit(3), which we intercept and store in AtExitHandlers.

Definition at line 64 of file Interpreter.cpp.

References callFunction(), and run().

Referenced by exitCalled().

GenericValue Interpreter::runFunction ( Function F,
const std::vector< GenericValue > &  ArgValues 
)
virtual

run - Start execution with the specified function and arguments.

Implements llvm::ExecutionEngine.

Definition at line 75 of file Interpreter.cpp.

References callFunction(), llvm::Function::getFunctionType(), llvm::FunctionType::getNumParams(), and run().

void Interpreter::visitAllocaInst ( AllocaInst I)
void Interpreter::visitAShr ( BinaryOperator I)
void Interpreter::visitBinaryOperator ( BinaryOperator I)
void Interpreter::visitBitCastInst ( BitCastInst I)

Definition at line 1708 of file Execution.cpp.

References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().

void Interpreter::visitBranchInst ( BranchInst I)
void llvm::Interpreter::visitCallInst ( CallInst I)
inline

Definition at line 172 of file lib/ExecutionEngine/Interpreter/Interpreter.h.

References visitCallSite().

void Interpreter::visitCallSite ( CallSite  CS)
void Interpreter::visitExtractElementInst ( ExtractElementInst I)
void Interpreter::visitExtractValueInst ( ExtractValueInst I)
void Interpreter::visitFCmpInst ( FCmpInst I)
void Interpreter::visitFPExtInst ( FPExtInst I)

Definition at line 1673 of file Execution.cpp.

References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().

void Interpreter::visitFPToSIInst ( FPToSIInst I)

Definition at line 1693 of file Execution.cpp.

References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().

void Interpreter::visitFPToUIInst ( FPToUIInst I)

Definition at line 1688 of file Execution.cpp.

References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().

void Interpreter::visitFPTruncInst ( FPTruncInst I)

Definition at line 1668 of file Execution.cpp.

References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().

void Interpreter::visitGetElementPtrInst ( GetElementPtrInst I)
void Interpreter::visitICmpInst ( ICmpInst I)
void Interpreter::visitIndirectBrInst ( IndirectBrInst I)

Definition at line 911 of file Execution.cpp.

References llvm::IndirectBrInst::getAddress(), and llvm::GVTOP().

void Interpreter::visitInsertElementInst ( InsertElementInst I)
void Interpreter::visitInsertValueInst ( InsertValueInst I)
void llvm::Interpreter::visitInstruction ( Instruction I)
inline
void Interpreter::visitIntToPtrInst ( IntToPtrInst I)

Definition at line 1703 of file Execution.cpp.

References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().

void llvm::Interpreter::visitInvokeInst ( InvokeInst I)
inline

Definition at line 173 of file lib/ExecutionEngine/Interpreter/Interpreter.h.

References visitCallSite().

void Interpreter::visitLoadInst ( LoadInst I)
void Interpreter::visitLShr ( BinaryOperator I)
void llvm::Interpreter::visitPHINode ( PHINode PN)
inline

Definition at line 153 of file lib/ExecutionEngine/Interpreter/Interpreter.h.

References llvm_unreachable.

void Interpreter::visitPtrToIntInst ( PtrToIntInst I)

Definition at line 1698 of file Execution.cpp.

References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().

void Interpreter::visitReturnInst ( ReturnInst I)
void Interpreter::visitSelectInst ( SelectInst I)
void Interpreter::visitSExtInst ( SExtInst I)

Definition at line 1658 of file Execution.cpp.

References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().

void Interpreter::visitShl ( BinaryOperator I)
void Interpreter::visitShuffleVectorInst ( ShuffleVectorInst I)
void Interpreter::visitSIToFPInst ( SIToFPInst I)

Definition at line 1683 of file Execution.cpp.

References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().

void Interpreter::visitStoreInst ( StoreInst I)
void Interpreter::visitSwitchInst ( SwitchInst I)
void Interpreter::visitTruncInst ( TruncInst I)

Definition at line 1653 of file Execution.cpp.

References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().

void Interpreter::visitUIToFPInst ( UIToFPInst I)

Definition at line 1678 of file Execution.cpp.

References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().

void Interpreter::visitUnreachableInst ( UnreachableInst I)

Definition at line 875 of file Execution.cpp.

References llvm::report_fatal_error().

void Interpreter::visitVAArgInst ( VAArgInst I)
void Interpreter::visitZExtInst ( ZExtInst I)

Definition at line 1663 of file Execution.cpp.

References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().


The documentation for this class was generated from the following files: