Commit 321e76fb by Richard Biener Committed by Richard Biener

dwarf2out.c (early_dwarf_finished): New global.

2016-09-16  Richard Biener  <rguenther@suse.de>

	* dwarf2out.c (early_dwarf_finished): New global.
	(set_early_dwarf::set_early_dwarf): Assert early_dwarf_finished
	is false.
	(dwarf2out_early_finish): Set early_dwarf_finished at the end,
	if called from LTO exit early.
	(dwarf2out_late_global_decl): When being during the early
	debug phase do not add locations but only const value attributes.
	Adjust the way we generate early DIEs for LTO.

	lto/
	* lto.c (lto_main): Invoke early_finish debug hook.

From-SVN: r240228
parent ae527639
2016-09-19 Richard Biener <rguenther@suse.de> 2016-09-19 Richard Biener <rguenther@suse.de>
* dwarf2out.c (early_dwarf_finished): New global.
(set_early_dwarf::set_early_dwarf): Assert early_dwarf_finished
is false.
(dwarf2out_early_finish): Set early_dwarf_finished at the end,
if called from LTO exit early.
(dwarf2out_late_global_decl): When being during the early
debug phase do not add locations but only const value attributes.
Adjust the way we generate early DIEs for LTO.
2016-09-19 Richard Biener <rguenther@suse.de>
PR middle-end/77605 PR middle-end/77605
* tree-data-ref.c (analyze_subscript_affine_affine): Use the * tree-data-ref.c (analyze_subscript_affine_affine): Use the
proper niter to bound the loops. proper niter to bound the loops.
......
...@@ -2711,9 +2711,14 @@ die_node; ...@@ -2711,9 +2711,14 @@ die_node;
/* Set to TRUE while dwarf2out_early_global_decl is running. */ /* Set to TRUE while dwarf2out_early_global_decl is running. */
static bool early_dwarf; static bool early_dwarf;
static bool early_dwarf_finished;
struct set_early_dwarf { struct set_early_dwarf {
bool saved; bool saved;
set_early_dwarf () : saved(early_dwarf) { early_dwarf = true; } set_early_dwarf () : saved(early_dwarf)
{
gcc_assert (! early_dwarf_finished);
early_dwarf = true;
}
~set_early_dwarf () { early_dwarf = saved; } ~set_early_dwarf () { early_dwarf = saved; }
}; };
...@@ -23878,18 +23883,31 @@ dwarf2out_early_global_decl (tree decl) ...@@ -23878,18 +23883,31 @@ dwarf2out_early_global_decl (tree decl)
static void static void
dwarf2out_late_global_decl (tree decl) dwarf2out_late_global_decl (tree decl)
{ {
/* We have to generate early debug late for LTO. */ /* Fill-in any location information we were unable to determine
if (in_lto_p) on the first pass. */
dwarf2out_early_global_decl (decl);
/* Fill-in any location information we were unable to determine
on the first pass. */
if (TREE_CODE (decl) == VAR_DECL if (TREE_CODE (decl) == VAR_DECL
&& !POINTER_BOUNDS_P (decl)) && !POINTER_BOUNDS_P (decl))
{ {
dw_die_ref die = lookup_decl_die (decl); dw_die_ref die = lookup_decl_die (decl);
/* We have to generate early debug late for LTO. */
if (! die && in_lto_p)
{
dwarf2out_decl (decl);
die = lookup_decl_die (decl);
}
if (die) if (die)
add_location_or_const_value_attribute (die, decl, false); {
/* We get called during the early debug phase via the symtab
code invoking late_global_decl for symbols that are optimized
out. When the early phase is not finished, do not add
locations. */
if (! early_dwarf_finished)
tree_add_const_value_attribute_for_decl (die, decl);
else
add_location_or_const_value_attribute (die, decl, false);
}
} }
} }
...@@ -28137,6 +28155,14 @@ dwarf2out_early_finish (void) ...@@ -28137,6 +28155,14 @@ dwarf2out_early_finish (void)
{ {
set_early_dwarf s; set_early_dwarf s;
/* With LTO early dwarf was really finished at compile-time, so make
sure to adjust the phase after annotating the LTRANS CU DIE. */
if (in_lto_p)
{
early_dwarf_finished = true;
return;
}
/* Walk through the list of incomplete types again, trying once more to /* Walk through the list of incomplete types again, trying once more to
emit full debugging info for them. */ emit full debugging info for them. */
retry_incomplete_types (); retry_incomplete_types ();
...@@ -28163,6 +28189,9 @@ dwarf2out_early_finish (void) ...@@ -28163,6 +28189,9 @@ dwarf2out_early_finish (void)
} }
} }
deferred_asm_name = NULL; deferred_asm_name = NULL;
/* The early debug phase is now finished. */
early_dwarf_finished = true;
} }
/* Reset all state within dwarf2out.c so that we can rerun the compiler /* Reset all state within dwarf2out.c so that we can rerun the compiler
......
2016-09-19 Richard Biener <rguenther@suse.de>
* lto.c (lto_main): Invoke early_finish debug hook.
2016-07-25 Richard Biener <rguenther@suse.de> 2016-07-25 Richard Biener <rguenther@suse.de>
* lto.c (compare_tree_sccs_1): Remove streamer_handle_as_builtin_p uses. * lto.c (compare_tree_sccs_1): Remove streamer_handle_as_builtin_p uses.
......
...@@ -3315,6 +3315,9 @@ lto_main (void) ...@@ -3315,6 +3315,9 @@ lto_main (void)
if (!flag_ltrans) if (!flag_ltrans)
lto_promote_statics_nonwpa (); lto_promote_statics_nonwpa ();
/* Annotate the CU DIE and mark the early debug phase as finished. */
debug_hooks->early_finish ();
/* Let the middle end know that we have read and merged all of /* Let the middle end know that we have read and merged all of
the input files. */ the input files. */
symtab->compile (); symtab->compile ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment