aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2015-06-05 18:44:53 +0000
committerAldy Hernandez <aldyh@gcc.gnu.org>2015-06-05 18:44:53 +0000
commitd7438551ff5ffa0afeca2aa3efd13035b26bee34 (patch)
tree906774b04a2315e6e0109ec866407a4b6ee1195f /gcc/ada
parent46ba128114d3fd892b94c3767fb7a681088c7d79 (diff)
downloadgcc-d7438551ff5ffa0afeca2aa3efd13035b26bee34.zip
gcc-d7438551ff5ffa0afeca2aa3efd13035b26bee34.tar.gz
gcc-d7438551ff5ffa0afeca2aa3efd13035b26bee34.tar.bz2
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. From-SVN: r224161
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog14
-rw-r--r--gcc/ada/gcc-interface/decl.c7
-rw-r--r--gcc/ada/gcc-interface/gigi.h5
-rw-r--r--gcc/ada/gcc-interface/misc.c4
-rw-r--r--gcc/ada/gcc-interface/utils.c34
5 files changed, 39 insertions, 25 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index c4c0e0c..e58d7af 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,17 @@
+2015-06-05 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc-interface/gigi.h (note_types_used_by_globals): Rename from
+ gnat_write_global_declarations.
+ * gcc-interface/misc.c (gnat_parse_file): Call
+ note_types_used_by_globals.
+ Remove LANG_HOOKS_WRITE_GLOBALS.
+ * gcc-interface/utils.c: Rename global_decls to type_decls.
+ (gnat_write_global_declarations): Rename
+ to note_types_used_by_globals.
+ Remove call to finalize_compilation_unit.
+ Remove debug_hooks->global_decl() call for globals.
+ (gnat_pushdecls): Only insert into type_decls if TYPE_DECL.
+
2015-06-04 Andrew MacLeod <amacleod@redhat.com>
* gcc-interface/cuintp.c: Adjust includes for restructured coretypes.h.
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index f1ff6fc..42e2cfb 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -5185,6 +5185,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
&& !Present (Alias (gnat_entity))
&& !(Present (Renamed_Object (gnat_entity)) && saved))
{
+ /* ?? DECL_ARTIFICIAL, and possibly DECL_IGNORED_P below, should
+ be set before calling rest_of_decl_compilation above (through
+ create_var_decl_1). This is because rest_of_decl_compilation
+ calls the debugging backend and will create a DIE without
+ DW_AT_artificial.
+
+ This is currently causing gnat.dg/specs/debug1.ads to FAIL. */
if (!Comes_From_Source (gnat_entity))
DECL_ARTIFICIAL (gnu_decl) = 1;
diff --git a/gcc/ada/gcc-interface/gigi.h b/gcc/ada/gcc-interface/gigi.h
index 91d9f9c..b85f351 100644
--- a/gcc/ada/gcc-interface/gigi.h
+++ b/gcc/ada/gcc-interface/gigi.h
@@ -531,8 +531,9 @@ extern tree gnat_type_for_size (unsigned precision, int unsignedp);
an unsigned type; otherwise a signed type is returned. */
extern tree gnat_type_for_mode (machine_mode mode, int unsignedp);
-/* Emit debug info for all global variable declarations. */
-extern void gnat_write_global_declarations (void);
+/* Keep track of types used at the global level and emit debug info
+ for all global types. */
+extern void note_types_used_by_globals (void);
/* Return the unsigned version of a TYPE_NODE, a scalar type. */
extern tree gnat_unsigned_type (tree type_node);
diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c
index 4c2e949..2eef7df 100644
--- a/gcc/ada/gcc-interface/misc.c
+++ b/gcc/ada/gcc-interface/misc.c
@@ -117,6 +117,8 @@ gnat_parse_file (void)
/* Call the front end. */
_ada_gnat1drv ();
+
+ note_types_used_by_globals ();
}
/* Return language mask for option processing. */
@@ -969,8 +971,6 @@ gnat_init_ts (void)
#define LANG_HOOKS_GETDECLS lhd_return_null_tree_v
#undef LANG_HOOKS_PUSHDECL
#define LANG_HOOKS_PUSHDECL gnat_return_tree
-#undef LANG_HOOKS_WRITE_GLOBALS
-#define LANG_HOOKS_WRITE_GLOBALS gnat_write_global_declarations
#undef LANG_HOOKS_GET_ALIAS_SET
#define LANG_HOOKS_GET_ALIAS_SET gnat_get_alias_set
#undef LANG_HOOKS_PRINT_DECL
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index f3d44e9..307a841 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -224,8 +224,8 @@ static GTY((deletable)) struct gnat_binding_level *free_binding_level;
/* The context to be used for global declarations. */
static GTY(()) tree global_context;
-/* An array of global declarations. */
-static GTY(()) vec<tree, va_gc> *global_decls;
+/* An array of global type declarations. */
+static GTY(()) vec<tree, va_gc> *type_decls;
/* An array of builtin function declarations. */
static GTY(()) vec<tree, va_gc> *builtin_decls;
@@ -756,7 +756,10 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
vec_safe_push (builtin_decls, decl);
}
else if (global_bindings_p ())
- vec_safe_push (global_decls, decl);
+ {
+ if (TREE_CODE (decl) == TYPE_DECL)
+ vec_safe_push (type_decls, decl);
+ }
else
{
DECL_CHAIN (decl) = BLOCK_VARS (current_binding_level->block);
@@ -5183,8 +5186,11 @@ smaller_form_type_p (tree type, tree orig_type)
static GTY (()) tree dummy_global;
+/* Keep track of types used at the global level and emit debug info
+ for all global types. */
+
void
-gnat_write_global_declarations (void)
+note_types_used_by_globals (void)
{
unsigned int i;
tree iter;
@@ -5214,26 +5220,12 @@ gnat_write_global_declarations (void)
}
/* Output debug information for all global type declarations first. This
- ensures that global types whose compilation hasn't been finalized yet,
+ ensures that global types whose compilation haven't been finalized yet,
for example pointers to Taft amendment types, have their compilation
finalized in the right context. */
- FOR_EACH_VEC_SAFE_ELT (global_decls, i, iter)
- if (TREE_CODE (iter) == TYPE_DECL && !DECL_IGNORED_P (iter))
+ FOR_EACH_VEC_SAFE_ELT (type_decls, i, iter)
+ if (!DECL_IGNORED_P (iter))
debug_hooks->type_decl (iter, false);
-
- /* Proceed to optimize and emit assembly. */
- symtab->finalize_compilation_unit ();
-
- /* After cgraph has had a chance to emit everything that's going to
- be emitted, output debug information for the rest of globals. */
- if (!seen_error ())
- {
- timevar_push (TV_SYMOUT);
- FOR_EACH_VEC_SAFE_ELT (global_decls, i, iter)
- if (TREE_CODE (iter) != TYPE_DECL && !DECL_IGNORED_P (iter))
- debug_hooks->global_decl (iter);
- timevar_pop (TV_SYMOUT);
- }
}
/* ************************************************************************