On Mar 27, 11 05:51, bearophile wrote:

I don't undersatand why this is useful, why the compiler isn't able to infer 
this by itself:

>A new function attribute leaf was introduced. This attribute allows better 
inter-procedural optimization across calls to functions that return to the current 
unit only via returning or exception handling. This is the case for most library 
functions that have no callbacks.<


Most of these attributes are designed for control freaks that don't believe in the compiler's decision :).

gcc's manual says,

Calls to external functions with this attribute must return to the current 
compilation unit only by return or by exception handling. In particular, leaf 
functions are not allowed to call callback function passed to it from the 
current compilation unit or directly call functions exported by the unit or 
longjmp into the unit. Leaf function might still call functions from other 
compilation units and thus they are not necessarily leaf in the sense that they 
contain no function calls at all.
The attribute is intended for library functions to improve dataflow analysis. 
The compiler takes the hint that any data not escaping the current compilation 
unit can not be used or modified by the leaf function. For example, the sin 
function is a leaf function, but qsort is not.

Note that leaf functions might invoke signals and signal handlers might be 
defined in the current compilation unit and use static variables. The only 
compliant way to write such a signal handler is to declare such variables 
volatile.

The attribute has no effect on functions defined within the current compilation 
unit. This is to allow easy merging of multiple compilation units into one, for 
example, by using the link time optimization. For this reason the attribute is 
not allowed on types to annotate indirect calls.


;

And I understand this even less:

>The new function attribute callee_pop_aggregate allows to specify if the caller 
or callee is responsible for popping the aggregate return pointer value from the 
stack.<

Just calling convention stuff.

Reply via email to