LLVM  13.0.0git
Public Member Functions | List of all members
llvm::Evaluator Class Reference

This class evaluates LLVM IR, producing the Constant representing each SSA instruction. More...

#include "llvm/Transforms/Utils/Evaluator.h"

Public Member Functions

 Evaluator (const DataLayout &DL, const TargetLibraryInfo *TLI)
 
 ~Evaluator ()
 
bool EvaluateFunction (Function *F, Constant *&RetVal, const SmallVectorImpl< Constant * > &ActualArgs)
 Evaluate a call to function F, returning true if successful, false if we can't evaluate it. More...
 
const DenseMap< Constant *, Constant * > & getMutatedMemory () const
 
const SmallPtrSetImpl< GlobalVariable * > & getInvariants () const
 

Detailed 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.

Definition at line 38 of file Evaluator.h.

Constructor & Destructor Documentation

◆ Evaluator()

llvm::Evaluator::Evaluator ( const DataLayout DL,
const TargetLibraryInfo TLI 
)
inline

Definition at line 40 of file Evaluator.h.

References DL.

◆ ~Evaluator()

llvm::Evaluator::~Evaluator ( )
inline

Definition at line 45 of file Evaluator.h.

References llvm::Constant::getNullValue().

Member Function Documentation

◆ EvaluateFunction()

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

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.

Definition at line 689 of file Evaluator.cpp.

References llvm::BasicBlock::begin(), llvm::dbgs(), E, F, llvm::PHINode::getIncomingValueForBlock(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::ReturnInst::getReturnValue(), llvm::BasicBlock::getTerminator(), llvm::Value::getType(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::is_contained(), llvm::Type::isVoidTy(), and LLVM_DEBUG.

Referenced by EvaluateStaticConstructor().

◆ getInvariants()

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

Definition at line 64 of file Evaluator.h.

Referenced by EvaluateStaticConstructor().

◆ getMutatedMemory()

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

Definition at line 60 of file Evaluator.h.

Referenced by EvaluateStaticConstructor().


The documentation for this class was generated from the following files: