LLVM API Documentation
#include "Interpreter.h"#include "llvm/Constants.h"#include "llvm/DerivedTypes.h"#include "llvm/Instructions.h"#include "llvm/CodeGen/IntrinsicLowering.h"#include "llvm/Support/GetElementPtrTypeIterator.h"#include "llvm/ADT/APInt.h"#include "llvm/ADT/Statistic.h"#include "llvm/Support/CommandLine.h"#include "llvm/Support/Debug.h"#include "llvm/Support/MathExtras.h"#include <algorithm>#include <cmath>#include <cstring>

Go to the source code of this file.
| #define DEBUG_TYPE "interpreter" |
Definition at line 14 of file Execution.cpp.
| #define IMPLEMENT_BINARY_OPERATOR | ( | OP, | |||
| TY | ) |
Value:
Definition at line 62 of file Execution.cpp.
Referenced by executeAddInst(), executeFDivInst(), executeMulInst(), and executeSubInst().
| #define IMPLEMENT_FCMP | ( | OP, | |||
| TY | ) |
Value:
Definition at line 307 of file Execution.cpp.
Referenced by executeFCMP_OEQ(), executeFCMP_OGE(), executeFCMP_OGT(), executeFCMP_OLE(), executeFCMP_OLT(), and executeFCMP_ONE().
| #define IMPLEMENT_INTEGER_BINOP1 | ( | OP, | |||
| TY | ) |
Value:
case Type::IntegerTyID: { \ Dest.IntVal = Src1.IntVal OP Src2.IntVal; \ break; \ }
Definition at line 67 of file Execution.cpp.
Referenced by executeAddInst(), executeMulInst(), and executeSubInst().
| #define IMPLEMENT_INTEGER_ICMP | ( | OP, | |||
| TY | ) |
Value:
case Type::IntegerTyID: \ Dest.IntVal = APInt(1,Src1.IntVal.OP(Src2.IntVal)); \ break;
Definition at line 136 of file Execution.cpp.
Referenced by executeICMP_EQ(), executeICMP_NE(), executeICMP_SGE(), executeICMP_SGT(), executeICMP_SLE(), executeICMP_SLT(), executeICMP_UGE(), executeICMP_UGT(), executeICMP_ULE(), and executeICMP_ULT().
| #define IMPLEMENT_POINTER_ICMP | ( | OP | ) |
Value:
case Type::PointerTyID: \ Dest.IntVal = APInt(1,(void*)(intptr_t)Src1.PointerVal OP \ (void*)(intptr_t)Src2.PointerVal); \ break;
Definition at line 145 of file Execution.cpp.
Referenced by executeICMP_EQ(), executeICMP_NE(), executeICMP_SGE(), executeICMP_SGT(), executeICMP_SLE(), executeICMP_SLT(), executeICMP_UGE(), executeICMP_UGT(), executeICMP_ULE(), and executeICMP_ULT().
Value:
if (TY == Type::FloatTy) { \ if (X.FloatVal != X.FloatVal || Y.FloatVal != Y.FloatVal) { \ Dest.IntVal = APInt(1,true); \ return Dest; \ } \ } else if (X.DoubleVal != X.DoubleVal || Y.DoubleVal != Y.DoubleVal) { \ Dest.IntVal = APInt(1,true); \ return Dest; \ }
Definition at line 391 of file Execution.cpp.
Referenced by executeFCMP_UEQ(), executeFCMP_UGE(), executeFCMP_UGT(), executeFCMP_ULE(), executeFCMP_ULT(), and executeFCMP_UNE().
| static uint64_t doSignExtension | ( | uint64_t | Val, | |
| const IntegerType * | ITy | |||
| ) | [inline, static] |
Definition at line 41 of file Execution.cpp.
References llvm::IntegerType::getBitMask(), and llvm::IntegerType::getBitWidth().
| static void executeAddInst | ( | GenericValue & | Dest, | |
| GenericValue | Src1, | |||
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 74 of file Execution.cpp.
References llvm::cerr(), llvm::Type::getTypeID(), IMPLEMENT_BINARY_OPERATOR, and IMPLEMENT_INTEGER_BINOP1.
Referenced by llvm::Interpreter::visitBinaryOperator().
| static GenericValue executeCmpInst | ( | unsigned | predicate, | |
| GenericValue | Src1, | |||
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 501 of file Execution.cpp.
References llvm::cerr(), 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(), executeICMP_EQ(), executeICMP_NE(), executeICMP_SGE(), executeICMP_SGT(), executeICMP_SLE(), executeICMP_SLT(), executeICMP_UGE(), executeICMP_UGT(), executeICMP_ULE(), executeICMP_ULT(), 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::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, and llvm::GenericValue::IntVal.
| static GenericValue executeFCMP_OEQ | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 312 of file Execution.cpp.
References llvm::cerr(), Dest, llvm::Type::getTypeID(), and IMPLEMENT_FCMP.
Referenced by executeCmpInst(), executeFCMP_UEQ(), and llvm::Interpreter::visitFCmpInst().
| static GenericValue executeFCMP_OGE | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 352 of file Execution.cpp.
References llvm::cerr(), Dest, llvm::Type::getTypeID(), and IMPLEMENT_FCMP.
Referenced by executeCmpInst(), executeFCMP_UGE(), and llvm::Interpreter::visitFCmpInst().
| static GenericValue executeFCMP_OGT | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 378 of file Execution.cpp.
References llvm::cerr(), Dest, llvm::Type::getTypeID(), and IMPLEMENT_FCMP.
Referenced by executeCmpInst(), executeFCMP_UGT(), and llvm::Interpreter::visitFCmpInst().
| static GenericValue executeFCMP_OLE | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 339 of file Execution.cpp.
References llvm::cerr(), Dest, llvm::Type::getTypeID(), and IMPLEMENT_FCMP.
Referenced by executeCmpInst(), executeFCMP_ULE(), and llvm::Interpreter::visitFCmpInst().
| static GenericValue executeFCMP_OLT | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 365 of file Execution.cpp.
References llvm::cerr(), Dest, llvm::Type::getTypeID(), and IMPLEMENT_FCMP.
Referenced by executeCmpInst(), executeFCMP_ULT(), and llvm::Interpreter::visitFCmpInst().
| static GenericValue executeFCMP_ONE | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 325 of file Execution.cpp.
References llvm::cerr(), Dest, llvm::Type::getTypeID(), and IMPLEMENT_FCMP.
Referenced by executeCmpInst(), executeFCMP_UNE(), and llvm::Interpreter::visitFCmpInst().
| static GenericValue executeFCMP_ORD | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 445 of file Execution.cpp.
References Dest, llvm::GenericValue::DoubleVal, llvm::Type::FloatTy, llvm::GenericValue::FloatVal, and llvm::GenericValue::IntVal.
Referenced by executeCmpInst(), and llvm::Interpreter::visitFCmpInst().
| static GenericValue executeFCMP_UEQ | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 403 of file Execution.cpp.
References Dest, executeFCMP_OEQ(), and IMPLEMENT_UNORDERED.
Referenced by executeCmpInst(), and llvm::Interpreter::visitFCmpInst().
| static GenericValue executeFCMP_UGE | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 424 of file Execution.cpp.
References Dest, executeFCMP_OGE(), and IMPLEMENT_UNORDERED.
Referenced by executeCmpInst(), and llvm::Interpreter::visitFCmpInst().
| static GenericValue executeFCMP_UGT | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 438 of file Execution.cpp.
References Dest, executeFCMP_OGT(), and IMPLEMENT_UNORDERED.
Referenced by executeCmpInst(), and llvm::Interpreter::visitFCmpInst().
| static GenericValue executeFCMP_ULE | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 417 of file Execution.cpp.
References Dest, executeFCMP_OLE(), and IMPLEMENT_UNORDERED.
Referenced by executeCmpInst(), and llvm::Interpreter::visitFCmpInst().
| static GenericValue executeFCMP_ULT | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 431 of file Execution.cpp.
References Dest, executeFCMP_OLT(), and IMPLEMENT_UNORDERED.
Referenced by executeCmpInst(), and llvm::Interpreter::visitFCmpInst().
| static GenericValue executeFCMP_UNE | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 410 of file Execution.cpp.
References Dest, executeFCMP_ONE(), and IMPLEMENT_UNORDERED.
Referenced by executeCmpInst(), and llvm::Interpreter::visitFCmpInst().
| static GenericValue executeFCMP_UNO | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 457 of file Execution.cpp.
References Dest, llvm::GenericValue::DoubleVal, llvm::Type::FloatTy, llvm::GenericValue::FloatVal, and llvm::GenericValue::IntVal.
Referenced by executeCmpInst(), and llvm::Interpreter::visitFCmpInst().
| static void executeFDivInst | ( | GenericValue & | Dest, | |
| GenericValue | Src1, | |||
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 110 of file Execution.cpp.
References llvm::cerr(), llvm::Type::getTypeID(), and IMPLEMENT_BINARY_OPERATOR.
Referenced by llvm::Interpreter::visitBinaryOperator().
| static void executeFRemInst | ( | GenericValue & | Dest, | |
| GenericValue | Src1, | |||
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 121 of file Execution.cpp.
References llvm::cerr(), llvm::Type::DoubleTyID, llvm::GenericValue::DoubleVal, llvm::Type::FloatTyID, llvm::GenericValue::FloatVal, and llvm::Type::getTypeID().
Referenced by llvm::Interpreter::visitBinaryOperator().
| static GenericValue executeICMP_EQ | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 151 of file Execution.cpp.
References llvm::cerr(), Dest, llvm::Type::getTypeID(), IMPLEMENT_INTEGER_ICMP, and IMPLEMENT_POINTER_ICMP.
Referenced by executeCmpInst(), llvm::Interpreter::visitICmpInst(), and llvm::Interpreter::visitSwitchInst().
| static GenericValue executeICMP_NE | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 164 of file Execution.cpp.
References llvm::cerr(), Dest, llvm::Type::getTypeID(), IMPLEMENT_INTEGER_ICMP, and IMPLEMENT_POINTER_ICMP.
Referenced by executeCmpInst(), and llvm::Interpreter::visitICmpInst().
| static GenericValue executeICMP_SGE | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 268 of file Execution.cpp.
References llvm::cerr(), Dest, llvm::Type::getTypeID(), IMPLEMENT_INTEGER_ICMP, and IMPLEMENT_POINTER_ICMP.
Referenced by executeCmpInst(), and llvm::Interpreter::visitICmpInst().
| static GenericValue executeICMP_SGT | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 216 of file Execution.cpp.
References llvm::cerr(), Dest, llvm::Type::getTypeID(), IMPLEMENT_INTEGER_ICMP, and IMPLEMENT_POINTER_ICMP.
Referenced by executeCmpInst(), and llvm::Interpreter::visitICmpInst().
| static GenericValue executeICMP_SLE | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 242 of file Execution.cpp.
References llvm::cerr(), Dest, llvm::Type::getTypeID(), IMPLEMENT_INTEGER_ICMP, and IMPLEMENT_POINTER_ICMP.
Referenced by executeCmpInst(), and llvm::Interpreter::visitICmpInst().
| static GenericValue executeICMP_SLT | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 190 of file Execution.cpp.
References llvm::cerr(), Dest, llvm::Type::getTypeID(), IMPLEMENT_INTEGER_ICMP, and IMPLEMENT_POINTER_ICMP.
Referenced by executeCmpInst(), and llvm::Interpreter::visitICmpInst().
| static GenericValue executeICMP_UGE | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 255 of file Execution.cpp.
References llvm::cerr(), Dest, llvm::Type::getTypeID(), IMPLEMENT_INTEGER_ICMP, and IMPLEMENT_POINTER_ICMP.
Referenced by executeCmpInst(), and llvm::Interpreter::visitICmpInst().
| static GenericValue executeICMP_UGT | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 203 of file Execution.cpp.
References llvm::cerr(), Dest, llvm::Type::getTypeID(), IMPLEMENT_INTEGER_ICMP, and IMPLEMENT_POINTER_ICMP.
Referenced by executeCmpInst(), and llvm::Interpreter::visitICmpInst().
| static GenericValue executeICMP_ULE | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 229 of file Execution.cpp.
References llvm::cerr(), Dest, llvm::Type::getTypeID(), IMPLEMENT_INTEGER_ICMP, and IMPLEMENT_POINTER_ICMP.
Referenced by executeCmpInst(), and llvm::Interpreter::visitICmpInst().
| static GenericValue executeICMP_ULT | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 177 of file Execution.cpp.
References llvm::cerr(), Dest, llvm::Type::getTypeID(), IMPLEMENT_INTEGER_ICMP, and IMPLEMENT_POINTER_ICMP.
Referenced by executeCmpInst(), and llvm::Interpreter::visitICmpInst().
| static void executeMulInst | ( | GenericValue & | Dest, | |
| GenericValue | Src1, | |||
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 98 of file Execution.cpp.
References llvm::cerr(), llvm::Type::getTypeID(), IMPLEMENT_BINARY_OPERATOR, and IMPLEMENT_INTEGER_BINOP1.
Referenced by llvm::Interpreter::visitBinaryOperator().
| static GenericValue executeSelectInst | ( | GenericValue | Src1, | |
| GenericValue | Src2, | |||
| GenericValue | Src3 | |||
| ) | [static] |
Definition at line 573 of file Execution.cpp.
References llvm::GenericValue::IntVal.
Referenced by llvm::Interpreter::visitSelectInst().
| static void executeSubInst | ( | GenericValue & | Dest, | |
| GenericValue | Src1, | |||
| GenericValue | Src2, | |||
| const Type * | Ty | |||
| ) | [static] |
Definition at line 86 of file Execution.cpp.
References llvm::cerr(), llvm::Type::getTypeID(), IMPLEMENT_BINARY_OPERATOR, and IMPLEMENT_INTEGER_BINOP1.
Referenced by llvm::Interpreter::visitBinaryOperator().
| static void SetValue | ( | Value * | V, | |
| GenericValue | Val, | |||
| ExecutionContext & | SF | |||
| ) | [static] |
Definition at line 50 of file Execution.cpp.
References llvm::ExecutionContext::Values.
Referenced by llvm::Interpreter::callFunction(), llvm::Interpreter::visitAllocationInst(), llvm::Interpreter::visitAShr(), llvm::Interpreter::visitBinaryOperator(), llvm::Interpreter::visitBitCastInst(), llvm::Interpreter::visitCallSite(), llvm::Interpreter::visitFCmpInst(), llvm::Interpreter::visitFPExtInst(), llvm::Interpreter::visitFPToSIInst(), llvm::Interpreter::visitFPToUIInst(), llvm::Interpreter::visitFPTruncInst(), llvm::Interpreter::visitGetElementPtrInst(), llvm::Interpreter::visitICmpInst(), llvm::Interpreter::visitIntToPtrInst(), llvm::Interpreter::visitLoadInst(), llvm::Interpreter::visitLShr(), llvm::Interpreter::visitPtrToIntInst(), llvm::Interpreter::visitSelectInst(), llvm::Interpreter::visitSExtInst(), llvm::Interpreter::visitShl(), llvm::Interpreter::visitSIToFPInst(), llvm::Interpreter::visitTruncInst(), llvm::Interpreter::visitUIToFPInst(), llvm::Interpreter::visitVAArgInst(), and llvm::Interpreter::visitZExtInst().
| STATISTIC | ( | NumDynamicInsts | , | |
| "Number of dynamic instructions executed" | ||||
| ) |
cl::opt<bool> PrintVolatile("interpreter-print-volatile", cl::Hidden, cl::desc("make the interpreter print every volatile load and store")) [static] |
Referenced by llvm::Interpreter::visitLoadInst(), and llvm::Interpreter::visitStoreInst().
Interpreter* TheEE = 0 [static] |
Definition at line 32 of file Execution.cpp.
This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.