> > The cgraph redesign probably deserves more discussion. > > 1) It may be worthwhile to abstract the graph manipulation code into a > utility class which is templatized. > > graph<T>, node<T> with node inheriting from T. > > 2) Introduce a global symbol table containing a function table and a > global variable table. The function table should replace the current > cgraph node link list, and the variable table replaces the varpool. > The symbol table should provide basic interfaces to do named based > lookup, traversal, alias handling etc. I noticed trunk already has > some of that -- but it seems more abstraction is needed. > > 3) it seems natural to drop 'node' in the naming scheme > > symbol (symtab_entry) --> base class; > function --> derived from symbol; (It conflicts with the existing > struct function though); > variable --> derived from symbol; > > typedef node<function> cnode;
We could drop node, yes. The conflict with current function is more interesting. Basically symbol table "function" is that we need for IPA optimizations, while struct function is what is load when function body is needed. Those are different. Not sure if we don't want to have symtab_ prefix for all symbol table stuff or if we want to rename struct function into something more fit. Honza