Hi Jeff,

to my understanding a leaf function is characterized by not calling another 
function in its function
body. So for the patch the question is whether we consider the mcount call 
belonging to the function
body or not. As I see it from the backends for all uses of is_leaf the function 
body is what comes
between the function prologue and the epilogue.  Hence calling mcount *before* 
the function prologue
does not speak against the "leafness" of a function. What do you think?

Bye,

-Andreas-

On 22/10/13 21:28, Andreas Krebbel wrote:
> On 16/10/13 22:25, Jeff Law wrote:
...
>> I still really feel this should be a target hook that is off by default 
>> so that the target maintainers can audit their target to ensure it 
>> operates correctly.
>>
>> Maybe I'm missing something, so perhaps another approach.  Can you 
>> explain why you think it is safe to ignore calls to mcount when trying 
>> to determine if a function is a leaf or not?
> 
> In general it is not safe to ignore calls to mcount. But if a target does 
> insert the call to mcount
> before the function prologue then mcount will not use the stack space 
> allocated by the current
> function. It will instead use the stack space allocated by the caller for the 
> current function. The
> current function can still be a leaf function since the call does not happen 
> within the scope of its
> stack frame.
> 
> The difference between PROFILE_HOOKS and FUNCTION_PROFILER is that for the 
> first the call to mcount
> is inserted always after the function prologue no matter what the backend 
> returns for the
> profile_before_prologue target hook.

Reply via email to