[LLVMdev] CFG extraction
Tobias Grosser
grosser at fim.uni-passau.de
Tue Oct 12 04:53:20 PDT 2010
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 advance
Hi,
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
More information about the llvm-dev
mailing list