This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: another tree access question
- From: Pop Sébastian <pop at gauvain dot u-strasbg dot fr>
- To: Jeffrey Richardson <jlrichardson at link dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 14 Mar 2003 14:46:33 +0100
- Subject: Re: another tree access question
- References: <3DF0D3B4.65F9992@link.com> <20021206183507.GB25799@gauvain.u-strasbg.fr> <3E70E875.C388FB86@link.com>
On Thu, Mar 13, 2003 at 03:22:13PM -0500, Jeffrey Richardson wrote:
> function such as debug_tree or print_node), and I want to find a single place in
> the gcc code to call this function and access the entire tree for the program unit
> currently being compiled, where would I place the call to the function?
>
You can have a look at the call graph: cgraphunit.c, cgraph.c
/* Analyze the whole compilation unit once it is parsed completely. */
void
cgraph_finalize_compilation_unit ()
/* Dump the callgraph. */
void
dump_cgraph (f)
> In other words, is there any place in the code where I can get an address of a tree
> which represents the entire program unit? If so, where is it?
>
in c-objc-common.c you have the following
if (flag_unit_at_a_time)
{
cgraph_finalize_compilation_unit ();
cgraph_optimize ();
}
I think that at this point you get the entire unit translated into trees.
You can insert a "dump_cgraph (stderr);" before and after the "cgraph_optimize ();",
then recompile GCC and test the cc1 compiler using:
"objdir/gcc/cc1 -funit-at-a-time foo.c" or something similar.
Sebastian