fixed bug #477835 for ds390-port
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 9 Dec 2001 11:45:10 +0000 (11:45 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 9 Dec 2001 11:45:10 +0000 (11:45 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1664 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/ds390/gen.c
src/ds390/ralloc.c
src/ds390/ralloc.h

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)
     {
index 8722a5c9be145231a3676c81bbc7a6b3b214ae14..c0f472c98a961857bde8bcc957c8d5981a11aec2 100644 (file)
@@ -1408,8 +1408,8 @@ static void fillGaps()
 /*-----------------------------------------------------------------*/
 /* rUmaskForOp :- returns register mask for an operand             */
 /*-----------------------------------------------------------------*/
-static bitVect *
-rUmaskForOp (operand * op)
+bitVect *
+ds390_rUmaskForOp (operand * op)
 {
   bitVect *rumask;
   symbol *sym;
@@ -1449,7 +1449,7 @@ regsUsedIniCode (iCode * ic)
   if (ic->op == IFX)
     {
       rmask = bitVectUnion (rmask,
-                           rUmaskForOp (IC_COND (ic)));
+                           ds390_rUmaskForOp (IC_COND (ic)));
       goto ret;
     }
 
@@ -1457,7 +1457,7 @@ regsUsedIniCode (iCode * ic)
   if (ic->op == JUMPTABLE)
     {
       rmask = bitVectUnion (rmask,
-                           rUmaskForOp (IC_JTCOND (ic)));
+                           ds390_rUmaskForOp (IC_JTCOND (ic)));
 
       goto ret;
     }
@@ -1465,16 +1465,16 @@ regsUsedIniCode (iCode * ic)
   /* of all other cases */
   if (IC_LEFT (ic))
     rmask = bitVectUnion (rmask,
-                         rUmaskForOp (IC_LEFT (ic)));
+                         ds390_rUmaskForOp (IC_LEFT (ic)));
 
 
   if (IC_RIGHT (ic))
     rmask = bitVectUnion (rmask,
-                         rUmaskForOp (IC_RIGHT (ic)));
+                         ds390_rUmaskForOp (IC_RIGHT (ic)));
 
   if (IC_RESULT (ic))
     rmask = bitVectUnion (rmask,
-                         rUmaskForOp (IC_RESULT (ic)));
+                         ds390_rUmaskForOp (IC_RESULT (ic)));
 
 ret:
   return rmask;
index 4e6116c36dd51173200956b7674017311554e210..4dde61b64bd32beafd1f727e339fb8bd61a37525 100644 (file)
@@ -60,6 +60,8 @@ extern regs regs390[];
 
 regs *ds390_regWithIdx (int);
 
+bitVect *ds390_rUmaskForOp (operand * op);
+
 extern int ds390_ptrRegReq;
 extern int ds390_nRegs;