Commit bd2b9f1e by Alexandre Oliva Committed by Alexandre Oliva

[LVU] Introduce location views

This patch introduces an option to enable the generation of location
views along with location lists.  The exact format depends on the
DWARF version: it can be a separate attribute (DW_AT_GNU_locviews) or
(DW_LLE_view_pair) entries in DWARF5+ loclists.

Line number tables are also affected.  If the assembler is found, at
compiler build time, to support .loc views, we use them and
assembler-computed view labels, otherwise we output compiler-generated
line number programs with conservatively-computed view labels.  In
either case, we output view information next to line number changes
when verbose assembly output is requested.

This patch requires an LVU patch that modifies the exported API of
final_scan_insn.  It also expects the entire SFN patchset to be
installed first, although SFN is not a requirement for LVU.

for  include/ChangeLog

	* dwarf2.def (DW_AT_GNU_locviews): New.
	* dwarf2.h (enum dwarf_location_list_entry_type): Add
	DW_LLE_GNU_view_pair.
	(DW_LLE_view_pair): Define.

for  gcc/ChangeLog

	* common.opt (gvariable-location-views): New.
	(gvariable-location-views=incompat5): New.
	* config.in: Rebuilt.
	* configure: Rebuilt.
	* configure.ac: Test assembler for view support.
	* dwarf2asm.c (dw2_asm_output_symname_uleb128): New.
	* dwarf2asm.h (dw2_asm_output_symname_uleb128): Declare.
	* dwarf2out.c (var_loc_view): New typedef.
	(struct dw_loc_list_struct): Add vl_symbol, vbegin, vend.
	(dwarf2out_locviews_in_attribute): New.
	(dwarf2out_locviews_in_loclist): New.
	(dw_val_equal_p): Compare val_view_list of dw_val_class_view_lists.
	(enum dw_line_info_opcode): Add LI_adv_address.
	(struct dw_line_info_table): Add view.
	(RESET_NEXT_VIEW, RESETTING_VIEW_P): New macros.
	(DWARF2_ASM_VIEW_DEBUG_INFO): Define default.
	(zero_view_p): New variable.
	(ZERO_VIEW_P): New macro.
	(output_asm_line_debug_info): New.
	(struct var_loc_node): Add view.
	(add_AT_view_list, AT_loc_list): New.
	(add_var_loc_to_decl): Add view param.  Test it against last.
	(new_loc_list): Add view params.  Record them.
	(AT_loc_list_ptr): Handle loc and view lists.
	(view_list_to_loc_list_val_node): New.
	(print_dw_val): Handle dw_val_class_view_list.
	(size_of_die): Likewise.
	(value_format): Likewise.
	(loc_list_has_views): New.
	(gen_llsym): Set vl_symbol too.
	(maybe_gen_llsym, skip_loc_list_entry): New.
	(dwarf2out_maybe_output_loclist_view_pair): New.
	(output_loc_list): Output view list or entries too.
	(output_view_list_offset): New.
	(output_die): Handle dw_val_class_view_list.
	(output_dwarf_version): New.
	(output_compilation_unit_header): Use it.
	(output_skeleton_debug_sections): Likewise.
	(output_rnglists, output_line_info): Likewise.
	(output_pubnames, output_aranges): Update version comments.
	(output_one_line_info_table): Output view numbers in asm comments.
	(dw_loc_list): Determine current endview, pass it to new_loc_list.
	Call maybe_gen_llsym.
	(loc_list_from_tree_1): Adjust.
	(add_AT_location_description): Create view list attribute if
	needed, check it's absent otherwise.
	(convert_cfa_to_fb_loc_list): Adjust.
	(maybe_emit_file): Call output_asm_line_debug_info for test.
	(dwarf2out_var_location): Reset views as needed.  Precompute
	add_var_loc_to_decl args.  Call get_attr_min_length only if we have the
	attribute.  Set view.
	(new_line_info_table): Reset next view.
	(set_cur_line_info_table): Call output_asm_line_debug_info for test.
	(dwarf2out_source_line): Likewise.  Output view resets and labels to
	the assembler, or select appropriate line info opcodes.
	(prune_unused_types_walk_attribs): Handle dw_val_class_view_list.
	(optimize_string_length): Catch it.  Adjust.
	(resolve_addr): Copy vl_symbol along with ll_symbol.  Handle
	dw_val_class_view_list, and remove it if no longer needed.
	(hash_loc_list): Hash view numbers.
	(loc_list_hasher::equal): Compare them.
	(optimize_location_lists): Check whether a view list symbol is
	needed, and whether the locview attribute is present, and
	whether they match.  Remove the locview attribute if no longer
	needed.
	(index_location_lists): Call skip_loc_list_entry for test.
	(dwarf2out_finish): Call output_asm_line_debug_info for test.
	Use output_dwarf_version.
	* dwarf2out.h (enum dw_val_class): Add dw_val_class_view_list.
	(struct dw_val_node): Add val_view_list.
	* final.c (SEEN_NEXT_VIEW): New.
	(set_next_view_needed): New.
	(clear_next_view_needed): New.
	(maybe_output_next_view): New.
	(final_start_function): Rename to...
	(final_start_function_1): ... this.  Take pointer to FIRST,
	add SEEN parameter.  Emit param bindings in the initial view.
	(final_start_function): Reintroduce SEEN-less interface.
	(final): Rename to...
	(final_1): ... this.  Take SEEN parameter.  Output final pending
	next view at the end.
	(final): Reintroduce seen-less interface.
	(final_scan_insn): Output pending next view before switching
	sections or ending a block.  Mark the next view as needed when
	outputting variable locations.  Notify debug backend of section
	changes, and of location view changes.
	(rest_of_handle_final): Adjust.
	* toplev.c (process_options): Autodetect value for debug variable
	location views option.  Warn on incompat5 without -gdwarf-5.
	* doc/invoke.texi (gvariable-location-views): New.
	(gvariable-location-views=incompat5): New.
	(gno-variable-location-views): New.

