LLVM
8.0.1
|
#include "Interpreter.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/IntrinsicLowering.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/GetElementPtrTypeIterator.h"
#include "llvm/IR/Instructions.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cmath>
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "interpreter" |
#define | IMPLEMENT_BINARY_OPERATOR(OP, TY) |
#define | IMPLEMENT_INTEGER_ICMP(OP, TY) |
#define | IMPLEMENT_VECTOR_INTEGER_ICMP(OP, TY) |
#define | IMPLEMENT_POINTER_ICMP(OP) |
#define | IMPLEMENT_FCMP(OP, TY) |
#define | IMPLEMENT_VECTOR_FCMP_T(OP, TY) |
#define | IMPLEMENT_VECTOR_FCMP(OP) |
#define | IMPLEMENT_SCALAR_NANS(TY, X, Y) |
#define | MASK_VECTOR_NANS_T(X, Y, TZ, FLAG) |
#define | MASK_VECTOR_NANS(TY, X, Y, FLAG) |
#define | IMPLEMENT_UNORDERED(TY, X, Y) |
#define | IMPLEMENT_VECTOR_UNORDERED(TY, X, Y, FUNC) |
#define | INTEGER_VECTOR_OPERATION(OP) |
#define | INTEGER_VECTOR_FUNCTION(OP) |
#define | FLOAT_VECTOR_FUNCTION(OP, TY) |
#define | FLOAT_VECTOR_OP(OP) |
#define | IMPLEMENT_VAARG(TY) case Type::TY##TyID: Dest.TY##Val = Src.TY##Val; break |
Variables | |
static cl::opt< bool > | PrintVolatile ("interpreter-print-volatile", cl::Hidden, cl::desc("make the interpreter print every volatile load and store")) |
#define DEBUG_TYPE "interpreter" |
Definition at line 31 of file Execution.cpp.
#define FLOAT_VECTOR_FUNCTION | ( | OP, | |
TY | |||
) |
#define FLOAT_VECTOR_OP | ( | OP | ) |
Referenced by llvm::Interpreter::visitBinaryOperator().
#define IMPLEMENT_BINARY_OPERATOR | ( | OP, | |
TY | |||
) |
Definition at line 50 of file Execution.cpp.
Referenced by executeFAddInst(), executeFDivInst(), executeFMulInst(), and executeFSubInst().
#define IMPLEMENT_FCMP | ( | OP, | |
TY | |||
) |
Definition at line 304 of file Execution.cpp.
Referenced by executeFCMP_OEQ(), executeFCMP_OGE(), executeFCMP_OGT(), executeFCMP_OLE(), executeFCMP_OLT(), and executeFCMP_ONE().
#define IMPLEMENT_INTEGER_ICMP | ( | OP, | |
TY | |||
) |
Definition at line 114 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 | ) |
Definition at line 132 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().
Definition at line 339 of file Execution.cpp.
Referenced by executeFCMP_ONE().
Definition at line 457 of file Execution.cpp.
Referenced by executeFCMP_UEQ(), executeFCMP_UGE(), executeFCMP_UGT(), executeFCMP_ULE(), executeFCMP_ULT(), and executeFCMP_UNE().
#define IMPLEMENT_VAARG | ( | TY | ) | case Type::TY##TyID: Dest.TY##Val = Src.TY##Val; break |
Definition at line 1714 of file Execution.cpp.
Referenced by llvm::Interpreter::visitVAArgInst().
#define IMPLEMENT_VECTOR_FCMP | ( | OP | ) |
Definition at line 317 of file Execution.cpp.
Referenced by executeFCMP_OEQ(), executeFCMP_OGE(), executeFCMP_OGT(), executeFCMP_OLE(), executeFCMP_OLT(), and executeFCMP_ONE().
#define IMPLEMENT_VECTOR_FCMP_T | ( | OP, | |
TY | |||
) |
Definition at line 309 of file Execution.cpp.
#define IMPLEMENT_VECTOR_INTEGER_ICMP | ( | OP, | |
TY | |||
) |
Definition at line 119 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().
Definition at line 468 of file Execution.cpp.
Referenced by executeFCMP_UEQ(), executeFCMP_UGE(), executeFCMP_UGT(), executeFCMP_ULE(), executeFCMP_ULT(), and executeFCMP_UNE().
#define INTEGER_VECTOR_FUNCTION | ( | OP | ) |
Referenced by llvm::Interpreter::visitBinaryOperator().
#define INTEGER_VECTOR_OPERATION | ( | OP | ) |
Referenced by llvm::Interpreter::visitBinaryOperator().
Definition at line 364 of file Execution.cpp.
Referenced by executeFCMP_ONE(), executeFCMP_UEQ(), executeFCMP_UGE(), executeFCMP_UGT(), executeFCMP_ULE(), executeFCMP_ULT(), and executeFCMP_UNE().
Definition at line 352 of file Execution.cpp.
|
static |
Definition at line 645 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(), 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_unreachable.
Referenced by llvm::Interpreter::visitInsertValueInst().
|
static |
Definition at line 55 of file Execution.cpp.
References llvm::dbgs(), llvm::Type::getTypeID(), IMPLEMENT_BINARY_OPERATOR, and llvm_unreachable.
Referenced by llvm::Interpreter::visitBinaryOperator(), and llvm::Interpreter::visitInsertValueInst().
|
static |
Definition at line 595 of file Execution.cpp.
References llvm::GenericValue::AggregateVal, assert(), llvm::GenericValue::IntVal, and llvm::Type::isVectorTy().
Referenced by executeCmpInst(), and llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 325 of file Execution.cpp.
References llvm::dbgs(), llvm::Type::getTypeID(), IMPLEMENT_FCMP, IMPLEMENT_VECTOR_FCMP, and llvm_unreachable.
Referenced by executeCmpInst(), executeFCMP_UEQ(), and llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 415 of file Execution.cpp.
References llvm::dbgs(), llvm::Type::getTypeID(), IMPLEMENT_FCMP, IMPLEMENT_VECTOR_FCMP, and llvm_unreachable.
Referenced by executeCmpInst(), executeFCMP_UGE(), and llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 443 of file Execution.cpp.
References llvm::dbgs(), llvm::Type::getTypeID(), IMPLEMENT_FCMP, IMPLEMENT_VECTOR_FCMP, and llvm_unreachable.
Referenced by executeCmpInst(), executeFCMP_UGT(), and llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 401 of file Execution.cpp.
References llvm::dbgs(), llvm::Type::getTypeID(), IMPLEMENT_FCMP, IMPLEMENT_VECTOR_FCMP, and llvm_unreachable.
Referenced by executeCmpInst(), executeFCMP_ULE(), and llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 429 of file Execution.cpp.
References llvm::dbgs(), llvm::Type::getTypeID(), IMPLEMENT_FCMP, IMPLEMENT_VECTOR_FCMP, and llvm_unreachable.
Referenced by executeCmpInst(), executeFCMP_ULT(), and llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 375 of file Execution.cpp.
References llvm::GenericValue::AggregateVal, llvm::dbgs(), llvm::Type::getTypeID(), IMPLEMENT_FCMP, IMPLEMENT_SCALAR_NANS, IMPLEMENT_VECTOR_FCMP, llvm::Type::isVectorTy(), llvm_unreachable, and MASK_VECTOR_NANS.
Referenced by executeCmpInst(), executeFCMP_UNE(), and llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 533 of file Execution.cpp.
References llvm::GenericValue::AggregateVal, assert(), llvm::GenericValue::DoubleVal, llvm::GenericValue::FloatVal, llvm::GenericValue::IntVal, llvm::Type::isFloatTy(), and llvm::Type::isVectorTy().
Referenced by executeCmpInst(), and llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 478 of file Execution.cpp.
References executeFCMP_OEQ(), IMPLEMENT_UNORDERED, IMPLEMENT_VECTOR_UNORDERED, and MASK_VECTOR_NANS.
Referenced by executeCmpInst(), and llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 506 of file Execution.cpp.
References executeFCMP_OGE(), IMPLEMENT_UNORDERED, IMPLEMENT_VECTOR_UNORDERED, and MASK_VECTOR_NANS.
Referenced by executeCmpInst(), and llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 524 of file Execution.cpp.
References executeFCMP_OGT(), IMPLEMENT_UNORDERED, IMPLEMENT_VECTOR_UNORDERED, and MASK_VECTOR_NANS.
Referenced by executeCmpInst(), and llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 497 of file Execution.cpp.
References executeFCMP_OLE(), IMPLEMENT_UNORDERED, IMPLEMENT_VECTOR_UNORDERED, and MASK_VECTOR_NANS.
Referenced by executeCmpInst(), and llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 515 of file Execution.cpp.
References executeFCMP_OLT(), IMPLEMENT_UNORDERED, IMPLEMENT_VECTOR_UNORDERED, and MASK_VECTOR_NANS.
Referenced by executeCmpInst(), and llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 488 of file Execution.cpp.
References executeFCMP_ONE(), IMPLEMENT_UNORDERED, IMPLEMENT_VECTOR_UNORDERED, and MASK_VECTOR_NANS.
Referenced by executeCmpInst(), and llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 564 of file Execution.cpp.
References llvm::GenericValue::AggregateVal, assert(), llvm::GenericValue::DoubleVal, llvm::GenericValue::FloatVal, llvm::GenericValue::IntVal, llvm::Type::isFloatTy(), and llvm::Type::isVectorTy().
Referenced by executeCmpInst(), and llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 88 of file Execution.cpp.
References llvm::dbgs(), llvm::Type::getTypeID(), IMPLEMENT_BINARY_OPERATOR, and llvm_unreachable.
Referenced by llvm::Interpreter::visitBinaryOperator(), and llvm::Interpreter::visitInsertValueInst().
|
static |
Definition at line 77 of file Execution.cpp.
References llvm::dbgs(), llvm::Type::getTypeID(), IMPLEMENT_BINARY_OPERATOR, and llvm_unreachable.
Referenced by llvm::Interpreter::visitBinaryOperator(), and llvm::Interpreter::visitInsertValueInst().
|
static |
Definition at line 99 of file Execution.cpp.
References llvm::dbgs(), llvm::Type::DoubleTyID, llvm::GenericValue::DoubleVal, llvm::Type::FloatTyID, llvm::GenericValue::FloatVal, llvm::Type::getTypeID(), and llvm_unreachable.
Referenced by llvm::Interpreter::visitBinaryOperator(), and llvm::Interpreter::visitInsertValueInst().
|
static |
Definition at line 66 of file Execution.cpp.
References llvm::dbgs(), llvm::Type::getTypeID(), IMPLEMENT_BINARY_OPERATOR, and llvm_unreachable.
Referenced by llvm::Interpreter::visitBinaryOperator(), and llvm::Interpreter::visitInsertValueInst().
|
static |
Definition at line 138 of file Execution.cpp.
References llvm::dbgs(), llvm::Type::getTypeID(), IMPLEMENT_INTEGER_ICMP, IMPLEMENT_POINTER_ICMP, IMPLEMENT_VECTOR_INTEGER_ICMP, and llvm_unreachable.
Referenced by executeCmpInst(), llvm::Interpreter::visitICmpInst(), and llvm::Interpreter::visitSwitchInst().
|
static |
Definition at line 152 of file Execution.cpp.
References llvm::dbgs(), llvm::Type::getTypeID(), IMPLEMENT_INTEGER_ICMP, IMPLEMENT_POINTER_ICMP, IMPLEMENT_VECTOR_INTEGER_ICMP, and llvm_unreachable.
Referenced by executeCmpInst(), and llvm::Interpreter::visitICmpInst().
|
static |
Definition at line 264 of file Execution.cpp.
References llvm::dbgs(), llvm::Type::getTypeID(), IMPLEMENT_INTEGER_ICMP, IMPLEMENT_POINTER_ICMP, IMPLEMENT_VECTOR_INTEGER_ICMP, and llvm_unreachable.
Referenced by executeCmpInst(), and llvm::Interpreter::visitICmpInst().
|
static |
Definition at line 208 of file Execution.cpp.
References llvm::dbgs(), llvm::Type::getTypeID(), IMPLEMENT_INTEGER_ICMP, IMPLEMENT_POINTER_ICMP, IMPLEMENT_VECTOR_INTEGER_ICMP, and llvm_unreachable.
Referenced by executeCmpInst(), and llvm::Interpreter::visitICmpInst().
|
static |
Definition at line 236 of file Execution.cpp.
References llvm::dbgs(), llvm::Type::getTypeID(), IMPLEMENT_INTEGER_ICMP, IMPLEMENT_POINTER_ICMP, IMPLEMENT_VECTOR_INTEGER_ICMP, and llvm_unreachable.
Referenced by executeCmpInst(), and llvm::Interpreter::visitICmpInst().
|
static |
Definition at line 180 of file Execution.cpp.
References llvm::dbgs(), llvm::Type::getTypeID(), IMPLEMENT_INTEGER_ICMP, IMPLEMENT_POINTER_ICMP, IMPLEMENT_VECTOR_INTEGER_ICMP, and llvm_unreachable.
Referenced by executeCmpInst(), and llvm::Interpreter::visitICmpInst().
|
static |
Definition at line 250 of file Execution.cpp.
References llvm::dbgs(), llvm::Type::getTypeID(), IMPLEMENT_INTEGER_ICMP, IMPLEMENT_POINTER_ICMP, IMPLEMENT_VECTOR_INTEGER_ICMP, and llvm_unreachable.
Referenced by executeCmpInst(), and llvm::Interpreter::visitICmpInst().
|
static |
Definition at line 194 of file Execution.cpp.
References llvm::dbgs(), llvm::Type::getTypeID(), IMPLEMENT_INTEGER_ICMP, IMPLEMENT_POINTER_ICMP, IMPLEMENT_VECTOR_INTEGER_ICMP, and llvm_unreachable.
Referenced by executeCmpInst(), and llvm::Interpreter::visitICmpInst().
|
static |
Definition at line 222 of file Execution.cpp.
References llvm::dbgs(), llvm::Type::getTypeID(), IMPLEMENT_INTEGER_ICMP, IMPLEMENT_POINTER_ICMP, IMPLEMENT_VECTOR_INTEGER_ICMP, and llvm_unreachable.
Referenced by executeCmpInst(), and llvm::Interpreter::visitICmpInst().
|
static |
Definition at line 166 of file Execution.cpp.
References llvm::dbgs(), llvm::Type::getTypeID(), IMPLEMENT_INTEGER_ICMP, IMPLEMENT_POINTER_ICMP, IMPLEMENT_VECTOR_INTEGER_ICMP, and llvm_unreachable.
Referenced by executeCmpInst(), and llvm::Interpreter::visitICmpInst().
|
static |
Definition at line 790 of file Execution.cpp.
References llvm::GenericValue::AggregateVal, assert(), llvm::GenericValue::IntVal, and llvm::Type::isVectorTy().
Referenced by llvm::Interpreter::visitInsertValueInst(), and llvm::Interpreter::visitSelectInst().
|
static |
Definition at line 1125 of file Execution.cpp.
References llvm::APInt::getBitWidth(), and llvm::NextPowerOf2().
Referenced by llvm::Interpreter::visitAShr(), llvm::Interpreter::visitLShr(), and llvm::Interpreter::visitShl().
|
static |
Definition at line 42 of file Execution.cpp.
References llvm::ExecutionContext::Values.
Referenced by llvm::Interpreter::callFunction(), llvm::Interpreter::exitCalled(), llvm::TGParser::getDependencies(), QualifiedNameOfImplicitName(), llvm::Interpreter::visitAllocaInst(), llvm::Interpreter::visitAShr(), llvm::Interpreter::visitBinaryOperator(), llvm::Interpreter::visitBitCastInst(), llvm::Interpreter::visitCallSite(), llvm::Interpreter::visitExtractElementInst(), llvm::Interpreter::visitExtractValueInst(), llvm::Interpreter::visitFCmpInst(), llvm::Interpreter::visitFPExtInst(), llvm::Interpreter::visitFPToSIInst(), llvm::Interpreter::visitFPToUIInst(), llvm::Interpreter::visitFPTruncInst(), llvm::Interpreter::visitGetElementPtrInst(), llvm::Interpreter::visitICmpInst(), llvm::Interpreter::visitIndirectBrInst(), llvm::Interpreter::visitInsertElementInst(), llvm::Interpreter::visitInsertValueInst(), llvm::Interpreter::visitIntToPtrInst(), llvm::Interpreter::visitLoadInst(), llvm::Interpreter::visitLShr(), llvm::Interpreter::visitPtrToIntInst(), llvm::Interpreter::visitSelectInst(), llvm::Interpreter::visitSExtInst(), llvm::Interpreter::visitShl(), llvm::Interpreter::visitShuffleVectorInst(), llvm::Interpreter::visitSIToFPInst(), llvm::Interpreter::visitTruncInst(), llvm::Interpreter::visitUIToFPInst(), llvm::Interpreter::visitVAArgInst(), and llvm::Interpreter::visitZExtInst().
STATISTIC | ( | NumDynamicInsts | , |
"Number of dynamic instructions executed" | |||
) |
|
static |
Referenced by llvm::Interpreter::visitLoadInst(), and llvm::Interpreter::visitStoreInst().