LLVM API Documentation

llvm::Interpreter Class Reference

#include <Interpreter.h>

Inheritance diagram for llvm::Interpreter:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Interpreter (Module *M)
 ~Interpreter ()
void runAtExitHandlers ()
virtual GenericValue runFunction (Function *F, const std::vector< GenericValue > &ArgValues)
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 visitBinaryOperator (BinaryOperator &I)
void visitAllocationInst (AllocationInst &I)
void visitFreeInst (FreeInst &I)
void visitLoadInst (LoadInst &I)
void visitStoreInst (StoreInst &I)
void visitGetElementPtrInst (GetElementPtrInst &I)
void visitPHINode (PHINode &PN)
void visitCastInst (CastInst &I)
void visitSelectInst (SelectInst &I)
void visitCallSite (CallSite CS)
void visitCallInst (CallInst &I)
void visitInvokeInst (InvokeInst &I)
void visitUnwindInst (UnwindInst &I)
void visitUnreachableInst (UnreachableInst &I)
void visitShl (ShiftInst &I)
void visitShr (ShiftInst &I)
void visitVAArgInst (VAArgInst &I)
void visitInstruction (Instruction &I)
GenericValue callExternalFunction (Function *F, const std::vector< GenericValue > &ArgVals)
void exitCalled (GenericValue GV)
void addAtExitHandler (Function *F)
GenericValuegetFirstVarArg ()
GenericValue executeGEPOperation (Value *Ptr, gep_type_iterator I, gep_type_iterator E, ExecutionContext &SF)

Static Public Member Functions

static void Register ()
static ExecutionEnginecreate (ModuleProvider *M)

Detailed Description

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


Constructor & Destructor Documentation

Interpreter::Interpreter ( Module M  ) 

Definition at line 61 of file Interpreter.cpp.

References llvm::ExecutionEngine::emitGlobals(), and llvm::ExecutionEngine::setTargetData().

Referenced by create().

Interpreter::~Interpreter (  ) 

Definition at line 73 of file Interpreter.cpp.


Member Function Documentation

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 77 of file Interpreter.cpp.

References callFunction(), and run().

Referenced by exitCalled().

static void llvm::Interpreter::Register (  )  [inline, static]

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

References create(), and llvm::ExecutionEngine::InterpCtor.

ExecutionEngine * Interpreter::create ( ModuleProvider M  )  [static]

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

Definition at line 34 of file Interpreter.cpp.

References llvm::Module::AnyEndianness, llvm::Module::AnyPointerSize, llvm::Module::BigEndian, llvm::Module::getEndianness(), llvm::Module::getPointerSize(), Interpreter(), llvm::Module::LittleEndian, M, llvm::ModuleProvider::materializeModule(), llvm::ExecutionEngine::MP, llvm::Module::Pointer32, llvm::Module::Pointer64, llvm::Module::setEndianness(), and llvm::Module::setPointerSize().

Referenced by Register().

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 88 of file Interpreter.cpp.

References callFunction(), F, and run().

virtual void* llvm::Interpreter::recompileAndRelinkFunction ( Function F  )  [inline, virtual]

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

Implements llvm::ExecutionEngine.

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

References F.

void llvm::Interpreter::freeMachineCodeForFunction ( Function F  )  [inline, virtual]

freeMachineCodeForFunction - The interpreter does not generate any code.

Implements llvm::ExecutionEngine.

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

void Interpreter::callFunction ( Function F,
const std::vector< GenericValue > &  ArgVals 
)

Definition at line 1036 of file Execution.cpp.

References AI, llvm::BasicBlock::begin(), callExternalFunction(), llvm::ExecutionContext::CurBB, llvm::ExecutionContext::CurFunction, llvm::ExecutionContext::CurInst, E, F, SetValue(), and llvm::ExecutionContext::VarArgs.

Referenced by runAtExitHandlers(), runFunction(), and visitCallSite().

void Interpreter::run (  ) 

Definition at line 1072 of file Execution.cpp.

References llvm::ExecutionContext::CurInst, DEBUG, NumDynamicInsts, and llvm::InstVisitor< SubClass, RetTy >::visit().

Referenced by runAtExitHandlers(), and runFunction().

void Interpreter::visitReturnInst ( ReturnInst I  ) 

Definition at line 587 of file Execution.cpp.

References llvm::User::getNumOperands(), llvm::ReturnInst::getReturnValue(), llvm::Value::getType(), RetTy, and llvm::Type::VoidTy.

