+2018-01-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/83645
+ * var-tracking.c (delete_vta_debug_insn): New inline function.
+ (delete_vta_debug_insns): Add USE_CFG argument, if true, walk just
+ insns from get_insns () to NULL instead of each bb separately.
+ Use delete_vta_debug_insn. No longer static.
+ (vt_debug_insns_local, variable_tracking_main_1): Adjust
+ delete_vta_debug_insns callers.
+ * rtl.h (delete_vta_debug_insns): Declare.
+ * final.c (rest_of_handle_final): Call delete_vta_debug_insns
+ instead of variable_tracking_main.
+
2018-01-03 Martin Sebor <msebor@redhat.com>
PR c/83559
static int debug_label_num = 1;
+/* Remove from the insn stream a single debug insn used for
+ variable tracking at assignments. */
+
+static inline void
+delete_vta_debug_insn (rtx_insn *insn)
+{
+ if (DEBUG_MARKER_INSN_P (insn))
+ {
+ reemit_marker_as_note (insn);
+ return;
+ }
+
+ tree decl = INSN_VAR_LOCATION_DECL (insn);
+ if (TREE_CODE (decl) == LABEL_DECL
+ && DECL_NAME (decl)
+ && !DECL_RTL_SET_P (decl))
+ {
+ PUT_CODE (insn, NOTE);
+ NOTE_KIND (insn) = NOTE_INSN_DELETED_DEBUG_LABEL;
+ NOTE_DELETED_LABEL_NAME (insn)
+ = IDENTIFIER_POINTER (DECL_NAME (decl));
+ SET_DECL_RTL (decl, insn);
+ CODE_LABEL_NUMBER (insn) = debug_label_num++;
+ }
+ else
+ delete_insn (insn);
+}
+
/* Remove from the insn stream all debug insns used for variable
- tracking at assignments. */
+ tracking at assignments. USE_CFG should be false if the cfg is no
+ longer usable. */
-static void
-delete_vta_debug_insns (void)
+void
+delete_vta_debug_insns (bool use_cfg)
{
basic_block bb;
rtx_insn *insn, *next;
if (!MAY_HAVE_DEBUG_INSNS)
return;
- FOR_EACH_BB_FN (bb, cfun)
- {
- FOR_BB_INSNS_SAFE (bb, insn, next)
+ if (use_cfg)
+ FOR_EACH_BB_FN (bb, cfun)
+ {
+ FOR_BB_INSNS_SAFE (bb, insn, next)
+ if (DEBUG_INSN_P (insn))
+ delete_vta_debug_insn (insn);
+ }
+ else
+ for (insn = get_insns (); insn; insn = next)
+ {
+ next = NEXT_INSN (insn);
if (DEBUG_INSN_P (insn))
- {
- if (DEBUG_MARKER_INSN_P (insn))
- {
- reemit_marker_as_note (insn);
- continue;
- }
-
- tree decl = INSN_VAR_LOCATION_DECL (insn);
- if (TREE_CODE (decl) == LABEL_DECL
- && DECL_NAME (decl)
- && !DECL_RTL_SET_P (decl))
- {
- PUT_CODE (insn, NOTE);
- NOTE_KIND (insn) = NOTE_INSN_DELETED_DEBUG_LABEL;
- NOTE_DELETED_LABEL_NAME (insn)
- = IDENTIFIER_POINTER (DECL_NAME (decl));
- SET_DECL_RTL (decl, insn);
- CODE_LABEL_NUMBER (insn) = debug_label_num++;
- }
- else
- delete_insn (insn);
- }
- }
+ delete_vta_debug_insn (insn);
+ }
}
/* Run a fast, BB-local only version of var tracking, to take care of
vt_debug_insns_local (bool skipped ATTRIBUTE_UNUSED)
{
/* ??? Just skip it all for now. */
- delete_vta_debug_insns ();
+ delete_vta_debug_insns (true);
}
/* Free the data structures needed for variable tracking. */
any pseudos at this point. */
|| targetm.no_register_allocation)
{
- delete_vta_debug_insns ();
+ delete_vta_debug_insns (true);
return 0;
}
{
vt_finalize ();
- delete_vta_debug_insns ();
+ delete_vta_debug_insns (true);
/* This is later restored by our caller. */
flag_var_tracking_assignments = 0;