Fixed the lazy lazy DPTR for genCall and genPtrGet
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 17 Feb 2001 19:18:27 +0000 (19:18 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 17 Feb 2001 19:18:27 +0000 (19:18 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@619 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/ds390/gen.c

index 2e2989dc31ad29f0a5365146df12cdbf7820e8b8..ce33ecc5d570060fe5afc9b659bc92a47fc79b8b 100644 (file)
@@ -2185,10 +2185,13 @@ genCall (iCode * ic)
            {
              char *l = aopGet (AOP (IC_LEFT (sic)), offset,
                                FALSE, FALSE, TRUE);
-             if (strcmp (l, fReturn[offset]))
-               emitcode ("mov", "%s,%s",
+             if (strcmp (l, fReturn[offset])) {
+               genSetDPTR(0);
+               _flushLazyDPS();
+               emitcode ("mov", "%s,%s ;jwk lazy genCall",
                          fReturn[offset],
                          l);
+             }
              offset++;
            }
          _endLazyDPSEvaluation ();
@@ -7853,6 +7856,8 @@ genGenPointerGet (operand * left,
   sym_link *retype = getSpec (operandType (result));
   sym_link *letype = getSpec (operandType (left));
 
+  D (emitcode (";", "genGenPointerGet "); );
+
   aopOp (left, ic, FALSE, TRUE);
 
   /* if the operand is already in dptr
@@ -7868,10 +7873,27 @@ genGenPointerGet (operand * left,
       else
        {                       /* we need to get it byte by byte */
          _startLazyDPSEvaluation ();
-         emitcode ("mov", "dpl,%s", aopGet (AOP (left), 0, FALSE, FALSE, TRUE));
-         emitcode ("mov", "dph,%s", aopGet (AOP (left), 1, FALSE, FALSE, TRUE));
-         emitcode ("mov", "dpx,%s", aopGet (AOP (left), 2, FALSE, FALSE, TRUE));
-         emitcode ("mov", "b,%s", aopGet (AOP (left), 3, FALSE, FALSE, TRUE));
+         if (AOP(left)->type==AOP_DPTR2) {
+           char *l;
+           l=aopGet(AOP(left),0,FALSE,FALSE,TRUE);
+           genSetDPTR(0);
+           _flushLazyDPS();
+           emitcode ("mov", "dpl,%s", l);
+           l=aopGet(AOP(left),1,FALSE,FALSE,TRUE);
+           genSetDPTR(0);
+           _flushLazyDPS();
+           emitcode ("mov", "dph,%s", l);
+           l=aopGet(AOP(left),2,FALSE,FALSE,TRUE);
+           genSetDPTR(0);
+           _flushLazyDPS();
+           emitcode ("mov", "dpx,%s", l);
+           emitcode ("mov", "b,%s", aopGet (AOP(left),3,FALSE,FALSE,TRUE));
+         } else {
+           emitcode ("mov", "dpl,%s", aopGet (AOP(left),0,FALSE,FALSE,TRUE));
+           emitcode ("mov", "dph,%s", aopGet (AOP(left),1,FALSE,FALSE,TRUE));
+           emitcode ("mov", "dpx,%s", aopGet (AOP(left),2,FALSE,FALSE,TRUE));
+           emitcode ("mov", "b,%s", aopGet (AOP(left),3,FALSE,FALSE,TRUE));
+         }
          _endLazyDPSEvaluation ();
        }
     }
@@ -9228,7 +9250,6 @@ gen390Code (iCode * lic)
   /* if debug information required */
   if (options.debug && currFunc)
     {
-      //jwk if (currFunc) {
       cdbSymbol (currFunc, cdbFile, FALSE, TRUE);
       _G.debugLine = 1;
       if (IS_STATIC (currFunc->etype))