diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4728a86d9271d1e55147ecb2bcdecd92215e5148..3f2dfc3032ce53ce0512f281ce7c119988b7aae0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2003-11-02  Zack Weinberg  <zack@codesourcery.com>
+
+	* print-rtl.c (print_rtx): Call PRINT_REG with second argument -1.
+	* config/i386/i386.c (print_reg): Abort on a virtual register
+	if code != -1; not if file == asm_out_file.
+	* config/i386/i386.h (PRINT_REG): Document meaning of CODE == -1.
+	(DEBUG_PRINT_REG): Delete, unused.
+
 2003-11-02  Andreas Schwab  <schwab@suse.de>
 
 	* config/ia64/fde-glibc.c (_GNU_SOURCE): Define to 1 instead of
@@ -164,36 +172,36 @@
 	code.
 
 2003-10-31  Andreas Jaeger  <aj@suse.de>,
-            Zack Weinberg  <zack@codesourcery.com>
-
-
-        * crtstuff.c (__register_frame_info, __register_frame_info_bases)
-        (__deregister_frame_info, __deregister_frame_info_bases):
-        Constify void * argument.
-        * unwind-dw2-fde.h (struct fde_vector):
-        Constify 'orig_data' and 'array' fields.
-        (__register_frame_info, __register_frame_info_bases)
-        (__deregister_frame_info, __deregister_frame_info_bases):
-        Constify void * argument.
-        (get_cie, next_fde, _Unwind_Find_FDE): Constify arguments,
-        return values, and casts of type fde *, struct dwarf_fde *,
-        and struct dwarf_cie *.
-        * unwind-dw2-fde.c (__register_frame_info, __register_frame_info_bases)
-        (__deregister_frame_info, __deregister_frame_info_bases):
-        Constify void * argument.
-        (get_cie_encoding, ): Constify struct dwarf_cie * argument.
-        (get_fde_encoding, fde_unencoded_compare, fde_single_encoding_compare)
-        (fde_mixed_encoding_compare, fde_compare_t, start_fde_sort, fde_insert)
-        fde_split, SWAP, frame_downheap, frame_heapsort)
-        (classify_object_over_fdes, add_fdes, linear_search_fdes,
-        binary_search_unencoded_fdes, binary_search_single_encoding_fdes,
-        binary_search_mixed_encoding_fdes, search_object, _Unwind_Find_FDE):
-        Constify arguments, local variables, return values, and casts
-        of type fde *, fde **, struct dwarf_fde *, and struct dwarf_cie *.
-        Use const pointer types in sizeof expressions, for clarity.
-        * unwind-dw2-fde-glibc.c
-        (_Unwind_find_registered_FDE, _Unwind_find_FDE): Constify return value.
-        (struct unw_eh_callback_data): Constify 'ret' field.
+	    Zack Weinberg  <zack@codesourcery.com>
+
+
+	* crtstuff.c (__register_frame_info, __register_frame_info_bases)
+	(__deregister_frame_info, __deregister_frame_info_bases):
+	Constify void * argument.
+	* unwind-dw2-fde.h (struct fde_vector):
+	Constify 'orig_data' and 'array' fields.
+	(__register_frame_info, __register_frame_info_bases)
+	(__deregister_frame_info, __deregister_frame_info_bases):
+	Constify void * argument.
+	(get_cie, next_fde, _Unwind_Find_FDE): Constify arguments,
+	return values, and casts of type fde *, struct dwarf_fde *,
+	and struct dwarf_cie *.
+	* unwind-dw2-fde.c (__register_frame_info, __register_frame_info_bases)
+	(__deregister_frame_info, __deregister_frame_info_bases):
+	Constify void * argument.
+	(get_cie_encoding, ): Constify struct dwarf_cie * argument.
+	(get_fde_encoding, fde_unencoded_compare, fde_single_encoding_compare)
+	(fde_mixed_encoding_compare, fde_compare_t, start_fde_sort, fde_insert)
+	fde_split, SWAP, frame_downheap, frame_heapsort)
+	(classify_object_over_fdes, add_fdes, linear_search_fdes,
+	binary_search_unencoded_fdes, binary_search_single_encoding_fdes,
+	binary_search_mixed_encoding_fdes, search_object, _Unwind_Find_FDE):
+	Constify arguments, local variables, return values, and casts
+	of type fde *, fde **, struct dwarf_fde *, and struct dwarf_cie *.
+	Use const pointer types in sizeof expressions, for clarity.
+	* unwind-dw2-fde-glibc.c
+	(_Unwind_find_registered_FDE, _Unwind_find_FDE): Constify return value.
+	(struct unw_eh_callback_data): Constify 'ret' field.
 
 2003-10-31  Fariborz Jahanian  <fjahanian@apple.com>
 	    David Edelsohn  <edelsohn@gnu.org>
@@ -265,7 +273,7 @@
 2003-10-30  Eric Christopher  <echristo@redhat.com>
 
 	* function.c (purge_addressof_1): Add case for REG_RETVAL
