This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: CFG from the GCC
- From: Ian Lance Taylor <iant at google dot com>
- To: weili747 <weili747 at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 13 Jul 2009 09:00:32 -0700
- Subject: Re: CFG from the GCC
- References: <24457776.post@talk.nabble.com>
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