This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: using gcc to build a control flow graph
- From: Diego Novillo <dnovillo at google dot com>
- To: Tanya Gornak <errizo at gmail dot com>
- Cc: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Mon, 3 Nov 2008 18:29:15 -0500
- Subject: Re: using gcc to build a control flow graph
- References: <5dcc4c8a0811031023p59491576m73c200e9045a1292@mail.gmail.com>
2008/11/3 Tanya Gornak <errizo@gmail.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.
Diego.