This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Inlining of vararg functions
- To: Nathan Sidwell <nathan at codesourcery dot com>
- Subject: Re: Inlining of vararg functions
- From: Jakub Jelinek <jakub at redhat dot com>
- Date: Thu, 3 May 2001 19:28:51 +0200
- Cc: Peter Simons <peter dot simons at cw dot com>, gcc at gcc dot gnu dot org
- References: <200105030836.f438aYc51152@dev13.de.cw.net> <3AF12052.ACDCE704@codesourcery.com>
- Reply-To: Jakub Jelinek <jakub at redhat dot com>
On Thu, May 03, 2001 at 10:09:38AM +0100, Nathan Sidwell wrote:
> I think it quite unlikely that this will happen. With varadic functions,
> the compiler has no knowledge of how the arguments are going to be
> accessed (it's isomorphic to the halting problem). they essentially have
> to be layed down in an array and accessed via a pointer. That
> would have to still be done on inlining, and I suspect it would get
> hairy.
>
> The one exception would be the empty function
> void foo (char *, ...)
> {
> }
>
> which I guess might happen for debug type things with debugging disabled.
>
> my feeling is that it is sufficiently rare for a varadic function call
> to be worth inlining in the first place, that implementing that functionallity
> would not be worth it.
Actually there are other cases not too hard to handle, like varadic functions
which never use __builtin_varargs_start or varadic functions which don't pass
the value returned by __builtin_varargs_start to anywhere outside of itself
and don't use __builtin_va_arg inside of loops
(if we can find out that the proper varargs.h header has been included).
Jakub