From 36f52e8f0812546e6cb533b384b29f56570624ff Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Tue, 12 Dec 2017 02:15:00 +0000 Subject: [PATCH] [SFN] boilerplate changes in preparation to introduce nonbind markers This patch introduces a number of new macros and functions that will be used to distinguish between different kinds of debug stmts, insns and notes, namely, preexisting debug bind ones and to-be-introduced nonbind markers. In a seemingly mechanical way, it adjusts several uses of the macros and functions, so that they refer to narrower categories when appropriate. These changes, by themselves, should not have any visible effect in the compiler behavior, since the upcoming debug markers are never created with this patch alone. for gcc/ChangeLog * gimple.h (enum gimple_debug_subcode): Add GIMPLE_DEBUG_BEGIN_STMT. (gimple_debug_begin_stmt_p): New. (gimple_debug_nonbind_marker_p): New. * tree.h (MAY_HAVE_DEBUG_MARKER_STMTS): New. (MAY_HAVE_DEBUG_BIND_STMTS): Renamed from.... (MAY_HAVE_DEBUG_STMTS): ... this. Check both. * insn-notes.def (BEGIN_STMT): New. * rtl.h (MAY_HAVE_DEBUG_MARKER_INSNS): New. (MAY_HAVE_DEBUG_BIND_INSNS): Renamed from.... (MAY_HAVE_DEBUG_INSNS): ... this. Check both. (NOTE_MARKER_LOCATION, NOTE_MARKER_P): New. (DEBUG_BIND_INSN_P, DEBUG_MARKER_INSN_P): New. (INSN_DEBUG_MARKER_KIND): New. (GEN_RTX_DEBUG_MARKER_BEGIN_STMT_PAT): New. (INSN_VAR_LOCATION): Check for VAR_LOCATION. (INSN_VAR_LOCATION_PTR): New. * cfgexpand.c (expand_debug_locations): Handle debug bind insns only. (expand_gimple_basic_block): Likewise. Emit debug temps for TER deps only if debug bind insns are enabled. (pass_expand::execute): Avoid deep TER and expand debug locations for debug bind insns only. * cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Narrow debug stmts special handling down to debug bind stmts. * combine.c (try_combine): Narrow debug insns special handling down to debug bind insns. * cse.c (delete_trivially_dead_insns): Handle debug bindings. Narrow debug insns preexisting special handling down to debug bind insns. * dce.c (rest_of_handle_ud_dce): Narrow debug insns special handling down to debug bind insns. * function.c (instantiate_virtual_regs): Skip debug markers, adjust handling of debug binds. * gimple-ssa-backprop.c (backprop::prepare_change): Try debug temp insertion iff MAY_HAVE_DEBUG_BIND_STMTS. * haifa-sched.c (schedule_insn): Narrow special handling of debug insns to debug bind insns. * ipa-param-manipulation.c (ipa_modify_call_arguments): Narrow special handling of debug stmts to debug bind stmts. * ipa-split.c (split_function): Likewise. * ira.c (combine_and_move_insns): Adjust debug bind insns only. * loop-unroll.c (apply_opt_in_copies): Adjust tests on bind debug insns. * reg-stack.c (convert_regs_1): Use DEBUG_BIND_INSN_P. * regrename.c (build_def_use): Likewise. * regcprop.c (copyprop_hardreg_forward_1): Likewise. (pass_cprop_hardreg): Narrow special casing of debug insns to debug bind insns. * regstat.c (regstat_init_n_sets_and_refs): Likewise. * reload1.c (reload): Likewise. * sese.c (sese_insert_phis_for_liveouts): Narrow special casing of debug stmts to debug bind stmts. * shrink-wrap.c (move_insn_for_shrink_wrap): Likewise. * ssa-iterators.h (num_imm_uses): Likewise. * tree-cfg.c (gimple_merge_blocks): Narrow special casing of debug stmts to debug bind stmts. * tree-inline.c (tree_function_versioning): Narrow special casing of debug stmts to debug bind stmts. * tree-loop-distribution.c (generate_loops_for_partition): Narrow special casing of debug stmts to debug bind stmts. * tree-sra.c (analyze_access_subtree): Narrow special casing of debug stmts to debug bind stmts. * tree-ssa-dce.c (remove_dead_stmt): Narrow special casing of debug stmts to debug bind stmts. * tree-ssa-loop-ivopt.c (remove_unused_ivs): Narrow special casing of debug stmts to debug bind stmts. * tree-ssa-reassoc.c (reassoc_remove_stmt): Likewise. * tree-ssa-tail-merge.c (tail_merge_optimize): Narrow special casing of debug stmts to debug bind stmts. * tree-ssa-threadedge.c (propagate_threaded_block_debug_info): Likewise. * tree-ssa.c (flush_pending_stmts): Narrow special casing of debug stmts to debug bind stmts. (gimple_replace_ssa_lhs): Likewise. (insert_debug_temp_for_var_def): Likewise. (insert_debug_temps_for_defs): Likewise. (reset_debug_uses): Likewise. * tree-ssanames.c (release_ssa_name_fn): Likewise. * tree-vect-loop-manip.c (adjust_debug_stmts_now): Likewise. (adjust_debug_stmts): Likewise. (adjust_phi_and_debug_stmts): Likewise. (vect_do_peeling): Likewise. * tree-vect-loop.c (vect_transform_loop): Likewise. * valtrack.c (propagate_for_debug): Use BIND_DEBUG_INSN_P. * var-tracking.c (adjust_mems): Narrow special casing of debug insns to debug bind insns. (dv_onepart_p, dataflow_set_clar_at_call, use_type): Likewise. (compute_bb_dataflow, vt_find_locations): Likewise. (vt_expand_loc, emit_notes_for_changes): Likewise. (vt_init_cfa_base): Likewise. (vt_emit_notes): Likewise. (vt_initialize): Likewise. (vt_finalize): Likewise. From-SVN: r255565 --- gcc/ChangeLog | 95 ++++++++++++++++++++++++++++++++++++ gcc/cfgexpand.c | 8 +-- gcc/cgraph.c | 2 +- gcc/combine.c | 12 ++--- gcc/cse.c | 17 ++++--- gcc/dce.c | 2 +- gcc/function.c | 7 +-- gcc/gimple-ssa-backprop.c | 2 +- gcc/gimple.h | 31 ++++++++++-- gcc/haifa-sched.c | 4 +- gcc/insn-notes.def | 3 ++ gcc/ipa-param-manipulation.c | 2 +- gcc/ipa-split.c | 11 +++-- gcc/ira.c | 4 +- gcc/loop-unroll.c | 6 ++- gcc/reg-stack.c | 4 +- gcc/regcprop.c | 4 +- gcc/regrename.c | 2 +- gcc/regstat.c | 2 +- gcc/reload1.c | 4 +- gcc/rtl.h | 47 +++++++++++++++++- gcc/sese.c | 2 +- gcc/shrink-wrap.c | 4 +- gcc/ssa-iterators.h | 2 +- gcc/tree-cfg.c | 2 +- gcc/tree-inline.c | 4 +- gcc/tree-loop-distribution.c | 2 +- gcc/tree-sra.c | 2 +- gcc/tree-ssa-dce.c | 2 +- gcc/tree-ssa-loop-ivopts.c | 2 +- gcc/tree-ssa-reassoc.c | 2 +- gcc/tree-ssa-tail-merge.c | 2 +- gcc/tree-ssa-threadedge.c | 2 +- gcc/tree-ssa.c | 10 ++-- gcc/tree-ssanames.c | 2 +- gcc/tree-vect-loop-manip.c | 8 +-- gcc/tree-vect-loop.c | 4 +- gcc/tree.h | 8 ++- gcc/valtrack.c | 2 +- gcc/var-tracking.c | 50 +++++++++---------- 40 files changed, 277 insertions(+), 104 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6d0a64e6adc..286a0fbac94 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,100 @@ 2017-12-12 Alexandre Oliva + * gimple.h (enum gimple_debug_subcode): Add + GIMPLE_DEBUG_BEGIN_STMT. + (gimple_debug_begin_stmt_p): New. + (gimple_debug_nonbind_marker_p): New. + * tree.h (MAY_HAVE_DEBUG_MARKER_STMTS): New. + (MAY_HAVE_DEBUG_BIND_STMTS): Renamed from.... + (MAY_HAVE_DEBUG_STMTS): ... this. Check both. + * insn-notes.def (BEGIN_STMT): New. + * rtl.h (MAY_HAVE_DEBUG_MARKER_INSNS): New. + (MAY_HAVE_DEBUG_BIND_INSNS): Renamed from.... + (MAY_HAVE_DEBUG_INSNS): ... this. Check both. + (NOTE_MARKER_LOCATION, NOTE_MARKER_P): New. + (DEBUG_BIND_INSN_P, DEBUG_MARKER_INSN_P): New. + (INSN_DEBUG_MARKER_KIND): New. + (GEN_RTX_DEBUG_MARKER_BEGIN_STMT_PAT): New. + (INSN_VAR_LOCATION): Check for VAR_LOCATION. + (INSN_VAR_LOCATION_PTR): New. + * cfgexpand.c (expand_debug_locations): Handle debug bind insns + only. + (expand_gimple_basic_block): Likewise. Emit debug temps for TER + deps only if debug bind insns are enabled. + (pass_expand::execute): Avoid deep TER and expand + debug locations for debug bind insns only. + * cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Narrow + debug stmts special handling down to debug bind stmts. + * combine.c (try_combine): Narrow debug insns special handling + down to debug bind insns. + * cse.c (delete_trivially_dead_insns): Handle debug bindings. + Narrow debug insns preexisting special handling down to debug + bind insns. + * dce.c (rest_of_handle_ud_dce): Narrow debug insns special + handling down to debug bind insns. + * function.c (instantiate_virtual_regs): Skip debug markers, + adjust handling of debug binds. + * gimple-ssa-backprop.c (backprop::prepare_change): Try debug + temp insertion iff MAY_HAVE_DEBUG_BIND_STMTS. + * haifa-sched.c (schedule_insn): Narrow special handling of debug + insns to debug bind insns. + * ipa-param-manipulation.c (ipa_modify_call_arguments): Narrow + special handling of debug stmts to debug bind stmts. + * ipa-split.c (split_function): Likewise. + * ira.c (combine_and_move_insns): Adjust debug bind insns only. + * loop-unroll.c (apply_opt_in_copies): Adjust tests on bind + debug insns. + * reg-stack.c (convert_regs_1): Use DEBUG_BIND_INSN_P. + * regrename.c (build_def_use): Likewise. + * regcprop.c (copyprop_hardreg_forward_1): Likewise. + (pass_cprop_hardreg): Narrow special casing of debug insns to + debug bind insns. + * regstat.c (regstat_init_n_sets_and_refs): Likewise. + * reload1.c (reload): Likewise. + * sese.c (sese_insert_phis_for_liveouts): Narrow special + casing of debug stmts to debug bind stmts. + * shrink-wrap.c (move_insn_for_shrink_wrap): Likewise. + * ssa-iterators.h (num_imm_uses): Likewise. + * tree-cfg.c (gimple_merge_blocks): Narrow special casing of + debug stmts to debug bind stmts. + * tree-inline.c (tree_function_versioning): Narrow special casing + of debug stmts to debug bind stmts. + * tree-loop-distribution.c (generate_loops_for_partition): + Narrow special casing of debug stmts to debug bind stmts. + * tree-sra.c (analyze_access_subtree): Narrow special casing + of debug stmts to debug bind stmts. + * tree-ssa-dce.c (remove_dead_stmt): Narrow special casing of debug + stmts to debug bind stmts. + * tree-ssa-loop-ivopt.c (remove_unused_ivs): Narrow special + casing of debug stmts to debug bind stmts. + * tree-ssa-reassoc.c (reassoc_remove_stmt): Likewise. + * tree-ssa-tail-merge.c (tail_merge_optimize): Narrow special + casing of debug stmts to debug bind stmts. + * tree-ssa-threadedge.c (propagate_threaded_block_debug_info): + Likewise. + * tree-ssa.c (flush_pending_stmts): Narrow special casing of + debug stmts to debug bind stmts. + (gimple_replace_ssa_lhs): Likewise. + (insert_debug_temp_for_var_def): Likewise. + (insert_debug_temps_for_defs): Likewise. + (reset_debug_uses): Likewise. + * tree-ssanames.c (release_ssa_name_fn): Likewise. + * tree-vect-loop-manip.c (adjust_debug_stmts_now): Likewise. + (adjust_debug_stmts): Likewise. + (adjust_phi_and_debug_stmts): Likewise. + (vect_do_peeling): Likewise. + * tree-vect-loop.c (vect_transform_loop): Likewise. + * valtrack.c (propagate_for_debug): Use BIND_DEBUG_INSN_P. + * var-tracking.c (adjust_mems): Narrow special casing of debug + insns to debug bind insns. + (dv_onepart_p, dataflow_set_clar_at_call, use_type): Likewise. + (compute_bb_dataflow, vt_find_locations): Likewise. + (vt_expand_loc, emit_notes_for_changes): Likewise. + (vt_init_cfa_base): Likewise. + (vt_emit_notes): Likewise. + (vt_initialize): Likewise. + (vt_finalize): Likewise. + * emit-rtl.c (next_nondebug_insn, prev_nondebug_insn): Reorder. (next_nonnote_nondebug_insn, prev_nonnote_nondebug_insn): Reorder. (next_nonnote_nondebug_insn_bb): New. diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index d1140602da4..b1646a5ec50 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -5307,7 +5307,7 @@ expand_debug_locations (void) flag_strict_aliasing = 0; for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) - if (DEBUG_INSN_P (insn)) + if (DEBUG_BIND_INSN_P (insn)) { tree value = (tree)INSN_VAR_LOCATION_LOC (insn); rtx val; @@ -5560,7 +5560,7 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls) a_2 = ... #DEBUG ... => #D1 */ - if (MAY_HAVE_DEBUG_INSNS + if (MAY_HAVE_DEBUG_BIND_INSNS && SA.values && !is_gimple_debug (stmt)) { @@ -6181,7 +6181,7 @@ pass_expand::execute (function *fun) timevar_pop (TV_OUT_OF_SSA); SA.partition_to_pseudo = XCNEWVEC (rtx, SA.map->num_partitions); - if (MAY_HAVE_DEBUG_STMTS && flag_tree_ter) + if (MAY_HAVE_DEBUG_BIND_STMTS && flag_tree_ter) { gimple_stmt_iterator gsi; FOR_EACH_BB_FN (bb, cfun) @@ -6372,7 +6372,7 @@ pass_expand::execute (function *fun) next_bb) bb = expand_gimple_basic_block (bb, var_ret_seq != NULL_RTX); - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) expand_debug_locations (); if (deep_ter_debug_map) diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 7ac58ce91c1..17a0d32ce5e 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -1431,7 +1431,7 @@ cgraph_edge::redirect_call_stmt_to_callee (void) stmts and associate D#X with parm in decl_debug_args_lookup vector to say for debug info that if parameter parm had been passed, it would have value parm_Y(D). */ - if (e->callee->clone.combined_args_to_skip && MAY_HAVE_DEBUG_STMTS) + if (e->callee->clone.combined_args_to_skip && MAY_HAVE_DEBUG_BIND_STMTS) { vec **debug_args = decl_debug_args_lookup (e->callee->decl); diff --git a/gcc/combine.c b/gcc/combine.c index 7f10c67bf0f..f4e94450c09 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -3778,7 +3778,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0, /* *SPLIT may be part of I2SRC, so make sure we have the original expression around for later debug processing. We should not need I2SRC any more in other cases. */ - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) i2src = copy_rtx (i2src); else i2src = NULL; @@ -4134,7 +4134,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0, return 0; } - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) { struct undo *undo; @@ -4447,7 +4447,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0, if (newi2pat) { - if (MAY_HAVE_DEBUG_INSNS && i2scratch) + if (MAY_HAVE_DEBUG_BIND_INSNS && i2scratch) propagate_for_debug (i2, last_combined_insn, i2dest, i2src, this_basic_block); INSN_CODE (i2) = i2_code_number; @@ -4455,7 +4455,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0, } else { - if (MAY_HAVE_DEBUG_INSNS && i2src) + if (MAY_HAVE_DEBUG_BIND_INSNS && i2src) propagate_for_debug (i2, last_combined_insn, i2dest, i2src, this_basic_block); SET_INSN_DELETED (i2); @@ -4465,7 +4465,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0, { LOG_LINKS (i1) = NULL; REG_NOTES (i1) = 0; - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) propagate_for_debug (i1, last_combined_insn, i1dest, i1src, this_basic_block); SET_INSN_DELETED (i1); @@ -4475,7 +4475,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0, { LOG_LINKS (i0) = NULL; REG_NOTES (i0) = 0; - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) propagate_for_debug (i0, last_combined_insn, i0dest, i0src, this_basic_block); SET_INSN_DELETED (i0); diff --git a/gcc/cse.c b/gcc/cse.c index 65cc9ae110c..e449223cbb2 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -7049,11 +7049,11 @@ delete_trivially_dead_insns (rtx_insn *insns, int nreg) timevar_push (TV_DELETE_TRIVIALLY_DEAD); /* First count the number of times each register is used. */ - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) { counts = XCNEWVEC (int, nreg * 3); for (insn = insns; insn; insn = NEXT_INSN (insn)) - if (DEBUG_INSN_P (insn)) + if (DEBUG_BIND_INSN_P (insn)) count_reg_usage (INSN_VAR_LOCATION_LOC (insn), counts + nreg, NULL_RTX, 1); else if (INSN_P (insn)) @@ -7111,12 +7111,15 @@ delete_trivially_dead_insns (rtx_insn *insns, int nreg) if (! live_insn && dbg_cnt (delete_trivial_dead)) { if (DEBUG_INSN_P (insn)) - count_reg_usage (INSN_VAR_LOCATION_LOC (insn), counts + nreg, - NULL_RTX, -1); + { + if (DEBUG_BIND_INSN_P (insn)) + count_reg_usage (INSN_VAR_LOCATION_LOC (insn), counts + nreg, + NULL_RTX, -1); + } else { rtx set; - if (MAY_HAVE_DEBUG_INSNS + if (MAY_HAVE_DEBUG_BIND_INSNS && (set = single_set (insn)) != NULL_RTX && is_dead_reg (SET_DEST (set), counts) /* Used at least once in some DEBUG_INSN. */ @@ -7156,10 +7159,10 @@ delete_trivially_dead_insns (rtx_insn *insns, int nreg) } } - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) { for (insn = get_last_insn (); insn; insn = PREV_INSN (insn)) - if (DEBUG_INSN_P (insn)) + if (DEBUG_BIND_INSN_P (insn)) { /* If this debug insn references a dead register that wasn't replaced with an DEBUG_EXPR, reset the DEBUG_INSN. */ diff --git a/gcc/dce.c b/gcc/dce.c index 7534d2abadf..6fd9548015c 100644 --- a/gcc/dce.c +++ b/gcc/dce.c @@ -777,7 +777,7 @@ rest_of_handle_ud_dce (void) } worklist.release (); - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) reset_unmarked_insns_debug_uses (); /* Before any insns are deleted, we must remove the chains since diff --git a/gcc/function.c b/gcc/function.c index 1fa538b4b7f..88f93db6cf0 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -1951,10 +1951,11 @@ instantiate_virtual_regs (void) Fortunately, they shouldn't contain virtual registers either. */ if (GET_CODE (PATTERN (insn)) == USE || GET_CODE (PATTERN (insn)) == CLOBBER - || GET_CODE (PATTERN (insn)) == ASM_INPUT) + || GET_CODE (PATTERN (insn)) == ASM_INPUT + || DEBUG_MARKER_INSN_P (insn)) continue; - else if (DEBUG_INSN_P (insn)) - instantiate_virtual_regs_in_rtx (&INSN_VAR_LOCATION (insn)); + else if (DEBUG_BIND_INSN_P (insn)) + instantiate_virtual_regs_in_rtx (INSN_VAR_LOCATION_PTR (insn)); else instantiate_virtual_regs_in_insn (insn); diff --git a/gcc/gimple-ssa-backprop.c b/gcc/gimple-ssa-backprop.c index 1daa0ceef0a..8068c2ab1f7 100644 --- a/gcc/gimple-ssa-backprop.c +++ b/gcc/gimple-ssa-backprop.c @@ -729,7 +729,7 @@ strip_sign_op (tree rhs) void backprop::prepare_change (tree var) { - if (MAY_HAVE_DEBUG_STMTS) + if (MAY_HAVE_DEBUG_BIND_STMTS) insert_debug_temp_for_var_def (NULL, var); reset_flow_sensitive_info (var); } diff --git a/gcc/gimple.h b/gcc/gimple.h index 0fcdd05aaba..d34aa142849 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -197,13 +197,12 @@ enum gf_mask { GF_PREDICT_TAKEN = 1 << 15 }; -/* Currently, there are only two types of gimple debug stmt. Others are - envisioned, for example, to enable the generation of is_stmt notes - in line number information, to mark sequence points, etc. This - subcode is to be used to tell them apart. */ +/* This subcode tells apart different kinds of stmts that are not used + for codegen, but rather to retain debug information. */ enum gimple_debug_subcode { GIMPLE_DEBUG_BIND = 0, - GIMPLE_DEBUG_SOURCE_BIND = 1 + GIMPLE_DEBUG_SOURCE_BIND = 1, + GIMPLE_DEBUG_BEGIN_STMT = 2 }; /* Masks for selecting a pass local flag (PLF) to work on. These @@ -4757,6 +4756,28 @@ gimple_debug_source_bind_set_value (gimple *dbg, tree value) gimple_set_op (dbg, 1, value); } +/* Return true if S is a GIMPLE_DEBUG BEGIN_STMT statement. */ + +static inline bool +gimple_debug_begin_stmt_p (const gimple *s) +{ + if (is_gimple_debug (s)) + return s->subcode == GIMPLE_DEBUG_BEGIN_STMT; + + return false; +} + +/* Return true if S is a GIMPLE_DEBUG non-binding marker statement. */ + +static inline bool +gimple_debug_nonbind_marker_p (const gimple *s) +{ + if (is_gimple_debug (s)) + return s->subcode == GIMPLE_DEBUG_BEGIN_STMT; + + return false; +} + /* Return the line number for EXPR, or return -1 if we have no line number information for it. */ static inline int diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index f5c06a95bb6..b7c0b3a6f4f 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -4010,7 +4010,7 @@ schedule_insn (rtx_insn *insn) gcc_assert (sd_lists_empty_p (insn, SD_LIST_HARD_BACK)); /* Reset debug insns invalidated by moving this insn. */ - if (MAY_HAVE_DEBUG_INSNS && !DEBUG_INSN_P (insn)) + if (MAY_HAVE_DEBUG_BIND_INSNS && !DEBUG_INSN_P (insn)) for (sd_it = sd_iterator_start (insn, SD_LIST_BACK); sd_iterator_cond (&sd_it, &dep);) { @@ -4023,7 +4023,7 @@ schedule_insn (rtx_insn *insn) continue; } - gcc_assert (DEBUG_INSN_P (dbg)); + gcc_assert (DEBUG_BIND_INSN_P (dbg)); if (sched_verbose >= 6) fprintf (sched_dump, ";;\t\tresetting: debug insn %d\n", diff --git a/gcc/insn-notes.def b/gcc/insn-notes.def index f96ce18ecb6..960487b31db 100644 --- a/gcc/insn-notes.def +++ b/gcc/insn-notes.def @@ -68,6 +68,9 @@ INSN_NOTE (VAR_LOCATION) /* The values passed to callee. */ INSN_NOTE (CALL_ARG_LOCATION) +/* The beginning of a statement. */ +INSN_NOTE (BEGIN_STMT) + /* Record the struct for the following basic block. Uses NOTE_BASIC_BLOCK. FIXME: Redundant with the basic block pointer now included in every insn. NOTE: If there's no CFG anymore, in other words, diff --git a/gcc/ipa-param-manipulation.c b/gcc/ipa-param-manipulation.c index bedd201f6dd..bcc736b99c0 100644 --- a/gcc/ipa-param-manipulation.c +++ b/gcc/ipa-param-manipulation.c @@ -402,7 +402,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gcall *stmt, } vargs.quick_push (expr); } - if (adj->op != IPA_PARM_OP_COPY && MAY_HAVE_DEBUG_STMTS) + if (adj->op != IPA_PARM_OP_COPY && MAY_HAVE_DEBUG_BIND_STMTS) { unsigned int ix; tree ddecl = NULL_TREE, origin = DECL_ORIGIN (adj->base), arg; diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c index 7ebd51554e5..48857c2aab3 100644 --- a/gcc/ipa-split.c +++ b/gcc/ipa-split.c @@ -1485,7 +1485,7 @@ split_function (basic_block return_bb, struct split_point *split_point, { vec **debug_args = NULL; unsigned i = 0, len = 0; - if (MAY_HAVE_DEBUG_STMTS) + if (MAY_HAVE_DEBUG_BIND_STMTS) { debug_args = decl_debug_args_lookup (node->decl); if (debug_args) @@ -1498,11 +1498,12 @@ split_function (basic_block return_bb, struct split_point *split_point, tree ddecl; gimple *def_temp; - /* This needs to be done even without MAY_HAVE_DEBUG_STMTS, - otherwise if it didn't exist before, we'd end up with - different SSA_NAME_VERSIONs between -g and -g0. */ + /* This needs to be done even without + MAY_HAVE_DEBUG_BIND_STMTS, otherwise if it didn't exist + before, we'd end up with different SSA_NAME_VERSIONs + between -g and -g0. */ arg = get_or_create_ssa_default_def (cfun, parm); - if (!MAY_HAVE_DEBUG_STMTS || debug_args == NULL) + if (!MAY_HAVE_DEBUG_BIND_STMTS || debug_args == NULL) continue; while (i < len && (**debug_args)[i] != DECL_ORIGIN (parm)) diff --git a/gcc/ira.c b/gcc/ira.c index a9ed17ea308..79837da1db5 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -3839,9 +3839,9 @@ combine_and_move_insns (void) } /* Last pass - adjust debug insns referencing cleared regs. */ - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) for (rtx_insn *insn = get_insns (); insn; insn = NEXT_INSN (insn)) - if (DEBUG_INSN_P (insn)) + if (DEBUG_BIND_INSN_P (insn)) { rtx old_loc = INSN_VAR_LOCATION_LOC (insn); INSN_VAR_LOCATION_LOC (insn) diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c index 0fdecd7fde2..cc154da9686 100644 --- a/gcc/loop-unroll.c +++ b/gcc/loop-unroll.c @@ -2037,12 +2037,14 @@ apply_opt_in_copies (struct opt_info *opt_info, FOR_BB_INSNS_SAFE (bb, insn, next) { if (!INSN_P (insn) - || (DEBUG_INSN_P (insn) + || (DEBUG_BIND_INSN_P (insn) + && INSN_VAR_LOCATION_DECL (insn) && TREE_CODE (INSN_VAR_LOCATION_DECL (insn)) == LABEL_DECL)) continue; while (!INSN_P (orig_insn) - || (DEBUG_INSN_P (orig_insn) + || (DEBUG_BIND_INSN_P (orig_insn) + && INSN_VAR_LOCATION_DECL (orig_insn) && (TREE_CODE (INSN_VAR_LOCATION_DECL (orig_insn)) == LABEL_DECL))) orig_insn = NEXT_INSN (orig_insn); diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c index 4f67a7bfa50..fe754b242d5 100644 --- a/gcc/reg-stack.c +++ b/gcc/reg-stack.c @@ -3034,7 +3034,7 @@ convert_regs_1 (basic_block block) /* Don't bother processing unless there is a stack reg mentioned or if it's a CALL_INSN. */ - if (DEBUG_INSN_P (insn)) + if (DEBUG_BIND_INSN_P (insn)) { if (starting_stack_p) debug_insns_with_starting_stack++; @@ -3074,7 +3074,7 @@ convert_regs_1 (basic_block block) for (insn = BB_HEAD (block); debug_insns_with_starting_stack; insn = NEXT_INSN (insn)) { - if (!DEBUG_INSN_P (insn)) + if (!DEBUG_BIND_INSN_P (insn)) continue; debug_insns_with_starting_stack--; diff --git a/gcc/regcprop.c b/gcc/regcprop.c index b80019b5be0..15d8b140ce7 100644 --- a/gcc/regcprop.c +++ b/gcc/regcprop.c @@ -752,7 +752,7 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd) next = NEXT_INSN (insn); if (!NONDEBUG_INSN_P (insn)) { - if (DEBUG_INSN_P (insn)) + if (DEBUG_BIND_INSN_P (insn)) { rtx loc = INSN_VAR_LOCATION_LOC (insn); if (!VAR_LOC_UNKNOWN_P (loc)) @@ -1296,7 +1296,7 @@ pass_cprop_hardreg::execute (function *fun) copyprop_hardreg_forward_1 (bb, all_vd + bb->index); } - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) { FOR_EACH_BB_FN (bb, fun) if (bitmap_bit_p (visited, bb->index) diff --git a/gcc/regrename.c b/gcc/regrename.c index 7fbfa3162ca..89380a87700 100644 --- a/gcc/regrename.c +++ b/gcc/regrename.c @@ -1876,7 +1876,7 @@ build_def_use (basic_block bb) if (REG_NOTE_KIND (note) == REG_CFA_RESTORE) scan_rtx (insn, &XEXP (note, 0), NO_REGS, mark_all_read, OP_IN); } - else if (DEBUG_INSN_P (insn) + else if (DEBUG_BIND_INSN_P (insn) && !VAR_LOC_UNKNOWN_P (INSN_VAR_LOCATION_LOC (insn))) { scan_rtx (insn, &INSN_VAR_LOCATION_LOC (insn), diff --git a/gcc/regstat.c b/gcc/regstat.c index 3fd26fd2fc6..fd3d3a8d98b 100644 --- a/gcc/regstat.c +++ b/gcc/regstat.c @@ -54,7 +54,7 @@ regstat_init_n_sets_and_refs (void) regstat_n_sets_and_refs = XNEWVEC (struct regstat_n_sets_and_refs_t, max_regno); - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) for (i = 0; i < max_regno; i++) { int use_count; diff --git a/gcc/reload1.c b/gcc/reload1.c index e15bd8a2c1a..322696a25f3 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -1112,7 +1112,7 @@ reload (rtx_insn *first, int global) /* We don't want complex addressing modes in debug insns if simpler ones will do, so delegitimize equivalences in debug insns. */ - if (MAY_HAVE_DEBUG_INSNS && reg_renumber[i] < 0) + if (MAY_HAVE_DEBUG_BIND_INSNS && reg_renumber[i] < 0) { rtx reg = regno_reg_rtx[i]; rtx equiv = 0; @@ -1140,7 +1140,7 @@ reload (rtx_insn *first, int global) while (next && DF_REF_INSN (next) == insn) next = DF_REF_NEXT_REG (next); - if (DEBUG_INSN_P (insn)) + if (DEBUG_BIND_INSN_P (insn)) { if (!equiv) { diff --git a/gcc/rtl.h b/gcc/rtl.h index 9cc982172f5..4de167d982c 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -815,8 +815,13 @@ struct GTY(()) rtvec_def { /* Predicate yielding nonzero iff X is an insn that is not a debug insn. */ #define NONDEBUG_INSN_P(X) (INSN_P (X) && !DEBUG_INSN_P (X)) +/* Nonzero if DEBUG_MARKER_INSN_P may possibly hold. */ +#define MAY_HAVE_DEBUG_MARKER_INSNS 0 /* debug_nonbind_markers_p */ +/* Nonzero if DEBUG_BIND_INSN_P may possibly hold. */ +#define MAY_HAVE_DEBUG_BIND_INSNS flag_var_tracking_assignments /* Nonzero if DEBUG_INSN_P may possibly hold. */ -#define MAY_HAVE_DEBUG_INSNS (flag_var_tracking_assignments) +#define MAY_HAVE_DEBUG_INSNS \ + (MAY_HAVE_DEBUG_MARKER_INSNS || MAY_HAVE_DEBUG_BIND_INSNS) /* Predicate yielding nonzero iff X is a real insn. */ #define INSN_P(X) \ @@ -1604,6 +1609,7 @@ extern const char * const reg_note_name[]; #define NOTE_EH_HANDLER(INSN) XCINT (INSN, 3, NOTE) #define NOTE_BASIC_BLOCK(INSN) XCBBDEF (INSN, 3, NOTE) #define NOTE_VAR_LOCATION(INSN) XCEXP (INSN, 3, NOTE) +#define NOTE_MARKER_LOCATION(INSN) XCUINT (INSN, 3, NOTE) #define NOTE_CFI(INSN) XCCFI (INSN, 3, NOTE) #define NOTE_LABEL_NUMBER(INSN) XCINT (INSN, 3, NOTE) @@ -1615,6 +1621,12 @@ extern const char * const reg_note_name[]; #define NOTE_INSN_BASIC_BLOCK_P(INSN) \ (NOTE_P (INSN) && NOTE_KIND (INSN) == NOTE_INSN_BASIC_BLOCK) +/* Nonzero if INSN is a debug nonbind marker note, + for which NOTE_MARKER_LOCATION can be used. */ +#define NOTE_MARKER_P(INSN) \ + (NOTE_P (INSN) && \ + (NOTE_KIND (INSN) == NOTE_INSN_BEGIN_STMT)) + /* Variable declaration and the location of a variable. */ #define PAT_VAR_LOCATION_DECL(PAT) (XCTREE ((PAT), 0, VAR_LOCATION)) #define PAT_VAR_LOCATION_LOC(PAT) (XCEXP ((PAT), 1, VAR_LOCATION)) @@ -1634,8 +1646,39 @@ extern const char * const reg_note_name[]; #define NOTE_VAR_LOCATION_STATUS(NOTE) \ PAT_VAR_LOCATION_STATUS (NOTE_VAR_LOCATION (NOTE)) +/* Evaluate to TRUE if INSN is a debug insn that denotes a variable + location/value tracking annotation. */ +#define DEBUG_BIND_INSN_P(INSN) \ + (DEBUG_INSN_P (INSN) \ + && (GET_CODE (PATTERN (INSN)) \ + == VAR_LOCATION)) +/* Evaluate to TRUE if INSN is a debug insn that denotes a program + source location marker. */ +#define DEBUG_MARKER_INSN_P(INSN) \ + (DEBUG_INSN_P (INSN) \ + && (GET_CODE (PATTERN (INSN)) \ + != VAR_LOCATION)) +/* Evaluate to the marker kind. */ +#define INSN_DEBUG_MARKER_KIND(INSN) \ + (GET_CODE (PATTERN (INSN)) == DEBUG_MARKER \ + ? (GET_MODE (PATTERN (INSN)) == VOIDmode \ + ? NOTE_INSN_BEGIN_STMT \ + : (enum insn_note)-1) \ + : (enum insn_note)-1) +/* Create patterns for debug markers. These and the above abstract + the representation, so that it's easier to get rid of the abuse of + the mode to hold the marker kind. Other marker types are + envisioned, so a single bit flag won't do; maybe separate RTL codes + wouldn't be a problem. */ +#define GEN_RTX_DEBUG_MARKER_BEGIN_STMT_PAT() \ + gen_rtx_DEBUG_MARKER (VOIDmode) + /* The VAR_LOCATION rtx in a DEBUG_INSN. */ -#define INSN_VAR_LOCATION(INSN) PATTERN (INSN) +#define INSN_VAR_LOCATION(INSN) \ + (RTL_FLAG_CHECK1 ("INSN_VAR_LOCATION", PATTERN (INSN), VAR_LOCATION)) +/* A pointer to the VAR_LOCATION rtx in a DEBUG_INSN. */ +#define INSN_VAR_LOCATION_PTR(INSN) \ + (&PATTERN (INSN)) /* Accessors for a tree-expanded var location debug insn. */ #define INSN_VAR_LOCATION_DECL(INSN) \ diff --git a/gcc/sese.c b/gcc/sese.c index 89cddf0ec97..bbc72d4d761 100644 --- a/gcc/sese.c +++ b/gcc/sese.c @@ -205,7 +205,7 @@ void sese_insert_phis_for_liveouts (sese_info_p region, basic_block bb, edge false_e, edge true_e) { - if (MAY_HAVE_DEBUG_STMTS) + if (MAY_HAVE_DEBUG_BIND_STMTS) sese_reset_debug_liveouts (region); unsigned i; diff --git a/gcc/shrink-wrap.c b/gcc/shrink-wrap.c index ce2ddfc09f7..91745936e95 100644 --- a/gcc/shrink-wrap.c +++ b/gcc/shrink-wrap.c @@ -309,10 +309,10 @@ move_insn_for_shrink_wrap (basic_block bb, rtx_insn *insn, move it as far as we can. */ do { - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) { FOR_BB_INSNS_REVERSE (bb, dinsn) - if (DEBUG_INSN_P (dinsn)) + if (DEBUG_BIND_INSN_P (dinsn)) { df_ref use; FOR_EACH_INSN_USE (use, dinsn) diff --git a/gcc/ssa-iterators.h b/gcc/ssa-iterators.h index 740cbf13cb2..201bf190cef 100644 --- a/gcc/ssa-iterators.h +++ b/gcc/ssa-iterators.h @@ -453,7 +453,7 @@ num_imm_uses (const_tree var) const ssa_use_operand_t *ptr; unsigned int num = 0; - if (!MAY_HAVE_DEBUG_STMTS) + if (!MAY_HAVE_DEBUG_BIND_STMTS) { for (ptr = start->next; ptr != start; ptr = ptr->next) if (USE_STMT (ptr)) diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 4d09b2cc99d..00f86613137 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -2072,7 +2072,7 @@ gimple_merge_blocks (basic_block a, basic_block b) gsi_insert_before (&dest_gsi, stmt, GSI_NEW_STMT); } /* Other user labels keep around in a form of a debug stmt. */ - else if (!DECL_ARTIFICIAL (label) && MAY_HAVE_DEBUG_STMTS) + else if (!DECL_ARTIFICIAL (label) && MAY_HAVE_DEBUG_BIND_STMTS) { gimple *dbg = gimple_build_debug_bind (label, integer_zero_node, diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index ca98e43327e..e6e3f129d42 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -5930,7 +5930,7 @@ tree_function_versioning (tree old_decl, tree new_decl, &vars); if (init) init_stmts.safe_push (init); - if (MAY_HAVE_DEBUG_STMTS && args_to_skip) + if (MAY_HAVE_DEBUG_BIND_STMTS && args_to_skip) { if (parm_num == -1) { @@ -6072,7 +6072,7 @@ tree_function_versioning (tree old_decl, tree new_decl, } } - if (debug_args_to_skip && MAY_HAVE_DEBUG_STMTS) + if (debug_args_to_skip && MAY_HAVE_DEBUG_BIND_STMTS) { tree parm; vec **debug_args = NULL; diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c index 29825cc3f53..7439a1f370e 100644 --- a/gcc/tree-loop-distribution.c +++ b/gcc/tree-loop-distribution.c @@ -826,7 +826,7 @@ generate_loops_for_partition (struct loop *loop, partition *partition, /* Remove stmts not in the PARTITION bitmap. */ bbs = get_loop_body_in_dom_order (loop); - if (MAY_HAVE_DEBUG_STMTS) + if (MAY_HAVE_DEBUG_BIND_STMTS) for (i = 0; i < loop->num_nodes; i++) { basic_block bb = bbs[i]; diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 54f1c8d54d5..daef8d72cd0 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -2512,7 +2512,7 @@ analyze_access_subtree (struct access *root, struct access *parent, gcc_checking_assert (!root->grp_scalar_read && !root->grp_assignment_read); sth_created = true; - if (MAY_HAVE_DEBUG_STMTS) + if (MAY_HAVE_DEBUG_BIND_STMTS) { root->grp_to_be_debug_replaced = 1; root->replacement_decl = create_access_replacement (root); diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c index 8595decc702..1e1307b2ff7 100644 --- a/gcc/tree-ssa-dce.c +++ b/gcc/tree-ssa-dce.c @@ -1081,7 +1081,7 @@ remove_dead_stmt (gimple_stmt_iterator *i, basic_block bb) /* If this is a store into a variable that is being optimized away, add a debug bind stmt if possible. */ - if (MAY_HAVE_DEBUG_STMTS + if (MAY_HAVE_DEBUG_BIND_STMTS && gimple_assign_single_p (stmt) && is_gimple_val (gimple_assign_rhs1 (stmt))) { diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 65794b2b777..350f94dfc33 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -7154,7 +7154,7 @@ remove_unused_ivs (struct ivopts_data *data) tree def = info->iv->ssa_name; - if (MAY_HAVE_DEBUG_STMTS && SSA_NAME_DEF_STMT (def)) + if (MAY_HAVE_DEBUG_BIND_STMTS && SSA_NAME_DEF_STMT (def)) { imm_use_iterator imm_iter; use_operand_p use_p; diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 485d0a692ce..b037dfbff8f 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -232,7 +232,7 @@ reassoc_remove_stmt (gimple_stmt_iterator *gsi) { gimple *stmt = gsi_stmt (*gsi); - if (!MAY_HAVE_DEBUG_STMTS || gimple_code (stmt) == GIMPLE_PHI) + if (!MAY_HAVE_DEBUG_BIND_STMTS || gimple_code (stmt) == GIMPLE_PHI) return gsi_remove (gsi, true); gimple_stmt_iterator prev = *gsi; diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c index e90283b9cc8..fc94f5d83d2 100644 --- a/gcc/tree-ssa-tail-merge.c +++ b/gcc/tree-ssa-tail-merge.c @@ -1781,7 +1781,7 @@ tail_merge_optimize (unsigned int todo) if (nr_bbs_removed_total > 0) { - if (MAY_HAVE_DEBUG_STMTS) + if (MAY_HAVE_DEBUG_BIND_STMTS) { calculate_dominance_info (CDI_DOMINATORS); update_debug_stmts (); diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c index 536c4717b72..70675e4a3fc 100644 --- a/gcc/tree-ssa-threadedge.c +++ b/gcc/tree-ssa-threadedge.c @@ -692,7 +692,7 @@ simplify_control_stmt_condition_1 (edge e, void propagate_threaded_block_debug_into (basic_block dest, basic_block src) { - if (!MAY_HAVE_DEBUG_STMTS) + if (!MAY_HAVE_DEBUG_BIND_STMTS) return; if (!single_pred_p (dest)) diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 8b6da9645ce..151f544baba 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -220,7 +220,7 @@ flush_pending_stmts (edge e) void gimple_replace_ssa_lhs (gimple *stmt, tree nlhs) { - if (MAY_HAVE_DEBUG_STMTS) + if (MAY_HAVE_DEBUG_BIND_STMTS) { tree lhs = gimple_get_lhs (stmt); @@ -242,7 +242,7 @@ gimple_replace_ssa_lhs (gimple *stmt, tree nlhs) tree target_for_debug_bind (tree var) { - if (!MAY_HAVE_DEBUG_STMTS) + if (!MAY_HAVE_DEBUG_BIND_STMTS) return NULL_TREE; if (TREE_CODE (var) == SSA_NAME) @@ -307,7 +307,7 @@ insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var) int usecount = 0; tree value = NULL; - if (!MAY_HAVE_DEBUG_STMTS) + if (!MAY_HAVE_DEBUG_BIND_STMTS) return; /* If this name has already been registered for replacement, do nothing @@ -495,7 +495,7 @@ insert_debug_temps_for_defs (gimple_stmt_iterator *gsi) ssa_op_iter op_iter; def_operand_p def_p; - if (!MAY_HAVE_DEBUG_STMTS) + if (!MAY_HAVE_DEBUG_BIND_STMTS) return; stmt = gsi_stmt (*gsi); @@ -521,7 +521,7 @@ reset_debug_uses (gimple *stmt) imm_use_iterator imm_iter; gimple *use_stmt; - if (!MAY_HAVE_DEBUG_STMTS) + if (!MAY_HAVE_DEBUG_BIND_STMTS) return; FOR_EACH_PHI_OR_STMT_DEF (def_p, stmt, op_iter, SSA_OP_DEF) diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c index 6d344ad5309..d00d64852c2 100644 --- a/gcc/tree-ssanames.c +++ b/gcc/tree-ssanames.c @@ -562,7 +562,7 @@ release_ssa_name_fn (struct function *fn, tree var) int saved_ssa_name_version = SSA_NAME_VERSION (var); use_operand_p imm = &(SSA_NAME_IMM_USE_NODE (var)); - if (MAY_HAVE_DEBUG_STMTS) + if (MAY_HAVE_DEBUG_BIND_STMTS) insert_debug_temp_for_var_def (NULL, var); if (flag_checking) diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c index a0d9baf0ee5..d56fbfcbde5 100644 --- a/gcc/tree-vect-loop-manip.c +++ b/gcc/tree-vect-loop-manip.c @@ -192,7 +192,7 @@ adjust_debug_stmts_now (adjust_info *ai) static void adjust_vec_debug_stmts (void) { - if (!MAY_HAVE_DEBUG_STMTS) + if (!MAY_HAVE_DEBUG_BIND_STMTS) return; gcc_assert (adjust_vec.exists ()); @@ -214,7 +214,7 @@ adjust_debug_stmts (tree from, tree to, basic_block bb) { adjust_info ai; - if (MAY_HAVE_DEBUG_STMTS + if (MAY_HAVE_DEBUG_BIND_STMTS && TREE_CODE (from) == SSA_NAME && ! SSA_NAME_IS_DEFAULT_DEF (from) && ! virtual_operand_p (from)) @@ -242,7 +242,7 @@ adjust_phi_and_debug_stmts (gimple *update_phi, edge e, tree new_def) SET_PHI_ARG_DEF (update_phi, e->dest_idx, new_def); - if (MAY_HAVE_DEBUG_STMTS) + if (MAY_HAVE_DEBUG_BIND_STMTS) adjust_debug_stmts (orig_def, PHI_RESULT (update_phi), gimple_bb (update_phi)); } @@ -1685,7 +1685,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1, create_lcssa_for_virtual_phi (loop); update_ssa (TODO_update_ssa_only_virtuals); - if (MAY_HAVE_DEBUG_STMTS) + if (MAY_HAVE_DEBUG_BIND_STMTS) { gcc_assert (!adjust_vec.exists ()); adjust_vec.create (32); diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 1759655fd07..3e4703a3600 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -7381,7 +7381,7 @@ vect_transform_loop (loop_vec_info loop_vinfo) if (!stmt_info) continue; - if (MAY_HAVE_DEBUG_STMTS && !STMT_VINFO_LIVE_P (stmt_info)) + if (MAY_HAVE_DEBUG_BIND_STMTS && !STMT_VINFO_LIVE_P (stmt_info)) vect_loop_kill_debug_uses (loop, phi); if (!STMT_VINFO_RELEVANT_P (stmt_info) @@ -7444,7 +7444,7 @@ vect_transform_loop (loop_vec_info loop_vinfo) continue; } - if (MAY_HAVE_DEBUG_STMTS && !STMT_VINFO_LIVE_P (stmt_info)) + if (MAY_HAVE_DEBUG_BIND_STMTS && !STMT_VINFO_LIVE_P (stmt_info)) vect_loop_kill_debug_uses (loop, stmt); if (!STMT_VINFO_RELEVANT_P (stmt_info) diff --git a/gcc/tree.h b/gcc/tree.h index 306ff090408..49cbb99d2db 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -1123,8 +1123,14 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int, #define VL_EXP_OPERAND_LENGTH(NODE) \ ((int)TREE_INT_CST_LOW (VL_EXP_CHECK (NODE)->exp.operands[0])) +/* Nonzero if gimple_debug_nonbind_marker_p() may possibly hold. */ +#define MAY_HAVE_DEBUG_MARKER_STMTS 0 /* debug_nonbind_markers_p */ +/* Nonzero if gimple_debug_bind_p() (and thus + gimple_debug_source_bind_p()) may possibly hold. */ +#define MAY_HAVE_DEBUG_BIND_STMTS flag_var_tracking_assignments /* Nonzero if is_gimple_debug() may possibly hold. */ -#define MAY_HAVE_DEBUG_STMTS (flag_var_tracking_assignments) +#define MAY_HAVE_DEBUG_STMTS \ + (MAY_HAVE_DEBUG_MARKER_STMTS || MAY_HAVE_DEBUG_BIND_STMTS) /* In a LOOP_EXPR node. */ #define LOOP_EXPR_BODY(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_EXPR, 0) diff --git a/gcc/valtrack.c b/gcc/valtrack.c index d4bab00c953..610c2f6d6c4 100644 --- a/gcc/valtrack.c +++ b/gcc/valtrack.c @@ -214,7 +214,7 @@ propagate_for_debug (rtx_insn *insn, rtx_insn *last, rtx dest, rtx src, { insn = next; next = NEXT_INSN (insn); - if (DEBUG_INSN_P (insn)) + if (DEBUG_BIND_INSN_P (insn)) { loc = simplify_replace_fn_rtx (INSN_VAR_LOCATION_LOC (insn), dest, propagate_for_debug_subst, &p); diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index 16327bd43f3..33bcca7d6f5 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -1125,7 +1125,7 @@ adjust_mems (rtx loc, const_rtx old_rtx, void *data) if (tem == NULL_RTX) tem = gen_rtx_raw_SUBREG (GET_MODE (loc), addr, SUBREG_BYTE (loc)); finish_subreg: - if (MAY_HAVE_DEBUG_INSNS + if (MAY_HAVE_DEBUG_BIND_INSNS && GET_CODE (tem) == SUBREG && (GET_CODE (SUBREG_REG (tem)) == PLUS || GET_CODE (SUBREG_REG (tem)) == MINUS @@ -1337,7 +1337,7 @@ dv_onepart_p (decl_or_value dv) { tree decl; - if (!MAY_HAVE_DEBUG_INSNS) + if (!MAY_HAVE_DEBUG_BIND_INSNS) return NOT_ONEPART; if (dv_is_value_p (dv)) @@ -4861,7 +4861,7 @@ dataflow_set_clear_at_call (dataflow_set *set, rtx_insn *call_insn) EXECUTE_IF_SET_IN_HARD_REG_SET (invalidated_regs, 0, r, hrsi) var_regno_delete (set, r); - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) { set->traversed_vars = set->vars; shared_hash_htab (set->vars) @@ -5535,7 +5535,7 @@ use_type (rtx loc, struct count_use_info *cui, machine_mode *modep) variable names such as VALUEs (never happens) or DEBUG_EXPRs (only happens in the presence of debug insns). */ - && (!MAY_HAVE_DEBUG_INSNS + && (!MAY_HAVE_DEBUG_BIND_INSNS || !rtx_debug_expr_p (XEXP (loc, 0)))) return MO_USE; else @@ -6700,7 +6700,7 @@ compute_bb_dataflow (basic_block bb) dataflow_set_copy (&old_out, out); dataflow_set_copy (out, in); - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) local_get_addr_cache = new hash_map; FOR_EACH_VEC_ELT (VTI (bb)->mos, i, mo) @@ -6982,7 +6982,7 @@ compute_bb_dataflow (basic_block bb) } } - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) { delete local_get_addr_cache; local_get_addr_cache = NULL; @@ -7069,7 +7069,7 @@ vt_find_locations (void) else oldinsz = oldoutsz = 0; - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) { dataflow_set *in = &VTI (bb)->in, *first_out = NULL; bool first = true, adjust = false; @@ -7130,7 +7130,7 @@ vt_find_locations (void) if (htabmax && htabsz > htabmax) { - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) inform (DECL_SOURCE_LOCATION (cfun->decl), "variable tracking size limit exceeded with " "-fvar-tracking-assignments, retrying without"); @@ -7190,7 +7190,7 @@ vt_find_locations (void) } } - if (success && MAY_HAVE_DEBUG_INSNS) + if (success && MAY_HAVE_DEBUG_BIND_INSNS) FOR_EACH_BB_FN (bb, cfun) gcc_assert (VTI (bb)->flooded); @@ -8579,7 +8579,7 @@ vt_expand_loc (rtx loc, variable_table_type *vars) struct expand_loc_callback_data data; rtx result; - if (!MAY_HAVE_DEBUG_INSNS) + if (!MAY_HAVE_DEBUG_BIND_INSNS) return loc; INIT_ELCD (data, vars); @@ -9014,7 +9014,7 @@ emit_notes_for_changes (rtx_insn *insn, enum emit_note_where where, if (!changed_variables->elements ()) return; - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) process_changed_values (htab); data.insn = insn; @@ -9498,10 +9498,8 @@ vt_emit_notes (void) delete_variable_part). */ emit_notes = true; - if (MAY_HAVE_DEBUG_INSNS) - { - dropped_values = new variable_table_type (cselib_get_next_uid () * 2); - } + if (MAY_HAVE_DEBUG_BIND_INSNS) + dropped_values = new variable_table_type (cselib_get_next_uid () * 2); dataflow_set_init (&cur); @@ -9511,13 +9509,13 @@ vt_emit_notes (void) subsequent basic blocks. */ emit_notes_for_differences (BB_HEAD (bb), &cur, &VTI (bb)->in); - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) local_get_addr_cache = new hash_map; /* Emit the notes for the changes in the basic block itself. */ emit_notes_in_bb (bb, &cur); - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) delete local_get_addr_cache; local_get_addr_cache = NULL; @@ -9533,7 +9531,7 @@ vt_emit_notes (void) dataflow_set_destroy (&cur); - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) delete dropped_values; dropped_values = NULL; @@ -9893,7 +9891,7 @@ vt_init_cfa_base (void) cfa_base_rtx = NULL_RTX; return; } - if (!MAY_HAVE_DEBUG_INSNS) + if (!MAY_HAVE_DEBUG_BIND_INSNS) return; /* Tell alias analysis that cfa_base_rtx should share @@ -9935,7 +9933,7 @@ vt_initialize (void) VTI (bb)->permp = NULL; } - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) { cselib_init (CSELIB_RECORD_MEMORY | CSELIB_PRESERVE_CONSTANTS); scratch_regs = BITMAP_ALLOC (NULL); @@ -9948,7 +9946,7 @@ vt_initialize (void) global_get_addr_cache = NULL; } - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) { rtx reg, expr; int ofst; @@ -10078,7 +10076,7 @@ vt_initialize (void) HOST_WIDE_INT pre, post = 0; basic_block first_bb, last_bb; - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) { cselib_record_sets_hook = add_with_sets; if (dump_file && (dump_flags & TDF_DETAILS)) @@ -10129,7 +10127,7 @@ vt_initialize (void) cselib_hook_called = false; adjust_insn (bb, insn); - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) { if (CALL_P (insn)) prepare_call_arguments (bb, insn); @@ -10164,7 +10162,7 @@ vt_initialize (void) vt_init_cfa_base (); hard_frame_pointer_adjustment = fp_cfa_offset; /* Disassociate sp from fp now. */ - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) { cselib_val *v; cselib_invalidate_rtx (stack_pointer_rtx); @@ -10184,7 +10182,7 @@ vt_initialize (void) bb = last_bb; - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) { cselib_preserve_only_values (); cselib_reset_table (cselib_get_next_uid ()); @@ -10283,7 +10281,7 @@ vt_finalize (void) location_chain_pool.release (); shared_hash_pool.release (); - if (MAY_HAVE_DEBUG_INSNS) + if (MAY_HAVE_DEBUG_BIND_INSNS) { if (global_get_addr_cache) delete global_get_addr_cache; -- 2.30.2