Hi Duncan,<br><br>    Does llvm have any specific methods to build dependenece graphs ?  <br><br>  Thanks,<br>  Rohith.<br><br><div class="gmail_quote">On Fri, Mar 26, 2010 at 4:50 AM, Duncan Sands <span dir="ltr"><<a href="mailto:baldrick@free.fr">baldrick@free.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Rohith,<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
     I'm actually working on building a dependence graph . I'm not able<br>
to find the methods which llvm uses to build the CFG. Is it possible to<br>
use the same functions do build a dependence graph ( i Know the CFG<br>
nodes are basicblocks where as dependence graph nodes will be variables)?.<br>
</blockquote>
<br></div>
LLVM does not have explicit methods to build the CFG because it is created<br>
automatically when you build the IR.  For example, each basic block must<br>
finish with a "terminator" instruction (branch, return, invoke, etc).  Each<br>
terminator instruction specifies which other basic blocks control can reach.<br>
Thus to find the successor nodes of a basic block, you look at the last<br>
instruction of the basic block, and see where it says control flows to.<br>
There are of course helper methods that do this for you.  Predecessors are<br>
also automatically set up.<br>
<br>
Similarly, the list of uses of "variables" (aka instructions) is maintained<br>
automatically.<br>
<br>
Ciao,<br>
<br>
Duncan.<br>
<br>
PS: Please reply to the list rather than me personally.  I've CC'd the list.<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">
<br>
Thanks,<br>
Rohith.<br>
<br>
On Thu, Mar 18, 2010 at 4:55 PM, Rohith Goparaju <<a href="mailto:rgoparaj@umail.iu.edu" target="_blank">rgoparaj@umail.iu.edu</a><br></div><div class="im">
<mailto:<a href="mailto:rgoparaj@umail.iu.edu" target="_blank">rgoparaj@umail.iu.edu</a>>> wrote:<br>
<br>
      Thanks Duncan...That was helpful.<br>
<br>
<br>
    On Thu, Mar 18, 2010 at 4:54 AM, Duncan Sands <<a href="mailto:baldrick@free.fr" target="_blank">baldrick@free.fr</a><br></div><div class="im">
    <mailto:<a href="mailto:baldrick@free.fr" target="_blank">baldrick@free.fr</a>>> wrote:<br>
<br>
        Hi Rohith,<br>
<br>
         >     Is there any API within llvm that provides methods to<br>
        access the CFG<br>
         > and do some manipulations on the CFG.<br>
<br>
        the CFG is built into the LLVM IR: given a basic block (i.e. a<br>
        node of the<br>
        CFG) you can iterate over its successors and predecessors using<br>
        the methods<br>
        in include/llvm/Support/CFG.h.  To modify the CFG you have to<br>
        modify the<br>
        basic blocks, usually by changing the basic block terminator.<br>
<br>
        Ciao,<br>
<br>
        Duncan.<br>
        _______________________________________________<br>
        LLVM Developers mailing list<br></div>
        <a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <mailto:<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>><div class="im"><br>
        <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
        <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br>
<br>
<br>
</div></blockquote>
<br>
</blockquote></div><br>