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.4] bringing patch tweaks from trunk to vta branches


I'm installing in the VTA and VTA4.4 branches the following patches, so
that they match the changes made to patches approved for and installed
in the trunk.

I'd also missed gcc/config/ia64/ia64.c in the patch that added
NONDEBUG_INSN_P to the VTA branches, but I caught that while preparing
the VTA patchset.  The last patch fixes it in the branch.

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

	* combine.c (move_deaths): Reformat to match trunk.

Index: gcc/combine.c
===================================================================
--- gcc/combine.c.orig	2009-06-05 03:53:40.000000000 -0300
+++ gcc/combine.c	2009-06-10 07:33:41.000000000 -0300
@@ -12361,7 +12361,8 @@ move_deaths (rtx x, rtx maybe_kill_insn,
 	  && ! reg_referenced_p (x, maybe_kill_insn))
 	return;
 
-      if (where_dead && BLOCK_FOR_INSN (where_dead) == BLOCK_FOR_INSN (to_insn)
+      if (where_dead
+	  && BLOCK_FOR_INSN (where_dead) == BLOCK_FOR_INSN (to_insn)
 	  && DF_INSN_LUID (where_dead) >= from_luid
 	  && DF_INSN_LUID (where_dead) < DF_INSN_LUID (to_insn))
 	{
for  gcc/ChangeLog.vta
from  Alexandre Oliva  <aoliva@redhat.com>

	* df-core.c (df_ref_debug): Reformat to match trunk.

Index: gcc/df-core.c
===================================================================
--- gcc/df-core.c.orig	2009-05-12 03:33:55.000000000 -0300
+++ gcc/df-core.c	2009-06-10 07:29:43.000000000 -0300
@@ -2126,10 +2126,14 @@ df_ref_debug (df_ref ref, FILE *file)
 	   DF_REF_IS_ARTIFICIAL (ref) ? -1 : DF_REF_INSN_UID (ref),
 	   DF_REF_FLAGS (ref),
 	   DF_REF_TYPE (ref));
-  if (DF_REF_LOC (ref) && !flag_dump_noaddr)
-    fprintf (file, "loc %p(%p) chain ", (void *)DF_REF_LOC (ref), (void *)*DF_REF_LOC (ref));
-  else if (DF_REF_LOC (ref) && flag_dump_noaddr)
-    fprintf (file, "loc #(#) chain ");
+  if (DF_REF_LOC (ref))
+    {
+      if (flag_dump_noaddr)
+	fprintf (file, "loc #(#) chain ");
+      else
+	fprintf (file, "loc %p(%p) chain ", (void *)DF_REF_LOC (ref),
+		 (void *)*DF_REF_LOC (ref));
+    }
   else
     fprintf (file, "chain ");
   df_chain_dump (DF_REF_CHAIN (ref), file);
for  ChangeLog.vta
from  Alexandre Oliva  <aoliva@redhat.com>

	* contrib/compare-debug: Use * rather than \? in portable regexp.

Index: contrib/compare-debug
===================================================================
--- contrib/compare-debug.orig	2009-06-10 07:25:12.000000000 -0300
+++ contrib/compare-debug	2009-06-10 07:28:42.000000000 -0300
@@ -78,7 +78,7 @@ else
   cmp2=
 
   for t in objdump readelf eu-readelf; do
-    if ($t --help) 2>&1 | grep -e '--\[\?section-\]\?headers' > /dev/null; then
+    if ($t --help) 2>&1 | grep -e '--\[*section-\]*headers' > /dev/null; then
       cmd=$t
 
       $cmd --section-headers "$1.$suf1" | grep '\.eh_frame' > /dev/null
for  gcc/ChangeLog.vta
from  Alexandre Oliva  <aoliva@redhat.com>

	* print-rtl.c (print_rtx): Don't duplicate MODE-printing code.

Index: gcc/print-rtl.c
===================================================================
--- gcc/print-rtl.c.orig	2009-05-13 04:07:10.000000000 -0300
+++ gcc/print-rtl.c	2009-06-10 07:26:57.000000000 -0300
@@ -205,12 +205,11 @@ print_rtx (const_rtx in_rtx)
 	    fputs ("/i", outfile);
 
 	  /* Print REG_NOTE names for EXPR_LIST and INSN_LIST.  */
-	  if (GET_CODE (in_rtx) == EXPR_LIST
-	      || GET_CODE (in_rtx) == INSN_LIST)
+	  if ((GET_CODE (in_rtx) == EXPR_LIST
+	       || GET_CODE (in_rtx) == INSN_LIST)
+	      && (int)GET_MODE (in_rtx) < REG_NOTE_MAX)
 	    fprintf (outfile, ":%s",
-		     (int)GET_MODE (in_rtx) >= REG_NOTE_MAX
-		     ? GET_MODE_NAME (GET_MODE (in_rtx))
-		     : GET_REG_NOTE_NAME (GET_MODE (in_rtx)));
+		     GET_REG_NOTE_NAME (GET_MODE (in_rtx)));
 
 	  /* For other rtl, print the mode if it's not VOID.  */
 	  else if (GET_MODE (in_rtx) != VOIDmode)
