LLVM API Documentation
#include <Interpreter.h>
Definition at line 96 of file lib/ExecutionEngine/Interpreter/Interpreter.h.
Interpreter::Interpreter | ( | std::unique_ptr< Module > | M | ) | [explicit] |
Definition at line 51 of file Interpreter.cpp.
References llvm::ExecutionEngine::emitGlobals(), llvm::LibFunc::memset, llvm::ExecutionEngine::setDataLayout(), and llvm::GenericValue::Untyped.
Referenced by create().
Definition at line 64 of file Interpreter.cpp.
void llvm::Interpreter::addAtExitHandler | ( | Function * | F | ) | [inline] |
Definition at line 200 of file lib/ExecutionEngine/Interpreter/Interpreter.h.
Referenced by lle_X_atexit().
GenericValue Interpreter::callExternalFunction | ( | Function * | F, |
const std::vector< GenericValue > & | ArgVals | ||
) |
Definition at line 248 of file ExternalFunctions.cpp.
References llvm::errs(), ExportedFunctions, FunctionsLock, llvm::ExecutionEngine::getDataLayout(), llvm::Function::getFunctionType(), llvm::Value::getName(), llvm::ExecutionEngine::getPointerToGlobalIfAvailable(), llvm::GlobalValue::getType(), lookupFunction(), llvm::report_fatal_error(), llvm::sys::DynamicLibrary::SearchForAddressOfSymbol(), TheInterpreter, and llvm::unique_lock< MutexT >::unlock().
Referenced by callFunction().
void Interpreter::callFunction | ( | Function * | F, |
const std::vector< GenericValue > & | ArgVals | ||
) |
Definition at line 2075 of file Execution.cpp.
References llvm::Function::arg_begin(), llvm::Function::arg_end(), llvm::Function::arg_size(), llvm::BasicBlock::begin(), llvm::Function::begin(), callExternalFunction(), llvm::ExecutionContext::CurBB, llvm::ExecutionContext::CurFunction, llvm::ExecutionContext::CurInst, F(), llvm::Function::getFunctionType(), llvm::Function::getReturnType(), llvm::GlobalValue::isDeclaration(), llvm::FunctionType::isVarArg(), SetValue(), and llvm::ExecutionContext::VarArgs.
Referenced by runAtExitHandlers(), runFunction(), and visitCallSite().
ExecutionEngine * Interpreter::create | ( | std::unique_ptr< Module > | M, |
std::string * | ErrStr = nullptr |
||
) | [static] |
Create an interpreter ExecutionEngine.
Create a new interpreter object.
Definition at line 35 of file Interpreter.cpp.
References Interpreter().
Referenced by Register().
void Interpreter::exitCalled | ( | GenericValue | GV | ) |
Definition at line 819 of file Execution.cpp.
References llvm::APInt::getZExtValue(), llvm::GenericValue::IntVal, runAtExitHandlers(), and llvm::APInt::zextOrTrunc().
Referenced by lle_X_exit().
GenericValue* llvm::Interpreter::getFirstVarArg | ( | ) | [inline] |
Definition at line 204 of file lib/ExecutionEngine/Interpreter/Interpreter.h.
void* llvm::Interpreter::getPointerToNamedFunction | ( | StringRef | Name, |
bool | AbortOnFailure = true |
||
) | [inline, override, 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.
This function is deprecated for the MCJIT execution engine.
Implements llvm::ExecutionEngine.
Definition at line 132 of file lib/ExecutionEngine/Interpreter/Interpreter.h.
static void llvm::Interpreter::Register | ( | ) | [inline, static] |
Definition at line 118 of file lib/ExecutionEngine/Interpreter/Interpreter.h.
References create(), and llvm::ExecutionEngine::InterpCtor.
void Interpreter::run | ( | ) |
Definition at line 2113 of file Execution.cpp.
References llvm::ExecutionContext::CurInst, llvm::dbgs(), DEBUG, llvm::Type::DoubleTyID, llvm::GenericValue::DoubleVal, llvm::Type::FloatTyID, llvm::GenericValue::FloatVal, llvm::APInt::getBitWidth(), llvm::Value::getType(), llvm::Type::getTypeID(), I, llvm::Type::IntegerTyID, llvm::GenericValue::IntVal, llvm_unreachable, llvm::Type::PointerTyID, llvm::GenericValue::PointerVal, llvm::APInt::toStringUnsigned(), llvm::ExecutionContext::Values, llvm::InstVisitor< Interpreter >::visit(), and llvm::Type::VoidTyID.
Referenced by runAtExitHandlers(), and runFunction().
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 68 of file Interpreter.cpp.
References callFunction(), and run().
Referenced by exitCalled().
GenericValue Interpreter::runFunction | ( | Function * | F, |
const std::vector< GenericValue > & | ArgValues | ||
) | [override, virtual] |
run - Start execution with the specified function and arguments.
Implements llvm::ExecutionEngine.
Definition at line 79 of file Interpreter.cpp.
References callFunction(), llvm::Function::getFunctionType(), llvm::FunctionType::getNumParams(), and run().
void Interpreter::visitAllocaInst | ( | AllocaInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 961 of file Execution.cpp.
References llvm::InstVisitor< Interpreter >::Alloca, llvm::dbgs(), DEBUG, llvm::SequentialType::getElementType(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), llvm::AllocaInst::getType(), llvm::DataLayout::getTypeAllocSize(), llvm::tgtok::IntVal, llvm::LibFunc::malloc, llvm::GenericValue::PointerVal, llvm::PTOGV(), and SetValue().
void Interpreter::visitAShr | ( | BinaryOperator & | I | ) |
Definition at line 1190 of file Execution.cpp.
References llvm::GenericValue::AggregateVal, llvm::APInt::ashr(), llvm::User::getOperand(), getShiftAmount(), llvm::Value::getType(), llvm::APInt::getZExtValue(), llvm::GenericValue::IntVal, llvm::Type::isVectorTy(), and SetValue().
void Interpreter::visitBinaryOperator | ( | BinaryOperator & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 680 of file Execution.cpp.
References llvm::GenericValue::AggregateVal, llvm::APIntOps::And(), llvm::dbgs(), executeFAddInst(), executeFDivInst(), executeFMulInst(), executeFRemInst(), executeFSubInst(), FLOAT_VECTOR_OP, llvm::LibFunc::fmod, llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::Value::getType(), I, INTEGER_VECTOR_FUNCTION, INTEGER_VECTOR_OPERATION, llvm::GenericValue::IntVal, llvm::Type::isVectorTy(), llvm_unreachable, llvm::APIntOps::Or(), llvm::APInt::sdiv(), sdiv(), SetValue(), llvm::APInt::srem(), srem(), llvm::APInt::udiv(), llvm::APIntOps::udiv(), llvm::APInt::urem(), llvm::APIntOps::urem(), and llvm::APIntOps::Xor().
void Interpreter::visitBitCastInst | ( | BitCastInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 1709 of file Execution.cpp.
References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().
void Interpreter::visitBranchInst | ( | BranchInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 880 of file Execution.cpp.
References llvm::BranchInst::getCondition(), llvm::BranchInst::getSuccessor(), llvm::tgtok::IntVal, and llvm::BranchInst::isUnconditional().
void llvm::Interpreter::visitCallInst | ( | CallInst & | I | ) | [inline] |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 175 of file lib/ExecutionEngine/Interpreter/Interpreter.h.
References visitCallSite().
void Interpreter::visitCallSite | ( | CallSite | CS | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 1063 of file Execution.cpp.
References llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::arg_begin(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::arg_end(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::arg_size(), llvm::ExecutionContext::Caller, callFunction(), llvm::ExecutionContext::CurInst, F(), llvm::GenericValue::IntPair::first, llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getCalledFunction(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getCalledValue(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), llvm::Function::getIntrinsicID(), llvm::Instruction::getParent(), llvm::GVTOP(), llvm::GlobalValue::isDeclaration(), llvm::IntrinsicLowering::LowerIntrinsicCall(), llvm::Intrinsic::not_intrinsic, llvm::GenericValue::IntPair::second, SetValue(), and llvm::GenericValue::UIntPairVal.
Referenced by visitCallInst(), and visitInvokeInst().
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 1746 of file Execution.cpp.
References llvm::GenericValue::AggregateVal, llvm::dbgs(), llvm::Type::DoubleTyID, llvm::Type::FloatTyID, llvm::User::getOperand(), llvm::Value::getType(), llvm::Type::getTypeID(), llvm::Type::IntegerTyID, llvm_unreachable, and SetValue().
void Interpreter::visitExtractValueInst | ( | ExtractValueInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 1884 of file Execution.cpp.
References llvm::GenericValue::AggregateVal, llvm::Type::ArrayTyID, llvm::Type::DoubleTyID, llvm::GenericValue::DoubleVal, llvm::Type::FloatTyID, llvm::GenericValue::FloatVal, llvm::ExtractValueInst::getAggregateOperand(), llvm::ExtractValueInst::getIndexedType(), llvm::ExtractValueInst::getIndices(), llvm::ExtractValueInst::getNumIndices(), llvm::Value::getType(), llvm::Type::getTypeID(), llvm::ExtractValueInst::idx_begin(), llvm::Type::IntegerTyID, llvm::GenericValue::IntVal, llvm_unreachable, llvm::Type::PointerTyID, llvm::GenericValue::PointerVal, SetValue(), llvm::Type::StructTyID, and llvm::Type::VectorTyID.
void Interpreter::visitFCmpInst | ( | FCmpInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 609 of file Execution.cpp.
References llvm::dbgs(), executeFCMP_BOOL(), executeFCMP_OEQ(), executeFCMP_OGE(), executeFCMP_OGT(), executeFCMP_OLE(), executeFCMP_OLT(), executeFCMP_ONE(), executeFCMP_ORD(), executeFCMP_UEQ(), executeFCMP_UGE(), executeFCMP_UGT(), executeFCMP_ULE(), executeFCMP_ULT(), executeFCMP_UNE(), executeFCMP_UNO(), llvm::CmpInst::FCMP_FALSE, llvm::CmpInst::FCMP_OEQ, llvm::CmpInst::FCMP_OGE, llvm::CmpInst::FCMP_OGT, llvm::CmpInst::FCMP_OLE, llvm::CmpInst::FCMP_OLT, llvm::CmpInst::FCMP_ONE, llvm::CmpInst::FCMP_ORD, llvm::CmpInst::FCMP_TRUE, llvm::CmpInst::FCMP_UEQ, llvm::CmpInst::FCMP_UGE, llvm::CmpInst::FCMP_UGT, llvm::CmpInst::FCMP_ULE, llvm::CmpInst::FCMP_ULT, llvm::CmpInst::FCMP_UNE, llvm::CmpInst::FCMP_UNO, llvm::User::getOperand(), llvm::CmpInst::getPredicate(), llvm::Value::getType(), I, llvm_unreachable, and SetValue().
void Interpreter::visitFPExtInst | ( | FPExtInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 1674 of file Execution.cpp.
References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().
void Interpreter::visitFPToSIInst | ( | FPToSIInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 1694 of file Execution.cpp.
References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().
void Interpreter::visitFPToUIInst | ( | FPToUIInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 1689 of file Execution.cpp.
References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().
void Interpreter::visitFPTruncInst | ( | FPTruncInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 1669 of file Execution.cpp.
References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().
void Interpreter::visitGetElementPtrInst | ( | GetElementPtrInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 1032 of file Execution.cpp.
References llvm::gep_type_begin(), llvm::gep_type_end(), llvm::GetElementPtrInst::getPointerOperand(), and SetValue().
void Interpreter::visitICmpInst | ( | ICmpInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 277 of file Execution.cpp.
References llvm::dbgs(), executeICMP_EQ(), executeICMP_NE(), executeICMP_SGE(), executeICMP_SGT(), executeICMP_SLE(), executeICMP_SLT(), executeICMP_UGE(), executeICMP_UGT(), executeICMP_ULE(), executeICMP_ULT(), llvm::User::getOperand(), llvm::CmpInst::getPredicate(), llvm::Value::getType(), I, llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::ICMP_ULT, llvm_unreachable, and SetValue().
void Interpreter::visitIndirectBrInst | ( | IndirectBrInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 912 of file Execution.cpp.
References llvm::IndirectBrInst::getAddress(), and llvm::GVTOP().
void Interpreter::visitInsertElementInst | ( | InsertElementInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 1779 of file Execution.cpp.
References llvm::GenericValue::AggregateVal, llvm::Type::DoubleTyID, llvm::Type::FloatTyID, llvm::Type::getContainedType(), llvm::User::getOperand(), llvm::InsertElementInst::getType(), llvm::Type::getTypeID(), llvm::Type::IntegerTyID, llvm::Type::isVectorTy(), llvm_unreachable, and SetValue().
void Interpreter::visitInsertValueInst | ( | InsertValueInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 1926 of file Execution.cpp.
References llvm::GenericValue::AggregateVal, llvm::Type::ArrayTyID, llvm::Type::DoubleTyID, llvm::GenericValue::DoubleVal, llvm::Type::FloatTyID, llvm::GenericValue::FloatVal, llvm::InsertValueInst::getAggregateOperand(), llvm::ExtractValueInst::getIndexedType(), llvm::InsertValueInst::getIndices(), llvm::InsertValueInst::getNumIndices(), llvm::User::getOperand(), llvm::Value::getType(), llvm::Type::getTypeID(), llvm::InsertValueInst::idx_begin(), llvm::Type::IntegerTyID, llvm::GenericValue::IntVal, llvm_unreachable, llvm::Type::PointerTyID, llvm::GenericValue::PointerVal, SetValue(), llvm::Type::StructTyID, and llvm::Type::VectorTyID.
void llvm::Interpreter::visitInstruction | ( | Instruction & | I | ) | [inline] |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 191 of file lib/ExecutionEngine/Interpreter/Interpreter.h.
References llvm::errs(), and llvm_unreachable.
void Interpreter::visitIntToPtrInst | ( | IntToPtrInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 1704 of file Execution.cpp.
References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().
void llvm::Interpreter::visitInvokeInst | ( | InvokeInst & | I | ) | [inline] |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 176 of file lib/ExecutionEngine/Interpreter/Interpreter.h.
References visitCallSite().
void Interpreter::visitLoadInst | ( | LoadInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 1038 of file Execution.cpp.
References llvm::dbgs(), llvm::LoadInst::getPointerOperand(), llvm::Value::getType(), llvm::GVTOP(), I, llvm::LoadInst::isVolatile(), llvm::ExecutionEngine::LoadValueFromMemory(), PrintVolatile, and SetValue().
void Interpreter::visitLShr | ( | BinaryOperator & | I | ) |
Definition at line 1163 of file Execution.cpp.
References llvm::GenericValue::AggregateVal, llvm::User::getOperand(), getShiftAmount(), llvm::Value::getType(), llvm::APInt::getZExtValue(), llvm::GenericValue::IntVal, llvm::Type::isVectorTy(), llvm::APInt::lshr(), and SetValue().
void llvm::Interpreter::visitPHINode | ( | PHINode & | PN | ) | [inline] |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 156 of file lib/ExecutionEngine/Interpreter/Interpreter.h.
References llvm_unreachable.
void Interpreter::visitPtrToIntInst | ( | PtrToIntInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 1699 of file Execution.cpp.
References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().
void Interpreter::visitReturnInst | ( | ReturnInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 862 of file Execution.cpp.
References llvm::Value::getContext(), llvm::User::getNumOperands(), llvm::ReturnInst::getReturnValue(), llvm::Value::getType(), and llvm::Type::getVoidTy().
void Interpreter::visitSelectInst | ( | SelectInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 805 of file Execution.cpp.
References executeSelectInst(), llvm::User::getOperand(), llvm::Value::getType(), and SetValue().
void Interpreter::visitSExtInst | ( | SExtInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 1659 of file Execution.cpp.
References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().
void Interpreter::visitShl | ( | BinaryOperator & | I | ) |
Definition at line 1136 of file Execution.cpp.
References llvm::GenericValue::AggregateVal, llvm::User::getOperand(), getShiftAmount(), llvm::Value::getType(), llvm::APInt::getZExtValue(), llvm::GenericValue::IntVal, llvm::Type::isVectorTy(), SetValue(), and llvm::APInt::shl().
void Interpreter::visitShuffleVectorInst | ( | ShuffleVectorInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 1814 of file Execution.cpp.
References llvm::GenericValue::AggregateVal, llvm::Type::DoubleTyID, llvm::Type::FloatTyID, llvm::Type::getContainedType(), llvm::User::getOperand(), llvm::ShuffleVectorInst::getType(), llvm::Type::getTypeID(), llvm::Type::IntegerTyID, llvm::Type::isVectorTy(), llvm_unreachable, and SetValue().
void Interpreter::visitSIToFPInst | ( | SIToFPInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 1684 of file Execution.cpp.
References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().
void Interpreter::visitStoreInst | ( | StoreInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 1049 of file Execution.cpp.
References llvm::dbgs(), llvm::User::getOperand(), llvm::StoreInst::getPointerOperand(), llvm::Value::getType(), llvm::GVTOP(), I, llvm::StoreInst::isVolatile(), PrintVolatile, and llvm::ExecutionEngine::StoreValueToMemory().
void Interpreter::visitSwitchInst | ( | SwitchInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 893 of file Execution.cpp.
References llvm::SwitchInst::case_begin(), llvm::SwitchInst::case_end(), executeICMP_EQ(), llvm::SwitchInst::getCondition(), llvm::SwitchInst::getDefaultDest(), llvm::Value::getType(), and llvm::GenericValue::IntVal.
void Interpreter::visitTruncInst | ( | TruncInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 1654 of file Execution.cpp.
References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().
void Interpreter::visitUIToFPInst | ( | UIToFPInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 1679 of file Execution.cpp.
References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().
void Interpreter::visitUnreachableInst | ( | UnreachableInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 876 of file Execution.cpp.
References llvm::report_fatal_error().
void Interpreter::visitVAArgInst | ( | VAArgInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 1717 of file Execution.cpp.
References llvm::dbgs(), llvm::GenericValue::IntPair::first, llvm::NVPTX::PTXLdStInstCode::Float, llvm::User::getOperand(), llvm::Value::getType(), llvm::Type::getTypeID(), IMPLEMENT_VAARG, llvm::Type::IntegerTyID, llvm::GenericValue::IntVal, llvm_unreachable, llvm::GenericValue::IntPair::second, SetValue(), and llvm::GenericValue::UIntPairVal.
void Interpreter::visitZExtInst | ( | ZExtInst & | I | ) |
Reimplemented from llvm::InstVisitor< Interpreter >.
Definition at line 1664 of file Execution.cpp.
References llvm::User::getOperand(), llvm::Value::getType(), and SetValue().