Patchwork [rl78] add some checks

login
register
mail settings
Submitter DJ Delorie
Date Aug. 10, 2012, 12:45 a.m.
Message ID <201208100045.q7A0jWm9016705@greed.delorie.com>
Download mbox | patch
Permalink /patch/176303/
State New
Headers show

Comments

DJ Delorie - Aug. 10, 2012, 12:45 a.m.
RTL checking pointed out a couple of cases where rl78.c was extracting
info from rtx without checking the rtx type first.  Applied.

2012-08-09  DJ Delorie  <dj@redhat.com>

	* config/rl78/rl78.c (rl78_alloc_physical_registers): Check for
	SET before extracting SET_SRC.
	(rl78_remove_unused_sets): Check for REG before extractnig REGNO.

Patch

Index: config/rl78/rl78.c
===================================================================
--- config/rl78/rl78.c	(revision 190277)
+++ config/rl78/rl78.c	(working copy)
@@ -2217,7 +2217,8 @@ 
 	  && GET_CODE (PATTERN (insn)) != CALL)
 	  continue;
 
-      if (GET_CODE (SET_SRC (PATTERN (insn))) == ASM_OPERANDS)
+      if (GET_CODE (PATTERN (insn)) == SET
+	  && GET_CODE (SET_SRC (PATTERN (insn))) == ASM_OPERANDS)
 	continue;
 
       valloc_method = get_attr_valloc (insn);
@@ -2644,7 +2645,7 @@ 
 
       dest = SET_DEST (insn);
 
-      if (REGNO (dest) > 23)
+      if (GET_CODE (dest) != REG || REGNO (dest) > 23)
 	continue;
 
       if (find_regno_note (insn, REG_UNUSED, REGNO (dest)))