void Interpreter::visitBranchInst ( BranchInst I  ) 

Reimplemented from llvm::InstVisitor< SubClass, RetTy >.

Definition at line 624 of file Execution.cpp.

References Dest, llvm::BranchInst::getCondition(), llvm::BranchInst::getSuccessor(), and llvm::BranchInst::isUnconditional().

void Interpreter::visitSwitchInst ( SwitchInst I  ) 

Reimplemented from llvm::InstVisitor< SubClass, RetTy >.

Definition at line 637 of file Execution.cpp.

References llvm::GenericValue::BoolVal, Dest, executeSetEQInst(), llvm::SwitchInst::getDefaultDest(), llvm::User::getNumOperands(), llvm::User::getOperand(), and llvm::Value::getType().

void Interpreter::visitBinaryOperator ( BinaryOperator I  ) 

Reimplemented from llvm::InstVisitor< SubClass, RetTy >.

Definition at line 496 of file Execution.cpp.

References executeAddInst(), executeAndInst(), executeDivInst(), executeMulInst(), executeOrInst(), executeRemInst(), executeSetEQInst(), executeSetGEInst(), executeSetGTInst(), executeSetLEInst(), executeSetLTInst(), executeSetNEInst(), executeSubInst(), executeXorInst(), llvm::BinaryOperator::getOpcode(), llvm::BinaryOperator::getOperand(), llvm::Value::getType(), R, SetValue(), and Ty.

void Interpreter::visitAllocationInst ( AllocationInst I  ) 

Reimplemented from llvm::InstVisitor< SubClass, RetTy >.

Definition at line 697 of file Execution.cpp.

References llvm::Instruction::Alloca, llvm::SequentialType::getElementType(), llvm::Instruction::getOpcode(), llvm::UnaryInstruction::getOperand(), llvm::AllocationInst::getType(), llvm::TargetData::getTypeSize(), llvm::PTOGV(), SetValue(), and Ty.

void Interpreter::visitFreeInst ( FreeInst I  ) 

Reimplemented from llvm::InstVisitor< SubClass, RetTy >.

Definition at line 716 of file Execution.cpp.

References llvm::UnaryInstruction::getOperand(), llvm::Value::getType(), and llvm::GVTOP().

void Interpreter::visitLoadInst ( LoadInst I  ) 

Reimplemented from llvm::InstVisitor< SubClass, RetTy >.

Definition at line 774 of file Execution.cpp.

References llvm::LoadInst::getPointerOperand(), llvm::Value::getType(), llvm::GVTOP(), llvm::ExecutionEngine::LoadValueFromMemory(), and SetValue().

void Interpreter::visitStoreInst ( StoreInst I  ) 

Reimplemented from llvm::InstVisitor< SubClass, RetTy >.

Definition at line 782 of file Execution.cpp.

References llvm::StoreInst::getOperand(), llvm::StoreInst::getPointerOperand(), llvm::Value::getType(), llvm::GVTOP(), llvm::ExecutionEngine::StoreValueToMemory(), and Val.

void Interpreter::visitGetElementPtrInst ( GetElementPtrInst I  ) 

Reimplemented from llvm::InstVisitor< SubClass, RetTy >.

Definition at line 768 of file Execution.cpp.

References executeGEPOperation(), llvm::gep_type_begin(), llvm::gep_type_end(), llvm::GetElementPtrInst::getPointerOperand(), SetValue(), and TheEE.

void llvm::Interpreter::visitPHINode ( PHINode PN  )  [inline]

Reimplemented from llvm::InstVisitor< SubClass, RetTy >.

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

void Interpreter::visitCastInst ( CastInst I  ) 

Reimplemented from llvm::InstVisitor< SubClass, RetTy >.

Definition at line 986 of file Execution.cpp.

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

void Interpreter::visitSelectInst ( SelectInst I  ) 

Reimplemented from llvm::InstVisitor< SubClass, RetTy >.

Definition at line 531 of file Execution.cpp.

References executeSelectInst(), llvm::SelectInst::getOperand(), R, and SetValue().

void Interpreter::visitCallSite ( CallSite  CS  ) 

Definition at line 794 of file Execution.cpp.