for  gcc/ChangeLog.vta
from  Alexandre Oliva  <aoliva@redhat.com>

	* gcc.c: Include mmap headers.
	(MAP_FAILED): Define default.
	(compare_debug, compare_debug_second, compare_debug_opt): Comment.
	(compare_files): New.  Add support for mmap checking, after
	splitting out of...
	(main): ... here.
	* final.c (rest_of_clean_state): Remove extraneous line break.

Index: gcc/gcc.c
===================================================================
--- gcc/gcc.c.orig	2009-06-10 07:20:30.000000000 -0300
+++ gcc/gcc.c	2009-06-10 07:25:46.000000000 -0300
@@ -84,6 +84,18 @@ compilation is specified by a string cal
 #include "flags.h"
 #include "opts.h"
 
+#ifdef HAVE_MMAP_FILE
+# include <sys/mman.h>
+# ifdef HAVE_MINCORE
+/* This is on Solaris.  */
+#  include <sys/types.h>
+# endif
+#endif
+
+#ifndef MAP_FAILED
+# define MAP_FAILED ((void *)-1)
+#endif
+
 /* By default there is no special suffix for target executables.  */
 /* FIXME: when autoconf is fixed, remove the host check - dj */
 #if defined(TARGET_EXECUTABLE_SUFFIX) && defined(HOST_EXECUTABLE_SUFFIX)
@@ -3205,9 +3217,21 @@ static struct switchstr *switches;
 
 static int n_switches;
 
+/* Set to zero if -fcompare-debug is disabled, positive if it's
+   enabled and we're running the first compilation, negative if it's
+   enabled and we're running the second compilation.  For most of the
+   time, it's in the range -1..1, but it can be temporarily set to 2
+   or 3 to indicate that the -fcompare-debug flags didn't come from
+   the command-line, but rather from the GCC_COMPARE_DEBUG environment
+   variable, until a synthesized -fcompare-debug flag is added to the
+   command line.  */
 int compare_debug;
+
+/* Set to nonzero if we've seen the -fcompare-debug-second flag.  */
 int compare_debug_second;
 
+/* Set to the flags that should be passed to the second compilation in
+   a -fcompare-debug compilation.  */
 const char *compare_debug_opt;
 
 static struct switchstr *switches_debug_check[2];
@@ -6528,6 +6552,125 @@ fatal_error (int signum)
   kill (getpid (), signum);
 }
 
