This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Improvements for debugging of var-tracking


Hi!

This patch fixes -fdump-rtl-vartrack-all dump (nameless decls don't need
  name: D.1571 D.1571
style output, just one D.1571 is enough, for DEBUG_EXPR_DECLs we should use
  name: D#53
and for variables with names other printouts include the D.NNNN for TDF_UID
immediately after name, without any spaces.
Also, this patch adds debug_dv routine, which is very helpful when in
var-tracking one doesn't know whether a decl_or_value is actually a tree or
rtx.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2010-02-25  Jakub Jelinek  <jakub@redhat.com>

	* Makefile.in (var-tracking.o): Depend on $(DIAGNOSTIC_H).
	* var-tracking.c: Include diagnostic.h.
	(debug_dv): New function.
	(dump_var): Print DEBUG_EXPR_DECLs as D#N instead of D.-N.

--- gcc/Makefile.in.jj	2010-02-23 12:15:50.000000000 +0100
+++ gcc/Makefile.in	2010-02-25 15:18:19.644418528 +0100
@@ -3025,7 +3025,7 @@ var-tracking.o : var-tracking.c $(CONFIG
    $(RTL_H) $(TREE_H) hard-reg-set.h insn-config.h reload.h $(FLAGS_H) \
    $(BASIC_BLOCK_H) output.h sbitmap.h alloc-pool.h $(FIBHEAP_H) $(HASHTAB_H) \
    $(REGS_H) $(EXPR_H) $(TIMEVAR_H) $(TREE_PASS_H) $(TREE_FLOW_H) \
-   cselib.h $(TARGET_H) $(TOPLEV_H) $(PARAMS_H)
+   cselib.h $(TARGET_H) $(TOPLEV_H) $(PARAMS_H) $(DIAGNOSTIC_H)
 profile.o : profile.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
    $(TREE_H) $(FLAGS_H) output.h $(REGS_H) $(EXPR_H) $(FUNCTION_H) \
    $(TOPLEV_H) $(COVERAGE_H) $(TREE_FLOW_H) value-prof.h cfghooks.h \
--- gcc/var-tracking.c.jj	2010-02-23 15:09:44.000000000 +0100
+++ gcc/var-tracking.c	2010-02-25 15:03:16.000000000 +0100
@@ -111,6 +111,7 @@
 #include "target.h"
 #include "toplev.h"
 #include "params.h"
+#include "diagnostic.h"
 
 /* var-tracking.c assumes that tree code with the same value as VALUE rtx code
    has no chance to appear in REG_EXPR/MEM_EXPRs and isn't a decl.
@@ -819,6 +820,17 @@ dv_from_value (rtx value)
   return dv;
 }
 
+extern void debug_dv (decl_or_value dv);
+
+void
+debug_dv (decl_or_value dv)
+{
+  if (dv_is_value_p (dv))
+    debug_rtx (dv_as_value (dv));
+  else
+    debug_generic_stmt (dv_as_decl (dv));
+}
+
 typedef unsigned int dvuid;
 
 /* Return the uid of DV.  */
@@ -5759,14 +5771,17 @@ dump_var (variable var)
       const_tree decl = dv_as_decl (var->dv);
 
       if (DECL_NAME (decl))
-	fprintf (dump_file, "  name: %s",
-		 IDENTIFIER_POINTER (DECL_NAME (decl)));
+	{
+	  fprintf (dump_file, "  name: %s",
+		   IDENTIFIER_POINTER (DECL_NAME (decl)));
+	  if (dump_flags & TDF_UID)
+	    fprintf (dump_file, "D.%u", DECL_UID (decl));
+	}
+      else if (TREE_CODE (decl) == DEBUG_EXPR_DECL)
+	fprintf (dump_file, "  name: D#%u", DEBUG_TEMP_UID (decl));
       else
 	fprintf (dump_file, "  name: D.%u", DECL_UID (decl));
-      if (dump_flags & TDF_UID)
-	fprintf (dump_file, " D.%u\n", DECL_UID (decl));
-      else
-	fprintf (dump_file, "\n");
+      fprintf (dump_file, "\n");
     }
   else
     {

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]