Hi all, I'm working on a GCC plugin, having made a lot of progress on that front. So far running my plugin works 'more or less' on things like the linux kernel. On the other hand running it on the plugin itself causes problems. Given that some of the data structures are pretty complicated in GCC I'm not surprised.
So the question I have (w.r.t. TREE data structures) are: 1) How to marking a node as visited by my algorithm (without screwing up the compiler!) 2) How to associate additional data (perhaps a pointer to something else) to a node (like a unique identifier, or a pointer to a data structure). Thoughts: 1) The general overview of my current algorithm: a) When a node can be uniquely identified (has an identifier or position information) I can use a look up. b) However with types (especially those that are anonymous) I find it challenging to do so. I assign such a node an anonymous identifier or try to assign a general data type (i.e. integer) when the type is internal. c) When I arrive at a node and it is identifiable and it is found in the lookup table I can infer that its children have also been visited. d) However there may be cases when I cannot identify where a node has been visited, and processing is duplicated. e) This method seems quite inefficient, error prone. 2) Can memory addresses be used to uniquely identify nodes? I believe this may be the case for identifier nodes. 3) Other ideas? I tuned my process based on trial and error, and focused on what worked at the time. I think I'm doing it in the wrong way. Brett