BUG in packForPush
authorsandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 5 Mar 2001 08:53:59 +0000 (08:53 +0000)
committersandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 5 Mar 2001 08:53:59 +0000 (08:53 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@666 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/ds390/ralloc.c
src/mcs51/ralloc.c

index 7bc49eae623c18f1e56e68fee23c4ab51a2433dd..cd3947356f2c185d5866269031611e3ddf50d29e 100644 (file)
@@ -2169,7 +2169,8 @@ accuse:
 static void
 packForPush (iCode * ic, eBBlock * ebp)
 {
-  iCode *dic;
+  iCode *dic, *lic;
+  bitVect *dbv;
 
   if (ic->op != IPUSH || !IS_ITEMP (IC_LEFT (ic)))
     return;
@@ -2187,6 +2188,13 @@ packForPush (iCode * ic, eBBlock * ebp)
   if (dic->op != '=' || POINTER_SET (dic))
     return;
 
+  /* make sure the right side does not have any definitions
+     inbetween */
+  dbv = OP_DEFS(IC_RIGHT(dic));
+  for (lic = ic; lic != dic ; lic = lic->prev) {
+         if (bitVectBitValue(dbv,lic->key)) return ;
+  }
+
   /* we now we know that it has one & only one def & use
      and the that the definition is an assignment */
   IC_LEFT (ic) = IC_RIGHT (dic);
index fb5f65c9904b6e9efa463a9bf8b94e0a7a176644..a5a61a86d667d0785436453bf504c8c1ba7eac5b 100644 (file)
@@ -2173,7 +2173,8 @@ accuse:
 static void
 packForPush (iCode * ic, eBBlock * ebp)
 {
-  iCode *dic;
+  iCode *dic, *lic;
+  bitVect *dbv;
 
   if (ic->op != IPUSH || !IS_ITEMP (IC_LEFT (ic)))
     return;
@@ -2191,6 +2192,12 @@ packForPush (iCode * ic, eBBlock * ebp)
   if (dic->op != '=' || POINTER_SET (dic))
     return;
 
+  /* make sure the right side does not have any definitions
+     inbetween */
+  dbv = OP_DEFS(IC_RIGHT(dic));
+  for (lic = ic; lic != dic ; lic = lic->prev) {
+         if (bitVectBitValue(dbv,lic->key)) return ;
+  }
   /* we now we know that it has one & only one def & use
      and the that the definition is an assignment */
   IC_LEFT (ic) = IC_RIGHT (dic);