diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2017-12-12 02:16:07 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2017-12-12 02:16:07 +0000 |
commit | 96a95ac18c2fe573d9c5039be18cf7c6cb26f171 (patch) | |
tree | b00f1071af75663b02d851d1219441346ab742ad /gcc/doc | |
parent | eb8b347423582a66758699748ffc3c499f6bdde2 (diff) | |
download | gcc-96a95ac18c2fe573d9c5039be18cf7c6cb26f171.zip gcc-96a95ac18c2fe573d9c5039be18cf7c6cb26f171.tar.gz gcc-96a95ac18c2fe573d9c5039be18cf7c6cb26f171.tar.bz2 |
[SFN] introduce statement frontier notes, still disabled
This patch completes the infrastructure for the introduction of
statement frontiers in C-family languages.
It brings in all the code remaining code needed to introduce and
transform begin stmt trees, gimple stmts, insns and notes, and
ultimately use them to generate the is_stmt column in DWARF2+ line
number tables/programs, however none of it is activated: the option
that would do so will be introduced in a subsequent patch.
This patch depends on an earlier patch with not-quite-boilerplate
changes towards SFN.
for gcc/c-family/ChangeLog
* c-semantics.c (pop_stmt_list): Move begin stmt marker into
subsequent statement list.
for gcc/c/ChangeLog
* c-objc-common.h (LANG_HOOKS_EMITS_BEGIN_STMT): Redefine as true.
* c-parser.c (add_debug_begin_stmt): New.
(c_parser_declaration_or_fndef): Call it.
(c_parser_compound_statement_nostart): Likewise.
(c_parser_statement_after_labels): Likewise.
* c-typeck (c_finish_stmt_expr): Skip begin stmts markers.
for gcc/cp/ChangeLog
* constexpr.c (check_constexpr_ctor_body_1): Skip begin stmt
markers.
(constexpr_fn_retval): Likewise.
(potential_constant_expression_1): Likewise.
(cxx_eval_statement_list): Check that a begin stmt marker is
not used as the value of a statement list.
(cxx_eval_constant_expression): Return begin stmt markers
unchanged.
* cp-array-notation.c (stmt_location): New.
(cp_expand_cond_array_notations): Use it.
* cp-objcp-common.h (LANG_HOOKS_EMITS_BEGIN_STMT): Redefine as true.
* parser.c (add_debug_begin_stmt): New.
(cp_parser_statement): Call it.
* pt.c (tsubst_copy): Handle begin stmt markers.
for gcc/ChangeLog
* cfgexpand.c (expand_gimple_basic_block): Handle begin stmt
markers. Integrate source bind into debug stmt expand loop.
(pass_expand::execute): Check debug marker limit. Avoid deep
TER and expand debug locations for debug bind insns only.
* cse.c (insn_live_p): Keep nonbind markers and debug bindings
followed by them.
* df-scan.c (df_insn_delete): Accept out-of-block debug insn.
* final.c (reemit_insn_block_notes): Take current block from
nonbind markers. Declare note where it's first set.
(final_scan_insn): Handle begin stmt notes. Emit is_stmt according to
begin stmt markers if enabled.
(notice_source_line): Handle nonbind markers. Fail if their
location is unknown or that of builtins.
(rest_of_handle_final): Convert begin stmt markers to notes if
var-tracking didn't run.
(rest_of_clean_state): Skip begin stmt markers.
* gimple-pretty-print.c (dump_gimple_debug): Handle begin stmt
markers.
* function.c (allocate_struct_function): Set begin_stmt_markers.
* function.h (struct function): Add debug_marker_count counter
and debug_nonbind_markers flag.
* gimple-iterator.c (gsi_remove): Adjust debug_marker_count.
* gimple-low.c (lower_function_body): Adjust
debug_nonbind_markers.
(lower_stmt): Drop or skip gimple debug stmts.
(lower_try_catch): Skip debug stmts.
* gimple.c (gimple_build_debug_begin_stmt): New.
(gimple_copy): Increment debug_marker_count if copying one.
* gimple.h (gimple_build_debug_begin_stmt): Declare.
* gimplify.c (rexpr_location): New.
(rexpr_has_location): New.
(warn_switch_unreachable_r): Handle gimple debug stmts.
(shortcut_cond_r): Call expr_location.
(find_goto): New.
(find_goto_label): New.
(shortcut_cond_expr): Call expr_has_location, expr_location, and
find_goto_label.
(gimplify_cond_expr): Call find_goto_label, expr_has_location, and
expr_location.
(gimplify_expr): Handle begin stmt markers. Reject debug expr decls.
* langhooks-def.h (LANG_HOOKS_EMITS_BEGIN_STMT): New. Add to...
(LANG_HOOKS_INITIALIZER): ... this.
* langhooks.h (struct lang_hooks): Add emits_begin_stmt.
* lra-contraints.c (inherit_reload_reg): Tolerate between-blocks
debug insns.
(update_ebb_live_info): Skip debug insn markers.
* lra.c (debug_insn_static_data): Rename to...
(debug_bind_static_data): ... this.
(debug_marker_static_data): New.
(lra_set_insn_recog_data): Select one of the above depending
on debug insn kind.
(lra_update_isn_regno_info): Don't assume debug insns have
freqs.
(push_insns): Skip debug insns.
* lto-streamer-in.c (input_function): Drop debug stmts
depending on active options. Adjust debug_nonbind_markers.
* params.def (PARAM_MAX_DEBUG_MARKER_COUNT): New.
* print-rtl.c (rtx_writer::print_rtx_operand_code_0): Handle
begin stmt marker notes.
(print_insn): Likewise.
* recog.c (extract_insn): Recognize rtl for debug markers.
* rtl.def (DEBUG_MARKER): New.
* tree-inline.c: Include params.h.
(remap_gimple_stmt): Handle nonbind markers.
(maybe_move_debug_stmts_to_successors): Likewise.
(copy_debug_stmt): Likewise.
* tree-iterator.c (append_to_statement_list_1): Append begin stmt
markers regardless of no side effects.
(tsi_link_before): Don't update container's side effects when adding
a begin stmt marker.
(tsi_link_after): Likewise.
(expr_first): Skip begin stmt markers.
(expr_last): Likewise.
* tree-pretty-print (dump_generic_node): Handle begin stmt markers.
* tree-ssa-threadedge.c (propagate_threaded_block_debug_info):
Disregard nonbind markers.
* tree.c (make_node_stat): Don't set side effects for begin stmt
markers.
(build1_stat): Likewise.
* tree.def (DEBUG_BEGIN_STMT): New.
* tree.h (GOTO_DESTINATION): Require a GOTO_EXPR.
* var-tracking.c (delete_debug_insns): Renamed to...
(delete_vta_debug_insns): ... this.
(reemit_marker_as_note): New.
(vt_initialize): Reemit markers.
(delete_vta_debug_insns): Likewise.
(vt_debug_insns_local): Reemit or delete markers.
(variable_tracking_main_1): Likewise.
* doc/generic.texi (DEBUG_BEGIN_STMT): Document.
* doc/gimple.texi (gimple_debug_begin_stmt_p): New.
(gimple_debug_nonbind_marker_p): New.
(gimple_build_debug_bind): Adjust.
(gimple_build_debug_begin_stmt): New.
* doc/invoke.texi (max-debug-marker-count): New param.
* doc/rtl.texi (debug_implicit_ptr, entry_value): New.
(debug_parameter_ref, debug_marker): New.
(NOTE_INSN_BEGIN_STMT): New.
(DEBUG_INSN): Describe begin stmt markers.
From-SVN: r255568
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/generic.texi | 5 | ||||
-rw-r--r-- | gcc/doc/gimple.texi | 24 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 7 | ||||
-rw-r--r-- | gcc/doc/rtl.texi | 53 |
4 files changed, 79 insertions, 10 deletions
diff --git a/gcc/doc/generic.texi b/gcc/doc/generic.texi index 75c448e..b01cdaa 100644 --- a/gcc/doc/generic.texi +++ b/gcc/doc/generic.texi @@ -2006,6 +2006,11 @@ case 2 ... 5: The first value will be @code{CASE_LOW}, while the second will be @code{CASE_HIGH}. +@item DEBUG_BEGIN_STMT + +Marks the beginning of a source statement, for purposes of debug +information generation. + @end table diff --git a/gcc/doc/gimple.texi b/gcc/doc/gimple.texi index fa98800..4926787 100644 --- a/gcc/doc/gimple.texi +++ b/gcc/doc/gimple.texi @@ -831,6 +831,16 @@ expression to a variable. Return true if g is any of the OpenMP codes. @end deftypefn +@deftypefn {GIMPLE function} gimple_debug_begin_stmt_p (gimple g) +Return true if g is a @code{GIMPLE_DEBUG} that marks the beginning of +a source statement. +@end deftypefn + +@deftypefn {GIMPLE function} gimple_debug_nonbind_marker_p (gimple g) +Return true if g is a @code{GIMPLE_DEBUG} that marks a program location, +without any variable binding. +@end deftypefn + @node Manipulating GIMPLE statements @section Manipulating GIMPLE statements @cindex Manipulating GIMPLE statements @@ -1530,10 +1540,11 @@ Set the conditional @code{COND_STMT} to be of the form 'if (1 == 1)'. @subsection @code{GIMPLE_DEBUG} @cindex @code{GIMPLE_DEBUG} @cindex @code{GIMPLE_DEBUG_BIND} +@cindex @code{GIMPLE_DEBUG_BEGIN_STMT} @deftypefn {GIMPLE function} gdebug *gimple_build_debug_bind (tree var, @ tree value, gimple stmt) -Build a @code{GIMPLE_DEBUG} statement with @code{GIMPLE_DEBUG_BIND} of +Build a @code{GIMPLE_DEBUG} statement with @code{GIMPLE_DEBUG_BIND} @code{subcode}. The effect of this statement is to tell debug information generation machinery that the value of user variable @code{var} is given by @code{value} at that point, and to remain with @@ -1604,6 +1615,17 @@ Return @code{TRUE} if @code{stmt} binds a user variable to a value, and @code{FALSE} if it unbinds the variable. @end deftypefn +@deftypefn {GIMPLE function} gimple gimple_build_debug_begin_stmt (tree block, location_t location) +Build a @code{GIMPLE_DEBUG} statement with +@code{GIMPLE_DEBUG_BEGIN_STMT} @code{subcode}. The effect of this +statement is to tell debug information generation machinery that the +user statement at the given @code{location} and @code{block} starts at +the point at which the statement is inserted. The intent is that side +effects (e.g. variable bindings) of all prior user statements are +observable, and that none of the side effects of subsequent user +statements are. +@end deftypefn + @node @code{GIMPLE_EH_FILTER} @subsection @code{GIMPLE_EH_FILTER} @cindex @code{GIMPLE_EH_FILTER} diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 1413095..189b3e4 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -10609,6 +10609,13 @@ debug information may end up not being used; setting this higher may enable the compiler to find more complex debug expressions, but compile time and memory use may grow. The default is 12. +@item max-debug-marker-count +Sets a threshold on the number of debug markers (e.g. begin stmt +markers) to avoid complexity explosion at inlining or expanding to RTL. +If a function has more such gimple stmts than the set limit, such stmts +will be dropped from the inlined copy of a function, and from its RTL +expansion. The default is 100000. + @item min-nondebug-insn-uid Use uids starting at this parameter for nondebug insns. The range below the parameter is reserved exclusively for debug insns created by diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi index a58eedc..dd3c0d3 100644 --- a/gcc/doc/rtl.texi +++ b/gcc/doc/rtl.texi @@ -3448,6 +3448,25 @@ Stands for the value bound to the @code{DEBUG_EXPR_DECL} @var{decl}, that points back to it, within value expressions in @code{VAR_LOCATION} nodes. +@findex debug_implicit_ptr +@item (debug_implicit_ptr:@var{mode} @var{decl}) +Stands for the location of a @var{decl} that is no longer addressable. + +@findex entry_value +@item (entry_value:@var{mode} @var{decl}) +Stands for the value a @var{decl} had at the entry point of the +containing function. + +@findex debug_parameter_ref +@item (debug_parameter_ref:@var{mode} @var{decl}) +Refers to a parameter that was completely optimized out. + +@findex debug_marker +@item (debug_marker:@var{mode}) +Marks a program location. With @code{VOIDmode}, it stands for the +beginning of a statement, a recommended inspection point logically after +all prior side effects, and before any subsequent side effects. + @end table @node Insns @@ -3724,6 +3743,12 @@ can be computed by evaluating the RTL expression from that static point in the program up to the next such note for the same user variable. +@findex NOTE_INSN_BEGIN_STMT +@item NOTE_INSN_BEGIN_STMT +This note is used to generate @code{is_stmt} markers in line number +debuggign information. It indicates the beginning of a user +statement. + @end table These codes are printed symbolically when they appear in debugging dumps. @@ -3741,15 +3766,25 @@ binds a user variable tree to an RTL representation of the it stands for the value bound to the corresponding @code{DEBUG_EXPR_DECL}. -Throughout optimization passes, binding information is kept in -pseudo-instruction form, so that, unlike notes, it gets the same -treatment and adjustments that regular instructions would. It is the -variable tracking pass that turns these pseudo-instructions into var -location notes, analyzing control flow, value equivalences and changes -to registers and memory referenced in value expressions, propagating -the values of debug temporaries and determining expressions that can -be used to compute the value of each user variable at as many points -(ranges, actually) in the program as possible. +@code{GIMPLE_DEBUG_BEGIN_STMT} is expanded to RTL as a @code{DEBUG_INSN} +with a @code{VOIDmode} @code{DEBUG_MARKER} @code{PATTERN}. These +@code{DEBUG_INSN}s, that do not carry @code{VAR_LOCATION} information, +just @code{DEBUG_MARKER}s, can be detected by testing +@code{DEBUG_MARKER_INSN_P}, whereas those that do can be recognized as +@code{DEBUG_BIND_INSN_P}. + +Throughout optimization passes, @code{DEBUG_INSN}s are not reordered +with respect to each other, particularly during scheduling. Binding +information is kept in pseudo-instruction form, so that, unlike notes, +it gets the same treatment and adjustments that regular instructions +would. It is the variable tracking pass that turns these +pseudo-instructions into @code{NOTE_INSN_VAR_LOCATION} and +@code{NOTE_INSN_BEGIN_STMT} notes, +analyzing control flow, value equivalences and changes to registers and +memory referenced in value expressions, propagating the values of debug +temporaries and determining expressions that can be used to compute the +value of each user variable at as many points (ranges, actually) in the +program as possible. Unlike @code{NOTE_INSN_VAR_LOCATION}, the value expression in an @code{INSN_VAR_LOCATION} denotes a value at that specific point in the |