References llvm::CallSite::arg_begin(), llvm::CallSite::arg_end(), llvm::CallSite::arg_size(), llvm::BasicBlock::begin(), llvm::Type::BoolTy, llvm::ExecutionContext::Caller, callFunction(), llvm::ExecutionContext::CurInst, F, llvm::GenericValue::first, llvm::CallSite::getCalledFunction(), llvm::CallSite::getCalledValue(), llvm::CallSite::getInstruction(), llvm::Instruction::getParent(), llvm::Instruction::getPrev(), llvm::Type::getPrimitiveSize(), llvm::GVTOP(), llvm::Type::isIntegral(), llvm::IntrinsicLowering::LowerIntrinsicCall(), llvm::Intrinsic::not_intrinsic, Prev, llvm::Type::SByteTy, llvm::GenericValue::second, SetValue(), llvm::Type::ShortTy, Ty, llvm::Type::UByteTy, llvm::GenericValue::UIntPairVal, llvm::Type::UShortTy, llvm::Intrinsic::vacopy, llvm::Intrinsic::vaend, and llvm::Intrinsic::vastart.

Referenced by visitCallInst(), and visitInvokeInst().

void llvm::Interpreter::visitCallInst ( CallInst I  )  [inline]

Reimplemented from llvm::InstVisitor< SubClass, RetTy >.

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

References visitCallSite().

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

Reimplemented from llvm::InstVisitor< SubClass, RetTy >.

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

References visitCallSite().

void Interpreter::visitUnwindInst ( UnwindInst I  ) 

Reimplemented from llvm::InstVisitor< SubClass, RetTy >.

Definition at line 601 of file Execution.cpp.

References llvm::ExecutionContext::Caller, and Inst.

void Interpreter::visitUnreachableInst ( UnreachableInst I  ) 

Reimplemented from llvm::InstVisitor< SubClass, RetTy >.

Definition at line 619 of file Execution.cpp.

void Interpreter::visitShl ( ShiftInst I  ) 

Definition at line 908 of file Execution.cpp.

References Dest, executeShlInst(), llvm::ShiftInst::getOperand(), llvm::Value::getType(), SetValue(), and Ty.

void Interpreter::visitShr ( ShiftInst I  ) 

Definition at line 918 of file Execution.cpp.

References Dest, executeShrInst(), llvm::ShiftInst::getOperand(), llvm::Value::getType(), SetValue(), and Ty.

void Interpreter::visitVAArgInst ( VAArgInst I  ) 

Reimplemented from llvm::InstVisitor< SubClass, RetTy >.

Definition at line 994 of file Execution.cpp.

References Dest, llvm::GenericValue::first, llvm::UnaryInstruction::getOperand(), llvm::Value::getType(), llvm::Type::getTypeID(), IMPLEMENT_VAARG, llvm::GenericValue::second, SetValue(), Src, Ty, and llvm::GenericValue::UIntPairVal.

void llvm::Interpreter::visitInstruction ( Instruction I  )  [inline]

Reimplemented from llvm::InstVisitor< SubClass, RetTy >.

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

GenericValue Interpreter::callExternalFunction ( Function F,
const std::vector< GenericValue > &  ArgVals 
)

Definition at line 86 of file ExternalFunctions.cpp.

References F, Functions, lookupFunction(), and TheInterpreter.

Referenced by callFunction().

void Interpreter::exitCalled ( GenericValue  GV  ) 

Definition at line 545 of file Execution.cpp.

References GV, and runAtExitHandlers().

Referenced by lle_X_exit().

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

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

References F.

Referenced by lle_X_atexit().

GenericValue* llvm::Interpreter::getFirstVarArg (  )  [inline]

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

GenericValue Interpreter::executeGEPOperation ( Value Ptr,
gep_type_iterator  I,
gep_type_iterator  E,
ExecutionContext SF 
)

Definition at line 726 of file Execution.cpp.

References E, llvm::SequentialType::getElementType(), llvm::TargetData::getStructLayout(), llvm::Value::getType(), llvm::TargetData::getTypeSize(), llvm::ConstantUInt::getValue(), Idx, llvm::Type::IntTyID, llvm::GenericValue::IntVal, llvm::Type::LongTyID, llvm::GenericValue::LongVal, llvm::StructLayout::MemberOffsets, llvm::GenericValue::PointerVal, llvm::Type::SByteTyID, llvm::GenericValue::SByteVal, llvm::Type::ShortTyID, llvm::GenericValue::ShortVal, llvm::Type::UByteTyID, llvm::GenericValue::UByteVal, llvm::Type::UIntTyID, llvm::GenericValue::UIntVal, llvm::Type::ULongTyID, llvm::GenericValue::ULongVal, llvm::Type::UShortTyID, and llvm::GenericValue::UShortVal.

Referenced by visitGetElementPtrInst().


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