Getting access to g++ tree from front end.

Brendon Costa bcosta@avdat.com.au
Thu Mar 31 08:05:00 GMT 2005


Hi,

    I am trying to make a small modification to a local copy of gcc (In 
particular the g++ front end) that will help me in documenting 
exceptions that can be thrown by functions. I have had a look at most of 
the gcc documentation i could find and it has been helpful, but i am 
currently stuck in where to look next. I know roughly how i want to 
implement this code, but i need to find an appropriate place to "hook 
into the g++ fronten code". What i need at the point of where i hook in, 
is just the intermediate tree generated by the C++ front end. This is 
the one spoken of in chapter 9 of the document "GNU Compiler Collection 
(GCC) Internals" where it talks about the intermediate representation 
used by the C and C++ front ends. I assume that this tree is generated, 
and then converted to a GIMPLE tree and then later to RTL, but what 
happens with it after i have used it is really none of my concern.

Questions:

1) Does gcc generate this full tree before it compiles the code (I.e. 
generates RTL and then assembly etc), and if not is there any point in 
time where this intermediate tree is complete so that i can get access 
to all information parsed in the given g++ session.

2) If there is a full tree generated, where is the best place to get 
that tree for my purposes (I will not be modifying the tree just 
iterating through it getting the appropriate information that i need and 
saving it externally)?

3) If the tree is never generated in its entirety at any point, i 
noticed that in the gcc/toplev.c file there is a function called: 
rest_of_compilation which is called for each function being compiled 
from what i can tell. It there something similar inside the front end 
where i can hook into that will give the full tree/branch for each 
function in the parsed file(s)?


Thanks for any help,
Brendon.



More information about the Gcc-help mailing list