aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c62
1 files changed, 41 insertions, 21 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 2e8fe614188..341efac767f 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -1812,7 +1812,7 @@ output_call_frame_info (for_eh)
dw_fde_ref fde;
dw_cfi_ref cfi;
char l1[20], l2[20], section_start_label[20];
- int any_lsda_needed = 0;
+ bool any_lsda_needed = false;
char augmentation[6];
int augmentation_size;
int fde_encoding = DW_EH_PE_absptr;
@@ -1823,17 +1823,19 @@ output_call_frame_info (for_eh)
if (fde_table_in_use == 0)
return;
- /* If we don't have any functions we'll want to unwind out of, don't emit any
- EH unwind information. */
+ /* If we don't have any functions we'll want to unwind out of, don't
+ emit any EH unwind information. Note that if exceptions aren't
+ enabled, we won't have collected nothrow information, and if we
+ asked for asynchronous tables, we always want this info. */
if (for_eh)
{
- int any_eh_needed = flag_asynchronous_unwind_tables;
+ bool any_eh_needed = !flag_exceptions || flag_asynchronous_unwind_tables;
for (i = 0; i < fde_table_in_use; i++)
if (fde_table[i].uses_eh_lsda)
- any_eh_needed = any_lsda_needed = 1;
+ any_eh_needed = any_lsda_needed = true;
else if (! fde_table[i].nothrow)
- any_eh_needed = 1;
+ any_eh_needed = true;
if (! any_eh_needed)
return;
@@ -1971,7 +1973,7 @@ output_call_frame_info (for_eh)
fde = &fde_table[i];
/* Don't emit EH unwind info for leaf functions that don't need it. */
- if (!flag_asynchronous_unwind_tables && for_eh
+ if (for_eh && !flag_asynchronous_unwind_tables && flag_exceptions
&& (fde->nothrow || fde->all_throwers_are_sibcalls)
&& !fde->uses_eh_lsda)
continue;
@@ -8177,6 +8179,11 @@ mem_loc_descriptor (rtl, mode)
add_loc_descr (&mem_loc_result, new_loc_descr (DW_OP_deref, 0, 0));
break;
+ case LO_SUM:
+ rtl = XEXP (rtl, 1);
+
+ /* ... fall through ... */
+
case LABEL_REF:
/* Some ports can transform a symbol ref into a label ref, because
the symbol ref is too far away and has to be dumped into a constant
@@ -9242,13 +9249,17 @@ rtl_for_decl_location (decl)
rtl = DECL_RTL_IF_SET (decl);
/* When generating abstract instances, ignore everything except
- constants and symbols living in memory. */
+ constants, symbols living in memory, and symbols living in
+ fixed registers. */
if (! reload_completed)
{
if (rtl
&& (CONSTANT_P (rtl)
|| (GET_CODE (rtl) == MEM
- && CONSTANT_P (XEXP (rtl, 0)))))
+ && CONSTANT_P (XEXP (rtl, 0)))
+ || (GET_CODE (rtl) == REG
+ && TREE_CODE (decl) == VAR_DECL
+ && TREE_STATIC (decl))))
{
#ifdef ASM_SIMPLIFY_DWARF_ADDR
rtl = ASM_SIMPLIFY_DWARF_ADDR (rtl);
@@ -11473,20 +11484,12 @@ gen_type_die (type, context_die)
if (type == NULL_TREE || type == error_mark_node)
return;
- /* We are going to output a DIE to represent the unqualified version
- of this type (i.e. without any const or volatile qualifiers) so
- get the main variant (i.e. the unqualified version) of this type
- now. (Vectors are special because the debugging info is in the
- cloned type itself). */
- if (TREE_CODE (type) != VECTOR_TYPE)
- type = type_main_variant (type);
-
- if (TREE_ASM_WRITTEN (type))
- return;
-
if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
&& DECL_ORIGINAL_TYPE (TYPE_NAME (type)))
{
+ if (TREE_ASM_WRITTEN (type))
+ return;
+
/* Prevent broken recursion; we can't hand off to the same type. */
if (DECL_ORIGINAL_TYPE (TYPE_NAME (type)) == type)
abort ();
@@ -11496,6 +11499,17 @@ gen_type_die (type, context_die)
return;
}
+ /* We are going to output a DIE to represent the unqualified version
+ of this type (i.e. without any const or volatile qualifiers) so
+ get the main variant (i.e. the unqualified version) of this type
+ now. (Vectors are special because the debugging info is in the
+ cloned type itself). */
+ if (TREE_CODE (type) != VECTOR_TYPE)
+ type = type_main_variant (type);
+
+ if (TREE_ASM_WRITTEN (type))
+ return;
+
switch (TREE_CODE (type))
{
case ERROR_MARK:
@@ -11799,6 +11813,10 @@ decls_for_scope (stmt, context_die, depth)
gen_decl_die (decl, context_die);
}
+ /* If we're at -g1, we're not interested in subblocks. */
+ if (debug_info_level <= DINFO_LEVEL_TERSE)
+ return;
+
/* Output the DIEs to represent all sub-blocks (and the items declared
therein) of this block. */
for (subblocks = BLOCK_SUBBLOCKS (stmt);
@@ -12076,7 +12094,9 @@ dwarf2out_decl (decl)
/* If we're a nested function, initially use a parent of NULL; if we're
a plain function, this will be fixed up in decls_for_scope. If
we're a method, it will be ignored, since we already have a DIE. */
- if (decl_function_context (decl))
+ if (decl_function_context (decl)
+ /* But if we're in terse mode, we don't care about scope. */
+ && debug_info_level > DINFO_LEVEL_TERSE)
context_die = NULL;
break;