This is the mail archive of the
mailing list for the glibc project.
Re: New attribute "infrequent"?
> On Mon, 27 Aug 2001, Jan Hubicka wrote:
> We can add an attribute (probably called "infrequent") to the functions. Such
> attribute exhibits a hint, that given function is definitly outside performance
> cirtical code, so gcc can:
> 1) optimize it for size
> 2) use for branch prediction purposes
> 3) propagate the information to other functions allways calling infrequent
> 4) once procedure splitting is implemented (if at all), it can move whole
> function to infrequently executed section.
> I would think we get most of the benefit already by recognizing "noreturn"
> functions and all calls leading to those. Marking functions "infrequent" is
Thats what I was thinking about too, but there are some important exceptions
like error handling or startup code.
Optimizing "noreturn" function for size instead of speed should be also good
idea, but just tiny fraction of code is "noreturn", while "infrequent" is in
fact majority of code.
> a much more fuzzy notion, and has therefore the risk of being counter-productive,
> especially as functions may be used in an entirely different way by different
> programs. The distributed cost of maintaining such attributes all over the place
> seems to be way higher than the benefit of such an optimization.
Thats precisely why I ask for an opinions...
As mentioned, I don't expect much anything except system libraries to use it...