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] Fix bootstrap on SPARC/Solaris with RTL checking


The error is:

/home/eric/svn/gcc/libgcc/../gcc/libgcc2.c: In function '__powitf2':
/home/eric/svn/gcc/libgcc/../gcc/libgcc2.c:1743: internal compiler error: RTL 
check: expected code 'reg', have 'mem' in rhs_regno, at rtl.h:956

Excerpt from df_get_call_refs:

  /* Record the registers used to pass arguments, and explicitly
     noted as clobbered.  */
  for (note = CALL_INSN_FUNCTION_USAGE (insn); note;
       note = XEXP (note, 1))
    {
      if (GET_CODE (XEXP (note, 0)) == USE)
        df_uses_record (collection_rec, &XEXP (XEXP (note, 0), 0),
			DF_REF_REG_USE, bb, insn, flags);
      else if (GET_CODE (XEXP (note, 0)) == CLOBBER)
	{
	  unsigned int regno = REGNO (XEXP (XEXP (note, 0), 0));
	  if (!bitmap_bit_p (defs_generated, regno))
	    df_defs_record (collection_rec, XEXP (note, 0), bb, insn, flags);
	}
    }

CALL_INSN_FUNCTION_USAGE doesn't only reference REGs, it can reference MEMs 
for parameters passed by reference.  The USE case is OK, but not the CLOBBER.

Bootstrapped on SPARC/Solaris 10, OK for mainline?


Btw, why is there an inconsistency between df_defs_record and df_uses_record 
for the second parameter?

df_uses_record (struct df_collection_rec *collection_rec,
                rtx *loc, enum df_ref_type ref_type,
		basic_block bb, rtx insn, enum df_ref_flags flags)

df_defs_record (struct df_collection_rec *collection_rec, 
                rtx x, basic_block bb, rtx insn, enum df_ref_flags flags)


2007-06-15  Eric Botcazou  <ebotcazou@libertysurf.fr>

	* df-scan.c (df_get_call_refs): Be prepared for MEMs inside CLOBBERs.


-- 
Eric Botcazou
Index: df-scan.c
===================================================================
--- df-scan.c	(revision 125716)
+++ df-scan.c	(working copy)
@@ -3079,9 +3079,16 @@ df_get_call_refs (struct df_collection_r
 			DF_REF_REG_USE, bb, insn, flags);
       else if (GET_CODE (XEXP (note, 0)) == CLOBBER)
 	{
-	  unsigned int regno = REGNO (XEXP (XEXP (note, 0), 0));
-	  if (!bitmap_bit_p (defs_generated, regno))
-	    df_defs_record (collection_rec, XEXP (note, 0), bb, insn, flags);
+	  if (REG_P (XEXP (XEXP (note, 0), 0)))
+	    {
+	      unsigned int regno = REGNO (XEXP (XEXP (note, 0), 0));
+	      if (!bitmap_bit_p (defs_generated, regno))
+		df_defs_record (collection_rec, XEXP (note, 0), bb,
+				insn, flags);
+	    }
+	  else
+	    df_uses_record (collection_rec, &XEXP (note, 0),
+		            DF_REF_REG_USE, bb, insn, flags);
 	}
     }
 

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