From: MaartenBrock Date: Wed, 4 Jun 2008 16:04:39 +0000 (+0000) Subject: * .version, X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=066cd8ebd4f07ca4e8777d238da4313f8915169f;p=fw%2Fsdcc * .version, * 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 --- diff --git a/.version b/.version index dbe59006..1817afea 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -2.8.1 +2.8.2 diff --git a/ChangeLog b/ChangeLog index fe5c6dee..9755162b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2008-06-04 Maarten Brock + * .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 diff --git a/doc/sdccman.lyx b/doc/sdccman.lyx index 4a3b1547..0abeacc6 100644 --- a/doc/sdccman.lyx +++ b/doc/sdccman.lyx @@ -104,7 +104,7 @@ SDCC Compiler User Guide \begin_layout Date \size normal -SDCC 2.8.1 +SDCC 2.8.2 \size footnotesize \newline diff --git a/src/ds390/gen.c b/src/ds390/gen.c index 74e31a5c..728bf80d 100644 --- a/src/ds390/gen.c +++ b/src/ds390/gen.c @@ -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