This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: another tree access question


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]