LLVM API Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

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, bool isLittleEndian, bool isLongPointer, IntrinsicLowering *IL)
 ~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 visitVANextInst (VANextInst &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)
GenericValue * getFirstVarArg ()
GenericValue executeGEPOperation (Value *Ptr, gep_type_iterator I, gep_type_iterator E, ExecutionContext &SF)

Static Public Member Functions

static ExecutionEngine * create (Module *M, IntrinsicLowering *IL)

Detailed Description

Definition at line 82 of file Interpreter.h.


Constructor & Destructor Documentation

Interpreter::Interpreter (  Module *  M,
bool  isLittleEndian,
bool  isLongPointer,
IntrinsicLowering *  IL
) 
 

Definition at line 51 of file Interpreter.cpp.

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

Referenced by create().

Interpreter::~Interpreter (   ) 
 

Definition at line 66 of file Interpreter.cpp.


Member Function Documentation

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

Definition at line 167 of file Interpreter.h.

Referenced by lle_X_atexit().

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

Definition at line 85 of file ExternalFunctions.cpp.

References Functions, llvm::Type::getDescription(), llvm::Function::getFunctionType(), llvm::Value::getName(), llvm::GlobalValue::getType(), and lookupFunction().

Referenced by callFunction().

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

Definition at line 1045 of file Execution.cpp.

References llvm::Function::abegin(), llvm::Function::aend(), llvm::Function::asize(), llvm::BasicBlock::begin(), llvm::Function::begin(), callExternalFunction(), llvm::ExecutionContext::CurBB, llvm::ExecutionContext::CurFunction, llvm::ExecutionContext::CurInst, E, llvm::Function::getFunctionType(), llvm::Function::getReturnType(), llvm::Function::isExternal(), llvm::FunctionType::isVarArg(), SetValue(), and llvm::ExecutionContext::VarArgs.

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

ExecutionEngine * Interpreter::create (  Module *  M,
IntrinsicLowering *  IL
)  [static]
 

create - Create an interpreter ExecutionEngine. This can never fail. The specified IntrinsicLowering implementation will be deleted when the Interpreter execution engine is destroyed.

Definition at line 24 of file Interpreter.cpp.

References llvm::Module::AnyPointerSize, llvm::Module::BigEndian, llvm::Module::getEndianness(), llvm::Module::getPointerSize(), Interpreter(), llvm::Module::LittleEndian, llvm::Module::Pointer32, and llvm::Module::Pointer64.

Referenced by llvm::ExecutionEngine::create().

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

Definition at line 726 of file Execution.cpp.

References llvm::SequentialType::getElementType(), llvm::TargetData::getStructLayout(), llvm::Value::getType(), llvm::TargetData::getTypeSize(), llvm::ConstantUInt::getValue(), 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().

void Interpreter::exitCalled (  GenericValue  GV  ) 
 

Definition at line 545 of file Execution.cpp.

References llvm::GenericValue::IntVal, and runAtExitHandlers().

Referenced by lle_X_exit().

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

freeMachineCodeForFunction - The interpreter does not generate any code.

Implements llvm::ExecutionEngine.

Definition at line 125 of file Interpreter.h.

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

Definition at line 171 of file Interpreter.h.

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 119 of file Interpreter.h.

void Interpreter::run (   ) 
 

Definition at line 1081 of file Execution.cpp.

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

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

References AtExitHandlers, 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 80 of file Interpreter.cpp.

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

void Interpreter::visitAllocationInst (  AllocationInst &  I  ) 
 

Reimplemented from llvm::InstVisitor< Interpreter >.

Definition at line 697 of file Execution.cpp.

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

void Interpreter::visitBinaryOperator (  BinaryOperator &  I  ) 
 

Reimplemented from llvm::InstVisitor< Interpreter >.

Definition at line 496 of file Execution.cpp.

