[LLVMdev] Memory Dependence Analysis: getNonLocalDependency()
Prakash Prabhu
prakash.prabhu at gmail.com
Mon Jul 28 15:47:34 PDT 2008
Hi,
I have a question about the memory dependence analysis. I am trying to use
it to selectively enumerate a set of pairs of (load, store) instructions for
every function by calling getNonLocalDependency() on the
MemoryDependenceAnalysis. This populates a DenseMap<BasicBlock*, Value*>. I
just looked up an usage of this in GVN.cpp:
MD->getNonLocalDependency(C, deps);
for (DenseMap<BasicBlock*, Value*>::iterator I = deps.begin(),
E = deps.end(); I != E; ++I) {
if (I->second == MemoryDependenceAnalysis::None) {
....
} else if (I->second != MemoryDependenceAnalysis::NonLocal) {
....
} else {
....
}
}
}
>From the documentation, I got to know that MD can return the set of
inter-block dependencies for any instruction (which is great!).
My question is: what does None, Local and NonLocal (special markers defined
in MemoryDependenceAnalysis.cpp) mean in this context ?
Given a store statement, my objective is to identify other load statements
that it is dependent on ? I tried this code and it seems to run, but I
wanted to make sure I am not missing anything (as a consequence of not
knowing the semantics of None, Local and NonLocal) :
for (DenseMap<BasicBlock*, Value*>::iterator B = depMap.begin(),
E = depMap.end(); B != E; B++)
{
if (B->second == MemoryDependenceAnalysis::None || B->second ==
MemoryDependenceAnalysis::NonLocal)
continue;
Value* depV = B->second;
if (isa<LoadInst>(depV))
{
...
}
}
Thanks in advance for any pointers!
- Prakash
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080728/daa0b6ee/attachment.html>
More information about the llvm-dev
mailing list