using gcc to build a control flow graph
Mon Nov 3 23:30:00 GMT 2008
2008/11/3 Tanya Gornak <email@example.com>:
> Could you please recommend me a way to extract control flow graph from gcc?
Depending on how much analysis you need to do, you could just request
the basic block boundaries dumped together with the IL using:
$ gcc -fdump-tree-ssa-blocks ...
This gives you a dump right after the program is in SSA form. The
basic block boundaries can then be post-processed to generate a graph
drawing input file. Most optimization passes will also accept the
-blocks modifier, so you can produce a CFG out of any pass.
However, if you need to interact with the CFG in deeper ways, then
you'll have to write a proper GCC pass.
More information about the Gcc-help