From-SVN: r257510
parent 6d3aa24c
2018-02-09 Alexandre Oliva <aoliva@redhat.com>
* common.opt (gvariable-location-views): New.
(gvariable-location-views=incompat5): New.
* config.in: Rebuilt.
* configure: Rebuilt.
* configure.ac: Test assembler for view support.
* dwarf2asm.c (dw2_asm_output_symname_uleb128): New.
* dwarf2asm.h (dw2_asm_output_symname_uleb128): Declare.
* dwarf2out.c (var_loc_view): New typedef.
(struct dw_loc_list_struct): Add vl_symbol, vbegin, vend.
(dwarf2out_locviews_in_attribute): New.
(dwarf2out_locviews_in_loclist): New.
(dw_val_equal_p): Compare val_view_list of dw_val_class_view_lists.
(enum dw_line_info_opcode): Add LI_adv_address.
(struct dw_line_info_table): Add view.
(RESET_NEXT_VIEW, RESETTING_VIEW_P): New macros.
(DWARF2_ASM_VIEW_DEBUG_INFO): Define default.
(zero_view_p): New variable.
(ZERO_VIEW_P): New macro.
(output_asm_line_debug_info): New.
(struct var_loc_node): Add view.
(add_AT_view_list, AT_loc_list): New.
(add_var_loc_to_decl): Add view param. Test it against last.
(new_loc_list): Add view params. Record them.
(AT_loc_list_ptr): Handle loc and view lists.
(view_list_to_loc_list_val_node): New.
(print_dw_val): Handle dw_val_class_view_list.
(size_of_die): Likewise.
(value_format): Likewise.
(loc_list_has_views): New.
(gen_llsym): Set vl_symbol too.
(maybe_gen_llsym, skip_loc_list_entry): New.
(dwarf2out_maybe_output_loclist_view_pair): New.
(output_loc_list): Output view list or entries too.
(output_view_list_offset): New.
(output_die): Handle dw_val_class_view_list.
(output_dwarf_version): New.
(output_compilation_unit_header): Use it.
(output_skeleton_debug_sections): Likewise.
(output_rnglists, output_line_info): Likewise.
(output_pubnames, output_aranges): Update version comments.
(output_one_line_info_table): Output view numbers in asm comments.
(dw_loc_list): Determine current endview, pass it to new_loc_list.
Call maybe_gen_llsym.
(loc_list_from_tree_1): Adjust.
(add_AT_location_description): Create view list attribute if
needed, check it's absent otherwise.
(convert_cfa_to_fb_loc_list): Adjust.
(maybe_emit_file): Call output_asm_line_debug_info for test.
(dwarf2out_var_location): Reset views as needed. Precompute
add_var_loc_to_decl args. Call get_attr_min_length only if we have the
attribute. Set view.
(new_line_info_table): Reset next view.
(set_cur_line_info_table): Call output_asm_line_debug_info for test.
(dwarf2out_source_line): Likewise. Output view resets and labels to
the assembler, or select appropriate line info opcodes.
(prune_unused_types_walk_attribs): Handle dw_val_class_view_list.
(optimize_string_length): Catch it. Adjust.
(resolve_addr): Copy vl_symbol along with ll_symbol. Handle
dw_val_class_view_list, and remove it if no longer needed.
(hash_loc_list): Hash view numbers.
(loc_list_hasher::equal): Compare them.
(optimize_location_lists): Check whether a view list symbol is
needed, and whether the locview attribute is present, and
whether they match. Remove the locview attribute if no longer
needed.
(index_location_lists): Call skip_loc_list_entry for test.
(dwarf2out_finish): Call output_asm_line_debug_info for test.
Use output_dwarf_version.
* dwarf2out.h (enum dw_val_class): Add dw_val_class_view_list.
(struct dw_val_node): Add val_view_list.
* final.c (SEEN_NEXT_VIEW): New.
(set_next_view_needed): New.
(clear_next_view_needed): New.
(maybe_output_next_view): New.
(final_start_function): Rename to...
(final_start_function_1): ... this. Take pointer to FIRST,
add SEEN parameter. Emit param bindings in the initial view.
(final_start_function): Reintroduce SEEN-less interface.
(final): Rename to...
(final_1): ... this. Take SEEN parameter. Output final pending
next view at the end.
(final): Reintroduce seen-less interface.
(final_scan_insn): Output pending next view before switching
sections or ending a block. Mark the next view as needed when
outputting variable locations. Notify debug backend of section
changes, and of location view changes.
(rest_of_handle_final): Adjust.
* toplev.c (process_options): Autodetect value for debug variable
location views option. Warn on incompat5 without -gdwarf-5.
* doc/invoke.texi (gvariable-location-views): New.
(gvariable-location-views=incompat5): New.
(gno-variable-location-views): New.
2018-02-08 David Malcolm <dmalcolm@redhat.com>
PR tree-optimization/84136
......
......@@ -2956,6 +2956,13 @@ gtoggle
Common Driver Report Var(flag_gtoggle)
Toggle debug information generation.
gvariable-location-views
Common Driver Var(debug_variable_location_views, 1) Init(2)
Augment variable location lists with progressive views.
gvariable-location-views=incompat5
Common Driver RejectNegative Var(debug_variable_location_views, -1) Init(2)
gvms
Common Driver JoinedOrMissing Negative(gxcoff)
Generate debug information in VMS format.
......
......@@ -358,6 +358,12 @@
#endif
/* Define if your assembler supports views in dwarf2 .loc directives. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_DWARF2_DEBUG_VIEW
#endif
/* Define if your assembler supports the R_PPC64_ENTRY relocation. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_ENTRY_MARKERS
......
......@@ -27825,6 +27825,52 @@ $as_echo "$gcc_cv_as_dwarf2_file_buggy" >&6; }
$as_echo "#define HAVE_AS_DWARF2_DEBUG_LINE 1" >>confdefs.h
if test $gcc_cv_as_leb128 = yes; then
conftest_s="\
.file 1 \"conftest.s\"
.loc 1 3 0 view .LVU1
$insn
.data
.uleb128 .LVU1
.uleb128 .LVU1
"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for dwarf2 debug_view support" >&5
$as_echo_n "checking assembler for dwarf2 debug_view support... " >&6; }
if test "${gcc_cv_as_dwarf2_debug_view+set}" = set; then :
$as_echo_n "(cached) " >&6
else
gcc_cv_as_dwarf2_debug_view=no
if test $in_tree_gas = yes; then
if test $in_tree_gas_is_elf = yes \
&& test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 27 \) \* 1000 + 0`
then gcc_cv_as_dwarf2_debug_view=yes
fi
elif test x$gcc_cv_as != x; then
$as_echo "$conftest_s" > conftest.s
if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }
then
gcc_cv_as_dwarf2_debug_view=yes
else
echo "configure: failed program was" >&5
cat conftest.s >&5
fi
rm -f conftest.o conftest.s
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_dwarf2_debug_view" >&5
$as_echo "$gcc_cv_as_dwarf2_debug_view" >&6; }
if test $gcc_cv_as_dwarf2_debug_view = yes; then
$as_echo "#define HAVE_AS_DWARF2_DEBUG_VIEW 1" >>confdefs.h
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for --gdwarf2 option" >&5
......
......@@ -4902,9 +4902,25 @@ if test x"$insn" != x; then
if test $gcc_cv_as_dwarf2_debug_line = yes \
&& test $gcc_cv_as_dwarf2_file_buggy = no; then
AC_DEFINE(HAVE_AS_DWARF2_DEBUG_LINE, 1,
AC_DEFINE(HAVE_AS_DWARF2_DEBUG_LINE, 1,
[Define if your assembler supports dwarf2 .file/.loc directives,
and preserves file table indices exactly as given.])
if test $gcc_cv_as_leb128 = yes; then
conftest_s="\
.file 1 \"conftest.s\"
.loc 1 3 0 view .LVU1
$insn
.data
.uleb128 .LVU1
.uleb128 .LVU1
"
gcc_GAS_CHECK_FEATURE([dwarf2 debug_view support],
gcc_cv_as_dwarf2_debug_view,
[elf,2,27,0],,[$conftest_s],,
[AC_DEFINE(HAVE_AS_DWARF2_DEBUG_VIEW, 1,
[Define if your assembler supports views in dwarf2 .loc directives.])])
fi
fi
gcc_GAS_CHECK_FEATURE([--gdwarf2 option],
......
......@@ -348,6 +348,7 @@ Objective-C and Objective-C++ Dialects}.
-gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
-gcolumn-info -gno-column-info @gol
-gstatement-frontiers -gno-statement-frontiers @gol
-gvariable-location-views -gno-variable-location-views @gol
-gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
-fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
-fno-eliminate-unused-debug-types @gol
......@@ -7255,6 +7256,34 @@ markers in the line number table. This is enabled by default when
compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
@dots{}), and outputting DWARF 2 debug information at the normal level.
@item -gvariable-location-views
@item -gvariable-location-views=incompat5
@item -gno-variable-location-views
@opindex gvariable-location-views
@opindex gvariable-location-views=incompat5
@opindex gno-variable-location-views
Augment variable location lists with progressive view numbers implied
from the line number table. This enables debug information consumers to
inspect state at certain points of the program, even if no instructions
associated with the corresponding source locations are present at that
point. If the assembler lacks support for view numbers in line number
tables, this will cause the compiler to emit the line number table,
which generally makes them somewhat less compact. The augmented line
number tables and location lists are fully backward-compatible, so they
can be consumed by debug information consumers that are not aware of
these augmentations, but they won't derive any benefit from them either.
This is enabled by default when outputting DWARF 2 debug information at
the normal level, as long as @option{-fvar-tracking-assignments} is
enabled and @option{-gstrict-dwarf} is not.
There is a proposed representation for view numbers that is not backward
compatible with the location list format introduced in DWARF 5, that can
be enabled with @option{-gvariable-location-views=incompat5}. This
option may be removed in the future, is only provided as a reference
implementation of the proposed representation. Debug information
consumers are not expected to support this extended format, and they
would be rendered unable to decode location lists using it.
@item -gz@r{[}=@var{type}@r{]}
@opindex gz
Produce compressed debug sections in DWARF format, if that is supported.
......@@ -767,6 +767,35 @@ dw2_asm_output_data_sleb128 (HOST_WIDE_INT value,
va_end (ap);
}
/* Output symbol LAB1 as an unsigned LEB128 quantity. LAB1 should be
an assembler-computed constant, e.g. a view number, because we
can't have relocations in LEB128 quantities. */
void
dw2_asm_output_symname_uleb128 (const char *lab1 ATTRIBUTE_UNUSED,
const char *comment, ...)
{
va_list ap;
va_start (ap, comment);
#ifdef HAVE_AS_LEB128
fputs ("\t.uleb128 ", asm_out_file);
assemble_name (asm_out_file, lab1);
#else
gcc_unreachable ();
#endif
if (flag_debug_asm && comment)
{
fprintf (asm_out_file, "\t%s ", ASM_COMMENT_START);
vfprintf (asm_out_file, comment, ap);
}
fputc ('\n', asm_out_file);
va_end (ap);
}
void
dw2_asm_output_delta_uleb128 (const char *lab1 ATTRIBUTE_UNUSED,
const char *lab2 ATTRIBUTE_UNUSED,
......
......@@ -70,6 +70,10 @@ extern void dw2_asm_output_data_sleb128 (HOST_WIDE_INT,
const char *, ...)
ATTRIBUTE_NULL_PRINTF_2;
extern void dw2_asm_output_symname_uleb128 (const char *,
const char *, ...)
ATTRIBUTE_NULL_PRINTF_2;
extern void dw2_asm_output_delta_uleb128 (const char *, const char *,
const char *, ...)
ATTRIBUTE_NULL_PRINTF_3;
......
......@@ -160,7 +160,8 @@ enum dw_val_class
dw_val_class_discr_list,
dw_val_class_const_implicit,
dw_val_class_unsigned_const_implicit,
dw_val_class_file_implicit
dw_val_class_file_implicit,
dw_val_class_view_list
};
/* Describe a floating point constant value, or a vector constant value. */
......@@ -203,6 +204,7 @@ struct GTY(()) dw_val_node {
rtx GTY ((tag ("dw_val_class_addr"))) val_addr;
unsigned HOST_WIDE_INT GTY ((tag ("dw_val_class_offset"))) val_offset;
dw_loc_list_ref GTY ((tag ("dw_val_class_loc_list"))) val_loc_list;
dw_die_ref GTY ((tag ("dw_val_class_view_list"))) val_view_list;
dw_loc_descr_ref GTY ((tag ("dw_val_class_loc"))) val_loc;
HOST_WIDE_INT GTY ((default)) val_int;
unsigned HOST_WIDE_INT
......
......@@ -110,6 +110,7 @@ along with GCC; see the file COPYING3. If not see
/* Bitflags used by final_scan_insn. */
#define SEEN_NOTE 1
#define SEEN_EMITTED 2
#define SEEN_NEXT_VIEW 4
/* Last insn processed by final_scan_insn. */
static rtx_insn *debug_insn;
......@@ -1692,6 +1693,67 @@ get_some_local_dynamic_name ()
return 0;
}
/* Arrange for us to emit a source location note before any further
real insns or section changes, by setting the SEEN_NEXT_VIEW bit in
*SEEN, as long as we are keeping track of location views. The bit
indicates we have referenced the next view at the current PC, so we
have to emit it. This should be called next to the var_location
debug hook. */
static inline void
set_next_view_needed (int *seen)
{
if (debug_variable_location_views)
*seen |= SEEN_NEXT_VIEW;
}
/* Clear the flag in *SEEN indicating we need to emit the next view.
This should be called next to the source_line debug hook. */
static inline void
clear_next_view_needed (int *seen)
{
*seen &= ~SEEN_NEXT_VIEW;
}
/* Test whether we have a pending request to emit the next view in
*SEEN, and emit it if needed, clearing the request bit. */
static inline void
maybe_output_next_view (int *seen)
{
if ((*seen & SEEN_NEXT_VIEW) != 0)
{
clear_next_view_needed (seen);
(*debug_hooks->source_line) (last_linenum, last_columnnum,
last_filename, last_discriminator,
false);
}
}
/* We want to emit param bindings (before the first begin_stmt) in the
initial view, if we are emitting views. To that end, we may
consume initial notes in the function, processing them in
final_start_function, before signaling the beginning of the
prologue, rather than in final.
We don't test whether the DECLs are PARM_DECLs: the assumption is
that there will be a NOTE_INSN_BEGIN_STMT marker before any
non-parameter NOTE_INSN_VAR_LOCATION. It's ok if the marker is not
there, we'll just have more variable locations bound in the initial
view, which is consistent with their being bound without any code
that would give them a value. */
static inline bool
in_initial_view_p (rtx_insn *insn)
{
return (!DECL_IGNORED_P (current_function_decl)
&& debug_variable_location_views
&& insn && GET_CODE (insn) == NOTE
&& (NOTE_KIND (insn) == NOTE_INSN_VAR_LOCATION
|| NOTE_KIND (insn) == NOTE_INSN_DELETED));
}
/* Output assembler code for the start of a function,
and initialize some of the variables in this file
for the new function. The label for the function and associated
......@@ -1699,12 +1761,15 @@ get_some_local_dynamic_name ()
FIRST is the first insn of the rtl for the function being compiled.
FILE is the file to write assembler code to.
SEEN should be initially set to zero, and it may be updated to
indicate we have references to the next location view, that would
require us to emit it at the current PC.
OPTIMIZE_P is nonzero if we should eliminate redundant
test and compare insns. */
void
final_start_function (rtx_insn *first, FILE *file,
int optimize_p ATTRIBUTE_UNUSED)
static void
final_start_function_1 (rtx_insn **firstp, FILE *file, int *seen,
int optimize_p ATTRIBUTE_UNUSED)
{
block_depth = 0;
......@@ -1722,8 +1787,21 @@ final_start_function (rtx_insn *first, FILE *file,
if (flag_sanitize & SANITIZE_ADDRESS)
asan_function_start ();
rtx_insn *first = *firstp;
if (in_initial_view_p (first))
{
do
{
final_scan_insn (first, file, 0, 0, seen);
first = NEXT_INSN (first);
}
while (in_initial_view_p (first));
*firstp = first;
}
if (!DECL_IGNORED_P (current_function_decl))
debug_hooks->begin_prologue (last_linenum, last_columnnum, last_filename);
debug_hooks->begin_prologue (last_linenum, last_columnnum,
last_filename);
if (!dwarf2_debug_info_emitted_p (current_function_decl))
dwarf2out_begin_prologue (0, 0, NULL);
......@@ -1799,6 +1877,17 @@ final_start_function (rtx_insn *first, FILE *file,
profile_after_prologue (file);
}
/* This is an exported final_start_function_1, callable without SEEN. */
void
final_start_function (rtx_insn *first, FILE *file,
int optimize_p ATTRIBUTE_UNUSED)
{
int seen = 0;
final_start_function_1 (&first, file, &seen, optimize_p);
gcc_assert (seen == 0);
}
static void
profile_after_prologue (FILE *file ATTRIBUTE_UNUSED)
{
......@@ -1928,11 +2017,10 @@ dump_basic_block_info (FILE *file, rtx_insn *insn, basic_block *start_to_bb,
/* Output assembler code for some insns: all or part of a function.
For description of args, see `final_start_function', above. */
void
final (rtx_insn *first, FILE *file, int optimize_p)
static void
final_1 (rtx_insn *first, FILE *file, int seen, int optimize_p)
{
rtx_insn *insn, *next;
int seen = 0;
/* Used for -dA dump. */
basic_block *start_to_bb = NULL;
......@@ -1999,6 +2087,8 @@ final (rtx_insn *first, FILE *file, int optimize_p)
insn = final_scan_insn (insn, file, optimize_p, 0, &seen);
}
maybe_output_next_view (&seen);
if (flag_debug_asm)
{
free (start_to_bb);
......@@ -2015,6 +2105,23 @@ final (rtx_insn *first, FILE *file, int optimize_p)
delete_insn (insn);
}
}
/* This is an exported final_1, callable without SEEN. */
void
final (rtx_insn *first, FILE *file, int optimize_p)
{
/* Those that use the internal final_start_function_1/final_1 API
skip initial debug bind notes in final_start_function_1, and pass
the modified FIRST to final_1. But those that use the public
final_start_function/final APIs, final_start_function can't move
FIRST because it's not passed by reference, so if they were
skipped there, skip them again here. */
while (in_initial_view_p (first))
first = NEXT_INSN (first);
final_1 (first, file, 0, optimize_p);
}
const char *
get_insn_template (int code, rtx insn)
......@@ -2155,6 +2262,8 @@ final_scan_insn (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
break;
case NOTE_INSN_SWITCH_TEXT_SECTIONS:
maybe_output_next_view (seen);
in_cold_section_p = !in_cold_section_p;
if (in_cold_section_p)
......@@ -2301,6 +2410,8 @@ final_scan_insn (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
break;
case NOTE_INSN_BLOCK_END:
maybe_output_next_view (seen);
if (debug_info_level == DINFO_LEVEL_NORMAL
|| debug_info_level == DINFO_LEVEL_VERBOSE
|| write_symbols == DWARF2_DEBUG
......@@ -2357,7 +2468,10 @@ final_scan_insn (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
case NOTE_INSN_VAR_LOCATION:
case NOTE_INSN_CALL_ARG_LOCATION:
if (!DECL_IGNORED_P (current_function_decl))
debug_hooks->var_location (insn);
{
debug_hooks->var_location (insn);
set_next_view_needed (seen);
}
break;
case NOTE_INSN_BEGIN_STMT:
......@@ -2368,6 +2482,7 @@ final_scan_insn (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
(*debug_hooks->source_line) (last_linenum, last_columnnum,
last_filename, last_discriminator,
true);
clear_next_view_needed (seen);
}
break;
......@@ -2563,6 +2678,10 @@ final_scan_insn (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
switch_to_section (current_function_section ());
if (debug_variable_location_views
&& !DECL_IGNORED_P (current_function_decl))
debug_hooks->var_location (insn);
break;
}
/* Output this line note if it is the first or the last line
......@@ -2575,7 +2694,12 @@ final_scan_insn (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
(*debug_hooks->source_line) (last_linenum, last_columnnum,
last_filename, last_discriminator,
is_stmt);
clear_next_view_needed (seen);
}
else
maybe_output_next_view (seen);
gcc_checking_assert (!DEBUG_INSN_P (insn));
if (GET_CODE (body) == PARALLEL
&& GET_CODE (XVECEXP (body, 0, 0)) == ASM_INPUT)
......@@ -3042,7 +3166,8 @@ final_scan_insn (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
/* Let the debug info back-end know about this call. We do this only
after the instruction has been emitted because labels that may be
created to reference the call instruction must appear after it. */
if (call_insn != NULL && !DECL_IGNORED_P (current_function_decl))
if ((debug_variable_location_views || call_insn != NULL)
&& !DECL_IGNORED_P (current_function_decl))
debug_hooks->var_location (insn);
current_output_insn = debug_insn = 0;
......@@ -4481,8 +4606,10 @@ rest_of_handle_final (void)
delete_vta_debug_insns (false);
assemble_start_function (current_function_decl, fnname);
final_start_function (get_insns (), asm_out_file, optimize);
final (get_insns (), asm_out_file, optimize);
rtx_insn *first = get_insns ();
int seen = 0;
final_start_function_1 (&first, asm_out_file, &seen, optimize);
final_1 (first, asm_out_file, seen, optimize);
if (flag_ipa_ra
&& !lookup_attribute ("noipa", DECL_ATTRIBUTES (current_function_decl)))
collect_fn_hard_reg_usage ();
......
......@@ -1558,6 +1558,22 @@ process_options (void)
|| write_symbols == VMS_AND_DWARF2_DEBUG)
&& !(flag_selective_scheduling || flag_selective_scheduling2));
if (debug_variable_location_views == AUTODETECT_VALUE)
{
debug_variable_location_views = flag_var_tracking
&& debug_info_level >= DINFO_LEVEL_NORMAL
&& (write_symbols == DWARF2_DEBUG
|| write_symbols == VMS_AND_DWARF2_DEBUG)
&& !dwarf_strict;
}
else if (debug_variable_location_views == -1 && dwarf_version != 5)
{
warning_at (UNKNOWN_LOCATION, 0,
"without -gdwarf-5, -gvariable-location-views=incompat5 "
"is equivalent to -gvariable-location-views");
debug_variable_location_views = 1;
}
if (flag_tree_cselim == AUTODETECT_VALUE)
{
if (HAVE_conditional_move)
......
2018-02-09 Alexandre Oliva <aoliva@redhat.com>
* dwarf2.def (DW_AT_GNU_locviews): New.
* dwarf2.h (enum dwarf_location_list_entry_type): Add
DW_LLE_GNU_view_pair.
(DW_LLE_view_pair): Define.
2018-01-03 Jakub Jelinek <jakub@redhat.com>
Update copyright years.
......
......@@ -443,6 +443,7 @@ DW_AT (DW_AT_GNU_pubtypes, 0x2135)
/* Attribute for discriminator.
See http://gcc.gnu.org/wiki/Discriminator */
DW_AT (DW_AT_GNU_discriminator, 0x2136)
DW_AT (DW_AT_GNU_locviews, 0x2137)
/* VMS extensions. */
DW_AT (DW_AT_VMS_rtnbeg_pd_address, 0x2201)
/* GNAT extensions. */
......
......@@ -298,6 +298,14 @@ enum dwarf_location_list_entry_type
DW_LLE_start_end = 0x07,
DW_LLE_start_length = 0x08,
/* <http://lists.dwarfstd.org/private.cgi/dwarf-discuss-dwarfstd.org/2017-April/004347.html>
has the proposal for now; only available to list members.
A (possibly updated) copy of the proposal is available at
<http://people.redhat.com/aoliva/papers/sfn/dwarf6-sfn-lvu.txt>. */
DW_LLE_GNU_view_pair = 0x09,
#define DW_LLE_view_pair DW_LLE_GNU_view_pair
/* Former extension for Fission.
See http://gcc.gnu.org/wiki/DebugFission. */
DW_LLE_GNU_end_of_list_entry = 0x00,
......
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