* .version,
authorMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 4 Jun 2008 16:04:39 +0000 (16:04 +0000)
committerMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 4 Jun 2008 16:04:39 +0000 (16:04 +0000)
* doc/sdccman.lyx: bumped sdcc version to 2.8.2
* src/ds390/gen.c (aopPutUsesAcc, genAddrOf): fixed bug 1015185

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5192 4a8a32a2-be11-0410-ad9d-d568d2c75423

.version
ChangeLog
doc/sdccman.lyx
src/ds390/gen.c

index dbe590065479b394ecabbd44460125ae5fe544bf..1817afea416c4a8e4814d22f5f4b2dcf4b0807e6 100644 (file)
--- a/.version
+++ b/.version
@@ -1 +1 @@
-2.8.1
+2.8.2
index fe5c6dee2aa46d95b423456aa340c4cdf19f5cf5..9755162bf0c2a7ad25eec0a29f3ebdcc85ed8aa2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2008-06-04 Maarten Brock <sourceforge.brock AT dse.nl>
 
+       * .version,
+       * doc/sdccman.lyx: bumped sdcc version to 2.8.2
+       * src/ds390/gen.c (aopPutUsesAcc, genAddrOf): fixed bug 1015185
        * src/mcs51/gen.c (genNearPointerGet, genNearPointerSet): fixed bug 1938300
        * support/regression/tests/bug1938300.c: new, added
 
index 4a3b1547ad44f441eb6ca842e654c186d6384e38..0abeacc6ba1ceb4c5b3c9e5f71f81d81cb702557 100644 (file)
@@ -104,7 +104,7 @@ SDCC Compiler User Guide
 \begin_layout Date
 
 \size normal
-SDCC 2.8.1
+SDCC 2.8.2
 \size footnotesize
 
 \newline
index 74e31a5cb440ab3ad94bb844282fd6254975f78d..728bf80d088021b4ed129492f6d648e491c4b15e 100644 (file)
@@ -1668,6 +1668,52 @@ aopGet (operand * oper,
   return NULL;  // not reached, but makes compiler happy.
 }
 
+/*-----------------------------------------------------------------*/
+/* aopPutUsesAcc - indicates ahead of time whether aopPut() will   */
+/*                 clobber the accumulator                         */
+/*-----------------------------------------------------------------*/
+static bool
+aopPutUsesAcc (operand * oper, const char *s, int offset)
+{
+  asmop * aop = AOP (oper);
+
+  if (offset > (aop->size - 1))
+    return FALSE;
+
+  switch (aop->type)
+    {
+    case AOP_DUMMY:
+      return TRUE;
+    case AOP_DIR:
+      return FALSE;
+    case AOP_REG:
+      wassert(strcmp(aop->aopu.aop_reg[offset]->name, "a"));
+      return FALSE;
+    case AOP_DPTRn:
+      return FALSE;
+    case AOP_DPTR:
+    case AOP_DPTR2:
+      return TRUE;
+    case AOP_R0:
+    case AOP_R1:
+      return ((aop->paged) || (*s == '@'));
+    case AOP_STK:
+      return (*s == '@');
+    case AOP_CRY:
+      return (!aop->aopu.aop_dir || strcmp(s, aop->aopu.aop_dir));
+    case AOP_STR:
+      return FALSE;
+    case AOP_IMMD:
+      return FALSE;
+    case AOP_ACC:
+      return FALSE;
+    default:
+      /* Error case --- will have been caught already */
+      wassert(0);
+      return FALSE;
+    }
+}
+
 /*-----------------------------------------------------------------*/
 /* aopPut - puts a string for a aop and indicates if acc is in use */
 /*-----------------------------------------------------------------*/
@@ -11937,6 +11983,7 @@ genAddrOf (iCode * ic)
 {
   symbol *sym = OP_SYMBOL (IC_LEFT (ic));
   int size, offset;
+  bool pushedA = FALSE;
 
   D (emitcode (";", "genAddrOf"));
 
@@ -11977,7 +12024,14 @@ genAddrOf (iCode * ic)
 
               emitcode ("addc","a,#!constbyte", offset);
 
+              if (aopPutUsesAcc (IC_RESULT (ic), "b", 0))
+                {
+                  emitcode ("push", "acc");
+                  pushedA = TRUE;
+                }
               aopPut (IC_RESULT (ic), "b", 0);
+              if (pushedA)
+                  emitcode ("pop", "acc");
               aopPut (IC_RESULT (ic), "a", 1);
               aopPut (IC_RESULT (ic), buff, 2);
           } else {
@@ -12056,7 +12110,6 @@ genAddrOf (iCode * ic)
 
 release:
   freeAsmop (IC_RESULT (ic), NULL, ic, TRUE);
-
 }
 
 #if 0 // obsolete, and buggy for != xdata