fix AOP_OP_3_NOFATAL
authorkvigor <kvigor@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 30 Jan 2001 19:13:44 +0000 (19:13 +0000)
committerkvigor <kvigor@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 30 Jan 2001 19:13:44 +0000 (19:13 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@550 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/ds390/gen.c

index 13459ab01b28e91feefc1249104eddcb04723092..e2db1f70ae380a45fd4f9d29decde86dbc5d74ed 100644 (file)
@@ -2969,17 +2969,24 @@ static void adjustArithmeticResult(iCode *ic)
 #define AOP_OP_3_NOFATAL(ic, rc) \
     aopOp (IC_RIGHT(ic),ic,FALSE, FALSE); \
     aopOp (IC_LEFT(ic),ic,FALSE, (AOP_TYPE(IC_RIGHT(ic)) == AOP_DPTR)); \
-    aopOp (IC_RESULT(ic),ic,TRUE, (AOP_TYPE(IC_LEFT(ic)) == AOP_DPTR) || \
-                                 (AOP_TYPE(IC_RIGHT(ic)) == AOP_DPTR)); \
     if (AOP_TYPE(IC_LEFT(ic)) == AOP_DPTR2 && \
-        AOP_TYPE(IC_RESULT(ic)) == AOP_DPTR2) \
+        isOperandInFarSpace(IC_RESULT(ic))) \
     { \
+       /* No can do; DPTR & DPTR2 in use, and we need another. */ \
        rc = TRUE; \
-       freeAsmop(IC_RESULT(ic), NULL,ic,(RESULTONSTACK(ic) ? FALSE : TRUE)); \
     }  \
     else \
     { \
+       aopOp (IC_RESULT(ic),ic,TRUE, (AOP_TYPE(IC_LEFT(ic)) == AOP_DPTR) || \
+                                     (AOP_TYPE(IC_RIGHT(ic)) == AOP_DPTR)); \
        rc = FALSE; \
+       if (AOP_TYPE(IC_LEFT(ic)) == AOP_DPTR2 && \
+           AOP_TYPE(IC_RESULT(ic)) == AOP_DPTR2) \
+       { \
+            /* werror(E_INTERNAL_ERROR,__FILE__,__LINE__, */ \
+            fprintf(stderr,                                  \
+                    "Ack: got unexpected DP2! (%s:%d %s:%d)\n", __FILE__, __LINE__, ic->filename, ic->lineno);   \
+       } \
     }
 
 #define AOP_OP_2(ic) \
@@ -3024,6 +3031,10 @@ static void genPlus (iCode *ic)
     }
 #else
     AOP_OP_3_NOFATAL(ic, pushResult);
+    if (pushResult)
+    {
+        D(emitcode(";", "genPlus: must push result: 3 ops in far space"););
+    }
 #endif    
 
     if (!pushResult)