class Evaluator

Declaration

class Evaluator { /* full declaration omitted */ };

Description

This class evaluates LLVM IR, producing the Constant representing each SSA instruction. Changes to global variables are stored in a mapping that can be iterated over after the evaluation is complete. Once an evaluation call fails, the evaluation object should not be reused.

Declared at: llvm/include/llvm/Transforms/Utils/Evaluator.h:38

Method Overview

  • public bool EvaluateBlock(BasicBlock::iterator CurInst, llvm::BasicBlock *& NextBB)
  • public bool EvaluateFunction(llvm::Function * F, llvm::Constant *& RetVal, const SmallVectorImpl<llvm::Constant *> & ActualArgs)
  • public Evaluator(const llvm::DataLayout & DL, const llvm::TargetLibraryInfo * TLI)
  • public llvm::Constant * castCallResultIfNeeded(llvm::Value * CallExpr, llvm::Constant * RV)
  • public llvm::Function * getCalleeWithFormalArgs(llvm::CallSite & CS, SmallVector<llvm::Constant *, 8> & Formals)
  • public bool getFormalParams(llvm::CallSite & CS, llvm::Function * F, SmallVector<llvm::Constant *, 8> & Formals)
  • public const SmallPtrSetImpl<llvm::GlobalVariable *> & getInvariants() const
  • public const DenseMap<llvm::Constant *, llvm::Constant *> & getMutatedMemory() const
  • public llvm::Constant * getVal(llvm::Value * V)
  • public void setVal(llvm::Value * V, llvm::Constant * C)
  • public ~Evaluator()

Methods

bool EvaluateBlock(BasicBlock::iterator CurInst,
                   llvm::BasicBlock*& NextBB)

Description

Evaluate all instructions in block BB, returning true if successful, false if we can't evaluate it. NewBB returns the next BB that control flows into, or null upon return.

Declared at: llvm/include/llvm/Transforms/Utils/Evaluator.h:63

Parameters

BasicBlock::iterator CurInst
llvm::BasicBlock*& NextBB

bool EvaluateFunction(
    llvm::Function* F,
    llvm::Constant*& RetVal,
    const SmallVectorImpl<llvm::Constant*>&
        ActualArgs)

Description

Evaluate a call to function F, returning true if successful, false if we can't evaluate it. ActualArgs contains the formal arguments for the function.

Declared at: llvm/include/llvm/Transforms/Utils/Evaluator.h:57

Parameters

llvm::Function* F
llvm::Constant*& RetVal
const SmallVectorImpl<llvm::Constant*>& ActualArgs

Evaluator(const llvm::DataLayout& DL,
          const llvm::TargetLibraryInfo* TLI)

Declared at: llvm/include/llvm/Transforms/Utils/Evaluator.h:40

Parameters

const llvm::DataLayout& DL
const llvm::TargetLibraryInfo* TLI

llvm::Constant* castCallResultIfNeeded(
    llvm::Value* CallExpr,
    llvm::Constant* RV)

Description

Casts call result to a type of bitcast call expression

Declared at: llvm/include/llvm/Transforms/Utils/Evaluator.h:86

Parameters

llvm::Value* CallExpr
llvm::Constant* RV

llvm::Function* getCalleeWithFormalArgs(
    llvm::CallSite& CS,
    SmallVector<llvm::Constant*, 8>& Formals)

Description

Given call site return callee and list of its formal arguments

Declared at: llvm/include/llvm/Transforms/Utils/Evaluator.h:77

Parameters

llvm::CallSite& CS
SmallVector<llvm::Constant*, 8>& Formals

bool getFormalParams(
    llvm::CallSite& CS,
    llvm::Function* F,
    SmallVector<llvm::Constant*, 8>& Formals)

Description

Given call site and callee returns list of callee formal argument values converting them when necessary

Declared at: llvm/include/llvm/Transforms/Utils/Evaluator.h:82

Parameters

llvm::CallSite& CS
llvm::Function* F
SmallVector<llvm::Constant*, 8>& Formals

const SmallPtrSetImpl<llvm::GlobalVariable*>&
getInvariants() const

Declared at: llvm/include/llvm/Transforms/Utils/Evaluator.h:92

const DenseMap<llvm::Constant*, llvm::Constant*>&
getMutatedMemory() const

Declared at: llvm/include/llvm/Transforms/Utils/Evaluator.h:88

llvm::Constant* getVal(llvm::Value* V)

Declared at: llvm/include/llvm/Transforms/Utils/Evaluator.h:65

Parameters

llvm::Value* V

void setVal(llvm::Value* V, llvm::Constant* C)

Declared at: llvm/include/llvm/Transforms/Utils/Evaluator.h:72

Parameters

llvm::Value* V
llvm::Constant* C

~Evaluator()

Declared at: llvm/include/llvm/Transforms/Utils/Evaluator.h:45