summaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authoraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-05 18:44:53 +0000
committeraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-05 18:44:53 +0000
commit3a1c9df24981c5068334726a0d92fd80c455eb6e (patch)
tree906774b04a2315e6e0109ec866407a4b6ee1195f /gcc/c
parentd51560f9afc5c8a826bcfa6fc90a96156b623559 (diff)
downloadgcc-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/c')
-rw-r--r--gcc/c/ChangeLog14
-rw-r--r--gcc/c/c-decl.c68
-rw-r--r--gcc/c/c-objc-common.c2
-rw-r--r--gcc/c/c-objc-common.h2
-rw-r--r--gcc/c/c-tree.h1
5 files changed, 37 insertions, 50 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index b933e5bc003..d37a3ab09f1 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,17 @@
+2015-06-05 Aldy Hernandez <aldyh@redhat.com>
+
+ * c-decl.c (finish_struct): Save C_TYPE_INCOMPLETE_VARS and
+ immediately clobber it.
+ (c_write_global_declarations_1): Remove call to
+ check_global_declaration_1.
+ (c_write_global_declarations_2): Remove.
+ (c_write_final_cleanups): Rename from c_write_global_declarations.
+ Remove call to finalize_compilation_unit.
+ Remove calls to debugging hooks.
+ * c-objc-common.c: Adjust comment for c_warn_unused_global_decl.
+ * c-objc-common.h: Remove LANG_HOOKS_WRITE_GLOBALS.
+ * c-tree.h: Remove c_write_global_declarations.
+
2015-06-04 Andrew MacLeod <amacleod@redhat.com>
* c-array-notation.c: Adjust includes for restructured coretypes.h.
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 8a0be2857a6..77d1de9adbb 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -7837,10 +7837,18 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
}
/* If this structure or union completes the type of any previous
- variable declaration, lay it out and output its rtl. */
- for (x = C_TYPE_INCOMPLETE_VARS (TYPE_MAIN_VARIANT (t));
- x;
- x = TREE_CHAIN (x))
+ variable declaration, lay it out and output its rtl.
+
+ Note: C_TYPE_INCOMPLETE_VARS overloads TYPE_VFIELD which is used
+ in dwarf2out via rest_of_decl_compilation below and means
+ something totally different. Since we will be clearing
+ C_TYPE_INCOMPLETE_VARS shortly after we iterate through them,
+ clear it ahead of time and avoid problems in dwarf2out. Ideally,
+ C_TYPE_INCOMPLETE_VARS should use some language specific
+ node. */
+ tree incomplete_vars = C_TYPE_INCOMPLETE_VARS (TYPE_MAIN_VARIANT (t));
+ C_TYPE_INCOMPLETE_VARS (TYPE_MAIN_VARIANT (t)) = 0;
+ for (x = incomplete_vars; x; x = TREE_CHAIN (x))
{
tree decl = TREE_VALUE (x);
if (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
@@ -7853,7 +7861,6 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
rest_of_decl_compilation (decl, toplevel, 0);
}
}
- C_TYPE_INCOMPLETE_VARS (TYPE_MAIN_VARIANT (t)) = 0;
/* Update type location to the one of the definition, instead of e.g.
a forward declaration. */
@@ -10679,9 +10686,8 @@ finish_declspecs (struct c_declspecs *specs)
return specs;
}
-/* A subroutine of c_write_global_declarations. Perform final processing
- on one file scope's declarations (or the external scope's declarations),
- GLOBALS. */
+/* Perform final processing on one file scope's declarations (or the
+ external scope's declarations), GLOBALS. */
static void
c_write_global_declarations_1 (tree globals)
@@ -10694,7 +10700,7 @@ c_write_global_declarations_1 (tree globals)
{
/* Check for used but undefined static functions using the C
standard's definition of "used", and set TREE_NO_WARNING so
- that check_global_declarations doesn't repeat the check. */
+ that check_global_declaration doesn't repeat the check. */
if (TREE_CODE (decl) == FUNCTION_DECL
&& DECL_INITIAL (decl) == 0
&& DECL_EXTERNAL (decl)
@@ -10715,21 +10721,6 @@ c_write_global_declarations_1 (tree globals)
reconsider |= wrapup_global_declaration_2 (decl);
}
while (reconsider);
-
- for (decl = globals; decl; decl = DECL_CHAIN (decl))
- check_global_declaration_1 (decl);
-}
-
-/* A subroutine of c_write_global_declarations Emit debug information for each
- of the declarations in GLOBALS. */
-
-static void
-c_write_global_declarations_2 (tree globals)
-{
- tree decl;
-
- for (decl = globals; decl ; decl = DECL_CHAIN (decl))
- debug_hooks->global_decl (decl);
}
/* Callback to collect a source_ref from a DECL. */
@@ -10779,8 +10770,11 @@ for_each_global_decl (void (*callback) (tree decl))
callback (decl);
}
+/* Perform any final parser cleanups and generate initial debugging
+ information. */
+
void
-c_write_global_declarations (void)
+c_parse_final_cleanups (void)
{
tree t;
unsigned i;
@@ -10789,6 +10783,7 @@ c_write_global_declarations (void)
if (pch_file)
return;
+ timevar_stop (TV_PHASE_PARSING);
timevar_start (TV_PHASE_DEFERRED);
/* Do the Objective-C stuff. This is where all the Objective-C
@@ -10827,34 +10822,15 @@ c_write_global_declarations (void)
}
/* Process all file scopes in this compilation, and the external_scope,
- through wrapup_global_declarations and check_global_declarations. */
+ through wrapup_global_declarations. */
FOR_EACH_VEC_ELT (*all_translation_units, i, t)
c_write_global_declarations_1 (BLOCK_VARS (DECL_INITIAL (t)));
c_write_global_declarations_1 (BLOCK_VARS (ext_block));
timevar_stop (TV_PHASE_DEFERRED);
- timevar_start (TV_PHASE_OPT_GEN);
-
- /* We're done parsing; proceed to optimize and emit assembly.
- FIXME: shouldn't be the front end's responsibility to call this. */
- symtab->finalize_compilation_unit ();
-
- timevar_stop (TV_PHASE_OPT_GEN);
- timevar_start (TV_PHASE_DBGINFO);
-
- /* After cgraph has had a chance to emit everything that's going to
- be emitted, output debug information for globals. */
- if (!seen_error ())
- {
- timevar_push (TV_SYMOUT);
- 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));
- timevar_pop (TV_SYMOUT);
- }
+ timevar_start (TV_PHASE_PARSING);
ext_block = NULL;
- timevar_stop (TV_PHASE_DBGINFO);
}
/* Register reserved keyword WORD as qualifier for address space AS. */
diff --git a/gcc/c/c-objc-common.c b/gcc/c/c-objc-common.c
index d77e9c23d6e..68ba65f2e03 100644
--- a/gcc/c/c-objc-common.c
+++ b/gcc/c/c-objc-common.c
@@ -49,7 +49,7 @@ c_missing_noreturn_ok_p (tree decl)
return flag_hosted && MAIN_NAME_P (DECL_ASSEMBLER_NAME (decl));
}
-/* Called from check_global_declarations. */
+/* Called from check_global_declaration. */
bool
c_warn_unused_global_decl (const_tree decl)
diff --git a/gcc/c/c-objc-common.h b/gcc/c/c-objc-common.h
index 84243c8dd7d..50c9f54998c 100644
--- a/gcc/c/c-objc-common.h
+++ b/gcc/c/c-objc-common.h
@@ -92,8 +92,6 @@ along with GCC; see the file COPYING3. If not see
#undef LANG_HOOKS_GETDECLS
#define LANG_HOOKS_GETDECLS lhd_return_null_tree_v
-#undef LANG_HOOKS_WRITE_GLOBALS
-#define LANG_HOOKS_WRITE_GLOBALS c_write_global_declarations
/* Hooks for tree gimplification. */
#undef LANG_HOOKS_GIMPLIFY_EXPR
diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h
index 7a7266500b1..28b58c636e4 100644
--- a/gcc/c/c-tree.h
+++ b/gcc/c/c-tree.h
@@ -695,7 +695,6 @@ typedef void c_binding_oracle_function (enum c_oracle_request, tree identifier);
extern c_binding_oracle_function *c_binding_oracle;
extern void c_finish_incomplete_decl (tree);
-extern void c_write_global_declarations (void);
extern tree c_omp_reduction_id (enum tree_code, tree);
extern tree c_omp_reduction_decl (tree);
extern tree c_omp_reduction_lookup (tree, tree);