+/* Compare the contents of the two files named CMPFILE[0] and
+   CMPFILE[1].  Return zero if they're identical, nonzero
+   otherwise.  */
+
+static int
+compare_files (char *cmpfile[])
+{
+  int ret = 0;
+  FILE *temp[2] = { NULL, NULL };
+  int i;
+
+#if HAVE_MMAP_FILE
+  {
+    size_t length[2];
+    void *map[2] = { NULL, NULL };
+
+    for (i = 0; i < 2; i++)
+      {
+	struct stat st;
+
+	if (stat (cmpfile[i], &st) < 0 || !S_ISREG (st.st_mode))
+	  {
+	    error ("%s: could not determine length of compare-debug file %s",
+		   input_filename, cmpfile[i]);
+	    ret = 1;
+	    break;
+	  }
+
+	length[i] = st.st_size;
+      }
+
+    if (!ret && length[0] != length[1])
+      {
+	error ("%s: -fcompare-debug failure (length)", input_filename);
+	ret = 1;
+      }
+
+    if (!ret)
+      for (i = 0; i < 2; i++)
+	{
+	  int fd = open (cmpfile[i], O_RDONLY);
+	  if (fd < 0)
+	    {
+	      error ("%s: could not open compare-debug file %s",
+		     input_filename, cmpfile[i]);
+	      ret = 1;
+	      break;
+	    }
+
+	  map[i] = mmap (NULL, length[i], PROT_READ, MAP_PRIVATE, fd, 0);
+	  close (fd);
+
+	  if (map[i] == (void *) MAP_FAILED)
+	    {
+	      ret = -1;
+	      break;
+	    }
+	}
+
+    if (!ret)
+      {
+	if (memcmp (map[0], map[1], length[0]) != 0)
+	  {
+	    error ("%s: -fcompare-debug failure", input_filename);
+	    ret = 1;
+	  }
+      }
+
+    for (i = 0; i < 2; i++)
+      if (map[i])
+	munmap ((caddr_t) map[i], length[i]);
+
+    if (ret >= 0)
+      return ret;
+
+    ret = 0;
+  }
+#endif
+
+  for (i = 0; i < 2; i++)
+    {
+      temp[i] = fopen (cmpfile[i], "r");
+      if (!temp[i])
+	{
+	  error ("%s: could not open compare-debug file %s",
+		 input_filename, cmpfile[i]);
+	  ret = 1;
+	  break;
+	}
+    }
+
+  if (!ret && temp[0] && temp[1])
+    for (;;)
+      {
+	int c0, c1;
+	c0 = fgetc (temp[0]);
+	c1 = fgetc (temp[1]);
+
+	if (c0 != c1)
+	  {
+	    error ("%s: -fcompare-debug failure",
+		   input_filename);
+	    ret = 1;
+	    break;
+	  }
+
+	if (c0 == EOF)
+	  break;
+      }
+
+  for (i = 1; i >= 0; i--)
+    {
+      if (temp[i])
+	fclose (temp[i]);
+    }
+
+  return ret;
+}
+
 extern int main (int, char **);
 
 int
@@ -7179,13 +7322,9 @@ warranty; not even for MERCHANTABILITY o
 	      value = do_spec (input_file_compiler->spec);
 	      infiles[i].compiled = true;
 	      if (value < 0)
-		{
-		  this_file_error = 1;
-		}
+		this_file_error = 1;
 	      else if (compare_debug && debug_check_temp_file[0])
 		{
-		  FILE *temp[2];
-
 		  if (verbose_flag)
 		    error ("Recompiling with -fcompare-debug");
 
@@ -7193,7 +7332,6 @@ warranty; not even for MERCHANTABILITY o
 		  n_switches = n_switches_debug_check[1];
 		  switches = switches_debug_check[1];
 
-		  debug_check_temp_file[1] = NULL;
 		  value = do_spec (input_file_compiler->spec);
 
 		  compare_debug = -compare_debug;
@@ -7210,52 +7348,11 @@ warranty; not even for MERCHANTABILITY o
 			      && strcmp (debug_check_temp_file[0],
 					 debug_check_temp_file[1]));
 
