This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: optimized inlining of specific standard function calls
- From: Andrew Haley <aph at redhat dot com>
- To: weigelt at metux dot de
- Cc: gcc-help at gnu dot org
- Date: Thu, 12 Nov 2009 10:21:50 +0000
- Subject: Re: optimized inlining of specific standard function calls
- References: <20091112085109.GA8197@nibiru.local>
Enrico Weigelt wrote:
many specific cases of standard library function calls, eg.
snprintf (buf, sizeof(buf), "%s%s", a, b)
could be optimized to a few assembler lines, since in those
cases the compiler knows exactly whats happening here.
Does gcc yet support such optimizations ?
Yes. For example, have a look at expand_builtin_fprintf() and
expand_builtin_strcpy() in
http://gcc.gnu.org/viewcvs/trunk/gcc/builtins.c?view=markup
You could do something similar by parsing a snprintf string and
converting it to expand_builtin_strcpy().
Andrew.