Re: [SFN+LVU+IEPM v4 5/9] [SFN] introduce statement frontier notes, still disabled

2017-12-11 Thread Alexandre Oliva
On Dec  7, 2017, Jeff Law  wrote:

> On 11/09/2017 07:34 PM, Alexandre Oliva wrote:
>> This patch completes the infrastructure for the introduction of
>> statement frontiers in C-family languages.
> Note I expect minor updates will be necessary due to the Cilk+ removal.
> Such changes are pre-approved.

> ok

Thanks, here's what got installed, FTR:

>From 90567983c3c093c60bd99a28266285553e615d43 Mon Sep 17 00:00:00 2001
From: aoliva 
Date: Tue, 12 Dec 2017 02:16:07 +
Subject: [PATCH 5/7] [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...

Re: [SFN+LVU+IEPM v4 5/9] [SFN] introduce statement frontier notes, still disabled

2017-12-07 Thread Jeff Law
On 11/09/2017 07:34 PM, Alexandre Oliva wrote:
> 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 

[SFN+LVU+IEPM v4 5/9] [SFN] introduce statement frontier notes, still disabled

2017-11-09 Thread Alexandre Oliva
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.