* src/mcs51/ralloc.c (getRegPtr, getRegGpr),
[fw/sdcc] / src / ds390 / gen.c
index 753bb4e80556183aae0a864d5f08ae024a4901cc..39acbf4805abf3702c40f00e523948af031615f6 100644 (file)
@@ -2675,9 +2675,16 @@ genCall (iCode * ic)
          if (size > 1)
            {
              emitcode ("mov", "b,%s", fReturn[1]);
+             _G.bInUse++;
            }
 
+         _G.accInUse++;
          aopOp (IC_RESULT (ic), ic, FALSE, FALSE);
+         _G.accInUse--;
+         
+         if (size > 1)
+           _G.bInUse--;
+
          aopPut (AOP (IC_RESULT (ic)), "a", 0);
 
          if (size > 1)
@@ -3887,7 +3894,7 @@ bool aopOp3(iCode * ic)
 {
     bool dp1InUse, dp2InUse;
     bool useDp2;
-    
+
     // First, generate the right opcode. DPTR may be used if neither left nor result are
     // of type AOP_STR.
     
@@ -3947,13 +3954,17 @@ bool aopOp3(iCode * ic)
         
     // We've op'd the left & right. So, if left or right are the same operand as result, 
     // we know aopOp will succeed, and we can just do it & bail.
-    if (isOperandEqual(IC_LEFT(ic),IC_RESULT(ic)) ||
-       isOperandEqual(IC_RIGHT(ic),IC_RESULT(ic)))
-    {
+    if (isOperandEqual(IC_LEFT(ic),IC_RESULT(ic)))
+      {
+       aopOp (IC_RESULT (ic), ic, TRUE, AOP_USESDPTR2 (IC_LEFT (ic)));
+       return TRUE;
+      }
+    if (isOperandEqual(IC_RIGHT(ic),IC_RESULT(ic)))
+      {
 //     D(emitcode(";", "aopOp3: (left | right) & result equal"););
-       aopOp(IC_RESULT(ic),ic,TRUE, FALSE);
+       aopOp(IC_RESULT(ic),ic,TRUE, AOP_USESDPTR2 (IC_RIGHT (ic)));
        return TRUE;
-    }
+      }
     
     // Operands may be equivalent (but not equal) if they share a spill location. If
     // so, use the same DPTR or DPTR2.