Bob Rossi wrote:
> Hi Ian,
>
> Basically, I want to use GCC with C,C++. I want to walk a tree that GCC
> creates for the translation units. I would like to know if for these two
> languages if I should use a language dependent tree, the generic tree or
> the gimple tree. In general, I would like to use the tree that most
closely
> resembles the source language, and that is documented best.
>
> For starters, can you recommend which tree structure I should use in
> GCC? If so, would it be to much to ask to point me to the object in the
> source code that represents the tree after the tree has been populated?
>
> If I should be using gimple, I found this paper.
> ftp://gcc.gnu.org/pub/gcc/summit/2003/GENERIC%20and%20GIMPLE.pdf
> Is there any other good documentation on this?

I cant help much as i have only been fumbling around in the GCC source
for a short time now and still have no idea about a lot of stuff.
However I did want to also look at the full tree for the C++ front end.
I did this from the parser.c: cp_parser_translation_unit() function just
after the call to: finish_translation_unit() and I was looking at the
tree defined globally elsewhere in the variable: global_namespace

This is probably not the best spot to look at the tree but it seemed to
work for me. However i have recently been changing the way i do things
as working with the full tree was VERY in-efficient for my task. I now
look at the trees for individual functions as they pass through:
gimplify.c: gimplify_function_tree()

It sped my code up by over 100x. I guess it really depends on what you
wish to do and I am sure someone else on this list can help a lot more
than i can.

Brendon.





Reply via email to