13#ifndef LLVM_TRANSFORMS_UTILS_EVALUATOR_H
14#define LLVM_TRANSFORMS_UTILS_EVALUATOR_H
38 struct MutableAggregate;
50 MutableValue(
const MutableValue &) =
delete;
51 MutableValue(MutableValue &&
Other) {
55 ~MutableValue() { clear(); }
73 struct MutableAggregate {
77 MutableAggregate(
Type *Ty) : Ty(Ty) {}
84 ValueStack.emplace_back();
88 for (
auto &Tmp : AllocaTmps)
92 if (!Tmp->use_empty())
104 for (
const auto &Pair : MutatedMemory)
105 Result[Pair.first] = Pair.second.toConstant();
115 bool &StrippedPointerCastsForAliasAnalysis);
119 Constant *R = ValueStack.back().lookup(V);
120 assert(R &&
"Reference to an uncomputed value!");
124 void setVal(Value *V, Constant *
C) {
125 ValueStack.back()[V] =
C;
129 Function *getCalleeWithFormalArgs(CallBase &CB,
130 SmallVectorImpl<Constant *> &Formals);
134 bool getFormalParams(CallBase &CB, Function *
F,
135 SmallVectorImpl<Constant *> &Formals);
138 Constant *ComputeLoadResult(GlobalVariable *GV,
Type *Ty,
144 std::deque<DenseMap<Value*, Constant*>> ValueStack;
153 DenseMap<GlobalVariable *, MutableValue> MutatedMemory;
162 SmallPtrSet<GlobalVariable*, 8> Invariants;
166 SmallPtrSet<Constant*, 8> SimpleConstants;
168 const DataLayout &DL;
169 const TargetLibraryInfo *TLI;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
This file defines the DenseMap class.
static bool getVal(MDTuple *MD, const char *Key, uint64_t &Val)
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
static SymbolRef::Type getType(const Symbol *Sym)
Class for arbitrary precision integers.
LLVM Basic Block Representation.
InstListType::iterator iterator
Instruction iterators...
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
This is an important base class in LLVM.
static LLVM_ABI Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
A parsed version of the target data layout string in and methods for querying it.
DenseMap< GlobalVariable *, Constant * > getMutatedInitializers() const
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.
const SmallPtrSetImpl< GlobalVariable * > & getInvariants() const
Evaluator(const DataLayout &DL, const TargetLibraryInfo *TLI)
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
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...
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.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
auto dyn_cast_if_present(const Y &Val)
dyn_cast_if_present<X> - Functionally identical to dyn_cast, except that a null (or none in the case ...
LLVM_ABI Error write(MCStreamer &Out, ArrayRef< std::string > Inputs, OnCuIndexOverflow OverflowOptValue)
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.