References abort(), Add(), llvm::ISD::And, executeAddInst(), executeAndInst(), executeDivInst(), executeMulInst(), executeOrInst(), executeRemInst(), executeSetEQInst(), executeSetGEInst(), executeSetGTInst(), executeSetLEInst(), executeSetLTInst(), executeSetNEInst(), executeSubInst(), executeXorInst(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::Value::getType(), Mul(), llvm::ISD::Or, R, llvm::ISD::SetEQ, llvm::ISD::SetGE, llvm::ISD::SetGT, llvm::ISD::SetLE, llvm::ISD::SetLT, llvm::ISD::SetNE, SetValue(), and llvm::ISD::Xor.

void Interpreter::visitBranchInst (  BranchInst &  I  ) 
 

Reimplemented from llvm::InstVisitor< Interpreter >.

Definition at line 624 of file Execution.cpp.

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

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

Reimplemented from llvm::InstVisitor< Interpreter >.

Definition at line 149 of file Interpreter.h.

References visitCallSite().

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::CallSite::getCalledFunction(), llvm::CallSite::getCalledValue(), llvm::CallSite::getInstruction(), llvm::Instruction::getParent(), llvm::Instruction::getPrev(), llvm::Type::getPrimitiveSize(), llvm::Value::getType(), llvm::GVTOP(), llvm::Type::isIntegral(), llvm::IntrinsicLowering::LowerIntrinsicCall(), llvm::Intrinsic::not_intrinsic, Parent, llvm::Type::SByteTy, SetValue(), llvm::Type::ShortTy, 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 Interpreter::visitCastInst (  CastInst &  I  ) 
 

Reimplemented from llvm::InstVisitor< Interpreter >.

Definition at line 986 of file Execution.cpp.

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

void Interpreter::visitFreeInst (  FreeInst &  I  ) 
 

Reimplemented from llvm::InstVisitor< Interpreter >.

Definition at line 716 of file Execution.cpp.

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

void Interpreter::visitGetElementPtrInst (  GetElementPtrInst &  I  ) 
 

Reimplemented from llvm::InstVisitor< Interpreter >.

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::visitInstruction (  Instruction &  I  )  [inline]
 

Reimplemented from llvm::InstVisitor< Interpreter >.

Definition at line 158 of file Interpreter.h.

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

Reimplemented from llvm::InstVisitor< Interpreter >.

Definition at line 150 of file Interpreter.h.

References visitCallSite().

void Interpreter::visitLoadInst (  LoadInst &  I  ) 
 

Reimplemented from llvm::InstVisitor< Interpreter >.

Definition at line 774 of file Execution.cpp.

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

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

Reimplemented from llvm::InstVisitor< Interpreter >.

Definition at line 143 of file Interpreter.h.

void Interpreter::visitReturnInst (  ReturnInst &  I  ) 
 

Definition at line 587 of file Execution.cpp.

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

void Interpreter::visitSelectInst (  SelectInst &  I  ) 
 

Reimplemented from llvm::InstVisitor< Interpreter >.

Definition at line 531 of file Execution.cpp.

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

void Interpreter::visitShl (  ShiftInst &  I  ) 
 

Definition at line 908 of file Execution.cpp.

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

void Interpreter::visitShr (  ShiftInst &  I  ) 
 

Definition at line 918 of file Execution.cpp.

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

void Interpreter::visitStoreInst (  StoreInst &  I  ) 
 

Reimplemented from llvm::InstVisitor< Interpreter >.

Definition at line 782 of file Execution.cpp.

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

void Interpreter::visitSwitchInst (  SwitchInst &  I  ) 
 

Reimplemented from llvm::InstVisitor< Interpreter >.

Definition at line 637 of file Execution.cpp.

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

void Interpreter::visitUnreachableInst (  UnreachableInst &  I  ) 
 

Reimplemented from llvm::InstVisitor< Interpreter >.

Definition at line 619 of file Execution.cpp.

References abort().

void Interpreter::visitUnwindInst (  UnwindInst &  I  ) 
 

Reimplemented from llvm::InstVisitor< Interpreter >.

Definition at line 601 of file Execution.cpp.

References abort(), and llvm::ExecutionContext::Caller.

void Interpreter::visitVAArgInst (  VAArgInst &  I  ) 
 

Reimplemented from llvm::InstVisitor< Interpreter >.

Definition at line 1006 of file Execution.cpp.

References abort(), llvm::User::getOperand(), llvm::Value::getType(), llvm::Type::getTypeID(), IMPLEMENT_VAARG, SetValue(), and llvm::GenericValue::UIntPairVal.

void Interpreter::visitVANextInst (  VANextInst &  I  ) 
 

Reimplemented from llvm::InstVisitor< Interpreter >.

Definition at line 991 of file Execution.cpp.

References llvm::User::getOperand(), SetValue(), and llvm::GenericValue::UIntPairVal.


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