From: kvigor Date: Thu, 3 May 2001 21:44:16 +0000 (+0000) Subject: fix genDjnz to handle data in far space X-Git-Url: https://git.gag.com/?p=fw%2Fsdcc;a=commitdiff_plain;h=0dc374981b8fe9fca8eb4add0a8e33c9e0232b59 fix genDjnz to handle data in far space git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@767 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/ds390/gen.c b/src/ds390/gen.c index b1acf729..55d1fa29 100644 --- a/src/ds390/gen.c +++ b/src/ds390/gen.c @@ -4333,8 +4333,7 @@ genCmpLt (iCode * ic, iCode * ifx) sym_link *letype, *retype; int sign; - D (emitcode (";", "genCmpLt "); - ); + D (emitcode (";", "genCmpLt ");); left = IC_LEFT (ic); right = IC_RIGHT (ic); @@ -6848,8 +6847,7 @@ genLeftShift (iCode * ic) char *l; symbol *tlbl, *tlbl1; - D (emitcode (";", "genLeftShift "); - ); + D (emitcode (";", "genLeftShift ");); right = IC_RIGHT (ic); left = IC_LEFT (ic); @@ -9230,12 +9228,25 @@ genDjnz (iCode * ic, iCode * ifx) return 0; /* otherwise we can save BIG */ + D(emitcode(";", "genDjnz");); + lbl = newiTempLabel (NULL); lbl1 = newiTempLabel (NULL); aopOp (IC_RESULT (ic), ic, FALSE, FALSE); - if (IS_AOP_PREG (IC_RESULT (ic))) + if (AOP_NEEDSACC(IC_RESULT(ic))) + { + /* If the result is accessed indirectly via + * the accumulator, we must explicitly write + * it back after the decrement. + */ + emitcode ("dec", "%s", + aopGet(AOP(IC_RESULT(ic)), 0, FALSE, FALSE, FALSE)); + aopPut(AOP(IC_RESULT(ic)), "acc", 0); + emitcode ("jnz", "%05d$", lbl->key + 100); + } + else if (IS_AOP_PREG (IC_RESULT (ic))) { emitcode ("dec", "%s", aopGet (AOP (IC_RESULT (ic)), 0, FALSE, FALSE, FALSE));