]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[SFN] boilerplate changes in preparation to introduce nonbind markers
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 12 Dec 2017 02:15:00 +0000 (02:15 +0000)
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 12 Dec 2017 02:15:00 +0000 (02:15 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@255565 138bc75d-0d04-0410-961f-82ee72b054a4

40 files changed:
gcc/ChangeLog
gcc/cfgexpand.c
gcc/cgraph.c
gcc/combine.c
gcc/cse.c
gcc/dce.c
gcc/function.c
gcc/gimple-ssa-backprop.c
gcc/gimple.h
gcc/haifa-sched.c
gcc/insn-notes.def
gcc/ipa-param-manipulation.c
gcc/ipa-split.c
gcc/ira.c
gcc/loop-unroll.c
gcc/reg-stack.c
gcc/regcprop.c
gcc/regrename.c
gcc/regstat.c
gcc/reload1.c
gcc/rtl.h
gcc/sese.c
gcc/shrink-wrap.c
gcc/ssa-iterators.h
gcc/tree-cfg.c
gcc/tree-inline.c
gcc/tree-loop-distribution.c
gcc/tree-sra.c
gcc/tree-ssa-dce.c
gcc/tree-ssa-loop-ivopts.c
gcc/tree-ssa-reassoc.c
gcc/tree-ssa-tail-merge.c
gcc/tree-ssa-threadedge.c
gcc/tree-ssa.c
gcc/tree-ssanames.c
gcc/tree-vect-loop-manip.c
gcc/tree-vect-loop.c
gcc/tree.h
gcc/valtrack.c
gcc/var-tracking.c

index 6d0a64e6adcc6231b642f12e667df13948589269..286a0fbac94caee07563e56c5e87b90cf7f660ae 100644 (file)
@@ -1,5 +1,100 @@
 2017-12-12  Alexandre Oliva <aoliva@redhat.com>
 
+       * 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.
index d1140602da4b4f377533692abe717e96097281d5..b1646a5ec507bc93fed570abbd9ba0b8f8cfb476 100644 (file)
@@ -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)
index 7ac58ce91c1aea4145b87f8175f68a377c0c35d3..17a0d32ce5eab757ce9736f7cba2303c8f81979a 100644 (file)
@@ -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<tree, va_gc> **debug_args
            = decl_debug_args_lookup (e->callee->decl);
index 7f10c67bf0f615b39f097605543f6c884c84552e..f4e94450c094c44b2569bc46dad0406d9a1efb3c 100644 (file)
@@ -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);
index 65cc9ae110c1468fa194f587cae11f3fa424a442..e449223cbb251590fd70ea9bd4d5bb27a6918076 100644 (file)
--- 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.  */
index 7534d2abadf69f67df8b153a744788687b82cee0..6fd9548015cebf5d7a42ae820bb4a893e77b2092 100644 (file)
--- 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
index 1fa538b4b7fd21a9a4fd40d8e9a21cf81fed95b1..88f93db6cf0fd674ae0c5e8116417868c0ed249d 100644 (file)
@@ -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);
 
index 1daa0ceef0ace5c079a4d3a59d1ac7103cb9be8a..8068c2ab1f715e2fa607bfab9a3a740d75a0f8c4 100644 (file)
@@ -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);
 }
