This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Clustering functions
- To: egcs at egcs dot cygnus dot com, laire at popmail dot owl dot de
- Subject: Re: Clustering functions
- From: mrs at wrs dot com (Mike Stump)
- Date: Wed, 2 Jun 1999 17:19:50 -0700
> From: Ralph Schmidt <laire@basis.owl.de>
> Date: Tue, 18 May 99 14:20:36 +0100
> To: crossgcc@cygnus.com.egcs@egcs.cygnus.com
This To: line looks horrible...
> Is it possible to mark functions in gcc with some attribute and let
> ld try to cluster these functions ? This way you could optimize
> cache usage for most used functions.
Yes. You can put them in named sections, and have S1, S2, S3, ... S9
and put exponentially more functions in the later buckets, and the
most used functions in the earlier buckets. This is a poor man's
strategy, but it should work ok.
>From the manual:
@item section ("section-name")
@cindex @code{section} function attribute
Normally, the compiler places the code it generates in the @code{text} section.
Sometimes, however, you need additional sections, or you need certain
particular functions to appear in special sections. The @code{section}
attribute specifies that a function lives in a particular section.
For example, the declaration:
@smallexample
extern void foobar (void) __attribute__ ((section ("bar")));
@end smallexample
@noindent
puts the function @code{foobar} in the @code{bar} section.