fixed bug #477835 for ds390-port
[fw/sdcc] / src / ds390 / gen.c
index 9db62c56fb76c3b536565bb9939fa58f8d14976e..6a073a73168dcad7631415bd5d2df548a239fd1c 100644 (file)
@@ -1842,10 +1842,10 @@ saveRegisters (iCode * lic)
              rsave = bitVectSetBit(rsave,i);
       }
   } else {
-      /* find the registers in use at this time
-        and push them away to safety */
-      rsave = bitVectCplAnd (bitVectCopy (ic->rMask),
-                            ic->rUsed);
+    /* safe the registers in use at this time but skip the
+       ones for the result */
+    rsave = bitVectCplAnd (bitVectCopy (ic->rMask),
+                          ds390_rUmaskForOp (IC_RESULT(ic)));
   }
   ic->regsSaved = 1;
   if (options.useXstack)
@@ -1896,10 +1896,10 @@ unsaveRegisters (iCode * ic)
              rsave = bitVectSetBit(rsave,i);
       }
   } else {
-      /* find the registers in use at this time
-        and push them away to safety */
-      rsave = bitVectCplAnd (bitVectCopy (ic->rMask),
-                            ic->rUsed);
+    /* restore the registers in use at this time but skip the
+       ones for the result */
+    rsave = bitVectCplAnd (bitVectCopy (ic->rMask), 
+                          ds390_rUmaskForOp (IC_RESULT(ic)));
   }
   if (options.useXstack)
     {