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]

Re: empty function optimizations


> 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.

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