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]

[vta, vta4.3] dump anon vars in debug insns in sched-vis


Debugging the last few bootstrap4-debug differences in libjava on
i686, ppc64 and x86_64, I noticed sched-vis crashed while dumping
libjava.  That's because we generate lots of anonymous variables in
libjava, that VTA treats as trackable variables.

The first patch below avoids the crash.

The second patch below should save a bit of memory and disk space
compiling Java class files, avoiding the generation of DEBUG stmts,
insns and notes for anonymous variables, as well as MO_VAL_SETs for
them within the var-tracking pass.

Both patches apply cleanly on both vta and vta4.3 branches.

for  gcc/ChangeLog.vta
from  Alexandre Oliva  <aoliva@redhat.com>

	* sched-vis.c (print_insn): Dump anonymous variables.

Index: gcc/sched-vis.c
===================================================================
--- gcc/sched-vis.c.orig	2008-07-29 19:52:28.000000000 -0300
+++ gcc/sched-vis.c	2008-08-11 04:05:49.000000000 -0300
@@ -670,7 +670,18 @@ print_insn (char *buf, rtx x, int verbos
 	const char *name = "?";
 
 	if (DECL_P (INSN_VAR_LOCATION_DECL (insn)))
-	  name = IDENTIFIER_POINTER (DECL_NAME (INSN_VAR_LOCATION_DECL (insn)));
+	  {
+	    tree id = DECL_NAME (INSN_VAR_LOCATION_DECL (insn));
+	    if (id)
+	      name = IDENTIFIER_POINTER (id);
+	    else
+	      {
+		char idbuf[32];
+		sprintf (idbuf, "D.%i",
+			 DECL_UID (INSN_VAR_LOCATION_DECL (insn)));
+		name = idbuf;
+	      }
+	  }
 	if (VAR_LOC_UNKNOWN_P (INSN_VAR_LOCATION_LOC (insn)))
 	  sprintf (buf, " %4d: debug %s optimized away", INSN_UID (insn), name);
 	else
for  gcc/ChangeLog.vta
from  Alexandre Oliva  <aoliva@redhat.com>

	* tree-into-ssa.c (var_debug_value_for_decl): Don't track
	anonymous variables.

Index: gcc/tree-into-ssa.c
===================================================================
--- gcc/tree-into-ssa.c.orig	2008-07-31 22:05:41.000000000 -0300
+++ gcc/tree-into-ssa.c	2008-08-11 05:36:53.000000000 -0300
@@ -1099,6 +1099,20 @@ var_debug_value_for_decl (tree var)
   if (DECL_IGNORED_P (var))
     return false;
 
+  if (!DECL_NAME (var))
+    {
+      tree origin = DECL_ABSTRACT_ORIGIN (var);
+
+      if (!origin)
+	return false;
+
+      if (!DECL_P (origin))
+	return false;
+
+      if (!DECL_NAME (origin))
+	return false;
+    }
+
   if (!MAY_HAVE_DEBUG_STMTS)
     return false;
 
-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}
FSFLA Board Member       ÂSÃ Libre! => http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}

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