CFG from the GCC

Ian Lance Taylor iant@google.com
Mon Jul 13 16:00:00 GMT 2009


weili747 <weili747@gmail.com> writes:

> I am trying to get CFG for a function in a program after all optimization
> passes have been applied. How can I get it? Thanks in advance.

You can get the basic blocks via FOR_EACH_BB.  Given a basic block, you
can use FOR_EACH_EDGE to get the edges.  For each edge, you can
EDGE_PRED and EDGE_SUCC to get the basic blocks that the edges connect
to.  See basic-block.h for these and other things.

Ian



More information about the Gcc-help mailing list