14 #ifndef LLVM_ANALYSIS_MEMORYDEPENDENCEANALYSIS_H 15 #define LLVM_ANALYSIS_MEMORYDEPENDENCEANALYSIS_H 39 class AssumptionCache;
45 class TargetLibraryInfo;
133 assert(Inst &&
"Def requires inst");
137 assert(Inst &&
"Clobber requires inst");
144 return MemDepResult(ValueTy::create<Other>(NonFuncLocal));
156 bool isDef()
const {
return Value.is<Def>(); }
161 return Value.is<Other>() && Value.cast<Other>() == NonLocal;
167 return Value.is<Other>() && Value.cast<Other>() == NonFuncLocal;
173 return Value.is<Other>() && Value.cast<Other>() == Unknown;
179 switch (Value.getTag()) {
181 return Value.cast<Invalid>();
183 return Value.cast<Clobber>();
185 return Value.cast<Def>();
201 bool isDirty()
const {
return Value.is<
Invalid>(); }
217 : BB(bb), Result(result) {}
242 : Entry(bb, result), Address(address) {}
298 struct NonLocalPointerInfo {
312 NonLocalPointerInfo() =
default;
342 using PerInstNLInfo = std::pair<NonLocalDepInfo, bool>;
370 : AA(AA), AC(AC), TLI(TLI), DT(DT), PV(PV) {}
379 unsigned getDefaultBlockScanLimit()
const;
412 void getNonLocalPointerDependency(
Instruction *QueryInst,
426 void invalidateCachedPointerInfo(Value *Ptr);
432 void invalidateCachedPredecessors();
451 unsigned *Limit =
nullptr);
458 unsigned *Limit =
nullptr);
475 static unsigned getLoadLoadClobberFullWidthSize(
const Value *MemLocBase,
481 void releaseMemory();
487 bool getNonLocalPointerDepFromBB(
Instruction *QueryInst,
493 bool SkipFirstBlock =
false);
497 unsigned NumSortedEntries);
535 void releaseMemory()
override;
545 #endif // LLVM_ANALYSIS_MEMORYDEPENDENCEANALYSIS_H
Value * getAddress() const
Returns the address of this pointer in this block.
Provides a lazy, caching interface for making common memory aliasing information queries, backed by LLVM's alias analysis passes.
This class represents lattice values for constants.
A compile time pair of an integer tag and the pointer-like type which it indexes within a sum type...
static constexpr LocationSize unknown()
bool operator<(const NonLocalDepEntry &RHS) const
bool isNonLocal() const
Tests if this MemDepResult represents a query that is transparent to the start of the block...
bool operator>(const MemDepResult &M) const
A cache of @llvm.assume calls within a function.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
An instruction for reading from memory.
void setResult(const MemDepResult &R, Value *Addr)
bool operator!=(const MemDepResult &M) const
bool isDef() const
Tests if this MemDepResult represents a query that is an instruction definition dependency.
bool isClobber() const
Tests if this MemDepResult represents a query that is an instruction clobber dependency.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
static bool isLoad(int Opcode)
static MemDepResult getDef(Instruction *Inst)
get methods: These are static ctor methods for creating various MemDepResult kinds.
An analysis that produces MemoryDependenceResults for a function.
MemoryDependenceResults(AliasAnalysis &AA, AssumptionCache &AC, const TargetLibraryInfo &TLI, DominatorTree &DT, PhiValues &PV)
PredIteratorCache - This class is an extremely trivial cache for predecessor iterator queries...
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
static MemDepResult getUnknown()
static bool runOnFunction(Function &F, bool PostInlining)
A set of analyses that are preserved following a run of a transformation pass.
LLVM Basic Block Representation.
PointerIntPair - This class implements a pair of a pointer and small integer.
PHITransAddr - An address value which tracks and handles phi translation.
This is a result from a NonLocal dependence query.
A CRTP mix-in that provides informational APIs needed for analysis passes.
NonLocalDepResult(BasicBlock *bb, MemDepResult result, Value *address)
Represent the analysis usage information of a pass.
static MemDepResult getNonFuncLocal()
FunctionPass class - This class is used to implement most global optimizations.
bool operator<(const MemDepResult &M) const
void setResult(const MemDepResult &R)
friend class MemoryDependenceResults
A wrapper analysis pass for the legacy pass manager that exposes a MemoryDepnedenceResults instance...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
A memory dependence query can return one of three different answers.
Representation for a specific memory location.
const MemDepResult & getResult() const
NonLocalDepEntry(BasicBlock *bb, MemDepResult result)
Provides information about what library functions are available for the current target.
static MemDepResult getClobber(Instruction *Inst)
const MemDepResult & getResult() const
BasicBlock * getBB() const
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
BasicBlock * getBB() const
InstListType::iterator iterator
Instruction iterators...
bool isNonFuncLocal() const
Tests if this MemDepResult represents a query that is transparent to the start of the function...
std::vector< NonLocalDepEntry > NonLocalDepInfo
A sum type over pointer-like types.
bool isUnknown() const
Tests if this MemDepResult represents a query which cannot and/or will not be computed.
NonLocalDepEntry(BasicBlock *bb)
Instruction * getInst() const
If this is a normal dependency, returns the instruction that is depended on.
This file provides utility analysis objects describing memory locations.
Class for calculating and caching the underlying values of phis in a function.
API to communicate dependencies between analyses during invalidation.
bool operator==(const MemDepResult &M) const
MemoryDependenceResults & getMemDep()
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
This is an entry in the NonLocalDepInfo cache.
A container for analyses that lazily runs them and caches their results.
This header defines various interfaces for pass management in LLVM.
static MemDepResult getNonLocal()
A special type used by analysis passes to provide an address that identifies that particular analysis...