LLVM API Documentation

Execution.cpp File Reference

#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>

Include dependency graph for Execution.cpp:

Go to the source code of this file.

Defines

#define DEBUG_TYPE   "interpreter"
#define IMPLEMENT_BINARY_OPERATOR(OP, TY)
#define IMPLEMENT_INTEGER_BINOP1(OP, TY)
#define IMPLEMENT_INTEGER_ICMP(OP, TY)
#define IMPLEMENT_POINTER_ICMP(OP)
#define IMPLEMENT_FCMP(OP, TY)
#define IMPLEMENT_UNORDERED(TY, X, Y)
#define IMPLEMENT_VAARG(TY)   case Type::TY##TyID: Dest.TY##Val = Src.TY##Val; break

Functions

 STATISTIC (NumDynamicInsts,"Number of dynamic instructions executed")
static uint64_t doSignExtension (uint64_t Val, const IntegerType *ITy)
static void SetValue (Value *V, GenericValue Val, ExecutionContext &SF)
static void executeAddInst (GenericValue &Dest, GenericValue Src1, GenericValue Src2, const Type *Ty)
static void executeSubInst (GenericValue &Dest, GenericValue Src1, GenericValue Src2, const Type *Ty)
static void executeMulInst (GenericValue &Dest, GenericValue Src1, GenericValue Src2, const Type *Ty)
static void executeFDivInst (GenericValue &Dest, GenericValue Src1, GenericValue Src2, const Type *Ty)
static void executeFRemInst (GenericValue &Dest, GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeICMP_EQ (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeICMP_NE (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeICMP_ULT (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeICMP_SLT (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeICMP_UGT (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeICMP_SGT (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeICMP_ULE (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeICMP_SLE (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeICMP_UGE (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeICMP_SGE (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeFCMP_OEQ (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeFCMP_ONE (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeFCMP_OLE (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeFCMP_OGE (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeFCMP_OLT (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeFCMP_OGT (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeFCMP_UEQ (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeFCMP_UNE (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeFCMP_ULE (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeFCMP_UGE (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeFCMP_ULT (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeFCMP_UGT (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeFCMP_ORD (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeFCMP_UNO (GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeCmpInst (unsigned predicate, GenericValue Src1, GenericValue Src2, const Type *Ty)
static GenericValue executeSelectInst (GenericValue Src1, GenericValue Src2, GenericValue Src3)

Variables

static InterpreterTheEE = 0
static cl::opt< bool > PrintVolatile ("interpreter-print-volatile", cl::Hidden, cl::desc("make the interpreter print every volatile load and store"))


Define Documentation

#define DEBUG_TYPE   "interpreter"

Definition at line 14 of file Execution.cpp.

#define IMPLEMENT_BINARY_OPERATOR ( OP,
TY   ) 

Value:

case Type::TY##TyID: \
     Dest.TY##Val = Src1.TY##Val OP Src2.TY##Val; \
     break

Definition at line 62 of file Execution.cpp.

Referenced by executeAddInst(), executeFDivInst(), executeMulInst(), and executeSubInst().

#define IMPLEMENT_FCMP ( OP,
TY   ) 

Value:

case Type::TY##TyID: \
     Dest.IntVal = APInt(1,Src1.TY##Val OP Src2.TY##Val); \
     break

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().

#define IMPLEMENT_UNORDERED ( TY,
X,
Y   ) 

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().

#define IMPLEMENT_VAARG ( TY   )     case Type::TY##TyID: Dest.TY##Val = Src.TY##Val; break

Definition at line 1168 of file Execution.cpp.

Referenced by llvm::Interpreter::visitVAArgInst().


Function Documentation

static uint64_t doSignExtension ( uint64_t  Val,
const IntegerType ITy 
) [inline, static]

static void executeAddInst ( GenericValue Dest,
GenericValue  Src1,
GenericValue  Src2,
const Type Ty 
) [static]

static GenericValue executeCmpInst ( unsigned  predicate,
GenericValue  Src1,
GenericValue  Src2,
const Type Ty 
) [static]

static GenericValue executeFCMP_OEQ ( GenericValue  Src1,
GenericValue  Src2,
const Type Ty 
) [static]

static GenericValue executeFCMP_OGE ( GenericValue  Src1,
GenericValue  Src2,
const Type Ty 
) [static]

static GenericValue executeFCMP_OGT ( GenericValue  Src1,
GenericValue  Src2,
const Type Ty 
) [static]

static GenericValue executeFCMP_OLE ( GenericValue  Src1,
GenericValue  Src2,
const Type Ty 
) [static]

static GenericValue executeFCMP_OLT ( GenericValue  Src1,
GenericValue  Src2,
const Type Ty 
) [static]

static GenericValue executeFCMP_ONE ( GenericValue  Src1,
GenericValue  Src2,
const Type Ty 
) [static]

static GenericValue executeFCMP_ORD ( GenericValue  Src1,
GenericValue  Src2,
const Type Ty 
) [static]

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]

static void executeFDivInst ( GenericValue Dest,
GenericValue  Src1,
GenericValue  Src2,
const Type Ty 
) [static]

static void executeFRemInst ( GenericValue Dest,
GenericValue  Src1,
GenericValue  Src2,
const Type Ty 
) [static]

static GenericValue executeICMP_EQ ( GenericValue  Src1,
GenericValue  Src2,
const Type Ty 
) [static]

static GenericValue executeICMP_NE ( GenericValue  Src1,
GenericValue  Src2,
const Type Ty 
) [static]

static GenericValue executeICMP_SGE ( GenericValue  Src1,
GenericValue  Src2,
const Type Ty 
) [static]

static GenericValue executeICMP_SGT ( GenericValue  Src1,
GenericValue  Src2,
const Type Ty 
) [static]

static GenericValue executeICMP_SLE ( GenericValue  Src1,
GenericValue  Src2,
const Type Ty 
) [static]

static GenericValue executeICMP_SLT ( GenericValue  Src1,
GenericValue  Src2,
const Type Ty 
) [static]

static GenericValue executeICMP_UGE ( GenericValue  Src1,
GenericValue  Src2,
const Type Ty 
) [static]

static GenericValue executeICMP_UGT ( GenericValue  Src1,
GenericValue  Src2,
const Type Ty 
) [static]

static GenericValue executeICMP_ULE ( GenericValue  Src1,
GenericValue  Src2,
const Type Ty 
) [static]

static GenericValue executeICMP_ULT ( GenericValue  Src1,
GenericValue  Src2,
const Type Ty 
) [static]

static void executeMulInst ( GenericValue Dest,
GenericValue  Src1,
GenericValue  Src2,
const Type Ty 
) [static]

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]

static void SetValue ( Value V,
GenericValue  Val,
ExecutionContext SF 
) [static]

STATISTIC ( NumDynamicInsts  ,
"Number of dynamic instructions executed"   
)


Variable Documentation

cl::opt<bool> PrintVolatile("interpreter-print-volatile", cl::Hidden, cl::desc("make the interpreter print every volatile load and store")) [static]

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.