LLVM  14.0.0git
Classes | 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...
 
DenseMap< GlobalVariable *, Constant * > getMutatedInitializers () 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 83 of file Evaluator.h.

References DL.

◆ ~Evaluator()

llvm::Evaluator::~Evaluator ( )
inline

Definition at line 88 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 643 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 110 of file Evaluator.h.

Referenced by EvaluateStaticConstructor().

◆ getMutatedInitializers()

DenseMap<GlobalVariable *, Constant *> llvm::Evaluator::getMutatedInitializers ( ) const
inline

Definition at line 103 of file Evaluator.h.

Referenced by EvaluateStaticConstructor().


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