index 0fcdd05aaba684f775954401152a817be66f1594..d34aa142849cf90a3757e71ed81584123d05aa49 100644 (file)
@@ -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
index f5c06a95bb6742475bf7d1f2c5ea16456fa21efe..b7c0b3a6f4ffb06df3253ef9187267e90f694914 100644 (file)
@@ -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",
index f96ce18ecb6dfae4a237fbb11e0b635af2900003..960487b31db1f65f63f6359b4e5a4aa9f0d7fa44 100644 (file)
@@ -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,
index bedd201f6dd1e9f1a9d7be4680847a76cf5b6420..bcc736b99c0f0bb786b169f112d79cebba3fea90 100644 (file)
@@ -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;
index 7ebd51554e5694c2651c563c99f0f63a0633b389..48857c2aab3782bb34988d2b4bc19870450f7130 100644 (file)
@@ -1485,7 +1485,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)
@@ -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))
index a9ed17ea308bbe0edff4dafdbacbfa5215569d74..79837da1db5142f5819d0d7ea53f215b4c2b1224 100644 (file)
--- 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)
index 0fdecd7fde2d693a04f4a138023d923d4c9e3eda..cc154da9686a7f9b50a04deefcfdab7a263a03fe 100644 (file)
@@ -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);
index 4f67a7bfa5076f17c0fc24bbf9772f5f8d7c8951..fe754b242d584429eeafea540afc5349301d80ff 100644 (file)
@@ -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--;
index b80019b5be0d8761a59234a940f8e54f7a9136e2..15d8b140ce7f473bdc7d09049229284ec7873c64 100644 (file)
@@ -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)
index 7fbfa3162ca6dbdc4cf26f2486934642e3626d52..89380a8770044c196877503ac36498eb6e51d12f 100644 (file)
@@ -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),
index 3fd26fd2fc688423278c65e779003cf108aabe52..fd3d3a8d98bd75457d1c5ef7da4fbb2762880e78 100644 (file)
@@ -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;
index e15bd8a2c1a94af0e517fd44a6e6bf462fd7ee33..322696a25f3e5b6e306f84a2fb7ca55dd3569beb 100644 (file)
@@ -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)
                    {
index 9cc982172f531aec0390f057d6775cc1f0bb1464..4de167d982cf2efb26561872d75a7646bc05385e 100644 (file)
--- 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) \
index 89cddf0ec974b73b1b247f39925d5bad978e8ee0..bbc72d4d7618bfc5241f11d89e24b84561c3fc09 100644 (file)
@@ -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;
index ce2ddfc09f783c9b3354649438760c19f4f9b735..91745936e95afb9df3c4a030c7fa00fe07caa65c 100644 (file)
@@ -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)
index 740cbf13cb2b5d626af308bfa11830bd9386f7a2..201bf190cefab537a2a4a3c9ff2064afa95588c0 100644 (file)
@@ -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))
index 4d09b2cc99d7a0c0f14b05ddeed958fbbae5079f..00f86613137a1ee07e152d2d1262e328ab12824e 100644 (file)
@@ -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,
index ca98e43327ec44feb4c22df61e8a6a416aa42e68..e6e3f129d4276b6b716bea711ad7a561d919dd71 100644 (file)
@@ -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<tree, va_gc> **debug_args = NULL;
index 29825cc3f53041f9d3830961c8798a4e31eb24e2..7439a1f370e8f17470ea4007ae5722705f786ad2 100644 (file)
@@ -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];
index 54f1c8d54d5b8700ec9948e3142e083a32dd78aa..daef8d72cd0e05684cd0326413125ec23901374d 100644 (file)
@@ -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);
index 8595decc7023316603709e52e868f368418f3e3a..1e1307b2ff72746b82c2521c0cd50ef7c66a8ada 100644 (file)
@@ -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)))
     {
index 65794b2b777e8d660d062df1fda2bec73cc7b895..350f94dfc33f3b55fc3a3ecf1c9a36fddb9004c9 100644 (file)
@@ -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;
index 485d0a692ce8ddd6194ce75496f1eb8e41d9b652..b037dfbff8fb00be3acb6095353db68f2278e666 100644 (file)
@@ -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;
index e90283b9cc8bd7a00edd44918fa2b99dc51c2a9a..fc94f5d83d2c926cd5186f81602618e15c78c25f 100644 (file)
@@ -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 ();
index 536c4717b725b2ec488ad9dc9f506540e498ac1f..70675e4a3fcda9acbf58cff473603d2478171406 100644 (file)
@@ -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))
index 8b6da9645ce020f73b02c2c56676ff022459151d..151f544babada65f208cf26e21f63e1f6d75514b 100644 (file)
@@ -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)
index 6d344ad5309627ff9a9e87410e97bdd1d735467c..d00d64852c2eecf3435be00d2f18fdd85941ee2a 100644 (file)
@@ -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)
index a0d9baf0ee52675c48ec79d66191d973dd6d7b9f..d56fbfcbde5a484ad3a7213ce529cdabcd0cf4ea 100644 (file)
@@ -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);
index 1759655fd0728bdb6faf99b9be3a362df260da32..3e4703a360049119deafe1c9fdf4317bd506a9dc 100644 (file)
@@ -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)
index 306ff0904081f4b674eaa492f8d9e9641fd636cf..49cbb99d2db2e805a94f4f0f107cf54e0a8f318f 100644 (file)
@@ -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)
index d4bab00c9534cb1ce41d3d131a022c34b4334810..610c2f6d6c430ef25e0390233b8568755f81097e 100644 (file)
@@ -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);
index 16327bd43f331420dcc3e14d71feffe8f0b0c48f..33bcca7d6f52c5827bab8da399dc593d1bd4c935 100644 (file)
@@ -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<rtx, rtx>;
 
   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<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;
 
@@ -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;