On Wed, Apr 04, 2012 at 01:39:45PM +0100, Måns Rullgård wrote: > Diego Biurrun <[email protected]> writes: > > > The av_cold attribute is only effective if the compiler can see it during > > the > > compilation of code that calls a function marked av_cold. Thus the > > attribute > > needs to be part of function declarations in header files. > > Patently false. Patch rejected.
http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html 6.30 Declaring Attributes of Functions cold The cold attribute is used to inform the compiler that a function is unlikely executed. The function is optimized for size rather than speed and on many targets it is placed into special subsection of the text section so all cold functions appears close together improving code locality of non-cold parts of program. The paths leading to call of cold functions within code are marked as unlikely by the branch prediction mechanism. It is thus useful to mark functions used to handle unlikely conditions, such as perror, as cold to improve optimization of hot functions that do call marked functions in rare occasions. How is the compiler supposed to mark paths leading to calls of a cold function as unlikely without av_cold in the header file? Diego _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
