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]
Other format: [Raw text]

Re: printf optimiziation in gcc-3.2.x


> Note that -ffreestanding completely disables these optimizations,
> though, e. g. memcpy(a, b, 4) isn't inlined anymore. (It would be nice
> to have a switch that only disables emitting new libcalls, but I don't
> think there is one.)

I recently installed a patch to c-common.c to allow backends to disable
specific builtin optimizations.  In our case, I wanted to disable
printf_unlocked and fputs_unlocked to fputc_unlocked.  This is useful
if a target doesn't support a specific optimization.  However, it's
not the right approach if you want to disable emitting new libcalls
in general.

In some ways, I think the ISO was wrong to allow these optimizations.
It tends to bypass testing by "configure" and the choice of the
programmer to use a specific libcall.  The optimization may result
in poorer performance.  GCC does no testing to determine whether
a particular target supports any given translation or whether it
actually is an optimization.  So, you do a lot of testing, release
GCC, and then find that it's broken.  In the case that prompted
the patch, configure checked for fputs_unlocked and fputc_unlocked.
It found the system had fputs_unlocked but not fputc_unlocked, but
then GCC changed a few fputs_unlocked calls to fputc_unlocked calls.

Dave
-- 
J. David Anglin                                  dave dot anglin at nrc-cnrc dot gc dot ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)


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