This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: empty function optimizations
- To: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Subject: Re: empty function optimizations
- From: Joern Rennecke <amylaar at cygnus dot co dot uk>
- Date: Wed, 12 Jul 2000 22:46:38 +0100 (BST)
- CC: mark at codesourcery dot com, amylaar at pasanda dot cygnus dot co dot uk, jbuck at racerx dot synopsys dot com, ken at gesn dot com, gcc at gcc dot gnu dot org
> I absolutely agree. As a result, Joe is right that any code reduction
> must come from factorizing the library code itself, using standard C++
> techniques, for practical purposes. Still, it may be possible to
> achieve code reduction by combining functionally-equivalent
> instantiations by means of an extension to the ABI, e.g. by placing
> multiple symbols in front of identical assembler code.
How about doing this optimization at the point when the template call
is expanded? We could translate the signature for the template into
a normal form. I.e. if any kind pointer will do the same for a particular
argument, we substitute its type with void *. If it's any kind of pointer
that points to something - or to something that is one byte wide - we
substitute it with type_for_size (1, 0) etc.
This will avoid emitting duplicates for ordinary calls, while it leaves
pointer assignments into variables and comparisons alone.