This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Traversing typedef hierarchy in C/C++ tree


Hi Ian,

Ian Lance Taylor <iant@google.com> writes:

> Unfortunately we have discovered over time that all the memory usage
> matters.  A rule of thumb for gcc is that compilation speed is roughly
> proportional to the amount of memory used.

I think fundamentally the requirements of those who use GCC as just a
compiler and those who use it to do other things (via plugins) will be
often at odds. The "compiler users" will always strive to keep as little
syntactic information as possible to maximize performance. While the
"plugin users" will want as much context as possible.

A more general approach which could satisfy both camps would be to allow
the "plugin users" to maintain the extra information if they need to. For
example, I would be perfectly happy to build and use the typedef hierarchy
outside of the AST. And all that I would need for this is a plugin event,
similar to PLUGIN_FINISH_TYPE, that would give me base type, new type,
and the decl nodes. In the parser source code the overhead would be an
additional if-statement for each typedef:

if (finish_typedef_callbacks_count != 0)
  /* Call registered callbacks. */

The nice thing about this approach is that it can be applied equally well
to a lot of things without having to fit them into the existing tree.

What do you think?

Thanks,
	Boris


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]