-        notes when modes are unequal.
+	notes when modes are unequal.
 
 2003-10-31  Jan Hubicka  <jh@suse.cz>
 
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index a42f1746317a1531e6d8a6538a3188c0d569520e..3bcc5eb436c5e8e0d041b9beaa1815017d068a99 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -6993,11 +6993,14 @@ put_condition_code (enum rtx_code code, enum machine_mode mode, int reverse,
 void
 print_reg (rtx x, int code, FILE *file)
 {
-  if ((REGNO (x) == ARG_POINTER_REGNUM
-       || REGNO (x) == FRAME_POINTER_REGNUM
-       || REGNO (x) == FLAGS_REG
-       || REGNO (x) == FPSR_REG)
-      && file == asm_out_file)
+  /* Code -1 indicates we are called from print_rtx, and it is not
+     an error for a virtual register to appear here.  */
+  if (code == -1)
+    code = 0;
+  else if (REGNO (x) == ARG_POINTER_REGNUM
+	   || REGNO (x) == FRAME_POINTER_REGNUM
+	   || REGNO (x) == FLAGS_REG
+	   || REGNO (x) == FPSR_REG)
     abort ();
 
   if (ASSEMBLER_DIALECT == ASM_ATT || USER_LABEL_PREFIX[0] == 0)
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 24a234172efa4918be8bc1a776aa510ddea34f7f..2f5630a3bd922c3632b86f3022291d80abfc80a0 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2882,7 +2882,8 @@ do {									\
    If CODE is 'k', pretend the mode is SImode.
    If CODE is 'q', pretend the mode is DImode.
    If CODE is 'h', pretend the reg is the `high' byte register.
-   If CODE is 'y', print "st(0)" instead of "st", if the reg is stack op.  */
+   If CODE is 'y', print "st(0)" instead of "st", if the reg is stack op.
+   If CODE is -1, it is not an error for X to be a virtual register.  */
 
 #define PRINT_REG(X, CODE, FILE)  \
   print_reg ((X), (CODE), (FILE))
@@ -2899,70 +2900,6 @@ do {						\
     goto FAIL;					\
 } while (0);
 
-/* Print the name of a register for based on its machine mode and number.
-   This macro is used to print debugging output.
-   This macro is different from PRINT_REG in that it may be used in
-   programs that are not linked with aux-output.o.  */
-
-#define DEBUG_PRINT_REG(X, CODE, FILE)			\
-  do { static const char * const hi_name[] = HI_REGISTER_NAMES;	\
-       static const char * const qi_name[] = QI_REGISTER_NAMES;	\
-       fprintf ((FILE), "%d ", REGNO (X));		\
-       if (REGNO (X) == FLAGS_REG)			\
-	 { fputs ("flags", (FILE)); break; }		\
-       if (REGNO (X) == DIRFLAG_REG)			\
-	 { fputs ("dirflag", (FILE)); break; }		\
-       if (REGNO (X) == FPSR_REG)			\
-	 { fputs ("fpsr", (FILE)); break; }		\
-       if (REGNO (X) == ARG_POINTER_REGNUM)		\
-	 { fputs ("argp", (FILE)); break; }		\
-       if (REGNO (X) == FRAME_POINTER_REGNUM)		\
-	 { fputs ("frame", (FILE)); break; }		\
-       if (STACK_TOP_P (X))				\
-	 { fputs ("st(0)", (FILE)); break; }		\
-       if (FP_REG_P (X))				\
-	 { fputs (hi_name[REGNO(X)], (FILE)); break; }	\
-       if (REX_INT_REG_P (X))				\
-	 {						\
-	   switch (GET_MODE_SIZE (GET_MODE (X)))	\
-	     {						\
-	     default:					\
-	     case 8:					\
-	       fprintf ((FILE), "r%i", REGNO (X)	\
-			- FIRST_REX_INT_REG + 8);	\
-	       break;					\
-	     case 4:					\
-	       fprintf ((FILE), "r%id", REGNO (X)	\
-			- FIRST_REX_INT_REG + 8);	\
-	       break;					\
-	     case 2:					\
-	       fprintf ((FILE), "r%iw", REGNO (X)	\
-			- FIRST_REX_INT_REG + 8);	\
-	       break;					\
-	     case 1:					\
-	       fprintf ((FILE), "r%ib", REGNO (X)	\
-			- FIRST_REX_INT_REG + 8);	\
-	       break;					\
-	     }						\
-	   break;					\
-	 }						\
-       switch (GET_MODE_SIZE (GET_MODE (X)))		\
-	 {						\
-	 case 8:					\
-	   fputs ("r", (FILE));				\
-	   fputs (hi_name[REGNO (X)], (FILE));		\
-	   break;					\
-	 default:					\
-	   fputs ("e", (FILE));				\
-	 case 2:					\
-	   fputs (hi_name[REGNO (X)], (FILE));		\
-	   break;					\
-	 case 1:					\
-	   fputs (qi_name[REGNO (X)], (FILE));		\
-	   break;					\
-	 }						\
-     } while (0)
-
 /* a letter which is not needed by the normal asm syntax, which
    we can use for operand syntax in the extended asm */
 
diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c
index 4d05136cf3f882aa5a6e4fd9536cebade0c6ada4..5c3b8d4443eb4752018e4cbfe68f8fb81f591ae9 100644
--- a/gcc/print-rtl.c
+++ b/gcc/print-rtl.c
@@ -386,7 +386,7 @@ print_rtx (rtx in_rtx)
 	    if (GET_CODE (in_rtx) == REG && value < FIRST_PSEUDO_REGISTER)
 	      {
 		fputc (' ', outfile);
-		PRINT_REG (in_rtx, 0, outfile);
+		PRINT_REG (in_rtx, -1, outfile);
 	      }
 	    else if (GET_CODE (in_rtx) == REG
 		     && value <= LAST_VIRTUAL_REGISTER)