[rl78] verify clobbers
diff mbox

Message ID 201401210430.s0L4Umsp011209@greed.delorie.com
State New
Headers show

Commit Message

DJ Delorie Jan. 21, 2014, 4:30 a.m. UTC
Minor tweak to make sure we don't try to take the REGNO of a MEM.
Committed.

	* config/rl78/rl78.c (rl78_propogate_register_origins): Verify
	that CLOBBERs are REGs before propogating their values.

Patch
diff mbox

Index: config/rl78/rl78.c
===================================================================
--- config/rl78/rl78.c	(revision 206866)
+++ config/rl78/rl78.c	(working copy)
@@ -3423,13 +3423,14 @@  rl78_propogate_register_origins (void)
 	  pat = PATTERN (insn);
 
 	  if (GET_CODE (pat) == PARALLEL)
 	    {
 	      rtx clobber = XVECEXP (pat, 0, 1);
 	      pat = XVECEXP (pat, 0, 0);
-	      if (GET_CODE (clobber) == CLOBBER)
+	      if (GET_CODE (clobber) == CLOBBER
+		  && GET_CODE (XEXP (clobber, 0)) == REG)
 		{
 		  int cr = REGNO (XEXP (clobber, 0));
 		  int mb = GET_MODE_SIZE (GET_MODE (XEXP (clobber, 0)));
 		  if (dump_file)
 		    fprintf (dump_file, "reset origins of %d regs at %d\n", mb, cr);
 		  for (i = 0; i < mb; i++)
@@ -3566,13 +3567,14 @@  rl78_propogate_register_origins (void)
 			    origins[i] = i;
 			    age[i] = 0;
 			  }
 		    }
 		}
 	    }
-	  else if (GET_CODE (pat) == CLOBBER)
+	  else if (GET_CODE (pat) == CLOBBER
+		   && GET_CODE (XEXP (pat, 0)) == REG)
 	    {
 	      if (REG_P (XEXP (pat, 0)))
 		{
 		  unsigned int reg = REGNO (XEXP (pat, 0));
 
 		  origins[reg] = reg;