14 #ifndef LLVM_ANALYSIS_MEMORYDEPENDENCEANALYSIS_H
15 #define LLVM_ANALYSIS_MEMORYDEPENDENCEANALYSIS_H
32 class AssumptionCache;
33 class MemoryDependenceAnalysis;
34 class PredIteratorCache;
106 assert(Inst &&
"Def requires inst");
110 assert(Inst &&
"Clobber requires inst");
115 PairTy(reinterpret_cast<Instruction*>(NonLocal), Other));
119 PairTy(reinterpret_cast<Instruction*>(NonFuncLocal), Other));
123 PairTy(reinterpret_cast<Instruction*>(Unknown), Other));
138 return Value.getInt() == Other
145 return Value.getInt() == Other
152 return Value.getInt() == Other
159 if (
Value.getInt() == Other)
return nullptr;
160 return Value.getPointer();
181 bool isDirty()
const {
return Value.getInt() ==
Invalid; }
195 : BB(bb), Result(result) {}
220 : Entry(bb, result), Address(address) {}
277 struct NonLocalPointerInfo {
297 NonLocalPointerInfo> CachedNonLocalPointerInfo;
298 CachedNonLocalPointerInfo NonLocalPointerDeps;
303 ReverseNonLocalPtrDepTy ReverseNonLocalPtrDeps;
309 typedef std::pair<NonLocalDepInfo, bool> PerInstNLInfo;
314 NonLocalDepMapType NonLocalDeps;
320 ReverseDepMapType ReverseLocalDeps;
323 ReverseDepMapType ReverseNonLocalDeps;
428 bool getNonLocalPointerDepFromBB(
Instruction *QueryInst,
434 bool SkipFirstBlock =
false);
438 unsigned NumSortedEntries);
void invalidateCachedPointerInfo(Value *Ptr)
invalidateCachedPointerInfo - This method is used to invalidate cached information about the specifie...
bool isDef() const
isDef - Return true if this MemDepResult represents a query that is an instruction definition depende...
BasicBlock * getBB() const
bool operator<(const MemDepResult &M) const
A cache of .assume calls within a function.
LoadInst - an instruction for reading from memory.
void setResult(const MemDepResult &R, Value *Addr)
bool isUnknown() const
isUnknown - Return true if this MemDepResult represents a query which cannot and/or will not be compu...
bool isClobber() const
isClobber - Return true if this MemDepResult represents a query that is an instruction clobber depend...
bool runOnFunction(Function &) override
Pass Implementation stuff. This doesn't do any analysis eagerly.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
static MemDepResult getDef(Instruction *Inst)
get methods: These are static ctor methods for creating various MemDepResult kinds.
MemoryDependenceAnalysis - This is an analysis that determines, for a given memory operation...
Value * getAddress() const
getAddress - Return the address of this pointer in this block.
void releaseMemory() override
Clean up memory in between runs.
PredIteratorCache - This class is an extremely trivial cache for predecessor iterator queries...
bool operator==(const MemDepResult &M) const
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Does not modify anything.
MemoryDependenceAnalysis()
static MemDepResult getUnknown()
MemDepResult getPointerDependencyFrom(const MemoryLocation &Loc, bool isLoad, BasicBlock::iterator ScanIt, BasicBlock *BB, Instruction *QueryInst=nullptr)
getPointerDependencyFrom - Return the instruction on which a memory location depends.
LLVM Basic Block Representation.
PHITransAddr - An address value which tracks and handles phi translation.
bool operator>(const MemDepResult &M) const
NonLocalDepResult - This is a result from a NonLocal dependence query.
NonLocalDepResult(BasicBlock *bb, MemDepResult result, Value *address)
Represent the analysis usage information of a pass.
static MemDepResult getNonFuncLocal()
BasicBlock * getBB() const
FunctionPass class - This class is used to implement most global optimizations.
const MemDepResult & getResult() const
void setResult(const MemDepResult &R)
MemDepResult - A memory dependence query can return one of three different answers, described below.
Representation for a specific memory location.
NonLocalDepEntry(BasicBlock *bb, MemDepResult result)
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
static MemDepResult getClobber(Instruction *Inst)
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
bool isNonLocal() const
isNonLocal - Return true if this MemDepResult represents a query that is transparent to the start of ...
std::vector< NonLocalDepEntry > NonLocalDepInfo
bool operator<(const NonLocalDepEntry &RHS) const
Instruction * getInst() const
getInst() - If this is a normal dependency, return the instruction that is depended on...
NonLocalDepEntry(BasicBlock *bb)
MemDepResult getDependency(Instruction *QueryInst)
getDependency - Return the instruction on which a memory operation depends.
void invalidateCachedPredecessors()
invalidateCachedPredecessors - Clear the PredIteratorCache info.
~MemoryDependenceAnalysis() override
const NonLocalDepInfo & getNonLocalCallDependency(CallSite QueryCS)
getNonLocalCallDependency - Perform a full dependency query for the specified call, returning the set of blocks that the value is potentially live across.
LLVM Value Representation.
const MemDepResult & getResult() const
NonLocalDepEntry - This is an entry in the NonLocalDepInfo cache.
static MemDepResult getNonLocal()
static unsigned getLoadLoadClobberFullWidthSize(const Value *MemLocBase, int64_t MemLocOffs, unsigned MemLocSize, const LoadInst *LI)
getLoadLoadClobberFullWidthSize - This is a little bit of analysis that looks at a memory location fo...
bool isNonFuncLocal() const
isNonFuncLocal - Return true if this MemDepResult represents a query that is transparent to the start...
bool operator!=(const MemDepResult &M) const
void removeInstruction(Instruction *InstToRemove)
removeInstruction - Remove an instruction from the dependence analysis, updating the dependence of in...
void getNonLocalPointerDependency(Instruction *QueryInst, SmallVectorImpl< NonLocalDepResult > &Result)
getNonLocalPointerDependency - Perform a full dependency query for an access to the QueryInst's speci...