I'm new to the gcc community. I've been asked to modify gcc to allow it to inject various kinds of instrumentation during compilation. My current plan is to capture the tree being generated by the front end, augment it, and pass it on to the back end. It seems like a reasonable approach but I can't find much information about interpreting and manipulating trees.
Does anyone have any information about this technique of wedging code between the front and back ends, or, better yet, some examples? Is there a better approach? Are there existing tools that might eliminate the need to write this instrumentation injector from scratch?