This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: New attribute "infrequent"?
- To: Jan Hubicka <jh at suse dot cz>
- Subject: Re: New attribute "infrequent"?
- From: Ulrich Drepper <drepper at redhat dot com>
- Date: 27 Aug 2001 09:30:06 -0700
- Cc: gcc at gcc dot gnu dot org, pfk at fuchs dot offl dot uni-jena dot de, libc-alpha at sources dot redhat dot com, aj at suse dot de
- References: <20010827174751.G11402@atrey.karlin.mff.cuni.cz>
- Reply-To: drepper at cygnus dot com (Ulrich Drepper)
Jan Hubicka <jh@suse.cz> writes:
> Does this make sense? It would imply a lot of work on glibc side to tag all
> functions...
>
> An extension can be allowing infrequent on variables too (such as stderr) and
> predicting any block containing reference to such variable as infrequently
> executing.
If you go there (and it doesn't sound bad at all) please go one step
further. Some compilers allow changing optimization levels and other
code generation controlling variables in the source file. Something
like
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int
foo (int a)
{
return a;
}
_Pragma ("-Os")
int
bar (int a)
{
return a;
}
_Pragma ("-Oprevious")
int
baz (int a)
{
return a;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Using __builtin_expect we can control the block ordering (though this
should be improved on as well) but as you say, aggressive
optimizations shouldn't be carried out on code which isn't critical
for the runtime.
The _Pragma stuff above will in any case be needed for the C99-style
control of floating-point handling.
--
---------------. ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Red Hat `--' drepper at redhat.com `------------------------