LLVM 20.0.0git
|
#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 30 of file Execution.cpp.
#define FLOAT_VECTOR_FUNCTION | ( | OP, | |
TY | |||
) |
#define FLOAT_VECTOR_OP | ( | OP | ) |
#define IMPLEMENT_BINARY_OPERATOR | ( | OP, | |
TY | |||
) |
Definition at line 103 of file Execution.cpp.
#define IMPLEMENT_FCMP | ( | OP, | |
TY | |||
) |
Definition at line 358 of file Execution.cpp.
#define IMPLEMENT_INTEGER_ICMP | ( | OP, | |
TY | |||
) |
Definition at line 167 of file Execution.cpp.
#define IMPLEMENT_POINTER_ICMP | ( | OP | ) |
Definition at line 186 of file Execution.cpp.
Definition at line 394 of file Execution.cpp.
Definition at line 512 of file Execution.cpp.
#define IMPLEMENT_VAARG | ( | TY | ) | case Type::TY##TyID: Dest.TY##Val = Src.TY##Val; break |
Definition at line 1726 of file Execution.cpp.
#define IMPLEMENT_VECTOR_FCMP | ( | OP | ) |
Definition at line 371 of file Execution.cpp.
#define IMPLEMENT_VECTOR_FCMP_T | ( | OP, | |
TY | |||
) |
Definition at line 363 of file Execution.cpp.
#define IMPLEMENT_VECTOR_INTEGER_ICMP | ( | OP, | |
TY | |||
) |
Definition at line 172 of file Execution.cpp.
Definition at line 523 of file Execution.cpp.
#define INTEGER_VECTOR_FUNCTION | ( | OP | ) |
#define INTEGER_VECTOR_OPERATION | ( | OP | ) |
Definition at line 407 of file Execution.cpp.
|
static |
Definition at line 108 of file Execution.cpp.
References llvm::dbgs(), Float, llvm::Type::getTypeID(), IMPLEMENT_BINARY_OPERATOR, and llvm_unreachable.
Referenced by llvm::Interpreter::visitBinaryOperator().
|
static |
Definition at line 650 of file Execution.cpp.
References llvm::GenericValue::AggregateVal, assert(), llvm::GenericValue::IntVal, and llvm::Type::isVectorTy().
Referenced by llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 380 of file Execution.cpp.
References llvm::dbgs(), Float, llvm::Type::getTypeID(), IMPLEMENT_FCMP, IMPLEMENT_VECTOR_FCMP, and llvm_unreachable.
Referenced by executeFCMP_UEQ(), and llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 470 of file Execution.cpp.
References llvm::dbgs(), Float, llvm::Type::getTypeID(), IMPLEMENT_FCMP, IMPLEMENT_VECTOR_FCMP, and llvm_unreachable.
Referenced by executeFCMP_UGE(), and llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 498 of file Execution.cpp.
References llvm::dbgs(), Float, llvm::Type::getTypeID(), IMPLEMENT_FCMP, IMPLEMENT_VECTOR_FCMP, and llvm_unreachable.
Referenced by executeFCMP_UGT(), and llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 456 of file Execution.cpp.
References llvm::dbgs(), Float, llvm::Type::getTypeID(), IMPLEMENT_FCMP, IMPLEMENT_VECTOR_FCMP, and llvm_unreachable.
Referenced by executeFCMP_ULE(), and llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 484 of file Execution.cpp.
References llvm::dbgs(), Float, llvm::Type::getTypeID(), IMPLEMENT_FCMP, IMPLEMENT_VECTOR_FCMP, and llvm_unreachable.
Referenced by executeFCMP_ULT(), and llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 430 of file Execution.cpp.
References llvm::GenericValue::AggregateVal, llvm::dbgs(), Float, llvm::Type::getTypeID(), IMPLEMENT_FCMP, IMPLEMENT_SCALAR_NANS, IMPLEMENT_VECTOR_FCMP, llvm::Type::isVectorTy(), llvm_unreachable, and MASK_VECTOR_NANS.
Referenced by executeFCMP_UNE(), and llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 588 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 llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 533 of file Execution.cpp.
References executeFCMP_OEQ(), IMPLEMENT_UNORDERED, IMPLEMENT_VECTOR_UNORDERED, and MASK_VECTOR_NANS.
Referenced by llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 561 of file Execution.cpp.
References executeFCMP_OGE(), IMPLEMENT_UNORDERED, IMPLEMENT_VECTOR_UNORDERED, and MASK_VECTOR_NANS.
Referenced by llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 579 of file Execution.cpp.
References executeFCMP_OGT(), IMPLEMENT_UNORDERED, IMPLEMENT_VECTOR_UNORDERED, and MASK_VECTOR_NANS.
Referenced by llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 552 of file Execution.cpp.
References executeFCMP_OLE(), IMPLEMENT_UNORDERED, IMPLEMENT_VECTOR_UNORDERED, and MASK_VECTOR_NANS.
Referenced by llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 570 of file Execution.cpp.
References executeFCMP_OLT(), IMPLEMENT_UNORDERED, IMPLEMENT_VECTOR_UNORDERED, and MASK_VECTOR_NANS.
Referenced by llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 543 of file Execution.cpp.
References executeFCMP_ONE(), IMPLEMENT_UNORDERED, IMPLEMENT_VECTOR_UNORDERED, and MASK_VECTOR_NANS.
Referenced by llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 619 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 llvm::Interpreter::visitFCmpInst().
|
static |
Definition at line 141 of file Execution.cpp.
References llvm::dbgs(), Float, llvm::Type::getTypeID(), IMPLEMENT_BINARY_OPERATOR, and llvm_unreachable.
Referenced by llvm::Interpreter::visitBinaryOperator().
|
static |
Definition at line 130 of file Execution.cpp.
References llvm::dbgs(), Float, llvm::Type::getTypeID(), IMPLEMENT_BINARY_OPERATOR, and llvm_unreachable.
Referenced by llvm::Interpreter::visitBinaryOperator().
|
static |
Definition at line 49 of file Execution.cpp.
References llvm::Type::DoubleTyID, llvm::GenericValue::DoubleVal, llvm::Type::FloatTyID, llvm::GenericValue::FloatVal, llvm::Type::getTypeID(), and llvm_unreachable.
Referenced by llvm::Interpreter::visitUnaryOperator().
|
static |
Definition at line 152 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().
|
static |
Definition at line 119 of file Execution.cpp.
References llvm::dbgs(), Float, llvm::Type::getTypeID(), IMPLEMENT_BINARY_OPERATOR, and llvm_unreachable.
Referenced by llvm::Interpreter::visitBinaryOperator().
|
static |
Definition at line 192 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 llvm::Interpreter::visitICmpInst(), and llvm::Interpreter::visitSwitchInst().
|
static |
Definition at line 206 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 llvm::Interpreter::visitICmpInst().
|
static |
Definition at line 318 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 llvm::Interpreter::visitICmpInst().
|
static |
Definition at line 262 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 llvm::Interpreter::visitICmpInst().
|
static |
Definition at line 290 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 llvm::Interpreter::visitICmpInst().
|
static |
Definition at line 234 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 llvm::Interpreter::visitICmpInst().
|
static |
Definition at line 304 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 llvm::Interpreter::visitICmpInst().
|
static |
Definition at line 248 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 llvm::Interpreter::visitICmpInst().
|
static |
Definition at line 276 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 llvm::Interpreter::visitICmpInst().
|
static |
Definition at line 220 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 llvm::Interpreter::visitICmpInst().
|
static |
Definition at line 809 of file Execution.cpp.
References llvm::GenericValue::AggregateVal, assert(), llvm::GenericValue::IntVal, and llvm::Type::isVectorTy().
Referenced by llvm::Interpreter::visitSelectInst().
|
static |
Definition at line 1139 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 41 of file Execution.cpp.
References llvm::ExecutionContext::Values.
Referenced by llvm::Interpreter::callFunction(), createMemSetLoop(), llvm::Interpreter::visitAllocaInst(), llvm::Interpreter::visitAShr(), llvm::Interpreter::visitBinaryOperator(), llvm::Interpreter::visitBitCastInst(), 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::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::visitUnaryOperator(), llvm::Interpreter::visitVAArgInst(), llvm::Interpreter::visitVACopyInst(), llvm::Interpreter::visitVAStartInst(), and llvm::Interpreter::visitZExtInst().
STATISTIC | ( | NumDynamicInsts | , |
"Number of dynamic instructions executed" | |||
) |
|
static |
Referenced by llvm::Interpreter::visitLoadInst(), and llvm::Interpreter::visitStoreInst().