diff options
author | aldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-06-05 18:44:53 +0000 |
---|---|---|
committer | aldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-06-05 18:44:53 +0000 |
commit | 3a1c9df24981c5068334726a0d92fd80c455eb6e (patch) | |
tree | 906774b04a2315e6e0109ec866407a4b6ee1195f /gcc/toplev.c | |
parent | d51560f9afc5c8a826bcfa6fc90a96156b623559 (diff) | |
download | gcc-3a1c9df24981c5068334726a0d92fd80c455eb6e.tar.gz |
Merge debug-early branch into mainline.
* dwarf2out.c: Remove deferred_locations*.
(dwarf2_debug_hooks): Add early_finish hook.
Remove global_decl hook.
Add early_global_decl and late_global_decl hook.
New global early_dwarf.
New structure set_early_dwarf.
(output_die): Indicate whether a DIE was generated early
when generating assembly with -dA.
(struct limbo_die_struct): Document created_for field.
Remove file_table_last_lookup.
(remove_AT): Return TRUE if successful.
(remove_child_TAG): Clear die_parent.
(reparent_child): New function abstracted from...
(splice_child_die): ...here.
(new_die): ICE if a DIE ends up in limbo too late.
(check_die): New.
(defer_location): Remove.
(add_subscript_info): Reuse DW_TAG_subrange_type if available.
(fill_variable_array_bounds): New.
(decl_start_label): Call fill_variable_array_bounds.
(gen_formal_parameter_die): Rewrite to reuse previously generated
DIEs.
(gen_subprogram_die): Same.
(gen_variable_die): Same.
(gen_const_die): Same.
(gen_label_die): Same.
(gen_lexical_block_die): Same.
(decl_will_get_specification_p): New.
(local_function_static): New.
(gen_struct_or_union_type_die): Fill in variable-length fields.
(gen_typedef_die): Fill in variable-length typedefs.
(gen_tagged_type_die): Gracefully return on error_mark_node.
Handle re-entrancy.
(gen_type_die_with_usage): Handle variable-length types.
Remove duplicate code for ARRAY_TYPE case.
(process_scope_var): Only process imported modules during early
dwarf.
(dwarf2out_early_global_decl): New.
(dwarf2out_late_global_decl): Rename from dwarf2out_global_decl.
(dwarf2out_type_decl): Set early_dwarf while calling
dwarf2out_decl.
(dwarf2out_decl): Verify that we did not recreate a previously
generated DIE.
Do not return on DECL_EXTERNALs in VAR_DECLs.
Abstract some code to local_function_static.
(lookup_filename): Remove use of file_table_last_lookup.
Gracefully exit on missing file_name.
(dwarf2out_finish): Verify limbo list.
Remove deferred_locations_list use.
Move deferred_asm_name and limbo flushing to...
(dwarf2out_early_finish): ...here. New.
(dwarf2out_c_finalize): Remove set of deferred_location_list,
deferred_asm_name, and file_table_last_lookup.
* cgraph.h (referred_to_p): Add default argument.
* cgraphunit.c (referred_to_p): Add and handle include_self
argument.
(analyze_functions): Add first_time argument.
Call check_global_declaration for all symbols.
Call late_global_decl for nodes for moribund nodes.
(finalize_compilation_unit): Add new argument to
analyze_functions.
Call early_global_decl for functions.
Call early_finish debug hook.
* dbxout.c (dbxout_early_global_decl): New.
(dbxout_late_global_decl): New. Adapted from dbxout_global_decl.
(dbx_debug_hooks): Add new hooks.
(xcoff_debug_hooks): Same.
* debug.c (do_nothing_debug_hooks): Add early_finish field.
Add early and late debug hooks.
Remove global_decl hook.
* debug.h (struct gcc_debug_hooks): Add early_finish,
early_global_decl, and late_global_decl fields.
Remove global_decl field.
Document gcc_debug_hooks.
* gengtype.c (output_typename): Remove.
* godump.c (go_early_global_decl): New.
(go_late_global_decl): New.
(go_global_decl): Remove.
(dump_go_spec_init): Remove global_decl. Add
{early,late}_global_decl.
* langhooks-def.h (LANG_HOOKS_WRITE_GLOBALS): Remove.
(LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS): New.
* langhooks.c (lhd_warn_unused_global_decl): Adjust comment.
(write_global_declarations): Remove.
(global_decl_processing): New.
* langhooks.h (struct lang_hooks_for_decls): Remove
final_write_globals field.
Add post_compilation_parsing_cleanups field.
* passes.c (rest_of_decl_compilation): Call early_global_decl.
* sdbout.c: Add early and late_global_decl hooks. Remove
sdbout_global_decl hook.
Add early_finish field for sdb_debug_hooks.
(sdbout_global_decl): Remove.
(sdbout_early_global_decl): New.
(sdbout_late_global_decl): New.
* timevar.def (TV_PHASE_LATE_PARSING_CLEANUPS): New.
* toplev.c (check_global_declaration): Rename from
check_global_declaration_1.
Adapt to use symtab infrastructure.
(check_global_declarations): Remove.
(emit_debug_global_declarations): Remove.
(compile_file): Remove call to final_write_globals langhook.
Run the actual compilation process.
Perform any post compilation parser cleanups.
Generate late debug info.
* toplev.h (check_global_declaration): New.
(check_global_declaration_1): Remove.
(check_global_declarations): Remove.
(write_global_declarations): Remove.
(emit_debug_global_declarations): Remove.
(global_decl_processing): New.
* tree-core.h (struct tree_block): Add DIE field.
* tree.h (BLOCK_DIE): New.
* vmsdbgout.c (vmsdbgout_global_decl): Remove function and its use
throughout.
(vmsdbgout_early_global_decl): New.
(vmsdbgout_late_global_decl): New.
Add early_finish debug hook field to vmsdbg_debug_hooks.
Remove vmsdbgout_decl to vmsdbgout_function_decl.
Add early and late_global_decl debug hooks.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224161 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r-- | gcc/toplev.c | 78 |
1 files changed, 37 insertions, 41 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c index f38fb32c0db..fd2ac4e7f2e 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -492,15 +492,15 @@ wrapup_global_declarations (tree *vec, int len) return output_something; } -/* A subroutine of check_global_declarations. Issue appropriate warnings - for the global declaration DECL. */ +/* Issue appropriate warnings for the global declaration DECL. */ void -check_global_declaration_1 (tree decl) +check_global_declaration (tree decl) { /* Warn about any function declared static but not defined. We don't warn about variables, because many programs have static variables that exist only to get some text into the object file. */ + symtab_node *snode = symtab_node::get (decl); if (TREE_CODE (decl) == FUNCTION_DECL && DECL_INITIAL (decl) == 0 && DECL_EXTERNAL (decl) @@ -508,9 +508,9 @@ check_global_declaration_1 (tree decl) && ! TREE_NO_WARNING (decl) && ! TREE_PUBLIC (decl) && (warn_unused_function - || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))) + || snode->referred_to_p (/*include_self=*/false))) { - if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))) + if (snode->referred_to_p (/*include_self=*/false)) pedwarn (input_location, 0, "%q+F used but never defined", decl); else warning (OPT_Wunused_function, "%q+F declared %<static%> but never defined", decl); @@ -525,6 +525,10 @@ check_global_declaration_1 (tree decl) || (warn_unused_variable && TREE_CODE (decl) == VAR_DECL && ! TREE_READONLY (decl))) && ! DECL_IN_SYSTEM_HEADER (decl) + && ! snode->referred_to_p (/*include_self=*/false) + /* This TREE_USED check is needed in addition to referred_to_p + above, because the `__unused__' attribute is not being + considered for referred_to_p. */ && ! TREE_USED (decl) /* The TREE_USED bit for file-scope decls is kept in the identifier, to handle multiple external decls in different scopes. */ @@ -535,6 +539,10 @@ check_global_declaration_1 (tree decl) && ! TREE_THIS_VOLATILE (decl) /* Global register variables must be declared to reserve them. */ && ! (TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl)) + /* Global ctors and dtors are called by the runtime. */ + && (TREE_CODE (decl) != FUNCTION_DECL + || (!DECL_STATIC_CONSTRUCTOR (decl) + && !DECL_STATIC_DESTRUCTOR (decl))) /* Otherwise, ask the language. */ && lang_hooks.decls.warn_unused_global (decl)) warning ((TREE_CODE (decl) == FUNCTION_DECL) @@ -543,38 +551,6 @@ check_global_declaration_1 (tree decl) "%q+D defined but not used", decl); } -/* Issue appropriate warnings for the global declarations in V (of - which there are LEN). */ - -void -check_global_declarations (tree *v, int len) -{ - int i; - - for (i = 0; i < len; i++) - check_global_declaration_1 (v[i]); -} - -/* Emit debugging information for all global declarations in VEC. */ - -void -emit_debug_global_declarations (tree *vec, int len) -{ - int i; - - /* Avoid confusing the debug information machinery when there are errors. */ - if (seen_error ()) - return; - /* No need for debug info in object files when producing slimLTO. */ - if (!in_lto_p && flag_lto && !flag_fat_lto_objects) - return; - - timevar_push (TV_SYMOUT); - for (i = 0; i < len; i++) - debug_hooks->global_decl (vec[i]); - timevar_pop (TV_SYMOUT); -} - /* Compile an entire translation unit. Write a file of assembly output and various debugging dumps. */ @@ -584,8 +560,7 @@ compile_file (void) timevar_start (TV_PHASE_PARSING); timevar_push (TV_PARSE_GLOBAL); - /* Call the parser, which parses the entire file (calling - rest_of_compilation for each function). */ + /* Parse entire file and generate initial debug information. */ lang_hooks.parse_file (); timevar_pop (TV_PARSE_GLOBAL); @@ -602,12 +577,33 @@ compile_file (void) ggc_protect_identifiers = false; - /* This must also call finalize_compilation_unit. */ - lang_hooks.decls.final_write_globals (); + /* Run the actual compilation process. */ + if (!in_lto_p) + { + timevar_start (TV_PHASE_OPT_GEN); + symtab->finalize_compilation_unit (); + timevar_stop (TV_PHASE_OPT_GEN); + } + + /* Perform any post compilation-proper parser cleanups and + processing. This is currently only needed for the C++ parser, + which can be hopefully cleaned up so this hook is no longer + necessary. */ + if (lang_hooks.decls.post_compilation_parsing_cleanups) + lang_hooks.decls.post_compilation_parsing_cleanups (); if (seen_error ()) return; + /* After the parser has generated debugging information, augment + this information with any new location/etc information that may + have become available after the compilation proper. */ + timevar_start (TV_PHASE_DBGINFO); + symtab_node *node; + FOR_EACH_DEFINED_SYMBOL (node) + debug_hooks->late_global_decl (node->decl); + timevar_stop (TV_PHASE_DBGINFO); + timevar_start (TV_PHASE_LATE_ASM); /* Compilation unit is finalized. When producing non-fat LTO object, we are |