This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [debug-early] reuse variable DIEs and fix their context
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Jason Merrill <jason at redhat dot com>,Aldy Hernandez <aldyh at redhat dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 28 Aug 2014 21:13:30 +0200
- Subject: Re: [debug-early] reuse variable DIEs and fix their context
- Authentication-results: sourceware.org; auth=none
- References: <53FD45A7 dot 4000804 at redhat dot com> <CAFiYyc0rftZkObJxo13UCwLvkhqMPNXkE11g-8tvdefQmhN2BQ at mail dot gmail dot com> <53FF6840 dot 9030505 at redhat dot com> <53FF6E61 dot 6030507 at redhat dot com>
On August 28, 2014 8:01:05 PM CEST, Jason Merrill <jason@redhat.com> wrote:
>On 08/28/2014 01:34 PM, Aldy Hernandez wrote:
>> I wonder if instead of early dumping of all the DECLs, we could only
>> dump the toplevel scoped DECLs, and let inheritance set the proper
>> contexts.
>
>Yes, I think this makes a lot more sense; do it at a well-defined point
>
>in compilation rather than as part of free_lang_data.
>
>> We could start with calling dwarf2out_early_decl() for each function
>> decl, and then for every global. This is analogous to what we
>currently
>> do for late dwarf2out.
>>
>> see final.c for the functions:
>> if (!DECL_IGNORED_P (current_function_decl))
>> debug_hooks->function_decl (current_function_decl);
>>
>> see c/c-decl.c for the globals:
>> FOR_EACH_VEC_ELT (*all_translation_units, i, t)
>> c_write_global_declarations_2 (BLOCK_VARS (DECL_INITIAL (t)));
>> c_write_global_declarations_2 (BLOCK_VARS (ext_block));
>
>> The problem being that to calculate `ext_block' above, we need
>intimate
>> knowledge of scopes and such, only available in the FE. Is there a
>> generic way of determining if a DECL is in global scope?
Via DECL_CONTEXT and the global scope macro predicate. Eventually not enough to detect class scope statics.
>Why not do it in the FE, i.e. *_write_global_declarations?
Yeah, ultimatively I'd like the front ends to do all required dwarf2out calls but free lang data seemed a convenient place to do things.
There is no reason we can't walk its array in a more sensible order.
Richard.
>
>Jason