|
LLVM
4.0.0
|
This class evaluates LLVM IR, producing the Constant representing each SSA instruction. More...
#include <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... | |
| bool | EvaluateBlock (BasicBlock::iterator CurInst, BasicBlock *&NextBB) |
| Evaluate all instructions in block BB, returning true if successful, false if we can't evaluate it. More... | |
| Constant * | getVal (Value *V) |
| void | setVal (Value *V, Constant *C) |
| const DenseMap< Constant *, Constant * > & | getMutatedMemory () const |
| const SmallPtrSetImpl < GlobalVariable * > & | getInvariants () const |
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 37 of file Evaluator.h.
|
inline |
Definition at line 39 of file Evaluator.h.
|
inline |
Definition at line 44 of file Evaluator.h.
References llvm::Constant::getNullValue().
| bool Evaluator::EvaluateBlock | ( | BasicBlock::iterator | CurInst, |
| BasicBlock *& | NextBB | ||
| ) |
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.
Definition at line 192 of file Evaluator.cpp.
References llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::arg_begin(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::arg_end(), C, llvm::Type::canLosslesslyBitCastTo(), llvm::ConstantFoldCall(), llvm::ConstantFoldConstant(), llvm::dbgs(), DEBUG, llvm::dyn_cast(), EvaluateFunction(), GEP, llvm::IntegerType::get(), llvm::ConstantInt::get(), llvm::ConstantExpr::get(), llvm::UndefValue::get(), llvm::ConstantExpr::getBitCast(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getCalledValue(), llvm::ConstantExpr::getCast(), llvm::ConstantExpr::getCompare(), llvm::Type::getContext(), llvm::ConstantExpr::getExtractValue(), llvm::Function::getFunctionType(), llvm::ConstantExpr::getGetElementPtr(), llvm::ConstantExpr::getInsertValue(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), llvm::APInt::getLimitedValue(), llvm::Value::getName(), llvm::ConstantExpr::getSelect(), llvm::Value::getType(), llvm::DataLayout::getTypeStoreSize(), getVal(), llvm::ConstantInt::getValue(), llvm::GlobalValue::getValueType(), llvm::ConstantInt::getZExtValue(), i, llvm::GlobalValue::InternalLinkage, llvm::Constant::isAllOnesValue(), llvm::GlobalValue::isDeclaration(), llvm::GlobalValue::isInterposable(), isSimpleEnoughPointerToCommit(), isSimpleEnoughValueToCommit(), llvm::FunctionType::isVarArg(), P, Ptr, llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), setVal(), and SI.
Referenced by 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 536 of file Evaluator.cpp.
References llvm::Function::arg_begin(), llvm::Function::arg_end(), llvm::BasicBlock::begin(), llvm::dbgs(), DEBUG, llvm::dyn_cast(), E, EvaluateBlock(), llvm::Function::front(), llvm::PHINode::getIncomingValueForBlock(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::BasicBlock::getTerminator(), getVal(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::is_contained(), and setVal().
Referenced by EvaluateBlock(), and EvaluateStaticConstructor().
|
inline |
Definition at line 79 of file Evaluator.h.
Referenced by EvaluateStaticConstructor().
Definition at line 75 of file Evaluator.h.
Referenced by EvaluateStaticConstructor().
Definition at line 64 of file Evaluator.h.
References assert().
Referenced by EvaluateBlock(), and EvaluateFunction().
Definition at line 71 of file Evaluator.h.
References C.
Referenced by EvaluateBlock(), and EvaluateFunction().
1.8.6