-		  temp[0] = fopen (debug_check_temp_file[0], "r");
-		  if (!temp[0])
-		    {
-		      error ("%s: could not open compare-debug file %s",
-			     input_filename, debug_check_temp_file[0]);
-		      this_file_error = 1;
-		    }
-		  temp[1] = fopen (debug_check_temp_file[1], "r");
-		  if (!temp[1])
-		    {
-		      error ("%s: could not open compare-debug file %s",
-			     input_filename, debug_check_temp_file[1]);
-		      this_file_error = 1;
-		    }
-
-		  free (debug_check_temp_file[1]);
-		  debug_check_temp_file[1] = NULL;
-		  free (debug_check_temp_file[0]);
-		  debug_check_temp_file[0] = NULL;
-
 		  if (verbose_flag)
 		    error ("Comparing final insns dumps");
 
-		  if (!this_file_error && temp[0] && temp[1])
-		    for (;;)
-		      {
-			int c0, c1;
-			c0 = fgetc (temp[0]);
-			c1 = fgetc (temp[1]);
-
-			if (c0 != c1)
-			  {
-			    error ("%s: -fcompare-debug failure",
-				   input_filename);
-			    this_file_error = 1;
-			    break;
-			  }
-
-			if (c0 == EOF)
-			  break;
-		      }
-
-		  if (temp[1])
-		    fclose (temp[1]);
-		  if (temp[0])
-		    fclose (temp[0]);
+		  if (compare_files (debug_check_temp_file))
+		    this_file_error = 1;
 		}
 
 	      if (compare_debug)
Index: gcc/final.c
===================================================================
--- gcc/final.c.orig	2009-06-10 07:20:30.000000000 -0300
+++ gcc/final.c	2009-06-10 07:21:57.000000000 -0300
@@ -4312,7 +4312,6 @@ rest_of_clean_state (void)
 	      INSN_UID (insn) = CODE_LABEL_NUMBER (insn);
 	    else
 	      INSN_UID (insn) = 0;
-
 	}
     }
 
for gcc/ChangeLog.vta
from  Alexandre Oliva  <aoliva@redhat.com>

	* config/ia64/ia64.c (emit_insn_group_barriers): Use
	NONDEBUG_INSN_P.
	(emit_all_insn_group_barriers): Likewise.
	(final_emit_insn_group_barriers): Likewise.

Index: gcc/config/ia64/ia64.c
===================================================================
--- gcc/config/ia64/ia64.c.orig	2009-05-12 03:51:18.000000000 -0300
+++ gcc/config/ia64/ia64.c	2009-06-09 00:55:04.000000000 -0300
@@ -6258,7 +6258,7 @@ emit_insn_group_barriers (FILE *dump)
 	  init_insn_group_barriers ();
 	  last_label = 0;
 	}
-      else if (INSN_P (insn) && !DEBUG_INSN_P (insn))
+      else if (NONDEBUG_INSN_P (insn))
 	{
 	  insns_since_last_label = 1;
 
@@ -6306,7 +6306,7 @@ emit_all_insn_group_barriers (FILE *dump
 
 	  init_insn_group_barriers ();
 	}
-      else if (INSN_P (insn) && !DEBUG_INSN_P (insn))
+      else if (NONDEBUG_INSN_P (insn))
 	{
 	  if (recog_memoized (insn) == CODE_FOR_insn_group_barrier)
 	    init_insn_group_barriers ();
@@ -8874,7 +8874,7 @@ final_emit_insn_group_barriers (FILE *du
 	  need_barrier_p = 0;
 	  prev_insn = NULL_RTX;
 	}
-      else if (INSN_P (insn) && !DEBUG_INSN_P (insn))
+      else if (NONDEBUG_INSN_P (insn))
 	{
 	  if (recog_memoized (insn) == CODE_FOR_insn_group_barrier)
 	    {
-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer

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