Hello, I would like to extract Control Flow Graph and Data Flow Graph from a sample program written in C++, Can anybody please direct me to some examples? Thanks in advance -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101012/fc071e63/attachment.html>
I know the MachineBasicBlock has some nice predecessor and successor iterators. See MachineBasicBlock::pred_iterator and MachineBasicBlock::succ_iterator for those iterators. -Jeff Kunkel On Tue, Oct 12, 2010 at 7:02 AM, hamed hamzehi <mohammadhamzehi at yahoo.com>wrote:> Hello, > > I would like to extract Control Flow Graph and Data Flow Graph from a > sample program written in C++, Can anybody please direct me to some > examples? > Thanks in advance > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101012/c20c592a/attachment.html>
On 10/12/2010 07:02 AM, hamed hamzehi wrote:> Hello, > > I would like to extract Control Flow Graph and Data Flow Graph from a > sample program written in C++, Can anybody please direct me to some > examples? > Thanks in advanceHi, to get the CFG's use this command. clang++ -S -emit-llvm program.cpp opt -view-cfg program.s This needs the graphviz package to be installed as the dotty program is called. To just extract the dot files of the CFG use: opt -dot-cfg program.s If you use -dot-cfg-only -view-cfg-only the CFG does not contain the statements of each bb. I do not know if there is any DataFlowGraph available in LLVM. Cheers Tobi