This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 2/9] [SFN] boilerplate changes in preparation to introduce nonbind markers
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Alexandre Oliva <aoliva at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 9 Oct 2017 14:54:18 +0200
- Subject: Re: [PATCH 2/9] [SFN] boilerplate changes in preparation to introduce nonbind markers
- Authentication-results: sourceware.org; auth=none
- References: <orefqoy2u9.fsf@lxoliva.fsfla.org> <20170930090827.6604-2-aoliva@redhat.com>
On Sat, Sep 30, 2017 at 11:08 AM, Alexandre Oliva <aoliva@redhat.com> wrote:
> 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.
Ok.
Thanks,
Richard.
> 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.
> (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-prop.c (ipa_modify_call_arguments): Narrow special
> handling of debug insns to debug bind insns.
> * 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_build_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.
> ---
> 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-prop.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 | 40 +++++++++++++++++++++++++++++++++--
> 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 +++++++++++++++++++++-----------------------
> 39 files changed, 175 insertions(+), 104 deletions(-)
>
> diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
> index bd3312e..cb866aa 100644
> --- a/gcc/cfgexpand.c
> +++ b/gcc/cfgexpand.c
> @@ -5285,7 +5285,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;
> @@ -5538,7 +5538,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))
> {
> @@ -6165,7 +6165,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)
> @@ -6356,7 +6356,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 3d0cefb..cd60193 100644
> --- a/gcc/cgraph.c
> +++ b/gcc/cgraph.c
> @@ -1459,7 +1459,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<tree, va_gc> **debug_args
> = decl_debug_args_lookup (e->callee->decl);
> diff --git a/gcc/combine.c b/gcc/combine.c
> index e502fa1..86d710d 100644
> --- a/gcc/combine.c
> +++ b/gcc/combine.c
> @@ -3726,7 +3726,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;
> @@ -4083,7 +4083,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;
>
> @@ -4396,7 +4396,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;
> @@ -4404,7 +4404,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);
> @@ -4414,7 +4414,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);
> @@ -4424,7 +4424,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 672fd2e..d1577a6 100644
> --- a/gcc/cse.c
> +++ b/gcc/cse.c
> @@ -7054,11 +7054,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))
> @@ -7116,12 +7116,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. */
> @@ -7161,10 +7164,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 7534d2a..6fd9548 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 c03e2ac..ae61d3d 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 f321ebb..b6e11c4 100644
> --- a/gcc/gimple-ssa-backprop.c
> +++ b/gcc/gimple-ssa-backprop.c
> @@ -726,7 +726,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 6213c49..1783e11 100644
> --- a/gcc/gimple.h
> +++ b/gcc/gimple.h
> @@ -198,13 +198,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
> @@ -4739,6 +4738,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 549e896..34cc46b 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 f96ce18..960487b 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-prop.c b/gcc/ipa-prop.c
> index 51f6221..2d15504 100644
> --- a/gcc/ipa-prop.c
> +++ b/gcc/ipa-prop.c
> @@ -4410,7 +4410,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 e3759d6..d45e951 100644
> --- a/gcc/ipa-split.c
> +++ b/gcc/ipa-split.c
> @@ -1471,7 +1471,7 @@ split_function (basic_block return_bb, struct split_point *split_point,
> {
> vec<tree, va_gc> **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)
> @@ -1484,11 +1484,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 046ce3b..17f54a0 100644
> --- a/gcc/ira.c
> +++ b/gcc/ira.c
> @@ -3842,9 +3842,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 322f151..923be72 100644
> --- a/gcc/loop-unroll.c
> +++ b/gcc/loop-unroll.c
> @@ -2026,12 +2026,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 f238106..e62ccda 100644
> --- a/gcc/reg-stack.c
> +++ b/gcc/reg-stack.c
> @@ -3028,7 +3028,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++;
> @@ -3068,7 +3068,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 73e945d4..0ce64d7 100644
> --- a/gcc/regcprop.c
> +++ b/gcc/regcprop.c
> @@ -757,7 +757,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))
> @@ -1302,7 +1302,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 7fbfa31..89380a8 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 3fd26fd..fd3d3a8 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 5e200b9..cf18b30 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 3bda77c..c79a277 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,32 @@ 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)
> +
> /* 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 ad85aa4..a24688f 100644
> --- a/gcc/sese.c
> +++ b/gcc/sese.c
> @@ -164,7 +164,7 @@ sese_build_liveouts (sese_info_p region, bitmap liveouts)
> sese_build_liveouts_bb (region, liveouts, bb);
>
> /* FIXME: We could start iterating form the successor of sese. */
> - if (MAY_HAVE_DEBUG_STMTS)
> + if (MAY_HAVE_DEBUG_BIND_STMTS)
> FOR_EACH_BB_FN (bb, cfun)
> if (!bb_in_sese_p (bb, region->region))
> sese_reset_debug_liveouts_bb (region, liveouts, bb);
> diff --git a/gcc/shrink-wrap.c b/gcc/shrink-wrap.c
> index 3cad776..85fe81d 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 c8aa77b..dca0439 100644
> --- a/gcc/ssa-iterators.h
> +++ b/gcc/ssa-iterators.h
> @@ -447,7 +447,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 99d1f1e..dc9ce3c 100644
> --- a/gcc/tree-cfg.c
> +++ b/gcc/tree-cfg.c
> @@ -2054,7 +2054,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 a226096..a142488 100644
> --- a/gcc/tree-inline.c
> +++ b/gcc/tree-inline.c
> @@ -6032,7 +6032,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)
> {
> @@ -6178,7 +6178,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<tree, va_gc> **debug_args = NULL;
> diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
> index 26b8b9a..65ccd71 100644
> --- a/gcc/tree-loop-distribution.c
> +++ b/gcc/tree-loop-distribution.c
> @@ -807,7 +807,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 f5675ed..e7167e7 100644
> --- a/gcc/tree-sra.c
> +++ b/gcc/tree-sra.c
> @@ -2477,7 +2477,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 e62afad..f60670f 100644
> --- a/gcc/tree-ssa-dce.c
> +++ b/gcc/tree-ssa-dce.c
> @@ -1086,7 +1086,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 bbea619..f8fe317 100644
> --- a/gcc/tree-ssa-loop-ivopts.c
> +++ b/gcc/tree-ssa-loop-ivopts.c
> @@ -7148,7 +7148,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 b2d0f57..a671a16 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 a65ff31..a3d5074 100644
> --- a/gcc/tree-ssa-tail-merge.c
> +++ b/gcc/tree-ssa-tail-merge.c
> @@ -1802,7 +1802,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 536c471..70675e4 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 8b6da96..151f544 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 5c96075..4318adc 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 5787d53..20d1962 100644
> --- a/gcc/tree-vect-loop-manip.c
> +++ b/gcc/tree-vect-loop-manip.c
> @@ -194,7 +194,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 ());
> @@ -216,7 +216,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))
> @@ -244,7 +244,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 bf49e26..07f666e 100644
> --- a/gcc/tree-vect-loop.c
> +++ b/gcc/tree-vect-loop.c
> @@ -7386,7 +7386,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)
> @@ -7449,7 +7449,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 caa4a69..2e8b3e9 100644
> --- a/gcc/tree.h
> +++ b/gcc/tree.h
> @@ -1126,8 +1126,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 38af3f0..8d864c9 100644
> --- a/gcc/valtrack.c
> +++ b/gcc/valtrack.c
> @@ -211,7 +211,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 51e519a..43fc71a 100644
> --- a/gcc/var-tracking.c
> +++ b/gcc/var-tracking.c
> @@ -1118,7 +1118,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
> @@ -1330,7 +1330,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))
> @@ -4854,7 +4854,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)
> @@ -5528,7 +5528,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
> @@ -6693,7 +6693,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<rtx, rtx>;
>
> FOR_EACH_VEC_ELT (VTI (bb)->mos, i, mo)
> @@ -6975,7 +6975,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;
> @@ -7062,7 +7062,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;
> @@ -7123,7 +7123,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");
> @@ -7183,7 +7183,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);
>
> @@ -8572,7 +8572,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);
> @@ -9007,7 +9007,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;
> @@ -9491,10 +9491,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);
>
> @@ -9504,13 +9502,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<rtx, rtx>;
>
> /* 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;
>
> @@ -9526,7 +9524,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;
>
> @@ -9886,7 +9884,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
> @@ -9928,7 +9926,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);
> @@ -9941,7 +9939,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;
> @@ -10071,7 +10069,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))
> @@ -10122,7 +10120,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);
> @@ -10157,7 +10155,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);
> @@ -10177,7 +10175,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 ());
> @@ -10276,7 +10274,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.9.5
>