This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[rl78] add some checks
- From: DJ Delorie <dj at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 9 Aug 2012 20:45:32 -0400
- Subject: [rl78] add some checks
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.
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)))