Inlining of vararg functions
Jakub Jelinek
jakub@redhat.com
Thu May 3 10:26:00 GMT 2001
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
More information about the Gcc
mailing list