14 #ifndef LLVM_TRANSFORMS_UTILS_EVALUATOR_H 15 #define LLVM_TRANSFORMS_UTILS_EVALUATOR_H 33 class TargetLibraryInfo;
43 ValueStack.emplace_back();
47 for (
auto &Tmp : AllocaTmps)
51 if (!Tmp->use_empty())
67 if (
Constant *CV = dyn_cast<Constant>(V))
return CV;
68 Constant *R = ValueStack.back().lookup(V);
69 assert(R &&
"Reference to an uncomputed value!");
74 ValueStack.back()[V] =
C;
103 std::deque<DenseMap<Value*, Constant*>> ValueStack;
133 #endif // LLVM_TRANSFORMS_UTILS_EVALUATOR_H
A parsed version of the target data layout string in and methods for querying it. ...
This class represents lattice values for constants.
bool EvaluateBlock(BasicBlock::iterator CurInst, BasicBlock *&NextBB)
Evaluate all instructions in block BB, returning true if successful, false if we can't evaluate it...
bool getFormalParams(CallSite &CS, Function *F, SmallVector< Constant *, 8 > &Formals)
Given call site and callee returns list of callee formal argument values converting them when necessa...
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...
static Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
LLVM Basic Block Representation.
This is an important base class in LLVM.
void setVal(Value *V, Constant *C)
This class evaluates LLVM IR, producing the Constant representing each SSA instruction.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
Constant * getVal(Value *V)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Provides information about what library functions are available for the current target.
InstListType::iterator iterator
Instruction iterators...
const SmallPtrSetImpl< GlobalVariable * > & getInvariants() const
Function * getCalleeWithFormalArgs(CallSite &CS, SmallVector< Constant *, 8 > &Formals)
Given call site return callee and list of its formal arguments.
Constant * castCallResultIfNeeded(Value *CallExpr, Constant *RV)
Casts call result to a type of bitcast call expression.
const DenseMap< Constant *, Constant * > & getMutatedMemory() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
Evaluator(const DataLayout &DL, const TargetLibraryInfo *TLI)