On Wed, Sep 3, 2014 at 7:54 PM, Aldy Hernandez <al...@redhat.com> wrote: > [Jason, Richard]: Is it useful for my patches to contain ChangeLog entries? > I find them mildly annoying for something that will inevitably be rewritten > multiple times, but if it aids in reviewing my WIP, I am more than happy to > continue including them.
I think they are useful in the sense that they make you review your patches youself ;) That's how I treat it with match-and-simplify where the final trunk commit will just say * foo.c: New. in most cases ;) > > On 08/28/14 11:01, Jason Merrill 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. > > > Great. It turned out, this was a cleaner approach as well. > > >>> 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? >> >> >> Why not do it in the FE, i.e. *_write_global_declarations? > > > This is what I've done in this patch. Fine. Of course FEs may choose to emit debug info even earlier before the whole unit is parsed. Flow-wise I still want to move hand-off to the cgraph code to toplev.c, out from the FEs final_write_gloabals hook: /* This must also call finalize_compilation_unit. */ lang_hooks.decls.final_write_globals (); that would make clearer how control flows. > I'm no longer generating dwarf early from free_lang_data, instead I'm using > the global_decl debug hook and adding an EARLY argument. Then I call it > twice, once after the FE is done, and once after the full compilation has > finished (cgraph has been generated, etc). The goal is to have the first > pass generate the DIEs and the 2nd pass fill in location information and > such. Sounds good (or split the hook into two). > Generating the globals first solves the context issue. The recursive nature > of generating DIEs gets everything right. For that matter, > with the attached patch, I actually get *LESS* guality failures than before. > Unexpected, but I'm not going to complain ;-). > > I have added a few (temporary) checks to make sure we're not regenerating > DIEs when we already have one (at least for DECLs). These should go away > after this work is incorporated into mainline. > > FYI, I am only handling C for now while we iron out the general idea. > > How does this look? /* Debug information for a global DECL. Called from toplev.c after - compilation proper has finished. */ - void (* global_decl) (tree decl); + compilation proper has finished. EARLY is true if global_decl() + is being called early on in the compilation process (i.e., before + cgraph information is available and before full location + information is available). */ I'd say "before code is generated" instead of "full location information is available" (location info always sounds ambiguous to me) + void (* global_decl) (tree decl, bool early); I'd also rather split the hook into two ... (and call the 2nd non-early phase hook from where we output the code). What does that phase output for global decls anyway? That is, the 2nd phase should use the cgraph/varpool iterators to amend debug info and not need the FEs list of global vars. Otherwise looks like a good incremental improvement to me. Richard. > Aldy