<DIV>Thanks a lot !! :-)</DIV>
<DIV> </DIV>
<DIV>Tanu<BR><BR><B><I>Misha Brukman <brukman@uiuc.edu></I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">On Wed, Nov 10, 2004 at 06:39:12AM -0800, Tanu Sharma wrote:<BR>> I am a new user of LLVM and have been trying to find how Control Flow<BR>> Graphs are implemented in it.I wish to get access to the internal<BR>> structures of CFG and learn how LLVM makes them.<BR><BR>LLVM does not need to construct a CFG, because the CFG is an explicit<BR>integral part of the program representation. Every BasicBlock ends with<BR>a terminator instruction, which is one of these:<BR><BR>http://llvm.cs.uiuc.edu/docs/LangRef.html#terminators<BR><BR>Each terminator has explicit target BasicBlocks (if any), which means<BR>you can navigate the CFG directly using the terminators or you can use<BR>the API pred_begin/end() and succ_begin/end() found in <BR><BR>llvm/include/llvm/Support/CFG.h<BR><BR>If you are not sure how to use them, search the code base for one of<BR>them to find example
 usage.<BR><BR>> Is there any existing tool that LLVM provides that makes CFG out of<BR>> bytecode ?<BR><BR>Above I described how to navigate the CFG within your compiler pass. If<BR>you mean "how can I visualize the CFG", then the answer is:<BR><BR>$ analyze -print-cfg file.bc<BR>or<BR>$ analyze -print-cfg-only file.bc<BR><BR>which will produce a 'dot' file. You will need to get 'dot' (search for<BR>graphviz package) which can convert .dot files into postscript.<BR><BR>-- <BR>Misha Brukman :: http://misha.brukman.net :: http://llvm.cs.uiuc.edu<BR><BR>_______________________________________________<BR>LLVM Developers mailing list<BR>LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu<BR>http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev<BR></BLOCKQUOTE><p>
        
                <hr size=1>Do you Yahoo!?<br> 
Check out the new Yahoo! Front Page. <a href="http://www.yahoo.com">www.yahoo.com</a>