13 #ifndef LLVM_TRANSFORMS_UTILS_EVALUATOR_H 14 #define LLVM_TRANSFORMS_UTILS_EVALUATOR_H 32 class TargetLibraryInfo;
42 ValueStack.emplace_back();
46 for (
auto &Tmp : AllocaTmps)
50 if (!Tmp->use_empty())
66 if (
Constant *CV = dyn_cast<Constant>(V))
return CV;
67 Constant *R = ValueStack.back().lookup(V);
68 assert(R &&
"Reference to an uncomputed value!");
73 ValueStack.back()[V] =
C;
102 std::deque<DenseMap<Value*, Constant*>> ValueStack;
132 #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.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
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.
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.
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
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)
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL