[LLVMdev] MemoryDependenceAnalysis && MemDepResult

neda 8664 neda8664 at gmail.com
Tue Nov 1 12:21:44 PDT 2011


How can extract memory dependence among of instructions. I used the
following code but it find only one dep for a instruction.I want to get all
dependences for an instruction.

    MemoryDependenceAnalysis &mda = getAnalysis<MemoryDependenceAnalysis>();

            MemDepResult mdr = mda.getDependency(inst);


            if (mdr.isDef()) {
                Instruction *dep = mdr.getInst();

                if (isa<LoadInst>(inst)) {
                    if (isa<StoreInst>(dep)) {
                           //READ AFTER WRITE
                    }
                }
                if (isa<StoreInst>(inst)) {
                    if (isa<LoadInst>(dep)) {
                          //WRITE AFTER READ
                    }
                    if (isa<StoreInst>(dep)) {
                         //WRITE AFTER WRITE
                    }
                }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111101/897e3b21/attachment.html>


More information about the llvm-dev mailing list