This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cfun and current_function_decl


On Mon, Jan 18, 2010 at 1:40 PM, Paulo J. Matos <pocmatos@gmail.com> wrote:
> On Mon, Jan 18, 2010 at 10:30 AM, Richard Guenther
> <richard.guenther@gmail.com> wrote:
>> On Mon, Jan 18, 2010 at 11:24 AM, Paulo J. Matos <pocmatos@gmail.com> wrote:
>>> Hi,
>>>
>>> As a continuation of my previous issue, what's the difference between
>>> cfun and current_function_decl and which one should I use to walk the
>>> tree during TARGET_FUNCTION_OK_FOR_SIBCALL?
>>>
>>> [In the internals document I only found references to cfun and even
>>> there was hard to understand what it actually is]
>>
>> It's supposed to be that cfun->decl == current_function_decl. ?Use
>> cfun in the middle-end, current_function_decl is used by frontends
>> as long as there is no struct function allocated for a function.
>>
>
> Hello Richard,
>
> Thanks for your reply. I tried cfun hoping that would do something
> different than current_function_decl but I was wrong.
> cfun->decl during the expand pass seems to only contain parts of the
> function instead of the whole thing.
>
> print_c_tree(stderr, cfun->decl); (in the TARGET_FUNCTION_OK_FOR_SIBCALL hook)
> only prints part of the first basic block.
>
> My theory is that the expand pass during the conversion to RTL
> destroyed the tree of the caller (cfun), and therefore you cannot
> actually access it during the hooks execution.
> Do you know if this is the case?

Yes.  During expansion we destroy the trees.

Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]